ith5 4 hónapja
szülő
commit
69000bda3b
2 módosított fájl, 25 hozzáadás és 7 törlés
  1. 23 5
      src/pages/index/index.tsx
  2. 2 2
      src/pages/login/index.tsx

+ 23 - 5
src/pages/index/index.tsx

@@ -1,6 +1,6 @@
 import { View, Text } from "@tarojs/components";
 import { Plus, User } from "@nutui/icons-react-taro";
-import { navigateTo } from "@tarojs/taro";
+import { getStorageSync, navigateTo } from "@tarojs/taro";
 import PostList from "../../components/post-list";
 
 import "./index.scss";
@@ -10,10 +10,16 @@ import { getCircleInfoApi } from "../../api/circle";
 
 function Index() {
   const [circleData, setCircleData] = useState<any>(null);
+  const [userInfo, setUserInfo] = useState<any>(null);
+  const getUserInfo = () => {
+    const userInfo = getStorageSync("User");
+    setUserInfo(userInfo);
+  };
   useEffect(() => {
     getCircleInfoApi({ id: 1 }).then((res: any) => {
       setCircleData(res.data);
     });
+    getUserInfo();
   }, []);
   return (
     <View className="index">
@@ -46,10 +52,22 @@ function Index() {
 
       <View className="index-content absolute top-[60px] left-0 right-0 bottom-0 z-20 rounded-[30px] overflow-hidden">
         <View className="h-25 p-[10px] flex ">
-          <View className="w-[22%] pt-[10px] mr-[10px] pb-[10px] pl-[5px] border-[1rpx] border-solid border-[#e0e0e0] rounded-[5px] shadow-[0_15px_10px_-16px_rgba(0,0,0,0.3)]">
-            <View className="text-[14px] font-[800] text-[#333]">福利中心</View>
-            <View className="text-[12px] text-[#949494]">登录领奖</View>
-          </View>
+          {userInfo?.is_vip ? (
+            <>
+              <View
+                className="w-[22%] pt-[10px] mr-[10px] pb-[10px] pl-[5px] border-[1rpx] border-solid border-[#e0e0e0] rounded-[5px] shadow-[0_15px_10px_-16px_rgba(0,0,0,0.3)]"
+                onClick={() => {}}
+              >
+                <View className="text-[14px] font-[800] text-[#333]">
+                  福利中心
+                </View>
+                <View className="text-[12px] text-[#949494]">登录领奖</View>
+              </View>
+            </>
+          ) : (
+            <></>
+          )}
+
           {/* <View className="w-[22%] pt-[10px] pb-[10px] pl-[5px] border-[1rpx] border-solid border-[#e0e0e0]  rounded-[5px] shadow-[0_15px_10px_-16px_rgba(0,0,0,0.3)]">
             <View className="text-[14px] font-[800] text-[#333]">游戏攻略</View>
             <View className="text-[12px] text-[#949494]">最新资讯</View>

+ 2 - 2
src/pages/login/index.tsx

@@ -27,9 +27,9 @@ const LoginIndex = () => {
   const smsLogin = async () => {
     await smsLoginApi({ mobile, code }).then((res: any) => {
       const { data } = res;
-      const { token, username, mobile } = data;
+      const { token, username, mobile, is_vip, vip_code } = data;
       setStorageSync("Authorization", token);
-      setStorageSync("User", { username, mobile });
+      setStorageSync("User", { username, mobile, is_vip, vip_code });
       redirectTo({ url: "/pages/index/index" });
     });
   };