提交 28db86b782fa0d36ecb2648c6506dc98eae09f71

作者 wangyu
1 个父辈 1027ff95

ossurl配置

正在显示 2 个修改的文件 包含 24 行增加22 行删除
... ... @@ -48,27 +48,29 @@ App({
48 48 },
49 49 success: function (res) {
50 50 console.log("getTokenByCode", res.data)
51   - var user = res.data.user;
52   - var tenant = res.data.tenant;
53   - that.globalData.tenant_id = tenant.id;
54   - that.globalData.userInfo = res.data.user;
55   - that.globalData.wx_open_id = user.wx_open_id;
56   - that.globalData.Authorization = "Bearer " + res.data.access_token;
57   - that.globalData.refresh_token = res.data.refresh_token;
58   - if (user && user.type == "0") {//匿名用户
59   - wx.redirectTo({
60   - url: '../../getPhone/getPhone'
61   - })
62   - } else if (user && user.type == "1") {//注册用户
63   - if (relaunch) {
64   - // wx.reLaunch({ //重新加载
65   - // url: '../home/home'
66   - // })
67   - wx.reLaunch({
68   - url: '../guide/guide'
  51 + if(res.statusCode<300){
  52 + var user = res.data.user;
  53 + var tenant = res.data.tenant;
  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'
69 62 })
  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()
70 73 }
71   - that.configOssUrl()
72 74 }
73 75 },
74 76 fail: function (res) {
... ... @@ -103,7 +105,7 @@ App({
103 105 },
104 106 method: 'GET',
105 107 success: function (result) {
106   - console.log('获取OSSURL 成功', result.data.app_url)
  108 + console.log('获取OSSURL 成功', result.data)
107 109 that.globalData.OSSUrl = result.data.app_url;
108 110 },
109 111 fail: function (res) {
... ... @@ -122,6 +124,7 @@ App({
122 124 globalData: {
123 125 appId: appId,
124 126 onshow_count: 0,
  127 + // baseUrl: "http://47.99.47.16:20000/",
125 128 // baseUrl: "http://47.96.75.229:20000/",
126 129 baseUrl: "https://api.workai.com.cn/",
127 130 OSSUrl: "",//"https://oss.workai.com.cn/",
... ...
1 1 var OSSInit;
2 2 var baseUrl = getApp().globalData.baseUrl;
3   -var OSSUrl = getApp().globalData.OSSUrl;
4 3 Page({
5 4
6 5 /**
... ... @@ -99,7 +98,7 @@ Page({
99 98 })
100 99 console.log('key', 'imagepath_' + path.substring(path.length - 10, path.length))
101 100 wx.uploadFile({
102   - url: OSSUrl,
  101 + url: getApp().globalData.OSSUrl,
103 102 filePath: path,
104 103 name: 'file',
105 104 formData: {
... ...
注册登录 后发表评论