feat: 评论完了
This commit is contained in:
@@ -6,7 +6,7 @@ import React, {
|
||||
forwardRef,
|
||||
} from "react";
|
||||
import { View, Text, Image, Map, ScrollView } from "@tarojs/components";
|
||||
import { Avatar } from "@nutui/nutui-react-taro";
|
||||
// import { Avatar } from "@nutui/nutui-react-taro";
|
||||
import Taro, {
|
||||
useRouter,
|
||||
useShareAppMessage,
|
||||
@@ -22,6 +22,7 @@ import {
|
||||
withAuth,
|
||||
NTRPEvaluatePopup,
|
||||
GameManagePopup,
|
||||
Comments,
|
||||
} from "@/components";
|
||||
import {
|
||||
EvaluateType,
|
||||
@@ -40,6 +41,7 @@ dayjs.locale("zh-cn");
|
||||
|
||||
// 将·作为连接符插入到标签文本之间
|
||||
function insertDotInTags(tags: string[]) {
|
||||
if (!tags) return []
|
||||
return tags.join("-·-").split("-");
|
||||
}
|
||||
|
||||
@@ -104,7 +106,6 @@ function Coursel(props) {
|
||||
async function getImagesMsg(imageList) {
|
||||
const latest_list: CourselItemType[] = [];
|
||||
const sys_info = await Taro.getSystemInfo();
|
||||
console.log(sys_info, "info");
|
||||
const max_width = sys_info.screenWidth - 30;
|
||||
const max_height = 240;
|
||||
const current_aspect_ratio = max_width / max_height;
|
||||
@@ -239,7 +240,7 @@ function isFull (counts) {
|
||||
|
||||
// 底部操作栏
|
||||
function StickyButton(props) {
|
||||
const { handleShare, handleJoinGame, detail, onStatusChange } = props;
|
||||
const { handleShare, handleJoinGame, detail, onStatusChange, handleAddComment, getCommentCount } = props;
|
||||
const ntrpRef = useRef(null);
|
||||
const { id, price, user_action_status, match_status, start_time, end_time, is_organizer } =
|
||||
detail || {};
|
||||
@@ -363,6 +364,8 @@ function StickyButton(props) {
|
||||
};
|
||||
}
|
||||
|
||||
const commentCount = getCommentCount()
|
||||
|
||||
return (
|
||||
<>
|
||||
<View className="sticky-bottom-bar">
|
||||
@@ -378,14 +381,15 @@ function StickyButton(props) {
|
||||
<View
|
||||
className="sticky-bottom-bar-comment"
|
||||
onClick={() => {
|
||||
Taro.showToast({ title: "To be continued", icon: "none" });
|
||||
// Taro.showToast({ title: "To be continued", icon: "none" });
|
||||
handleAddComment()
|
||||
}}
|
||||
>
|
||||
<Image
|
||||
className="sticky-bottom-bar-comment-icon"
|
||||
src={img.ICON_DETAIL_COMMENT_DARK}
|
||||
/>
|
||||
<Text className="sticky-bottom-bar-comment-text">32</Text>
|
||||
<Text className="sticky-bottom-bar-comment-text">{commentCount > 0 ? commentCount : '评论'}</Text>
|
||||
</View>
|
||||
</View>
|
||||
<View className={classnames("detail-main-action", available ? '' : 'disabled')}>
|
||||
@@ -580,7 +584,7 @@ function VenueInfo(props) {
|
||||
function previewImage(current_url) {
|
||||
Taro.previewImage({
|
||||
current: current_url,
|
||||
urls: venue_image_list.map((c) => c.url),
|
||||
urls: venue_image_list?.length > 0 ? venue_image_list.map((c) => c.url) : [],
|
||||
});
|
||||
}
|
||||
return (
|
||||
@@ -629,7 +633,7 @@ function VenueInfo(props) {
|
||||
<View className="venue-screenshot-title">预定截图</View>
|
||||
<ScrollView scrollY className="venue-screenshot-scroll-view">
|
||||
<View className="venue-screenshot-image-list">
|
||||
{venue_image_list.map((item) => {
|
||||
{venue_image_list?.length > 0 && venue_image_list.map((item) => {
|
||||
return (
|
||||
<View
|
||||
className="venue-screenshot-image-item"
|
||||
@@ -651,7 +655,6 @@ function VenueInfo(props) {
|
||||
}
|
||||
|
||||
function genNTRPRequirementText(min, max) {
|
||||
console.log(min, max, "ntrp");
|
||||
if (min && max && min !== max) {
|
||||
return `${min} - ${max} 之间`;
|
||||
} else if (max === "1") {
|
||||
@@ -798,7 +801,7 @@ function Participants(props) {
|
||||
|
||||
function SupplementalNotes(props) {
|
||||
const {
|
||||
detail: { description, description_tag = [] },
|
||||
detail: { description, description_tag },
|
||||
} = props;
|
||||
return (
|
||||
<View className="detail-page-content-supplemental-notes">
|
||||
@@ -808,7 +811,7 @@ function SupplementalNotes(props) {
|
||||
<View className="supplemental-notes-content">
|
||||
{/* supplemental notes tags */}
|
||||
<View className="supplemental-notes-content-tags">
|
||||
{insertDotInTags(description_tag).map((tag, index) => (
|
||||
{insertDotInTags(description_tag || []).map((tag, index) => (
|
||||
<View key={index} className="supplemental-notes-content-tags-tag">
|
||||
<Text>{tag}</Text>
|
||||
</View>
|
||||
@@ -873,6 +876,7 @@ function OrganizerInfo(props) {
|
||||
currentLocation: location,
|
||||
onUpdateUserInfo = () => {},
|
||||
handleViewUserInfo,
|
||||
handleAddComment,
|
||||
} = props;
|
||||
const {
|
||||
id,
|
||||
@@ -956,7 +960,7 @@ function OrganizerInfo(props) {
|
||||
)}
|
||||
</View>
|
||||
)}
|
||||
<View className="organizer-actions-comment">
|
||||
<View className="organizer-actions-comment" onClick={() => handleAddComment()}>
|
||||
<Image
|
||||
className="organizer-actions-comment-icon"
|
||||
src={img.ICON_DETAIL_COMMENT}
|
||||
@@ -1056,6 +1060,7 @@ function Index() {
|
||||
const isMyOwn = userInfo.id === myInfo.id;
|
||||
|
||||
const sharePopupRef = useRef<any>(null);
|
||||
const commentRef = useRef();
|
||||
|
||||
useDidShow(async () => {
|
||||
await updateLocation();
|
||||
@@ -1084,10 +1089,16 @@ function Index() {
|
||||
|
||||
const fetchDetail = async () => {
|
||||
if (!id) return;
|
||||
const res = await DetailService.getDetail(Number(id));
|
||||
if (res.code === 0) {
|
||||
setDetail(res.data);
|
||||
fetchUserInfoById(res.data.publisher_id);
|
||||
try {
|
||||
const res = await DetailService.getDetail(Number(id));
|
||||
if (res.code === 0) {
|
||||
setDetail(res.data);
|
||||
fetchUserInfoById(res.data.publisher_id);
|
||||
}
|
||||
} catch (e) {
|
||||
if (e.message === '球局不存在') {
|
||||
handleBack()
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1139,7 +1150,6 @@ function Index() {
|
||||
navto(`/user_pages/other/index?userid=${userId}`);
|
||||
}
|
||||
|
||||
console.log("detail", detail);
|
||||
const backgroundImage = detail?.image_list?.[0]
|
||||
? { backgroundImage: `url(${detail?.image_list?.[0]})` }
|
||||
: {};
|
||||
@@ -1199,13 +1209,17 @@ function Index() {
|
||||
currentLocation={currentLocation}
|
||||
onUpdateUserInfo={onUpdateUserInfo}
|
||||
handleViewUserInfo={handleViewUserInfo}
|
||||
handleAddComment={() => { commentRef.current && commentRef.current.addComment() }}
|
||||
/>
|
||||
<Comments ref={commentRef} game_id={Number(id)} publisher_id={Number(detail.publisher_id)} />
|
||||
{/* sticky bottom action bar */}
|
||||
<StickyButton
|
||||
handleShare={handleShare}
|
||||
handleJoinGame={handleJoinGame}
|
||||
detail={detail}
|
||||
onStatusChange={onStatusChange}
|
||||
handleAddComment={() => { commentRef.current && commentRef.current.addComment() }}
|
||||
getCommentCount={() => commentRef.current && commentRef.current.getCommentCount()}
|
||||
/>
|
||||
{/* share popup */}
|
||||
<SharePopup
|
||||
|
||||
Reference in New Issue
Block a user