Merge branch 'feat/liujie'
This commit is contained in:
@@ -22,6 +22,7 @@ export default function Carousel(props) {
|
|||||||
const current_aspect_ratio = max_width / max_height;
|
const current_aspect_ratio = max_width / max_height;
|
||||||
let container_width = 0;
|
let container_width = 0;
|
||||||
for (const imageUrl of imageList) {
|
for (const imageUrl of imageList) {
|
||||||
|
try {
|
||||||
const { width, height } = await Taro.getImageInfo({ src: imageUrl });
|
const { width, height } = await Taro.getImageInfo({ src: imageUrl });
|
||||||
if (width && height) {
|
if (width && height) {
|
||||||
const aspect_ratio = width / height;
|
const aspect_ratio = width / height;
|
||||||
@@ -40,6 +41,9 @@ export default function Carousel(props) {
|
|||||||
height: latest_w_h.height,
|
height: latest_w_h.height,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.log(error);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
setList(latest_list);
|
setList(latest_list);
|
||||||
setListWidth(container_width);
|
setListWidth(container_width);
|
||||||
|
|||||||
@@ -8,10 +8,12 @@
|
|||||||
// gap: 12px;
|
// gap: 12px;
|
||||||
|
|
||||||
&-calendar-date {
|
&-calendar-date {
|
||||||
width: 60%;
|
width: auto;
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
gap: 16px;
|
gap: 16px;
|
||||||
|
flex: 1;
|
||||||
|
min-width: 0;
|
||||||
|
|
||||||
&-calendar {
|
&-calendar {
|
||||||
display: flex;
|
display: flex;
|
||||||
@@ -27,6 +29,7 @@
|
|||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
color: #fff;
|
color: #fff;
|
||||||
background: #536272;
|
background: #536272;
|
||||||
|
flex-shrink: 0;
|
||||||
|
|
||||||
.month {
|
.month {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
@@ -57,12 +60,15 @@
|
|||||||
|
|
||||||
&-date {
|
&-date {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
width: auto;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
align-items: flex-start;
|
align-items: flex-start;
|
||||||
justify-content: space-evenly;
|
justify-content: space-evenly;
|
||||||
gap: 4px;
|
gap: 4px;
|
||||||
align-self: stretch;
|
align-self: stretch;
|
||||||
color: #fff;
|
color: #fff;
|
||||||
|
flex: 1;
|
||||||
|
min-width: 0;
|
||||||
|
|
||||||
.date {
|
.date {
|
||||||
color: #fff;
|
color: #fff;
|
||||||
@@ -82,6 +88,12 @@
|
|||||||
font-style: normal;
|
font-style: normal;
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
line-height: 20px; /* 166.667% */
|
line-height: 20px; /* 166.667% */
|
||||||
|
width: 100%;
|
||||||
|
flex: 1;
|
||||||
|
min-width: 0;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
overflow: hidden;
|
||||||
|
white-space: nowrap;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -90,7 +102,9 @@
|
|||||||
display: flex;
|
display: flex;
|
||||||
align-items: flex-end;
|
align-items: flex-end;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
|
width: 80px;
|
||||||
gap: 4px;
|
gap: 4px;
|
||||||
|
flex-shrink: 0;
|
||||||
|
|
||||||
&-icon {
|
&-icon {
|
||||||
width: 20px;
|
width: 20px;
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import Taro from "@tarojs/taro";
|
import Taro from "@tarojs/taro";
|
||||||
import dayjs from "dayjs";
|
import dayjs, { Dayjs } from "dayjs";
|
||||||
import "dayjs/locale/zh-cn";
|
import "dayjs/locale/zh-cn";
|
||||||
import { calculateDistance } from "@/utils";
|
import { calculateDistance } from "@/utils";
|
||||||
import { View, Image, Text, Map } from "@tarojs/components";
|
import { View, Image, Text, Map } from "@tarojs/components";
|
||||||
@@ -8,6 +8,28 @@ import styles from "./index.module.scss";
|
|||||||
|
|
||||||
dayjs.locale("zh-cn");
|
dayjs.locale("zh-cn");
|
||||||
|
|
||||||
|
function genGameLength(startTime: Dayjs, endTime: Dayjs) {
|
||||||
|
if (!startTime || !endTime) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
const hours = endTime.diff(startTime, "hour");
|
||||||
|
if (Math.floor(hours / 24) > 1) {
|
||||||
|
return `${Math.floor(hours / 24)}天${hours % 24}小时`;
|
||||||
|
}
|
||||||
|
return `${hours}小时`;
|
||||||
|
}
|
||||||
|
|
||||||
|
function genGameRange(startTime: Dayjs, endTime: Dayjs) {
|
||||||
|
if (!startTime || !endTime) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
// 如果跨天(自然日)
|
||||||
|
if (!startTime.isSame(endTime, "day")) {
|
||||||
|
return `${startTime.format("HH:mm")} - ${endTime.format("MM月DD日 HH:mm")}`;
|
||||||
|
}
|
||||||
|
return `${startTime.format("HH:mm")} - ${endTime.format("HH:mm")}`;
|
||||||
|
}
|
||||||
|
|
||||||
// 球局信息
|
// 球局信息
|
||||||
export default function GameInfo(props) {
|
export default function GameInfo(props) {
|
||||||
const { detail, currentLocation } = props;
|
const { detail, currentLocation } = props;
|
||||||
@@ -41,13 +63,13 @@ export default function GameInfo(props) {
|
|||||||
|
|
||||||
const startTime = dayjs(start_time);
|
const startTime = dayjs(start_time);
|
||||||
const endTime = dayjs(end_time);
|
const endTime = dayjs(end_time);
|
||||||
const game_length = endTime.diff(startTime, "minutes") / 60;
|
const game_length = genGameLength(startTime, endTime);
|
||||||
|
|
||||||
const startMonth = startTime.format("M");
|
const startMonth = startTime.format("M");
|
||||||
const startDay = startTime.format("D");
|
const startDay = startTime.format("D");
|
||||||
const theDayOfWeek = startTime.format("dddd");
|
const theDayOfWeek = startTime.format("dddd");
|
||||||
const startDate = `${startMonth}月${startDay}日 ${theDayOfWeek}`;
|
const startDate = `${startMonth}月${startDay}日 ${theDayOfWeek}`;
|
||||||
const gameRange = `${startTime.format("HH:mm")} - ${endTime.format("HH:mm")}`;
|
const gameRange = genGameRange(startTime, endTime);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View className={styles["detail-page-content-game-info"]}>
|
<View className={styles["detail-page-content-game-info"]}>
|
||||||
@@ -80,7 +102,7 @@ export default function GameInfo(props) {
|
|||||||
>
|
>
|
||||||
<View className={styles.date}>{startDate}</View>
|
<View className={styles.date}>{startDate}</View>
|
||||||
<View className={styles["venue-time"]}>
|
<View className={styles["venue-time"]}>
|
||||||
{gameRange} ({game_length}小时)
|
{gameRange} ({game_length})
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
|
|||||||
Reference in New Issue
Block a user