|
@ -1,6 +1,6 @@ |
|
|
import Vue from 'vue'; |
|
|
import Vue from 'vue'; |
|
|
import store from '@/store'; |
|
|
import store from '@/store'; |
|
|
|
|
|
import md5 from 'js-md5'; |
|
|
// 定义 API URL
|
|
|
// 定义 API URL
|
|
|
const DEV_API_URL = 'http://1.13.193.49'; |
|
|
const DEV_API_URL = 'http://1.13.193.49'; |
|
|
// const DEV_API_URL = 'https://epic.js-dyyj.com';
|
|
|
// const DEV_API_URL = 'https://epic.js-dyyj.com';
|
|
@ -81,6 +81,16 @@ Vue.prototype.Post = (params = {}, apiurl,customUrl) => { |
|
|
uni.showLoading({ |
|
|
uni.showLoading({ |
|
|
title: '加载中' |
|
|
title: '加载中' |
|
|
}); |
|
|
}); |
|
|
|
|
|
let userID = '' |
|
|
|
|
|
const userInfoFromStorage = uni.getStorageSync('userInfo'); |
|
|
|
|
|
if (userInfoFromStorage) { |
|
|
|
|
|
const userInfo = JSON.parse(userInfoFromStorage); |
|
|
|
|
|
if (userInfo.id) { |
|
|
|
|
|
userID = userInfo.id.toString(); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
let time = new Date().getTime() |
|
|
|
|
|
let sign = userID+ time |
|
|
uni.request({ |
|
|
uni.request({ |
|
|
method: params.method || 'GET', |
|
|
method: params.method || 'GET', |
|
|
url:baseUrl + apiurl, |
|
|
url:baseUrl + apiurl, |
|
@ -89,9 +99,10 @@ Vue.prototype.Post = (params = {}, apiurl,customUrl) => { |
|
|
'content-type': 'application/json', |
|
|
'content-type': 'application/json', |
|
|
'token': token || '', |
|
|
'token': token || '', |
|
|
'userId': getUserId() || '', |
|
|
'userId': getUserId() || '', |
|
|
|
|
|
'sign':md5(md5(sign.toString())), |
|
|
|
|
|
'timestamp':time |
|
|
}, |
|
|
}, |
|
|
success: (res) => { |
|
|
success: (res) => { |
|
|
console.log('success', res.data); |
|
|
|
|
|
uni.hideLoading() |
|
|
uni.hideLoading() |
|
|
if (res.data.code === 200 || res.data.code === 1) { |
|
|
if (res.data.code === 200 || res.data.code === 1) { |
|
|
resolve(res.data); |
|
|
resolve(res.data); |
|
|