16 Commits

Author SHA1 Message Date
张成
d90dcb053e 修改 分享的 图标 2025-12-28 13:33:48 +08:00
张成
e7ee8bc1de 兜底 页面 样式问题 2025-12-28 11:05:32 +08:00
张成
9f63a2369a 1 2025-12-13 00:20:26 +08:00
张成
e560d06106 1 2025-12-12 23:49:10 +08:00
张成
4c5262441c 1 2025-12-12 11:56:41 +08:00
张成
293b9e6eba 1 2025-12-11 15:56:22 +08:00
c42055d2c3 Merge branch 'feat/liujie' 2025-12-11 09:57:09 +08:00
b7efbce737 feat: 修改NTRP上次测试结果文案 2025-12-11 09:56:56 +08:00
筱野
26ab56fd1e Merge branch 'master' of http://git.bimwe.com/tennis/mini-programs 2025-12-10 22:14:15 +08:00
筱野
28201d79b9 修改标题对齐问题 2025-12-10 22:14:08 +08:00
e1c4990ada Merge branch 'feat/liujie' 2025-12-10 20:08:33 +08:00
46a59ba282 feat: refund policy 从订单接口获取、梳理订单操作按钮 2025-12-10 20:08:13 +08:00
张成
7b620210a2 1 2025-12-10 00:35:15 +08:00
张成
e2a8ed4e32 1 2025-12-10 00:14:09 +08:00
张成
85566b448e Merge branch 'master' of http://git.bimwe.com/tennis/mini-programs 2025-12-09 23:39:38 +08:00
张成
0774cf5ae6 1 2025-12-09 23:39:34 +08:00
17 changed files with 553 additions and 133 deletions

View File

