From 3f1b287057764d1b847c32472eca9e56bad6dcb7 Mon Sep 17 00:00:00 2001 From: zhl Date: Sun, 25 Apr 2021 20:50:58 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=9D=83=E9=99=90=E7=AE=A1?= =?UTF-8?q?=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/admins.ts | 24 ++ src/api/permissions.ts | 22 ++ src/icons/components/index.ts | 1 + src/icons/components/permission.ts | 12 + src/icons/svg/permission.svg | 1 + src/lang/en.ts | 1 + src/lang/zh.ts | 3 +- src/router/modules/shop.ts | 10 + src/router/modules/system.ts | 10 + src/views/shop/shop_admin.vue | 524 +++++++++++++++++++++++++++++ src/views/system/admin.vue | 32 +- src/views/system/permission.vue | 345 +++++++++++++++++++ 12 files changed, 959 insertions(+), 26 deletions(-) create mode 100644 src/api/permissions.ts create mode 100644 src/icons/components/permission.ts create mode 100644 src/icons/svg/permission.svg create mode 100644 src/views/shop/shop_admin.vue create mode 100644 src/views/system/permission.vue diff --git a/src/api/admins.ts b/src/api/admins.ts index 96afbc0..c59e444 100644 --- a/src/api/admins.ts +++ b/src/api/admins.ts @@ -1,5 +1,29 @@ import request from '@/utils/request' +export interface IAdmin { + id: string + username: string + showname: string + comment: string + locked: boolean + roles: string[] + sex: string + avatar: string + password: string + department: string +} +export const defaultAdmin: IAdmin = { + id: '', + username: '', + showname: '', + comment: '', + locked: false, + roles: [], + sex: '0', + password: '', + avatar: '', + department: '' +} export const getAdminInfo = (data: any) => request({ url: '/admin/info', diff --git a/src/api/permissions.ts b/src/api/permissions.ts new file mode 100644 index 0000000..156fbb9 --- /dev/null +++ b/src/api/permissions.ts @@ -0,0 +1,22 @@ +import request from '@/utils/request' + +export const getPermissions = (params: any) => + request({ + url: '/permissions', + method: 'get', + params + }) + +export const savePermission = (data: any) => + request({ + url: '/permission', + method: 'post', + data + }) + +export const deletePermission = (id: number) => + request({ + url: `/permission/${id}`, + method: 'delete' + }) + diff --git a/src/icons/components/index.ts b/src/icons/components/index.ts index da952bc..423412d 100644 --- a/src/icons/components/index.ts +++ b/src/icons/components/index.ts @@ -38,6 +38,7 @@ import './password' import './pdf' import './people' import './peoples' +import './permission' import './points' import './promo' import './qq' diff --git a/src/icons/components/permission.ts b/src/icons/components/permission.ts new file mode 100644 index 0000000..bb7e7e4 --- /dev/null +++ b/src/icons/components/permission.ts @@ -0,0 +1,12 @@ +/* eslint-disable */ +/* tslint:disable */ +// @ts-ignore +import icon from 'vue-svgicon' +icon.register({ + 'permission': { + width: 64, + height: 64, + viewBox: '0 0 1024 1024', + data: '' + } +}) diff --git a/src/icons/svg/permission.svg b/src/icons/svg/permission.svg new file mode 100644 index 0000000..0456453 --- /dev/null +++ b/src/icons/svg/permission.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/lang/en.ts b/src/lang/en.ts index e1160d3..1d35a4b 100644 --- a/src/lang/en.ts +++ b/src/lang/en.ts @@ -78,6 +78,7 @@ export default { createQuestion: 'Create Question', shop: 'Shop Setting', shop_list: 'Shop List', + shop_admin: 'Shop Admins', create_shop: 'Create Shop', shop_edit: 'Shop Editor', game_setting: 'Game Setting', diff --git a/src/lang/zh.ts b/src/lang/zh.ts index d5d87d7..d25fc4c 100644 --- a/src/lang/zh.ts +++ b/src/lang/zh.ts @@ -5,7 +5,7 @@ export default { system: '系统', adminuser: '管理员', guide: '引导页', - permission: '权限测试页', + permission: '权限管理', rolePermission: '角色权限', pagePermission: '页面权限', directivePermission: '指令权限', @@ -78,6 +78,7 @@ export default { createQuestion: '创建题目', shop: '店铺设置', shop_list: '店铺列表', + shop_admin: '店铺管理员', create_shop: '创建店铺', shop_edit: '编辑店铺', game_setting: '游戏设置', diff --git a/src/router/modules/shop.ts b/src/router/modules/shop.ts index 8a18a74..489cb1d 100644 --- a/src/router/modules/shop.ts +++ b/src/router/modules/shop.ts @@ -10,6 +10,16 @@ const shopRoutes: RouteConfig = { alwaysShow: true }, children: [ + { + path: 'shopadmin', + component: () => import('@/views/shop/shop_admin.vue'), + name: 'ShopAdmin', + meta: { + title: 'shop_admin', + permissions: ['adminuser:read'], + icon: 'admin' + } + }, { path: 'setting', component: () => import('@/views/game/game_setting.vue'), diff --git a/src/router/modules/system.ts b/src/router/modules/system.ts index 2ffcb38..5cd5331 100644 --- a/src/router/modules/system.ts +++ b/src/router/modules/system.ts @@ -11,6 +11,16 @@ const systemRoutes: RouteConfig = { alwaysShow: true }, children: [ + { + path: 'permission', + component: () => import('@/views/system/permission.vue'), + name: 'Permission', + meta: { + title: 'permission', + permissions: ['role:read'], + icon: 'permission' + } + }, { path: 'role', component: () => import('@/views/system/role.vue'), diff --git a/src/views/shop/shop_admin.vue b/src/views/shop/shop_admin.vue new file mode 100644 index 0000000..9e49198 --- /dev/null +++ b/src/views/shop/shop_admin.vue @@ -0,0 +1,524 @@ + + + + + diff --git a/src/views/system/admin.vue b/src/views/system/admin.vue index ce7b406..5ad9e8d 100644 --- a/src/views/system/admin.vue +++ b/src/views/system/admin.vue @@ -250,35 +250,17 @@ import { cloneDeep } from 'lodash' import { Component, Vue } from 'vue-property-decorator' import { getRoles } from '@/api/roles' -import { deleteAdmin, getUsers, saveAdmin } from '@/api/admins' +import { + defaultAdmin, + deleteAdmin, + getUsers, + IAdmin, + saveAdmin +} from '@/api/admins' import { IRole } from '@/views/system/role.vue' import { getShops } from '@/api/shop' -interface IAdmin { - id: string - username: string - showname: string - comment: string - locked: boolean - roles: string[] - sex: string - avatar: string - password: string - department: string -} -const defaultAdmin: IAdmin = { - id: '', - username: '', - showname: '', - comment: '', - locked: false, - roles: [], - sex: '0', - password: '', - avatar: '', - department: '' -} @Component({ name: 'AdminSystem', diff --git a/src/views/system/permission.vue b/src/views/system/permission.vue new file mode 100644 index 0000000..c8764e1 --- /dev/null +++ b/src/views/system/permission.vue @@ -0,0 +1,345 @@ + + + + +