You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
660 B
30 lines
660 B
import urlConfig from '@/utils/config.js'
|
|
|
|
export default function $http(options) {
|
|
const { method, url, data } = options
|
|
const header = {}
|
|
let $store = getCurrentPages()[0].$vm.$store
|
|
header['User-Type'] = 'applet'
|
|
header['Authentication'] = $store.state["m_user"].token
|
|
|
|
return new Promise((reslove, reject) => {
|
|
uni.request({
|
|
method,
|
|
url: urlConfig + url,
|
|
data,
|
|
header: header,
|
|
dataType: 'json'
|
|
}).then(res => {
|
|
if (res[1].data.success) {
|
|
reslove(res[1].data)
|
|
}else if(res[1].statusCode == 200){
|
|
reslove(res[1].data)
|
|
}
|
|
else {
|
|
reject(res[1].data)
|
|
}
|
|
}).catch(err => {
|
|
reject(err)
|
|
})
|
|
})
|
|
}
|