fix(api): 修改评论图片上传接口为支持FormData格式
refactor(Item.vue): 调整样式和布局,优化图片高度和文本显示 feat(details/[id].vue): 实现图片上传配置获取和FormData上传功能
This commit is contained in:
@@ -10,7 +10,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;
|
||||
}
|
||||
@@ -69,6 +69,22 @@ 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()
|
||||
@@ -77,4 +93,5 @@ const goLogin = () => {
|
||||
export default {
|
||||
get,
|
||||
post,
|
||||
postV2,
|
||||
}
|
||||
Reference in New Issue
Block a user