uni-app
中 manifest.json->h5->devServer
配置:
代码:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
| "h5": { "devServer": { "port": 8080, "disableHostCheck": true, "proxy": { "/apis": { "target": "https://api.mokahr.com", "changeOrigin": true, "secure": false ,"pathRewrite": { "^/apis": "" } } }, "https": true } }
|
请求页面:
代码:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
| uni.request({ url: '/apis/api-platform/v1/data/ehrApplications', method: 'GET',
data: { stage: 'pending_checkin', phone: that.formData.mailphone },
header: { 'content-type': 'application/json', 'cache-control': 'no-cache' }, success: res => { if (res.statusCode == '500') { uni.showToast({ icon: 'none', title: res.data.errorMessage, }); return; } }, fail: (res) => { uni.showToast({ icon: 'none', title: res, }); }, complete: () => { } });
|