Переглянути джерело

fix:系统已到期,退出登录解决问题解决完成

李帅 2 місяців тому
батько
коміт
6e5096cd2e
2 змінених файлів з 32 додано та 20 видалено
  1. 10 4
      src/utils/request.js
  2. 22 16
      src/views/settingsPage/clinicOverview/edit.vue

+ 10 - 4
src/utils/request.js

@@ -1,7 +1,7 @@
1 1
 import axios from 'axios'
2 2
 import { Notification, MessageBox, Message, Loading } from 'element-ui'
3 3
 import store from '@/store'
4
-import { getToken } from '@/utils/auth'
4
+import { getToken ,removeToken } from '@/utils/auth'
5 5
 import errorCode from '@/utils/errorCode'
6 6
 import { tansParams, blobValidate } from "@/utils/ruoyi";
7 7
 import cache from '@/plugins/cache'
@@ -16,8 +16,9 @@ export let isRelogin = { show: false };
16 16
 axios.defaults.headers['Content-Type'] = 'application/json;charset=utf-8'
17 17
 // 创建axios实例
18 18
 const service = axios.create({
19
-  baseURL: process.env.VUE_APP_BASE_API,
20
-  // baseURL: "http://39.105.121.97:8080/api",
19
+  // baseURL: process.env.VUE_APP_BASE_API,
20
+  baseURL: "http://39.105.121.97:8080/api",
21
+  // baseURL: "http://106.74.15.131:81/api",
21 22
   
22 23
   // axios中请求配置有baseURL选项,表示请求URL公共部分
23 24
   // baseURL: "http://192.168.3.142:8081/api",
@@ -105,6 +106,7 @@ service.interceptors.response.use(res => {
105 106
       if (!isRelogin.show) {
106 107
         isRelogin.show = true;
107 108
         MessageBox.confirm('登录状态已过期,您可以继续留在该页面,或者重新登录', '系统提示', { confirmButtonText: '重新登录', cancelButtonText: '取消', type: 'warning' }).then(() => {
109
+          console.log(getToken,"getToken");
108 110
           isRelogin.show = false;
109 111
           store.dispatch('LogOut').then(() => {
110 112
             location.href = '/index';
@@ -125,7 +127,11 @@ service.interceptors.response.use(res => {
125 127
       Notification.error({ title: msg })
126 128
       return Promise.reject('error')
127 129
     } else {
128
-      return  JSON.parse(cyptoTool.methods.decrypt(res.data)) 
130
+      if(res.data.msg && res.data.msg ==="退出成功"){
131
+        return res.data
132
+      } else {
133
+        return  JSON.parse(cyptoTool.methods.decrypt(res.data)) 
134
+      }
129 135
     }
130 136
   },
131 137
   error => {

+ 22 - 16
src/views/settingsPage/clinicOverview/edit.vue

@@ -133,12 +133,12 @@
133 133
         <el-col :span="8">
134 134
           <ul>
135 135
             <li class="li_box">
136
-              <el-form-item label="营业执照编码" style="width: 95%">
136
+              <el-form-item label="营业执照编码" label-width="120px" style="width: 95%">
137 137
                 <el-input v-model="ruleForm.businessLicenseCode"></el-input>
138 138
               </el-form-item>
139 139
             </li>
140 140
             <li class="li_box">
141
-              <el-form-item label="营业时间" style="width: 95%">
141
+              <el-form-item label="营业时间" label-width="120px" style="width: 95%">
142 142
                 <el-time-select
143 143
                   placeholder="开始时间"
144 144
                   v-model="ruleForm.businessStartTime"
@@ -189,7 +189,7 @@
189 189
           </ul>
190 190
         </el-col>
191 191
         <el-col :span="8"> 
192
-          <el-form-item label="诊所编号标识" style="width: 95%">
192
+          <el-form-item label="诊所编号标识" style="width: 95%" label-width="120px" prop="clinicCode">
193 193
             <el-input v-model="ruleForm.clinicCode"></el-input>
194 194
           </el-form-item>
195 195
         </el-col>
@@ -338,7 +338,6 @@ import { regionData } from 'element-china-area-data'
338 338
 import { upload } from '@/api/system/user.js'
339 339
 import { clinicInfo } from '@/api/allApi.js'
340 340
 import banner from "./banner.vue";
341
-import store from "@/store";
342 341
 
343 342
 export default {
344 343
   name: 'EitcErmPcEdit',
@@ -370,6 +369,9 @@ export default {
370 369
         detailedAddress: [
371 370
           { required: true, message: '请输入详细地址', trigger: 'blur' }
372 371
         ],
372
+        clinicCode: [
373
+          { required: true, message: '请输入诊所编号标识', trigger: 'blur' }
374
+        ],
373 375
         region: [
374 376
           { required: true, message: '请选择诊所所在地区', trigger: 'change' }
375 377
         ]
@@ -498,18 +500,22 @@ export default {
498 500
       this.banner3 = ''
499 501
       this.bannerList3 = []
500 502
     },
501
-    async preserve() {
502
-      if(this.ruleForm.city.length && Array.isArray(this.ruleForm.city)) {
503
-        this.ruleForm.city = this.ruleForm.city.join()
504
-      }
505
-
506
-      this.ruleForm.bannerPic1 = this.banner1
507
-      this.ruleForm.bannerPic2 = this.banner2
508
-      this.ruleForm.bannerPic3 = this.banner3
509
-      const res = await clinicInfo(this.ruleForm)
510
-      if (res.code !== 200) return this.$message.$error(res.msg)
511
-      this.$message.success('保存成功')
512
-      this.$emit('cancel')
503
+    preserve() {
504
+      this.$refs.ruleForm.validate(async(valid) => {
505
+        if (valid) {
506
+          if(this.ruleForm.city.length && Array.isArray(this.ruleForm.city)) {
507
+            this.ruleForm.city = this.ruleForm.city.join()
508
+          }
509
+    
510
+          this.ruleForm.bannerPic1 = this.banner1
511
+          this.ruleForm.bannerPic2 = this.banner2
512
+          this.ruleForm.bannerPic3 = this.banner3
513
+          const res = await clinicInfo(this.ruleForm)
514
+          if (res.code !== 200) return this.$message.$error(res.msg)
515
+          this.$message.success('保存成功')
516
+          this.$emit('cancel')
517
+        }
518
+      })
513 519
     },
514 520
     handleStartTimeChange(value) {
515 521
       // 当开始时间变化时,更新结束时间的最小选择时间