From 7f5b0a311ab0ce6bbbadccd35234280919c11692 Mon Sep 17 00:00:00 2001 From: xpz2018 <107107461@qq.com> Date: Thu, 10 Jun 2021 15:34:14 +0800 Subject: [PATCH] no message --- pages/index/index.js | 14 +++++++------- pages/index/scene.js | 27 ++++++++++++++------------- pages/login/index.js | 12 +++++++++++- 3 files changed, 32 insertions(+), 21 deletions(-) diff --git a/pages/index/index.js b/pages/index/index.js index a7c8e2e..2d6b0a7 100644 --- a/pages/index/index.js +++ b/pages/index/index.js @@ -2,7 +2,6 @@ import Scene from './scene' import { getMessageList } from "../../api/saas" import { headerFactoryId } from "../../api/user" -import util from '../../utils/util' const event = require('../../utils/event') const storage = require('../../utils/storage') const app = getApp() @@ -34,12 +33,13 @@ Scene({ }, /************************************** 初始化流程 ********************************************/ onLoad: function (options) { - const updateManager = wx.getUpdateManager() - updateManager.onCheckForUpdate() - updateManager.onUpdateReady(function () { - // 新的版本已经下载好,调用 applyUpdate 应用新版本并重启 - updateManager.applyUpdate() - }) + if (options.url) { + var path = options.url + if (options.key && options.value) { + path += '?' + options.key + '=' + options.value + } + wx.navigateTo({ url: path }) + } this.data.items = [] for (let mIndex = 0; mIndex < app.userInfo.enterpriseInfos.length; mIndex++) { const element = app.userInfo.enterpriseInfos[mIndex] diff --git a/pages/index/scene.js b/pages/index/scene.js index 6cf9864..69bad10 100644 --- a/pages/index/scene.js +++ b/pages/index/scene.js @@ -12,18 +12,19 @@ export default function Scene(config) { } } } - config.onUnload = function(options) { - if (onUnload) { - onUnload.call(this, options) - } - let pages = getCurrentPages() //当前页面栈 - if (pages.length == 1 && pages[0].route != 'pages/index/index') { - if (app.userInfo && app.userInfo.userId) { - wx.redirectTo({ url: '/pages/index/index' }) - } else { - wx.reLaunch({ url: '/pages/login/index' }) - } - } - } + // config.onUnload = function(options) { + // if (onUnload) { + // onUnload.call(this, options) + // } + // let pages = getCurrentPages() //当前页面栈 + // if (pages.length == 1 && pages[0].route != 'pages/index/index') { + // console.log('to login or to home>>>') + // if (app.userInfo && app.userInfo.userId) { + // wx.redirectTo({ url: '/pages/index/index' }) + // } else { + // wx.reLaunch({ url: '/pages/login/index' }) + // } + // } + // } return Page(config) } diff --git a/pages/login/index.js b/pages/login/index.js index 16ec038..b61f0e6 100644 --- a/pages/login/index.js +++ b/pages/login/index.js @@ -25,6 +25,7 @@ Page({ loging: false, regist: false, metaData: null, + url: null, code: null // code: '?mark=ztb_saas&QrCodeRecordId=597399780326510592' }, @@ -43,6 +44,11 @@ Page({ } else if(options.qrcode){ //分享进入 this.data.code = '?mark=ztb_saas&QrCodeRecordId=' + options.qrcode + } else if (options.url) { + this.data.url = options.url + if (options.key && options.value) { + this.data.url += '?' + options.key + '=' + options.value + } } this.wxLogin() }, @@ -114,7 +120,11 @@ Page({ } if(factoryId){ headerFactoryId(app.userInfo.factoryId) - wx.redirectTo({ url: '/pages/index/index' }) + if(this.data.url) { + wx.redirectTo({ url: '/pages/index/index?url=' + this.data.url }) + } else { + wx.redirectTo({ url: '/pages/index/index' }) + } } else { this.setData({ loging: false}) Dialog.alert({ title: '温馨提示', message: '还没有您所属的打包站信息,请联系相关客服人员' }).then(() => {