From c70a3de1ca132fd4da8719c4bfe96f0fff38d8fd Mon Sep 17 00:00:00 2001 From: flower-string <2178503051@qq.com> Date: Thu, 6 Mar 2025 19:55:08 +0800 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20feat:=20=E6=B7=BB=E5=8A=A0=E9=A6=96?= =?UTF-8?q?=E9=A1=B5=E7=9A=84=E5=AF=BC=E8=88=AA=E5=AE=88=E5=8D=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ruoyi-ui/src/router/index.js | 25 +++- ruoyi-ui/src/views/index.vue | 97 +++----------- ruoyi-ui/src/views/temp.vue | 237 +++++++++++++++++++++++++++++++++++ 3 files changed, 278 insertions(+), 81 deletions(-) create mode 100644 ruoyi-ui/src/views/temp.vue diff --git a/ruoyi-ui/src/router/index.js b/ruoyi-ui/src/router/index.js index c772484..c01c9c9 100644 --- a/ruoyi-ui/src/router/index.js +++ b/ruoyi-ui/src/router/index.js @@ -1,5 +1,6 @@ import Vue from 'vue' import Router from 'vue-router' +import {currentRole} from "@/api/system/role"; Vue.use(Router) @@ -70,8 +71,26 @@ export const constantRoutes = [ path: 'index', component: () => import('@/views/index'), name: 'Index', - meta: { title: '工作台', icon: 'dashboard', affix: true } + meta: { title: '工作台', icon: 'dashboard', affix: true }, + beforeEnter: (to, from, next) => { + // 从本地存储获取角色信息 + currentRole().then(res => { + const role = res.data.roleKey; + // console.log(role, '当前用户的权限为'); + if (role === 'temp') { + next('/temp') // 重定向到临时页面 + } else { + next() + } + }) + } }, + { + path: 'temp', + component: () => import('@/views/temp'), + name: 'Temp', + meta: { title: '临时页面', icon: 'dashboard', affix: true } + } ] }, { @@ -330,9 +349,11 @@ Router.prototype.replace = function push(location) { return routerReplace.call(this, location).catch(err => err) } -export default new Router({ +const router = new Router({ base: process.env.VUE_APP_CONTEXT_PATH, mode: 'history', // 去掉url中的# scrollBehavior: () => ({ y: 0 }), routes: constantRoutes }) + +export default router diff --git a/ruoyi-ui/src/views/index.vue b/ruoyi-ui/src/views/index.vue index cea9fe3..f95338f 100644 --- a/ruoyi-ui/src/views/index.vue +++ b/ruoyi-ui/src/views/index.vue @@ -1,60 +1,24 @@ @@ -68,7 +32,6 @@ import Inventory from "../components/Inventory/index.vue"; import Announcements from "../components/Announcements/index.vue"; import ProjectManagement from "../components/ProjectManagement/index.vue"; import FinancialCharts from "../components/FinancialCharts/index.vue"; -import {currentRole} from "@/api/system/role"; export default { name: "Index", @@ -81,14 +44,6 @@ export default { }, data() { return { - // 新员工填写的信息 - employeeData: { - name: "", - email: "", - // 其他必要字段 - }, - // 当前步骤,从 0 开始计数 - activeStep: 0, version: "0.8.3", commandstats: null, usedmemory: null, @@ -100,29 +55,13 @@ export default { noticeTitle: '', noticeContent: '', drawer: false, - currentRole:{} }; }, created() { - this.getCurrentUserRole(); this.getList(); this.getListNotice(); }, methods: { - submitForm() { - // 这里可以加入表单验证与提交逻辑 - // 模拟提交后进入下一流程(例如审批中) - this.activeStep = 1; - this.$message({ - message: "表单提交成功,进入审批流程!", - type: "success" - }); - }, - getCurrentUserRole(){ - currentRole().then(res => { - this.currentRole = res.data; - }) - }, getList() { getCache().then((response) => { this.cache = response.data; diff --git a/ruoyi-ui/src/views/temp.vue b/ruoyi-ui/src/views/temp.vue new file mode 100644 index 0000000..c651634 --- /dev/null +++ b/ruoyi-ui/src/views/temp.vue @@ -0,0 +1,237 @@ + + + + + \ No newline at end of file