重构第一版 智控助手小程序

This commit is contained in:
2025-12-30 15:21:19 +08:00
parent c25e282398
commit 3852e6ac20
32 changed files with 3584 additions and 123 deletions

View File

@@ -2,29 +2,34 @@
let show = 0;
export default async function reqeust(params) {
show++;
return new Promise((resolve, reject) => {
// 判断是否需要显示loading弹窗
const needLoading = params.title !== undefined && params.title !== null && params.title !== '';
if (needLoading) {
wx.showLoading({
title: params.title,
mask:true
})
wx.request({
mask: true
});
}
return new Promise((resolve, reject) => {
wx.request({
header: {
contentType: 'application/x-www-form-urlencoded', // 填入服务名称
},
contentType: 'application/x-www-form-urlencoded', // 填入服务名称
},
url: params.url,
method: params.method || 'post',
data: params.data || {},
success: res => {
resolve(res.data)
resolve(res.data)
},
fail: err => {
reject(err)
},
complete:()=>{
show--;
if(show==0){
wx.hideLoading()
if (needLoading && show === 0) {
wx.hideLoading();
}
}
})