Ver código fonte

修改账户状态

huangbin 4 anos atrás
pai
commit
fb51e75902

+ 9 - 4
src/App.vue

@@ -19,6 +19,12 @@ import { setLoadComplete } from '@/setup/methods/index';
 import { isLogin, logout } from '@/services/bus/login';
 let lastTime = new Date().getTime();
 
+function logoutAction() {
+    logout();
+    APP.closeServer();
+    Router.replace('/login');
+}
+
 // 设置太久没有操作界面,自动退出界面功能
 function setOvertime() {
     window.addEventListener('mousemove', () => {
@@ -39,9 +45,7 @@ function setOvertime() {
                         okText: '确定',
                         keyboard: false,
                     });
-                    logout();
-                    APP.closeServer();
-                    Router.replace('/login');
+                    logoutAction();
                 }
             }
         },
@@ -59,12 +63,13 @@ export default defineComponent({
 
         // 登出状态展示
         eventBus.$onOnly('logout', () => {
+            // debugger;
             tip.value = '跳转中...';
             spinning.value = true;
             TimerUtils.setTimeout(
                 () => {
                     spinning.value = false;
-                    APP.closeServer();
+                    logoutAction();
                 },
                 1000,
                 'logoutTimer'

+ 4 - 3
src/layout/top.vue

@@ -1,18 +1,19 @@
 <template>
   <a-layout class="layout-top">
-    <a-layout-header class="m-layout-header">
+    <a-layout-header class="m-layout-header"
+                     @contextmenu.prevent>
       <div>深圳市多元世纪信息技术股份有限公司</div>
       <div class="m-layout-header-right">
         <div>
           <span>{{ username }},您好!</span>
         </div>
         <div class="relative">
-          <a-input-search ref="userNameInput"
+          <!-- <a-input-search ref="userNameInput"
                           class="searchInput"
                           readonly
                           placeholder="请输入代码/名称"
                           @pressEnter="search">
-          </a-input-search>
+          </a-input-search> -->
           <!-- <a-icon type="search" /> -->
         </div>
         <div class="news-container">

+ 4 - 0
src/router/index.ts

@@ -33,6 +33,7 @@ const routes: Array<RouteRecordRaw> = [
                 path: '/forward',
                 name: 'forward',
                 component: () => import('@/views/market/forward/index.vue'),
+
             },
             {
                 path: '/warehouse-trade',
@@ -43,6 +44,9 @@ const routes: Array<RouteRecordRaw> = [
                 path: '/outaccount_status',
                 name: 'accountStatus',
                 component: () => import('@/views/account/accountStatus.vue'),
+                meta: {
+                    requireAuth: true
+                },
             },
 
         ],

+ 4 - 3
src/utils/request/request.ts

@@ -1,7 +1,6 @@
-import axios from 'axios';
-import Router from '@/router';
 import { getToken } from '@/services/bus/token';
-import APP from '@/services/index';
+import eventBus from '@/utils/eventBus/index';
+import axios from 'axios';
 
 const request = axios.create({
     // 配置选项
@@ -39,6 +38,8 @@ request.interceptors.response.use(
                 console.error(`${data.msg}(${data.code})`);
             } else if (status === 401) {
                 // 主要处理token失效时 页面进行接口请求时的异常情况
+
+                eventBus.$emit('logout');
                 console.warn('待处理,token失效')
             } else if (status === 403) {
                 console.error(`${data.msg}(${data.code})`);

+ 3 - 1
src/views/account/accountStatus.vue

@@ -1,5 +1,6 @@
 <template>
-  <div class="account-status">
+  <div class="account-status"
+       @contextmenu.prevent>
     <firstMenu :list="menulist"
                :value="'value'"
                @selectMenu="selectMenu" />
@@ -117,6 +118,7 @@ export default defineComponent({
 
 <style lang="less">
 .account-status {
+    height: 100%;
     .ant-table-wrapper {
         margin-left: 1px;
         .ant-table-body > table {