From 7a232287b9517e837deb113475b5d06c6cd509b8 Mon Sep 17 00:00:00 2001 From: zhangtao <1176193409@qq.com> Date: Sun, 9 Oct 2022 17:01:00 +0800 Subject: [PATCH] update js --- .env.localhost | 2 +- mock/system/router.js | 14 ++++---- src/api/common/upload.js | 59 +++++++++++++++++++++++++++++++++ src/store/modules/permission.js | 1 + src/utils/dictionary.js | 30 +++++++++++++++++ 5 files changed, 98 insertions(+), 8 deletions(-) create mode 100644 src/api/common/upload.js create mode 100644 src/utils/dictionary.js diff --git a/.env.localhost b/.env.localhost index b919d0f..1104cf0 100644 --- a/.env.localhost +++ b/.env.localhost @@ -2,7 +2,7 @@ VITE_PUBLIC_PATH = '/' # 是否启用MOCK -VITE_APP_USE_MOCK = false +VITE_APP_USE_MOCK = true # proxy VITE_PROXY = [["/api-local","http://127.0.0.1:8002/api"],["/api-mock","http://127.0.0.1:8003"]] diff --git a/mock/system/router.js b/mock/system/router.js index ab34519..5ece2b9 100644 --- a/mock/system/router.js +++ b/mock/system/router.js @@ -2,7 +2,7 @@ const asyncRoutes = [ { path: '/system', component: 'Layout', - redirect: '/system/menu', + redirect: '/system-manage/menu', pid: 0, title: 'System', meta: { @@ -11,7 +11,7 @@ const asyncRoutes = [ children: [ { path: 'menu', - component: 'views/system/menu/index', + component: 'views/system-manage/menu-manage/index', title: 'SystemMenu', meta: { title: '菜单管理' @@ -19,7 +19,7 @@ const asyncRoutes = [ }, { path: 'user', - component: 'views/system/user/index', + component: 'views/system-manage/user-manage/index', title: 'SystemUser', meta: { title: '用户管理' @@ -27,16 +27,16 @@ const asyncRoutes = [ }, { path: 'role', - component: 'views/system/role/index', - name: 'SystemRole', + component: 'views/system-manage/role-manage/index', + title: 'SystemRole', meta: { title: '角色管理' } }, { path: 'dept', - component: 'views/system/dept/index', - name: 'SystemDept', + component: 'views/system-manage/department-manage/index', + title: 'SystemDept', meta: { title: '部门管理' } diff --git a/src/api/common/upload.js b/src/api/common/upload.js new file mode 100644 index 0000000..4c3ea18 --- /dev/null +++ b/src/api/common/upload.js @@ -0,0 +1,59 @@ +import { defAxios as request } from '@/utils/http' + +/** + * @description: 获取音视频上传地址和凭证 + * @param {Object} params + * @return {Object} + */ +export function getAuth(params) { + return request({ + url: '/aliyuncsVod/createUploadVideo', + method: 'get', + params + }) +} + +/** + * @description: 刷新音/视频上传凭证 + * @param {String} videoId + * @return {*} + */ +export function refreshAuth(videoId) { + return request({ + url: '/aliyuncsVod/refreshUploadVideo', + method: 'get', + params: { + videoId + } + }) +} + +/** + * @description: 获取图片上传鉴权 + * @param {String} objectName + * @return {*} + */ +export function getOssAuth(objectName) { + return request({ + url: '/aliyunOss/getSecurityToken', + method: 'get', + responseAll: true, + params: { + objectName + } + }) +} + +/** + * @description: 上传离线视频地址 + * @param {String} params + * @return {*} + */ +export function uploadVideoUrl(data) { + return request({ + url: '/inspection/uploadVideoUrl', + method: 'post', + data + }) +} + diff --git a/src/store/modules/permission.js b/src/store/modules/permission.js index c51e996..459f092 100644 --- a/src/store/modules/permission.js +++ b/src/store/modules/permission.js @@ -114,6 +114,7 @@ export const usePermissionStore = defineStore('permission', { const res = await getMenu() if (res.code === 0) { const result = dataArrayToRoutes(res.data) + console.log(result) this.accessRoutes = result return Promise.resolve(result) } else { diff --git a/src/utils/dictionary.js b/src/utils/dictionary.js new file mode 100644 index 0000000..fffa5bd --- /dev/null +++ b/src/utils/dictionary.js @@ -0,0 +1,30 @@ +export const QUESTION_STATUS = [ + { label: '已确认', value: 1 }, + { label: '已忽略', value: 2 }, + { label: '待确认', value: 3 } +] + +export const USER_STATUS = [ + { label: '正常', value: 1 }, + { label: '禁用', value: 2 } +] + +export const MENU_TYPE = [ + { label: '菜单', value: 0 }, + { label: '按钮', value: 1 } +] + +export const MENU_OPEN = [ + { label: '内部', value: '1' }, + { label: '外部', value: '2' } +] + +export const MENU_VISIBLE = [ + { label: '可见', value: 0 }, + { label: '不可见', value: 1 } +] + +export const MENU_STATUS = [ + { label: '在用', value: 1 }, + { label: '停用', value: 2 } +]