import functions from '@/utils/functions.js' import {host} from "@/config/host"; const service = (params) => { return new Promise((relove, reject) => { let token=uni.getStorageSync('token') let user=uni.getStorageSync('user') // try{ if (!/^http/.test(params.url)) { // const rExp = new RegExp("(? { if (res.statusCode === 200) { let data = res.data; switch (data.code) { case 1001: uni.setStorageSync('token',data.data); service(params); break; case 1002: // todo 让用户重新登录 reject(data); break; default: relove(data); } } else { functions.error('连接服务器失败') } }) }) } export default service;