加入群聊
This commit is contained in:
@@ -450,7 +450,7 @@ function Result() {
|
||||
const { params } = useRouter();
|
||||
const { id } = params;
|
||||
const userInfo = useUserInfo();
|
||||
const { fetchUserInfo } = useUserActions();
|
||||
const { fetchUserInfo, updateUserInfo } = useUserActions();
|
||||
const { type, next, clear } = useEvaluate();
|
||||
const radarRef = useRef();
|
||||
|
||||
@@ -500,6 +500,7 @@ function Result() {
|
||||
ntrp_level,
|
||||
update_type: "test_result",
|
||||
});
|
||||
updateUserInfo({ ntrp_level: ntrp_level });
|
||||
} catch (e) {
|
||||
Taro.showToast({ title: e.message, icon: "none" });
|
||||
}
|
||||
|
||||
@@ -83,7 +83,7 @@ interface TestResult {
|
||||
level_description: string;
|
||||
radar_data: RadarData;
|
||||
test_duration: number; // 单位秒
|
||||
create_time: string; // 时间字符串
|
||||
create_time: string; // 时间字符串
|
||||
}
|
||||
|
||||
// data 对象
|
||||
@@ -103,7 +103,10 @@ class EvaluateService {
|
||||
}
|
||||
|
||||
// 提交答案
|
||||
async submit(req: { answers: { question_id: number, answer_index: number }[], test_duration: number }): Promise<ApiResponse<TestResultData>> {
|
||||
async submit(req: {
|
||||
answers: { question_id: number; answer_index: number }[];
|
||||
test_duration: number;
|
||||
}): Promise<ApiResponse<TestResultData>> {
|
||||
return httpService.post("/ntrp/submit", req, { showLoading: true });
|
||||
}
|
||||
|
||||
@@ -113,7 +116,9 @@ class EvaluateService {
|
||||
}
|
||||
|
||||
// 获取测试详情
|
||||
async getTestResult(req: { record_id: number }): Promise<ApiResponse<TestResultData>> {
|
||||
async getTestResult(req: {
|
||||
record_id: number;
|
||||
}): Promise<ApiResponse<TestResultData>> {
|
||||
return httpService.post("/ntrp/detail", req, { showLoading: true });
|
||||
}
|
||||
|
||||
@@ -123,8 +128,14 @@ class EvaluateService {
|
||||
}
|
||||
|
||||
// 更新NTRP等级
|
||||
async updateNtrp(req: { record_id: number, ntrp_level: string, update_type: string }): Promise<ApiResponse<any>> {
|
||||
return httpService.post("/ntrp/update_user_level", req, { showLoading: true });
|
||||
async updateNtrp(req: {
|
||||
record_id: number;
|
||||
ntrp_level: string;
|
||||
update_type: string;
|
||||
}): Promise<ApiResponse<any>> {
|
||||
return httpService.post("/ntrp/update_user_level", req, {
|
||||
showLoading: true,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
File diff suppressed because one or more lines are too long
|
Before Width: | Height: | Size: 15 KiB |
@@ -23,7 +23,6 @@ const EditProfilePage: React.FC = () => {
|
||||
// 表单状态,基于store中的用户信息初始化
|
||||
const getInitialFormData = () => {
|
||||
const info = user_info as UserInfoType;
|
||||
debugger;
|
||||
return {
|
||||
nickname: info?.nickname ?? "",
|
||||
personal_profile: info?.personal_profile ?? "",
|
||||
|
||||
@@ -5,17 +5,13 @@
|
||||
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 以下全白 */
|
||||
);
|
||||
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 以下全白 */
|
||||
);
|
||||
}
|
||||
|
||||
// 主要内容区域
|
||||
@@ -23,7 +19,7 @@
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
color: rgba(0, 0, 0, 0.40);
|
||||
color: rgba(0, 0, 0, 0.4);
|
||||
text-align: center;
|
||||
font-family: "PingFang SC";
|
||||
font-size: 14px;
|
||||
@@ -40,6 +36,7 @@
|
||||
}
|
||||
|
||||
.qrcode {
|
||||
width: 240px;
|
||||
margin: 32px 0 -20px;
|
||||
}
|
||||
|
||||
@@ -47,4 +44,4 @@
|
||||
font-weight: 400;
|
||||
margin-bottom: 78px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,92 +2,27 @@ 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";
|
||||
import httpService from "@/services/httpService";
|
||||
|
||||
const OtherUserPage: React.FC = () => {
|
||||
// 获取页面参数
|
||||
const instance = Taro.getCurrentInstance();
|
||||
const user_id = instance.router?.params?.userid;
|
||||
|
||||
const JoinGroupPage: React.FC = () => {
|
||||
// 获取导航栏高度信息
|
||||
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: "",
|
||||
});
|
||||
const [url, setUrl] = useState("");
|
||||
|
||||
// 页面加载时获取用户信息
|
||||
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",
|
||||
});
|
||||
}
|
||||
}
|
||||
const getQrCode = async () => {
|
||||
const res = await httpService.post("/parameter/many_key", {
|
||||
keys: "QRCode",
|
||||
});
|
||||
setUrl(res.data.QRCode);
|
||||
};
|
||||
|
||||
load_user_data();
|
||||
}, [user_id]);
|
||||
getQrCode();
|
||||
// drawImageToCanvas();
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<View className="page_container">
|
||||
@@ -104,8 +39,13 @@ const OtherUserPage: React.FC = () => {
|
||||
<View className="main_content" style={{ paddingTop: `${totalHeight}px` }}>
|
||||
<Text className="title-text">你应该会想加入这里</Text>
|
||||
<Text>你会在这里遇见相似的人,和更好的自己。</Text>
|
||||
<Image className="qrcode" mode="scaleToFill" src={require("@/static/userInfo/group-qrcode.svg")} showMenuByLongpress></Image>
|
||||
<Text className="hint-text">长按入群吧👆让运动不再一个人</Text>
|
||||
<Image
|
||||
className="qrcode"
|
||||
mode="scaleToFill"
|
||||
src={url}
|
||||
showMenuByLongpress
|
||||
></Image>
|
||||
<Text className="hint-text">长按保存图片👆使用微信扫码加入群聊</Text>
|
||||
<Text>你不是一个人在寻找球友。</Text>
|
||||
<Text>你想认识的人,也在找你。</Text>
|
||||
<Text>每一个热爱运动的人,</Text>
|
||||
@@ -115,4 +55,4 @@ const OtherUserPage: React.FC = () => {
|
||||
);
|
||||
};
|
||||
|
||||
export default OtherUserPage;
|
||||
export default JoinGroupPage;
|
||||
|
||||
Reference in New Issue
Block a user