Skip to content

Commit

Permalink
💩 poop:新增评课历史内容
Browse files Browse the repository at this point in the history
  • Loading branch information
BlackishGreen33 committed Sep 1, 2024
1 parent 3506c99 commit 361ac03
Showing 1 changed file with 32 additions and 51 deletions.
83 changes: 32 additions & 51 deletions src/subpackages/profile/modules/components/History.tsx
Original file line number Diff line number Diff line change
@@ -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<CommentInfo[]>([]);

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 (
<View className="flex h-screen flex-col items-center gap-4 overflow-y-scroll py-4">
<Comment
onClick={(props) => {
const serializedComment = encodeURIComponent(JSON.stringify(props));
void Taro.navigateTo({
url: `/pages/evaluateInfo/index?comment=${serializedComment}`,
});
}}
key={uniqueKeyUtil.nextKey()}
type="inner"
/>
<Comment
onClick={(props) => {
const serializedComment = encodeURIComponent(JSON.stringify(props));
void Taro.navigateTo({
url: `/pages/evaluateInfo/index?comment=${serializedComment}`,
});
}}
key={uniqueKeyUtil.nextKey()}
type="inner"
/>
<Comment
onClick={(props) => {
const serializedComment = encodeURIComponent(JSON.stringify(props));
void Taro.navigateTo({
url: `/pages/evaluateInfo/index?comment=${serializedComment}`,
});
}}
key={uniqueKeyUtil.nextKey()}
type="inner"
/>
<Comment
onClick={(props) => {
const serializedComment = encodeURIComponent(JSON.stringify(props));
void Taro.navigateTo({
url: `/pages/evaluateInfo/index?comment=${serializedComment}`,
});
}}
key={uniqueKeyUtil.nextKey()}
type="inner"
/>
<Comment
onClick={(props) => {
const serializedComment = encodeURIComponent(JSON.stringify(props));
void Taro.navigateTo({
url: `/pages/evaluateInfo/index?comment=${serializedComment}`,
});
}}
key={uniqueKeyUtil.nextKey()}
type="inner"
/>
{comments.map((item) => (
<Comment
key={uniqueKeyUtil.nextKey()}
type="inner"
{...item}
onClick={(props) => {
const serializedComment = encodeURIComponent(JSON.stringify(props));
void Taro.navigateTo({
url: `/pages/evaluateInfo/index?comment=${serializedComment}`,
});
}}
/>
))}
</View>
);
});
Expand Down

0 comments on commit 361ac03

Please sign in to comment.