Commit 02207e7b by chenjinjing

no message

parent 774280b7
...@@ -27,14 +27,14 @@ export async function getBaseData(id) { ...@@ -27,14 +27,14 @@ export async function getBaseData(id) {
return result; return result;
} }
function checkUnit(str, data, allUnit?) { function checkUnit(checkString, data, allUnit?) {
if (allUnit) { if (allUnit) {
return `${data[str]}%`; return `${data[checkString]}%`;
} }
let configs = [ let configs = [
{ {
test:/&d/, test:/&%/,
str:"%" str:"%"
}, },
{ {
...@@ -54,9 +54,9 @@ function checkUnit(str, data, allUnit?) { ...@@ -54,9 +54,9 @@ function checkUnit(str, data, allUnit?) {
let result = ""; let result = "";
for (let i = 0; i < configs.length; i++) { for (let i = 0; i < configs.length; i++) {
let {test, str} = configs[i]; let {test, str} = configs[i];
let checkValue = str.replace(test,""); let checkValue = checkString.replace(test,"");
result = `${data[checkValue] || 0}`; result = `${data[checkValue] || 0}`;
if (checkValue.length != str.length) return `${result}${str}`; if (checkValue.length != checkString.length) return `${result}${str}`;
} }
return result; return result;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment