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.
40 lines
803 B
40 lines
803 B
|
|
export const myRequest = (options) => { |
|
return new Promise((resolve, reject) => { |
|
let url='http://sophia.wujingnft.com/prod-api' |
|
uni.request({ |
|
url: url + options.url, |
|
method: options.method || "GET", |
|
// sslVerify:false, |
|
data: options.data || {}, |
|
header: options.header, |
|
success: (res) => { |
|
if (res.data.code == 500) { |
|
return uni.showToast({ |
|
title: res.data.msg, |
|
icon:'none' |
|
}) |
|
} else if(res.data.code==0){ |
|
resolve(res); |
|
}else if (res.data.code !== 200 & res.data.code !== 500) { |
|
return uni.showToast({ |
|
title: "获取数据失败" |
|
}) |
|
} |
|
resolve(res); |
|
|
|
}, |
|
fail: (err) => { |
|
console.log(err); |
|
uni.showToast({ |
|
title: "请求接口失败", |
|
icon:'error' |
|
}) |
|
reject(err) |
|
} |
|
|
|
}) |
|
}) |
|
} |
|
|
|
|
|
|