You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
// 志明
|
|
|
|
// let baseUrl = "http://192.168.10.55:9100/v1"
|
|
|
|
// 伟旭
|
|
|
|
// let baseUrl = "http://192.168.200.97:9100/v1"
|
|
|
|
// let baseUrl = "http://47.119.160.181:9082/v1"
|
|
|
|
// let baseUrl = "http://192.168.12.36:8080/v1"
|
|
|
|
// let baseUrl = "http://47.119.163.201:81/v1/v1"
|
|
|
|
let baseUrl = "http://56carrier.com:80/v1"
|
|
|
|
|
|
|
|
import store from '../store/index'
|
|
|
|
// import baseUrl from './config.js'
|
|
|
|
export default (options) => {
|
|
|
|
return new Promise((resolve, reject) => {
|
|
|
|
uni.request({
|
|
|
|
url: baseUrl + options.url,
|
|
|
|
method: options.method || 'GET',
|
|
|
|
header: {
|
|
|
|
'Content-Type': options.contentType || 'application/json; charset=utf-8;',
|
|
|
|
'Authorization':(store.state.token&& `Bearer ` + store.state.token) || ''
|
|
|
|
},
|
|
|
|
data: options.params,
|
|
|
|
success: res => {
|
|
|
|
const data = res.data
|
|
|
|
console.log(res.data,'res.data')
|
|
|
|
if( data.code === 200){
|
|
|
|
resolve(data)
|
|
|
|
} else if(data.code === 401){
|
|
|
|
uni.showToast({
|
|
|
|
title: data.message,
|
|
|
|
icon: 'none'
|
|
|
|
})
|
|
|
|
uni.clearStorage()
|
|
|
|
uni.reLaunch({
|
|
|
|
url: '/pages/login/index'
|
|
|
|
})
|
|
|
|
// reject(data.msg)
|
|
|
|
} else {
|
|
|
|
uni.showToast({
|
|
|
|
title: data.message,
|
|
|
|
icon: 'none'
|
|
|
|
})
|
|
|
|
reject(data.msg)
|
|
|
|
}
|
|
|
|
},
|
|
|
|
fail: err => {
|
|
|
|
uni.showToast({
|
|
|
|
title: '请检查您的网络',
|
|
|
|
icon: 'none'
|
|
|
|
})
|
|
|
|
reject(err);
|
|
|
|
},
|
|
|
|
complete: () => {
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
};
|