This commit is contained in:
qiangyanwen 2022-08-14 17:02:19 +08:00
parent fc44c34aaf
commit e17e94cbeb
4 changed files with 23 additions and 0 deletions

11
package-lock.json generated
View File

@ -12,6 +12,7 @@
"axios": "^0.27.2",
"core-js": "^3.8.3",
"echarts": "^5.3.3",
"nprogress": "^0.2.0",
"pinia": "^2.0.18",
"pinia-plugin-persist": "^1.0.0",
"vue": "^3.2.13",
@ -7661,6 +7662,11 @@
"node": ">=4"
}
},
"node_modules/nprogress": {
"version": "0.2.0",
"resolved": "https://registry.npmmirror.com/nprogress/-/nprogress-0.2.0.tgz",
"integrity": "sha512-I19aIingLgR1fmhftnbWWO3dXc0hSxqHQHQb3H8m+K3TnEn/iSeTZZOyvKXWqQESMwuUVnatlCnZdLBZZt2VSA=="
},
"node_modules/nth-check": {
"version": "2.1.1",
"resolved": "https://registry.npmmirror.com/nth-check/-/nth-check-2.1.1.tgz",
@ -17229,6 +17235,11 @@
"path-key": "^2.0.0"
}
},
"nprogress": {
"version": "0.2.0",
"resolved": "https://registry.npmmirror.com/nprogress/-/nprogress-0.2.0.tgz",
"integrity": "sha512-I19aIingLgR1fmhftnbWWO3dXc0hSxqHQHQb3H8m+K3TnEn/iSeTZZOyvKXWqQESMwuUVnatlCnZdLBZZt2VSA=="
},
"nth-check": {
"version": "2.1.1",
"resolved": "https://registry.npmmirror.com/nth-check/-/nth-check-2.1.1.tgz",

View File

@ -12,6 +12,7 @@
"axios": "^0.27.2",
"core-js": "^3.8.3",
"echarts": "^5.3.3",
"nprogress": "^0.2.0",
"pinia": "^2.0.18",
"pinia-plugin-persist": "^1.0.0",
"vue": "^3.2.13",

View File

@ -6,6 +6,7 @@ import router from './router'
import './assets/css/style.css'
import Echarts from "vue-echarts";
import "echarts"
import "nprogress/nprogress.css"
const app = createApp(App)
import {createPinia} from "pinia";
const pina = createPinia()

View File

@ -1,6 +1,7 @@
import axios from 'axios';
import {message} from "ant-design-vue";
import {useRouter} from "vue-router";
import NProgress from "nprogress"
const service = axios.create({
baseURL: 'http://192.168.0.103:8000/api',
@ -10,6 +11,7 @@ const router = useRouter()
service.interceptors.request.use(function (config) {
console.log(config)
NProgress.start()
const token = window.sessionStorage.getItem("token")
if (token !== "" || token != null || token != '') {
config.headers["Authorization"] = "Bearer " +token
@ -23,4 +25,12 @@ service.interceptors.request.use(function (config) {
})
service.interceptors.response.use(function (response) {
NProgress.done();
return response;
},function (error) {
return Promise.reject(error)
});
export default service;