diff --git a/src/utils/request.js b/src/utils/request.js index e4cb091f..18c24eee 100644 --- a/src/utils/request.js +++ b/src/utils/request.js @@ -7,6 +7,8 @@ import { tansParams, blobValidate } from '@/utils/bonus' import cache from '@/plugins/cache' import { saveAs } from 'file-saver' import { decryptWithSM4, encryptWithSM4, hashWithSM3AndSalt } from '@/utils/sm' +import router from '@/router' + const systemConfig = JSON.parse(localStorage.getItem('systemConfig')) || { requestConfig: { encryptRequest: false, checkIntegrity: false, encryptResponse: false } }; @@ -110,9 +112,9 @@ service.interceptors.response.use(res => { if (code === 401) { console.log('🚀 ~ process.env.VUE_APP_BASE_API:', process.env.VUE_APP_BASE_API) if (process.env.VUE_APP_BASE_API == '/iws/jiju-api') { - this.$store.dispatch('LogOut').then(() => { + store.dispatch('LogOut').then(() => { }).catch((err) => { - console.log('🚀 ~ this.$store.dispatch ~ err:', err) + console.log('🚀 ~ store.dispatch ~ err:', err) }) setTimeout(() => { // 'http://sgwpdm.ah.sgcc.com.cn/iws/cas/login?appId=3874dcb953f184dc75450e33d6d6d4fa&service=http://sgwpdm.ah.sgcc.com.cn/iws/mea-view/', @@ -121,11 +123,11 @@ service.interceptors.response.use(res => { ) }, 500) } else { - this.$store.dispatch('LogOut').then(() => { + store.dispatch('LogOut').then(() => { // location.href = '/login' - this.$router.push('/login') + router.push('/login') }).catch(() => { - this.$router.push('/login') + router.push('/login') }) } return Promise.reject('无效的会话,或者会话已过期,请重新登录。') diff --git a/src/views/login1.vue b/src/views/login1.vue index 46dca383..2ae8d78b 100644 --- a/src/views/login1.vue +++ b/src/views/login1.vue @@ -201,7 +201,7 @@ export default { verificationCode: [{ required: true, trigger: 'blur', message: '请输入验证码' }] }, loading: false, - captchaEnabled: true, + captchaEnabled: false, redirect: undefined, isSendingCode: false, countdown: 0, @@ -212,8 +212,16 @@ export default { }, computed: { config() { + console.log('🚀 ~ config ~ config:', localStorage.getItem('systemConfig')) + let systemConfig = null + try { + systemConfig = JSON.parse(localStorage.getItem('systemConfig')) + console.log('🚀 ~ config ~ systemConfig:', systemConfig) + } catch (err) { + console.log('获取config失败:', err) + } return ( - JSON.parse(localStorage.getItem('systemConfig')) || { + systemConfig || { loginConfig: { phonePassword: true, emailPassword: true, @@ -225,7 +233,7 @@ export default { emailRegisters: true } } - ) // 获取 JSON 对象 + ) }, loginRules() { return this.loginMethod === 'password' ? this.passwordLoginRules : this.mobileLoginRules @@ -285,7 +293,6 @@ export default { } } else { this.isIws = false - this.getCode() this.getCookie() } },