From c99f9976a5ef9d8974105feb8fc0580a10adf98c Mon Sep 17 00:00:00 2001 From: QYF-GitLab1 <1940665526@qq.com> Date: 星期一, 23 十二月 2024 14:58:49 +0800 Subject: [PATCH] 111 --- assets/request/index.js | 48 ++++++++++++++++++++++++++++++++++++------------ 1 files changed, 36 insertions(+), 12 deletions(-) diff --git a/assets/request/index.js b/assets/request/index.js index d881bc1..d20f265 100644 --- a/assets/request/index.js +++ b/assets/request/index.js @@ -1,6 +1,11 @@ import config from "../js/config" - - +import { + loginInfo +} from '../js/login'; +const app = getApp() +let clearStorage = false; +let timer = null; +let backUrl = null const request = (params) => { let fullUrl = `${config.requestCtx}${params.url}` let token = wx.getStorageSync(config.tokenKey) ? wx.getStorageSync(config.tokenKey) : '' @@ -22,7 +27,7 @@ const url = currentPage.route let options = currentPage.options let urlargs = `/${url}?` - wx.clearStorageSync(); + // wx.clearStorageSync(); if (!clearStorage) { clearStorage = true; if (!timer) { @@ -31,14 +36,38 @@ }, 4000); } // urlargs = JSON.stringify(urlargs) + console.log() let strOpt = JSON.stringify(options) let currentUrl = { options: options, backUrl: urlargs } - currentUrl = JSON.stringify(currentUrl) - wx.reLaunch({ - url: urlargs ? '/pages/index/index?backUrl=' + encodeURIComponent(currentUrl) : '/pages/index/index' + // currentUrl = JSON.stringify(currentUrl) + // 涓嶅幓棣栭〉鐧诲綍锛岀洿鎺ヨ皟鐢ㄥ叕鍏辩櫥褰曟柟娉� + // wx.reLaunch({ + // url: urlargs ? '/pages/home/home?backUrl=' + encodeURIComponent(currentUrl) : '/pages/home/home' + // }) + console.log(currentUrl, 123) + loginInfo(app, (data) => { + if (data) { + if (currentUrl.options) { + for (let key in options) { + const value = currentUrl.options[key] + currentUrl.backUrl += `${key}=${value}&` + } + backUrl = currentUrl.backUrl + console.log(backUrl, "url") + if (backUrl) { + wx.reLaunch({ + url: backUrl + }) + } else { + wx.reLaunch({ + url: '/pages/home/home' + }) + } + } + } else {} }) } } else { @@ -47,11 +76,6 @@ icon: 'none' }) reject(res.data.message) - wx.login({ - success: (res) => { - console.log(res) - }, - }) } }, fail: (res) => { @@ -61,7 +85,7 @@ }) reject('鎺ュ彛璇锋眰閿欒') }, - complete: () => { } + complete: () => {} }) }) } -- Gitblit v1.9.1