|
@@ -5,76 +5,23 @@ import router from './router'
|
|
import ElementUI from 'element-ui'
|
|
import ElementUI from 'element-ui'
|
|
import 'element-ui/lib/theme-chalk/index.css'
|
|
import 'element-ui/lib/theme-chalk/index.css'
|
|
import dd from 'gdt-jsapi' //是腾讯广点通提供的模块
|
|
import dd from 'gdt-jsapi' //是腾讯广点通提供的模块
|
|
-import axiosInit from "../until/httpRequest.js"
|
|
|
|
import base from "../until/base.js"
|
|
import base from "../until/base.js"
|
|
|
|
+import http from '../until/request'
|
|
|
|
+
|
|
|
|
+import axios from "axios";
|
|
import store from './store/store.js';
|
|
import store from './store/store.js';
|
|
import VConsole from 'vconsole'
|
|
import VConsole from 'vconsole'
|
|
const vConsole = new VConsole()
|
|
const vConsole = new VConsole()
|
|
Vue.use(vConsole)
|
|
Vue.use(vConsole)
|
|
Vue.use(ElementUI);
|
|
Vue.use(ElementUI);
|
|
Vue.config.productionTip = false
|
|
Vue.config.productionTip = false
|
|
|
|
+
|
|
|
|
+
|
|
Vue.prototype.$dd = dd
|
|
Vue.prototype.$dd = dd
|
|
-window.axios = axiosInit();
|
|
|
|
Vue.prototype.$store = store;
|
|
Vue.prototype.$store = store;
|
|
-// Vue.prototype.$http = window.axios;
|
|
|
|
Vue.prototype.$url = base.url;
|
|
Vue.prototype.$url = base.url;
|
|
-// Vue.prototype.$httpUrl = base.httpUrl;
|
|
|
|
-Vue.prototype.$geoUrl = base.geoserverUrl;
|
|
|
|
Vue.prototype.$appId = base.appId;
|
|
Vue.prototype.$appId = base.appId;
|
|
-
|
|
|
|
-import axios from "axios";
|
|
|
|
-axios.defaults.baseURL = 'http://192.168.1.88:8081/anzhi/' //王宇浩的本地端口
|
|
|
|
-const http = axios.create({
|
|
|
|
- timeout: 1000 * 300,
|
|
|
|
- withCredentials: true,
|
|
|
|
- headers: {
|
|
|
|
- 'Content-Type': 'application/json; charset=utf-8'
|
|
|
|
- }
|
|
|
|
-})
|
|
|
|
-
|
|
|
|
-/**
|
|
|
|
- * 请求拦截
|
|
|
|
- */
|
|
|
|
-http.interceptors.request.use(config => {
|
|
|
|
- console.log("请求拦截--------",config);
|
|
|
|
- config.headers['token'] = window.localStorage.getItem('token') // 请求头带上token
|
|
|
|
-
|
|
|
|
- return config
|
|
|
|
-}, error => {
|
|
|
|
- return Promise.reject(error)
|
|
|
|
-})
|
|
|
|
-
|
|
|
|
-/**
|
|
|
|
- * 响应拦截
|
|
|
|
- */
|
|
|
|
-http.interceptors.response.use(response => {
|
|
|
|
- console.log("response---响应拦截------",response);
|
|
|
|
- if (response.data && response.data.code === 401) { // 401, token失效
|
|
|
|
- // ElementUI.Message.error("请重新登录");
|
|
|
|
- // router.push({ name: 'login' })
|
|
|
|
- dd.openSchemeUrl({
|
|
|
|
- url: "taurus://taurusclient/action/open_app?appId=" + appId + "&type=1&offline=false&url=" + encodeURIComponent(url)
|
|
|
|
- }).then(res => { })
|
|
|
|
- } else if (response.data.code < 0) {
|
|
|
|
- if (response.data.code == -2) {
|
|
|
|
- return response
|
|
|
|
- } else {
|
|
|
|
- // ElementUI.Message.error(response.data.msg);
|
|
|
|
- // 没有返回值会报错
|
|
|
|
- return "错误"
|
|
|
|
- }
|
|
|
|
- } else {
|
|
|
|
- return response
|
|
|
|
- }
|
|
|
|
-}, error => {
|
|
|
|
- console.log("error----------",error);
|
|
|
|
-})
|
|
|
|
-
|
|
|
|
-http.adornUrl = (s) => {
|
|
|
|
- return 'proxyApi'
|
|
|
|
-}
|
|
|
|
Vue.prototype.$http = http
|
|
Vue.prototype.$http = http
|
|
-
|
|
|
|
Vue.prototype.$axios = axios
|
|
Vue.prototype.$axios = axios
|
|
|
|
|
|
|
|
|