home主页和AiTools页

This commit is contained in:
2025-10-10 10:41:39 +08:00
parent c37c97e97e
commit 672a2f4c90
219 changed files with 20979 additions and 0 deletions

26
plugins/axios.js Normal file
View File

@ -0,0 +1,26 @@
//设置请求和拦截响应器
export default function({
$axios,
app
}) {
// 请求拦截器
$axios.onRequest(config => {
// 如果用 token从 cookie 拿
const token = app.$cookies.get('token')
if (token) {
config.headers.Authorization = `Bearer ${token}` //鉴权方式这里使用的bearer
}
return config
}, error => Promise.reject(error))
// 响应拦截器
$axios.onResponse(response => {
if(response.code!=0){
return response
}
return response.data // 直接返回 data调用时不用再写 res.data
}, error => Promise.reject(error))
}