| | |
| | | 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) : '' |
| | |
| | | const url = currentPage.route |
| | | let options = currentPage.options |
| | | let urlargs = `/${url}?` |
| | | wx.clearStorageSync(); |
| | | // wx.clearStorageSync(); |
| | | if (!clearStorage) { |
| | | clearStorage = true; |
| | | if (!timer) { |
| | |
| | | }, 4000); |
| | | } |
| | | // urlargs = JSON.stringify(urlargs) |
| | | console.log() |
| | | let strOpt = JSON.stringify(options) |
| | | let currentUrl = { |
| | | options: options, |
| | | backUrl: urlargs |
| | | } |
| | | currentUrl = JSON.stringify(currentUrl) |
| | | // 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 { |
| | | wx.showToast({ |