|
@@ -13,6 +13,14 @@ App({
|
|
|
|
|
|
|
|
globalData: {
|
|
globalData: {
|
|
|
storeId: null,
|
|
storeId: null,
|
|
|
|
|
+ /**
|
|
|
|
|
+ * userProfileDTO: {
|
|
|
|
|
+ * isBindPhoneNumber: false
|
|
|
|
|
+ subMchList: []
|
|
|
|
|
+ userId: "107"
|
|
|
|
|
+ userType: "10"
|
|
|
|
|
+ }
|
|
|
|
|
+ */
|
|
|
mUser: null,
|
|
mUser: null,
|
|
|
},
|
|
},
|
|
|
|
|
|
|
@@ -21,7 +29,7 @@ App({
|
|
|
// 登录
|
|
// 登录
|
|
|
wx.login({
|
|
wx.login({
|
|
|
success: res => {
|
|
success: res => {
|
|
|
- // 发送 res.code 到后台换取 openId, sessionKey, unionId
|
|
|
|
|
|
|
+ // 发送 res.code 到后台换取 accessTokenDTO, userProfileDTO
|
|
|
console.log("code", res);
|
|
console.log("code", res);
|
|
|
if (res.code){
|
|
if (res.code){
|
|
|
wx.request({
|
|
wx.request({
|
|
@@ -32,16 +40,13 @@ App({
|
|
|
},
|
|
},
|
|
|
header: {
|
|
header: {
|
|
|
'content-type': 'application/x-www-form-urlencoded',
|
|
'content-type': 'application/x-www-form-urlencoded',
|
|
|
- // 'X-Referrer-Id': codeUrl[1] || '',
|
|
|
|
|
- // 'X-Store-Id': codeUrl[0] || ''
|
|
|
|
|
- 'X-Referrer-Id': '',
|
|
|
|
|
- 'X-Store-Id': ''
|
|
|
|
|
|
|
+ 'X-Referrer-Id': '', // 旧租户字段
|
|
|
|
|
+ 'X-Store-Id': '', // 旧租户字段
|
|
|
},
|
|
},
|
|
|
success:(res)=> {
|
|
success:(res)=> {
|
|
|
console.log(res);
|
|
console.log(res);
|
|
|
- // this.globalData.mUser = res.data.data;
|
|
|
|
|
- // this.globalData.storeId = '';
|
|
|
|
|
- // this.data.loginSuccess = true;
|
|
|
|
|
|
|
+ this.globalData.mUser = res.data.data;
|
|
|
|
|
+ wx.setStorageSync('accessToken', this.globalData.mUser.accessTokenDTO.accessToken);
|
|
|
},
|
|
},
|
|
|
fail: function(res){
|
|
fail: function(res){
|
|
|
console.log(res);
|
|
console.log(res);
|