Commit 22d56468 by cwq0219

页面

1 parent 1b4ee10d
......@@ -2,7 +2,7 @@
* @Author: limin
* @Date: 2019-08-26 18:02:55
* @Last Modified by: chenwq
* @Last Modified time: 2020-12-14 10:51:11
* @Last Modified time: 2020-12-15 15:07:48
*/
import request from './request'
......@@ -24,12 +24,18 @@ export function AccountLogin(data) {
data.method = LOGIN_URL
// return request(data, RequestMethods.POST)
return new Promise(resolve => {
resolve({
roleType: 1,
userName: 'wxw',
loginName: 'foutouren',
authes: []
})
(data.userName === 'admin' && data.password === '123456')
? resolve({
code: '0',
roleType: 1,
userName: 'admin',
loginName: 'foutouren',
authes: []
})
: resolve({
code: '-1',
message: '账号或密码错误'
})
})
}
......
......@@ -23,7 +23,7 @@ export const home = {
name: 'index',
icon: 's-home',
meta: {
title: 'echats',
title: '总览',
authId: '101',
parentId: '0',
cache: true
......@@ -60,167 +60,128 @@ export const sys = [
* 所有需动态过滤的资源点
*/
export const resources = {
// '102': {
// path: '/bb',
// icon: 'document',
// name: '表格组件',
// meta: {
// title: '表格组件',
// authId: '102',
// parentId: '0'
// }
// },
// '10201': {
// path: '/table1',
// icon: 'document-copy',
// name: 'fimsTable1',
// meta: {
// title: '默认使用',
// authId: '10201',
// parentId: '102',
// cache: true
// },
// component: _import('table1'),
// auth: [{
// authId: '1020101',
// parentId: '10201',
// label: '编辑',
// handle: 'handleEdit'
// }, {
// authId: '1020102',
// parentId: '10201',
// label: '删除',
// color: '#FF0000',
// handle: 'handleDelete'
// }, {
// authId: '1020103',
// parentId: '10201',
// label: '添加',
// category: 'Button',
// type: 'button',
// handle: 'handleEdit',
// icon: 'plus'
// }, {
// authId: '1020104',
// parentId: '10201',
// label: '批量操作',
// category: 'Button',
// type: 'button',
// handle: 'handleOperate'
// }]
// },
// '10202': {
// path: '/table2',
// icon: 'finished',
// name: 'fimsTable2',
// meta: {
// title: '外部数据传入',
// authId: '10202',
// parentId: '102',
// cache: true
// },
// component: _import('table2')
// },
// '107': {
// path: '/users',
// icon: 'user',
// name: '帐号管理',
// meta: {
// title: '用户管理',
// authId: '107',
// parentId: '0'
// }
// },
// '10701': {
// path: '/user',
// name: 'FimsUsers',
// icon: 'user-solid',
// meta: {
// title: '用户管理',
// authId: '10701',
// parentId: '107',
// cache: true
// },
// auth: [{ // 列表操作
// authId: '1070101',
// parentId: '10701',
// label: '审核',
// handle: 'handleVerify'
// }, { //
// authId: '1070102',
// parentId: '10701',
// label: '重置密码',
// handle: 'handleOperation'
// }, { //
// authId: '1070103',
// parentId: '10701',
// label: '编辑',
// handle: 'handleEdit'
// }, { //
// authId: '1070104',
// parentId: '10701',
// label: '延期',
// handle: 'handleOperation'
// }, { //
// authId: '1070105',
// parentId: '10701',
// label: '禁用',
// color: '#FF0000',
// handle: 'handleOperation'
// }, { //
// authId: '1070106',
// parentId: '10701',
// label: '激活',
// handle: 'handleOperation'
// }, { // 列表操作
// authId: '1070107',
// parentId: '10701',
// label: '创建用户',
// category: 'action',
// type: 'button',
// handle: 'handleRegister',
// icon: 'plus'
// }],
// component: _import('userManage/user')
// },
// '10702': {
// path: '/role',
// name: 'FimsRoles',
// icon: 'open',
// meta: {
// title: '权限管理',
// authId: '10702',
// parentId: '107'
// },
// auth: [{
// authId: '1070201',
// parentId: '10702',
// label: '创建角色',
// category: 'action',
// handle: 'handleEdit',
// type: 'button',
// icon: 'plus'
// }, {
// authId: '1070202',
// parentId: '10702',
// label: '权限编辑',
// handle: 'handleEdit',
// type: 'text'
// }],
// component: _import('userManage/role')
// },
// '10703': {
// path: '/loginLogs',
// name: 'FimsLoginLogs',
// icon: 'tickets',
// meta: {
// title: '登录日志',
// authId: '10703',
// parentId: '107',
// cache: true
// },
// component: _import('userManage/loginLogs')
// }
'102': {
path: '/customer',
icon: 'user-solid',
name: 'customer',
meta: {
title: '客户管理',
authId: '102',
parentId: '0',
cache: true
},
auth: [
{
authId: '10201',
parentId: '102',
label: '重置密码',
handle: 'handleReset'
}, {
authId: '10202',
parentId: '102',
label: '启用',
handle: 'handleUpOrDown',
ruleObj: {
attr: 'status',
rule: { 0: '启用', 1: '停用' }
}
}
],
component: _import('customer/customer')
},
'103': {
path: '/device',
icon: 'document-copy',
name: 'device',
meta: {
title: '设备管理',
authId: '103',
parentId: '0',
cache: true
},
component: _import('device/device')
},
'104': {
path: '/user',
icon: 'document-copy',
name: 'user',
meta: {
title: '用户管理',
authId: '104',
parentId: '0',
cache: true
},
component: _import('user/user')
},
'105': {
path: '/apiManage',
icon: 'document-copy',
name: 'apiManage',
meta: {
title: 'API管理',
authId: '105',
parentId: '0',
cache: true
}
},
'10501': {
path: '/apiList',
icon: 'document-copy',
name: 'apiList',
meta: {
title: 'API列表',
authId: '10501',
parentId: '105',
cache: true
},
component: _import('apiManage/apiList')
},
'10502': {
path: '/apiRecord',
icon: 'document-copy',
name: 'apiRecord',
meta: {
title: 'API调用记录',
authId: '10502',
parentId: '105',
cache: true
},
component: _import('apiManage/apiRecord')
},
'106': {
path: '/appMarket',
icon: 'document-copy',
name: 'appMarket',
meta: {
title: 'APP营销管理',
authId: '106',
parentId: '0',
cache: true
},
auth: [{
authId: '10601',
parentId: '106',
label: '新增',
category: 'Button',
type: 'primary',
handle: 'handleAdd'
}, {
authId: '10602',
parentId: '106',
label: '编辑',
handle: 'handleEdit'
}, {
authId: '10603',
parentId: '10701',
label: '下架',
handle: 'handleUpOrDown',
ruleObj: {
attr: 'status',
rule: { 0: '上架', 1: '下架' }
}
}],
component: _import('appMarket/appMarket')
}
}
/**
......@@ -248,7 +209,8 @@ export const errorPage = {
export const frameInRoutes = frameIn
export const localRoutes = {
...resources, [home.meta.authId]: home
...resources,
[home.meta.authId]: home
}
// 重新组织后导出
......
import util from '@/libs/util.js'
import {
AccountLogin,
getAuths,
getUserInfo
AccountLogin
} from '@api/sys.account'
import {
SUPPER_ADMIN
......@@ -13,6 +11,7 @@ import {
import {
baseConfig
} from '@/main'
import notice from '@/common/notice'
export default {
namespaced: true,
actions: {
......@@ -28,6 +27,10 @@ export default {
return new Promise((resolve, reject) => {
// 开始请求登录接口
AccountLogin(p).then(async(data = {}) => {
if (data.code === '-1') {
notice.errorTips(data.message)
reject(new Error())
}
// 设置 cookie 一定要存 uuid 和 token 两个 cookie
// 整个系统依赖这两个数据进行校验和存储
// uuid 是用户身份唯一标识 用户注册的时候确定 并且不可改变 不可重复
......@@ -50,10 +53,10 @@ export default {
// 结束
resolve()
})
.catch(err => {
console.log('err: ', err)
reject(err)
})
// .catch(err => {
// console.log('err: ', err)
// reject(err)
// })
})
},
/**
......
<!-- api列表 -->
<template>
<d2-container>
<d2-table-header title="API列表"></d2-table-header>
<d2-table
:searchForm="searchForm"
:tableParams="tableParams"
:getListApi="getListApi"
></d2-table>
</d2-container>
</template>
<script>
export default {
name: 'apiList',
data() {
return {
searchForm: {},
getListApi: '',
tableParams: {
btnId: new Date().getTime() + parseInt(Math.random() * 1000),
listName: 'list',
tableColumns: [{
label: 'id',
prop: '',
width: '200px'
}, {
label: 'API分类',
prop: ''
}, {
label: 'API名称',
prop: ''
}, {
label: '请求方式',
prop: '',
width: '180px'
}, {
label: 'API接口',
prop: ''
}, {
label: '说明',
prop: ''
}, {
label: '状态',
prop: ''
}]
}
}
},
components: {},
computed: {},
mounted() { },
methods: {}
}
</script>
<style scoped>
</style>
<!-- api调用记录 -->
<template>
<d2-container>
<el-form
slot="header"
inline="true"
>
<el-form-item label="访问时间:">
<el-select>
<el-option></el-option>
</el-select>
</el-form-item>
</el-form>
<d2-table
:searchForm="searchForm"
:tableParams="tableParams"
:getListApi="getListApi"
>
<auth-button
slot="auth-button"
slot-scope="scope"
:data="scope.scope"
></auth-button>
</d2-table>
</d2-container>
</template>
<script>
export default {
name: 'apiRecord',
data() {
return {
searchForm: {},
getListApi: '',
tableParams: {
btnId: new Date().getTime() + parseInt(Math.random() * 1000),
listName: 'list',
tableColumns: [{
label: '序号',
prop: '',
width: '200px'
}, {
label: '访问时间',
prop: ''
}, {
label: '客户',
prop: ''
}, {
label: '调用API',
prop: '',
width: '180px'
}, {
label: '调用结果',
prop: ''
}]
}
}
},
mounted() { },
methods: {}
}
</script>
<style scoped>
</style>
<!-- app营销管理 -->
<template>
<d2-container>
<d2-table-header title="广告列表">
<auth-button category="Button"></auth-button>
</d2-table-header>
<d2-table
:searchForm="searchForm"
:tableParams="tableParams"
:getListApi="getListApi"
>
<auth-button
slot="auth-button"
slot-scope="scope"
:data="scope.scope"
></auth-button>
</d2-table>
</d2-container>
</template>
<script>
export default {
name: 'appMarket',
data() {
return {
searchForm: {},
getListApi: '',
tableParams: {
btnId: new Date().getTime() + parseInt(Math.random() * 1000),
listName: 'list',
tableColumns: [{
label: 'id',
prop: '',
width: '200px'
}, {
label: '标题',
prop: ''
}, {
label: '图片',
prop: ''
}, {
label: '位置',
prop: '',
width: '180px'
}, {
label: '打开界面',
prop: ''
}, {
label: '添加时间',
prop: ''
}, {
label: '状态',
prop: ''
}]
}
}
},
mounted() { },
methods: {}
}
</script>
<style scoped>
</style>
<!-- 客户管理 -->
<template>
<d2-container>
<d2-table-header title="客户列表"></d2-table-header>
<d2-table
:searchForm="searchForm"
:tableParams="tableParams"
:getListApi="getListApi"
>
<auth-button
slot="auth-button"
slot-scope="scope"
:data="scope.scope"
></auth-button>
</d2-table>
</d2-container>
</template>
<script>
export default {
name: 'customer',
data() {
return {
searchForm: {},
getListApi: '',
tableParams: {
btnId: new Date().getTime() + parseInt(Math.random() * 1000),
listName: 'list',
tableColumns: [{
label: 'id',
prop: 'id',
width: '200px'
}, {
label: '客户名称',
prop: 'customerName'
}, {
label: '联系人',
prop: 'contactPerson'
}, {
label: '联系电话',
prop: 'contactNumber',
width: '180px'
}, {
label: '省份',
prop: 'province'
}, {
label: '城市',
prop: 'city'
}, {
label: '详细地址',
prop: 'address'
}, {
label: '账号状态',
prop: 'status',
formatter: (cellValue) => {
return {
0: '停用',
1: '正常',
2: '待审核'
}[cellValue.status]
}
}]
}
}
},
mounted() { },
methods: {}
}
</script>
<style scoped>
</style>
<!-- 设备管理 -->
<template>
<d2-container>
<el-form slot="header" inline="true">
<el-form-item label="客户名称:">
<el-select>
<el-option></el-option>
</el-select>
</el-form-item>
<el-form-item label="设备类型:">
<el-select>
<el-option></el-option>
</el-select>
</el-form-item>
<el-form-item label="激活时间:">
<el-select>
<el-option></el-option>
</el-select>
</el-form-item>
</el-form>
<d2-table
:searchForm="searchForm"
:tableParams="tableParams"
:getListApi="getListApi"
></d2-table>
</d2-container>
</template>
<script>
export default {
name: 'device',
data() {
return {
searchForm: {},
getListApi: '',
tableParams: {
btnId: new Date().getTime() + parseInt(Math.random() * 1000),
listName: 'list',
tableColumns: [{
label: '序号',
prop: 'id',
width: '200px'
}, {
label: '设备SN',
prop: 'deviceSn'
}, {
label: '类型',
prop: 'deviceType',
fomatter: (cellValue) => {
return cellValue.deviceType
}
}, {
label: '客户',
prop: 'customerName',
width: '180px'
}, {
label: '激活时间',
prop: 'activatTime'
}, {
label: '状态',
prop: 'status',
fomatter: (cellValue) => {
return {
0: '异常',
1: '正常'
}[cellValue.status]
}
}]
}
}
},
components: {},
computed: {},
mounted() { },
methods: {}
}
</script>
<style scoped>
</style>
......@@ -122,11 +122,8 @@ export default {
time: dayjs().format('HH:mm:ss'),
// 表单
formLogin: {
userName: 'dongdao',
// userName: 'houlai',
userName: 'admin',
password: '123456'
// userName: '',
// password: ''
},
// 表单校验
rules: Object.freeze({
......@@ -179,7 +176,7 @@ export default {
const _current = await this.current()
await this.initBaseData()
this.$router.replace(this.$route.query.redirect || _current)
})
}).catch(() => {})
}
})
}
......
<!-- 用户管理 -->
<template>
<d2-container>
<el-form
slot="header"
inline="true"
>
<el-form-item label="客户名称:">
<el-select>
<el-option></el-option>
</el-select>
</el-form-item>
<el-form-item label="注册时间:">
<el-select>
<el-option></el-option>
</el-select>
</el-form-item>
</el-form>
<d2-table
:searchForm="searchForm"
:tableParams="tableParams"
:getListApi="getListApi"
></d2-table>
</d2-container>
</template>
<script>
export default {
name: 'user',
data() {
return {
searchForm: {},
getListApi: '',
tableParams: {
btnId: new Date().getTime() + parseInt(Math.random() * 1000),
listName: 'list',
tableColumns: [{
label: 'id',
prop: '',
width: '200px'
}, {
label: '昵称',
prop: ''
}, {
label: '联系电话',
prop: ''
}, {
label: '微信ID',
prop: '',
width: '180px'
}, {
label: '省份',
prop: ''
}, {
label: '城市',
prop: 'status'
}, {
label: '所属客户名称',
prop: 'status'
}, {
label: '注册时间',
prop: 'status'
}, {
label: '最后登录时间',
prop: 'status'
}]
}
}
},
mounted() { },
methods: {}
}
</script>
<style scoped>
</style>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!