Ver código fonte

提交代码~

release/210823_需求对对碰
王饶冀 3 anos atrás
pai
commit
7ea1f3f026
2 arquivos alterados com 18 adições e 25 exclusões
  1. 11
    11
      app.js
  2. 7
    14
      pages/login/login.js

+ 11
- 11
app.js Ver arquivo

@@ -1,12 +1,7 @@
// app.js
App({
onLaunch() {
// 获取本地用户信息
const userInfo = wx.getStorageSync('userInfo') || null;
if(userInfo){
this.globalData.userInfo = userInfo;
console.log(`从本地拿到的userInfo`)
}

// 版本更新
const updateManager = wx.getUpdateManager()

@@ -61,12 +56,17 @@ App({
success: (result) => {
console.log("微信LOGIN result")
if (!!result.data && result.data.openid) {
// this.globalData.openid = result.data.openid;
this.globalData.openid = result.data.openid;
this.globalData.appid = result.data.appid;
this.globalData.sessionKey = result.data.sessionKey;
// 获取本地用户信息
const userInfo = wx.getStorageSync('userInfo') || null;
console.log(userInfo,'userInfo')
if(userInfo){
this.globalData.userInfo = userInfo;
}
}
}
}
})
} else {
wx.showToast({
@@ -80,8 +80,8 @@ App({
},
globalData: {
userInfo: null,
openid: "oBkT7vu1Q8l-xsbux_i1FNmRWuJ4",
// openid:"",
// openid: "oBkT7vu1Q8l-xsbux_i1FNmRWuJ4",
openid: "",
appid: "",
sessionKey: "",
suiteCode: "",

+ 7
- 14
pages/login/login.js Ver arquivo

@@ -42,6 +42,10 @@ Page({
},
// 保存用户信息
appletLogin(iv, encryptedData) {
wx.showLoading({
title: '登录中...',
mask: true
})
let { nickName, gender, country, city, province, avatarUrl } = this.data.userInfo;
$request.get('/com/appletLogin.action', {
// openid: app.globalData.openid,
@@ -56,7 +60,7 @@ Page({
province,
city
}).then(res => {
// console.log(res,'保存用户信息返回的Res')
console.log(res,'保存用户信息返回的Res')
this.getUserSession()
}).catch(error => {
console.log(error, 'error appletLogin')
@@ -103,21 +107,10 @@ Page({
// 保存个人信息后拿到新数据
getUserSession() {
let that = this
wx.showLoading({
title: '加载中',
mask: true
})
$request.post('/script/getSession.action', {}).then(res => {
console.log(res, 'getUserSession---res')
wx.hideLoading()
app.globalData.customerId = res.data.customer.customerId
// wx.navigateTo({
// url: "/pages/mine/mine", //跳转页面的路径,可带参数 ?隔开,不同参数用 & 分隔;相对路径,不需要.wxml后缀
// success: function () {}, //成功后的回调;
// fail: function () {}, //失败后的回调;
// complete: function () {} //结束后的回调(成功,失败都会执行)
// })

app.globalData.customerId = res.data.customer.customerId;
wx.navigateBack()
}).catch(error => {
console.log(error, "获取error")
})

Carregando…
Cancelar
Salvar