Bladeren bron

礼包领取

ith5 3 maanden geleden
bovenliggende
commit
4a5b61ddfd

BIN
src/asset/img/avatar.png


+ 160 - 0
src/components/change-password/index.tsx

@@ -0,0 +1,160 @@
+import { Button, Form, Input, Popup } from "@nutui/nutui-react-taro";
+import { View } from "@tarojs/components";
+import { getStorageSync, showToast } from "@tarojs/taro";
+import { useEffect, useState } from "react";
+import { sendChangePasswordCodeApi, changePasswordApi } from "../../api/auth";
+
+const ChangePassword = ({ showBottom, setShowBottom }: any) => {
+  const [form] = Form.useForm();
+  const [formData, setFormData] = useState({
+    user_name: "",
+    user_pwd: "",
+    phone: "",
+    code: "",
+  });
+
+  const [countdown, setCountdown] = useState(0);
+
+  // 获取验证码
+  const handleGetCode = async () => {
+    if (countdown > 0) return;
+
+    if (!formData.phone) {
+      showToast({
+        icon: "none",
+        title: "请输入手机号码",
+        duration: 2000,
+      });
+      return;
+    }
+
+    // 校验手机号格式
+    const phoneRegex = /^1[3-9]\d{9}$/;
+    if (!phoneRegex.test(formData.phone)) {
+      showToast({
+        icon: "none",
+        title: "请输入正确的手机号",
+      });
+      return;
+    }
+    try {
+      // 调用发送验证码接口
+      await sendChangePasswordCodeApi({
+        phone: formData.phone,
+      });
+
+      // 这里可以调用发送验证码的API
+      showToast({
+        title: "验证码已发送",
+        duration: 2000,
+        icon: "none",
+      });
+      setCountdown(60);
+    } catch (error: any) {
+      showToast({
+        title: error.message,
+        duration: 2000,
+        icon: "none",
+      });
+    }
+  };
+
+  const handleSubmit = async (data: any) => {
+    await changePasswordApi({
+      user_name: data.user_name,
+      user_pwd: data.user_pwd,
+      phone: data.phone,
+      code: data.code.detail.value,
+    });
+    showToast({
+      title: "修改密码成功",
+      duration: 2000,
+      icon: "none",
+    });
+    setShowBottom(false);
+  };
+
+  useEffect(() => {
+    let info = getStorageSync("vipInfo");
+    setFormData({
+      user_name: info.user_name,
+      phone: info.phone,
+      code: "",
+      user_pwd: "",
+    });
+    form.setFieldValue("user_name", info.user_name);
+    form.setFieldValue("phone", info.phone);
+  }, [showBottom]);
+
+  return (
+    <Popup
+      visible={showBottom}
+      position="bottom"
+      onClose={() => {
+        setShowBottom(false);
+      }}
+    >
+      <View>
+        <Form form={form} onFinish={(data) => handleSubmit(data)}>
+          <Form.Item label="账号" name="user_name">
+            <Input
+              placeholder="请输入账号"
+              readOnly={true}
+              value={formData.user_name}
+              onChange={(value) =>
+                setFormData({ ...formData, user_name: value })
+              }
+            />
+          </Form.Item>
+          <Form.Item label="新密码" name="user_pwd">
+            <Input
+              placeholder="请输入新密码"
+              value={formData.user_pwd}
+              onChange={(value) =>
+                setFormData({ ...formData, user_pwd: value })
+              }
+            />
+          </Form.Item>
+          <Form.Item label="手机号码" name="phone">
+            <Input
+              placeholder="请输入手机号码"
+              readOnly={true}
+              value={formData.phone}
+              onChange={(value) => setFormData({ ...formData, phone: value })}
+            />
+          </Form.Item>
+          <Form.Item label="验证码" name="code">
+            <View className="flex items-center">
+              <Input
+                placeholder="请输入验证码"
+                value={formData.code}
+                onChange={(value) => setFormData({ ...formData, code: value })}
+              />
+              <Button
+                className="w-[100px] h-[40px] text-[14px] text-[#333]"
+                disabled={countdown > 0}
+                onClick={handleGetCode}
+                size="small"
+                type="primary"
+              >
+                {countdown > 0 ? `${countdown}s` : "获取验证码"}
+              </Button>
+            </View>
+          </Form.Item>
+          <Form.Item>
+            <Button
+              block
+              type="primary"
+              size="large"
+              onClick={() => form.submit}
+            >
+              提交
+            </Button>
+          </Form.Item>
+        </Form>
+      </View>
+    </Popup>
+  );
+};
+
+export default ChangePassword;

