...
|
...
|
@@ -2,7 +2,57 @@ |
|
|
App({
|
|
|
onLaunch: function () {
|
|
|
// 展示本地存储能力
|
|
|
wx.request({
|
|
|
url: 'http://39.97.184.199:8080/CommonInterface/GetToken',
|
|
|
|
|
|
method: 'POST',
|
|
|
|
|
|
success: function (res) {//返回取得的数据
|
|
|
console.log(res.data.ResultObj)
|
|
|
wx.setStorageSync('authToken', res.data.ResultObj)
|
|
|
if (res.data.code == '20000') {
|
|
|
resolve(res.data.data);
|
|
|
}
|
|
|
},
|
|
|
fail: function (e) {
|
|
|
reject('网络出错');
|
|
|
// wx.hideLoading()
|
|
|
wx.hideNavigationBarLoading()
|
|
|
},
|
|
|
complate() {
|
|
|
wx.hideLoading({
|
|
|
title: '加载中',
|
|
|
})
|
|
|
}
|
|
|
})
|
|
|
|
|
|
|
|
|
// wx.request({
|
|
|
// url: 'http://39.97.184.199:8080//Staff/GetAccessToken',
|
|
|
|
|
|
|
|
|
// method: 'POST',
|
|
|
|
|
|
// success: function (res) {//返回取得的数据
|
|
|
// console.log(res.data.ResultObj)
|
|
|
// wx.setStorageSync('authToken', res.data.ResultObj)
|
|
|
// if (res.data.code == '20000') {
|
|
|
// resolve(res.data.data);
|
|
|
// }
|
|
|
// },
|
|
|
// fail: function (e) {
|
|
|
// reject('网络出错');
|
|
|
// // wx.hideLoading()
|
|
|
// wx.hideNavigationBarLoading()
|
|
|
// },
|
|
|
// complate() {
|
|
|
// wx.hideLoading({
|
|
|
// title: '加载中',
|
|
|
// })
|
|
|
// }
|
|
|
// })
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
//封装post
|
...
|
...
|
@@ -18,23 +68,24 @@ App({ |
|
|
// wx.showLoading({
|
|
|
// title: '加载中',
|
|
|
// })
|
|
|
let that = this;
|
|
|
|
|
|
wx.showNavigationBarLoading()
|
|
|
wx.showLoading({
|
|
|
title: '加载中',
|
|
|
})
|
|
|
var promise = new Promise((resolve, reject) => {
|
|
|
//init
|
|
|
let that = this;
|
|
|
let postData = data;
|
|
|
let baseUrl = 'http://39.97.184.199:8080';
|
|
|
|
|
|
|
|
|
//网络请求
|
|
|
let header = {
|
|
|
'content-type': 'application/x-www-form-urlencoded'
|
|
|
'content-type': 'application/x-www-form-urlencoded',
|
|
|
'authToken': wx.getStorageSync('authToken')||''
|
|
|
}
|
|
|
header = Object.assign(header, headerParams)
|
|
|
wx.request({
|
|
|
url: baseUrl + url,
|
|
|
url: that.globalData.baseUrl + url,
|
|
|
data: postData,
|
|
|
method: 'POST',
|
|
|
header: header,
|
...
|
...
|
@@ -124,6 +175,10 @@ App({ |
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//上传文件
|
|
|
upload(filetype, file) {
|
|
|
|
...
|
...
|
@@ -171,7 +226,9 @@ App({ |
|
|
return promise;
|
|
|
},
|
|
|
globalData: {
|
|
|
userInfo: null
|
|
|
userInfo: null,
|
|
|
baseUrl : 'http://39.97.184.199:8080'
|
|
|
|
|
|
},
|
|
|
|
|
|
|
...
|
...
|
|