|
@@ -1,11 +1,11 @@
|
|
|
//测试地址
|
|
|
-// const baseURL = 'http://192.168.0.149:7782/'
|
|
|
- /*const burl2='http://api.dms.66km.com.cn/' */
|
|
|
+ //const baseURL = 'http://192.168.0.122:8002/'
|
|
|
+const baseURL='http://oil.66km.com.cn/'
|
|
|
//66正式
|
|
|
/* const baseURL = 'https://apidms.66km.com/'
|
|
|
const burl2='https://apidms.66km.com/' */
|
|
|
//欧洲维修
|
|
|
- const baseURL = 'http://oil.66km.com.cn/'
|
|
|
+ //const baseURL = 'http://oil.66km.com.cn/'
|
|
|
// const burl2='http://edms.eurorepar.cn/ '
|
|
|
// import md5 from './MD5.js'
|
|
|
|
|
@@ -40,7 +40,14 @@ const http = (url = '', date = {}, type = 'POST', header = {
|
|
|
}) => {
|
|
|
return new Promise((resolve, reject) => {
|
|
|
header={};
|
|
|
- const openId = uni.getStorageSync("openId");
|
|
|
+
|
|
|
+ if(uni.getStorageSync("wxdata")){
|
|
|
+ //console.log(uni.getStorageSync("wxdata"))
|
|
|
+ var openId = uni.getStorageSync("wxdata").openid;
|
|
|
+ }else{
|
|
|
+ var openId = '';
|
|
|
+ }
|
|
|
+
|
|
|
//console.log(that.$store)
|
|
|
//header['token']='98A9FED8814B457288166BDF623F33D1';
|
|
|
header['openId']=openId;
|
|
@@ -55,6 +62,52 @@ const http = (url = '', date = {}, type = 'POST', header = {
|
|
|
}).then((response) => {
|
|
|
//console.log(response)
|
|
|
//let [error, res] = response;
|
|
|
+ if(response.data.code!=0){
|
|
|
+ //console.log('??')
|
|
|
+ uni.showToast({
|
|
|
+ title: response.data.msg,
|
|
|
+ icon:'none',
|
|
|
+ duration: 4000,
|
|
|
+ });
|
|
|
+ }
|
|
|
+ resolve(response.data);
|
|
|
+ // resolve(res.data);
|
|
|
+ }).catch(error => {
|
|
|
+ let [err, res] = error;
|
|
|
+ reject(err)
|
|
|
+ })
|
|
|
+ });
|
|
|
+}
|
|
|
+const http2 = (url = '', date = {}, type = 'POST', header = {
|
|
|
+}) => {
|
|
|
+ return new Promise((resolve, reject) => {
|
|
|
+ header={};
|
|
|
+ if(uni.getStorageSync("wxdata")){
|
|
|
+ //console.log(uni.getStorageSync("wxdata"))
|
|
|
+ var openId = uni.getStorageSync("wxdata").openid;
|
|
|
+ }else{
|
|
|
+ var openId = '';
|
|
|
+ }
|
|
|
+ header['openId']=openId;
|
|
|
+ header['Content-Type']='application/x-www-form-urlencoded';
|
|
|
+ //console.log(baseURL + url)
|
|
|
+ uni.request({
|
|
|
+ method: type,
|
|
|
+ url: baseURL + url,
|
|
|
+ data: date,
|
|
|
+ header: header,
|
|
|
+ dataType: 'json',
|
|
|
+ }).then((response) => {
|
|
|
+ //console.log(response)
|
|
|
+ //let [error, res] = response;
|
|
|
+ if(response.data.code!=0){
|
|
|
+ //console.log('??')
|
|
|
+ uni.showToast({
|
|
|
+ title: response.data.msg,
|
|
|
+ icon:'none',
|
|
|
+ duration: 4000,
|
|
|
+ });
|
|
|
+ }
|
|
|
resolve(response.data);
|
|
|
// resolve(res.data);
|
|
|
}).catch(error => {
|
|
@@ -63,7 +116,6 @@ const http = (url = '', date = {}, type = 'POST', header = {
|
|
|
})
|
|
|
});
|
|
|
}
|
|
|
-
|
|
|
|
|
|
|
|
|
function refresh(url,date,type,header){
|
|
@@ -95,5 +147,5 @@ function refresh(url,date,type,header){
|
|
|
}
|
|
|
|
|
|
export default {
|
|
|
- http,baseURL,ajax
|
|
|
+ http,baseURL,ajax,http2
|
|
|
}
|