+ 2 - 1
src/components/comment-list/item.tsx

@@ -1,6 +1,7 @@
 import { Text, View } from "@tarojs/components";
 import { timeFormat } from "../../utils/index";
 import CommentInput from "./comment-input";
+import avatar from "../../asset/img/avatar.png";
 import { useState } from "react";
 
 const CommentListItem = ({ commentData, isChild = false }) => {
@@ -34,7 +35,7 @@ const CommentListItem = ({ commentData, isChild = false }) => {
                     style={{
                       backgroundImage: item.avatar_url
                         ? `url('${item.avatar_url}')`
-                        : "none",
+                        : `url('${avatar}')`,
                     }}
                   ></View>
                 </View>

+ 13 - 18
src/components/game-intro/index.tsx

@@ -102,85 +102,80 @@ const GameIntro = (props) => {
             <View className="text-[12px] text-[#949494]">年龄分级</View>
           </View>
         </View>
-        <View className="w-full h-[427px] p-[10px]">
+        <View className="w-full p-[10px]">
           <ScrollView className="w-full h-full" scrollX showScrollbar={false}>
             <View className="flex">
               <View
                 style={{
                   width: "250px",
-                  height: "427px",
+                  height: "327px",
                   marginRight: "10px",
                 }}
               >
                 <img
                   src={banner1}
-                  width="250px"
-                  height="427px"
+                  height="327px"
                   style={{ objectFit: "cover", borderRadius: "10px" }}
                 />
               </View>
               <View
                 style={{
                   width: "250px",
-                  height: "427px",
+                  height: "327px",
                   marginRight: "10px",
                 }}
               >
                 <img
                   src={banner2}
-                  width="250px"
-                  height="427px"
+                  height="327px"
                   style={{ objectFit: "cover", borderRadius: "10px" }}
                 />
               </View>
               <View
                 style={{
                   width: "250px",
-                  height: "427px",
+                  height: "327px",
                   marginRight: "10px",
                 }}
               >
                 <img
                   src={banner3}
-                  width="250px"
-                  height="427px"
+                  height="327px"
                   style={{ objectFit: "cover", borderRadius: "10px" }}
                 />
               </View>
               <View
                 style={{
                   width: "250px",
-                  height: "427px",
+                  height: "327px",
                   marginRight: "10px",
                 }}
               >
                 <img
                   src={banner4}
-                  width="250px"
-                  height="427px"
+                  height="327px"
                   style={{ objectFit: "cover", borderRadius: "10px" }}
                 />
               </View>
               <View
                 style={{
                   width: "250px",
-                  height: "427px",
+                  height: "327px",
                   marginRight: "10px",
                 }}
               >
                 <img
                   src={banner5}
-                  width="250px"
-                  height="427px"
+                  height="327px"
                   style={{ objectFit: "cover", borderRadius: "10px" }}
                 />
               </View>
             </View>
           </ScrollView>
-          <View className="text-[12px] text-[#949494]">
+          <View className="text-[12px] mt-[10px] text-[#949494]">
             版本号:1.0.0 更新时间:2025-09-19
           </View>
-          <View className="px-[10px]">
+          <View className="px-[10px] mt-[10px] pb-[30px]">
             <Button
               block
               size="large"

+ 3 - 2
src/components/post-list/index copy.tsx

@@ -1,5 +1,6 @@
 import { Text, View, ScrollView } from "@tarojs/components";
 import { Heart, HeartFill, Plus } from "@nutui/icons-react-taro";
+import avatar from "../../asset/img/avatar.png";
 import { Message } from "@nutui/icons-react-taro";
 import {
   Grid,
@@ -191,7 +192,7 @@ const PostList = () => {
                     style={{
                       backgroundImage: item.user.avatar_url
                         ? `url('${item.user.avatar_url}')`
-                        : "none",
+                        : `url('${avatar}')`,
                     }}
                   ></View>
                   <View className="ml-[5px]">
@@ -200,7 +201,7 @@ const PostList = () => {
                     </View>
                     {item.user.is_official ? (
                       <View className="text-[12px] text-[#949494]">
-                        《心动女友》官方账号
+                        官方账号
                       </View>
                     ) : (
                       <></>

+ 9 - 6
src/components/post-list/index.tsx

@@ -1,6 +1,7 @@
 import { Text, View, ScrollView } from "@tarojs/components";
 import { Heart, HeartFill, Plus } from "@nutui/icons-react-taro";
 import { Message } from "@nutui/icons-react-taro";
+import avatar from "../../asset/img/avatar.png";
 import {
   Grid,
   GridItem,
@@ -21,7 +22,7 @@ import {
 import { strSlice } from "../../utils/index";
 import { followApi, interactionApi, unfollowApi } from "../../api/interaction";
 import { Dialog } from "@nutui/nutui-react-taro";
-import { navigateTo } from "@tarojs/taro";
+import { getStorageSync, navigateTo } from "@tarojs/taro";
 
 interface PostListProps {
   style?: any;
@@ -54,8 +55,9 @@ const PostList = forwardRef<PostListRef, PostListProps>(({ style }, ref) => {
         setLoading(true);
       }
       try {
+        let circleInfo = getStorageSync("circleInfo");
         const res: any = await circlePostListApi({
-          circleId: 1,
+          circleId: circleInfo.id,
           page,
           pageSize: pageSize,
         });
@@ -125,11 +127,12 @@ const PostList = forwardRef<PostListRef, PostListProps>(({ style }, ref) => {
       const data = [...postList];
       data.forEach((item: any) => {
         if (item.id === postId) {
-          item.interaction_type = type;
+          item.is_praised = type === "praise" ? true : false;
           item.like_count =
             type === "praise" ? item.like_count + 1 : item.like_count - 1;
         }
       });
+      console.log(data);
       setPostList(data);
     }
   };
@@ -209,16 +212,16 @@ const PostList = forwardRef<PostListRef, PostListProps>(({ style }, ref) => {
                     style={{
                       backgroundImage: item.user.avatar_url
                         ? `url('${item.user.avatar_url}')`
-                        : "none",
+                        : `url('${avatar}')`,
                     }}
                   ></View>
                   <View className="ml-[5px]">
                     <View className="text-[14px] font-[800] text-[#9c9dee]">
                       {item.user.nickname || item.user.username || "微信用户"}
                     </View>
-                    {item.user.is_officia ? (
+                    {item.user.is_official ? (
                       <View className="text-[12px] text-[#949494]">
-                        《心动女友》官方账号
+                        官方账号
                       </View>
                     ) : (
                       <></>

+ 3 - 4
src/pages/detail/index.tsx

@@ -2,6 +2,7 @@ import { ScrollView, View } from "@tarojs/components";
 import { pxTransform, useLoad, navigateBack } from "@tarojs/taro";
 import { useState } from "react";
 import { ArrowLeft, Plus } from "@nutui/icons-react-taro";
+import avatar from "../../asset/img/avatar.png";
 import { Text } from "@tarojs/components";
 import "./index.scss";
 import {
@@ -98,7 +99,7 @@ const Detail = () => {
               style={{
                 backgroundImage: postData.user.avatar_url
                   ? `url('${postData.user.avatar_url}')`
-                  : "none",
+                  : `url('${avatar}')`,
               }}
             ></View>
             <View className="ml-[10rpx]">
@@ -106,9 +107,7 @@ const Detail = () => {
                 {postData.user.nickname || "微信用户"}
               </View>
               {postData.user.is_official ? (
-                <View className="text-[12px] text-[#949494]">
-                  《心动女友》官方账号
-                </View>
+                <View className="text-[12px] text-[#949494]">官方账号</View>
               ) : (
                 <></>
               )}

+ 57 - 7
src/pages/gift/index.tsx

@@ -1,4 +1,4 @@
-import { NavBar } from "@nutui/nutui-react-taro";
+import { NavBar, Picker, Popup } from "@nutui/nutui-react-taro";
 import { View } from "@tarojs/components";
 import { ArrowLeft } from "@nutui/icons-react-taro";
 import { getStorageSync, navigateBack } from "@tarojs/taro";
@@ -7,25 +7,36 @@ import {
   receiveVipCustomersGiftApi,
 } from "../../api/gift";
 import { useEffect, useState } from "react";
+import { getVipUserRoleListApi } from "../../api/user";
 
 const Gift = () => {
-  const [giftList, setGiftList] = useState([]);
+  const [giftList, setGiftList] = useState<any>([]);
+  const [roleList, setRoleList] = useState<any>([]);
+  const [roleInfo, setRoleInfo] = useState<any>(null);
+  const [showRolePopup, setShowRolePopup] = useState(false);
 
   const getGiftList = async () => {
     // 圈子id 从本地存储中获取
-    const mainId = getStorageSync("vipInfo").game_id;
+    const mainId = getStorageSync("circleInfo").main_id;
     if (!mainId) {
       return;
     }
 
-    const res: any = await getVipCustomersGiftListApi({ main_id: mainId });
+    const res: any = await getVipCustomersGiftListApi({
+      main_id: mainId,
+      user_name: getStorageSync("vipInfo").user_name,
+      role_id: roleInfo?.role_id,
+    });
     if (res.code === 200) {
       setGiftList(res.data);
     }
   };
 
   const getGift = async (item) => {
-    const res: any = await receiveVipCustomersGiftApi(item);
+    const res: any = await receiveVipCustomersGiftApi({
+      ...item,
+      role_id: roleInfo?.role_id,
+    });
     if (res.code === 200) {
       const data = [...giftList];
       data.forEach((ite: any) => {
@@ -37,9 +48,30 @@ const Gift = () => {
     }
   };
 
+  // 请求角色列表
+  const getRoleList = async () => {
+    const res: any = await getVipUserRoleListApi({});
+    if (res.code === 200) {
+      if (res.data.length) {
+        res.data.map((item) => {
+          item.text = item.role_name;
+          item.value = item.role_id;
+        });
+        setRoleList(res.data);
+      }
+
+      setRoleInfo(res.data[0]);
+    }
+  };
+
   useEffect(() => {
-    getGiftList();
+    getRoleList();
   }, []);
+  useEffect(() => {
+    if (roleInfo?.role_id) {
+      getGiftList();
+    }
+  }, [roleInfo]);
   return (
     <View>
       <NavBar
@@ -57,7 +89,17 @@ const Gift = () => {
       >
         礼包中心
       </NavBar>
-      <View className="pt-[60px]">
+      <View className="pt-[40px]">
+        <View className="cursor-pointer bg-[#5d66a7] h-[40px] line-height-[40px] text-[#fff] flex items-center justify-between px-[10px] border-b-[1px] border-[#f2f2f2] text-[14px]">
+          <View>{roleInfo?.role_name}</View>
+          <View
+            onClick={() => {
+              setShowRolePopup(true);
+            }}
+          >
+            切换角色
+          </View>
+        </View>
         {giftList.map((item: any) => (
           <View className="flex items-center justify-between px-[10px] border-b-[1px] border-[#f2f2f2] pb-[10px]">
             <View className="text-[14px]">
@@ -83,6 +125,14 @@ const Gift = () => {
           </View>
         ))}
       </View>
+      <Picker
+        title="请选择角色"
+        visible={showRolePopup}
+        options={roleList}
+        onClose={() => {
+          setShowRolePopup(false);
+        }}
+      ></Picker>
     </View>
   );
 };

+ 2 - 2
src/pages/index/index.scss

@@ -48,8 +48,8 @@
 // 页面内容容器
 .page-content {
   position: relative;
-  min-height: calc(100vh - 80px); // 最小高度 = 视窗高度 + 蓝色区域高度
-  padding-top: 80px;
+  min-height: calc(100vh - 70px); // 最小高度 = 视窗高度 + 蓝色区域高度
+  padding-top: 70px;
 }
 
 // PostList容器样式

+ 21 - 16
src/pages/index/index.tsx

@@ -1,5 +1,5 @@
 import { View } from "@tarojs/components";
-import { Gift, Home, User } from "@nutui/icons-react-taro";
+import { Gift, Home, User, List } from "@nutui/icons-react-taro";
 import { navigateTo, redirectTo, getStorageSync } from "@tarojs/taro";
 import PostList from "../../components/post-list";
 
@@ -21,7 +21,8 @@ function Index() {
   const containerTopRef = useRef<HTMLDivElement>(null);
   const [vipUserInfo, setVipUserInfo] = useState<any>(null);
   useEffect(() => {
-    getCircleInfoApi({ id: 1 }).then((res: any) => {
+    let circleInfo = getStorageSync("circleInfo");
+    getCircleInfoApi({ id: circleInfo.id }).then((res: any) => {
       setCircleData(res.data);
     });
     setVipUserInfo(getStorageSync("vipInfo"));
@@ -74,13 +75,14 @@ function Index() {
 
       <View className="page-content">
         {vipUserInfo && (
-          <View className="flex items-center justify-around w-[100%]">
+          <View className="flex items-center justify-around w-[100%] py-[10px]">
             <View
               className="text-[#fff] w-[28%] h-[30px] flex items-center justify-center text-center text-[12px]  rounded-[5px] font-[800] px-[10px] bg-[#5258acf0] "
               onClick={() => {
                 navigateTo({ url: "/pages/act/index" });
               }}
             >
+              <List size={16} className="mr-[5px]" />
               积分中心
             </View>
             <View
@@ -89,7 +91,7 @@ function Index() {
                 navigateTo({ url: "/pages/gift/index" });
               }}
             >
-              <Gift size={16} />
+              <Gift size={16} className="mr-[5px]" />
               礼包中心
             </View>
             {/* <View
@@ -117,28 +119,31 @@ function Index() {
               setTab1value(value);
             }}
           >
-            {vipUserInfo?.download_list && (
+            <TabPane title="官方咨讯" value="1">
+              <PostList
+                style={{
+                  height: vipUserInfo
+                    ? vipUserInfo.notice
+                      ? "calc(100vh - 250px)"
+                      : "calc(100vh - 224px)"
+                    : "calc(100vh - 180px)",
+                }}
+              />
+            </TabPane>
+            {vipUserInfo?.download_list.length > 0 && (
               <TabPane title="游戏介绍" value="0">
                 <GameIntro
                   style={{
                     height: vipUserInfo
-                      ? "calc(100vh - 260px)"
+                      ? vipUserInfo.notice
+                        ? "calc(100vh - 250px)"
+                        : "calc(100vh - 224px)"
                       : "calc(100vh - 180px)",
                   }}
                   vipUserInfo={vipUserInfo}
                 />
               </TabPane>
             )}
-
-            <TabPane title="官方咨讯" value="1">
-              <PostList
-                style={{
-                  height: vipUserInfo
-                    ? "calc(100vh - 260px)"
-                    : "calc(100vh - 180px)",
-                }}
-              />
-            </TabPane>
           </Tabs>
         </View>
         <View className="bg-[#fff] fixed bottom-[0px] left-[0px] right-[0px] w-full">

+ 324 - 172
src/pages/self/index.tsx

@@ -10,6 +10,7 @@ import {
   Setting,
   User,
 } from "@nutui/icons-react-taro";
+import avatar from "../../asset/img/avatar.png";
 import {
   Badge,
   Button,
@@ -30,6 +31,10 @@ import {
   useDidShow,
   navigateBack,
   useLoad,
+  getStorageSync,
+  showToast,
+  removeStorageSync,
+  showModal,
 } from "@tarojs/taro";
 import "./index.scss";
 import { useState, useEffect, useCallback } from "react";
@@ -37,6 +42,7 @@ import { strSlice } from "../../utils";
 import { followApi, interactionApi, unfollowApi } from "../../api/interaction";
 import { getUserPostListApi } from "../../api/post";
 import { getUserInfoApi } from "../../api/user";
+import ChangePassword from "../../components/change-password";
 const Self = () => {
   const [tab1value, setTab1value] = useState<string | number>("0");
   const [scrollHeight, setScrollHeight] = useState<number>(0);
@@ -49,6 +55,7 @@ const Self = () => {
   const [mediaUrl, setMediaUrl] = useState<any[]>([]);
   const [showPreview, setShowPreview] = useState(false);
   const [init, setInit] = useState(0);
+  const [showBottom, setShowBottom] = useState(false);
   const [userInfo, setUserInfo] = useState<any>({});
   const [pageConfig, setPageConfig] = useState({
     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 (
     isRefresh: boolean = false,
@@ -218,13 +300,17 @@ const Self = () => {
   return (
     <>
       <NavBar
-        back={<></>}
+        back={
+          <View className="flex items-center">
+            <ArrowLeft />
+            返回
+          </View>
+        }
         onBackClick={(e) => {
-          e.preventDefault();
-          navigateBack({ delta: 1 });
+          navigateTo({ url: "/pages/index/index" });
         }}
       >
-        消息
+        {userId ? "用户主页" : "我的"}
       </NavBar>
 
       <View className="min-h-screen bg-[#f7f8fa]">
@@ -233,30 +319,68 @@ const Self = () => {
             <View className="flex items-center">
               <View className="w-[50px] h-[50px] bg-[#1874d0] rounded-[50%] overflow-hidden">
                 <Image
-                  src={userInfo.avatar_url}
+                  src={userInfo.avatar_url || avatar}
                   width="100%"
                   height="100%"
                   mode="aspectFill"
                 />
               </View>
-              <View className="flex-1 ml-[10px]">
+              <View className="ml-[10px]">
                 <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 className="w-[80px]">
               {userId ? (
                 <></>
               ) : (
                 <>
-                  <Setting
+                  {/* <Setting
                     className="mr-[10px]"
                     size={18}
                     onClick={() => {
                       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}>
                     <Notice
                       onClick={() => {
@@ -308,171 +432,193 @@ const Self = () => {
             </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
-                          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 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
-                        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>
-                ))}
+                  )}
 
-              
-                {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>
-                )}
+                  )}
 
-              
-                {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
           images={mediaUrl}
           visible={showPreview}
@@ -481,21 +627,27 @@ const Self = () => {
           indicator
         />
       </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} />
     </>
   );
 };