fix(DetailsComments): 修复图片上传功能,改为直接上传文件而非base64,并添加上传配置获取逻辑

This commit is contained in:
DESKTOP-RQ919RC\Pc
2025-09-08 17:16:36 +08:00
parent 9572eaa81f
commit ee191311ea
50 changed files with 442 additions and 393 deletions

View File

@@ -11,7 +11,7 @@ axios.interceptors.request.use(
async (config) => {
// 开发时登录用的,可以直接替换小程序的 authorization
if (process.env.NODE_ENV !== "production") {
const miucms_session = "01346a38444d71aaadb3adad52b52c39";
const miucms_session = "921d45d85b2b50503704123611232948";
document.cookie = "miucms_session=" + miucms_session;
config["headers"]["authorization"] = miucms_session;
}
@@ -79,6 +79,25 @@ const post = (url, params) => {
});
};
const postV2 = (url, params) => {
return new Promise((resolve, reject) => {
//是将对象 序列化成URL的形式以&进行拼接
axios
.post(url, params)
.then((res) => {
let data = res.data;
if (data.code == 401 && !process.server) goLogin();
resolve(data);
})
.catch((err) => {
if (err.data.code == 401) {
goLogin();
resolve(err.data);
} else reject(err.data);
});
});
};
// 打开登录
const goLogin = () => {
if (typeof ajax_login === "function") ajax_login();
@@ -87,4 +106,5 @@ const goLogin = () => {
export default {
get,
post,
postV2,
};