Browse Source

no message

feature/v2.0
xpz2018 4 years ago
parent
commit
7f5b0a311a
3 changed files with 32 additions and 21 deletions
  1. 14
      pages/index/index.js
  2. 27
      pages/index/scene.js
  3. 12
      pages/login/index.js

14
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]

27
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)
}

12
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(() => {

Loading…
Cancel
Save