|
|
@ -2,22 +2,22 @@
|
|
|
|
* @Author: ch
|
|
|
|
* @Author: ch
|
|
|
|
* @Date: 2022-05-04 17:11:07
|
|
|
|
* @Date: 2022-05-04 17:11:07
|
|
|
|
* @LastEditors: ch
|
|
|
|
* @LastEditors: ch
|
|
|
|
* @LastEditTime: 2022-06-09 18:55:23
|
|
|
|
* @LastEditTime: 2022-06-09 19:22:06
|
|
|
|
* @Description: file content
|
|
|
|
* @Description: file content
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
import { creatUuid } from "@/plugins/utils";
|
|
|
|
import { CreatUuid } from "@/plugins/utils";
|
|
|
|
let axiosTk = null;
|
|
|
|
let axiosTk = null;
|
|
|
|
export default function ({$axios, store, route}, inject) {
|
|
|
|
export default function ({$axios, store, route}, inject) {
|
|
|
|
const $axiosTk = $axios.create();
|
|
|
|
const $axiosTk = $axios.create();
|
|
|
|
let uuid = store.state.uuid;
|
|
|
|
let uuid = store.state.uuid;
|
|
|
|
if (!uuid) {
|
|
|
|
if (!uuid) {
|
|
|
|
uuid = creatUuid(16, 2);
|
|
|
|
uuid = CreatUuid(16, 2);
|
|
|
|
store.commit('setUUID', uuid);
|
|
|
|
store.commit('setUUID', uuid);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
config.headers.uid = uuid;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$axiosTk.defaults.timeout = 3000;
|
|
|
|
$axiosTk.defaults.timeout = 3000;
|
|
|
|
$axiosTk.onRequest( config =>{
|
|
|
|
$axiosTk.onRequest( config =>{
|
|
|
|
|
|
|
|
config.headers.uid = uuid;
|
|
|
|
if(!store.state.token){
|
|
|
|
if(!store.state.token){
|
|
|
|
location.href = '/';
|
|
|
|
location.href = '/';
|
|
|
|
return Promise.reject({message : '要先登录才能操作哦~'});
|
|
|
|
return Promise.reject({message : '要先登录才能操作哦~'});
|
|
|
|