1234567891011121314151617181920212223242526272829303132 |
- const BASE_URL = 'http://colliery.nxjiewei.com/api'
- // const BASE_URL = 'http://ningdongyunying.nxjiewei.com/api'
- // const BASE_URL = 'http://zaoquan.nxjiewei.com:8011/api'
- // const BASE_URL = 'http://yangchangwan.nxjiewei.com:8011/api'
- // const BASE_URL = 'http://renjiazhuang.nxjiewei.com:8011/api'
- export const myRequest = (options)=>{
- return new Promise((resolve,reject)=>{
- uni.request({
- url:BASE_URL+options.url,
- method:options.method || "GET",
- data:options.data || {},
- header:options.header || {},
- success: (res) => {
- console.log(res)
- if(res.data.code !== 0){
- return uni.showToast({
- title:"获取数据失败"
- });
- }
- resolve(res)
- },
- fail: (err) => {
- console.log(err)
- uni.showToast({
- title:"请求接口失败"
- })
- reject(err)
- }
- })
- })
- }
|