Blame view
src/store/request.js
1.01 KB
87eade409 验光数据填充检测 |
1 |
const DOMAIN = 'https://api.glass.xiuyetang.com' |
e2eaa8a22 请求地址提取 |
2 |
|
31b5bebd4 订单样式修改 |
3 |
let loading = false |
e2eaa8a22 请求地址提取 |
4 |
export default async function request({ |
87eade409 验光数据填充检测 |
5 6 7 8 |
url, method = 'post', data = {}, header = { |
089dce19d 支付修改 |
9 |
'Content-Type': 'application/x-www-form-urlencoded', |
87eade409 验光数据填充检测 |
10 11 12 13 14 15 16 17 18 19 |
}, timeout = 3000, withCredentials = false, // 跨域请求时是否携带凭证(cookies) // sslVerify: true, // 验证 ssl 证书 success, fail = (res) => { console.log('fail status === > ', res) }, complete = (res) => { console.log('complete status === > ', res) |
31b5bebd4 订单样式修改 |
20 21 22 |
if (loading) { uni.hideLoading() } |
089dce19d 支付修改 |
23 |
}, |
31b5bebd4 订单样式修改 |
24 25 |
isLoading = false, loadingText = '加载中', |
e2eaa8a22 请求地址提取 |
26 |
}) { |
31b5bebd4 订单样式修改 |
27 28 29 30 31 32 |
if (isLoading) { loading = isLoading uni.showLoading({ title: loadingText, }) } |
87eade409 验光数据填充检测 |
33 |
const uid = uni.getStorageSync('uid') |
089dce19d 支付修改 |
34 |
const openid = uni.getStorageSync('openid') |
87eade409 验光数据填充检测 |
35 36 37 |
data = { uid, openid, |
089dce19d 支付修改 |
38 |
...data, |
87eade409 验光数据填充检测 |
39 40 41 42 43 44 45 46 47 48 49 |
} uni .request({ url: DOMAIN + url, method, data, header, timeout, withCredentials, success, fail, |
089dce19d 支付修改 |
50 |
complete, |
87eade409 验光数据填充检测 |
51 52 |
}) } |