1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 |
- import Vue from 'vue';
- import App from './App.vue';
- import axios from 'axios';
- import store from './store';
- import router from './router/index.js';
- import ElementUI from 'element-ui';
- import 'element-ui/lib/theme-chalk/index.css';
- import '@/utils/smc-directives';
- import htmlToPdf from '@/utils/htmlToPdf'
- Vue.use(ElementUI);
- Vue.use(htmlToPdf);
- import { debug } from '@/services/constant';
- axios.defaults.withCredentials = true;
- Vue.prototype.$http = axios;
- const path = require('path');
- let myPath = path.resolve(__dirname,'/img/so');
- let myPath2 = path.resolve(__dirname,'./img/so');
- let myPath3 = path.resolve('ee','foo/bar', './baz');
- let myPath4 = path.resolve('/foo/bar', '/tmp/file/');
-
- console.log(__dirname);
- console.log(myPath);
- console.log(myPath2);
- console.log(myPath3);
- console.log(myPath4);
- //请求拦截
- axios.interceptors.request.use((config) => {
- //请求之前重新拼装url
- if(!debug){
- config.url = '/rest/diagnosis' + config.url;
- }
- return config;
- });
- // 添加响应拦截器
- axios.interceptors.response.use(function(response) {
- // 对响应数据做些事
- return response;
- }, function (error) {
- // 请求错误时做些事
- if (error.response.status == '401' || error.response.status == '403') { // 未登录重定向值登录页面
- router.replace({path: '/index'});
- }
- return Promise.reject(error);
- });
- router.onError((err) => {
- console.log(err);
- });
- Vue.filter('removeIndex',function(val){
- let str = ''
- if(!Number.isNaN(Number.parseInt(val[0]))){
- str = val.replace(val[0],'');
- }
- if(!Number.isNaN(Number.parseInt(str[0]))){
- str = str.replace(val[0],'');
- }
- return str;
- });
- new Vue({
- el: '#app',
- router,
- store,
- render: h => h(App)
- })
|