|
@@ -10,6 +10,7 @@ import {
|
|
|
Setting,
|
|
Setting,
|
|
|
User,
|
|
User,
|
|
|
} from "@nutui/icons-react-taro";
|
|
} from "@nutui/icons-react-taro";
|
|
|
|
|
+import avatar from "../../asset/img/avatar.png";
|
|
|
import {
|
|
import {
|
|
|
Badge,
|
|
Badge,
|
|
|
Button,
|
|
Button,
|
|
@@ -30,6 +31,10 @@ import {
|
|
|
useDidShow,
|
|
useDidShow,
|
|
|
navigateBack,
|
|
navigateBack,
|
|
|
useLoad,
|
|
useLoad,
|
|
|
|
|
+ getStorageSync,
|
|
|
|
|
+ showToast,
|
|
|
|
|
+ removeStorageSync,
|
|
|
|
|
+ showModal,
|
|
|
} from "@tarojs/taro";
|
|
} from "@tarojs/taro";
|
|
|
import "./index.scss";
|
|
import "./index.scss";
|
|
|
import { useState, useEffect, useCallback } from "react";
|
|
import { useState, useEffect, useCallback } from "react";
|
|
@@ -37,6 +42,7 @@ import { strSlice } from "../../utils";
|
|
|
import { followApi, interactionApi, unfollowApi } from "../../api/interaction";
|
|
import { followApi, interactionApi, unfollowApi } from "../../api/interaction";
|
|
|
import { getUserPostListApi } from "../../api/post";
|
|
import { getUserPostListApi } from "../../api/post";
|
|
|
import { getUserInfoApi } from "../../api/user";
|
|
import { getUserInfoApi } from "../../api/user";
|
|
|
|
|
+import ChangePassword from "../../components/change-password";
|
|
|
const Self = () => {
|
|
const Self = () => {
|
|
|
const [tab1value, setTab1value] = useState<string | number>("0");
|
|
const [tab1value, setTab1value] = useState<string | number>("0");
|
|
|
const [scrollHeight, setScrollHeight] = useState<number>(0);
|
|
const [scrollHeight, setScrollHeight] = useState<number>(0);
|
|
@@ -49,6 +55,7 @@ const Self = () => {
|
|
|
const [mediaUrl, setMediaUrl] = useState<any[]>([]);
|
|
const [mediaUrl, setMediaUrl] = useState<any[]>([]);
|
|
|
const [showPreview, setShowPreview] = useState(false);
|
|
const [showPreview, setShowPreview] = useState(false);
|
|
|
const [init, setInit] = useState(0);
|
|
const [init, setInit] = useState(0);
|
|
|
|
|
+ const [showBottom, setShowBottom] = useState(false);
|
|
|
const [userInfo, setUserInfo] = useState<any>({});
|
|
const [userInfo, setUserInfo] = useState<any>({});
|
|
|
const [pageConfig, setPageConfig] = useState({
|
|
const [pageConfig, setPageConfig] = useState({
|
|
|
page: 1,
|
|
page: 1,
|
|
@@ -95,6 +102,81 @@ const Self = () => {
|
|
|
}
|
|
}
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
|
|
+ const handleLogout = () => {
|
|
|
|
|
+ showModal({
|
|
|
|
|
+ title: "提示",
|
|
|
|
|
+ content: "确定退出登录吗?",
|
|
|
|
|
+ confirmColor: "#1874d0",
|
|
|
|
|
+ cancelColor: "#949494",
|
|
|
|
|
+ success: function (res) {
|
|
|
|
|
+ if (res.confirm) {
|
|
|
|
|
+ removeStorageSync("vipInfo");
|
|
|
|
|
+ removeStorageSync("Authorization");
|
|
|
|
|
+ removeStorageSync("User");
|
|
|
|
|
+ removeStorageSync("circleInfo");
|
|
|
|
|
+ redirectTo({ url: "/pages/login/index" });
|
|
|
|
|
+ } else if (res.cancel) {
|
|
|
|
|
+ console.log("用户点击取消");
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ });
|
|
|
|
|
+ };
|
|
|
|
|
+
|
|
|
|
|
+ const handleCopyUserName = () => {
|
|
|
|
|
+ // 兼容性更好的复制方法
|
|
|
|
|
+ const copyText = async () => {
|
|
|
|
|
+ try {
|
|
|
|
|
+ // 优先使用现代 Clipboard API
|
|
|
|
|
+ if (navigator.clipboard && window.isSecureContext) {
|
|
|
|
|
+ await navigator.clipboard.writeText(
|
|
|
|
|
+ getStorageSync("vipInfo").user_name
|
|
|
|
|
+ );
|
|
|
|
|
+ showToast({
|
|
|
|
|
+ title: "账号已复制",
|
|
|
|
|
+ duration: 2000,
|
|
|
|
|
+ icon: "none",
|
|
|
|
|
+ });
|
|
|
|
|
+ } else {
|
|
|
|
|
+ // 降级方案:使用传统的 document.execCommand
|
|
|
|
|
+ const textArea = document.createElement("textarea");
|
|
|
|
|
+ textArea.value = getStorageSync("vipInfo").user_name;
|
|
|
|
|
+ textArea.style.position = "fixed";
|
|
|
|
|
+ textArea.style.left = "-999999px";
|
|
|
|
|
+ textArea.style.top = "-999999px";
|
|
|
|
|
+ document.body.appendChild(textArea);
|
|
|
|
|
+ textArea.focus();
|
|
|
|
|
+ textArea.select();
|
|
|
|
|
+
|
|
|
|
|
+ const successful = document.execCommand("copy");
|
|
|
|
|
+ document.body.removeChild(textArea);
|
|
|
|
|
+
|
|
|
|
|
+ if (successful) {
|
|
|
|
|
+ showToast({
|
|
|
|
|
+ title: "账号已复制",
|
|
|
|
|
+ duration: 2000,
|
|
|
|
|
+ icon: "none",
|
|
|
|
|
+ });
|
|
|
|
|
+ } else {
|
|
|
|
|
+ showToast({
|
|
|
|
|
+ title: "复制失败,请手动复制",
|
|
|
|
|
+ duration: 2000,
|
|
|
|
|
+ icon: "none",
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ } catch (error) {
|
|
|
|
|
+ console.error("复制失败:", error);
|
|
|
|
|
+ showToast({
|
|
|
|
|
+ title: "复制失败,请手动复制",
|
|
|
|
|
+ duration: 2000,
|
|
|
|
|
+ icon: "none",
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+ };
|
|
|
|
|
+
|
|
|
|
|
+ copyText();
|
|
|
|
|
+ };
|
|
|
|
|
+
|
|
|
// 获取帖子列表
|
|
// 获取帖子列表
|
|
|
const getPostList = async (
|
|
const getPostList = async (
|
|
|
isRefresh: boolean = false,
|
|
isRefresh: boolean = false,
|
|
@@ -218,13 +300,17 @@ const Self = () => {
|
|
|
return (
|
|
return (
|
|
|
<>
|
|
<>
|
|
|
<NavBar
|
|
<NavBar
|
|
|
- back={<></>}
|
|
|
|
|
|
|
+ back={
|
|
|
|
|
+ <View className="flex items-center">
|
|
|
|
|
+ <ArrowLeft />
|
|
|
|
|
+ 返回
|
|
|
|
|
+ </View>
|
|
|
|
|
+ }
|
|
|
onBackClick={(e) => {
|
|
onBackClick={(e) => {
|
|
|
- e.preventDefault();
|
|
|
|
|
- navigateBack({ delta: 1 });
|
|
|
|
|
|
|
+ navigateTo({ url: "/pages/index/index" });
|
|
|
}}
|
|
}}
|
|
|
>
|
|
>
|
|
|
- 消息
|
|
|
|
|
|
|
+ {userId ? "用户主页" : "我的"}
|
|
|
</NavBar>
|
|
</NavBar>
|
|
|
|
|
|
|
|
<View className="min-h-screen bg-[#f7f8fa]">
|
|
<View className="min-h-screen bg-[#f7f8fa]">
|
|
@@ -233,30 +319,68 @@ const Self = () => {
|
|
|
<View className="flex items-center">
|
|
<View className="flex items-center">
|
|
|
<View className="w-[50px] h-[50px] bg-[#1874d0] rounded-[50%] overflow-hidden">
|
|
<View className="w-[50px] h-[50px] bg-[#1874d0] rounded-[50%] overflow-hidden">
|
|
|
<Image
|
|
<Image
|
|
|
- src={userInfo.avatar_url}
|
|
|
|
|
|
|
+ src={userInfo.avatar_url || avatar}
|
|
|
width="100%"
|
|
width="100%"
|
|
|
height="100%"
|
|
height="100%"
|
|
|
mode="aspectFill"
|
|
mode="aspectFill"
|
|
|
/>
|
|
/>
|
|
|
</View>
|
|
</View>
|
|
|
- <View className="flex-1 ml-[10px]">
|
|
|
|
|
|
|
+ <View className="ml-[10px]">
|
|
|
<View className="text-[16px] font-bold">
|
|
<View className="text-[16px] font-bold">
|
|
|
- {userInfo.username || userInfo.nickname}
|
|
|
|
|
|
|
+ <View>{userInfo.nickname || userInfo.username}</View>
|
|
|
|
|
+ {userId ? (
|
|
|
|
|
+ <></>
|
|
|
|
|
+ ) : (
|
|
|
|
|
+ <View>
|
|
|
|
|
+ <Text className="text-[14px] text-[#949494]">
|
|
|
|
|
+ 账号:{getStorageSync("vipInfo")?.user_name || ""}
|
|
|
|
|
+ </Text>
|
|
|
|
|
+ <Text
|
|
|
|
|
+ onClick={handleCopyUserName}
|
|
|
|
|
+ className="text-[#1874d0] text-[14px] ml-[10px]"
|
|
|
|
|
+ >
|
|
|
|
|
+ 复制
|
|
|
|
|
+ </Text>
|
|
|
|
|
+ </View>
|
|
|
|
|
+ )}
|
|
|
</View>
|
|
</View>
|
|
|
</View>
|
|
</View>
|
|
|
</View>
|
|
</View>
|
|
|
- <View>
|
|
|
|
|
|
|
+ <View className="w-[80px]">
|
|
|
{userId ? (
|
|
{userId ? (
|
|
|
<></>
|
|
<></>
|
|
|
) : (
|
|
) : (
|
|
|
<>
|
|
<>
|
|
|
- <Setting
|
|
|
|
|
|
|
+ {/* <Setting
|
|
|
className="mr-[10px]"
|
|
className="mr-[10px]"
|
|
|
size={18}
|
|
size={18}
|
|
|
onClick={() => {
|
|
onClick={() => {
|
|
|
navigateTo({ url: "/pages/self/setting/index" });
|
|
navigateTo({ url: "/pages/self/setting/index" });
|
|
|
}}
|
|
}}
|
|
|
- />
|
|
|
|
|
|
|
+ /> */}
|
|
|
|
|
+ <Button
|
|
|
|
|
+ type="primary"
|
|
|
|
|
+ size="small"
|
|
|
|
|
+ onClick={() => {
|
|
|
|
|
+ setShowBottom(true);
|
|
|
|
|
+ // navigateTo({ url: "/pages/self/setting/index" });
|
|
|
|
|
+ }}
|
|
|
|
|
+ >
|
|
|
|
|
+ 修改密码
|
|
|
|
|
+ </Button>
|
|
|
|
|
+ {userId ? (
|
|
|
|
|
+ <></>
|
|
|
|
|
+ ) : (
|
|
|
|
|
+ <Button
|
|
|
|
|
+ size="small"
|
|
|
|
|
+ type="danger"
|
|
|
|
|
+ onClick={() => {
|
|
|
|
|
+ handleLogout();
|
|
|
|
|
+ }}
|
|
|
|
|
+ >
|
|
|
|
|
+ 退出登录
|
|
|
|
|
+ </Button>
|
|
|
|
|
+ )}
|
|
|
{/* <Badge top="2" right="8" value={userInfo.notification_count}>
|
|
{/* <Badge top="2" right="8" value={userInfo.notification_count}>
|
|
|
<Notice
|
|
<Notice
|
|
|
onClick={() => {
|
|
onClick={() => {
|
|
@@ -308,171 +432,193 @@ const Self = () => {
|
|
|
</View>
|
|
</View>
|
|
|
</View> */}
|
|
</View> */}
|
|
|
</View>
|
|
</View>
|
|
|
- <View className="mt-[10px]">
|
|
|
|
|
- {/* <Tabs
|
|
|
|
|
- className="tabs-self"
|
|
|
|
|
- align="left"
|
|
|
|
|
- value={tab1value}
|
|
|
|
|
- onChange={(value) => {
|
|
|
|
|
- setTab1value(value);
|
|
|
|
|
- }}
|
|
|
|
|
- >
|
|
|
|
|
- <Tabs.TabPane title="帖子">
|
|
|
|
|
- <ScrollView
|
|
|
|
|
- scrollY
|
|
|
|
|
- style={{ height: `${scrollHeight}px` }}
|
|
|
|
|
- onScrollToLower={loadMore}
|
|
|
|
|
- refresherEnabled
|
|
|
|
|
- refresherTriggered={refreshing}
|
|
|
|
|
- onRefresherRefresh={onRefresh}
|
|
|
|
|
- lowerThreshold={50}
|
|
|
|
|
- className="bg-[#f7f8fa]"
|
|
|
|
|
- >
|
|
|
|
|
- {postList.map((item) => (
|
|
|
|
|
- <View
|
|
|
|
|
- className="post-list-item bg-[#fff] p-[10px] mt-[10px]"
|
|
|
|
|
- onClick={() =>
|
|
|
|
|
- navigateTo({ url: `/pages/detail/index?id=${item.id}` })
|
|
|
|
|
- }
|
|
|
|
|
- >
|
|
|
|
|
- <View className="flex items-center justify-between">
|
|
|
|
|
- <View className="flex items-center">
|
|
|
|
|
|
|
+ {userId ? (
|
|
|
|
|
+ <View className="mt-[10px]">
|
|
|
|
|
+ <Tabs
|
|
|
|
|
+ className="tabs-self"
|
|
|
|
|
+ align="left"
|
|
|
|
|
+ value={tab1value}
|
|
|
|
|
+ onChange={(value) => {
|
|
|
|
|
+ setTab1value(value);
|
|
|
|
|
+ }}
|
|
|
|
|
+ >
|
|
|
|
|
+ <Tabs.TabPane title="帖子">
|
|
|
|
|
+ <ScrollView
|
|
|
|
|
+ scrollY
|
|
|
|
|
+ style={{ height: `${scrollHeight}px` }}
|
|
|
|
|
+ onScrollToLower={loadMore}
|
|
|
|
|
+ refresherEnabled
|
|
|
|
|
+ refresherTriggered={refreshing}
|
|
|
|
|
+ onRefresherRefresh={onRefresh}
|
|
|
|
|
+ lowerThreshold={50}
|
|
|
|
|
+ className="bg-[#f7f8fa]"
|
|
|
|
|
+ >
|
|
|
|
|
+ {postList.map((item) => (
|
|
|
|
|
+ <View
|
|
|
|
|
+ className="post-list-item bg-[#fff] p-[10px] mt-[10px]"
|
|
|
|
|
+ onClick={() =>
|
|
|
|
|
+ navigateTo({ url: `/pages/detail/index?id=${item.id}` })
|
|
|
|
|
+ }
|
|
|
|
|
+ >
|
|
|
|
|
+ <View className="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: item.user.avatar_url
|
|
|
|
|
+ ? `url('${item.user.avatar_url}')`
|
|
|
|
|
+ : `url('${avatar}')`,
|
|
|
|
|
+ }}
|
|
|
|
|
+ ></View>
|
|
|
|
|
+ <View className="ml-[10rpx]">
|
|
|
|
|
+ <View className="text-[14px] font-[800] text-[#9c9dee]">
|
|
|
|
|
+ {item.user.nickname || "微信用户"}
|
|
|
|
|
+ </View>
|
|
|
|
|
+ {item.user.is_official ? (
|
|
|
|
|
+ <View className="text-[12px] text-[#949494]">
|
|
|
|
|
+ 官方账号
|
|
|
|
|
+ </View>
|
|
|
|
|
+ ) : (
|
|
|
|
|
+ <></>
|
|
|
|
|
+ )}
|
|
|
|
|
+ </View>
|
|
|
|
|
+ </View>
|
|
|
|
|
+ </View>
|
|
|
|
|
+ <View className="text-[14px] text-[#333] pt-[10px]">
|
|
|
|
|
+ {item.type === "1" ? (
|
|
|
|
|
+ <>
|
|
|
|
|
+ {strSlice(item.content, 100)}
|
|
|
|
|
+ {item.content.length > 100 && (
|
|
|
|
|
+ <Text className="text-[#1874d0]">全文</Text>
|
|
|
|
|
+ )}
|
|
|
|
|
+ </>
|
|
|
|
|
+ ) : (
|
|
|
|
|
+ <>
|
|
|
|
|
+ <View
|
|
|
|
|
+ className="text-[14px] text-[#333]"
|
|
|
|
|
+ dangerouslySetInnerHTML={{
|
|
|
|
|
+ __html: strSlice(item.content, 100),
|
|
|
|
|
+ }}
|
|
|
|
|
+ ></View>
|
|
|
|
|
+ {item.content.length > 100 && (
|
|
|
|
|
+ <Text className="text-[#1874d0]">全文</Text>
|
|
|
|
|
+ )}
|
|
|
|
|
+ </>
|
|
|
|
|
+ )}
|
|
|
|
|
+ </View>
|
|
|
|
|
+ <View className="mt-[10px]">
|
|
|
|
|
+ <Grid
|
|
|
|
|
+ columns={item.media_url.length < 3 ? 2 : 3}
|
|
|
|
|
+ gap={7}
|
|
|
|
|
+ style={
|
|
|
|
|
+ {
|
|
|
|
|
+ "--nutui-grid-item-content-padding": "0px",
|
|
|
|
|
+ "--nutui-grid-item-content-margin": "0px",
|
|
|
|
|
+ } as any
|
|
|
|
|
+ }
|
|
|
|
|
+ >
|
|
|
|
|
+ {item.media_url.map((ite: any, index: number) => {
|
|
|
|
|
+ return (
|
|
|
|
|
+ <GridItem>
|
|
|
|
|
+ <Image
|
|
|
|
|
+ width="100%"
|
|
|
|
|
+ height="100px"
|
|
|
|
|
+ src={ite.src}
|
|
|
|
|
+ mode="widthFix"
|
|
|
|
|
+ onClick={(e) => {
|
|
|
|
|
+ e.stopPropagation();
|
|
|
|
|
+ setMediaUrl(item.media_url);
|
|
|
|
|
+ setInit(index + 1);
|
|
|
|
|
+
|
|
|
|
|
+ setShowPreview(true);
|
|
|
|
|
+ }}
|
|
|
|
|
+ />
|
|
|
|
|
+ </GridItem>
|
|
|
|
|
+ );
|
|
|
|
|
+ })}
|
|
|
|
|
+ </Grid>
|
|
|
|
|
+ </View>
|
|
|
|
|
+ <View className="mt-[10px] pl-[20px] pr-[20px] flex items-center justify-between">
|
|
|
|
|
+ <View className="flex items-center">
|
|
|
|
|
+ <Message size={16} color="#949494" />
|
|
|
|
|
+ <Text className="ml-[5px] text-[16px] text-[#949494]">
|
|
|
|
|
+ {item.comment_count}
|
|
|
|
|
+ </Text>
|
|
|
|
|
+ </View>
|
|
|
<View
|
|
<View
|
|
|
- className="w-[40px] h-[40px] rounded-[50%] bg-[#000] overflow-hidden bg-cover bg-center"
|
|
|
|
|
- style={{
|
|
|
|
|
- backgroundImage: item.user.avatar_url
|
|
|
|
|
- ? `url('${item.user.avatar_url}')`
|
|
|
|
|
- : "none",
|
|
|
|
|
|
|
+ className="flex items-center"
|
|
|
|
|
+ onClick={(e) => {
|
|
|
|
|
+ e.stopPropagation();
|
|
|
|
|
+ handleInteraction(
|
|
|
|
|
+ item.id,
|
|
|
|
|
+ item.interaction_type === "praise"
|
|
|
|
|
+ ? "dispraise"
|
|
|
|
|
+ : "praise"
|
|
|
|
|
+ );
|
|
|
}}
|
|
}}
|
|
|
- ></View>
|
|
|
|
|
- <View className="ml-[10rpx]">
|
|
|
|
|
- <View className="text-[14px] font-[800] text-[#9c9dee]">
|
|
|
|
|
- {item.user.nickname || "微信用户"}
|
|
|
|
|
- </View>
|
|
|
|
|
- {item.user.is_official ? (
|
|
|
|
|
- <View className="text-[12px] text-[#949494]">
|
|
|
|
|
- 《心动女友》官方账号
|
|
|
|
|
- </View>
|
|
|
|
|
|
|
+ >
|
|
|
|
|
+ {item.interaction_type === "praise" ? (
|
|
|
|
|
+ <HeartFill size={16} color="#ec4342" />
|
|
|
) : (
|
|
) : (
|
|
|
- <></>
|
|
|
|
|
|
|
+ <Heart size={16} color="#949494" />
|
|
|
)}
|
|
)}
|
|
|
|
|
+ <Text className="ml-[5px] text-[16px] text-[#949494]">
|
|
|
|
|
+ {item.like_count}
|
|
|
|
|
+ </Text>
|
|
|
</View>
|
|
</View>
|
|
|
</View>
|
|
</View>
|
|
|
</View>
|
|
</View>
|
|
|
- <View className="text-[14px] text-[#333] pt-[10px]">
|
|
|
|
|
- {strSlice(item.content, 100)}
|
|
|
|
|
- {item.content.length > 100 && (
|
|
|
|
|
- <Text className="text-[#1874d0]">全文</Text>
|
|
|
|
|
- )}
|
|
|
|
|
- </View>
|
|
|
|
|
- <View className="mt-[10px]">
|
|
|
|
|
- <Grid
|
|
|
|
|
- columns={item.media_url.length < 3 ? 2 : 3}
|
|
|
|
|
- gap={7}
|
|
|
|
|
- style={
|
|
|
|
|
- {
|
|
|
|
|
- "--nutui-grid-item-content-padding": "0px",
|
|
|
|
|
- "--nutui-grid-item-content-margin": "0px",
|
|
|
|
|
- } as any
|
|
|
|
|
- }
|
|
|
|
|
- >
|
|
|
|
|
- {item.media_url.map((ite: any, index: number) => {
|
|
|
|
|
- return (
|
|
|
|
|
- <GridItem>
|
|
|
|
|
- <Image
|
|
|
|
|
- width="100%"
|
|
|
|
|
- height="100px"
|
|
|
|
|
- src={ite.src}
|
|
|
|
|
- mode="widthFix"
|
|
|
|
|
- onClick={(e) => {
|
|
|
|
|
- e.stopPropagation();
|
|
|
|
|
- setMediaUrl(item.media_url);
|
|
|
|
|
- setInit(index + 1);
|
|
|
|
|
|
|
+ ))}
|
|
|
|
|
|
|
|
- setShowPreview(true);
|
|
|
|
|
- }}
|
|
|
|
|
- />
|
|
|
|
|
- </GridItem>
|
|
|
|
|
- );
|
|
|
|
|
- })}
|
|
|
|
|
- </Grid>
|
|
|
|
|
- </View>
|
|
|
|
|
- <View className="mt-[10px] pl-[20px] pr-[20px] flex items-center justify-between">
|
|
|
|
|
- <View className="flex items-center">
|
|
|
|
|
- <Message size={16} color="#949494" />
|
|
|
|
|
- <Text className="ml-[5px] text-[16px] text-[#949494]">
|
|
|
|
|
- {item.comment_count}
|
|
|
|
|
- </Text>
|
|
|
|
|
- </View>
|
|
|
|
|
|
|
+ {error && (
|
|
|
|
|
+ <View className="p-[20px] text-center">
|
|
|
|
|
+ <View className="text-[#ff4d4f] mb-[10px]">{error}</View>
|
|
|
<View
|
|
<View
|
|
|
- className="flex items-center"
|
|
|
|
|
- onClick={(e) => {
|
|
|
|
|
- e.stopPropagation();
|
|
|
|
|
- handleInteraction(
|
|
|
|
|
- item.id,
|
|
|
|
|
- item.interaction_type === "praise"
|
|
|
|
|
- ? "dispraise"
|
|
|
|
|
- : "praise"
|
|
|
|
|
- );
|
|
|
|
|
- }}
|
|
|
|
|
|
|
+ className="text-[#1874d0] underline cursor-pointer"
|
|
|
|
|
+ onClick={() => getPostList()}
|
|
|
>
|
|
>
|
|
|
- {item.interaction_type === "praise" ? (
|
|
|
|
|
- <HeartFill size={16} color="#ec4342" />
|
|
|
|
|
- ) : (
|
|
|
|
|
- <Heart size={16} color="#949494" />
|
|
|
|
|
- )}
|
|
|
|
|
- <Text className="ml-[5px] text-[16px] text-[#949494]">
|
|
|
|
|
- {item.like_count}
|
|
|
|
|
- </Text>
|
|
|
|
|
|
|
+ 点击重试
|
|
|
</View>
|
|
</View>
|
|
|
</View>
|
|
</View>
|
|
|
- </View>
|
|
|
|
|
- ))}
|
|
|
|
|
|
|
+ )}
|
|
|
|
|
|
|
|
-
|
|
|
|
|
- {error && (
|
|
|
|
|
- <View className="p-[20px] text-center">
|
|
|
|
|
- <View className="text-[#ff4d4f] mb-[10px]">{error}</View>
|
|
|
|
|
- <View
|
|
|
|
|
- className="text-[#1874d0] underline cursor-pointer"
|
|
|
|
|
- onClick={() => getPostList()}
|
|
|
|
|
- >
|
|
|
|
|
- 点击重试
|
|
|
|
|
|
|
+ {loadingMore && (
|
|
|
|
|
+ <View className="p-[20px] text-[14px] text-center text-[#999]">
|
|
|
|
|
+ 加载更多...
|
|
|
</View>
|
|
</View>
|
|
|
- </View>
|
|
|
|
|
- )}
|
|
|
|
|
|
|
+ )}
|
|
|
|
|
|
|
|
-
|
|
|
|
|
- {loadingMore && (
|
|
|
|
|
- <View className="p-[20px] text-center text-[#999]">
|
|
|
|
|
- 加载更多...
|
|
|
|
|
- </View>
|
|
|
|
|
- )}
|
|
|
|
|
|
|
+ {!hasMore &&
|
|
|
|
|
+ postList.length > 0 &&
|
|
|
|
|
+ !loading &&
|
|
|
|
|
+ !refreshing && (
|
|
|
|
|
+ <View className="p-[20px] text-[14px] text-center text-[#999]">
|
|
|
|
|
+ 没有更多内容了
|
|
|
|
|
+ </View>
|
|
|
|
|
+ )}
|
|
|
|
|
|
|
|
-
|
|
|
|
|
- {!hasMore && postList.length > 0 && !loading && !refreshing && (
|
|
|
|
|
- <View className="p-[20px] text-center text-[#999]">
|
|
|
|
|
- 没有更多内容了
|
|
|
|
|
- </View>
|
|
|
|
|
- )}
|
|
|
|
|
|
|
+ {!loading &&
|
|
|
|
|
+ !refreshing &&
|
|
|
|
|
+ postList.length === 0 &&
|
|
|
|
|
+ !error && (
|
|
|
|
|
+ <View className="p-[40px] text-[14px] text-center text-[#999]">
|
|
|
|
|
+ 暂无帖子
|
|
|
|
|
+ </View>
|
|
|
|
|
+ )}
|
|
|
|
|
|
|
|
-
|
|
|
|
|
- {!loading && !refreshing && postList.length === 0 && !error && (
|
|
|
|
|
- <View className="p-[40px] text-center text-[#999]">
|
|
|
|
|
- 暂无帖子
|
|
|
|
|
- </View>
|
|
|
|
|
- )}
|
|
|
|
|
|
|
+ {loading && postList.length === 0 && (
|
|
|
|
|
+ <View className="p-[40px] text-[14px] text-center text-[#999]">
|
|
|
|
|
+ 加载中...
|
|
|
|
|
+ </View>
|
|
|
|
|
+ )}
|
|
|
|
|
+ </ScrollView>
|
|
|
|
|
+ </Tabs.TabPane>
|
|
|
|
|
+ </Tabs>
|
|
|
|
|
+ </View>
|
|
|
|
|
+ ) : (
|
|
|
|
|
+ <></>
|
|
|
|
|
+ )}
|
|
|
|
|
|
|
|
-
|
|
|
|
|
- {loading && postList.length === 0 && (
|
|
|
|
|
- <View className="p-[40px] text-center text-[#999]">
|
|
|
|
|
- 加载中...
|
|
|
|
|
- </View>
|
|
|
|
|
- )}
|
|
|
|
|
- </ScrollView>
|
|
|
|
|
- </Tabs.TabPane>
|
|
|
|
|
- </Tabs> */}
|
|
|
|
|
- </View>
|
|
|
|
|
<ImagePreview
|
|
<ImagePreview
|
|
|
images={mediaUrl}
|
|
images={mediaUrl}
|
|
|
visible={showPreview}
|
|
visible={showPreview}
|
|
@@ -481,21 +627,27 @@ const Self = () => {
|
|
|
indicator
|
|
indicator
|
|
|
/>
|
|
/>
|
|
|
</View>
|
|
</View>
|
|
|
- <View className="bg-[#fff] fixed bottom-[0px] left-[0px] right-[0px] w-full">
|
|
|
|
|
- <Tabbar
|
|
|
|
|
- defaultValue={1}
|
|
|
|
|
- onSwitch={(value) => {
|
|
|
|
|
- if (value === 1) {
|
|
|
|
|
- redirectTo({ url: "/pages/self/index" });
|
|
|
|
|
- } else {
|
|
|
|
|
- redirectTo({ url: "/pages/index/index" });
|
|
|
|
|
- }
|
|
|
|
|
- }}
|
|
|
|
|
- >
|
|
|
|
|
- <Tabbar.Item title="首页" icon={<Home width={20} height={20} />} />
|
|
|
|
|
- <Tabbar.Item title="我的" icon={<User width={20} height={20} />} />
|
|
|
|
|
- </Tabbar>
|
|
|
|
|
- </View>
|
|
|
|
|
|
|
+
|
|
|
|
|
+ {userId ? (
|
|
|
|
|
+ <></>
|
|
|
|
|
+ ) : (
|
|
|
|
|
+ <View className="bg-[#fff] fixed bottom-[0px] left-[0px] right-[0px] w-full">
|
|
|
|
|
+ <Tabbar
|
|
|
|
|
+ defaultValue={1}
|
|
|
|
|
+ onSwitch={(value) => {
|
|
|
|
|
+ if (value === 1) {
|
|
|
|
|
+ redirectTo({ url: "/pages/self/index" });
|
|
|
|
|
+ } else {
|
|
|
|
|
+ redirectTo({ url: "/pages/index/index" });
|
|
|
|
|
+ }
|
|
|
|
|
+ }}
|
|
|
|
|
+ >
|
|
|
|
|
+ <Tabbar.Item title="首页" icon={<Home width={20} height={20} />} />
|
|
|
|
|
+ <Tabbar.Item title="我的" icon={<User width={20} height={20} />} />
|
|
|
|
|
+ </Tabbar>
|
|
|
|
|
+ </View>
|
|
|
|
|
+ )}
|
|
|
|
|
+ <ChangePassword showBottom={showBottom} setShowBottom={setShowBottom} />
|
|
|
</>
|
|
</>
|
|
|
);
|
|
);
|
|
|
};
|
|
};
|