From e49f0cca764de59e8fe0941518434d43848a2605 Mon Sep 17 00:00:00 2001 From: Ultrame <1019265060@qq.com> Date: Mon, 1 Dec 2025 16:39:09 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8A=A0=E5=85=A5=E7=BE=A4=E8=81=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/other_pages/ntrp-evaluate/index.tsx | 3 +- src/services/evaluateService.ts | 21 ++++-- src/static/userInfo/group-qrcode.svg | 22 ------ src/user_pages/edit/index.tsx | 1 - src/user_pages/joinGroup/index.scss | 23 +++--- src/user_pages/joinGroup/index.tsx | 98 +++++-------------------- 6 files changed, 47 insertions(+), 121 deletions(-) delete mode 100644 src/static/userInfo/group-qrcode.svg diff --git a/src/other_pages/ntrp-evaluate/index.tsx b/src/other_pages/ntrp-evaluate/index.tsx index 1f4b069..a445893 100644 --- a/src/other_pages/ntrp-evaluate/index.tsx +++ b/src/other_pages/ntrp-evaluate/index.tsx @@ -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" }); } diff --git a/src/services/evaluateService.ts b/src/services/evaluateService.ts index a661c26..a3e207d 100644 --- a/src/services/evaluateService.ts +++ b/src/services/evaluateService.ts @@ -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> { + async submit(req: { + answers: { question_id: number; answer_index: number }[]; + test_duration: number; + }): Promise> { return httpService.post("/ntrp/submit", req, { showLoading: true }); } @@ -113,7 +116,9 @@ class EvaluateService { } // 获取测试详情 - async getTestResult(req: { record_id: number }): Promise> { + async getTestResult(req: { + record_id: number; + }): Promise> { 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> { - return httpService.post("/ntrp/update_user_level", req, { showLoading: true }); + async updateNtrp(req: { + record_id: number; + ntrp_level: string; + update_type: string; + }): Promise> { + return httpService.post("/ntrp/update_user_level", req, { + showLoading: true, + }); } } diff --git a/src/static/userInfo/group-qrcode.svg b/src/static/userInfo/group-qrcode.svg deleted file mode 100644 index 818cf27..0000000 --- a/src/static/userInfo/group-qrcode.svg +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/user_pages/edit/index.tsx b/src/user_pages/edit/index.tsx index f23c07d..3ff30cb 100644 --- a/src/user_pages/edit/index.tsx +++ b/src/user_pages/edit/index.tsx @@ -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 ?? "", diff --git a/src/user_pages/joinGroup/index.scss b/src/user_pages/joinGroup/index.scss index 53a68ec..4dd7178 100644 --- a/src/user_pages/joinGroup/index.scss +++ b/src/user_pages/joinGroup/index.scss @@ -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; } -} \ No newline at end of file +} diff --git a/src/user_pages/joinGroup/index.tsx b/src/user_pages/joinGroup/index.tsx index 1da564b..1e327bf 100644 --- a/src/user_pages/joinGroup/index.tsx +++ b/src/user_pages/joinGroup/index.tsx @@ -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>({ - 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 ( @@ -104,8 +39,13 @@ const OtherUserPage: React.FC = () => { 你应该会想加入这里 你会在这里遇见相似的人,和更好的自己。 - - 长按入群吧👆让运动不再一个人 + + 长按保存图片👆使用微信扫码加入群聊 你不是一个人在寻找球友。 你想认识的人,也在找你。 每一个热爱运动的人, @@ -115,4 +55,4 @@ const OtherUserPage: React.FC = () => { ); }; -export default OtherUserPage; +export default JoinGroupPage;