Commit 044e4da4 by 胡悦

first submit

0 parents
> 1%
last 2 versions
not ie <= 8
root = true
[*]
charset = utf-8
indent_style = space
indent_size = 2
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
/build/
/config/
/dist/
/*.js
module.exports = {
root: true,
env: {
node: true
},
'extends': [
'plugin:vue/essential',
'@vue/prettier'
],
rules: {
'no-console': process.env.NODE_ENV === 'production' ? 'error' : 'off',
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off'
},
parserOptions: {
parser: 'babel-eslint'
}
}
module.exports = {
root: true,
parser: 'babel-eslint',
parserOptions: {
sourceType: 'module'
},
env: {
browser: true,
node: true,
es6: true,
},
extends: 'eslint:recommended',
// required to lint *.vue files
plugins: [
'html'
],
// check if imports actually resolve
'settings': {
'import/resolver': {
'webpack': {
'config': 'build/webpack.base.conf.js'
}
}
},
// add your custom rules here
//it is base on https://github.com/vuejs/eslint-config-vue
rules: {
'accessor-pairs': 2,
'arrow-spacing': [2, {
'before': true,
'after': true
}],
'block-spacing': [2, 'always'],
'brace-style': [2, '1tbs', {
'allowSingleLine': true
}],
'camelcase': [0, {
'properties': 'always'
}],
'comma-dangle': [2, 'never'],
'comma-spacing': [2, {
'before': false,
'after': true
}],
'comma-style': [2, 'last'],
'constructor-super': 2,
'curly': [2, 'multi-line'],
'dot-location': [2, 'property'],
'eol-last': 2,
'eqeqeq': [2, 'allow-null'],
'generator-star-spacing': [2, {
'before': true,
'after': true
}],
'handle-callback-err': [2, '^(err|error)$'],
'indent': [2, 2, {
'SwitchCase': 1
}],
'jsx-quotes': [2, 'prefer-single'],
'key-spacing': [2, {
'beforeColon': false,
'afterColon': true
}],
'keyword-spacing': [2, {
'before': true,
'after': true
}],
'new-cap': [2, {
'newIsCap': true,
'capIsNew': false
}],
'new-parens': 2,
'no-array-constructor': 2,
'no-caller': 2,
'no-console': 'off',
'no-class-assign': 2,
'no-cond-assign': 2,
'no-const-assign': 2,
'no-control-regex': 2,
'no-delete-var': 2,
'no-dupe-args': 2,
'no-dupe-class-members': 2,
'no-dupe-keys': 2,
'no-duplicate-case': 2,
'no-empty-character-class': 2,
'no-empty-pattern': 2,
'no-eval': 2,
'no-ex-assign': 2,
'no-extend-native': 2,
'no-extra-bind': 2,
'no-extra-boolean-cast': 2,
'no-extra-parens': [2, 'functions'],
'no-fallthrough': 2,
'no-floating-decimal': 2,
'no-func-assign': 2,
'no-implied-eval': 2,
'no-inner-declarations': [2, 'functions'],
'no-invalid-regexp': 2,
'no-irregular-whitespace': 2,
'no-iterator': 2,
'no-label-var': 2,
'no-labels': [2, {
'allowLoop': false,
'allowSwitch': false
}],
'no-lone-blocks': 2,
'no-mixed-spaces-and-tabs': 2,
'no-multi-spaces': 2,
'no-multi-str': 2,
'no-multiple-empty-lines': [2, {
'max': 1
}],
'no-native-reassign': 2,
'no-negated-in-lhs': 2,
'no-new-object': 2,
'no-new-require': 2,
'no-new-symbol': 2,
'no-new-wrappers': 2,
'no-obj-calls': 2,
'no-octal': 2,
'no-octal-escape': 2,
'no-path-concat': 2,
'no-proto': 2,
'no-redeclare': 2,
'no-regex-spaces': 2,
'no-return-assign': [2, 'except-parens'],
'no-self-assign': 2,
'no-self-compare': 2,
'no-sequences': 2,
'no-shadow-restricted-names': 2,
'no-spaced-func': 2,
'no-sparse-arrays': 2,
'no-this-before-super': 2,
'no-throw-literal': 2,
'no-trailing-spaces': 2,
'no-undef': 2,
'no-undef-init': 2,
'no-unexpected-multiline': 2,
'no-unmodified-loop-condition': 2,
'no-unneeded-ternary': [2, {
'defaultAssignment': false
}],
'no-unreachable': 2,
'no-unsafe-finally': 2,
'no-unused-vars': [2, {
'vars': 'all',
'args': 'none'
}],
'no-useless-call': 2,
'no-useless-computed-key': 2,
'no-useless-constructor': 2,
'no-useless-escape': 0,
'no-whitespace-before-property': 2,
'no-with': 2,
'one-var': [2, {
'initialized': 'never'
}],
'operator-linebreak': [2, 'after', {
'overrides': {
'?': 'before',
':': 'before'
}
}],
'padded-blocks': [2, 'never'],
'quotes': [2, 'single', {
'avoidEscape': true,
'allowTemplateLiterals': true
}],
'semi': [2, 'never'],
'semi-spacing': [2, {
'before': false,
'after': true
}],
'space-before-blocks': [2, 'always'],
'space-before-function-paren': [2, 'never'],
'space-in-parens': [2, 'never'],
'space-infix-ops': 2,
'space-unary-ops': [2, {
'words': true,
'nonwords': false
}],
'spaced-comment': [2, 'always', {
'markers': ['global', 'globals', 'eslint', 'eslint-disable', '*package', '!', ',']
}],
'template-curly-spacing': [2, 'never'],
'use-isnan': 2,
'valid-typeof': 2,
'wrap-iife': [2, 'any'],
'yield-star-spacing': [2, 'both'],
'yoda': [2, 'never'],
'prefer-const': 2,
'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0,
'object-curly-spacing': [2, 'always', {
objectsInObjects: false
}],
'array-bracket-spacing': [2, 'never']
}
}
.DS_Store
node_modules
/dist
# local env files
.env.local
.env.*.local
# Log files
npm-debug.log*
yarn-debug.log*
yarn-error.log*
# Editor directories and files
.idea
.vscode
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw*
module.exports = {
plugins: {
autoprefixer: {}
}
}
{
"semi": false,
"singleQuote": true
}
\ No newline at end of file
module.exports = {
presets: ["@vue/app"]
};
This file is too large to display.
This diff could not be displayed because it is too large.
{
"name": "glsx-oss-carowner",
"version": "1.0.0",
"description": "车家管理平台",
"author": "huyue <huyue@didihu.com.cn>",
"private": true,
"scripts": {
"serve": "vue-cli-service serve",
"build": "vue-cli-service build",
"lint": "vue-cli-service lint"
},
"dependencies": {
"axios": "^0.18.0",
"element-ui": "^2.15.1",
"glsx-vue-common": "^1.2.1",
"lodash": "^4.17.10",
"node-sass": "^4.9.3",
"sass-loader": "^7.1.0",
"vue": "^2.5.17"
},
"devDependencies": {
"@vue/cli-plugin-babel": "^3.0.1",
"@vue/cli-plugin-eslint": "^3.0.1",
"@vue/cli-service": "^3.0.1",
"@vue/eslint-config-prettier": "^3.0.1",
"eslint-plugin-html": "^4.0.5",
"less": "^3.0.4",
"less-loader": "^4.1.0",
"vue-template-compiler": "^2.5.17"
}
}
No preview for this file type
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<!-- <link rel="icon" href="<%= BASE_URL %>favicon.ico"> -->
<title><%= htmlWebpackPlugin.options.title %></title>
</head>
<body>
<noscript>
<strong>We're sorry but multiple-pages doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
</noscript>
<div id="app"></div>
<!-- built files will be auto injected -->
</body>
</html>
import { GlAxios } from 'glsx-vue-common'
const path = '/smartAdmin/product/'
function getList(params) {
return GlAxios.get(`${path}getList`, { params })
}
export { getList }
// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
// import GlsxVueComponents from 'glsx-vue-components'
// import 'glsx-vue-components/dist/glsx-vue-components.css'
import { Request as request } from 'glsx-vue-common'
import '@/styles/index.scss'
// 组件
import '@/components'
// import _ from 'lodash'
// import axios from 'axios'
Vue.use(ElementUI)
// var mixin = {
// mounted() {
// const _this = this
// const theme = new this.$Theme()
// const connection = this.$Penpal.connectToParent({
// methods: {
// setTheme(color) {
// theme.change(color)
// },
// height() {
// return document.height || document.body.offsetHeight // document.documentElement.clientHeight || document.body.clientHeight //
// }
// }
// })
// connection.promise.then(parent => {
// const cfg = _this.$get_session_config()
// if (cfg) return
// parent.getResources().then(config => {
// _this.$set_session_config(config)
// })
// })
// }
// }
const URL = 'https://oss-config.test.glsx.com.cn/mock/5be17454f31545347559d499/config'
const getConfig = (url = URL + '/oss_carowner_config') => {
return new Promise((resolve, reject) => {
request({ url }).then(res => {
if (res.status === 'success') {
resolve({ 'vue': Vue, 'config': JSON.parse(res.data) })
} else {
reject('ERROR.')
}
})
})
}
/* eslint-disable no-new */
const render = App => {
new Vue({
el: '#app',
// mixins: [mixin],
render: h => h(App)
})
}
export default { render, getConfig }
<!-- 表格+分页 -->
<template>
<div class="d2-table">
<el-table
:ref="tableParams.mutiSelectName + 'MutiTable' || 'mutiTable'"
:data="getListApi ? data : tableData"
:row-key="tableParams.mutiSelectUniqueKey || ''"
v-loading="loading"
border
:highlight-current-row="true"
:stripe="true"
@sort-change="sortChange"
@selection-change="handleSelect"
size="medium"
>
<el-table-column
v-if="tableParams.mutiSelectUniqueKey && tableParams.mutiSelectName"
type="selection"
width="55"
:reserve-selection="true"
>
</el-table-column>
<el-table-column
v-if="hasNum"
align="center"
width="60px"
label="序号"
type='index'
:index="index=>index+(page.currentPage - 1) * page.pageSize + 1"
></el-table-column>
<el-table-column
v-for="(item, index) in tableParams.tableColumns"
:key="index"
:label="item.label"
:prop="item.prop"
:width="item.width"
:min-width="item.minWidth"
:align="item.align||'center'"
:sortable="item.sortable"
>
<template slot-scope="scope">
<slot
v-if="item.addHtml"
:name="item.addHtml"
:scope="scope.row"
:prop="item.prop"
:width="item.width"
></slot>
<template v-else-if="item.tagLabel">
<el-tag
v-if="!item.tagName"
:type="tableParams.tag.type[scope.row[item.prop]]"
v-text="tableParams.tag.label[scope.row[item.prop]]"
>
</el-tag>
<el-tag
v-else
:type="tableParams[item.tagName].type[scope.row[item.prop]]"
v-text="tableParams[item.tagName].label[scope.row[item.prop]]"
></el-tag>
</template>
<template v-else-if="item.formatter">
<span v-text="item.formatter(scope.row)"></span>
</template>
<template v-else-if="getListApi">
<span v-text="scope.row[item.prop]"></span>
</template>
<template v-else>
<span v-text="tableData[scope.$index][item.prop]"></span>
</template>
<template v-if="item.addSymbol">
<span v-text="item.addSymbol"></span>
</template>
</template>
</el-table-column>
<el-table-column
v-if="tableParams.tableOption"
label="操作"
:align="tableParams.tableOption.align||'center'"
:width="tableParams.tableOption.width||'200'"
fixed="right"
>
<template slot-scope="scope">
<slot
name="auth-button"
:scope="scope.row"
></slot>
</template>
</el-table-column>
</el-table>
<el-pagination
v-if="hasPage"
background
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:current-page="page.currentPage"
:page-sizes="[10,20,30,40]"
:page-size="page.pageSize"
:total="getListApi ? total : tableTotal"
:layout="layout"
>
</el-pagination>
</div>
</template>
<script>
export default {
name: 'd2-table',
data() {
return {
loading: false,
data: [],
// 页码
page: {
pageSize: 10,
currentPage: 1
},
total: 10,
// 排序
sortColum: '',
sort: '',
// 多选数组
mutiSelectArr: {}
}
},
props: {
// 搜索条件
searchForm: {
type: Object,
default: () => []
},
// 表格数据-外部传入
tableData: {
type: Array,
default: () => [
{
name: 1212,
status: 1
}
]
},
tableTotal: {
type: Number,
default: 0
},
// 获取列表接口
getListApi: {
type: Function,
default: null
},
// 搜索前操作
beforeSearchFn: {
type: Function,
default: () => {
return new Promise((resolve, reject) => {
resolve()
})
}
},
// 分页,默认有
hasPage: {
type: Boolean,
default: true
},
// 分页组件配置
layout: {
type: String,
default: 'sizes,total,->,prev,pager,next,jumper'
},
// 序号,默认有
hasNum: {
type: Boolean,
default: true
},
tableParams: {
type: Object,
default: () => {
return {
// 多选-判断来自哪个页面
// mutiSelectName: {
// type: String,
// default: ''
// },
// 多选-唯一标识
// mutiSelectUniqueKey: {
// type: String,
// default: ''
// },
// 搜索按钮id;new Date().getTime() + parseInt(Math.random() * 1000)
// btnId: {
// type: String,
// default: ''
// },
// 后端返回列表参数名
listName: {
type: String,
default: ''
},
// 标签-默认标签名为tag;若有多个,那么需要在表格栏的列中加“tagName”
// tag: {
// type: Array,
// default: () => []
// },
// 表格操作,默认没有
// tableOption: {
// type: Object,
// default: null
// },
// 表格栏
tableColumns: {
type: Array,
default: () => []
}
}
}
}
},
mounted() {
const btn = document.getElementById(this.tableParams.btnId)
btn && btn.addEventListener('click', this.refreshEmit)
this.getListApi && this.refreshTable()
},
methods: {
// 排序
sortChange({ column, prop, order }) {
this.sortColum = order ? prop : ''
this.sort = order
this.refreshTable()
},
// 多选
handleSelect(val) {
this.mutiSelectArr[this.tableParams.mutiSelectName] = val
},
// 清空多选
clearMutiSelect() {
this.mutiSelectArr[this.tableParams.mutiSelectName] = []
this.$refs[this.tableParams.mutiSelectName + 'MutiTable'].clearSelection()
},
// 发布事件,以期查询条件改变后,页面图表需要刷新
refreshEmit() {
this.$emit('searchChange')
this.refreshTable(true, true)
},
refreshTable(clearMuti = true, resetCurrentPage = false) {
this.beforeSearchFn().then(res => {
// console.log(res)
// 清空多选
clearMuti && this.clearMutiSelect()
this.loading = true
resetCurrentPage && (this.page.currentPage = 1)
var params = {
...this.page,
...this.searchForm
}
if (this.sort) {
params.sortColum = this.sortColum
params.sort = this.sort === 'descending' ? 1 : 0
}
this.getListApi(params).then(res => {
this.data = res[this.tableParams.listName]
this.total = res.pagination.totalCount
this.loading = false
}).catch(() => {
this.loading = false
})
})
},
// 每页条数
handleSizeChange(value) {
this.page.pageSize = value
this.getListApi ? this.refreshTable(false) : this.$emit('refreshTable', this.page)
},
// 页码
handleCurrentChange(value) {
this.page.currentPage = value
this.getListApi ? this.refreshTable(false) : this.$emit('refreshTable', this.page)
}
}
}
</script>
<style>
.a-click {
cursor: pointer;
}
.el-table .cell {
line-height: 14px;
}
.d2-table p {
margin: 10px 0;
}
</style>
<template>
<el-dialog
:title="title"
:visible.sync="isVisible"
>
<slot></slot>
<div
slot="footer"
class="dialog-footer"
>
<el-button
type="primary"
@click="handleConfirm"
>确 定</el-button>
<el-button @click="handleClose">取 消</el-button>
</div>
</el-dialog>
</template>
<script>
export default {
name: 'GlsxDialog',
props: {
title: {
type: String,
default: null
},
isVisible: {
type: Boolean,
default: false
}
},
data() {
return {
}
},
methods: {
handleClose() {
this.$emit('closeDialog')
},
handleConfirm() {
this.$emit('confirmDialog')
}
}
}
</script>
\ No newline at end of file
import Vue from 'vue'
// 注意 有些组件使用异步加载会有影响
Vue.component('d2-table', () => import('./d2-table/index.vue'))
Vue.component('glsx-dialog', () => import('./glsx-dialog/index.vue'))
body {
overflow: hidden;
height: 100%;
-moz-osx-font-smoothing: grayscale;
-webkit-font-smoothing: antialiased;
text-rendering: optimizeLegibility;
font-family: Helvetica Neue, Helvetica, PingFang SC, Hiragino Sans GB, Microsoft YaHei, Arial, sans-serif;
}
html {
height: 100%;
box-sizing: border-box;
}
#app {
height: 100%;
}
*,
*:before,
*:after {
box-sizing: inherit;
}
hr {
height: 1px;
border: 0px;
background-color: #e7eaec
}
a,
a:focus,
a:hover {
cursor: pointer;
color: inherit;
outline: none;
text-decoration: none;
}
div:focus {
outline: none;
}
a:focus,
a:active {
outline: none;
}
a,
a:focus,
a:hover {
cursor: pointer;
color: inherit;
text-decoration: none;
}
.clearfix {
&:after {
visibility: hidden;
display: block;
font-size: 0;
content: " ";
clear: both;
height: 0;
}
}
//main-container全局样式
.app-main {
overflow: auto;
}
.app-container {
padding: 20px;
}
// element
.el-table--medium td {
padding: 4px 0 !important;
}
.el-table .cell {
padding: 0 0;
}
// common样式
.m-t-sm {
margin-top: 20px;
}
import App from './index.vue'
import base from '@/base'
import GlsxVueCommon from 'glsx-vue-common'
base.getConfig().then(data => {
const { vue, config } = data
vue.use(GlsxVueCommon, config)
base.render(App)
})
<template>
<div>
<el-steps
:active="active"
simple
finish-status="success"
>
<el-step
icon="el-icon-edit"
title="场景基础信息"
></el-step>
<el-step
icon="el-icon-edit"
title="场景规则"
></el-step>
</el-steps>
<el-form
v-if="active == 1"
style="margin: 20px 0;"
:model="basicForm"
:rules="basicRules"
ref="basicForm"
label-width="100px"
>
<el-form-item
label="场景名称"
prop="name"
>
<el-input
class="w-217"
v-model="basicForm.name"
show-word-limit
maxlength="10"
></el-input>
</el-form-item>
<el-form-item
label="场景类型"
prop="name"
>
<el-select
v-model="basicForm.region"
placeholder="请选择活动区域"
>
<el-option
label="区域一"
value="shanghai"
></el-option>
<el-option
label="区域二"
value="beijing"
></el-option>
</el-select>
</el-form-item>
<el-form-item
label="场景图标"
prop="name"
>
<el-select
v-model="value"
placeholder="请选择"
>
<el-option
v-for="item in cities"
:key="item.value"
:label="item.label"
:value="item.value"
>
<span style="float: left">{{ item.label }}</span>
<img
style="float: right;width: 30px;height: 30px;margin-top: 2px;"
src="../../../assets/auth-bg.jpg"
alt=""
>
</el-option>
</el-select>
<img
style="width: 50px;height: 50px; vertical-align: middle;margin-left: 20px;"
src="../../../assets/auth-bg.jpg"
alt=""
>
</el-form-item>
<el-form-item
label="场景背景图"
prop="name"
>
<!-- <img
:src="imgUrl"
alt=""
> -->
<el-image>
<div
slot="error"
class="image-slot"
>
<i class="el-icon-picture-outline"></i>
</div>
</el-image>
<el-button
class="import-btn"
style="display: block;"
type="primary"
>上传图片
<input
type="file"
id="fileUpload"
class="import-input"
multiple="3"
accept="image/png, image/jpeg, image/jpg"
@change="uploadImg($event)"
/>
</el-button>
</el-form-item>
<el-form-item
label="场景描述"
prop="name"
>
<el-input
type="textarea"
placeholder="请输入内容"
v-model="basicForm.textarea"
:rows="5"
maxlength="500"
show-word-limit
>
</el-input>
</el-form-item>
</el-form>
<el-form
v-if="active == 2"
:model="ruleForm"
:rules="scenarioRules"
ref="scenarioForm"
label-width="150px"
>
<el-form-item
label="场景触发条件规则"
prop="name"
>
<el-radio
v-model="ruleForm.radio"
label="1"
>满足任一条件触发</el-radio>
<el-radio
v-model="radio"
label="2"
>满足全部条件触发</el-radio>
</el-form-item>
<el-form-item
label="场景执行周期"
prop="name"
>
<el-select
v-model="value"
placeholder="请选择"
>
<el-option
v-for="item in options"
:key="item.value"
:label="item.label"
:value="item.value"
>
</el-option>
</el-select>
</el-form-item>
</el-form>
<!-- <img
:src="imgUrl"
alt=""
>
<el-button
class="import-btn"
style="display: block;"
type="primary"
>上传图片
<input
type="file"
id="fileUpload"
class="import-input"
multiple="3"
accept="image/png, image/jpeg, image/jpg"
@change="uploadImg($event)"
/>
</el-button>
<el-upload
class="avatar-uploader"
action="https://jsonplaceholder.typicode.com/posts/"
:show-file-list="false"
:on-success="handleAvatarSuccess"
:before-upload="beforeAvatarUpload"
>
<img
v-if="imageUrl"
:src="imageUrl"
class="avatar"
>
<i
v-else
class="el-icon-plus avatar-uploader-icon"
></i>
</el-upload> -->
<el-button
style="margin-top: 12px;"
@click="last"
>上一步</el-button>
<el-button
style="margin-top: 12px;"
@click="next"
>下一步</el-button>
</div>
</template>
<script>
export default {
data() {
return {
active: 1,
basicForm: {},
basicRules: {},
cities: [{
value: 'Beijing',
label: '北京'
}, {
value: 'Shanghai',
label: '上海'
}, {
value: 'Nanjing',
label: '南京'
}, {
value: 'Chengdu',
label: '成都'
}, {
value: 'Shenzhen',
label: '深圳'
}, {
value: 'Guangzhou',
label: '广州'
}],
value: '',
ruleForm: {},
scenarioRules: {}
// imageUrl: '',
// imgUrl: ''
}
},
methods: {
last() {
this.active = 1
},
next() {
this.active = 2
}
// handleAvatarSuccess(res, file) {
// this.imageUrl = URL.createObjectURL(file.raw)
// },
// beforeAvatarUpload(file) {
// console.log(file)
// const isJPG = file.type === 'image/jpeg'
// const isLt2M = file.size / 1024 / 1024 < 2
// if (!isJPG) {
// this.$message.error('上传头像图片只能是 JPG 格式!')
// }
// if (!isLt2M) {
// this.$message.error('上传头像图片大小不能超过 2MB!')
// }
// return isJPG && isLt2M
// },
// uploadImg(e) {
// console.log(e)
// const file = e.target.files[0]
// this.imgUrl = window.URL.createObjectURL(file)
// }
}
}
</script>
<style>
.avatar-uploader .el-upload {
border: 1px dashed #d9d9d9;
border-radius: 6px;
cursor: pointer;
position: relative;
overflow: hidden;
}
.avatar-uploader .el-upload:hover {
border-color: #409eff;
}
.avatar-uploader-icon {
font-size: 28px;
color: #8c939d;
width: 178px;
height: 178px;
line-height: 178px;
text-align: center;
}
.avatar {
width: 178px;
height: 178px;
display: block;
}
.import-btn {
position: relative;
}
.import-input {
opacity: 0;
position: absolute;
right: 0;
top: 0;
width: 70px;
height: 36px;
cursor: pointer;
font-size: 0;
}
.w-217 {
width: 217px !important;
}
</style>
\ No newline at end of file
import App from './index.vue'
import base from '@/base'
import GlsxVueCommon from 'glsx-vue-common'
base.getConfig().then(data => {
const { vue, config } = data
vue.use(GlsxVueCommon, config)
base.render(App)
})
<!-- -->
<template>
<div>
<a href="http://www.glsx.com.cn/">广联赛讯主页</a>
</div>
</template>
<script>
export default {
data() {
return {
}
}
}
</script>
<style scoped>
</style>
import App from './index.vue'
import base from '@/base'
import GlsxVueCommon from 'glsx-vue-common'
base.getConfig().then(data => {
const { vue, config } = data
vue.use(GlsxVueCommon, config)
base.render(App)
})
<template>
<div>
<el-button
class="import-btn"
style="display: block;"
type="primary"
>上传图标
<input
type="file"
id="fileUpload"
class="import-input"
multiple="3"
accept="image/png, image/jpeg, image/jpg"
@change="uploadImg($event)"
/>
</el-button>
<ul>
<li
v-for="item in iconList"
:key="item.id"
>
<el-image
style="width: 100px; height: 100px"
:src="item.src"
></el-image>
<div>{{item.name}}</div>
<el-button type="text">更新</el-button>
</li>
</ul>
</div>
</template>
<script>
export default {
data() {
return {
iconList: [
{
id: 1,
src: 'https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg',
name: 'deng_01'
},
{
id: 2,
src: '@/assets/auth-bg.jpg',
name: 'deng_02'
},
{
id: 3,
src: '@/assets/auth-bg.jpg',
name: 'deng_03'
},
{
id: 4,
src: '@/assets/auth-bg.jpg',
name: 'deng_04'
}
]
}
},
methods: {
uploadImg(e) {
const size = e.target.files[0].size / 1024 / 1024
if (size < 20) {
if (name) this.$set(this.ruleForm, name, e.target.files[0].name)
// // 转码base64
const reader = new FileReader()
reader.readAsDataURL(e.target.files[0])
reader.onload = event => {
const imgFile = event.target.result
const arrBase64 = imgFile.split(',')
const fileInfo = e.target.files[0].name.split('.')[1] + '@' + arrBase64[1]
this.$set(this.ruleForm, 'showContent', fileInfo)
// this.ruleForm.showContent = e.target.files[0].name.split('.')[1] + '@' + arrBase64[1]
// this.request({
// fileName: e.target.files[0].name.split('.')[0],
// file: fileInfo
// })
}
} else {
this.notice.errorTips('上传文件不可超过20M')
}
}
}
}
</script>
<style scope>
ul,
li {
list-style: none;
}
ul {
display: flex;
}
li {
width: 150px;
text-align: center;
}
.import-btn {
position: relative;
}
.import-input {
opacity: 0;
position: absolute;
right: 0;
top: 0;
width: 70px;
height: 36px;
cursor: pointer;
font-size: 0;
}
</style>
\ No newline at end of file
import App from './index.vue'
import base from '@/base'
import GlsxVueCommon from 'glsx-vue-common'
base.getConfig().then(data => {
const { vue, config } = data
vue.use(GlsxVueCommon, config)
base.render(App)
})
<template>
<div>
<el-button
type="primary"
@click="switchDialog"
>新增产品</el-button>
<d2-table
class="m-t-sm"
:searchForm="productSearchForm"
:tableParams="productTableParams"
:getListApi="getListApi"
>
<img
slot="thumb"
slot-scope="scope"
class="pro-img"
src="@/assets/logo.png"
/>
<span
slot="auth-button"
slot-scope="scope"
>
<el-button
type="text"
@click="handleProEdit(scope.scope)"
>下架</el-button>
<el-button
type="text"
@click="handleProEdit(scope.scope)"
>指令集</el-button>
</span>
</d2-table>
<glsx-dialog
:isVisible="visible"
:title="'新增产品'"
@closeDialog="switchDialog"
@confirmDialog="handleSubmit"
>
<slot>
<el-form
:model="productRuleForm"
:rules="productRules"
ref="productRuleForm"
label-width="100px"
>
<el-form-item
v-for="item in productFormList"
:key="item.label"
:label="item.label"
:prop="item.prop"
>
<template v-if="item.type == 'input'">
<el-input
v-if="item.limit"
type="text"
:placeholder="item.placeholder || '请输入'"
v-model="productRuleForm[item.prop]"
:maxlength="item.maxlength || 10"
show-word-limit
></el-input>
<el-input
v-else
type="text"
:placeholder="item.placeholder || '请输入'"
v-model="productRuleForm[item.prop]"
></el-input>
</template>
<template v-else-if="item.type == 'select'">
<el-select
v-model="productRuleForm[item.prop]"
:placeholder="item.placeholder || '请选择'"
>
<el-option
v-for="i in item.options"
:key="i.value"
:label="i.label"
:value="i.value"
>
</el-option>
</el-select>
</template>
<template v-else-if="item.type == 'thumb'">
<el-button
class="import-btn"
style="display: block;"
type="primary"
>上传图片
<input
type="file"
id="fileUpload"
class="import-input"
accept="image/png, image/jpeg, image/jpg"
@change="uploadImg($event)"
/>
</el-button>
</template>
</el-form-item>
</el-form>
</slot>
</glsx-dialog>
</div>
</template>
<script>
import { getList } from '../../../api/product'
export default {
data() {
return {
productSearchForm: {},
productTableParams: {
btnId: new Date().getTime() + parseInt(Math.random() * 1000),
listName: 'list',
tableOption: true,
tableColumns: [
{
label: '产品名称',
prop: 'name'
},
{
label: '缩略图',
prop: '',
addHtml: 'thumb'
},
{
label: '商城ID',
prop: ''
},
{
label: '产品类型',
prop: ''
},
{
label: '接入平台',
prop: 'netWork'
},
{
label: '配网方式',
prop: ''
},
{
label: '状态',
prop: ''
}
]
},
getListApi: getList,
visible: false,
productRuleForm: {},
productRules: {
name: [{ required: true, message: '请输入类型名称', trigger: 'blur' }],
type: [{ required: true, message: '请选择类型名称', trigger: 'change' }],
shopId: [{ required: true, message: '请选择类型名称', trigger: 'change' }],
label: [{ required: true, message: '请选择类型名称', trigger: 'change' }]
},
productFormList: [
{
label: '产品名称:',
prop: 'name',
type: 'input',
placeholder: '请输入名称',
maxlength: 15,
limit: true
},
{
label: '缩略图:',
prop: '',
type: 'thumb'
},
{
label: '产品分类:',
prop: 'type',
type: 'select',
options: [
{
label: '车载智能',
value: '1'
},
{
label: '智能家居',
value: '2'
}
]
},
{
label: '商城ID:',
prop: 'shopId',
type: 'input'
},
{
label: '接入平台:',
prop: 'label',
type: 'select',
options: []
},
{
label: '配网方式:',
prop: 'label',
type: 'select',
options: []
}
],
formParams: {}
}
},
mounted() {
// getList({}).then(res => {
// console.log(res)
// })
},
methods: {
switchDialog() {
this.visible = !this.visible
if (!this.visible) this.$refs.productRuleForm.resetFields()
},
handleSubmit() {
console.log(this.productRuleForm)
this.$refs.productRuleForm.validate((valid) => {
if (valid) {
alert('submit!')
this.visible = !this.visible
} else {
console.log('error submit!!')
return false
}
})
},
uploadImg(e) {
console.log(e)
const size = e.target.files[0].size / 1024 / 1024
if (size < 20) {
if (name) this.$set(this.productRuleForm, name, e.target.files[0].name)
// // 转码base64
const reader = new FileReader()
console.log(e.target.files[0])
reader.readAsDataURL(e.target.files[0])
reader.onload = event => {
const imgFile = event.target.result
const arrBase64 = imgFile.split(',')
const fileInfo = e.target.files[0].name.split('.')[1] + '@' + arrBase64[1]
this.$set(this.productRuleForm, 'showContent', fileInfo)
// this.ruleForm.showContent = e.target.files[0].name.split('.')[1] + '@' + arrBase64[1]
}
} else {
this.notice.errorTips('上传文件不可超过20M')
}
}
}
}
</script>
<style scoped>
.import-btn {
position: relative;
}
.import-input {
opacity: 0;
position: absolute;
right: 0;
top: 0;
width: 70px;
height: 36px;
cursor: pointer;
font-size: 0;
}
</style>
\ No newline at end of file
import App from './index.vue'
import base from '@/base'
import GlsxVueCommon from 'glsx-vue-common'
base.getConfig().then(data => {
const { vue, config } = data
vue.use(GlsxVueCommon, config)
base.render(App)
})
<template>
<div>
<el-button
type="primary"
@click="create"
>新增类型</el-button>
<d2-table
class="m-t-sm"
:searchForm="typeSearchForm"
:tableParams="typeTableParams"
>
</d2-table>
<glsx-dialog
:isVisible="visible"
:title="'新增类型'"
@closeDialog="closeDialog"
@confirmDialog="handleSubmit"
>
<slot>
<el-form
:model="ruleForm"
:rules="rules"
ref="ruleForm"
label-width="100px"
>
<el-form-item
v-for="item in formList"
:key="item.label"
:label="item.label"
:prop="item.prop"
>
<el-input
v-if="item.type == 'input'"
type="text"
:placeholder="item.placeholder || '请输入'"
v-model="ruleForm[item.prop]"
maxlength="10"
show-word-limit
></el-input>
<el-select
v-else-if="item.type == 'select'"
v-model="ruleForm[item.prop]"
:placeholder="item.placeholder || '请选择'"
>
<el-option
v-for="i in item.options"
:key="i.value"
:label="i.label"
:value="i.value"
>
</el-option>
</el-select>
</el-form-item>
</el-form>
</slot>
</glsx-dialog>
</div>
</template>
<script>
export default {
data() {
return {
typeSearchForm: {},
typeTableParams: {
btnId: new Date().getTime() + parseInt(Math.random() * 1000),
tableColumns: [
{
label: '类型名称',
prop: 'name'
},
{
label: '一级分类',
prop: 'status'
},
{
label: '耳机分类',
prop: ''
},
{
label: '商城标签',
prop: ''
}
]
},
visible: false,
ruleForm: {},
rules: {
name: [{ required: true, message: '请输入类型名称', trigger: 'blur' }],
type: [{ required: true, message: '请选择类型名称', trigger: 'change' }],
type1: [{ required: true, message: '请选择类型名称', trigger: 'change' }],
label: [{ required: true, message: '请选择类型名称', trigger: 'change' }]
},
formList: [
{
label: '类型名称:',
prop: 'name',
type: 'input',
placeholder: '请输入名称'
},
{
label: '一级分类:',
prop: 'type',
type: 'select',
options: [
{
label: '车载智能',
value: '1'
},
{
label: '智能家居',
value: '2'
}
]
},
{
label: '二级分类:',
prop: 'type1',
type: 'select',
options: ''
},
{
label: '商城标签:',
prop: 'label',
type: 'select',
options: []
}
],
formParams: {}
}
},
methods: {
create() {
this.visible = !this.visible
},
closeDialog() {
this.visible = !this.visible
},
handleSubmit() {
console.log(this.ruleForm)
this.$refs.ruleForm.validate((valid) => {
if (valid) {
alert('submit!')
this.visible = !this.visible
} else {
console.log('error submit!!')
return false
}
})
}
}
}
</script>
\ No newline at end of file
import App from './index.vue'
import base from '@/base'
import GlsxVueCommon from 'glsx-vue-common'
base.getConfig().then(data => {
const { vue, config } = data
vue.use(GlsxVueCommon, config)
base.render(App)
})
<template>
<div>
<el-button type="primary">添加场景</el-button>
<d2-table
class="m-t-sm"
:searchForm="scenarioSearchForm"
:tableParams="scenarioTableParams"
>
<span
slot="auth-button"
slot-scope="scope"
>
<el-button
type="text"
@click="handleEdit(scope.scope)"
>编辑</el-button>
<el-button
type="text"
@click="handleEdit(scope.scope)"
>下架</el-button>
</span>
</d2-table>
</div>
</template>
<script>
export default {
data() {
return {
scenarioSearchForm: {},
scenarioTableParams: {
btnId: new Date().getTime() + parseInt(Math.random() * 1000),
tableOption: true,
tableColumns: [
{
label: '场景名称',
prop: 'name'
},
{
label: '分类',
prop: 'status'
},
{
label: '查看次数',
prop: ''
},
{
label: '状态',
prop: ''
}
]
}
}
},
methods: {
handleEdit() {
}
}
}
</script>
\ No newline at end of file
import App from './app.vue'
import base from '@/base'
import GlsxVueCommon from 'glsx-vue-common'
base.getConfig().then(data => {
const { vue, config } = data
vue.use(GlsxVueCommon, config)
base.render(App)
})
<template>
<div
id="app"
class="outsider"
>
<div slot="header">
广联运营平台
</div>
<ul>
<li>
<a
href="../customer/addScenario.html"
target="_self"
>
添加场景
</a>
</li>
<li>
<a
href="../customer/scenarioManagement.html"
target="_self"
>
场景管理
</a>
</li>
<li>
<a
href="../customer/iconLibrary.html"
target="_self"
>
图标库
</a>
</li>
<li>
<a
href="../customer/productManagement.html"
target="_self"
>
类型管理
</a>
</li>
<li>
<a
href="../customer/productList.html"
target="_self"
>
产品列表
</a>
</li>
</ul>
</div>
</template>
<script>
export default {
name: 'App'
}
</script>
<style scoped>
.outsider {
background-color: #fff;
padding: 20px 0px 40px 0px;
/* margin: 20px 20px; */
}
</style>
File mode changed
File mode changed
module.exports = {
index: '主页',
'customer/glsx': '广联赛讯'
}
'use strict'
const titles = require('./title.js')
const glob = require('glob')
const pages = {}
// const mode = process.env.NODE_ENV || 'development'
glob.sync('./src/views/**/app.js').forEach(path => {
const chunk = path.split('./src/views/')[1].split('/app.js')[0]
pages[chunk] = {
entry: path,
template: 'public/index.html',
title: titles[chunk],
chunks: ['chunk-vendors', 'chunk-common', chunk]
}
})
module.exports = {
pages,
chainWebpack: config => config.plugins.delete('named-chunks'),
configureWebpack: (config) => {
// config.devtool = (mode === 'development') ? 'inline-source-map' : false
// config.mode = mode
},
devServer: {
port: 8085,
host: 'localhost',
open: true,
proxy: {
'/api': {
target: 'http://127.0.0.1:8080',
changeOrigin: true,
pathRewrite: { '^/api': '' }
}
}
}
}
This diff could not be displayed because it is too large.
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!