@@ -1,4 +1,4 @@
import { useEffect, useState, useRef } from "react"; import { useEffect, useState } from "react";
import { View, Text, Image } from "@tarojs/components"; import { View, Text, Image } from "@tarojs/components";
import img from "@/config/images"; import img from "@/config/images";
import { useGlobalState } from "@/store/global"; import { useGlobalState } from "@/store/global";
@@ -13,6 +13,12 @@ import LocationConfirmDialog from "@/components/LocationConfirmDialog";
// 城市缓存 key // 城市缓存 key
const CITY_CACHE_KEY = "USER_SELECTED_CITY"; const CITY_CACHE_KEY = "USER_SELECTED_CITY";
// 定位弹窗关闭时间缓存 key用户选择"继续浏览"时记录)
const LOCATION_DIALOG_DISMISS_TIME_KEY = "LOCATION_DIALOG_DISMISS_TIME";
// 城市切换时间缓存 key用户手动切换城市时记录
const CITY_CHANGE_TIME_KEY = "CITY_CHANGE_TIME";
// 2小时的毫秒数
const TWO_HOURS_MS = 2 * 60 * 60 * 1000;
interface IProps { interface IProps {
config?: { config?: {
@@ -90,7 +96,6 @@ const HomeNavbar = (props: IProps) => {
detectedProvince: string; detectedProvince: string;
cachedCity: [string, string]; cachedCity: [string, string];
} | null>(null); } | null>(null);
const hasShownLocationDialog = useRef(false); // 防止重复弹窗
// 监听城市选择器状态变化,通知父组件 // 监听城市选择器状态变化,通知父组件
useEffect(() => { useEffect(() => {
@@ -104,41 +109,156 @@ const HomeNavbar = (props: IProps) => {
// 只使用省份/直辖市,不使用城市(城市可能是区) // 只使用省份/直辖市,不使用城市(城市可能是区)
const detectedLocation = lastLocationProvince; const detectedLocation = lastLocationProvince;
// 初始化城市:优先使用缓存的定位信息,其次使用用户详情中的位置信息 // 检查是否应该显示定位确认弹窗
const should_show_location_dialog = (): boolean => {
try {
const current_time = Date.now();
// 检查是否在2小时内切换过城市
const city_change_time = (Taro as any).getStorageSync(CITY_CHANGE_TIME_KEY);
if (city_change_time) {
const time_diff = current_time - city_change_time;
// 如果距离上次切换城市还在2小时内不显示弹窗
if (time_diff < TWO_HOURS_MS) {
console.log(`[HomeNavbar] 距离上次切换城市还不到2小时剩余时间: ${Math.ceil((TWO_HOURS_MS - time_diff) / 1000 / 60)}分钟,不显示定位弹窗`);
return false;
} else {
// 超过2小时清除过期记录
(Taro as any).removeStorageSync(CITY_CHANGE_TIME_KEY);
}
}
// 检查是否在2小时内已选择"继续浏览"
const dismiss_time = (Taro as any).getStorageSync(LOCATION_DIALOG_DISMISS_TIME_KEY);
if (!dismiss_time) {
return true; // 没有记录,可以显示
}
const time_diff = current_time - dismiss_time;
// 如果距离上次选择"继续浏览"已超过2小时可以再次显示
if (time_diff >= TWO_HOURS_MS) {
// 清除过期记录
(Taro as any).removeStorageSync(LOCATION_DIALOG_DISMISS_TIME_KEY);
return true;
}
// 在2小时内不显示弹窗
console.log(`[HomeNavbar] 距离上次选择"继续浏览"还不到2小时剩余时间: ${Math.ceil((TWO_HOURS_MS - time_diff) / 1000 / 60)}分钟`);
return false;
} catch (error) {
console.error('[HomeNavbar] 检查定位弹窗显示条件失败:', error);
return true; // 出错时默认显示
}
};
// 显示定位确认弹窗
const showLocationConfirmDialog = (detectedLocation: string, cachedCity: [string, string]) => {
// 检查是否应该显示弹窗
if (!should_show_location_dialog()) {
console.log('[HomeNavbar] 用户在2小时内已选择"继续浏览"或切换过城市,不显示弹窗');
return;
}
console.log('[HomeNavbar] 准备显示定位确认弹窗,隐藏 GuideBar');
setLocationDialogData({ detectedProvince: detectedLocation, cachedCity });
setLocationDialogVisible(true);
// 显示弹窗时隐藏 GuideBar
setShowGuideBar(false);
console.log('[HomeNavbar] setShowGuideBar(false) 已调用');
};
// 初始化城市:优先使用缓存的定位信息,如果缓存城市和用户详情位置不一致,且时间过期,则弹出选择框
// 只在组件挂载时执行一次,避免重复执行
useEffect(() => { useEffect(() => {
// 1. 尝试从缓存中读取上次的定位信息 // 1. 优先尝试从缓存中读取上次的定位信息
const cachedCity = (Taro as any).getStorageSync(CITY_CACHE_KEY); const cachedCity = (Taro as any).getStorageSync(CITY_CACHE_KEY);
if (cachedCity && Array.isArray(cachedCity) && cachedCity.length === 2) { if (cachedCity && Array.isArray(cachedCity) && cachedCity.length === 2) {
// 如果有缓存的定位信息,使用缓存 // 如果有缓存的定位信息,使用缓存
const cachedCityArray = cachedCity as [string, string]; const cachedCityArray = cachedCity as [string, string];
console.log("使用缓存的定位城市:", cachedCityArray); console.log("[HomeNavbar] 使用缓存的定位城市:", cachedCityArray);
updateArea(cachedCityArray); updateArea(cachedCityArray);
// 如果用户详情中有位置信息且与缓存不同,弹窗询问是否切换 // 如果用户详情中有位置信息且与缓存不一致,检查是否需要弹窗
if (detectedLocation && cachedCityArray[1] !== detectedLocation && !hasShownLocationDialog.current) { if (detectedLocation && cachedCityArray[1] !== detectedLocation) {
hasShownLocationDialog.current = true; // 检查时间缓存,如果没有或过期,则弹出选择框
showLocationConfirmDialog(detectedLocation, cachedCityArray); if (should_show_location_dialog()) {
console.log("[HomeNavbar] 缓存城市与用户详情位置不一致,且时间过期,弹出选择框");
showLocationConfirmDialog(detectedLocation, cachedCityArray);
} else {
console.log("[HomeNavbar] 缓存城市与用户详情位置不一致,但时间未过期,不弹出选择框");
}
} }
} else if (detectedLocation) { } else if (detectedLocation) {
// 如果没有缓存但有用户详情中的位置信息,直接使用并保存到缓存 // 只有在完全没有缓存的情况下,才使用用户详情中的位置信息
console.log("没有缓存,使用用户详情中的位置信息:", detectedLocation); console.log("[HomeNavbar] 没有缓存,使用用户详情中的位置信息:", detectedLocation);
const newArea: [string, string] = ["中国", detectedLocation]; const newArea: [string, string] = ["中国", detectedLocation];
updateArea(newArea); updateArea(newArea);
// 保存定位信息到缓存 // 保存定位信息到缓存
(Taro as any).setStorageSync(CITY_CACHE_KEY, newArea); (Taro as any).setStorageSync(CITY_CACHE_KEY, newArea);
} }
}, [detectedLocation]); // eslint-disable-next-line react-hooks/exhaustive-deps
}, []); // 空依赖数组,确保只在组件挂载时执行一次
// 显示定位确认弹窗 // 检查是否在2小时内已选择"继续浏览"或切换过城市(当前不使用,首页重新进入时直接使用缓存中的位置)
const showLocationConfirmDialog = (detectedLocation: string, cachedCity: [string, string]) => { // const should_show_location_dialog = (): boolean => {
console.log('[LocationDialog] 准备显示定位确认弹窗,隐藏 GuideBar'); // try {
setLocationDialogData({ detectedProvince: detectedLocation, cachedCity }); // // 检查是否在2小时内切换过城市
setLocationDialogVisible(true); // const city_change_time = (Taro as any).getStorageSync(CITY_CHANGE_TIME_KEY);
// 显示弹窗时隐藏 GuideBar // if (city_change_time) {
setShowGuideBar(false); // const current_time = Date.now();
console.log('[LocationDialog] setShowGuideBar(false) 已调用'); // const time_diff = current_time - city_change_time;
}; //
// // 如果距离上次切换城市还在2小时内不显示弹窗
// if (time_diff < TWO_HOURS_MS) {
// console.log(`距离上次切换城市还不到2小时剩余时间: ${Math.ceil((TWO_HOURS_MS - time_diff) / 1000 / 60)}分钟,不显示定位弹窗`);
// return false;
// } else {
// // 超过2小时清除过期记录
// (Taro as any).removeStorageSync(CITY_CHANGE_TIME_KEY);
// }
// }
//
// // 检查是否在2小时内已选择"继续浏览"
// const dismiss_time = (Taro as any).getStorageSync(LOCATION_DIALOG_DISMISS_TIME_KEY);
// if (!dismiss_time) {
// return true; // 没有记录,可以显示
// }
//
// const current_time = Date.now();
// const time_diff = current_time - dismiss_time;
//
// // 如果距离上次选择"继续浏览"已超过2小时可以再次显示
// if (time_diff >= TWO_HOURS_MS) {
// // 清除过期记录
// (Taro as any).removeStorageSync(LOCATION_DIALOG_DISMISS_TIME_KEY);
// return true;
// }
//
// // 在2小时内不显示弹窗
// console.log(`距离上次选择"继续浏览"还不到2小时剩余时间: ${Math.ceil((TWO_HOURS_MS - time_diff) / 1000 / 60)}分钟`);
// return false;
// } catch (error) {
// console.error('检查定位弹窗显示条件失败:', error);
// return true; // 出错时默认显示
// }
// };
// 显示定位确认弹窗(当前不使用,首页重新进入时直接使用缓存中的位置)
// const showLocationConfirmDialog = (detectedLocation: string, cachedCity: [string, string]) => {
// // 检查是否在2小时内已选择"继续浏览"
// if (!should_show_location_dialog()) {
// console.log('[LocationDialog] 用户在2小时内已选择"继续浏览",不显示弹窗');
// return;
// }
//
// console.log('[LocationDialog] 准备显示定位确认弹窗,隐藏 GuideBar');
// setLocationDialogData({ detectedProvince: detectedLocation, cachedCity });
// setLocationDialogVisible(true);
// // 显示弹窗时隐藏 GuideBar
// setShowGuideBar(false);
// console.log('[LocationDialog] setShowGuideBar(false) 已调用');
// };
// 处理定位弹窗确认 // 处理定位弹窗确认
const handleLocationDialogConfirm = () => { const handleLocationDialogConfirm = () => {
@@ -150,6 +270,14 @@ const HomeNavbar = (props: IProps) => {
updateArea(newArea); updateArea(newArea);
// 更新缓存为新的定位信息 // 更新缓存为新的定位信息
(Taro as any).setStorageSync(CITY_CACHE_KEY, newArea); (Taro as any).setStorageSync(CITY_CACHE_KEY, newArea);
// 记录切换城市的时间戳2小时内不再提示
try {
const current_time = Date.now();
(Taro as any).setStorageSync(CITY_CHANGE_TIME_KEY, current_time);
console.log(`[LocationDialog] 已记录用户切换城市的时间2小时内不再提示`);
} catch (error) {
console.error('保存城市切换时间失败:', error);
}
console.log("切换到用户详情中的位置信息并更新缓存:", detectedProvince); console.log("切换到用户详情中的位置信息并更新缓存:", detectedProvince);
// 关闭弹窗 // 关闭弹窗
@@ -162,14 +290,23 @@ const HomeNavbar = (props: IProps) => {
handleCityChangeWithoutCache(); handleCityChangeWithoutCache();
}; };
// 处理定位弹窗取消 // 处理定位弹窗取消(用户选择"继续浏览"
const handleLocationDialogCancel = () => { const handleLocationDialogCancel = () => {
if (!locationDialogData) return; if (!locationDialogData) return;
const { cachedCity } = locationDialogData; const { cachedCity } = locationDialogData;
// 用户选择"",保持缓存的定位城市 // 用户选择"继续浏览",保持缓存的定位城市
console.log("保持缓存的定位城市:", cachedCity[1]); console.log("保持缓存的定位城市:", cachedCity[1]);
// 记录用户选择"继续浏览"的时间戳2小时内不再提示
try {
const current_time = Date.now();
(Taro as any).setStorageSync(LOCATION_DIALOG_DISMISS_TIME_KEY, current_time);
console.log(`[LocationDialog] 已记录用户选择"继续浏览"的时间2小时内不再提示`);
} catch (error) {
console.error('保存定位弹窗关闭时间失败:', error);
}
// 关闭弹窗 // 关闭弹窗
setLocationDialogVisible(false); setLocationDialogVisible(false);
setLocationDialogData(null); setLocationDialogData(null);
@@ -258,12 +395,23 @@ const HomeNavbar = (props: IProps) => {
// 处理城市切换(用户手动选择) // 处理城市切换(用户手动选择)
const handleCityChange = async (_newArea: any) => { const handleCityChange = async (_newArea: any) => {
// 用户手动选择的城市保存到缓存(临时切换) // 用户手动选择的城市保存到缓存
console.log("用户手动选择城市(不保存缓存:", _newArea); console.log("用户手动选择城市,更新缓存:", _newArea);
// 先更新 area 状态(用于界面显示和接口参数) // 先更新 area 状态(用于界面显示和接口参数)
updateArea(_newArea); updateArea(_newArea);
// 保存城市到缓存
try {
(Taro as any).setStorageSync(CITY_CACHE_KEY, _newArea);
// 记录切换时间2小时内不再弹出定位弹窗
const current_time = Date.now();
(Taro as any).setStorageSync(CITY_CHANGE_TIME_KEY, current_time);
console.log("已保存城市到缓存并记录切换时间:", _newArea, current_time);
} catch (error) {
console.error("保存城市缓存失败:", error);
}
// 先调用列表接口(会使用更新后的 state.area // 先调用列表接口(会使用更新后的 state.area
if (refreshBothLists) { if (refreshBothLists) {
await refreshBothLists(); await refreshBothLists();

View File

@@ -79,6 +79,10 @@
cursor: pointer; cursor: pointer;
transition: opacity 0.2s; transition: opacity 0.2s;
margin-top: 20px; margin-top: 20px;
position: relative;
z-index: 1;
user-select: none;
-webkit-tap-highlight-color: transparent;
&:first-child { &:first-child {
margin-top: 0; margin-top: 0;
@@ -111,6 +115,8 @@
font-size: 16px; font-size: 16px;
line-height: 22px; line-height: 22px;
text-align: center; text-align: center;
pointer-events: none;
user-select: none;
&.primary { &.primary {
color: #ffffff; color: #ffffff;

View File

@@ -40,10 +40,22 @@ const LocationConfirmDialog: React.FC<LocationConfirmDialogProps> = ({
<View className="locationDialogContent"> <View className="locationDialogContent">
<Text className="locationDialogTitle">{detectedCity}</Text> <Text className="locationDialogTitle">{detectedCity}</Text>
<View className="locationDialogButtons"> <View className="locationDialogButtons">
<View className="locationDialogButton primary" onClick={onConfirm}> <View
className="locationDialogButton primary"
onClick={(e) => {
e.stopPropagation();
onConfirm();
}}
>
<Text className="locationDialogButtonText primary">{detectedCity}</Text> <Text className="locationDialogButtonText primary">{detectedCity}</Text>
</View> </View>
<View className="locationDialogButton secondary" onClick={onCancel}> <View
className="locationDialogButton secondary"
onClick={(e) => {
e.stopPropagation();
onCancel();
}}
>
<Text className="locationDialogButtonText secondary">{currentCity}</Text> <Text className="locationDialogButtonText secondary">{currentCity}</Text>
</View> </View>
</View> </View>

View File

@@ -2,7 +2,7 @@ import Taro from "@tarojs/taro";
import { View, Canvas } from "@tarojs/components"; import { View, Canvas } from "@tarojs/components";
import { forwardRef, useImperativeHandle } from "react"; import { forwardRef, useImperativeHandle } from "react";
import shareLogoSvg from "@/static/ntrp/ntrp_share_logo.png"; import shareLogoSvg from "@/static/ntrp/ntrp_share_logo.png";
import docCopySvg from "@/static/ntrp/ntrp_doc_copy.svg"; import docCopyPng from "@/static/ntrp/ntrp_doc_copy.png";
import { OSS_BASE_URL } from "@/config/api"; import { OSS_BASE_URL } from "@/config/api";
interface RadarChartV2Props { interface RadarChartV2Props {
@@ -315,7 +315,7 @@ const RadarChartV2 = forwardRef<RadarChartV2Ref, RadarChartV2Props>((props, ref)
const addonRotation = 8 * (Math.PI / 180); // 旋转 8 度 const addonRotation = 8 * (Math.PI / 180); // 旋转 8 度
try { try {
const docCopyImg = await loadImage(canvas, docCopySvg); const docCopyImg = await loadImage(canvas, docCopyPng);
ctx.save(); ctx.save();
// 移动到旋转中心 // 移动到旋转中心

View File

@@ -1,4 +1,4 @@
import React, { useCallback } from 'react' import React, { useCallback, useState } from 'react'
import { View } from '@tarojs/components' import { View } from '@tarojs/components'
import { TextArea } from '@nutui/nutui-react-taro'; import { TextArea } from '@nutui/nutui-react-taro';
@@ -22,27 +22,49 @@ const TitleTextarea: React.FC<TitleTextareaProps> = ({
onBlur onBlur
}) => { }) => {
const isOverflow = value.length > maxLength const isOverflow = value.length > maxLength
// const [isFocused, setIsFocused] = useState(false)
// const showPlaceholder = !isFocused && !value
const handleChange = useCallback((values) => { const handleChange = useCallback((values) => {
// if (values.length > maxLength ) { // if (values.length > maxLength ) {
// const newValues = values.slice(0, maxLength) // const newValues = values.slice(0, maxLength)
// onChange(newValues) // onChange(newValues)
// return; // return;
// } // }
onChange(values) onChange(values)
}, []) }, [onChange])
const handleFocus = useCallback(() => {
// setIsFocused(true)
onFocus?.()
}, [onFocus])
const handleBlur = useCallback(() => {
// setIsFocused(false)
onBlur?.()
}, [onBlur])
return ( return (
<View className='title-input-wrapper'> <View className='title-input-wrapper'>
<TextArea <View className='title-input-box'>
className='title-input' <TextArea
placeholder={placeholder} className='title-input'
value={value} placeholder={placeholder}
onInput={(e) => handleChange(e.detail.value)} value={value}
// maxlength={maxLength} onInput={(e) => handleChange(e.detail.value)}
autoSize={true} // maxlength={maxLength}
placeholderClass='title-input-placeholder' placeholderClass='title-input-placeholder'
onFocus={onFocus} autoSize={true}
onBlur={onBlur} onFocus={handleFocus}
/> onBlur={handleBlur}
/>
{/* {showPlaceholder && (
<View className='title-input-placeholder-custom'>
{placeholder}
</View>
)} */}
</View>
<View className={`char-count${isOverflow ? ' char-count--error' : ''}`}> <View className={`char-count${isOverflow ? ' char-count--error' : ''}`}>
{value.length}/{maxLength} {value.length}/{maxLength}
</View> </View>

View File

@@ -4,9 +4,22 @@
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: space-between; justify-content: space-between;
padding: 8px 12px; padding: 10px 12px;
min-height: 36px; min-height: 32px;
box-sizing: border-box; box-sizing: border-box;
.title-input-box {
position: relative;
flex: 1;
display: flex;
}
.title-input-placeholder {
color: rgba(60, 60, 67, 0.60) !important;
font-weight: normal !important;
position: relative;
line-height: 22px !important;
height: 22px;
flex: 1;
}
.title-input { .title-input {
flex: 1; flex: 1;
padding: 0; padding: 0;
@@ -17,22 +30,23 @@
display: flex; display: flex;
align-items: center; align-items: center;
resize: none; resize: none;
line-height: 26px; line-height: 22px;
min-height: 26px; min-height: 22px;
} }
.title-input-placeholder-custom {
// 使用 placeholderClass 来控制 placeholder 样式 position: absolute;
.title-input-placeholder { left: 7px;
color: rgba(60, 60, 67, 0.60) !important; top: 50%;
font-size: 16px !important; width: 100%;
font-weight: normal !important; padding: 0;
line-height: 26px !important; color: rgba(60, 60, 67, 0.60);
height: 26px; font-size: 16px;
flex: 1; font-weight: normal;
line-height: 22px;
pointer-events: none;
box-sizing: border-box;
transform: translateY(-50%);
} }
.char-count { .char-count {
color: #999; color: #999;
pointer-events: none; pointer-events: none;

View File

@@ -46,8 +46,7 @@ function genRefundNotice(refund_policy) {
}; };
} }
function renderCancelContent(checkOrderInfo) { function renderCancelContent(refund_policy = []) {
const { refund_policy = [] } = checkOrderInfo;
const current = dayjs(); const current = dayjs();
const policyList = [ const policyList = [
{ {
@@ -65,7 +64,6 @@ function renderCancelContent(checkOrderInfo) {
}; };
}), }),
]; ];
console.log("policyList", policyList);
const targetIndex = policyList.findIndex((item) => item.beforeCurrent); const targetIndex = policyList.findIndex((item) => item.beforeCurrent);
const { notice } = genRefundNotice(refund_policy); const { notice } = genRefundNotice(refund_policy);
return ( return (
@@ -107,7 +105,7 @@ export type RefundRef = {
export default forwardRef<RefundRef>(function RefundPopup(_props, ref) { export default forwardRef<RefundRef>(function RefundPopup(_props, ref) {
const [visible, setVisible] = useState(false); const [visible, setVisible] = useState(false);
const [checkOrderInfo, setCheckOrderInfo] = useState({}); const [refundPolicy, setRefundPolicy] = useState([]);
const [orderData, setOrderData] = useState({}); const [orderData, setOrderData] = useState({});
const onDown = useRef<((result: boolean) => void) | null>(null); const onDown = useRef<((result: boolean) => void) | null>(null);
@@ -116,11 +114,10 @@ export default forwardRef<RefundRef>(function RefundPopup(_props, ref) {
})); }));
async function onShow(orderItem, onFinish: (result: boolean) => void) { async function onShow(orderItem, onFinish: (result: boolean) => void) {
const { game_info } = orderItem; const { refund_policy } = orderItem;
onDown.current = onFinish; onDown.current = onFinish;
setOrderData(orderItem); setOrderData(orderItem);
const res = await orderService.getCheckOrderInfo(game_info.id); setRefundPolicy(refund_policy);
setCheckOrderInfo(res.data);
setVisible(true); setVisible(true);
} }
@@ -172,7 +169,7 @@ export default forwardRef<RefundRef>(function RefundPopup(_props, ref) {
onClick={onClose} onClick={onClose}
/> />
</View> </View>
{renderCancelContent(checkOrderInfo)} {renderCancelContent(refundPolicy)}
<Button className={styles.action} onClick={handleConfirmQuit}> <Button className={styles.action} onClick={handleConfirmQuit}>
退 退
</Button> </Button>

View File

@@ -73,6 +73,7 @@ export default function Participants(props) {
}>({ show: () => {} }); }>({ show: () => {} });
const userInfo = useUserInfo(); const userInfo = useUserInfo();
const participants = detail.participants || []; const participants = detail.participants || [];
const substitute_members = detail.substitute_members || [];
// const participants = Array(10) // const participants = Array(10)
// .fill(0) // .fill(0)
// .map((_, index) => ({ // .map((_, index) => ({
@@ -92,6 +93,8 @@ export default function Participants(props) {
const { const {
participant_count, participant_count,
max_participants, max_participants,
substitute_count,
max_substitute_players,
user_action_status = {}, user_action_status = {},
start_time, start_time,
price, price,
@@ -293,6 +296,13 @@ export default function Participants(props) {
const { action = () => {} } = generateTextAndAction(user_action_status)!; const { action = () => {} } = generateTextAndAction(user_action_status)!;
const leftCount = max_participants - participant_count; const leftCount = max_participants - participant_count;
const leftSubstituteCount = (max_substitute_players || 0) - (substitute_count || 0);
const showSubstituteApplicationEntry =
[can_pay, can_join, is_substituting, waiting_start].every(
(item) => !item
) &&
can_substitute &&
dayjs(start_time).isAfter(dayjs());
return ( return (
<> <>
@@ -389,6 +399,98 @@ export default function Participants(props) {
"" ""
)} )}
</View> </View>
{/* 候补区域 */}
{max_substitute_players > 0 && (substitute_count > 0 || showSubstituteApplicationEntry) && (
<View className={styles["detail-page-content-participants"]}>
<View className={styles["participants-title"]}>
<Text></Text>
<Text>·</Text>
<Text>{leftSubstituteCount > 0 ? `剩余空位 ${leftSubstituteCount}` : "已满员"}</Text>
</View>
<View className={styles["participants-list"]}>
{/* 候补申请入口 */}
{showSubstituteApplicationEntry && (
<View
className={styles["participants-list-application"]}
onClick={() => {
action?.();
}}
>
<Image
className={styles["participants-list-application-icon"]}
src={img.ICON_DETAIL_APPLICATION_ADD}
/>
<Text className={styles["participants-list-application-text"]}>
</Text>
</View>
)}
{/* 候补成员列表 */}
<ScrollView
refresherBackground="#FAFAFA"
className={classnames(
styles["participants-list-scroll"],
showSubstituteApplicationEntry ? styles.withApplication : ""
)}
scrollX
>
<View
className={styles["participants-list-scroll-content"]}
style={{
width: `${
Math.max(substitute_members.length, 1) * 103 + (Math.max(substitute_members.length, 1) - 1) * 8
}px`,
}}
>
{substitute_members.map((substitute) => {
const {
is_organizer,
user: {
avatar_url,
nickname,
level,
ntrp_level,
id: substitute_user_id,
},
} = substitute;
const role = is_organizer ? "组织者" : "参与者";
// 优先使用 ntrp_level如果没有则使用 level
const ntrpValue = ntrp_level || level;
// 格式化显示 NTRP如果没有值则显示"初学者"
const displayNtrp = ntrpValue
? formatNtrpDisplay(ntrpValue)
: "初学者";
return (
<View
key={substitute.id}
className={styles["participants-list-item"]}
>
<Image
className={styles["participants-list-item-avatar"]}
mode="aspectFill"
src={avatar_url}
onClick={handleViewUserInfo.bind(
null,
substitute_user_id
)}
/>
<Text className={styles["participants-list-item-name"]}>
{nickname || "未知"}
</Text>
<Text className={styles["participants-list-item-level"]}>
{displayNtrp}
</Text>
<Text className={styles["participants-list-item-role"]}>
{role}
</Text>
</View>
);
})}
</View>
</ScrollView>
</View>
</View>
)}
<NTRPEvaluatePopup type={EvaluateScene.detail} ref={ntrpRef} showGuide /> <NTRPEvaluatePopup type={EvaluateScene.detail} ref={ntrpRef} showGuide />
</> </>
); );

View File

@@ -79,7 +79,8 @@ function Index() {
}); });
// 位置更新后,重新获取详情页数据(因为距离等信息可能发生变化) // 位置更新后,重新获取详情页数据(因为距离等信息可能发生变化)
await fetchDetail(); // 注意:这里不调用 fetchDetail避免与 useDidShow 中的调用重复
// 如果需要更新距离信息,可以在 fetchDetail 成功后根据当前位置重新计算
if (from === "publish") { if (from === "publish") {
handleShare(true); handleShare(true);
} }

View File

@@ -129,15 +129,37 @@ const ListPageContent: React.FC<ListPageContentProps> = ({
// ScrollView 滚动处理 // ScrollView 滚动处理
const handleScrollViewScroll = useCallback( const handleScrollViewScroll = useCallback(
(e: any) => { (e: any) => {
const currentScrollTop = e?.detail?.scrollTop || 0; const currentScrollTop = e?.detail?.scrollTop || 0;
const scrollHeight = e?.detail?.scrollHeight || 0;
const clientHeight = e?.detail?.clientHeight || 0;
const lastScrollTop = lastScrollTopRef.current; const lastScrollTop = lastScrollTopRef.current;
const currentTime = Date.now(); const currentTime = Date.now();
const timeDiff = currentTime - lastScrollTimeRef.current; const timeDiff = currentTime - lastScrollTimeRef.current;
if (timeDiff < 100) return; if (timeDiff < 100) return;
// 计算距离底部的距离提前加载距离底部600px时开始加载
// 注意:如果 scrollHeight 或 clientHeight 不可用,则使用 lowerThreshold 触发
if (scrollHeight > 0 && clientHeight > 0) {
const distanceToBottom = scrollHeight - currentScrollTop - clientHeight;
const preloadThreshold = 600; // 提前加载阈值
// 如果距离底部小于阈值,且正在向下滚动,且有更多数据,则提前加载
if (
distanceToBottom < preloadThreshold &&
distanceToBottom > 0 &&
!loading &&
!loadingMoreRef.current &&
listPageState?.isHasMoreData &&
currentScrollTop > lastScrollTop // 向下滚动
) {
loadingMoreRef.current = true;
loadMoreMatches().finally(() => {
loadingMoreRef.current = false;
});
}
}
const scrollDiff = currentScrollTop - lastScrollTop; const scrollDiff = currentScrollTop - lastScrollTop;
let newDirection = scrollDirectionRef.current; let newDirection = scrollDirectionRef.current;
if (Math.abs(scrollDiff) > 15) { if (Math.abs(scrollDiff) > 15) {
@@ -195,7 +217,7 @@ const ListPageContent: React.FC<ListPageContentProps> = ({
lastScrollTopRef.current = currentScrollTop; lastScrollTopRef.current = currentScrollTop;
lastScrollTimeRef.current = currentTime; lastScrollTimeRef.current = currentTime;
}, },
[updateListPageState, onNavStateChange] [updateListPageState, onNavStateChange, loading, loadMoreMatches, listPageState?.isHasMoreData]
// 移除 showSearchBar 和 isShowInputCustomerNavBar 依赖,使用 ref 获取最新值 // 移除 showSearchBar 和 isShowInputCustomerNavBar 依赖,使用 ref 获取最新值
); );
@@ -214,6 +236,38 @@ const ListPageContent: React.FC<ListPageContentProps> = ({
} }
}, [isActive]); }, [isActive]);
// 记录上一次的城市,用于检测城市变化
const prevAreaRef = useRef<[string, string] | null>(null);
// 监听城市变化,重新获取行政区列表并清空已选择的行政区
useEffect(() => {
if (area && area.length >= 2) {
const currentProvince = area[1];
const prevProvince = prevAreaRef.current?.[1];
// 只有当城市真正改变时才执行(避免初始化时也触发)
if (prevProvince && prevProvince !== currentProvince) {
console.log("城市改变,重新获取行政区列表:", {
prevProvince,
currentProvince,
});
// 城市改变时,重新获取行政区列表
getDistricts();
// 清空已选择的行政区,避免显示错误的行政区
const currentState = useListStore.getState();
const currentPageState = currentState.isSearchResult
? currentState.searchPageState
: currentState.listPageState;
if (currentPageState?.distanceQuickFilter?.district) {
updateDistanceQuickFilter({ district: undefined });
}
}
// 更新记录的城市
prevAreaRef.current = area as [string, string];
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [area?.[1]]); // 只监听省份area[1])的变化
// 当页面从非激活状态切换为激活状态时,检查城市是否变化,如果变化则重新加载数据 // 当页面从非激活状态切换为激活状态时,检查城市是否变化,如果变化则重新加载数据
useEffect(() => { useEffect(() => {
// 如果从非激活状态变为激活状态(切回列表页) // 如果从非激活状态变为激活状态(切回列表页)
@@ -518,7 +572,7 @@ const ListPageContent: React.FC<ListPageContentProps> = ({
refresherEnabled={true} refresherEnabled={true}
refresherTriggered={refreshing} refresherTriggered={refreshing}
onRefresherRefresh={handleRefresh} onRefresherRefresh={handleRefresh}
lowerThreshold={100} lowerThreshold={600}
onScrollToLower={async () => { onScrollToLower={async () => {
if ( if (
!loading && !loading &&

View File

@@ -380,8 +380,13 @@ function OrderMsg(props) {
wechat_contact, wechat_contact,
price, price,
} = detail; } = detail;
const { order_no } = orderDetail; const { order_no, registrant_phone: registrant_phone_from_order } =
const { order_info: { registrant_phone } = {} } = checkOrderInfo; orderDetail;
const {
order_info: { registrant_phone: registrant_phone_from_check_order } = {},
} = checkOrderInfo || {};
const registrant_phone =
registrant_phone_from_order || registrant_phone_from_check_order;
const startTime = dayjs(start_time); const startTime = dayjs(start_time);
const endTime = dayjs(end_time); const endTime = dayjs(end_time);
const startDate = startTime.format("YYYY年M月D日"); const startDate = startTime.format("YYYY年M月D日");
@@ -402,13 +407,11 @@ function OrderMsg(props) {
}, },
{ {
title: "报名人电话", title: "报名人电话",
// content: registrant_phone,
content: registrant_phone ? ( content: registrant_phone ? (
<Text <Text
selectable={true} // 支持长按复制 selectable={true} // 支持长按复制
style={{ style={{
color: "#007AFF", color: "#007AFF",
// textDecoration: "underline",
cursor: "pointer", cursor: "pointer",
}} }}
onClick={() => { onClick={() => {
@@ -427,7 +430,6 @@ function OrderMsg(props) {
}, },
{ {
title: "组织人电话", title: "组织人电话",
// content: wechat_contact,
content: content:
wechat_contact && isPhoneNumber(wechat_contact) ? ( wechat_contact && isPhoneNumber(wechat_contact) ? (
<Text <Text
@@ -489,8 +491,7 @@ function OrderMsg(props) {
} }
function RefundPolicy(props) { function RefundPolicy(props) {
const { checkOrderInfo } = props; const { refund_policy = [] } = props;
const { refund_policy = [] } = checkOrderInfo;
const current = dayjs(); const current = dayjs();
const policyList = [ const policyList = [
{ {
@@ -563,7 +564,7 @@ const OrderCheck = () => {
const [id, gameId] = [Number(stringId), Number(stringGameId)]; const [id, gameId] = [Number(stringId), Number(stringGameId)];
const [detail, setDetail] = useState<GameData | {}>({}); const [detail, setDetail] = useState<GameData | {}>({});
const [location, setLocation] = useState<number[]>([0, 0]); const [location, setLocation] = useState<number[]>([0, 0]);
const [checkOrderInfo, setCheckOrderInfo] = useState<GameOrderRes | {}>({}); const [checkOrderInfo, setCheckOrderInfo] = useState<GameOrderRes>();
const [orderDetail, setOrderDetail] = useState({}); const [orderDetail, setOrderDetail] = useState({});
const { paying, setPaying } = useOrder(); const { paying, setPaying } = useOrder();
@@ -584,11 +585,11 @@ const OrderCheck = () => {
if (res.code === 0) { if (res.code === 0) {
gameDetail = res.data; gameDetail = res.data;
} }
checkOrder(gameId);
} }
if (gameDetail.id) { setDetail(gameDetail);
setDetail(gameDetail); const location = await getCurrentLocation();
onInit(gameDetail.id); setLocation([location.latitude, location.longitude]);
}
} }
async function checkOrder(gid) { async function checkOrder(gid) {
@@ -596,12 +597,6 @@ const OrderCheck = () => {
setCheckOrderInfo(orderRes.data); setCheckOrderInfo(orderRes.data);
} }
async function onInit(gid) {
checkOrder(gid);
const location = await getCurrentLocation();
setLocation([location.latitude, location.longitude]);
}
async function getPaymentParams() { async function getPaymentParams() {
// 检查登录状态和手机号(创建订单前检查) // 检查登录状态和手机号(创建订单前检查)
if (!requireLoginWithPhone()) { if (!requireLoginWithPhone()) {
@@ -626,10 +621,6 @@ const OrderCheck = () => {
return; // 未登录或未绑定手机号,已跳转到登录页 return; // 未登录或未绑定手机号,已跳转到登录页
} }
setPaying(true); setPaying(true);
Taro.showLoading({
title: "支付中...",
mask: true,
});
let payment_params = {}; let payment_params = {};
try { try {
@@ -641,7 +632,6 @@ const OrderCheck = () => {
}); });
} }
await payOrder(payment_params); await payOrder(payment_params);
Taro.hideLoading();
Taro.showToast({ Taro.showToast({
title: "支付成功", title: "支付成功",
icon: "success", icon: "success",
@@ -655,7 +645,6 @@ const OrderCheck = () => {
// delta: 1, // delta: 1,
// }); // });
} catch (error) { } catch (error) {
Taro.hideLoading();
Taro.showToast({ Taro.showToast({
title: error.message, title: error.message,
icon: "none", icon: "none",
@@ -712,22 +701,27 @@ const OrderCheck = () => {
checkOrderInfo={checkOrderInfo} checkOrderInfo={checkOrderInfo}
/> />
{/* Refund policy */} {/* Refund policy */}
<RefundPolicy checkOrderInfo={checkOrderInfo} /> <RefundPolicy
refund_policy={
checkOrderInfo?.refund_policy || orderDetail?.refund_policy || []
}
/>
{/* Disclaimer */} {/* Disclaimer */}
<Disclaimer /> <Disclaimer />
{(!id || {(!id ||
(order_status === OrderStatus.PENDING && (order_status === OrderStatus.PENDING &&
cancel_type === CancelType.NONE)) && cancel_type === CancelType.NONE)) && (
!paying && ( <Button
<Button className={styles.payButton}
className={styles.payButton} disabled={paying}
disabled={paying} onClick={handlePay}
onClick={handlePay} loading={paying}
> >
{order_status === OrderStatus.PENDING ? "继续" : "确认"} {paying
? "支付中..."
</Button> : `${order_status === OrderStatus.PENDING ? "继续" : "确认"}支付`}
)} </Button>
)}
</View> </View>
); );
}; };

View File

@@ -16,7 +16,7 @@
justify-content: flex-start; justify-content: flex-start;
padding: 0; padding: 0;
position: relative; position: relative;
height: calc(100vh - 98px); height: calc(100vh);
} }
// 空状态图片 // 空状态图片
@@ -56,13 +56,13 @@
// 按钮区域 // 按钮区域
&__buttons { &__buttons {
position: absolute; position: absolute;
bottom: 110px; bottom: 48px;
left: 0; left: 0;
right: 0; right: 0;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
gap: 10px; gap: 10px;
padding: 0 20px; padding: 8px 20px;
z-index: 1; z-index: 1;
align-items: center; align-items: center;
} }
@@ -72,7 +72,7 @@
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
width: 251px; width: 100%;
height: 52px; height: 52px;
border-radius: 16px; border-radius: 16px;
box-shadow: 0px 8px 64px 0px rgba(0, 0, 0, 0.1), box-shadow: 0px 8px 64px 0px rgba(0, 0, 0, 0.1),
@@ -87,13 +87,12 @@
// 按钮文字样式 // 按钮文字样式
&_text { &_text {
font-family: 'DingTalk JinBuTi';
font-weight: 400; font-family: 'PingFang SC';
font-size: 18px; font-style: normal;
line-height: 1.11; font-weight: 600;
letter-spacing: -0.05em; font-size: 16px;
text-align: center; line-height: 22px;
color: #000000;
} }
// 主要按钮(去看看其他球局) // 主要按钮(去看看其他球局)
@@ -101,6 +100,8 @@
background: #000000; background: #000000;
border: 2px solid rgba(0, 0, 0, 0.06); border: 2px solid rgba(0, 0, 0, 0.06);
.empty_state_page__button_text { .empty_state_page__button_text {
color: #ffffff; // 黑色背景下使用白色文字 color: #ffffff; // 黑色背景下使用白色文字
} }

View File

@@ -12,13 +12,12 @@ import './index.scss';
function Index() { function Index() {
const { statusNavbarHeightInfo } = useGlobalState() || {}; const { statusNavbarHeightInfo } = useGlobalState() || {};
const { totalHeight = 98 } = statusNavbarHeightInfo || {};
const [countdown, setCountdown] = useState(5); const [countdown, setCountdown] = useState(5);
// 倒计时自动返回 // 倒计时自动返回
useEffect(() => { useEffect(() => {
if (countdown <= 0) { if (countdown <= 0) {
handle_go_to_home(); handle_go_to_home();
return; return;
} }

View File

@@ -170,7 +170,8 @@ function Intro() {
const { setCallback } = useEvaluate(); const { setCallback } = useEvaluate();
const { last_test_result = null } = ntrpData || {}; const { last_test_result = null } = ntrpData || {};
const { ntrp_level, create_time, id } = last_test_result || {}; const { ntrp_level, create_time, id, level_description } =
last_test_result || {};
const lastTestTime = create_time const lastTestTime = create_time
? dayjs(create_time).format("YYYY年M月D日") ? dayjs(create_time).format("YYYY年M月D日")
: ""; : "";
@@ -266,7 +267,7 @@ function Intro() {
</Text> </Text>
</View> </View>
<View className={styles.slogan}> <View className={styles.slogan}>
<Text>线+</Text> <Text>{level_description}</Text>
</View> </View>
</View> </View>
<View className={styles.actions}> <View className={styles.actions}>
@@ -667,7 +668,7 @@ function Result() {
} }
useShareAppMessage(async (res) => { useShareAppMessage(async (res) => {
console.log( "res",result); console.log("res", result);
return { return {
title: "来测一测你的NTRP等级吧", title: "来测一测你的NTRP等级吧",
imageUrl: result?.level_img || undefined, imageUrl: result?.level_img || undefined,

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

@@ -1,4 +1,5 @@
import { create } from "zustand"; import { create } from "zustand";
import Taro from "@tarojs/taro";
import { import {
fetchUserProfile, fetchUserProfile,
updateUserProfile, updateUserProfile,
@@ -15,7 +16,7 @@ export interface UserState {
fetchUserInfo: () => Promise<UserInfoType | undefined>; fetchUserInfo: () => Promise<UserInfoType | undefined>;
updateUserInfo: (userInfo: Partial<UserInfoType>) => void; updateUserInfo: (userInfo: Partial<UserInfoType>) => void;
nicknameChangeStatus: Partial<NicknameChangeStatus>; nicknameChangeStatus: Partial<NicknameChangeStatus>;
checkNicknameChangeStatus: () => void; checkNicknameChangeStatus: (force?: boolean) => void;
updateNickname: (nickname: string) => void; updateNickname: (nickname: string) => void;
// NTRP 测试结果缓存 // NTRP 测试结果缓存
lastTestResult: LastTimeTestResult | null; lastTestResult: LastTimeTestResult | null;
@@ -32,6 +33,10 @@ const getTimeNextDate = (time: string) => {
return `${year}-${month}-${day}`; return `${year}-${month}-${day}`;
}; };
// 请求锁,避免重复调用
let isFetchingLastTestResult = false;
let isCheckingNicknameStatus = false;
export const useUser = create<UserState>()((set) => ({ export const useUser = create<UserState>()((set) => ({
user: {}, user: {},
fetchUserInfo: async () => { fetchUserInfo: async () => {
@@ -40,14 +45,31 @@ export const useUser = create<UserState>()((set) => ({
const userData = res.data; const userData = res.data;
set({ user: userData }); set({ user: userData });
// 当 userLastLocationProvince 更新时,同步更新 area // 优先使用缓存中的城市,不使用用户信息中的位置
// 检查是否有缓存的城市
const CITY_CACHE_KEY = "USER_SELECTED_CITY";
const cachedCity = (Taro as any).getStorageSync?.(CITY_CACHE_KEY);
if (cachedCity && Array.isArray(cachedCity) && cachedCity.length === 2) {
// 如果有缓存的城市,使用缓存,不更新 area
console.log("[userStore] 检测到缓存的城市,使用缓存,不更新 area");
return userData;
}
// 只有当没有缓存时,才使用用户信息中的位置
if (userData?.last_location_province) { if (userData?.last_location_province) {
const listStore = useListStore.getState(); const listStore = useListStore.getState();
const currentArea = listStore.area; const currentArea = listStore.area;
// 只有当 area 不存在或与 userLastLocationProvince 不一致时才更新 // 只有当 area 不存在时才使用用户信息中的位置
if (!currentArea || currentArea[1] !== userData.last_location_province) { if (!currentArea) {
const newArea: [string, string] = ["中国", userData.last_location_province]; const newArea: [string, string] = ["中国", userData.last_location_province];
listStore.updateArea(newArea); listStore.updateArea(newArea);
// 保存到缓存
try {
(Taro as any).setStorageSync?.(CITY_CACHE_KEY, newArea);
} catch (error) {
console.error("保存城市缓存失败:", error);
}
} }
} }
@@ -87,8 +109,20 @@ export const useUser = create<UserState>()((set) => ({
} }
}, },
nicknameChangeStatus: {}, nicknameChangeStatus: {},
checkNicknameChangeStatus: async () => { checkNicknameChangeStatus: async (force = false) => {
// 如果正在请求中,直接返回,避免重复调用
if (isCheckingNicknameStatus) {
return;
}
// 如果已经有状态数据且不是强制更新,跳过,避免重复调用
if (!force) {
const currentState = useUser.getState();
if (currentState.nicknameChangeStatus && Object.keys(currentState.nicknameChangeStatus).length > 0) {
return;
}
}
try { try {
isCheckingNicknameStatus = true;
const res = await checkNicknameChangeStatusApi(); const res = await checkNicknameChangeStatusApi();
const { next_period_start_time } = res.data; const { next_period_start_time } = res.data;
set({ set({
@@ -99,12 +133,15 @@ export const useUser = create<UserState>()((set) => ({
}); });
} catch (error) { } catch (error) {
console.error("检查昵称变更状态失败:", error); console.error("检查昵称变更状态失败:", error);
} finally {
isCheckingNicknameStatus = false;
} }
}, },
updateNickname: async (nickname) => { updateNickname: async (nickname) => {
try { try {
await updateNicknameApi(nickname); await updateNicknameApi(nickname);
await useUser.getState().checkNicknameChangeStatus(); // 更新昵称后强制更新状态
await useUser.getState().checkNicknameChangeStatus(true);
set((state) => ({ set((state) => ({
user: { ...state.user, nickname }, user: { ...state.user, nickname },
})); }));
@@ -115,7 +152,27 @@ export const useUser = create<UserState>()((set) => ({
// NTRP 测试结果缓存 // NTRP 测试结果缓存
lastTestResult: null, lastTestResult: null,
fetchLastTestResult: async () => { fetchLastTestResult: async () => {
// 如果已经有缓存数据,直接返回,避免重复调用
const currentState = useUser.getState();
if (currentState.lastTestResult) {
return currentState.lastTestResult;
}
// 如果正在请求中,等待请求完成,避免重复调用
if (isFetchingLastTestResult) {
// 等待请求完成,最多等待 3 秒
let waitCount = 0;
while (isFetchingLastTestResult && waitCount < 30) {
await new Promise((resolve) => setTimeout(resolve, 100));
waitCount++;
const state = useUser.getState();
if (state.lastTestResult) {
return state.lastTestResult;
}
}
return null;
}
try { try {
isFetchingLastTestResult = true;
const res = await evaluateService.getLastResult(); const res = await evaluateService.getLastResult();
if (res.code === 0) { if (res.code === 0) {
set({ lastTestResult: res.data }); set({ lastTestResult: res.data });
@@ -125,6 +182,8 @@ export const useUser = create<UserState>()((set) => ({
} catch (error) { } catch (error) {
console.error("获取NTRP测试结果失败:", error); console.error("获取NTRP测试结果失败:", error);
return null; return null;
} finally {
isFetchingLastTestResult = false;
} }
}, },
})); }));

View File

@@ -6,18 +6,28 @@ export function getOrderStatus(orderData) {
if (!order_no) { if (!order_no) {
return 'none' return 'none'
} }
const { start_time } = game_info const { start_time } = game_info || {}
if (!start_time) { console.log('活动开始时间未找到, start_time: ', start_time); }
const unPay = order_status === OrderStatus.PENDING && ([CancelType.NONE].includes(cancel_type)); const unPay = order_status === OrderStatus.PENDING && ([CancelType.NONE].includes(cancel_type));
const refund = [RefundStatus.SUCCESS].includes(refund_status); const refund = [RefundStatus.SUCCESS].includes(refund_status);
const refunding = [RefundStatus.PENDING].includes(refund_status); const refunding = [RefundStatus.PENDING].includes(refund_status);
const expired = const expired =
order_status === OrderStatus.FINISHED; order_status === OrderStatus.FINISHED;
const frozen = dayjs().add(2, 'h').isAfter(dayjs(start_time)) const frozen = dayjs().isAfter(dayjs(start_time))
const canceled = [CancelType.TIMEOUT, CancelType.USER].includes(cancel_type); const canceled = [CancelType.TIMEOUT, CancelType.USER].includes(cancel_type);
return unPay ? 'unpay' : refund ? 'refund' : canceled ? 'canceled' : expired ? 'expired' : refunding ? 'refunding' : frozen ? 'start' : 'progress' // return unPay ? 'unpay' : refund ? 'refund' : canceled ? 'canceled' : expired ? 'expired' : refunding ? 'refunding' : is_substitute_order ? 'progress' : frozen ? 'start' : 'progress'
if (unPay) return 'unpay';
if (refund) return 'refund';
if (canceled) return 'canceled';
if (expired) return 'expired';
if (refunding) return 'refunding';
if (frozen) return 'start';
// if (is_substitute_order) return 'progress';
return 'progress';
} }
// scene: list、detail // scene: list、detail