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

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