From 2ad99881201294d022f8eff2789d5f75c2c5ddb5 Mon Sep 17 00:00:00 2001 From: Ultrame <1019265060@qq.com> Date: Thu, 27 Nov 2025 17:02:51 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8A=A0=E5=85=A5=E7=A4=BE=E7=BE=A4=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app.config.ts | 24 ++--- src/user_pages/edit/index.tsx | 8 +- src/user_pages/joinGroup/index.config.ts | 4 + src/user_pages/joinGroup/index.scss | 22 +++++ src/user_pages/joinGroup/index.tsx | 119 +++++++++++++++++++++++ 5 files changed, 160 insertions(+), 17 deletions(-) create mode 100644 src/user_pages/joinGroup/index.config.ts create mode 100644 src/user_pages/joinGroup/index.scss create mode 100644 src/user_pages/joinGroup/index.tsx diff --git a/src/app.config.ts b/src/app.config.ts index 164f5af..e219154 100644 --- a/src/app.config.ts +++ b/src/app.config.ts @@ -12,13 +12,9 @@ export default defineAppConfig({ "game_pages/sharePoster/index", ], subPackages: [ - { - root: 'publish_pages', - pages: [ - "publishBall/index", - "footballRules/index" - ], + root: "publish_pages", + pages: ["publishBall/index", "footballRules/index"], }, { root: "user_pages", @@ -35,6 +31,7 @@ export default defineAppConfig({ "setTransactionPassword/index", // 设置交易密码 "validPhone/index", // 验证手机号 "withdrawal/index", // 提现 + "joinGroup/index", // 加入社群 ], }, // { @@ -45,15 +42,14 @@ export default defineAppConfig({ // ], // }, { - root: 'order_pages', + root: "order_pages", pages: [ "orderList/index", // 订单列表页 "orderDetail/index", // 订单详情页 - ], }, { - root: 'other_pages', + root: "other_pages", pages: [ "comment_reply/index", // 收到的评论和回复 "new_follow/index", // 新增关注 @@ -63,13 +59,13 @@ export default defineAppConfig({ }, ], - "preloadRule": { + preloadRule: { // 移除首屏预加载,所有子包改为按需加载,提升启动速度 // 如果需要,可以在 main_pages/index 加载后再预加载常用包 "main_pages/index": { - "packages": ["publish_pages"], // 只预加载最常用的发布页面 - "network": "all" - } + packages: ["publish_pages"], // 只预加载最常用的发布页面 + network: "all", + }, }, window: { @@ -90,5 +86,5 @@ export default defineAppConfig({ provider: "wx76a9a06e5b4e693e", }, }, - "lazyCodeLoading": "requiredComponents" + lazyCodeLoading: "requiredComponents", }); diff --git a/src/user_pages/edit/index.tsx b/src/user_pages/edit/index.tsx index 780669c..5854a9f 100644 --- a/src/user_pages/edit/index.tsx +++ b/src/user_pages/edit/index.tsx @@ -415,8 +415,10 @@ const EditProfilePage: React.FC = () => { } }; - const handleAddGroup = () => { - console.log("加入社群~"); + const handleJoinGroup = () => { + Taro.navigateTo({ + url: "/user_pages/joinGroup/index", + }); }; const getDefaultOption = (options) => { @@ -715,7 +717,7 @@ const EditProfilePage: React.FC = () => { > 客服聊天 - + 加入社群 diff --git a/src/user_pages/joinGroup/index.config.ts b/src/user_pages/joinGroup/index.config.ts new file mode 100644 index 0000000..9a66c14 --- /dev/null +++ b/src/user_pages/joinGroup/index.config.ts @@ -0,0 +1,4 @@ +export default definePageConfig({ + navigationBarTitleText: "", + navigationStyle: "custom", +}); diff --git a/src/user_pages/joinGroup/index.scss b/src/user_pages/joinGroup/index.scss new file mode 100644 index 0000000..7ca1f16 --- /dev/null +++ b/src/user_pages/joinGroup/index.scss @@ -0,0 +1,22 @@ +// 他人用户页面样式 +.page_container { + height: 100vh; + overflow: hidden; + position: relative; + overflow-y: auto; + box-sizing: border-box; + background: radial-gradient( + circle at 50% 0, + /* 光晕圆心在顶部中间 */ rgba(191, 255, 239, 0.9) 0px, + /* 中间更深的浅蓝 */ rgba(191, 255, 239, 0.5) 200px, + /* 100px 处开始淡化 */ #fafafa 300px, + /* 到 200px 变成白色 */ #fafafa 100% /* 200px 以下全白 */ + ); +} + +// 主要内容区域 +.main_content { + display: flex; + flex-direction: column; + align-items: center; +} diff --git a/src/user_pages/joinGroup/index.tsx b/src/user_pages/joinGroup/index.tsx new file mode 100644 index 0000000..9bbb5f6 --- /dev/null +++ b/src/user_pages/joinGroup/index.tsx @@ -0,0 +1,119 @@ +import React, { useState, useEffect } from "react"; +import { View, Text, Image } from "@tarojs/components"; +import Taro from "@tarojs/taro"; +import "./index.scss"; +import { UserService, UserInfoType } from "@/services/userService"; +import * as LoginService from "@/services/loginService"; +import { useGlobalState } from "@/store/global"; +import { GeneralNavbar } from "@/components"; + +const OtherUserPage: React.FC = () => { + // 获取页面参数 + const instance = Taro.getCurrentInstance(); + const user_id = instance.router?.params?.userid; + + // 获取导航栏高度信息 + const { statusNavbarHeightInfo } = useGlobalState() || {}; + const { totalHeight = 98 } = statusNavbarHeightInfo || {}; + + // 模拟用户数据 + const [user_info, setUserInfo] = useState>({ + id: parseInt(user_id || "1") || 1, + gender: "", + nickname: "网球爱好者", + avatar_url: require("@/static/userInfo/default_avatar.svg"), + join_date: "2024年3月加入", + stats: { + following_count: 0, + followers_count: 0, + hosted_games_count: 0, + participated_games_count: 0, + }, + tags: ["北京朝阳", "金融从业者", "NTRP 3.5"], + bio: "热爱网球的金融从业者,周末喜欢约球\n技术还在提升中,欢迎一起切磋\n平时在朝阳公园附近活动", + city: "北京", + district: "朝阳", + occupation: "金融从业者", + ntrp_level: "NTRP 3.5", + is_following: false, + ongoing_games: [], + personal_profile: "", + }); + + // 页面加载时获取用户信息 + useEffect(() => { + const load_user_data = async () => { + if (user_id) { + try { + // const user_data = await UserService.get_user_info(user_id); + const res = await LoginService.getUserInfoById(user_id); + const { data: userData } = res; + // setUserInfo({...res.data as UserInfo, avatar: data.avatar_url || require("@/static/userInfo/default_avatar.svg")}); + setUserInfo({ + id: parseInt(user_id || "") || 0, + nickname: userData.nickname || "", + avatar_url: userData.avatar_url || "", + join_date: userData.subscribe_time + ? `${new Date(userData.subscribe_time).getFullYear()}年${ + new Date(userData.subscribe_time).getMonth() + 1 + }月加入` + : "", + stats: { + following_count: userData.stats?.following_count || 0, + followers_count: userData.stats?.followers_count || 0, + hosted_games_count: userData.stats?.hosted_games_count || 0, + participated_games_count: + userData.stats?.participated_games_count || 0, + }, + + personal_profile: userData.personal_profile || "", + province: userData.province || "", + city: userData.city || "", + district: userData.district || "", + occupation: userData.occupation || "", + ntrp_level: "", + phone: userData.phone || "", + gender: userData.gender || "", + birthday: userData.birthday || "", + }); + setIsFollowing(userData.is_following || false); + } catch (error) { + console.error("加载用户数据失败:", error); + Taro.showToast({ + title: "加载失败", + icon: "none", + }); + } + } + }; + + load_user_data(); + }, [user_id]); + + return ( + + {/* 顶部导航栏 */} + { + Taro.navigateBack(); + }} + /> + {/* 主要内容 */} + + 你应该会想加入这里 + 你想认识的人,也在找你。 + + 长按入群吧👆让运动不再一个人 + 你不是一个人在寻找球友。 + 你想认识的人,也在找你。 + 每一个热爱运动的人, + 都在这里相遇。 + + + ); +}; + +export default OtherUserPage;