feat: 新增拼团

This commit is contained in:
2026-09-23 10:29:41 +08:00
parent f7b9e66172
commit 67f8b3f352
33 changed files with 7491 additions and 858 deletions
+84 -68
View File
@@ -76,77 +76,93 @@ function request(options) {
reject(new Error('服务请求失败,请稍后重试'));
return;
}
if (data.status === 500) {
uni.showToast({
title: "系统异常,请稍后再试",
icon: "none", // 可选 success/loading/none
duration: 2000, // 持续时长,单位ms
mask: false, // 是否显示透明蒙层,防止触摸穿透
});
if (data.status === 500) {
uni.showToast({
title: "系统异常,请稍后再试",
icon: "none", // 可选 success/loading/none
duration: 2000, // 持续时长,单位ms
mask: false, // 是否显示透明蒙层,防止触摸穿透
});
reject(new Error('系统异常,请稍后再试'));
return;
}
// 601 微信登录没注册
if (data.bizcode === 100) {
resolve(data); // 成功时返回数据
} else if (data.bizcode === 201) {
if ([201, 200].includes(data.errcode)) {
uni.showToast({
title: "登录失效,请重新登录",
icon: "none", // 可选 success/loading/none
duration: 2000, // 持续时长,单位ms
mask: false, // 是否显示透明蒙层,防止触摸穿透
position: "middle", // 位置,可选 top/middle/bottom
});
} else {
uni.showToast({
title: data.msg,
icon: "none", // 可选 success/loading/none
duration: 2000, // 持续时长,单位ms
mask: false, // 是否显示透明蒙层,防止触摸穿透
position: "middle", // 位置,可选 top/middle/bottom
});
}
/**
* 205:已经有账号,返回登录页面
* 200 or 201:token失效,返回登录页面
*/
if ([201, 200, 205].includes(data.errcode)) {
uni.removeStorageSync(TOKEN_NAME);
uni.removeStorageSync(USER_DATA);
let timer = setTimeout(() => {
clearTimeout(timer);
timer = null;
uni.navigateTo({
url: "/pages/login_package/login/login",
});
}, 2000);
}
}
// 601 微信登录没注册
if (data.bizcode === 100) {
resolve(data); // 成功时返回数据
} else if (data.bizcode === 201) {
if ([201, 200].includes(data.errcode)) {
uni.showToast({
title: "登录失效,请重新登录",
icon: "none", // 可选 success/loading/none
duration: 2000, // 持续时长,单位ms
mask: false, // 是否显示透明蒙层,防止触摸穿透
position: "middle", // 位置,可选 top/middle/bottom
});
} else {
uni.showToast({
title: data.msg,
icon: "none", // 可选 success/loading/none
duration: 2000, // 持续时长,单位ms
mask: false, // 是否显示透明蒙层,防止触摸穿透
position: "middle", // 位置,可选 top/middle/bottom
});
}
/**
* 205:已经有账号,返回登录页面
* 200 or 201:token失效,返回登录页面
*/
if ([201, 200, 205].includes(data.errcode)) {
uni.removeStorageSync(TOKEN_NAME);
uni.removeStorageSync(USER_DATA);
let timer = setTimeout(() => {
clearTimeout(timer);
timer = null;
let redirectParam = "";
try {
const pages = getCurrentPages();
if (pages && pages.length) {
const cur = pages[pages.length - 1];
if (cur && cur.route && !cur.route.includes("login_package/login/login")) {
let path = "/" + cur.route;
const opts = cur.options || {};
const qs = Object.keys(opts)
.map((k) => `${k}=${encodeURIComponent(opts[k])}`)
.join("&");
if (qs) path += "?" + qs;
redirectParam = "?redirect=" + encodeURIComponent(path);
}
}
} catch (e) {}
uni.navigateTo({
url: `/pages/login_package/login/login${redirectParam}`,
});
}, 2000);
}
reject(data);
} else {
console.log("错误-1", data, url);
uni.showToast({
title: data.msg || "系统错误,请稍后再试",
icon: "none", // 可选 success/loading/none
duration: 2000, // 持续时长,单位ms
});
reject(data); // 其他错误情况返回错误信息
}
},
fail: (error) => {
console.log("错误-2", url);
if (isShowLoading) {
hideLoading();
}
uni.showToast({
title: "服务器异常,稍后再试",
icon: "none", // 可选 success/loading/none
duration: 2000, // 持续时长,单位ms
});
console.log("错误-1", data, url);
uni.showToast({
title: data.msg || "系统错误,请稍后再试",
icon: "none", // 可选 success/loading/none
duration: 2000, // 持续时长,单位ms
});
reject(data); // 其他错误情况返回错误信息
}
},
fail: (error) => {
console.log("错误-2", url);
if (isShowLoading) {
hideLoading();
}
uni.showToast({
title: "服务器异常,稍后再试",
icon: "none", // 可选 success/loading/none
duration: 2000, // 持续时长,单位ms
});
reject(error);
},
});
});
}
},
});
});
}
export default request;