加入社群页面

This commit is contained in:
2025-11-27 17:02:51 +08:00
parent a20490f28d
commit 2ad9988120
5 changed files with 160 additions and 17 deletions

View File

@@ -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",
});

View File

@@ -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 = () => {
></Image>
<Text className="logout_text"></Text>
</View>
<View className="logout_button" onClick={handleAddGroup}>
<View className="logout_button" onClick={handleJoinGroup}>
<Image src={require("@/static/userInfo/chat.svg")}></Image>
<Text className="logout_text"></Text>
</View>

View File

@@ -0,0 +1,4 @@
export default definePageConfig({
navigationBarTitleText: "",
navigationStyle: "custom",
});

View File

@@ -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;
}

View File

@@ -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<Partial<UserInfoType>>({
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 (
<View className="page_container">
{/* 顶部导航栏 */}
<GeneralNavbar
title=""
showBack={true}
showAvatar={false}
onBack={() => {
Taro.navigateBack();
}}
/>
{/* 主要内容 */}
<View className="main_content" style={{ paddingTop: `${totalHeight}px` }}>
<Text></Text>
<Text></Text>
<Image src=""></Image>
<Text>👆</Text>
<Text></Text>
<Text></Text>
<Text></Text>
<Text></Text>
</View>
</View>
);
};
export default OtherUserPage;