diff --git a/main/manager-web/src/App.vue b/main/manager-web/src/App.vue index 85e03471..f1d98917 100644 --- a/main/manager-web/src/App.vue +++ b/main/manager-web/src/App.vue @@ -27,6 +27,10 @@ nav { } } +.el-message { + top: 45px !important; +} + \ No newline at end of file diff --git a/main/manager-web/src/apis/httpRequest.js b/main/manager-web/src/apis/httpRequest.js index 4d8093d3..44d939e7 100755 --- a/main/manager-web/src/apis/httpRequest.js +++ b/main/manager-web/src/apis/httpRequest.js @@ -110,7 +110,7 @@ function httpHandlerError(info, callBack) { }else if (info.data.code === 401) { console.log('触发 401,清除 Token 并跳转登录页'); store.commit('clearAuth'); - window.location.href = '/login'; + goToPage(Constant.PAGE.LOGIN, true); return true } else { showDanger(info.data.msg) diff --git a/main/manager-web/src/components/AddWisdomBodyDialog.vue b/main/manager-web/src/components/AddWisdomBodyDialog.vue index 042cdbce..b0ace54f 100644 --- a/main/manager-web/src/components/AddWisdomBodyDialog.vue +++ b/main/manager-web/src/components/AddWisdomBodyDialog.vue @@ -47,7 +47,10 @@ export default { return; } userApi.addAgent(this.wisdomBodyName, (res) => { - this.$message.success('添加成功'); + this.$message.success({ + message: '添加成功', + showClose: true + }); this.$emit('confirm', res); this.$emit('update:visible', false); this.wisdomBodyName = ""; diff --git a/main/manager-web/src/components/DeviceItem.vue b/main/manager-web/src/components/DeviceItem.vue index 4ad34709..729b3d1f 100644 --- a/main/manager-web/src/components/DeviceItem.vue +++ b/main/manager-web/src/components/DeviceItem.vue @@ -20,12 +20,12 @@
配置角色
-
- 声纹识别 -
-
- 历史对话 -
+ + + + + +
设备管理
diff --git a/main/manager-web/src/components/HeaderBar.vue b/main/manager-web/src/components/HeaderBar.vue index 2efee6c1..df5dbc95 100644 --- a/main/manager-web/src/components/HeaderBar.vue +++ b/main/manager-web/src/components/HeaderBar.vue @@ -88,7 +88,7 @@ export default { methods: { goHome() { // 跳转到首页 - this.$router.push('/') + this.$router.push('/home') }, goUserManagement() { this.$router.push('/user-management') @@ -135,13 +135,16 @@ export default { try { // 调用 Vuex 的 logout action await this.logout(); - - this.$message.success('退出登录成功'); - - this.$router.push('/login'); + this.$message.success({ + message:'退出登录成功', + showClose:true + }); } catch (error) { console.error('退出登录失败:', error); - this.$message.error('退出登录失败,请重试'); + this.$message.error({ + message:'退出登录失败,请重试', + showClose:true + }); } }, @@ -203,6 +206,7 @@ export default { } .equipment-management { + padding: 0 9px; width: 82px; height: 24px; border-radius: 12px; diff --git a/main/manager-web/src/router/index.js b/main/manager-web/src/router/index.js index 007e33aa..a6f2f2a6 100644 --- a/main/manager-web/src/router/index.js +++ b/main/manager-web/src/router/index.js @@ -76,6 +76,20 @@ const router = new VueRouter({ routes }) +// 全局处理重复导航,改为刷新页面 +const originalPush = VueRouter.prototype.push +VueRouter.prototype.push = function push(location) { + return originalPush.call(this, location).catch(err => { + if (err.name === 'NavigationDuplicated') { + // 如果是重复导航,刷新页面 + window.location.reload() + } else { + // 其他错误正常抛出 + throw err + } + }) +} + // 需要登录才能访问的路由 const protectedRoutes = ['home', 'RoleConfig', 'DeviceManagement', 'UserManagement', 'ModelConfig'] diff --git a/main/manager-web/src/store/index.js b/main/manager-web/src/store/index.js index e3e21789..15377c71 100644 --- a/main/manager-web/src/store/index.js +++ b/main/manager-web/src/store/index.js @@ -1,6 +1,7 @@ import Vue from 'vue' import Vuex from 'vuex' import Constant from '../utils/constant' +import {goToPage} from "@/utils"; Vue.use(Vuex) @@ -51,7 +52,8 @@ export default new Vuex.Store({ logout({ commit }) { return new Promise((resolve) => { commit('clearAuth') - window.location.href = '/login'; + goToPage(Constant.PAGE.LOGIN,true); + window.location.reload(); // 彻底重置状态 }) } }, diff --git a/main/manager-web/src/views/UserManagement.vue b/main/manager-web/src/views/UserManagement.vue index aee22aec..b6c4308e 100644 --- a/main/manager-web/src/views/UserManagement.vue +++ b/main/manager-web/src/views/UserManagement.vue @@ -1,62 +1,67 @@ @@ -70,7 +75,7 @@ export default { data() { return { showViewPassword: false, - currentPassword: '', // 存储获取到的密码 + currentPassword: '', searchPhone: '', userList: [], currentPage: 1, @@ -102,7 +107,6 @@ export default { } }, methods: { - // 获取用户列表 fetchUsers() { adminApi.getUserList({ page: this.currentPage, @@ -118,19 +122,13 @@ export default { } }); }, - - // 搜索 handleSearch() { this.currentPage = 1; this.fetchUsers(); }, - - // 全选 handleSelectAll() { this.$refs.userTable.toggleAllSelection(); }, - - // 批量删除用户 batchDelete() { const selectedUsers = this.$refs.userTable.selection; if (selectedUsers.length === 0) { @@ -186,8 +184,6 @@ export default { this.$message.info('已取消删除'); }); }, - - // 批量启用用户 batchEnable() { const selectedUsers = this.$refs.userTable.selection; if (selectedUsers.length === 0) { @@ -199,16 +195,12 @@ export default { }); this.$message.success('启用操作成功'); }, - - // 批量禁用用户 batchDisable() { this.userList.forEach(user => { user.status = '禁用'; }); this.$message.success('状态已更新为禁用'); }, - - // 重置密码 resetPassword(row) { this.$confirm('重置后将会生成新密码,是否继续?', '提示', { confirmButtonText: '确定', @@ -231,8 +223,6 @@ export default { row.status = '正常'; console.log('恢复用户:', row); }, - - // 用户删除 deleteUser(row) { this.$confirm('确定要删除该用户吗?', '警告', { confirmButtonText: '确定', @@ -275,289 +265,155 @@ export default { this.currentPage = page; this.fetchUsers(); }, - } }; + \ No newline at end of file diff --git a/main/manager-web/src/views/home.vue b/main/manager-web/src/views/home.vue index 8c676897..09a2f947 100644 --- a/main/manager-web/src/views/home.vue +++ b/main/manager-web/src/views/home.vue @@ -109,10 +109,16 @@ export default { import('@/apis/module/agent').then(({ default: userApi }) => { userApi.deleteAgent(agentId, (res) => { if (res.data.code === 0) { - this.$message.success('删除成功'); + this.$message.success({ + message: '删除成功', + showClose: true + }); this.fetchAgentList(); // 刷新列表 } else { - this.$message.error(res.data.msg || '删除失败'); + this.$message.error({ + message: res.data.msg || '删除失败', + showClose: true + }); } }); });