12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 |
- import url from './config.js'
- const install = (Vue, vm) => {
- Vue.prototype.$u.http.setConfig({
- baseUrl: url.QN_URL,
-
-
-
-
-
-
-
- });
-
- Vue.prototype.$u.http.interceptor.request = (config) => {
-
- config.header.Authorization = vm.$store.state.token;
-
- config.header.Token = vm.$store.state.enToken;
- console.log(config,'请求')
-
-
-
-
-
-
-
-
-
- return config;
- }
-
- Vue.prototype.$u.http.interceptor.response = (res) => {
- console.log(res)
- uni.hideNavigationBarLoading();
- uni.stopPullDownRefresh()
-
-
- if (res.state) {
-
- return res;
- } else {
- if (res.errorcode === 1017 || res.data === '当前企业不存在') {
- vm.$store.dispatch('logout')
-
-
-
-
- } else {
- uni.showToast({
- title: res.data,
- icon: 'none'
- })
- }
- return false
- };
- }
- }
- export default {
- install
- }
|