Commit 22d56468 by cwq0219

页面

1 parent 1b4ee10d
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: limin * @Author: limin
* @Date: 2019-08-26 18:02:55 * @Date: 2019-08-26 18:02:55
* @Last Modified by: chenwq * @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' import request from './request'
...@@ -24,12 +24,18 @@ export function AccountLogin(data) { ...@@ -24,12 +24,18 @@ export function AccountLogin(data) {
data.method = LOGIN_URL data.method = LOGIN_URL
// return request(data, RequestMethods.POST) // return request(data, RequestMethods.POST)
return new Promise(resolve => { return new Promise(resolve => {
resolve({ (data.userName === 'admin' && data.password === '123456')
roleType: 1, ? resolve({
userName: 'wxw', code: '0',
loginName: 'foutouren', roleType: 1,
authes: [] userName: 'admin',
}) loginName: 'foutouren',
authes: []
})
: resolve({
code: '-1',
message: '账号或密码错误'
})
}) })
} }
......
...@@ -23,7 +23,7 @@ export const home = { ...@@ -23,7 +23,7 @@ export const home = {
name: 'index', name: 'index',
icon: 's-home', icon: 's-home',
meta: { meta: {
title: 'echats', title: '总览',
authId: '101', authId: '101',
parentId: '0', parentId: '0',
cache: true cache: true
...@@ -60,167 +60,128 @@ export const sys = [ ...@@ -60,167 +60,128 @@ export const sys = [
* 所有需动态过滤的资源点 * 所有需动态过滤的资源点
*/ */
export const resources = { export const resources = {
// '102': { '102': {
// path: '/bb', path: '/customer',
// icon: 'document', icon: 'user-solid',
// name: '表格组件', name: 'customer',
// meta: { meta: {
// title: '表格组件', title: '客户管理',
// authId: '102', authId: '102',
// parentId: '0' parentId: '0',
// } cache: true
// }, },
// '10201': { auth: [
// path: '/table1', {
// icon: 'document-copy', authId: '10201',
// name: 'fimsTable1', parentId: '102',
// meta: { label: '重置密码',
// title: '默认使用', handle: 'handleReset'
// authId: '10201', }, {
// parentId: '102', authId: '10202',
// cache: true parentId: '102',
// }, label: '启用',
// component: _import('table1'), handle: 'handleUpOrDown',
// auth: [{ ruleObj: {
// authId: '1020101', attr: 'status',
// parentId: '10201', rule: { 0: '启用', 1: '停用' }
// label: '编辑', }
// handle: 'handleEdit' }
// }, { ],
// authId: '1020102', component: _import('customer/customer')
// parentId: '10201', },
// label: '删除', '103': {
// color: '#FF0000', path: '/device',
// handle: 'handleDelete' icon: 'document-copy',
// }, { name: 'device',
// authId: '1020103', meta: {
// parentId: '10201', title: '设备管理',
// label: '添加', authId: '103',
// category: 'Button', parentId: '0',
// type: 'button', cache: true
// handle: 'handleEdit', },
// icon: 'plus' component: _import('device/device')
// }, { },
// authId: '1020104', '104': {
// parentId: '10201', path: '/user',
// label: '批量操作', icon: 'document-copy',
// category: 'Button', name: 'user',
// type: 'button', meta: {
// handle: 'handleOperate' title: '用户管理',
// }] authId: '104',
// }, parentId: '0',
// '10202': { cache: true
// path: '/table2', },
// icon: 'finished', component: _import('user/user')
// name: 'fimsTable2', },
// meta: { '105': {
// title: '外部数据传入', path: '/apiManage',
// authId: '10202', icon: 'document-copy',
// parentId: '102', name: 'apiManage',
// cache: true meta: {
// }, title: 'API管理',
// component: _import('table2') authId: '105',
// }, parentId: '0',
// '107': { cache: true
// path: '/users', }
// icon: 'user', },
// name: '帐号管理', '10501': {
// meta: { path: '/apiList',
// title: '用户管理', icon: 'document-copy',
// authId: '107', name: 'apiList',
// parentId: '0' meta: {
// } title: 'API列表',
// }, authId: '10501',
// '10701': { parentId: '105',
// path: '/user', cache: true
// name: 'FimsUsers', },
// icon: 'user-solid', component: _import('apiManage/apiList')
// meta: { },
// title: '用户管理', '10502': {
// authId: '10701', path: '/apiRecord',
// parentId: '107', icon: 'document-copy',
// cache: true name: 'apiRecord',
// }, meta: {
// auth: [{ // 列表操作 title: 'API调用记录',
// authId: '1070101', authId: '10502',
// parentId: '10701', parentId: '105',
// label: '审核', cache: true
// handle: 'handleVerify' },
// }, { // component: _import('apiManage/apiRecord')
// authId: '1070102', },
// parentId: '10701', '106': {
// label: '重置密码', path: '/appMarket',
// handle: 'handleOperation' icon: 'document-copy',
// }, { // name: 'appMarket',
// authId: '1070103', meta: {
// parentId: '10701', title: 'APP营销管理',
// label: '编辑', authId: '106',
// handle: 'handleEdit' parentId: '0',
// }, { // cache: true
// authId: '1070104', },
// parentId: '10701', auth: [{
// label: '延期', authId: '10601',
// handle: 'handleOperation' parentId: '106',
// }, { // label: '新增',
// authId: '1070105', category: 'Button',
// parentId: '10701', type: 'primary',
// label: '禁用', handle: 'handleAdd'
// color: '#FF0000', }, {
// handle: 'handleOperation' authId: '10602',
// }, { // parentId: '106',
// authId: '1070106', label: '编辑',
// parentId: '10701', handle: 'handleEdit'
// label: '激活', }, {
// handle: 'handleOperation' authId: '10603',
// }, { // 列表操作 parentId: '10701',
// authId: '1070107', label: '下架',
// parentId: '10701', handle: 'handleUpOrDown',
// label: '创建用户', ruleObj: {
// category: 'action', attr: 'status',
// type: 'button', rule: { 0: '上架', 1: '下架' }
// handle: 'handleRegister', }
// icon: 'plus' }],
// }], component: _import('appMarket/appMarket')
// 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')
// }
} }
/** /**
...@@ -248,7 +209,8 @@ export const errorPage = { ...@@ -248,7 +209,8 @@ export const errorPage = {
export const frameInRoutes = frameIn export const frameInRoutes = frameIn
export const localRoutes = { export const localRoutes = {
...resources, [home.meta.authId]: home ...resources,
[home.meta.authId]: home
} }
// 重新组织后导出 // 重新组织后导出
......
import util from '@/libs/util.js' import util from '@/libs/util.js'
import { import {
AccountLogin, AccountLogin
getAuths,
getUserInfo
} from '@api/sys.account' } from '@api/sys.account'
import { import {
SUPPER_ADMIN SUPPER_ADMIN
...@@ -13,6 +11,7 @@ import { ...@@ -13,6 +11,7 @@ import {
import { import {
baseConfig baseConfig
} from '@/main' } from '@/main'
import notice from '@/common/notice'
export default { export default {
namespaced: true, namespaced: true,
actions: { actions: {
...@@ -28,6 +27,10 @@ export default { ...@@ -28,6 +27,10 @@ export default {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
// 开始请求登录接口 // 开始请求登录接口
AccountLogin(p).then(async(data = {}) => { AccountLogin(p).then(async(data = {}) => {
if (data.code === '-1') {
notice.errorTips(data.message)
reject(new Error())
}
// 设置 cookie 一定要存 uuid 和 token 两个 cookie // 设置 cookie 一定要存 uuid 和 token 两个 cookie
// 整个系统依赖这两个数据进行校验和存储 // 整个系统依赖这两个数据进行校验和存储
// uuid 是用户身份唯一标识 用户注册的时候确定 并且不可改变 不可重复 // uuid 是用户身份唯一标识 用户注册的时候确定 并且不可改变 不可重复
...@@ -50,10 +53,10 @@ export default { ...@@ -50,10 +53,10 @@ export default {
// 结束 // 结束
resolve() resolve()
}) })
.catch(err => { // .catch(err => {
console.log('err: ', err) // console.log('err: ', err)
reject(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 { ...@@ -122,11 +122,8 @@ export default {
time: dayjs().format('HH:mm:ss'), time: dayjs().format('HH:mm:ss'),
// 表单 // 表单
formLogin: { formLogin: {
userName: 'dongdao', userName: 'admin',
// userName: 'houlai',
password: '123456' password: '123456'
// userName: '',
// password: ''
}, },
// 表单校验 // 表单校验
rules: Object.freeze({ rules: Object.freeze({
...@@ -179,7 +176,7 @@ export default { ...@@ -179,7 +176,7 @@ export default {
const _current = await this.current() const _current = await this.current()
await this.initBaseData() await this.initBaseData()
this.$router.replace(this.$route.query.redirect || _current) 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!