diff --git a/src/components/CommonPopup/index.module.scss b/src/components/CommonPopup/index.module.scss index 7784154..7caeab6 100644 --- a/src/components/CommonPopup/index.module.scss +++ b/src/components/CommonPopup/index.module.scss @@ -48,7 +48,7 @@ border-bottom: 1px solid rgba(0, 0, 0, 0.06); .common-popup__title { - font-family: 'PingFang SC'; + font-family: "PingFang SC"; font-weight: 600; font-size: 22px; line-height: 1.27em; @@ -62,7 +62,7 @@ display: flex; align-items: center; justify-content: center; - background: #FFFFFF; + background: #ffffff; border: 1px solid rgba(0, 0, 0, 0.06); border-radius: 50%; cursor: pointer; @@ -100,7 +100,7 @@ display: flex; gap: 8px; background: #fff; - padding-bottom: env(safe-area-inset-bottom); + padding-bottom: max(10px, env(safe-area-inset-bottom)); } .common-popup__btn { @@ -134,4 +134,4 @@ border-radius: 12px !important; padding: 4px 10px; } -} \ No newline at end of file +} diff --git a/src/components/Radar/index.tsx b/src/components/Radar/index.tsx index a03702c..bd81a80 100644 --- a/src/components/Radar/index.tsx +++ b/src/components/Radar/index.tsx @@ -1,25 +1,12 @@ -import Taro, { useReady } from "@tarojs/taro"; -import { View, Canvas, Button } from "@tarojs/components"; -import { useEffect, useRef, forwardRef, useImperativeHandle } from "react"; +import Taro from "@tarojs/taro"; +import { View, Canvas } from "@tarojs/components"; +import { useEffect, forwardRef, useImperativeHandle } from "react"; const RadarChart: React.FC = forwardRef((props, ref) => { const { data } = props; - const renderFnRef = useRef(); - // const labels = [ - // "正手球质", - // "正手控制", - // "反手球质", - // "反手控制", - // "底线相持", - // "场地覆盖", - // "发球接发", - // "接随机球", - // "战术设计", - // ]; - // const values = [50, 75, 60, 20, 40, 70, 65, 35, 75]; const maxValue = 100; - const levels = 4; + const levels = 5; const radius = 100; const center = { x: 160, y: 160 }; @@ -35,14 +22,10 @@ const RadarChart: React.FC = forwardRef((props, ref) => { }, { texts: [], vals: [] } ); - renderFnRef.current && renderFnRef.current(texts, vals); + renderCanvas(texts, vals); } }, [data]); - useReady(() => { - renderFnRef.current = renderCanvas; - }); - function renderCanvas(labels, values) { const query = Taro.createSelectorQuery(); query @@ -57,12 +40,15 @@ const RadarChart: React.FC = forwardRef((props, ref) => { ctx.scale(dpr, dpr); // === 绘制圆形网格 === - for (let i = 1; i <= levels; i++) { + for (let i = levels; i >= 1; i--) { const r = (radius / levels) * i; ctx.beginPath(); ctx.arc(center.x, center.y, r, 0, Math.PI * 2); - if (i % 2 === 0) { - ctx.fillStyle = "rgba(0, 150, 200, 0.1)"; + if (i % 2 === 1) { + ctx.fillStyle = "#fff"; + ctx.fill(); + } else { + ctx.fillStyle = "#CAFCF0"; ctx.fill(); } ctx.strokeStyle = "#bbb"; @@ -143,19 +129,6 @@ const RadarChart: React.FC = forwardRef((props, ref) => { }), })); - // 保存为图片 - const saveImage = () => { - Taro.canvasToTempFilePath({ - canvasId: "radarCanvas", - success: (res) => { - Taro.saveImageToPhotosAlbum({ - filePath: res.tempFilePath, - success: () => Taro.showToast({ title: "保存成功" }), - }); - }, - }); - }; - return ( { id="radarCanvas" style={{ width: "320px", height: "320px", background: "transparent" }} /> - {/* */} ); }); diff --git a/src/other_pages/ntrp-evaluate/index.module.scss b/src/other_pages/ntrp-evaluate/index.module.scss index 815e830..a354819 100644 --- a/src/other_pages/ntrp-evaluate/index.module.scss +++ b/src/other_pages/ntrp-evaluate/index.module.scss @@ -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 { diff --git a/src/other_pages/ntrp-evaluate/index.tsx b/src/other_pages/ntrp-evaluate/index.tsx index 4b8a238..65508ce 100644 --- a/src/other_pages/ntrp-evaluate/index.tsx +++ b/src/other_pages/ntrp-evaluate/index.tsx @@ -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 ( - + @@ -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]) => [