| | |
| | | let server_url = VUE_APP_BASE_URL; |
| | | let token = uni.getStorageSync('tk'); |
| | | export function service(options = {}) { |
| | | console.log(("option",options)) |
| | | options.url = `${server_url}${options.url}`; |
| | | //配置请求头 |
| | | if(uni.getStorageSync('tk')){ |
| | |
| | | //成功 |
| | | options.success = (res) => { |
| | | // if (Number(res.data.code) == 100) { |
| | | if(Number(res.data.code) == 403){ |
| | | if(Number(res.data.code) == 403 || Number(res.data.code) == 401){ |
| | | uni.showToast({ |
| | | icon: 'none', |
| | | duration: 2000, |
| | |
| | | icon: "none", |
| | | title: '服务响应失败' |
| | | }); |
| | | uni.clearStorageSync(); |
| | | uni.clearStorage(); |
| | | uni.clearStorageSync() |
| | | uni.clearStorage() |
| | | uni.navigateTo({ |
| | | url: '/pages/index/index' |
| | | }) |