From 68b6626ece8b94c1faa091ee3811e09c4af6d28f Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期二, 15 十月 2024 10:14:18 +0800 Subject: [PATCH] 2024-10-15 --- src/api/index.js | 47 ++++++++++++++++++++++++++++++++++++++++++++--- 1 files changed, 44 insertions(+), 3 deletions(-) diff --git a/src/api/index.js b/src/api/index.js index fa691dd..72e889c 100644 --- a/src/api/index.js +++ b/src/api/index.js @@ -47,6 +47,18 @@ okText: '鐭ラ亾浜�', onOk: () => { window.GLOB.$error = false + + localStorage.removeItem('UserID') + localStorage.removeItem('LoginUID') + localStorage.removeItem('User_Name') + localStorage.removeItem('Full_Name') + localStorage.removeItem('avatar') + localStorage.removeItem('dataM') + localStorage.removeItem('localDataM') + localStorage.removeItem('debug') + localStorage.removeItem('role_id') + localStorage.removeItem('mk_user_type') + sessionStorage.clear() if (!!(window.history && window.history.pushState)) { window.history.replaceState(null, null, window.location.href.split('#')[0] + '#/login') @@ -98,6 +110,25 @@ } /** + * @description 浣跨敤dostar鎺ュ彛锛岃烦杩囬獙璇� + * @param {Object} param 鏌ヨ鍙婃彁浜ゅ弬鏁� + */ + loginAndRedirect (param) { + let url = '' + if (process.env.NODE_ENV === 'production') { + url = document.location.origin + '/zh-CN/Home/LoginAndRedirect' + } else { + url = window.GLOB.location + '/zh-CN/Home/LoginAndRedirect' + } + + return axios({ + url: url, + method: 'post', + data: qs.stringify(param) + }) + } + + /* @description 鐩存帴璇锋眰 * @description 寰俊涓氬姟璇锋眰 鍘熸帴鍙� 'wxpay/getaccesstoken' */ // wxAccessToken (appId, domain = '') { @@ -733,6 +764,12 @@ } } + if (param.$type) { + url += '/' + param.$type + } + + delete param.$type + param = this.encryptParam(param) return new Promise((resolve) => { @@ -751,7 +788,7 @@ res.ErrCode = '-2' MKEmitter.emit('reloadTabs') } - if (res.status) { + if (res.status && id) { window.GLOB.CacheMap.set(id, res) } resolve(res) @@ -1038,6 +1075,12 @@ } } + if (param.$type) { + url += '/' + param.$type + } + + delete param.$type + param.username = sessionStorage.getItem('User_Name') || '' param.fullname = sessionStorage.getItem('Full_Name') || '' param.s_debug = window.GLOB.debugger ? 'Y' : '' @@ -1088,8 +1131,6 @@ * @description 娓呯┖鍚庣缂撳瓨 */ cacheInterface (param) { - param.userid = sessionStorage.getItem('UserID') || '' - param.LoginUID = sessionStorage.getItem('LoginUID') || '' param.appkey = window.GLOB.appkey || '' let url = '/webapi/excache' -- Gitblit v1.8.0