|
@@ -1,4 +1,4 @@
|
|
|
-import { View } from "@tarojs/components";
|
|
|
|
|
|
|
+import { ScrollView, View } from "@tarojs/components";
|
|
|
import { pxTransform, useLoad, navigateBack } from "@tarojs/taro";
|
|
import { pxTransform, useLoad, navigateBack } from "@tarojs/taro";
|
|
|
import { useState } from "react";
|
|
import { useState } from "react";
|
|
|
import { ArrowLeft, Plus } from "@nutui/icons-react-taro";
|
|
import { ArrowLeft, Plus } from "@nutui/icons-react-taro";
|
|
@@ -75,6 +75,7 @@ const Detail = () => {
|
|
|
return postData ? (
|
|
return postData ? (
|
|
|
<View>
|
|
<View>
|
|
|
<NavBar
|
|
<NavBar
|
|
|
|
|
+ fixed
|
|
|
back={
|
|
back={
|
|
|
<>
|
|
<>
|
|
|
<ArrowLeft />
|
|
<ArrowLeft />
|
|
@@ -88,92 +89,94 @@ const Detail = () => {
|
|
|
>
|
|
>
|
|
|
帖子详情
|
|
帖子详情
|
|
|
</NavBar>
|
|
</NavBar>
|
|
|
- <View className="p-[10px] flex items-center justify-between">
|
|
|
|
|
- <View className="flex items-center">
|
|
|
|
|
- <View
|
|
|
|
|
- className="w-[40px] h-[40px] rounded-[50%] bg-[#000] overflow-hidden bg-cover bg-center"
|
|
|
|
|
- style={{
|
|
|
|
|
- backgroundImage: postData.user.avatar_url
|
|
|
|
|
- ? `url('${postData.user.avatar_url}')`
|
|
|
|
|
- : "none",
|
|
|
|
|
- }}
|
|
|
|
|
- ></View>
|
|
|
|
|
- <View className="ml-[10rpx]">
|
|
|
|
|
- <View className="text-[14px] font-[800] text-[#9c9dee]">
|
|
|
|
|
- {postData.user.nickname || "微信用户"}
|
|
|
|
|
- </View>
|
|
|
|
|
- {postData.user.is_official ? (
|
|
|
|
|
- <View className="text-[12px] text-[#949494]">
|
|
|
|
|
- 《心动女友》官方账号
|
|
|
|
|
|
|
+ <ScrollView className="pt-[50px]">
|
|
|
|
|
+ <View className="p-[10px] flex items-center justify-between">
|
|
|
|
|
+ <View className="flex items-center">
|
|
|
|
|
+ <View
|
|
|
|
|
+ className="w-[40px] h-[40px] rounded-[50%] bg-[#000] overflow-hidden bg-cover bg-center"
|
|
|
|
|
+ style={{
|
|
|
|
|
+ backgroundImage: postData.user.avatar_url
|
|
|
|
|
+ ? `url('${postData.user.avatar_url}')`
|
|
|
|
|
+ : "none",
|
|
|
|
|
+ }}
|
|
|
|
|
+ ></View>
|
|
|
|
|
+ <View className="ml-[10rpx]">
|
|
|
|
|
+ <View className="text-[14px] font-[800] text-[#9c9dee]">
|
|
|
|
|
+ {postData.user.nickname || "微信用户"}
|
|
|
</View>
|
|
</View>
|
|
|
- ) : (
|
|
|
|
|
- <></>
|
|
|
|
|
- )}
|
|
|
|
|
|
|
+ {postData.user.is_official ? (
|
|
|
|
|
+ <View className="text-[12px] text-[#949494]">
|
|
|
|
|
+ 《心动女友》官方账号
|
|
|
|
|
+ </View>
|
|
|
|
|
+ ) : (
|
|
|
|
|
+ <></>
|
|
|
|
|
+ )}
|
|
|
|
|
+ </View>
|
|
|
</View>
|
|
</View>
|
|
|
- </View>
|
|
|
|
|
- <View className="flex items-center">
|
|
|
|
|
- <View
|
|
|
|
|
- className="flex items-center justify-center mr-[12px] text-[12px] bg-[#f8f8f8] text-[#949494] rounded-[20px] h-[25px] w-[60px] text-center"
|
|
|
|
|
- onClick={() =>
|
|
|
|
|
- handleFollowClick(postData.user_id, postData.is_followed)
|
|
|
|
|
- }
|
|
|
|
|
- >
|
|
|
|
|
- {postData.is_followed ? <></> : <Plus color="#1874d0" />}
|
|
|
|
|
- <Text>{postData.is_followed ? "已关注" : "关注"}</Text>
|
|
|
|
|
|
|
+ <View className="flex items-center">
|
|
|
|
|
+ <View
|
|
|
|
|
+ className="flex items-center justify-center mr-[12px] text-[12px] bg-[#f8f8f8] text-[#949494] rounded-[20px] h-[25px] w-[60px] text-center"
|
|
|
|
|
+ onClick={() =>
|
|
|
|
|
+ handleFollowClick(postData.user_id, postData.is_followed)
|
|
|
|
|
+ }
|
|
|
|
|
+ >
|
|
|
|
|
+ {postData.is_followed ? <></> : <Plus color="#1874d0" />}
|
|
|
|
|
+ <Text>{postData.is_followed ? "已关注" : "关注"}</Text>
|
|
|
|
|
+ </View>
|
|
|
</View>
|
|
</View>
|
|
|
</View>
|
|
</View>
|
|
|
- </View>
|
|
|
|
|
- <Swiper
|
|
|
|
|
- height={pxTransform(300)}
|
|
|
|
|
- defaultValue={0}
|
|
|
|
|
- onChange={(e) => {
|
|
|
|
|
- setCurrentIndex(e.detail.current);
|
|
|
|
|
- }}
|
|
|
|
|
- indicator={
|
|
|
|
|
- <View
|
|
|
|
|
- style={{
|
|
|
|
|
- display: "flex",
|
|
|
|
|
- flexDirection: "row",
|
|
|
|
|
- justifyContent: "center",
|
|
|
|
|
- alignItems: "center",
|
|
|
|
|
- position: "absolute",
|
|
|
|
|
- left: "85%",
|
|
|
|
|
- bottom: pxTransform(10),
|
|
|
|
|
- width: pxTransform(46),
|
|
|
|
|
- height: pxTransform(22),
|
|
|
|
|
- backgroundColor: "rgba(0, 0, 0, 0.33)",
|
|
|
|
|
- borderRadius: pxTransform(22),
|
|
|
|
|
- textAlign: "center",
|
|
|
|
|
- fontSize: pxTransform(14),
|
|
|
|
|
- zIndex: 1,
|
|
|
|
|
- }}
|
|
|
|
|
- >
|
|
|
|
|
- <Text style={{ color: "#fff" }}>
|
|
|
|
|
- {currentIndex + 1}/{postData.media_url.length}
|
|
|
|
|
- </Text>
|
|
|
|
|
- </View>
|
|
|
|
|
- }
|
|
|
|
|
- >
|
|
|
|
|
- {postData.media_url.map((item, index) => (
|
|
|
|
|
- <Swiper.Item key={item}>
|
|
|
|
|
- <Image
|
|
|
|
|
- width="100%"
|
|
|
|
|
- height="100%"
|
|
|
|
|
- onClick={() => {
|
|
|
|
|
- setShowPreview(true);
|
|
|
|
|
- setInit(index + 1);
|
|
|
|
|
|
|
+ <Swiper
|
|
|
|
|
+ height={pxTransform(300)}
|
|
|
|
|
+ defaultValue={0}
|
|
|
|
|
+ onChange={(e) => {
|
|
|
|
|
+ setCurrentIndex(e.detail.current);
|
|
|
|
|
+ }}
|
|
|
|
|
+ indicator={
|
|
|
|
|
+ <View
|
|
|
|
|
+ style={{
|
|
|
|
|
+ display: "flex",
|
|
|
|
|
+ flexDirection: "row",
|
|
|
|
|
+ justifyContent: "center",
|
|
|
|
|
+ alignItems: "center",
|
|
|
|
|
+ position: "absolute",
|
|
|
|
|
+ left: "85%",
|
|
|
|
|
+ bottom: pxTransform(10),
|
|
|
|
|
+ width: pxTransform(46),
|
|
|
|
|
+ height: pxTransform(22),
|
|
|
|
|
+ backgroundColor: "rgba(0, 0, 0, 0.33)",
|
|
|
|
|
+ borderRadius: pxTransform(22),
|
|
|
|
|
+ textAlign: "center",
|
|
|
|
|
+ fontSize: pxTransform(14),
|
|
|
|
|
+ zIndex: 1,
|
|
|
}}
|
|
}}
|
|
|
- mode="aspectFill"
|
|
|
|
|
- src={item.src}
|
|
|
|
|
- />
|
|
|
|
|
- </Swiper.Item>
|
|
|
|
|
- ))}
|
|
|
|
|
- </Swiper>
|
|
|
|
|
- <View className="p-[10px]">
|
|
|
|
|
- <View className="text-[14px] text-[#333]">{postData.content}</View>
|
|
|
|
|
- <CommentList postId={postData.id} />
|
|
|
|
|
- <CommentListInteraction postData={postData} />
|
|
|
|
|
- </View>
|
|
|
|
|
|
|
+ >
|
|
|
|
|
+ <Text style={{ color: "#fff" }}>
|
|
|
|
|
+ {currentIndex + 1}/{postData.media_url.length}
|
|
|
|
|
+ </Text>
|
|
|
|
|
+ </View>
|
|
|
|
|
+ }
|
|
|
|
|
+ >
|
|
|
|
|
+ {postData.media_url.map((item, index) => (
|
|
|
|
|
+ <Swiper.Item key={item}>
|
|
|
|
|
+ <Image
|
|
|
|
|
+ width="100%"
|
|
|
|
|
+ height="100%"
|
|
|
|
|
+ onClick={() => {
|
|
|
|
|
+ setShowPreview(true);
|
|
|
|
|
+ setInit(index + 1);
|
|
|
|
|
+ }}
|
|
|
|
|
+ mode="aspectFill"
|
|
|
|
|
+ src={item.src}
|
|
|
|
|
+ />
|
|
|
|
|
+ </Swiper.Item>
|
|
|
|
|
+ ))}
|
|
|
|
|
+ </Swiper>
|
|
|
|
|
+ <View className="p-[10px]">
|
|
|
|
|
+ <View className="text-[14px] text-[#333]">{postData.content}</View>
|
|
|
|
|
+ <CommentList postId={postData.id} />
|
|
|
|
|
+ </View>
|
|
|
|
|
+ </ScrollView>
|
|
|
|
|
+ <CommentListInteraction postData={postData} />
|
|
|
<ImagePreview
|
|
<ImagePreview
|
|
|
images={postData.media_url}
|
|
images={postData.media_url}
|
|
|
visible={showPreview}
|
|
visible={showPreview}
|