|
|
@@ -104,7 +104,7 @@ export default {
|
|
|
const CONTENT_ROW_LENGTH = 20;
|
|
|
let [contentLeng, contentArray, contentRows] = that.textByteLength(
|
|
|
store_name,
|
|
|
- CONTENT_ROW_LENGTH
|
|
|
+ CONTENT_ROW_LENGTH,
|
|
|
);
|
|
|
if (contentRows > 2) {
|
|
|
contentRows = 2;
|
|
|
@@ -254,7 +254,7 @@ export default {
|
|
|
people,
|
|
|
count,
|
|
|
num,
|
|
|
- successFn
|
|
|
+ successFn,
|
|
|
) {
|
|
|
let that = this;
|
|
|
let rain = 2;
|
|
|
@@ -280,14 +280,14 @@ export default {
|
|
|
110 * rain,
|
|
|
230 * rain,
|
|
|
30 * rain,
|
|
|
- 1
|
|
|
+ 1,
|
|
|
);
|
|
|
context.drawImage(
|
|
|
arrImages[2],
|
|
|
68 * rain,
|
|
|
194 * rain,
|
|
|
160 * rain,
|
|
|
- 160 * rain
|
|
|
+ 160 * rain,
|
|
|
);
|
|
|
context.save();
|
|
|
|
|
|
@@ -314,7 +314,7 @@ export default {
|
|
|
94 * rain,
|
|
|
75 * rain,
|
|
|
75 * rain,
|
|
|
- 6 * rain
|
|
|
+ 6 * rain,
|
|
|
);
|
|
|
context.clip();
|
|
|
context.drawImage(
|
|
|
@@ -322,7 +322,7 @@ export default {
|
|
|
27 * rain,
|
|
|
94 * rain,
|
|
|
75 * rain,
|
|
|
- 75 * rain
|
|
|
+ 75 * rain,
|
|
|
);
|
|
|
context.draw(true, function () {
|
|
|
uni.canvasToTempFilePath({
|
|
|
@@ -693,7 +693,7 @@ export default {
|
|
|
let status = permision.isIOS
|
|
|
? await permision.requestIOS("location")
|
|
|
: await permision.requestAndroid(
|
|
|
- "android.permission.ACCESS_FINE_LOCATION"
|
|
|
+ "android.permission.ACCESS_FINE_LOCATION",
|
|
|
);
|
|
|
|
|
|
if (status === null || status === 1) {
|
|
|
@@ -910,7 +910,7 @@ export async function getSceneInfo(e, index) {
|
|
|
merchantId: params.merchantId,
|
|
|
userId: appStore.userInfo.userId,
|
|
|
};
|
|
|
- appStore.setIndexRefersh(true)
|
|
|
+ appStore.setIndexRefersh(true);
|
|
|
await footprintScan(obj);
|
|
|
await appStore.USERINFO();
|
|
|
}
|
|
|
@@ -1034,17 +1034,18 @@ export const Calc = {
|
|
|
* @returns {Object} 解析结果
|
|
|
*/
|
|
|
_parseNumStr(num) {
|
|
|
- // 第一步:先校验并转换为有效数字(修复 NaN 问题)
|
|
|
const validNum = this._validateNum(num);
|
|
|
- const str = String(validNum).trim().replace(/^\+/, ""); // 移除正号
|
|
|
+ const str = String(validNum).trim().replace(/^\+/, "");
|
|
|
|
|
|
const isNegative = str.startsWith("-");
|
|
|
const absStr = isNegative ? str.slice(1) : str;
|
|
|
- const [integerPart = "0", decimalPart = "0"] = absStr.split(".");
|
|
|
+ const parts = absStr.split(".");
|
|
|
+
|
|
|
+ const integerPart = parts[0] || "0";
|
|
|
+ const decimalPart = parts.length > 1 ? parts[1] : "";
|
|
|
|
|
|
- // 处理纯小数(如.123)或纯整数(如123.)的情况
|
|
|
const cleanInteger = integerPart || "0";
|
|
|
- const cleanDecimal = decimalPart || "0";
|
|
|
+ const cleanDecimal = decimalPart;
|
|
|
|
|
|
return {
|
|
|
isNegative,
|
|
|
@@ -1083,7 +1084,7 @@ export const Calc = {
|
|
|
},
|
|
|
|
|
|
/**
|
|
|
- * 加法运算(修复精度问题 + 入参校验)
|
|
|
+ * 加法运算
|
|
|
*/
|
|
|
add(a, b) {
|
|
|
// 链式调用/直接调用参数处理
|
|
|
@@ -1099,7 +1100,7 @@ export const Calc = {
|
|
|
},
|
|
|
|
|
|
/**
|
|
|
- * 减法运算(修复精度问题 + 入参校验)
|
|
|
+ * 减法运算
|
|
|
*/
|
|
|
sub(a, b) {
|
|
|
const [arg1, arg2] =
|
|
|
@@ -1113,7 +1114,7 @@ export const Calc = {
|
|
|
},
|
|
|
|
|
|
/**
|
|
|
- * 乘法运算(修复精度问题 + 入参校验)
|
|
|
+ * 乘法运算
|
|
|
*/
|
|
|
mul(a, b) {
|
|
|
const [arg1, arg2] =
|
|
|
@@ -1140,13 +1141,12 @@ export const Calc = {
|
|
|
},
|
|
|
|
|
|
/**
|
|
|
- * 除法运算(修复精度问题 + 入参校验)
|
|
|
+ * 除法运算
|
|
|
*/
|
|
|
div(a, b) {
|
|
|
const [arg1, arg2] =
|
|
|
this.currentValue === null ? [a, b] : [this.currentValue, a];
|
|
|
|
|
|
- // 先校验除数是否为有效数字(避免 0/NaN 混淆)
|
|
|
const validArg2 = this._validateNum(arg2);
|
|
|
if (validArg2 === 0) {
|
|
|
throw new Error("除数不能为0");
|
|
|
@@ -1155,26 +1155,15 @@ export const Calc = {
|
|
|
const n1 = this._parseNumStr(arg1);
|
|
|
const n2 = this._parseNumStr(arg2);
|
|
|
|
|
|
- // 转换为整数(移除小数点)
|
|
|
const n1Int =
|
|
|
BigInt(n1.integerPart + n1.decimalPart) * (n1.isNegative ? -1n : 1n);
|
|
|
const n2Int =
|
|
|
BigInt(n2.integerPart + n2.decimalPart) * (n2.isNegative ? -1n : 1n);
|
|
|
|
|
|
- // 计算缩放比例:10^(n2小数位数 - n1小数位数)
|
|
|
- const decimalDiff = n2.decimalLength - n1.decimalLength;
|
|
|
- const scale = BigInt(10 ** Math.abs(decimalDiff));
|
|
|
- let divResult;
|
|
|
-
|
|
|
- if (decimalDiff >= 0) {
|
|
|
- divResult = (n1Int * scale) / n2Int;
|
|
|
- } else {
|
|
|
- divResult = n1Int / (n2Int * scale);
|
|
|
- }
|
|
|
+ const scaleFactor = 10 ** (n2.decimalLength - n1.decimalLength);
|
|
|
+ const divResult = (Number(n1Int) / Number(n2Int)) * scaleFactor;
|
|
|
|
|
|
- // 处理除法精度(保留15位小数,避免无限循环)
|
|
|
- this.currentValue =
|
|
|
- Number(divResult) / Number(BigInt(10 ** Math.max(0, -decimalDiff)));
|
|
|
+ this.currentValue = parseFloat(divResult.toPrecision(15));
|
|
|
|
|
|
return this;
|
|
|
},
|
|
|
@@ -1285,13 +1274,14 @@ export const Calc = {
|
|
|
return result;
|
|
|
},
|
|
|
};
|
|
|
+
|
|
|
export async function getPhoneNumber(e, inviteCode) {
|
|
|
const { Toast } = useToast();
|
|
|
- console.log('getPhoneNumber123', e);
|
|
|
+ console.log("getPhoneNumber123", e);
|
|
|
|
|
|
// 用户拒绝授权
|
|
|
- if (e.detail.errMsg !== 'getPhoneNumber:ok') {
|
|
|
- Toast({ title: '请授权手机号以完成登录' });
|
|
|
+ if (e.detail.errMsg !== "getPhoneNumber:ok") {
|
|
|
+ Toast({ title: "请授权手机号以完成登录" });
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
@@ -1300,25 +1290,24 @@ export async function getPhoneNumber(e, inviteCode) {
|
|
|
try {
|
|
|
// 2. 将授权码发送到后端换取手机号
|
|
|
const res = await wxLogin({ code: e.detail.code });
|
|
|
- console.log('wxLogin接口res=', res);
|
|
|
+ console.log("wxLogin接口res=", res);
|
|
|
|
|
|
// 3. 处理后端响应
|
|
|
if (res.code === 200) {
|
|
|
return res; // 返回数据
|
|
|
} else {
|
|
|
- Toast({ title: res.message || '获取失败' });
|
|
|
+ Toast({ title: res.message || "获取失败" });
|
|
|
return null;
|
|
|
}
|
|
|
} catch (error) {
|
|
|
Toast({ title: "获取手机号失败:" + error });
|
|
|
- console.error('获取手机号失败:', error);
|
|
|
+ console.error("获取手机号失败:", error);
|
|
|
return null;
|
|
|
} finally {
|
|
|
-
|
|
|
}
|
|
|
} else {
|
|
|
// 授权失败
|
|
|
Toast({ title: e.detail?.errorMessage || "请允许授权以获取手机号" });
|
|
|
return null;
|
|
|
}
|
|
|
-};
|
|
|
+}
|