This commit is contained in:
2025-05-21 15:45:10 +08:00
parent f6ed5b04de
commit 5d96054c0c
44 changed files with 2460 additions and 2126 deletions

View File

@@ -4,7 +4,19 @@ import {showToast} from "./uils.js";
import AESCrypto from "./AESCrypto.js";
import {useUserStore} from "../pinia/UserStore/index.js";
export const BASEURL = import.meta.env.MODE === 'development' ? '/baseApi/api' : import.meta.env.VITE_API_URL;
let BASEURL = null;
// #ifdef MP-WEIXIN
BASEURL = import.meta.env.VITE_API_URL;
// #endif
// #ifndef MP-WEIXIN
BASEURL = import.meta.env.MODE === 'development' ?
'/baseApi/api' :
import.meta.env.VITE_API_URL;
// #endif
export {BASEURL};
const request = axios.create({
baseURL: BASEURL,
@@ -16,6 +28,7 @@ request.interceptors.request.use(
(config) => {
const {token} = useUserStore();
console.log('看看token在不在', token)
// 如果 token 存在,则将其添加到请求头中
if (token) {
config.headers['Access-Token'] = token;

View File

@@ -114,7 +114,8 @@ export const download = (urls) => {
}
})
},
fail: () => {
fail: (err) => {
console.log(err);
reject(false);
}
})
@@ -131,6 +132,11 @@ export const numberToCharacter = (number) => {
return ['一', '二', '三', '四', '五'][number];
}
export const toWXMiniApp = (id) => {
const {token} = useUserStore();
window.open(`weixin://dl/business/?appid=${import.meta.env.VITE_APP_ID}&path=pages/index/index&env_version=${import.meta.env.VITE_APP_VERSION}&query=${encodeURIComponent(`id=${id}&token=${token}`)}`);
}
export const uploadFile = ({count}) => {
const UserStore = useUserStore();
return new Promise((resolve, reject) => {