fix: 问题修复
This commit is contained in:
@@ -104,7 +104,12 @@ const NTRPEvaluatePopup = (props: NTRPEvaluatePopupProps, ref) => {
|
||||
async function getNtrp() {
|
||||
const res = await evaluateService.getLastResult();
|
||||
if (res.code === 0 && res.data.has_ntrp_level) {
|
||||
setNtrp(res.data.user_ntrp_level);
|
||||
const match = res.data.user_ntrp_level.match(/-?\d+(\.\d+)?/);
|
||||
if (!match) {
|
||||
setNtrp("");
|
||||
return;
|
||||
}
|
||||
setNtrp(match[0] as string);
|
||||
} else {
|
||||
setNtrp("");
|
||||
}
|
||||
@@ -128,7 +133,7 @@ const NTRPEvaluatePopup = (props: NTRPEvaluatePopupProps, ref) => {
|
||||
title: "NTRP水平修改成功",
|
||||
icon: "none",
|
||||
});
|
||||
evaCallback.next(true);
|
||||
evaCallback.next({ flag: true, score: String(ntrp) });
|
||||
handleClose();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
import React, { useEffect } from "react";
|
||||
import React, { useState, useEffect } from "react";
|
||||
import { View, Image, Text } from "@tarojs/components";
|
||||
import Taro from "@tarojs/taro";
|
||||
import { useUserInfo, useUserActions } from "@/store/userStore";
|
||||
// import { getCurrentFullPath } from "@/utils";
|
||||
import evaluateService, { StageType } from "@/services/evaluateService";
|
||||
import DocCopy from "@/static/ntrp/ntrp_doc_copy.svg";
|
||||
import ArrowRight from "@/static/ntrp/ntrp_arrow_right_color.svg";
|
||||
import {
|
||||
@@ -16,18 +17,36 @@ function NTRPTestEntryCard(props: {
|
||||
type: EvaluateScene;
|
||||
evaluateCallback?: EvaluateCallback;
|
||||
}) {
|
||||
const [testFlag, setTestFlag] = useState(false);
|
||||
const { type, evaluateCallback } = props;
|
||||
const userInfo = useUserInfo();
|
||||
const { setCallback } = useEvaluate();
|
||||
// const { fetchUserInfo } = useUserActions()
|
||||
const { fetchUserInfo } = useUserActions();
|
||||
|
||||
// useEffect(() => {
|
||||
// fetchUserInfo()
|
||||
// }, [])
|
||||
console.log(userInfo);
|
||||
|
||||
useEffect(() => {
|
||||
fetchUserInfo();
|
||||
evaluateService.getLastResult().then((res) => {
|
||||
setTestFlag(res.code === 0 && res.data.has_ntrp_level);
|
||||
});
|
||||
}, []);
|
||||
|
||||
function handleTest() {
|
||||
switch (type) {
|
||||
case (EvaluateScene.list, EvaluateScene.share):
|
||||
case EvaluateScene.list:
|
||||
setCallback({
|
||||
type,
|
||||
next: () => {
|
||||
Taro.redirectTo({ url: "/game_pages/list/index" });
|
||||
},
|
||||
onCancel: () => {
|
||||
// Taro.redirectTo({ url: "/game_pages/list/index" });
|
||||
Taro.navigateBack();
|
||||
},
|
||||
});
|
||||
break;
|
||||
case EvaluateScene.share:
|
||||
setCallback({
|
||||
type,
|
||||
next: () => {
|
||||
@@ -37,18 +56,35 @@ function NTRPTestEntryCard(props: {
|
||||
Taro.redirectTo({ url: "/main_pages/index" });
|
||||
},
|
||||
});
|
||||
case (EvaluateScene.detail, EvaluateScene.publish):
|
||||
break;
|
||||
case EvaluateScene.detail:
|
||||
case EvaluateScene.publish:
|
||||
setCallback(evaluateCallback as EvaluateCallback);
|
||||
case (EvaluateScene.user, EvaluateScene.userEdit):
|
||||
break;
|
||||
case EvaluateScene.user:
|
||||
setCallback({
|
||||
type,
|
||||
next: () => {
|
||||
Taro.redirectTo({ url: "/main_pages/index" });
|
||||
},
|
||||
onCancel: () => {
|
||||
Taro.redirectTo({ url: "/user_pages/myself/index" });
|
||||
// Taro.redirectTo({ url: "/user_pages/myself/index" });
|
||||
Taro.navigateBack();
|
||||
},
|
||||
});
|
||||
break;
|
||||
case EvaluateScene.userEdit:
|
||||
setCallback({
|
||||
type,
|
||||
next: () => {
|
||||
Taro.redirectTo({ url: "/game_pages/list/index" });
|
||||
},
|
||||
onCancel: () => {
|
||||
// Taro.redirectTo({ url: "/user_pages/edit/index" });
|
||||
Taro.navigateBack();
|
||||
},
|
||||
});
|
||||
break;
|
||||
default:
|
||||
setCallback({
|
||||
type,
|
||||
@@ -60,8 +96,10 @@ function NTRPTestEntryCard(props: {
|
||||
},
|
||||
});
|
||||
}
|
||||
Taro.redirectTo({
|
||||
url: `/other_pages/ntrp-evaluate/index?stage=test`,
|
||||
Taro.navigateTo({
|
||||
url: `/other_pages/ntrp-evaluate/index?stage=${
|
||||
testFlag ? StageType.INTRO : StageType.TEST
|
||||
}`,
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ export interface PublishMenuProps {
|
||||
const PublishMenu: React.FC<PublishMenuProps> = (props) => {
|
||||
const { onVisibleChange } = props;
|
||||
const [isVisible, setIsVisible] = useState(false);
|
||||
|
||||
|
||||
// 使用 useEffect 监听 isVisible 变化,确保所有情况都能触发回调
|
||||
useEffect(() => {
|
||||
onVisibleChange?.(isVisible);
|
||||
@@ -55,7 +55,7 @@ const PublishMenu: React.FC<PublishMenuProps> = (props) => {
|
||||
if (!userInfo.ntrp_level) {
|
||||
ntrpRef.current.show({
|
||||
type: EvaluateScene.publish,
|
||||
next: (flag) => {
|
||||
next: ({ flag }) => {
|
||||
if (flag) {
|
||||
handleMenuClick(type);
|
||||
} else if (type === "ai") {
|
||||
|
||||
@@ -204,6 +204,9 @@ export default function GameInfo(props) {
|
||||
// hide business msg
|
||||
showLocation
|
||||
theme="dark"
|
||||
enableScroll={false}
|
||||
enableZoom={false}
|
||||
onTap={openMap}
|
||||
/>
|
||||
)}
|
||||
</View>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { View, Text } from "@tarojs/components";
|
||||
import { genNTRPRequirementText } from "../../utils/helper";
|
||||
import { genNTRPRequirementText } from "@/utils/helper";
|
||||
import styles from "./index.module.scss";
|
||||
|
||||
// 玩法要求
|
||||
|
||||
@@ -6,7 +6,7 @@ import { calculateDistance } from "@/utils";
|
||||
import { useUserInfo } from "@/store/userStore";
|
||||
import * as LoginService from "@/services/loginService";
|
||||
import img from "@/config/images";
|
||||
import { navto } from "../../utils/helper";
|
||||
import { navto } from "@/utils/helper";
|
||||
import styles from "./index.module.scss";
|
||||
|
||||
function genRecommendGames(games, location, avatar) {
|
||||
|
||||
@@ -12,7 +12,7 @@ import WechatLogo from "@/static/detail/wechat_icon.svg";
|
||||
// import WechatTimeline from "@/static/detail/wechat_timeline.svg";
|
||||
import LinkIcon from "@/static/detail/link.svg";
|
||||
import CrossIcon from "@/static/detail/cross.svg";
|
||||
import { genNTRPRequirementText, navto } from "../../utils/helper";
|
||||
import { genNTRPRequirementText, navto } from "@/utils/helper";
|
||||
import { DayOfWeekMap } from "../../config";
|
||||
import styles from "./index.module.scss";
|
||||
|
||||
|
||||
@@ -88,7 +88,7 @@
|
||||
&.disabled > .sticky-bottom-bar-join-game {
|
||||
background: #b4b4b4;
|
||||
color: rgba(60, 60, 67, 0.6);
|
||||
pointer-events: none;
|
||||
// pointer-events: none;
|
||||
}
|
||||
|
||||
.sticky-bottom-bar-join-game {
|
||||
@@ -147,6 +147,7 @@
|
||||
font-feature-settings: "liga" off, "clig" off;
|
||||
font-family: "DingTalk JinBuTi";
|
||||
// font-style: italic;
|
||||
font-style: normal;
|
||||
font-size: 18px;
|
||||
font-weight: 400;
|
||||
line-height: 20px;
|
||||
|
||||
@@ -9,7 +9,7 @@ import { MATCH_STATUS, IsSubstituteSupported } from "@/services/detailService";
|
||||
import { GameManagePopup, NTRPEvaluatePopup } from "@/components";
|
||||
import img from "@/config/images";
|
||||
import RMB_ICON from "@/static/detail/rmb.svg";
|
||||
import { toast, navto } from "../../utils/helper";
|
||||
import { toast, navto } from "@/utils/helper";
|
||||
import styles from "./index.module.scss";
|
||||
|
||||
function isFull(counts) {
|
||||
@@ -36,6 +36,34 @@ function isFull(counts) {
|
||||
return false;
|
||||
}
|
||||
|
||||
function matchNtrpRequestment(
|
||||
target?: string,
|
||||
min?: string,
|
||||
max?: string
|
||||
): boolean {
|
||||
// 目标值为空或 undefined
|
||||
if (!target?.trim()) return true;
|
||||
|
||||
// 提取目标值中的第一个数字
|
||||
const match = target.match(/-?\d+(\.\d+)?/);
|
||||
if (!match) return true;
|
||||
|
||||
const value = parseFloat(match[0]);
|
||||
const minNum = min !== undefined ? parseFloat(min) : undefined;
|
||||
const maxNum = max !== undefined ? parseFloat(max) : undefined;
|
||||
|
||||
// min 和 max 都未定义 → 直接通过
|
||||
if (minNum === undefined && maxNum === undefined) return true;
|
||||
|
||||
// min = max 或只有一边 undefined → 参考值判断,包含端点
|
||||
if (minNum === undefined || maxNum === undefined || minNum === maxNum) {
|
||||
return value >= (minNum ?? maxNum!);
|
||||
}
|
||||
|
||||
// 正常区间判断,包含端点
|
||||
return value >= minNum && value <= maxNum;
|
||||
}
|
||||
|
||||
// 底部操作栏
|
||||
export default function StickyButton(props) {
|
||||
const {
|
||||
@@ -45,6 +73,7 @@ export default function StickyButton(props) {
|
||||
onStatusChange,
|
||||
handleAddComment,
|
||||
getCommentCount,
|
||||
currentUserInfo,
|
||||
} = props;
|
||||
const [commentCount, setCommentCount] = useState(0);
|
||||
const ntrpRef = useRef<{
|
||||
@@ -58,14 +87,28 @@ export default function StickyButton(props) {
|
||||
start_time,
|
||||
end_time,
|
||||
is_organizer,
|
||||
skill_level_max,
|
||||
skill_level_min,
|
||||
} = detail || {};
|
||||
|
||||
const { ntrp_level } = currentUserInfo || {};
|
||||
|
||||
const matchNtrpReq = matchNtrpRequestment(
|
||||
ntrp_level,
|
||||
skill_level_min,
|
||||
skill_level_max
|
||||
);
|
||||
|
||||
const gameManageRef = useRef();
|
||||
|
||||
function handleSelfEvaluate() {
|
||||
ntrpRef?.current?.show({
|
||||
type: EvaluateScene.detail,
|
||||
next: (flag) => {
|
||||
next: ({ flag, score }) => {
|
||||
if (!matchNtrpRequestment(score, skill_level_min, skill_level_max)) {
|
||||
toast("您当前不符合此球局NTRP水平要求,去看看其他活动吧~");
|
||||
return;
|
||||
}
|
||||
if (flag) {
|
||||
Taro.navigateTo({
|
||||
url: `/order_pages/orderDetail/index?gameId=${id}`,
|
||||
@@ -123,31 +166,31 @@ export default function StickyButton(props) {
|
||||
return {
|
||||
text: "活动已取消",
|
||||
available: false,
|
||||
// action: () => toast("活动已取消"),
|
||||
action: () => toast("活动已取消,去看看其他活动吧~"),
|
||||
};
|
||||
} else if (MATCH_STATUS.FINISHED === match_status) {
|
||||
return {
|
||||
text: "活动已结束",
|
||||
available: false,
|
||||
// action: () => toast("活动已取消"),
|
||||
action: () => toast("活动已结束,去看看其他活动吧~"),
|
||||
};
|
||||
} else if (dayjs(end_time).isBefore(dayjs())) {
|
||||
return {
|
||||
text: "活动已结束",
|
||||
available: false,
|
||||
// action: () => toast("活动已结束"),
|
||||
action: () => toast("活动已结束,去看看其他活动吧~"),
|
||||
};
|
||||
} else if (dayjs(start_time).isBefore(dayjs())) {
|
||||
return {
|
||||
text: "活动已开始",
|
||||
available: false,
|
||||
// action: () => toast("活动已开始"),
|
||||
action: () => toast("活动已开始,去看看其他活动吧~"),
|
||||
};
|
||||
} else if (isFull(detail)) {
|
||||
return {
|
||||
text: "活动已满员",
|
||||
available: false,
|
||||
// action: () => toast("活动已满员"),
|
||||
action: () => toast("活动已满员,去看看其他活动吧~"),
|
||||
};
|
||||
}
|
||||
if (waiting_start) {
|
||||
@@ -159,7 +202,7 @@ export default function StickyButton(props) {
|
||||
<Text className={styles.btnText}>已加入</Text>
|
||||
</>
|
||||
),
|
||||
action: () => toast("已加入"),
|
||||
action: () => toast("您已参与了本次活动"),
|
||||
};
|
||||
} else if (is_substituting) {
|
||||
return {
|
||||
@@ -170,7 +213,7 @@ export default function StickyButton(props) {
|
||||
<Text className={styles.btnText}>已加入候补</Text>
|
||||
</>
|
||||
),
|
||||
action: () => toast("已加入候补"),
|
||||
action: () => toast("您已加入候补,候补失败会全额退款~"),
|
||||
};
|
||||
} else if (can_pay) {
|
||||
return {
|
||||
@@ -190,6 +233,19 @@ export default function StickyButton(props) {
|
||||
}
|
||||
},
|
||||
};
|
||||
} else if (!matchNtrpReq) {
|
||||
return {
|
||||
text: () => (
|
||||
<>
|
||||
<Image className={styles.crrrencySymbol} src={RMB_ICON} />
|
||||
{displayPrice}
|
||||
<Text className={styles.btnText}>立即加入</Text>
|
||||
</>
|
||||
),
|
||||
available: false,
|
||||
action: () =>
|
||||
toast("您当前不符合此球局NTRP水平要求,去看看其他活动吧~"),
|
||||
};
|
||||
} else if (can_substitute) {
|
||||
return {
|
||||
text: () => (
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Text, View } from "@tarojs/components";
|
||||
import styles from "./index.module.scss";
|
||||
import { insertDotInTags } from "../../utils/helper";
|
||||
import { insertDotInTags } from "@/utils/helper";
|
||||
|
||||
export default function SupplementalNotes(props) {
|
||||
const {
|
||||
|
||||
@@ -4,7 +4,7 @@ import Taro from "@tarojs/taro";
|
||||
import { CommonPopup } from "@/components";
|
||||
import img from "@/config/images";
|
||||
import styles from "./index.module.scss";
|
||||
import { insertDotInTags } from "../../utils/helper";
|
||||
import { insertDotInTags } from "@/utils/helper";
|
||||
|
||||
// 场馆信息
|
||||
export default function VenueInfo(props) {
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
.detail-page {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
// background-color: #FAFAFA;
|
||||
// padding-bottom: env(safe-area-inset-bottom);
|
||||
position: relative;
|
||||
|
||||
.custom-navbar {
|
||||
height: 56px; /* 通常与原生导航栏高度一致 */
|
||||
@@ -11,43 +10,55 @@
|
||||
justify-content: center;
|
||||
// background-color: #fff;
|
||||
color: #000;
|
||||
padding-top: 44px; /* 适配状态栏 */
|
||||
position: sticky;
|
||||
// padding-top: 44px; /* 适配状态栏 */
|
||||
position: fixed;
|
||||
width: 100%;
|
||||
top: 0;
|
||||
box-sizing: border-box;
|
||||
z-index: 100;
|
||||
overflow: hidden;
|
||||
background-color: rgba(0, 0, 0, 0.2);
|
||||
border-bottom: 1px solid transparent;
|
||||
transition: background 0.25s ease, backdrop-filter 0.25s ease;
|
||||
|
||||
&.glass {
|
||||
background: rgba(0, 0, 0, 0.2);
|
||||
box-shadow: 0 0 4px 0 rgba(255, 255, 255, 0.25) inset;
|
||||
backdrop-filter: blur(6px);
|
||||
border-color: rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
}
|
||||
|
||||
.detail-navigator {
|
||||
height: 30px;
|
||||
height: 40px;
|
||||
width: 80px;
|
||||
border-radius: 15px;
|
||||
position: absolute;
|
||||
left: 12px;
|
||||
border: 1px solid #888;
|
||||
// border: 1px solid #888;
|
||||
box-sizing: border-box;
|
||||
color: #fff;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
background: rgba(0, 0, 0, 0.1);
|
||||
// background: rgba(0, 0, 0, 0.1);
|
||||
|
||||
.detail-navigator-back {
|
||||
border-right: 1px solid #444;
|
||||
}
|
||||
// .detail-navigator-back {
|
||||
// border-right: 1px solid #444;
|
||||
// }
|
||||
|
||||
.detail-navigator-back,
|
||||
.detail-navigator-icon {
|
||||
height: 20px;
|
||||
width: 50%;
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
justify-content: flex-start;
|
||||
align-items: center;
|
||||
|
||||
& > .detail-navigator-back-icon {
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
color: #fff;
|
||||
margin-left: 8px;
|
||||
}
|
||||
|
||||
& > .detail-navigator-logo-icon {
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
import { useState, useEffect, useRef } from "react";
|
||||
import { View, Text, Image } from "@tarojs/components";
|
||||
import { View, Text, Image, ScrollView } from "@tarojs/components";
|
||||
import Taro, { useRouter, useDidShow } from "@tarojs/taro";
|
||||
import classnames from "classnames";
|
||||
import { throttle } from "@tarojs/runtime";
|
||||
// 导入API服务
|
||||
import { withAuth, Comments } from "@/components";
|
||||
import DetailService from "@/services/detailService";
|
||||
@@ -18,9 +20,9 @@ import Participants from "./components/Participants";
|
||||
import SupplementalNotes from "./components/SupplementalNotes";
|
||||
import OrganizerInfo from "./components/OrganizerInfo";
|
||||
import SharePopup from "./components/SharePopup";
|
||||
import { navto, toast } from "./utils/helper";
|
||||
import { navto, toast } from "@/utils/helper";
|
||||
import ArrowLeft from "@/static/detail/icon-arrow-left.svg";
|
||||
import Logo from "@/static/detail/icon-logo-go.svg";
|
||||
// import Logo from "@/static/detail/icon-logo-go.svg";
|
||||
import styles from "./index.module.scss";
|
||||
|
||||
function Index() {
|
||||
@@ -35,7 +37,7 @@ function Index() {
|
||||
const myInfo = useUserInfo();
|
||||
|
||||
const { statusNavbarHeightInfo } = useGlobalState();
|
||||
const { statusBarHeight, navBarHeight } = statusNavbarHeightInfo;
|
||||
const { statusBarHeight, navBarHeight, totalHeight } = statusNavbarHeightInfo;
|
||||
|
||||
const isMyOwn = userInfo.id === myInfo.id;
|
||||
|
||||
@@ -150,14 +152,33 @@ function Index() {
|
||||
? { backgroundImage: `url(${detail?.image_list?.[0]})` }
|
||||
: {};
|
||||
|
||||
const [glass, setGlass] = useState(false);
|
||||
|
||||
const onScroll = throttle((e) => {
|
||||
const top = e.detail.scrollTop;
|
||||
setGlass(top > 20);
|
||||
}, 16);
|
||||
|
||||
return (
|
||||
<View className={styles["detail-page"]}>
|
||||
<ScrollView
|
||||
className={styles["detail-page"]}
|
||||
scrollY
|
||||
onScroll={onScroll}
|
||||
onScrollToUpper={() => {
|
||||
setGlass(false);
|
||||
}}
|
||||
enhanced
|
||||
showScrollbar={false}
|
||||
>
|
||||
{/* custom navbar */}
|
||||
<view
|
||||
className={styles["custom-navbar"]}
|
||||
<View
|
||||
className={classnames(
|
||||
styles["custom-navbar"],
|
||||
glass ? styles.glass : ""
|
||||
)}
|
||||
style={{
|
||||
height: `${statusBarHeight}px`,
|
||||
paddingTop: `${navBarHeight}px`,
|
||||
height: `${totalHeight}px`,
|
||||
paddingTop: `${statusBarHeight}px`,
|
||||
}}
|
||||
>
|
||||
<View className={styles["detail-navigator"]}>
|
||||
@@ -170,14 +191,14 @@ function Index() {
|
||||
src={ArrowLeft}
|
||||
/>
|
||||
</View>
|
||||
<View className={styles["detail-navigator-icon"]}>
|
||||
{/* <View className={styles["detail-navigator-icon"]}>
|
||||
<Image
|
||||
className={styles["detail-navigator-logo-icon"]}
|
||||
src={Logo}
|
||||
/>
|
||||
</View>
|
||||
</View> */}
|
||||
</View>
|
||||
</view>
|
||||
</View>
|
||||
<View className={styles["detail-page-bg"]} style={backgroundImage} />
|
||||
{/* swiper */}
|
||||
<Carousel detail={detail} />
|
||||
@@ -238,6 +259,7 @@ function Index() {
|
||||
getCommentCount={
|
||||
commentRef.current && commentRef.current.getCommentCount
|
||||
}
|
||||
currentUserInfo={myInfo}
|
||||
/>
|
||||
{/* share popup */}
|
||||
<SharePopup
|
||||
@@ -248,7 +270,7 @@ function Index() {
|
||||
userInfo={userInfo}
|
||||
/>
|
||||
</View>
|
||||
</View>
|
||||
</ScrollView>
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,28 +0,0 @@
|
||||
import Taro from "@tarojs/taro";
|
||||
|
||||
export function navto(url) {
|
||||
Taro.navigateTo({
|
||||
url: url,
|
||||
});
|
||||
}
|
||||
|
||||
export function toast(message) {
|
||||
Taro.showToast({ title: message, icon: "none" });
|
||||
}
|
||||
|
||||
// 将·作为连接符插入到标签文本之间
|
||||
export function insertDotInTags(tags: string[]) {
|
||||
if (!tags) return [];
|
||||
return tags.join("-·-").split("-");
|
||||
}
|
||||
|
||||
export function genNTRPRequirementText(min, max) {
|
||||
if (min && max && min !== max) {
|
||||
return `${min} - ${max} 之间`;
|
||||
} else if (max === "1") {
|
||||
return "无要求";
|
||||
} else if (max) {
|
||||
return `${max} 以上`;
|
||||
}
|
||||
return "-";
|
||||
}
|
||||
@@ -13,7 +13,7 @@ import WechatLogo from "@/static/detail/wechat_icon.svg";
|
||||
import WechatTimeline from "@/static/detail/wechat_timeline.svg";
|
||||
import { useUserActions } from "@/store/userStore";
|
||||
import { DayOfWeekMap } from "../detail/config";
|
||||
import { genNTRPRequirementText } from "@/game_pages/detail/utils/helper";
|
||||
import { genNTRPRequirementText } from "@/utils/helper";
|
||||
import styles from "./index.module.scss";
|
||||
|
||||
function SharePoster(props) {
|
||||
|
||||
@@ -400,15 +400,49 @@ function OrderMsg(props) {
|
||||
},
|
||||
{
|
||||
title: "报名人电话",
|
||||
content: registrant_phone,
|
||||
// content: registrant_phone,
|
||||
content: registrant_phone ? (
|
||||
<Text
|
||||
selectable={true} // 支持长按复制
|
||||
style={{
|
||||
color: "#007AFF",
|
||||
// textDecoration: "underline",
|
||||
cursor: "pointer",
|
||||
}}
|
||||
onClick={() => {
|
||||
Taro.makePhoneCall({ phoneNumber: registrant_phone });
|
||||
}}
|
||||
>
|
||||
{registrant_phone}
|
||||
</Text>
|
||||
) : (
|
||||
"-"
|
||||
),
|
||||
},
|
||||
{
|
||||
title: "组织人微信号",
|
||||
content: wechat_contact,
|
||||
content: wechat_contact || "-",
|
||||
},
|
||||
{
|
||||
title: "组织人电话",
|
||||
content: wechat_contact,
|
||||
// content: wechat_contact,
|
||||
content: wechat_contact ? (
|
||||
<Text
|
||||
selectable={true} // 支持长按复制
|
||||
style={{
|
||||
color: "#007AFF",
|
||||
// textDecoration: "underline",
|
||||
cursor: "pointer",
|
||||
}}
|
||||
onClick={() => {
|
||||
Taro.makePhoneCall({ phoneNumber: wechat_contact });
|
||||
}}
|
||||
>
|
||||
{wechat_contact}
|
||||
</Text>
|
||||
) : (
|
||||
"-"
|
||||
),
|
||||
},
|
||||
{
|
||||
title: "费用",
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
}
|
||||
|
||||
.container {
|
||||
padding: 100px 12px 40px;
|
||||
padding: 100px 0 40px;
|
||||
background-color: #fafafa;
|
||||
height: 100vh;
|
||||
width: 100%;
|
||||
@@ -24,7 +24,7 @@
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
position: relative;
|
||||
background-color: #fff;
|
||||
background-color: #fafafa;
|
||||
|
||||
// .bg {
|
||||
// position: absolute;
|
||||
@@ -48,12 +48,13 @@
|
||||
font-style: normal;
|
||||
font-weight: 500;
|
||||
line-height: 18px;
|
||||
background-color: #f9f9f9;
|
||||
// background-color: #f9f9f9;
|
||||
}
|
||||
}
|
||||
|
||||
.orderItem {
|
||||
width: 100%;
|
||||
// width: calc(100% - 3px);
|
||||
margin: 0 12px;
|
||||
// height: 222px;
|
||||
background-color: #fff;
|
||||
border-radius: 12px;
|
||||
|
||||
@@ -17,7 +17,7 @@ import { withAuth, RefundPopup, GeneralNavbar } from "@/components";
|
||||
import { payOrder, generateOrderActions } from "@/utils";
|
||||
import emptyContent from "@/static/emptyStatus/publish-empty.png";
|
||||
import CustomerIcon from "@/static/order/customer.svg";
|
||||
import { insertDotInTags } from "@/game_pages/detail/utils/helper";
|
||||
import { insertDotInTags, genNTRPRequirementText } from "@/utils/helper";
|
||||
import styles from "./index.module.scss";
|
||||
|
||||
dayjs.locale("zh-cn");
|
||||
@@ -363,11 +363,7 @@ const OrderList = () => {
|
||||
<Text>{max_players}</Text>
|
||||
</View>
|
||||
<View className={styles.levelReq}>
|
||||
{skill_level_max !== skill_level_min
|
||||
? `${skill_level_min || "-"} 至 ${skill_level_max || "-"}`
|
||||
: skill_level_min === 1
|
||||
? "无要求"
|
||||
: `${skill_level_min} 以上`}
|
||||
{genNTRPRequirementText(skill_level_min, skill_level_max)}
|
||||
</View>
|
||||
<View className={styles.playType}>{play_type}</View>
|
||||
</View>
|
||||
|
||||
@@ -8,6 +8,7 @@ import evaluateService, {
|
||||
LastTimeTestResult,
|
||||
Question,
|
||||
TestResultData,
|
||||
StageType,
|
||||
} from "@/services/evaluateService";
|
||||
import { useUserInfo, useUserActions } from "@/store/userStore";
|
||||
import { useEvaluate, EvaluateScene } from "@/store/evaluateStore";
|
||||
@@ -24,12 +25,6 @@ import DownloadIcon from "@/static/ntrp/ntrp_download.svg";
|
||||
import ReTestIcon from "@/static/ntrp/ntrp_re-action.svg";
|
||||
import styles from "./index.module.scss";
|
||||
|
||||
enum StageType {
|
||||
INTRO = "intro",
|
||||
TEST = "test",
|
||||
RESULT = "result",
|
||||
}
|
||||
|
||||
const sourceTypeToTextMap = new Map([
|
||||
[EvaluateScene.detail, "继续加入球局"],
|
||||
[EvaluateScene.publish, "继续发布球局"],
|
||||
@@ -174,20 +169,17 @@ function Intro() {
|
||||
}
|
||||
|
||||
function handleNext(type) {
|
||||
setCallback({
|
||||
type: EvaluateScene.share,
|
||||
next: () => {
|
||||
Taro.redirectTo({ url: "/main_pages/index" });
|
||||
},
|
||||
onCancel: () => {
|
||||
Taro.redirectTo({ url: "/main_pages/index" });
|
||||
// if (userInfo.id) {
|
||||
// Taro.redirectTo({ url: "/game_pages/list/index" });
|
||||
// } else {
|
||||
// Taro.exitMiniProgram();
|
||||
// }
|
||||
},
|
||||
});
|
||||
if (!id) {
|
||||
setCallback({
|
||||
type: EvaluateScene.share,
|
||||
next: () => {
|
||||
Taro.redirectTo({ url: "/main_pages/index" });
|
||||
},
|
||||
onCancel: () => {
|
||||
Taro.redirectTo({ url: "/main_pages/index" });
|
||||
},
|
||||
});
|
||||
}
|
||||
Taro.redirectTo({
|
||||
url: `/other_pages/ntrp-evaluate/index?stage=${type}${
|
||||
type === StageType.RESULT ? `&id=${id}` : ""
|
||||
@@ -497,7 +489,7 @@ function Result() {
|
||||
|
||||
async function handleGoon() {
|
||||
if (type) {
|
||||
next();
|
||||
next({ flag: false, score: result?.ntrp_level as string });
|
||||
await delay(1500);
|
||||
clear();
|
||||
} else {
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,12 @@
|
||||
import httpService from "./httpService";
|
||||
import type { ApiResponse } from "./httpService";
|
||||
|
||||
export enum StageType {
|
||||
INTRO = "intro",
|
||||
TEST = "test",
|
||||
RESULT = "result",
|
||||
}
|
||||
|
||||
// 单个选项类型
|
||||
interface Option {
|
||||
text: string;
|
||||
|
||||
@@ -11,7 +11,10 @@ export enum EvaluateScene {
|
||||
|
||||
export interface EvaluateCallback {
|
||||
type: EvaluateScene | ''
|
||||
next: (flag?: boolean) => void,
|
||||
// flag是用来区分跳转ntrp测试后的操作和直接修改ntrp水平成功后的操作
|
||||
// score是用在加入球局前判断是否满足球局要求的返回值,限定为必传
|
||||
// next有两个地方调用:ntrp结果页handleGoon、ntrp弹窗(NTRPEvaluatePopup)直接修改点击保存按钮时
|
||||
next: ({ flag, score }: { flag?: boolean, score: string }) => void,
|
||||
onCancel: () => void,
|
||||
}
|
||||
|
||||
|
||||
@@ -23,4 +23,35 @@ export const sceneRedirectLogic = (options, defaultPage: string) => {
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
export function navto(url) {
|
||||
Taro.navigateTo({
|
||||
url: url,
|
||||
});
|
||||
}
|
||||
|
||||
export function toast(message) {
|
||||
Taro.showToast({ title: message, icon: "none" });
|
||||
}
|
||||
|
||||
// 将·作为连接符插入到标签文本之间
|
||||
export function insertDotInTags(tags: string[]) {
|
||||
if (!tags) return [];
|
||||
return tags.join("-·-").split("-");
|
||||
}
|
||||
|
||||
function formatNtrpDisplay(val) {
|
||||
return Number(val).toFixed(1)
|
||||
}
|
||||
|
||||
export function genNTRPRequirementText(min, max) {
|
||||
if (min && max && min !== max) {
|
||||
return `${formatNtrpDisplay(min)} - ${formatNtrpDisplay(max)} 之间`;
|
||||
} else if (max === "1") {
|
||||
return "无要求";
|
||||
} else if (max) {
|
||||
return `${formatNtrpDisplay(max)} 以上`;
|
||||
}
|
||||
return "-";
|
||||
}
|
||||
Reference in New Issue
Block a user