feature/uuid-0609-ch
ch 2 years ago
parent c259a61025
commit 1c5402a7b0

@ -4,19 +4,19 @@
* @Author: ch
* @Date: 2022-05-03 23:04:45
* @LastEditors: ch
* @LastEditTime: 2022-06-09 18:54:57
* @LastEditTime: 2022-06-09 19:21:46
* @Description: file content
*/
import { creatUuid } from "@/plugins/utils";
import { CreatUuid } from "@/plugins/utils";
let axios = null
export default function ({ app, $axios, store, req }) {
let uuid = store.state.uuid;
if (!uuid) {
uuid = creatUuid(16, 2);
uuid = CreatUuid(16, 2);
store.commit('setUUID', uuid);
}
$axiosTk.onRequest( config =>{
$axios.onRequest( config =>{
config.headers.uid = uuid;
return config;
});

@ -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 : '要先登录才能操作哦~'});

Loading…
Cancel
Save