2 Commits

5 changed files with 60 additions and 30 deletions

View File

@@ -177,23 +177,32 @@
} }
&-title { &-title {
display: flex; display: flex;
align-items: center; align-items: center;
height: 24px; height: 24px;
gap: 2px; gap: 2px;
overflow: hidden; overflow: hidden;
color: rgba(255, 255, 255, 0.85); color: rgba(255, 255, 255, 0.85);
text-overflow: ellipsis; text-overflow: ellipsis;
font-size: 16px; font-size: 16px;
font-style: normal; font-style: normal;
font-weight: 600; font-weight: 600;
line-height: 24px; /* 150% */ line-height: 24px; /* 150% */
&-arrow { &-text {
width: 12px; flex: 1;
height: 12px; min-width: 0;
} overflow: hidden;
} text-overflow: ellipsis;
white-space: nowrap;
}
&-arrow {
flex: 0 0 12px;
width: 12px;
height: 12px;
}
}
&-time-range { &-time-range {
overflow: hidden; overflow: hidden;

View File

@@ -86,12 +86,12 @@ export default function OrganizerInfo(props) {
await LoginService.followUser(id); await LoginService.followUser(id);
} }
onUpdateUserInfo(); onUpdateUserInfo();
Taro.showToast({ (Taro as any).showToast({
title: `${nickname} ${follow ? "已取消关注" : "已关注"}`, title: `${nickname} ${follow ? "已取消关注" : "已关注"}`,
icon: "success", icon: "success",
}); });
} catch (e) { } catch (e) {
Taro.showToast({ (Taro as any).showToast({
title: `${nickname} ${follow ? "取消关注失败" : "关注失败"}`, title: `${nickname} ${follow ? "取消关注失败" : "关注失败"}`,
icon: "error", icon: "error",
}); });
@@ -193,13 +193,17 @@ export default function OrganizerInfo(props) {
className={styles["recommend-games-list-item"]} className={styles["recommend-games-list-item"]}
onClick={handleViewGame.bind(null, game.id)} onClick={handleViewGame.bind(null, game.id)}
> >
{/* game title */} {/* game title */}
<View className={styles["recommend-games-list-item-title"]}> <View className={styles["recommend-games-list-item-title"]}>
<Text>{game.title}</Text> <Text
<Image className={styles["recommend-games-list-item-title-text"]}
className={ >
styles["recommend-games-list-item-title-arrow"] {game.title}
} </Text>
<Image
className={
styles["recommend-games-list-item-title-arrow"]
}
src={img.ICON_DETAIL_ARROW_RIGHT} src={img.ICON_DETAIL_ARROW_RIGHT}
/> />
</View> </View>

View File

@@ -12,7 +12,12 @@ import WechatLogo from "@/static/detail/wechat_icon.svg";
// import WechatTimeline from "@/static/detail/wechat_timeline.svg"; // import WechatTimeline from "@/static/detail/wechat_timeline.svg";
import LinkIcon from "@/static/detail/link.svg"; import LinkIcon from "@/static/detail/link.svg";
import CrossIcon from "@/static/detail/cross.svg"; import CrossIcon from "@/static/detail/cross.svg";
import { genNTRPRequirementText, navto, genGameLength } from "@/utils/helper"; import {
genNTRPRequirementText,
navto,
genGameLength,
formatGameStartTime,
} from "@/utils/helper";
import { waitForAuthInit } from "@/utils/authInit"; import { waitForAuthInit } from "@/utils/authInit";
import { useUserActions } from "@/store/userStore"; import { useUserActions } from "@/store/userStore";
import { OSS_BASE } from "@/config/api"; import { OSS_BASE } from "@/config/api";
@@ -107,7 +112,7 @@ export default forwardRef(({ id, from, detail, userInfo }, ref) => {
const startTime = dayjs(start_time); const startTime = dayjs(start_time);
const endTime = dayjs(end_time); const endTime = dayjs(end_time);
const dayofWeek = DayOfWeekMap.get(startTime.day()); const dayofWeek = DayOfWeekMap.get(startTime.day());
const gameLength = `${endTime.diff(startTime, "hour")}小时`; const gameLength = genGameLength(startTime, endTime);
const currentUserInfo = await ensureUserInfo(); const currentUserInfo = await ensureUserInfo();
try { try {
const url = await generateShareImage({ const url = await generateShareImage({
@@ -119,7 +124,7 @@ export default forwardRef(({ id, from, detail, userInfo }, ref) => {
skill_level_max, skill_level_max,
)}`, )}`,
gameDate: `${startTime.format("M月D日")} (${dayofWeek})`, gameDate: `${startTime.format("M月D日")} (${dayofWeek})`,
gameTime: `${startTime.format("ah")} ${gameLength}`, gameTime: `${formatGameStartTime(startTime)} ${gameLength}`,
venueName: location_name, venueName: location_name,
venueImages: image_list ? image_list : [], venueImages: image_list ? image_list : [],
}); });
@@ -164,7 +169,6 @@ export default forwardRef(({ id, from, detail, userInfo }, ref) => {
const startTime = dayjs(start_time); const startTime = dayjs(start_time);
const endTime = dayjs(end_time); const endTime = dayjs(end_time);
const dayofWeek = DayOfWeekMap.get(startTime.day()); const dayofWeek = DayOfWeekMap.get(startTime.day());
// const gameLength = `${endTime.diff(startTime, "hour")}小时`;
const game_length = genGameLength(startTime, endTime); const game_length = genGameLength(startTime, endTime);
let qrCodeUrl = ""; let qrCodeUrl = "";
try { try {
@@ -193,7 +197,7 @@ export default forwardRef(({ id, from, detail, userInfo }, ref) => {
title, title,
locationName: location_name, locationName: location_name,
date: `${startTime.format("M月D日")} (${dayofWeek})`, date: `${startTime.format("M月D日")} (${dayofWeek})`,
time: `${startTime.format("ah")} ${game_length}`, time: `${formatGameStartTime(startTime)} ${game_length}`,
qrCodeUrl, qrCodeUrl,
}); });
} catch (e) { } catch (e) {

View File

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

View File

@@ -164,3 +164,12 @@ export function genGameLength(startTime: Dayjs, endTime: Dayjs) {
// 保留一位小数去除末尾的0 // 保留一位小数去除末尾的0
return `${parseFloat(totalHours.toFixed(1))}小时`; return `${parseFloat(totalHours.toFixed(1))}小时`;
} }
export function formatGameStartTime(startTime: Dayjs) {
if (!startTime || !startTime.isValid()) {
return "";
}
const hour = startTime.hour();
const minute = startTime.minute();
return minute === 0 ? `${hour}` : `${hour}${minute}`;
}