From 361ac0321df9e37c5ef5b1ba6076dc7ce9134291 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A2=A8=E7=B6=A0BG?= Date: Sun, 1 Sep 2024 23:43:27 +0800 Subject: [PATCH] =?UTF-8?q?:poop:=20poop=EF=BC=9A=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E8=AF=84=E8=AF=BE=E5=8E=86=E5=8F=B2=E5=86=85=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../profile/modules/components/History.tsx | 83 +++++++------------ 1 file changed, 32 insertions(+), 51 deletions(-) diff --git a/src/subpackages/profile/modules/components/History.tsx b/src/subpackages/profile/modules/components/History.tsx index 9ec389f..4357a99 100644 --- a/src/subpackages/profile/modules/components/History.tsx +++ b/src/subpackages/profile/modules/components/History.tsx @@ -1,63 +1,44 @@ +/* eslint-disable @typescript-eslint/no-unsafe-argument */ +/* eslint-disable @typescript-eslint/no-unsafe-assignment */ +/* eslint-disable @typescript-eslint/no-unsafe-member-access */ import { View } from '@tarojs/components'; import Taro from '@tarojs/taro'; -import React, { memo } from 'react'; +import { memo, useEffect, useState } from 'react'; +import { CommentInfo } from '@/common/assets/types'; import { Comment } from '@/common/components'; +import { get } from '@/common/utils/fetch'; import uniqueKeyUtil from '@/common/utils/keyGen'; const History: React.FC = memo(() => { + const [comments, setComments] = useState([]); + + useEffect(() => { + const fetchData = async () => { + const res = await get( + `evaluations/list/mine?cur_evaluation_id=${0}&limit=${10}&status=${'Public'}` + ); + console.log(res.data); + setComments(res.data); + }; + void fetchData(); + }, []); + return ( - { - const serializedComment = encodeURIComponent(JSON.stringify(props)); - void Taro.navigateTo({ - url: `/pages/evaluateInfo/index?comment=${serializedComment}`, - }); - }} - key={uniqueKeyUtil.nextKey()} - type="inner" - /> - { - const serializedComment = encodeURIComponent(JSON.stringify(props)); - void Taro.navigateTo({ - url: `/pages/evaluateInfo/index?comment=${serializedComment}`, - }); - }} - key={uniqueKeyUtil.nextKey()} - type="inner" - /> - { - const serializedComment = encodeURIComponent(JSON.stringify(props)); - void Taro.navigateTo({ - url: `/pages/evaluateInfo/index?comment=${serializedComment}`, - }); - }} - key={uniqueKeyUtil.nextKey()} - type="inner" - /> - { - const serializedComment = encodeURIComponent(JSON.stringify(props)); - void Taro.navigateTo({ - url: `/pages/evaluateInfo/index?comment=${serializedComment}`, - }); - }} - key={uniqueKeyUtil.nextKey()} - type="inner" - /> - { - const serializedComment = encodeURIComponent(JSON.stringify(props)); - void Taro.navigateTo({ - url: `/pages/evaluateInfo/index?comment=${serializedComment}`, - }); - }} - key={uniqueKeyUtil.nextKey()} - type="inner" - /> + {comments.map((item) => ( + { + const serializedComment = encodeURIComponent(JSON.stringify(props)); + void Taro.navigateTo({ + url: `/pages/evaluateInfo/index?comment=${serializedComment}`, + }); + }} + /> + ))} ); });