增加新功能

This commit is contained in:
hejiangming
2025-03-23 20:36:06 +08:00
parent 2ae62b59ed
commit 78270eeda0
184 changed files with 2690 additions and 1496 deletions
+4
View File
@@ -1,2 +1,6 @@
"use strict";
const BASE_URL = "http://cl55un59859.vicp.fun:24346";
const APPID = "hmuk25aaf86reta9sdwpo";
exports.APPID = APPID;
exports.BASE_URL = BASE_URL;
//# sourceMappingURL=../../.sourcemap/mp-weixin/utils/config.js.map
+2 -6
View File
@@ -6,12 +6,8 @@ const ORDER_STATUS_CSS = {
//待发货
3: "#FF0050",
//待收货
4: "#999999",
//已完成
5: "#999999",
//退款中
6: "#999999"
//已取消
4: "#999999"
//待评价
};
exports.ORDER_STATUS_CSS = ORDER_STATUS_CSS;
//# sourceMappingURL=../../.sourcemap/mp-weixin/utils/enumCssUtils.js.map
+16 -14
View File
@@ -13,25 +13,25 @@ function getValue(optionArr, key) {
}
const SMS_TYPE = {
"PASSWD": "passwd",
"LOGIN": "login"
"LOGIN": "login",
"REGISTER": "register"
};
const ORDER_TYPE = {
"ALL": 0,
"UNPAID": 1,
"UNPAID": 0,
"PAYMENT_IMG": 1,
"UNSHIPPED": 2,
"NOT_RECEIVE": 3,
"AFTER_SALE": 4,
"CANCELED": 5,
"COMPLETED": 6
"SUCCEED": 4,
"CLOSE": 5
};
const ORDER_STATUS = [
{
key: 0,
name: "全部"
name: "待支付"
},
{
key: 1,
name: "待付款"
name: "支付中"
},
{
key: 2,
@@ -43,15 +43,11 @@ const ORDER_STATUS = [
},
{
key: 4,
name: "退款售后"
name: "交易成功"
},
{
key: 5,
name: "已取消"
},
{
key: 6,
name: "已完成"
name: "交易关闭"
}
];
const PAYMENT_WAY = {
@@ -82,11 +78,17 @@ const PRODUCT_DELIVERY_TIME = [
value: "大于48小时发货"
}
];
const SEARCH_TYPE = {
NORMAL: 0,
EXPLOSIVE: 1,
SOMETHING: 2
};
exports.ORDER_STATUS = ORDER_STATUS;
exports.ORDER_TYPE = ORDER_TYPE;
exports.PAYMENT_WAY = PAYMENT_WAY;
exports.PAYMENT_WAY_ = PAYMENT_WAY_;
exports.PRODUCT_DELIVERY_TIME = PRODUCT_DELIVERY_TIME;
exports.SEARCH_TYPE = SEARCH_TYPE;
exports.SMS_TYPE = SMS_TYPE;
exports.getValue = getValue;
//# sourceMappingURL=../../.sourcemap/mp-weixin/utils/enumUtils.js.map
+61 -10
View File
@@ -1,21 +1,23 @@
"use strict";
const common_vendor = require("../common/vendor.js");
const utils_auth = require("./auth.js");
const baseUrl = "http://192.168.0.108:8087";
const utils_config = require("./config.js");
function request(options) {
const { url, method = "GET", data = {}, headers = {} } = options;
const token = utils_auth.getStorageFun(utils_auth.TOKEN_NAME);
const defaultHeaders = {
"HSM-AUTH": token ? token : "",
// 如果存在token, 则添加到请求头中
// 'HSM-AUTH': token ? token : '', // 如果存在token, 则添加到请求头中
"content-type": ["post", "POST"].includes(method) ? "application/x-www-form-urlencoded" : "application/json"
};
if (token) {
defaultHeaders["HSM-AUTH"] = token;
}
return new Promise((resolve, reject) => {
common_vendor.index.showLoading({
title: "加载中..."
});
common_vendor.index.request({
url: baseUrl + url,
url: utils_config.BASE_URL + url,
method,
data,
header: {
@@ -25,17 +27,66 @@ function request(options) {
},
success: (res) => {
common_vendor.index.hideLoading();
if (res.statusCode === 200) {
resolve(res.data);
} else if (res.statusCode === 201) {
reject(new Error("Unauthorized"));
const data2 = res.data;
if (data2.bizcode === 100) {
resolve(data2);
} else if (data2.bizcode === 201) {
if ([201, 200].includes(data2.errcode)) {
common_vendor.index.showToast({
title: "登录失效,请从新登录",
icon: "none",
// 可选 success/loading/none
duration: 2e3,
// 持续时长,单位ms
mask: false,
// 是否显示透明蒙层,防止触摸穿透
position: "middle"
// 位置,可选 top/middle/bottom
});
} else {
common_vendor.index.showToast({
title: data2.msg,
icon: "none",
// 可选 success/loading/none
duration: 2e3,
// 持续时长,单位ms
mask: false,
// 是否显示透明蒙层,防止触摸穿透
position: "middle"
// 位置,可选 top/middle/bottom
});
}
if ([201, 200, 205].includes(data2.errcode)) {
setTimeout(() => {
common_vendor.index.navigateTo({
url: "/pages/login/login"
});
}, 2e3);
}
} else {
reject(res);
common_vendor.index.showToast({
title: data2.msg,
icon: "error",
// 可选 success/loading/none
duration: 2e3,
// 持续时长,单位ms
mask: false
// 是否显示透明蒙层,防止触摸穿透
});
reject(data2);
}
},
fail: (error) => {
common_vendor.index.hideLoading();
reject(error);
common_vendor.index.showToast({
title: "服务器异常,稍后再试",
icon: "error",
// 可选 success/loading/none
duration: 2e3,
// 持续时长,单位ms
mask: false
// 是否显示透明蒙层,防止触摸穿透
});
}
});
});