暂存code
This commit is contained in:
+15
@@ -35,10 +35,25 @@ function getStorageFun(key, sync = true) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
function clear(sync = true) {
|
||||
try {
|
||||
if (sync) {
|
||||
return common_vendor.index.clearStorageSync();
|
||||
} else {
|
||||
common_vendor.index.clearStorage();
|
||||
}
|
||||
common_vendor.index.removeStorage({
|
||||
key: "isForcedLogin"
|
||||
});
|
||||
} 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.clear = clear;
|
||||
exports.getStorageFun = getStorageFun;
|
||||
exports.setStorageFun = setStorageFun;
|
||||
//# sourceMappingURL=../../.sourcemap/mp-weixin/utils/auth.js.map
|
||||
|
||||
+3
-3
@@ -1,6 +1,6 @@
|
||||
"use strict";
|
||||
const BASE_URL = "http://cl55un59859.vicp.fun:24346";
|
||||
const APPID = "hmuk25aaf86reta9sdwpo";
|
||||
exports.APPID = APPID;
|
||||
const BASE_URL = "https://frontend.jdns360.com/api";
|
||||
const Authorization = "bxboAtH04huysyO1DO2E4FNomvQaFItp0gzHRv0aM+Hx4Rb9pijiAlWdRPUtB4HUJrwa1yVGoKFyCmXGZYja9v+GPz+SFVnDJJk/yit2LLMxX85SpnzRzVySJSsDTBLSTrh5BhGPST2iymdcGvQAdNIW9gAQoeDGIr8o3ctgLF08cdJiEQc255Ql7LxdqiHgP/SgY2JUrlGxGzE5iXDETCmXCvBxqbxEzhe4JbgdEMlKjjA0jcFDam0ArHPD2CoHI7WemdJZDw2+OAokFnoSF8dMyt1G9+nHqD40iMcK5bG6BFUNJwVMFgIZvQz5OqotqaNKnq/80UNDyOyeaaj9Lw==";
|
||||
exports.Authorization = Authorization;
|
||||
exports.BASE_URL = BASE_URL;
|
||||
//# sourceMappingURL=../../.sourcemap/mp-weixin/utils/config.js.map
|
||||
|
||||
+218
-12
@@ -5,7 +5,7 @@ function getValue(optionArr, key) {
|
||||
return resultVal;
|
||||
}
|
||||
optionArr.map((item) => {
|
||||
if (item.key === key) {
|
||||
if (item.type === key || item.key === key) {
|
||||
resultVal = item.value || item.name;
|
||||
}
|
||||
});
|
||||
@@ -16,6 +16,21 @@ const SMS_TYPE = {
|
||||
"LOGIN": "login",
|
||||
"REGISTER": "register"
|
||||
};
|
||||
const IMG_TYPE = {
|
||||
"COMMON": "COMMON",
|
||||
"CATEGORY": "CATEGORY",
|
||||
"BRAND": "BRAND",
|
||||
"SHOP": "SHOP",
|
||||
"GOODS": "GOODS",
|
||||
"SPECS": "SPECS"
|
||||
};
|
||||
const MINE_ORDER_TYPE = {
|
||||
"UNPAID": 1,
|
||||
"UNSHIPPED": 2,
|
||||
"NOT_RECEIVE": 3,
|
||||
"SUCCEED": 4,
|
||||
"AFTER_SALE": 5
|
||||
};
|
||||
const ORDER_TYPE = {
|
||||
"UNPAID": 0,
|
||||
"PAYMENT_IMG": 1,
|
||||
@@ -54,16 +69,6 @@ const PAYMENT_WAY = {
|
||||
"WECHAT": 1,
|
||||
"ALIPAY": 2
|
||||
};
|
||||
const PAYMENT_WAY_ = [
|
||||
{
|
||||
key: 1,
|
||||
value: "微信支付"
|
||||
},
|
||||
{
|
||||
key: 2,
|
||||
value: "支付宝支付"
|
||||
}
|
||||
];
|
||||
const PRODUCT_DELIVERY_TIME = [
|
||||
{
|
||||
key: 1,
|
||||
@@ -83,10 +88,211 @@ const SEARCH_TYPE = {
|
||||
EXPLOSIVE: 1,
|
||||
SOMETHING: 2
|
||||
};
|
||||
const DELIVER_STATUS = {
|
||||
NO_DELIVERY_REQUIRED: 0,
|
||||
AWAIT_DELIVERY_REQUIRED: 1,
|
||||
YES_DELIVERY_REQUIRED: 2,
|
||||
RECEIVED: 3
|
||||
};
|
||||
const DELIVER_STATUS_ = [
|
||||
{
|
||||
key: 0,
|
||||
value: "无需发货"
|
||||
},
|
||||
{
|
||||
key: 1,
|
||||
value: "待发货"
|
||||
},
|
||||
{
|
||||
key: 2,
|
||||
value: "已发货"
|
||||
},
|
||||
{
|
||||
key: 3,
|
||||
value: "已收货"
|
||||
}
|
||||
];
|
||||
const BALANCE_TYPE = [
|
||||
{
|
||||
key: 1,
|
||||
value: "消费获得"
|
||||
},
|
||||
{
|
||||
key: 2,
|
||||
value: "抽奖获得"
|
||||
},
|
||||
{
|
||||
key: 3,
|
||||
value: "直推获得"
|
||||
},
|
||||
{
|
||||
key: 4,
|
||||
value: "间推获得"
|
||||
},
|
||||
{
|
||||
key: 5,
|
||||
value: "极差奖"
|
||||
},
|
||||
{
|
||||
key: 6,
|
||||
value: "平级奖"
|
||||
},
|
||||
{
|
||||
key: 7,
|
||||
value: "充值"
|
||||
},
|
||||
{
|
||||
key: 8,
|
||||
value: "提现"
|
||||
},
|
||||
{
|
||||
key: 9,
|
||||
value: "支付"
|
||||
},
|
||||
{
|
||||
key: 10,
|
||||
value: "转出"
|
||||
},
|
||||
{
|
||||
key: 11,
|
||||
value: "转入"
|
||||
},
|
||||
{
|
||||
key: 12,
|
||||
value: "兑换"
|
||||
},
|
||||
{
|
||||
key: 13,
|
||||
value: "释放转出"
|
||||
},
|
||||
{
|
||||
key: 14,
|
||||
value: "释放转入"
|
||||
},
|
||||
{
|
||||
key: 15,
|
||||
value: "协议变更"
|
||||
},
|
||||
{
|
||||
key: 16,
|
||||
value: "买入"
|
||||
},
|
||||
{
|
||||
key: 17,
|
||||
value: "卖出"
|
||||
},
|
||||
{
|
||||
key: 18,
|
||||
value: "系统赠送"
|
||||
},
|
||||
{
|
||||
key: 19,
|
||||
value: "区域代理收益"
|
||||
}
|
||||
];
|
||||
const CERT_OPTION = [
|
||||
{
|
||||
key: 1,
|
||||
value: "居民身份证"
|
||||
},
|
||||
{
|
||||
key: 2,
|
||||
value: "护照"
|
||||
}
|
||||
];
|
||||
const CERT_STATUS_OPTION = [
|
||||
{
|
||||
key: 0,
|
||||
value: "未认证"
|
||||
},
|
||||
{
|
||||
key: 1,
|
||||
value: "审核中"
|
||||
},
|
||||
{
|
||||
key: 2,
|
||||
value: "已认证"
|
||||
},
|
||||
{
|
||||
key: 3,
|
||||
value: "认证失败"
|
||||
}
|
||||
];
|
||||
const ACCOUNT_CATEGORY = [
|
||||
{
|
||||
key: "expend",
|
||||
value: "贡献值"
|
||||
},
|
||||
{
|
||||
key: "raffle",
|
||||
value: "抽奖次数"
|
||||
},
|
||||
{
|
||||
key: "exchange",
|
||||
value: "兑换券"
|
||||
},
|
||||
{
|
||||
key: "deduction",
|
||||
value: "抵扣券"
|
||||
},
|
||||
{
|
||||
key: "vcoin",
|
||||
value: "交易币"
|
||||
},
|
||||
{
|
||||
key: "bonus",
|
||||
value: "推荐佣金"
|
||||
},
|
||||
{
|
||||
key: "redpacket",
|
||||
value: "现金红包"
|
||||
},
|
||||
{
|
||||
key: "balance",
|
||||
value: "现金余额"
|
||||
}
|
||||
];
|
||||
const ACCOUNT_TYPE = [
|
||||
{
|
||||
key: "lock",
|
||||
value: "锁定账户"
|
||||
},
|
||||
{
|
||||
key: "current",
|
||||
value: "活期账户"
|
||||
},
|
||||
{
|
||||
key: "quicken",
|
||||
value: "加速释放账户"
|
||||
}
|
||||
];
|
||||
const FINANCE_WITHDRAWAL_STATUS = [
|
||||
{
|
||||
key: 0,
|
||||
value: "审核中"
|
||||
},
|
||||
{
|
||||
key: 1,
|
||||
value: "已打款"
|
||||
},
|
||||
{
|
||||
key: 2,
|
||||
value: "拒绝"
|
||||
}
|
||||
];
|
||||
exports.ACCOUNT_CATEGORY = ACCOUNT_CATEGORY;
|
||||
exports.ACCOUNT_TYPE = ACCOUNT_TYPE;
|
||||
exports.BALANCE_TYPE = BALANCE_TYPE;
|
||||
exports.CERT_OPTION = CERT_OPTION;
|
||||
exports.CERT_STATUS_OPTION = CERT_STATUS_OPTION;
|
||||
exports.DELIVER_STATUS = DELIVER_STATUS;
|
||||
exports.DELIVER_STATUS_ = DELIVER_STATUS_;
|
||||
exports.FINANCE_WITHDRAWAL_STATUS = FINANCE_WITHDRAWAL_STATUS;
|
||||
exports.IMG_TYPE = IMG_TYPE;
|
||||
exports.MINE_ORDER_TYPE = MINE_ORDER_TYPE;
|
||||
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;
|
||||
|
||||
+58
@@ -1,5 +1,18 @@
|
||||
"use strict";
|
||||
const common_vendor = require("../common/vendor.js");
|
||||
function formatDate(date) {
|
||||
if (!date) {
|
||||
return "";
|
||||
}
|
||||
return common_vendor.dayjs(date).format("YYYY-MM-DD HH:mm:ss");
|
||||
}
|
||||
function formatDate1(date) {
|
||||
if (!date) {
|
||||
return "";
|
||||
}
|
||||
common_vendor.dayjs(date).format("HH:mm:ss");
|
||||
return common_vendor.dayjs(date).format("HH:mm:ss");
|
||||
}
|
||||
function copyData(val) {
|
||||
common_vendor.index.setClipboardData({
|
||||
data: val
|
||||
@@ -40,6 +53,51 @@ function assembleAddress(addressObj) {
|
||||
resutlObj.names = names.join(" ");
|
||||
return resutlObj;
|
||||
}
|
||||
function handleAmount(amount) {
|
||||
let currentAmount = parseFloat(amount) || 0;
|
||||
if (amount && amount > 0) {
|
||||
currentAmount = "+" + currentAmount;
|
||||
}
|
||||
return currentAmount;
|
||||
}
|
||||
function getBankNumber(number) {
|
||||
let currentAmount = number || "";
|
||||
if (number && number.length > 4) {
|
||||
currentAmount = currentAmount.slice(-4);
|
||||
}
|
||||
return currentAmount;
|
||||
}
|
||||
function encipherBankNumber(cardNumber) {
|
||||
if (cardNumber.length <= 8) {
|
||||
return cardNumber;
|
||||
}
|
||||
const firstFour = cardNumber.slice(0, 4);
|
||||
const lastFour = cardNumber.slice(-4);
|
||||
const mask = "****";
|
||||
const maskedCard = firstFour + " " + mask + " " + lastFour;
|
||||
return maskedCard;
|
||||
}
|
||||
function comparisonVersionHandler(reqV, curV) {
|
||||
if (curV && reqV) {
|
||||
curV = String(curV);
|
||||
reqV = String(reqV);
|
||||
let arr1 = curV.split("."), arr2 = reqV.split(".");
|
||||
let minLength = Math.min(arr1.length, arr2.length), position = 0, diff = 0;
|
||||
while (position < minLength && (diff = parseInt(arr1[position]) - parseInt(arr2[position])) == 0) {
|
||||
position++;
|
||||
}
|
||||
diff = diff != 0 ? diff : arr1.length - arr2.length;
|
||||
return diff > 0;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
exports.assembleAddress = assembleAddress;
|
||||
exports.comparisonVersionHandler = comparisonVersionHandler;
|
||||
exports.copyData = copyData;
|
||||
exports.encipherBankNumber = encipherBankNumber;
|
||||
exports.formatDate = formatDate;
|
||||
exports.formatDate1 = formatDate1;
|
||||
exports.getBankNumber = getBankNumber;
|
||||
exports.handleAmount = handleAmount;
|
||||
//# sourceMappingURL=../../.sourcemap/mp-weixin/utils/index.js.map
|
||||
|
||||
+36
-17
@@ -3,19 +3,23 @@ const common_vendor = require("../common/vendor.js");
|
||||
const utils_auth = require("./auth.js");
|
||||
const utils_config = require("./config.js");
|
||||
function request(options) {
|
||||
const { url, method = "GET", data = {}, headers = {} } = options;
|
||||
const { url, method = "GET", data = {}, headers = {}, isShowLoading = true } = options;
|
||||
const token = utils_auth.getStorageFun(utils_auth.TOKEN_NAME);
|
||||
const defaultHeaders = {
|
||||
// 'HSM-AUTH': token ? token : '', // 如果存在token, 则添加到请求头中
|
||||
"Authorization": utils_config.Authorization,
|
||||
"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: "加载中..."
|
||||
});
|
||||
if (isShowLoading) {
|
||||
common_vendor.index.showLoading({
|
||||
title: "加载中..."
|
||||
});
|
||||
}
|
||||
common_vendor.index.request({
|
||||
url: utils_config.BASE_URL + url,
|
||||
method,
|
||||
@@ -26,14 +30,31 @@ function request(options) {
|
||||
// 使用展开运算符合并默认头和自定义头
|
||||
},
|
||||
success: (res) => {
|
||||
common_vendor.index.hideLoading();
|
||||
const data2 = res.data;
|
||||
if (isShowLoading) {
|
||||
common_vendor.index.hideLoading();
|
||||
}
|
||||
let data2 = res.data;
|
||||
if (data2 && typeof data2 === "string") {
|
||||
data2 = JSON.parse(data2);
|
||||
}
|
||||
if (data2.status === 500) {
|
||||
common_vendor.index.showToast({
|
||||
title: "系统异常,请稍后再试",
|
||||
icon: "none",
|
||||
// 可选 success/loading/none
|
||||
duration: 2e3,
|
||||
// 持续时长,单位ms
|
||||
mask: false
|
||||
// 是否显示透明蒙层,防止触摸穿透
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (data2.bizcode === 100) {
|
||||
resolve(data2);
|
||||
} else if (data2.bizcode === 201) {
|
||||
if ([201, 200].includes(data2.errcode)) {
|
||||
common_vendor.index.showToast({
|
||||
title: "登录失效,请从新登录",
|
||||
title: "登录失效,请重新登录",
|
||||
icon: "none",
|
||||
// 可选 success/loading/none
|
||||
duration: 2e3,
|
||||
@@ -66,26 +87,24 @@ function request(options) {
|
||||
} else {
|
||||
common_vendor.index.showToast({
|
||||
title: data2.msg,
|
||||
icon: "error",
|
||||
icon: "none",
|
||||
// 可选 success/loading/none
|
||||
duration: 2e3,
|
||||
duration: 2e3
|
||||
// 持续时长,单位ms
|
||||
mask: false
|
||||
// 是否显示透明蒙层,防止触摸穿透
|
||||
});
|
||||
reject(data2);
|
||||
}
|
||||
},
|
||||
fail: (error) => {
|
||||
common_vendor.index.hideLoading();
|
||||
if (isShowLoading) {
|
||||
common_vendor.index.hideLoading();
|
||||
}
|
||||
common_vendor.index.showToast({
|
||||
title: "服务器异常,稍后再试",
|
||||
icon: "error",
|
||||
icon: "none",
|
||||
// 可选 success/loading/none
|
||||
duration: 2e3,
|
||||
duration: 2e3
|
||||
// 持续时长,单位ms
|
||||
mask: false
|
||||
// 是否显示透明蒙层,防止触摸穿透
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user