增加新模块

This commit is contained in:
何江明
2025-03-20 08:46:07 +08:00
parent 15014e22aa
commit 2ae62b59ed
1729 changed files with 94700 additions and 4232 deletions
+44
View File
@@ -0,0 +1,44 @@
"use strict";
const common_vendor = require("../common/vendor.js");
const TOKEN_NAME = "fcc-token";
const USER_KEY = "fcc-user-key";
const USER_DATA = "fcc-user-data";
const USER_LOGIN_TIME = "fcc-login-time";
function setStorageFun(key, value, sync = true) {
try {
if (sync) {
return common_vendor.index.setStorageSync(key, value);
} else {
common_vendor.index.setStorage({
key,
data: value
});
}
} catch (e) {
}
}
function getStorageFun(key, sync = true) {
try {
if (sync) {
return common_vendor.index.getStorageSync(key);
} else {
let data = "";
common_vendor.index.getStorage({
key,
success: function(res) {
data = res.data;
}
});
return data;
}
} catch (e) {
return false;
}
}
exports.TOKEN_NAME = TOKEN_NAME;
exports.USER_DATA = USER_DATA;
exports.USER_KEY = USER_KEY;
exports.USER_LOGIN_TIME = USER_LOGIN_TIME;
exports.getStorageFun = getStorageFun;
exports.setStorageFun = setStorageFun;
//# sourceMappingURL=../../.sourcemap/mp-weixin/utils/auth.js.map
+2
View File
@@ -0,0 +1,2 @@
"use strict";
//# sourceMappingURL=../../.sourcemap/mp-weixin/utils/config.js.map
+17
View File
@@ -0,0 +1,17 @@
"use strict";
const ORDER_STATUS_CSS = {
1: "#5486FF",
//待支付,不管
2: "#FF0050",
//待发货
3: "#FF0050",
//待收货
4: "#999999",
//已完成
5: "#999999",
//退款中
6: "#999999"
//已取消
};
exports.ORDER_STATUS_CSS = ORDER_STATUS_CSS;
//# sourceMappingURL=../../.sourcemap/mp-weixin/utils/enumCssUtils.js.map
+92
View File
@@ -0,0 +1,92 @@
"use strict";
function getValue(optionArr, key) {
let resultVal = "";
if (!optionArr || optionArr.length === 0) {
return resultVal;
}
optionArr.map((item) => {
if (item.key === key) {
resultVal = item.value || item.name;
}
});
return resultVal;
}
const SMS_TYPE = {
"PASSWD": "passwd",
"LOGIN": "login"
};
const ORDER_TYPE = {
"ALL": 0,
"UNPAID": 1,
"UNSHIPPED": 2,
"NOT_RECEIVE": 3,
"AFTER_SALE": 4,
"CANCELED": 5,
"COMPLETED": 6
};
const ORDER_STATUS = [
{
key: 0,
name: "全部"
},
{
key: 1,
name: "待付款"
},
{
key: 2,
name: "待发货"
},
{
key: 3,
name: "待收货"
},
{
key: 4,
name: "退款售后"
},
{
key: 5,
name: "已取消"
},
{
key: 6,
name: "已完成"
}
];
const PAYMENT_WAY = {
"WECHAT": 1,
"ALIPAY": 2
};
const PAYMENT_WAY_ = [
{
key: 1,
value: "微信支付"
},
{
key: 2,
value: "支付宝支付"
}
];
const PRODUCT_DELIVERY_TIME = [
{
key: 1,
value: "24小时内发货"
},
{
key: 2,
value: "48小时内发货"
},
{
key: 3,
value: "大于48小时发货"
}
];
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.SMS_TYPE = SMS_TYPE;
exports.getValue = getValue;
//# sourceMappingURL=../../.sourcemap/mp-weixin/utils/enumUtils.js.map
+45
View File
@@ -0,0 +1,45 @@
"use strict";
const common_vendor = require("../common/vendor.js");
function copyData(val) {
common_vendor.index.setClipboardData({
data: val
});
}
function assembleAddress(addressObj) {
const resutlObj = {};
if (!addressObj || Object.keys(addressObj).length === 0) {
return resutlObj;
}
const ids = [];
if (addressObj.countryId) {
ids.push(addressObj.countryId);
}
if (addressObj.provinceId) {
ids.push(addressObj.provinceId);
}
if (addressObj.cityId) {
ids.push(addressObj.cityId);
}
if (addressObj.areaId) {
ids.push(addressObj.areaId);
}
const names = [];
if (addressObj.countryName) {
names.push(addressObj.countryName);
}
if (addressObj.provinceName) {
names.push(addressObj.provinceName);
}
if (addressObj.cityName) {
names.push(addressObj.cityName);
}
if (addressObj.areaName) {
names.push(addressObj.areaName);
}
resutlObj.ids = ids.join(",");
resutlObj.names = names.join(" ");
return resutlObj;
}
exports.assembleAddress = assembleAddress;
exports.copyData = copyData;
//# sourceMappingURL=../../.sourcemap/mp-weixin/utils/index.js.map
+44
View File
@@ -0,0 +1,44 @@
"use strict";
const common_vendor = require("../common/vendor.js");
const utils_auth = require("./auth.js");
const baseUrl = "http://192.168.0.108:8087";
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, 则添加到请求头中
"content-type": ["post", "POST"].includes(method) ? "application/x-www-form-urlencoded" : "application/json"
};
return new Promise((resolve, reject) => {
common_vendor.index.showLoading({
title: "加载中..."
});
common_vendor.index.request({
url: baseUrl + url,
method,
data,
header: {
...defaultHeaders,
...headers
// 使用展开运算符合并默认头和自定义头
},
success: (res) => {
common_vendor.index.hideLoading();
if (res.statusCode === 200) {
resolve(res.data);
} else if (res.statusCode === 201) {
reject(new Error("Unauthorized"));
} else {
reject(res);
}
},
fail: (error) => {
common_vendor.index.hideLoading();
reject(error);
}
});
});
}
exports.request = request;
//# sourceMappingURL=../../.sourcemap/mp-weixin/utils/request.js.map