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.

57 lines
1.3 KiB
JavaScript

4 weeks ago
// 志明
// 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"
1 day ago
// let baseUrl = "http://192.168.12.36:8080/v1"
4 weeks ago
// let baseUrl = "http://47.119.163.201:81/v1/v1"
let baseUrl = "http://56carrier.com:80/v1"
import store from '../store/index'
4 weeks ago
// import baseUrl from './config.js'
export default (options) => {
return new Promise((resolve, reject) => {
uni.request({
4 weeks ago
url: baseUrl + options.url,
method: options.method || 'GET',
header: {
'Content-Type': options.contentType || 'application/json; charset=utf-8;',
4 weeks ago
'Authorization':(store.state.token&& `Bearer ` + store.state.token) || ''
},
data: options.params,
success: res => {
const data = res.data
1 day ago
console.log(res.data,'res.data')
4 weeks ago
if( data.code === 200){
resolve(data)
1 day ago
} 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({
4 weeks ago
title: data.message,
icon: 'none'
})
reject(data.msg)
}
},
fail: err => {
uni.showToast({
title: '请检查您的网络',
icon: 'none'
})
reject(err);
},
complete: () => {
}
});
});
};