提交 71122b65770482f67707d87207072e7542545e5c

作者 wangyu
1 个父辈 28db86b7

oss优化

正在显示 2 个修改的文件 包含 21 行增加21 行删除
@@ -48,29 +48,29 @@ App({ @@ -48,29 +48,29 @@ App({
48 }, 48 },
49 success: function (res) { 49 success: function (res) {
50 console.log("getTokenByCode", res.data) 50 console.log("getTokenByCode", res.data)
51 - if(res.statusCode<300){  
52 - var user = res.data.user;  
53 - var tenant = res.data.tenant; 51 + var user = res.data.user;
  52 + var tenant = res.data.tenant;
  53 + if (tenant && tenant.length > 0) {
54 that.globalData.tenant_id = tenant.id; 54 that.globalData.tenant_id = tenant.id;
55 - that.globalData.userInfo = res.data.user;  
56 - that.globalData.wx_open_id = user.wx_open_id;  
57 - that.globalData.Authorization = "Bearer " + res.data.access_token;  
58 - that.globalData.refresh_token = res.data.refresh_token;  
59 - if (user && user.type == "0") {//匿名用户  
60 - wx.redirectTo({  
61 - url: '../../getPhone/getPhone' 55 + }
  56 + that.globalData.userInfo = res.data.user;
  57 + that.globalData.wx_open_id = user.wx_open_id;
  58 + that.globalData.Authorization = "Bearer " + res.data.access_token;
  59 + that.globalData.refresh_token = res.data.refresh_token;
  60 + if (user && user.type == "0") {//匿名用户
  61 + wx.redirectTo({
  62 + url: '../../getPhone/getPhone'
  63 + })
  64 + } else if (user && user.type == "1") {//注册用户
  65 + if (relaunch) {
  66 + // wx.reLaunch({ //重新加载
  67 + // url: '../home/home'
  68 + // })
  69 + wx.reLaunch({
  70 + url: '../guide/guide'
62 }) 71 })
63 - } else if (user && user.type == "1") {//注册用户  
64 - if (relaunch) {  
65 - // wx.reLaunch({ //重新加载  
66 - // url: '../home/home'  
67 - // })  
68 - wx.reLaunch({  
69 - url: '../guide/guide'  
70 - })  
71 - }  
72 - that.configOssUrl()  
73 } 72 }
  73 + that.configOssUrl()
74 } 74 }
75 }, 75 },
76 fail: function (res) { 76 fail: function (res) {
@@ -17,7 +17,7 @@ Page({ @@ -17,7 +17,7 @@ Page({
17 */ 17 */
18 onLoad: function(options) { 18 onLoad: function(options) {
19 console.log('onLoad') 19 console.log('onLoad')
20 - if (app.globalData.Authorization && app.globalData.OSSUrl.length == 0) { 20 + if (app.globalData.OSSUrl.length == 0) {
21 app.configOssUrl() 21 app.configOssUrl()
22 } 22 }
23 23
注册登录 后发表评论