feat: 修复commompopup按钮底边距在安卓上显示异常的问题、修复测试结果页偶尔出现不渲染雷达图的问题
This commit is contained in:
@@ -459,6 +459,12 @@
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-feature-settings: "liga" off, "clig" off;
|
||||
font-family: "PingFang SC";
|
||||
font-size: 16px;
|
||||
font-style: normal;
|
||||
font-weight: 600;
|
||||
line-height: normal;
|
||||
}
|
||||
|
||||
&.disabled {
|
||||
|
||||
@@ -11,6 +11,7 @@ import evaluateService, {
|
||||
} from "@/services/evaluateService";
|
||||
import { useUserInfo, useUserActions } from "@/store/userStore";
|
||||
import { useEvaluate, EvaluateScene } from "@/store/evaluateStore";
|
||||
import { useGlobalState } from "@/store/global";
|
||||
import { delay, getCurrentFullPath } from "@/utils";
|
||||
import CloseIcon from "@/static/ntrp/ntrp_close_icon.svg";
|
||||
import DocCopy from "@/static/ntrp/ntrp_doc_copy.svg";
|
||||
@@ -76,17 +77,38 @@ function adjustRadarLabels(
|
||||
return result as [string, number][];
|
||||
}
|
||||
|
||||
function isEmptyArrowFunction(fn) {
|
||||
return (
|
||||
typeof fn === "function" &&
|
||||
!fn.hasOwnProperty("prototype") && // 排除普通函数
|
||||
fn.toString().replace(/\s+/g, "") === "()=>{}"
|
||||
);
|
||||
function isOnCancelEmpty(onCancelFunc) {
|
||||
if (typeof onCancelFunc !== "function") {
|
||||
console.log("onCancel 不是函数");
|
||||
return false;
|
||||
}
|
||||
|
||||
try {
|
||||
const funcString = onCancelFunc.toString().trim();
|
||||
|
||||
// 常见空函数模式
|
||||
const emptyFunctionPatterns = [
|
||||
"functiononCancel(){}",
|
||||
"function onCancel() {}",
|
||||
"onCancel(){}",
|
||||
"()=>{}",
|
||||
"functiononCancel(){ }",
|
||||
"() => {}",
|
||||
];
|
||||
|
||||
const normalized = funcString.replace(/\s/g, "");
|
||||
return emptyFunctionPatterns.includes(normalized);
|
||||
} catch (error) {
|
||||
console.error("检查 onCancel 函数时出错:", error);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function CommonGuideBar(props) {
|
||||
const { title, confirm } = props;
|
||||
const { onCancel } = useEvaluate();
|
||||
const { statusNavbarHeightInfo } = useGlobalState();
|
||||
const { statusBarHeight, navBarHeight } = statusNavbarHeightInfo;
|
||||
// const userInfo = useUserInfo()
|
||||
|
||||
function handleClose() {
|
||||
@@ -94,7 +116,8 @@ function CommonGuideBar(props) {
|
||||
if (confirm) {
|
||||
}
|
||||
try {
|
||||
if (isEmptyArrowFunction(onCancel)) {
|
||||
console.log(onCancel, isOnCancelEmpty(onCancel));
|
||||
if (isOnCancelEmpty(onCancel)) {
|
||||
Taro.redirectTo({ url: "/game_pages/list/index" });
|
||||
}
|
||||
onCancel();
|
||||
@@ -104,7 +127,13 @@ function CommonGuideBar(props) {
|
||||
}
|
||||
|
||||
return (
|
||||
<View className={styles.header}>
|
||||
<View
|
||||
className={styles.header}
|
||||
style={{
|
||||
height: navBarHeight + "px",
|
||||
paddingTop: statusBarHeight + "px",
|
||||
}}
|
||||
>
|
||||
<View className={styles.closeIcon} onClick={handleClose}>
|
||||
<Image className={styles.closeImg} src={CloseIcon} />
|
||||
</View>
|
||||
@@ -335,7 +364,6 @@ function Test() {
|
||||
}
|
||||
|
||||
function handIndexChange(direction) {
|
||||
console.log(disabled, direction);
|
||||
if (disabled && direction > 0) {
|
||||
return;
|
||||
}
|
||||
@@ -421,12 +449,13 @@ function Result() {
|
||||
useEffect(() => {
|
||||
getResultById();
|
||||
fetchUserInfo();
|
||||
}, []);
|
||||
}, [id]);
|
||||
|
||||
async function getResultById() {
|
||||
const res = await evaluateService.getTestResult({ record_id: Number(id) });
|
||||
if (res.code === 0) {
|
||||
setResult(res.data);
|
||||
// delay(1000);
|
||||
setRadarData(
|
||||
adjustRadarLabels(
|
||||
Object.entries(res.data.radar_data.abilities).map(([key, value]) => [
|
||||
|
||||
Reference in New Issue
Block a user