123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778 |
- //测试地址
- const baseUrl = 'http://dms.66km.com.cn/'
- //const baseUrl = 'http://192.168.0.10:20187/'
- const configUrl='http://qw.66km.com.cn/'
- //正式地址
- //66 dmsqw.66km.com
- /* const baseUrl = 'http://apidms.66km.com/'
- const configUrl='http://dmsqw.66km.com/' */
- //欧洲维修
- /* const baseUrl = 'https://crm.eurorepar.cn/'
- const configUrl='http://dmshf.eurorepar.cn/' */
- const http = (url = '', date = {}, type = 'POST', header = {
- }) => {
- return new Promise((resolve, reject) => {
- header={};
- var token=uni.getStorageSync('token')
- header['token']=token;
- if(url=='enterprise/wechat/extCustomerMobile'){
- header['Content-Type']='application/x-www-form-urlencoded';
- }else{
- header['Content-Type']='application/json;charset=utf-8';
- }
-
- uni.request({
- method: type,
- url: baseUrl + url,
- data: date,
- header: header,
- dataType: 'json',
- }).then((response) => {
- // console.log(response.data.code)
- //console.log(response.data.data.code)
- //let [error, res] = response;
- // console.log(res)
- /* if(res.data.code==401||res.data.code==403){
-
- uni.clearStorageSync()
-
- }else if(res.data.code==409){
- // getToken(url,date,type,header)
- } */
- /* if(response.data.data.code!=1){
- console.log(res.data.data.msg)
- uni.hideLoading();
- uni.clearStorageSync()
- uni.showToast({
- title: res.data.data.msg,
- icon: 'none',
- duration: 3000
- });
- } */
- /* if(response.data.code!=1){
- //console.log(res.data.msg)
- uni.hideLoading();
- //uni.clearStorageSync()
- uni.showToast({
- title: response.data.msg,
- icon: 'none',
- duration: 3000
- });
- }else{
-
- } */
- resolve(response.data);
-
- }).catch(error => {
- let [err, res] = error;
- reject(err)
- })
- });
- }
- export default {
- http,configUrl
- }
|