正在显示
3 个修改的文件
包含
32 行增加
和
2 行删除
@@ -68,6 +68,7 @@ App({ | @@ -68,6 +68,7 @@ App({ | ||
68 | url: '../guide/guide' | 68 | url: '../guide/guide' |
69 | }) | 69 | }) |
70 | } | 70 | } |
71 | + that.configOssUrl() | ||
71 | } | 72 | } |
72 | }, | 73 | }, |
73 | fail: function (res) { | 74 | fail: function (res) { |
@@ -92,12 +93,38 @@ App({ | @@ -92,12 +93,38 @@ App({ | ||
92 | } | 93 | } |
93 | }, | 94 | }, |
94 | 95 | ||
96 | + configOssUrl: function () { | ||
97 | + wx.showLoading() | ||
98 | + var that = this | ||
99 | + wx.request({ | ||
100 | + url: this.globalData.baseUrl + "filemeta/v1/config", | ||
101 | + header: { | ||
102 | + 'Authorization': this.globalData.Authorization | ||
103 | + }, | ||
104 | + method: 'GET', | ||
105 | + success: function (result) { | ||
106 | + console.log('获取OSSURL 成功', result.data.app_url) | ||
107 | + that.globalData.OSSUrl = result.data.app_url; | ||
108 | + }, | ||
109 | + fail: function (res) { | ||
110 | + console.log('获取OSSURL 失败', res) | ||
111 | + wx.showToast({ | ||
112 | + icon: "none", | ||
113 | + title: "云存储功能失效,请联系开发人员", | ||
114 | + }) | ||
115 | + }, | ||
116 | + complete: function () { | ||
117 | + wx.hideLoading() | ||
118 | + } | ||
119 | + }) | ||
120 | + }, | ||
121 | + | ||
95 | globalData: { | 122 | globalData: { |
96 | appId: appId, | 123 | appId: appId, |
97 | onshow_count: 0, | 124 | onshow_count: 0, |
98 | // baseUrl: "http://47.96.75.229:20000/", | 125 | // baseUrl: "http://47.96.75.229:20000/", |
99 | baseUrl: "https://api.workai.com.cn/", | 126 | baseUrl: "https://api.workai.com.cn/", |
100 | - OSSUrl: "https://oss.workai.com.cn/", | 127 | + OSSUrl: "",//"https://oss.workai.com.cn/", |
101 | userInfo: null, | 128 | userInfo: null, |
102 | hasLogin: false, | 129 | hasLogin: false, |
103 | openid: null, | 130 | openid: null, |
@@ -117,7 +117,7 @@ Page({ | @@ -117,7 +117,7 @@ Page({ | ||
117 | app.globalData.tenant_id = tenant.id; | 117 | app.globalData.tenant_id = tenant.id; |
118 | app.globalData.userInfo = user; | 118 | app.globalData.userInfo = user; |
119 | app.globalData.wx_open_id = user.wx_open_id; | 119 | app.globalData.wx_open_id = user.wx_open_id; |
120 | - | 120 | + app.configOssUrl() |
121 | wx.reLaunch({ | 121 | wx.reLaunch({ |
122 | url: '../main/guide/guide' | 122 | url: '../main/guide/guide' |
123 | }) | 123 | }) |
@@ -17,6 +17,9 @@ Page({ | @@ -17,6 +17,9 @@ 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) { | ||
21 | + app.configOssUrl() | ||
22 | + } | ||
20 | 23 | ||
21 | }, | 24 | }, |
22 | 25 |
请
注册
或
登录
后发表评论