ith5 пре 3 месеци
родитељ
комит
c4aba1d761
4 измењених фајлова са 48 додато и 47 уклоњено
  1. 3 1
      src/api/auth/index.ts
  2. 42 44
      src/pages/index/index.tsx
  3. 1 1
      src/pages/login/index.tsx
  4. 2 1
      src/pages/self/setting/index.tsx

+ 3 - 1
src/api/auth/index.ts

@@ -1,3 +1,4 @@
+import { getSystemInfo } from "../../utils";
 import request from "../../http/request";
 
 export const authBaseApi = "/auth";
@@ -18,9 +19,10 @@ export const sendCodeApi = (params) => {
  * 短信登录
  */
 export const smsLoginApi = (params) => {
+  const os = getSystemInfo();
   return request({
     url: `${authBaseApi}/sms_login`,
     method: "POST",
-    data: params,
+    data: { os, ...params },
   });
 };

+ 42 - 44
src/pages/index/index.tsx

@@ -1,6 +1,6 @@
 import { View } from "@tarojs/components";
-import { Gift, Home, Plus, User } from "@nutui/icons-react-taro";
-import { navigateTo, redirectTo } from "@tarojs/taro";
+import { Gift, Home, User } from "@nutui/icons-react-taro";
+import { navigateTo, redirectTo, getStorageSync } from "@tarojs/taro";
 import PostList from "../../components/post-list";
 
 import "./index.scss";
@@ -14,7 +14,6 @@ import {
 import { useEffect, useRef, useState } from "react";
 import { getCircleInfoApi } from "../../api/circle";
 import GameIntro from "../../components/game-intro";
-import { getVipUserInfoApi, getVipUserRoleListApi } from "../../api/user";
 
 function Index() {
   const [circleData, setCircleData] = useState<any>(null);
@@ -25,26 +24,9 @@ function Index() {
     getCircleInfoApi({ id: 1 }).then((res: any) => {
       setCircleData(res.data);
     });
-    getVipUserRoleList();
+    setVipUserInfo(getStorageSync("vipInfo"));
   }, []);
 
-  // 获取vip用户角色信息
-  const getVipUserRoleList = async () => {
-    const res: any = await getVipUserRoleListApi({});
-
-    if (res.code === 200 && res.data.length > 0) {
-      getVipUserInfo(res.data[0].role_id);
-    }
-  };
-
-  // 获取vip用户信息
-  const getVipUserInfo = async (role_id: number) => {
-    const res: any = await getVipUserInfoApi({ role_id });
-    if (res.code === 200) {
-      setVipUserInfo(res.data);
-    }
-  };
-
   return (
     <View ref={containerTopRef} className="index">
       {/* 头部导航栏 - 移出page-content容器 */}
@@ -91,25 +73,26 @@ function Index() {
       {/* 页面内容 - 使用ScrollView控制整个页面滚动 */}
 
       <View className="page-content">
-        <View className="flex items-center justify-around w-[100%]">
-          <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" });
-            }}
-          >
-            积分中心
-          </View>
-          <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/gift/index" });
-            }}
-          >
-            <Gift size={16} />
-            礼包中心
-          </View>
-          {/* <View
+        {vipUserInfo && (
+          <View className="flex items-center justify-around w-[100%]">
+            <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" });
+              }}
+            >
+              积分中心
+            </View>
+            <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/gift/index" });
+              }}
+            >
+              <Gift size={16} />
+              礼包中心
+            </View>
+            {/* <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/publish/index" });
@@ -118,9 +101,14 @@ function Index() {
             <Plus size={20} />
             发布帖子
           </View> */}
-        </View>
+          </View>
+        )}
         {vipUserInfo?.notice && <NoticeBar content={vipUserInfo.notice} />}
-        <View style={{ height: "calc(100vh - 180px)" }}>
+        <View
+          style={{
+            height: vipUserInfo ? "calc(100vh - 180px)" : "calc(100vh - 100px)",
+          }}
+        >
           <Tabs
             align="left"
             autoHeight
@@ -132,14 +120,24 @@ function Index() {
             {vipUserInfo?.download_list && (
               <TabPane title="游戏介绍" value="0">
                 <GameIntro
-                  style={{ height: "calc(100vh - 260px)" }}
+                  style={{
+                    height: vipUserInfo
+                      ? "calc(100vh - 260px)"
+                      : "calc(100vh - 180px)",
+                  }}
                   vipUserInfo={vipUserInfo}
                 />
               </TabPane>
             )}
 
             <TabPane title="官方咨讯" value="1">
-              <PostList style={{ height: "calc(100vh - 260px)" }} />
+              <PostList
+                style={{
+                  height: vipUserInfo
+                    ? "calc(100vh - 260px)"
+                    : "calc(100vh - 180px)",
+                }}
+              />
             </TabPane>
           </Tabs>
         </View>

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

@@ -33,8 +33,8 @@ const LoginIndex = () => {
         mobile,
         is_vip,
         vip_code,
-        vip_info,
         circle_info,
+        vip_info,
       } = data;
       setStorageSync("Authorization", token);
       setStorageSync("User", { username, mobile, is_vip, vip_code });

+ 2 - 1
src/pages/self/setting/index.tsx

@@ -65,7 +65,8 @@ export default function Setting() {
       });
     }
   };
-  const userInfo = getStorageSync("User");
+  const userInfo = getStorageSync("vipInfo");
+
   return (
     <View>
       <NavBar