提交 1027ff95ca72ca5742322e8c1fb0d52216856b37

作者 wangyu
1 个父辈 65a7c6db

修改ossurl的获取为调接口获取

... ... @@ -68,6 +68,7 @@ App({
68 68 url: '../guide/guide'
69 69 })
70 70 }
  71 + that.configOssUrl()
71 72 }
72 73 },
73 74 fail: function (res) {
... ... @@ -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 122 globalData: {
96 123 appId: appId,
97 124 onshow_count: 0,
98 125 // baseUrl: "http://47.96.75.229:20000/",
99 126 baseUrl: "https://api.workai.com.cn/",
100   - OSSUrl: "https://oss.workai.com.cn/",
  127 + OSSUrl: "",//"https://oss.workai.com.cn/",
101 128 userInfo: null,
102 129 hasLogin: false,
103 130 openid: null,
... ...
... ... @@ -117,7 +117,7 @@ Page({
117 117 app.globalData.tenant_id = tenant.id;
118 118 app.globalData.userInfo = user;
119 119 app.globalData.wx_open_id = user.wx_open_id;
120   -
  120 + app.configOssUrl()
121 121 wx.reLaunch({
122 122 url: '../main/guide/guide'
123 123 })
... ...
... ... @@ -17,6 +17,9 @@ Page({
17 17 */
18 18 onLoad: function(options) {
19 19 console.log('onLoad')
  20 + if (app.globalData.Authorization && app.globalData.OSSUrl.length == 0) {
  21 + app.configOssUrl()
  22 + }
20 23
21 24 },
22 25
... ...
注册登录 后发表评论