fix: unify game time formatting and game length display in share poster

This commit is contained in:
2026-04-06 22:16:44 +08:00
parent 8c6fb1190e
commit 56fb3ade00
3 changed files with 25 additions and 8 deletions

View File

@@ -14,7 +14,11 @@ 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 "@/utils/helper";
import {
genNTRPRequirementText,
genGameLength,
formatGameStartTime,
} from "@/utils/helper";
import { waitForAuthInit } from "@/utils/authInit";
import { OSS_BASE } from "@/config/api";
import styles from "./index.module.scss";
@@ -53,7 +57,7 @@ function SharePoster(props) {
const startTime = dayjs(start_time);
const endTime = dayjs(end_time);
const dayofWeek = DayOfWeekMap.get(startTime.day());
const gameLength = `${endTime.diff(startTime, "hour")}小时`;
const gameLength = genGameLength(startTime, endTime);
Taro.showLoading({ title: "生成中..." });
const qrCodeUrlRes = await DetailService.getQrCodeUrl({
page: "game_pages/detail/index",
@@ -77,7 +81,7 @@ function SharePoster(props) {
title,
locationName: location_name,
date: `${startTime.format("M月D日")} (${dayofWeek})`,
time: `${startTime.format("ah")} ${gameLength}`,
time: `${formatGameStartTime(startTime)} ${gameLength}`,
qrCodeUrl,
});
Taro.hideLoading();