style: fix style
This commit is contained in:
@@ -176,6 +176,7 @@
|
|||||||
|
|
||||||
& > .input {
|
& > .input {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
height: 36px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
export default definePageConfig({
|
export default definePageConfig({
|
||||||
navigationBarTitleText: '球局详情',
|
navigationBarTitleText: '球局详情',
|
||||||
navigationStyle: 'custom',
|
navigationStyle: 'custom',
|
||||||
|
enableShareAppMessage: true,
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -1066,7 +1066,7 @@
|
|||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
height: 52px;
|
height: 52px;
|
||||||
width: 113px;
|
width: 120px;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
padding: 2px 20px;
|
padding: 2px 20px;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
@@ -1177,33 +1177,3 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.share-popup-content {
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
padding: 20px 16px env(safe-area-inset-bottom);
|
|
||||||
box-sizing: border-box;
|
|
||||||
// padding-bottom: env(safe-area-inset-bottom);
|
|
||||||
box-sizing: border-box;
|
|
||||||
display: flex;
|
|
||||||
justify-content: space-around;
|
|
||||||
align-items: center;
|
|
||||||
|
|
||||||
& > view {
|
|
||||||
width: 100px;
|
|
||||||
height: 64px;
|
|
||||||
border-radius: 12px;
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
align-items: center;
|
|
||||||
gap: 12px;
|
|
||||||
|
|
||||||
& > image {
|
|
||||||
width: 24px;
|
|
||||||
height: 24px;
|
|
||||||
}
|
|
||||||
|
|
||||||
& > text {
|
|
||||||
color: rgba(0, 0, 0, 0.85);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import React, {
|
|||||||
useImperativeHandle,
|
useImperativeHandle,
|
||||||
forwardRef,
|
forwardRef,
|
||||||
} from "react";
|
} from "react";
|
||||||
import { View, Text, Image, Map, ScrollView } from "@tarojs/components";
|
import { View, Text, Image, Map, ScrollView, Button } from "@tarojs/components";
|
||||||
// import { Avatar } from "@nutui/nutui-react-taro";
|
// import { Avatar } from "@nutui/nutui-react-taro";
|
||||||
import Taro, {
|
import Taro, {
|
||||||
useRouter,
|
useRouter,
|
||||||
@@ -13,7 +13,7 @@ import Taro, {
|
|||||||
useShareTimeline,
|
useShareTimeline,
|
||||||
useDidShow,
|
useDidShow,
|
||||||
} from "@tarojs/taro";
|
} from "@tarojs/taro";
|
||||||
import classnames from 'classnames'
|
import classnames from "classnames";
|
||||||
import dayjs from "dayjs";
|
import dayjs from "dayjs";
|
||||||
import "dayjs/locale/zh-cn";
|
import "dayjs/locale/zh-cn";
|
||||||
// 导入API服务
|
// 导入API服务
|
||||||
@@ -29,19 +29,23 @@ import {
|
|||||||
SceneType,
|
SceneType,
|
||||||
DisplayConditionType,
|
DisplayConditionType,
|
||||||
} from "@/components/NTRPEvaluatePopup";
|
} from "@/components/NTRPEvaluatePopup";
|
||||||
import DetailService, { MATCH_STATUS, IsSubstituteSupported } from "@/services/detailService";
|
import DetailService, {
|
||||||
|
MATCH_STATUS,
|
||||||
|
IsSubstituteSupported,
|
||||||
|
} from "@/services/detailService";
|
||||||
import * as LoginService from "@/services/loginService";
|
import * as LoginService from "@/services/loginService";
|
||||||
import OrderService from "@/services/orderService";
|
import OrderService from "@/services/orderService";
|
||||||
import { getCurrentLocation, calculateDistance } from "@/utils/locationUtils";
|
import { getCurrentLocation, calculateDistance } from "@/utils/locationUtils";
|
||||||
import { useUserInfo, useUserActions } from "@/store/userStore";
|
import { useUserInfo, useUserActions } from "@/store/userStore";
|
||||||
import img from "@/config/images";
|
import img from "@/config/images";
|
||||||
|
import styles from "./style.module.scss";
|
||||||
import "./index.scss";
|
import "./index.scss";
|
||||||
|
|
||||||
dayjs.locale("zh-cn");
|
dayjs.locale("zh-cn");
|
||||||
|
|
||||||
// 将·作为连接符插入到标签文本之间
|
// 将·作为连接符插入到标签文本之间
|
||||||
function insertDotInTags(tags: string[]) {
|
function insertDotInTags(tags: string[]) {
|
||||||
if (!tags) return []
|
if (!tags) return [];
|
||||||
return tags.join("-·-").split("-");
|
return tags.join("-·-").split("-");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -172,14 +176,14 @@ const SharePopup = forwardRef(
|
|||||||
},
|
},
|
||||||
}));
|
}));
|
||||||
|
|
||||||
// function handleShareToWechat() {
|
useShareAppMessage((res) => {
|
||||||
// useShareAppMessage(() => {
|
console.log(res, "res");
|
||||||
// return {
|
return {
|
||||||
// title: '分享',
|
title: "分享",
|
||||||
// path: `/game_pages/detail/index?id=${id}&from=share`,
|
imageUrl: "https://img.yzcdn.cn/vant/cat.jpeg",
|
||||||
// }
|
path: `/game_pages/detail/index?id=${id}&from=share`,
|
||||||
// })
|
};
|
||||||
// }
|
});
|
||||||
|
|
||||||
// function handleShareToWechatMoments() {
|
// function handleShareToWechatMoments() {
|
||||||
// useShareTimeline(() => {
|
// useShareTimeline(() => {
|
||||||
@@ -190,17 +194,19 @@ const SharePopup = forwardRef(
|
|||||||
// })
|
// })
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// function handleSaveToLocal() {
|
function handleSaveToLocal() {
|
||||||
// Taro.saveImageToPhotosAlbum({
|
Taro.showToast({ title: "not yet", icon: "error" });
|
||||||
// filePath: images[0],
|
return;
|
||||||
// success: () => {
|
Taro.saveImageToPhotosAlbum({
|
||||||
// Taro.showToast({ title: '保存成功', icon: 'success' })
|
filePath: "",
|
||||||
// },
|
success: () => {
|
||||||
// fail: () => {
|
Taro.showToast({ title: "保存成功", icon: "success" });
|
||||||
// Taro.showToast({ title: '保存失败', icon: 'none' })
|
},
|
||||||
// },
|
fail: () => {
|
||||||
// })
|
Taro.showToast({ title: "保存失败", icon: "none" });
|
||||||
// }
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<CommonPopup
|
<CommonPopup
|
||||||
@@ -212,9 +218,25 @@ const SharePopup = forwardRef(
|
|||||||
hideFooter
|
hideFooter
|
||||||
style={{ minHeight: "100px" }}
|
style={{ minHeight: "100px" }}
|
||||||
>
|
>
|
||||||
<View catchMove className="share-popup-content">
|
<View className={styles.shareContainer}>
|
||||||
|
<View catchMove className={styles.title}>
|
||||||
分享卡片
|
分享卡片
|
||||||
</View>
|
</View>
|
||||||
|
<View className={styles.shareItems}>
|
||||||
|
<Button
|
||||||
|
className={classnames(styles.button, styles.share)}
|
||||||
|
openType="share"
|
||||||
|
>
|
||||||
|
分享到聊天
|
||||||
|
</Button>
|
||||||
|
<Button
|
||||||
|
className={classnames(styles.button, styles.save)}
|
||||||
|
onClick={handleSaveToLocal}
|
||||||
|
>
|
||||||
|
保存到本地
|
||||||
|
</Button>
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
</CommonPopup>
|
</CommonPopup>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -231,26 +253,43 @@ function toast(message) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function isFull(counts) {
|
function isFull(counts) {
|
||||||
const { max_players, current_players, max_substitute_players, current_substitute_count, is_substitute_supported } = counts
|
const {
|
||||||
|
max_players,
|
||||||
|
current_players,
|
||||||
|
max_substitute_players,
|
||||||
|
current_substitute_count,
|
||||||
|
is_substitute_supported,
|
||||||
|
} = counts;
|
||||||
if (max_players === current_players) {
|
if (max_players === current_players) {
|
||||||
|
return true;
|
||||||
return true
|
} else if (is_substitute_supported === IsSubstituteSupported.SUPPORT) {
|
||||||
|
return max_substitute_players === current_substitute_count;
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (is_substitute_supported === IsSubstituteSupported.SUPPORT) {
|
return false;
|
||||||
return max_substitute_players === current_substitute_count
|
|
||||||
}
|
|
||||||
|
|
||||||
return false
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 底部操作栏
|
// 底部操作栏
|
||||||
function StickyButton(props) {
|
function StickyButton(props) {
|
||||||
const { handleShare, handleJoinGame, detail, onStatusChange, handleAddComment, getCommentCount } = props;
|
const {
|
||||||
const [commentCount, setCommentCount] = useState(0)
|
handleShare,
|
||||||
|
handleJoinGame,
|
||||||
|
detail,
|
||||||
|
onStatusChange,
|
||||||
|
handleAddComment,
|
||||||
|
getCommentCount,
|
||||||
|
} = props;
|
||||||
|
const [commentCount, setCommentCount] = useState(0);
|
||||||
const ntrpRef = useRef(null);
|
const ntrpRef = useRef(null);
|
||||||
const { id, price, user_action_status, match_status, start_time, end_time, is_organizer } =
|
const {
|
||||||
detail || {};
|
id,
|
||||||
|
price,
|
||||||
|
user_action_status,
|
||||||
|
match_status,
|
||||||
|
start_time,
|
||||||
|
end_time,
|
||||||
|
is_organizer,
|
||||||
|
} = detail || {};
|
||||||
|
|
||||||
const gameManageRef = useRef();
|
const gameManageRef = useRef();
|
||||||
|
|
||||||
@@ -261,13 +300,15 @@ function StickyButton(props) {
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
getCommentCount?.((count) => {
|
getCommentCount?.((count) => {
|
||||||
setCommentCount(count)
|
setCommentCount(count);
|
||||||
})
|
});
|
||||||
}, [getCommentCount])
|
}, [getCommentCount]);
|
||||||
|
|
||||||
function generateTextAndAction(
|
function generateTextAndAction(
|
||||||
user_action_status: null | { [key: string]: boolean }
|
user_action_status: null | { [key: string]: boolean }
|
||||||
): undefined | { text: string | React.FC; action?: () => void; available?: boolean } {
|
):
|
||||||
|
| undefined
|
||||||
|
| { text: string | React.FC; action?: () => void; available?: boolean } {
|
||||||
if (!user_action_status) {
|
if (!user_action_status) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -367,7 +408,11 @@ function StickyButton(props) {
|
|||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
const { text, available = true, action = () => { } } = generateTextAndAction(user_action_status)!;
|
const {
|
||||||
|
text,
|
||||||
|
available = true,
|
||||||
|
action = () => {},
|
||||||
|
} = generateTextAndAction(user_action_status)!;
|
||||||
|
|
||||||
let ActionText: React.FC | string = text;
|
let ActionText: React.FC | string = text;
|
||||||
|
|
||||||
@@ -393,17 +438,24 @@ function StickyButton(props) {
|
|||||||
className="sticky-bottom-bar-comment"
|
className="sticky-bottom-bar-comment"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
// Taro.showToast({ title: "To be continued", icon: "none" });
|
// Taro.showToast({ title: "To be continued", icon: "none" });
|
||||||
handleAddComment()
|
handleAddComment();
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Image
|
<Image
|
||||||
className="sticky-bottom-bar-comment-icon"
|
className="sticky-bottom-bar-comment-icon"
|
||||||
src={img.ICON_DETAIL_COMMENT_DARK}
|
src={img.ICON_DETAIL_COMMENT_DARK}
|
||||||
/>
|
/>
|
||||||
<Text className="sticky-bottom-bar-comment-text">{commentCount > 0 ? commentCount : '评论'}</Text>
|
<Text className="sticky-bottom-bar-comment-text">
|
||||||
|
{commentCount > 0 ? commentCount : "评论"}
|
||||||
|
</Text>
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
<View className={classnames("detail-main-action", available ? '' : 'disabled')}>
|
<View
|
||||||
|
className={classnames(
|
||||||
|
"detail-main-action",
|
||||||
|
available ? "" : "disabled"
|
||||||
|
)}
|
||||||
|
>
|
||||||
<View
|
<View
|
||||||
style={is_organizer ? {} : { margin: "auto" }}
|
style={is_organizer ? {} : { margin: "auto" }}
|
||||||
className="sticky-bottom-bar-join-game"
|
className="sticky-bottom-bar-join-game"
|
||||||
@@ -563,7 +615,7 @@ function GameInfo(props) {
|
|||||||
{ latitude: c_latitude, longitude: c_longitude },
|
{ latitude: c_latitude, longitude: c_longitude },
|
||||||
]}
|
]}
|
||||||
includePadding={{ left: 50, right: 50, top: 50, bottom: 50 }}
|
includePadding={{ left: 50, right: 50, top: 50, bottom: 50 }}
|
||||||
onError={() => { }}
|
onError={() => {}}
|
||||||
// hide business msg
|
// hide business msg
|
||||||
showLocation
|
showLocation
|
||||||
theme="dark"
|
theme="dark"
|
||||||
@@ -595,7 +647,8 @@ function VenueInfo(props) {
|
|||||||
function previewImage(current_url) {
|
function previewImage(current_url) {
|
||||||
Taro.previewImage({
|
Taro.previewImage({
|
||||||
current: current_url,
|
current: current_url,
|
||||||
urls: venue_image_list?.length > 0 ? venue_image_list.map((c) => c.url) : [],
|
urls:
|
||||||
|
venue_image_list?.length > 0 ? venue_image_list.map((c) => c.url) : [],
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
return (
|
return (
|
||||||
@@ -644,7 +697,8 @@ function VenueInfo(props) {
|
|||||||
<View className="venue-screenshot-title">预定截图</View>
|
<View className="venue-screenshot-title">预定截图</View>
|
||||||
<ScrollView scrollY className="venue-screenshot-scroll-view">
|
<ScrollView scrollY className="venue-screenshot-scroll-view">
|
||||||
<View className="venue-screenshot-image-list">
|
<View className="venue-screenshot-image-list">
|
||||||
{venue_image_list?.length > 0 && venue_image_list.map((item) => {
|
{venue_image_list?.length > 0 &&
|
||||||
|
venue_image_list.map((item) => {
|
||||||
return (
|
return (
|
||||||
<View
|
<View
|
||||||
className="venue-screenshot-image-item"
|
className="venue-screenshot-image-item"
|
||||||
@@ -763,7 +817,8 @@ function Participants(props) {
|
|||||||
<View
|
<View
|
||||||
className="participants-list-scroll-content"
|
className="participants-list-scroll-content"
|
||||||
style={{
|
style={{
|
||||||
width: `${participants.length * 103 + (participants.length - 1) * 8
|
width: `${
|
||||||
|
participants.length * 103 + (participants.length - 1) * 8
|
||||||
}px`,
|
}px`,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
@@ -884,7 +939,7 @@ function OrganizerInfo(props) {
|
|||||||
const {
|
const {
|
||||||
userInfo,
|
userInfo,
|
||||||
currentLocation: location,
|
currentLocation: location,
|
||||||
onUpdateUserInfo = () => { },
|
onUpdateUserInfo = () => {},
|
||||||
handleViewUserInfo,
|
handleViewUserInfo,
|
||||||
handleAddComment,
|
handleAddComment,
|
||||||
} = props;
|
} = props;
|
||||||
@@ -970,7 +1025,10 @@ function OrganizerInfo(props) {
|
|||||||
)}
|
)}
|
||||||
</View>
|
</View>
|
||||||
)}
|
)}
|
||||||
<View className="organizer-actions-comment" onClick={() => handleAddComment()}>
|
<View
|
||||||
|
className="organizer-actions-comment"
|
||||||
|
onClick={() => handleAddComment()}
|
||||||
|
>
|
||||||
<Image
|
<Image
|
||||||
className="organizer-actions-comment-icon"
|
className="organizer-actions-comment-icon"
|
||||||
src={img.ICON_DETAIL_COMMENT}
|
src={img.ICON_DETAIL_COMMENT}
|
||||||
@@ -1106,8 +1164,8 @@ function Index() {
|
|||||||
fetchUserInfoById(res.data.publisher_id);
|
fetchUserInfoById(res.data.publisher_id);
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
if (e.message === '球局不存在') {
|
if (e.message === "球局不存在") {
|
||||||
handleBack()
|
handleBack();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -1219,17 +1277,27 @@ function Index() {
|
|||||||
currentLocation={currentLocation}
|
currentLocation={currentLocation}
|
||||||
onUpdateUserInfo={onUpdateUserInfo}
|
onUpdateUserInfo={onUpdateUserInfo}
|
||||||
handleViewUserInfo={handleViewUserInfo}
|
handleViewUserInfo={handleViewUserInfo}
|
||||||
handleAddComment={() => { commentRef.current && commentRef.current.addComment() }}
|
handleAddComment={() => {
|
||||||
|
commentRef.current && commentRef.current.addComment();
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
<Comments
|
||||||
|
ref={commentRef}
|
||||||
|
game_id={Number(id)}
|
||||||
|
publisher_id={Number(detail.publisher_id)}
|
||||||
/>
|
/>
|
||||||
<Comments ref={commentRef} game_id={Number(id)} publisher_id={Number(detail.publisher_id)} />
|
|
||||||
{/* sticky bottom action bar */}
|
{/* sticky bottom action bar */}
|
||||||
<StickyButton
|
<StickyButton
|
||||||
handleShare={handleShare}
|
handleShare={handleShare}
|
||||||
handleJoinGame={handleJoinGame}
|
handleJoinGame={handleJoinGame}
|
||||||
detail={detail}
|
detail={detail}
|
||||||
onStatusChange={onStatusChange}
|
onStatusChange={onStatusChange}
|
||||||
handleAddComment={() => { commentRef.current && commentRef.current.addComment() }}
|
handleAddComment={() => {
|
||||||
getCommentCount={commentRef.current && commentRef.current.getCommentCount}
|
commentRef.current && commentRef.current.addComment();
|
||||||
|
}}
|
||||||
|
getCommentCount={
|
||||||
|
commentRef.current && commentRef.current.getCommentCount
|
||||||
|
}
|
||||||
/>
|
/>
|
||||||
{/* share popup */}
|
{/* share popup */}
|
||||||
<SharePopup
|
<SharePopup
|
||||||
|
|||||||
24
src/game_pages/detail/style.module.scss
Normal file
24
src/game_pages/detail/style.module.scss
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
.shareContainer {
|
||||||
|
.title {
|
||||||
|
padding: 20px;
|
||||||
|
color: #000;
|
||||||
|
text-align: center;
|
||||||
|
font-family: "PingFang SC";
|
||||||
|
font-size: 18px;
|
||||||
|
font-style: normal;
|
||||||
|
font-weight: 600;
|
||||||
|
line-height: 28px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.shareItems {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
padding-bottom: 60px;
|
||||||
|
|
||||||
|
.button {
|
||||||
|
width: 140px;
|
||||||
|
height: 40px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user