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