暂存code
This commit is contained in:
+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
|
||||
|
||||
Reference in New Issue
Block a user