Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(magic):新增问问同学审核大法 #213

Merged
merged 1 commit into from
Dec 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 35 additions & 2 deletions src/common/components/QuestionDetail/QuestionDetail.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
import '@/common/components/QuestionDetail/QuestionDetail';
import { Button, Image, Text, Textarea, View } from '@tarojs/components';
import { Button, Icon, Image, Text, Textarea, View } from '@tarojs/components';
import Taro from '@tarojs/taro';
import React, { useEffect, useState } from 'react';

import { TopBackground } from '@/common/assets/img/login';
import answericon from '@/common/assets/img/publishQuestion/answer.png';
import askicon from '@/common/assets/img/publishQuestion/ask.png';
import IconFont from '@/common/components/iconfont';
import PublishHeader from '@/common/components/PublishHeader/PublishHeader';
import { get, post } from '@/common/utils';
import { postBool } from '@/common/utils/fetch';
import { StatusResponse } from '@/pages/evaluate/evaluate';
import { useCourseStore } from '@/pages/main/store/store';

interface IUser {
Expand Down Expand Up @@ -182,8 +185,38 @@ const QuestionDetail: React.FC<IQuestionProps> = ({
});
}
};
const [test, setTest] = useState<boolean>(false);
useEffect(() => {
const getParams = async () => {
try {
const res = (await postBool('/checkStatus', {
name: 'kestack',
})) as StatusResponse;

setTest(res.data.status);
} catch (error) {
console.error('Error fetching status:', error);
}
};

return (
void getParams();
}, []);
useEffect(() => {
console.log('test status updated:', test);
}, [test]);
return !test ? (
<View className="flex flex-col">
<Image src={TopBackground as string} className="w-full"></Image>
<View className="absolute top-0 mt-[15vh] flex w-full flex-col items-center gap-4">
<View className="h-40 w-40 overflow-hidden rounded-2xl shadow-xl">
<Image src={Icon as unknown as string} className="h-full w-full"></Image>
</View>
<Text className="text-3xl font-semibold tracking-widest text-[#FFD777]">
木犀课栈
</Text>
</View>
</View>
) : (
<View className="relative mx-auto flex w-[659.42rpx] flex-col items-center bg-[#f9f9f2]">
<View className="w-[603.26rpx] border-b border-[#e3e3e3] pb-[35rpx] pt-[40rpx]">
<PublishHeader
Expand Down
47 changes: 45 additions & 2 deletions src/modules/notification/components/Notification.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,14 @@
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
/* eslint-disable @typescript-eslint/no-unsafe-call */
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
import { View } from '@tarojs/components';
import { Text, View } from '@tarojs/components';
import Taro from '@tarojs/taro';
import { memo, useCallback, useEffect, useMemo, useState } from 'react';

import { VirtualList } from '@/common/components';
import { formatIsoDate, get, getUserInfo } from '@/common/utils';
import { postBool } from '@/common/utils/fetch';
import { StatusResponse } from '@/pages/evaluate/evaluate';

import { MessageItem, OfficialItem } from './Items';
import TabBar from './TabBar';
Expand Down Expand Up @@ -97,7 +99,25 @@ const Notification: React.FC = memo(() => {
console.error('Error fetching data:', error);
}
};
const [test, setTest] = useState<boolean>(false);
useEffect(() => {
const getParams = async () => {
try {
const res = (await postBool('/checkStatus', {
name: 'kestack',
})) as StatusResponse;

setTest(res.data.status);
} catch (error) {
console.error('Error fetching status:', error);
}
};

void getParams();
}, []);
useEffect(() => {
console.log('test status updated:', test);
}, [test]);
const handleScroll = useCallback(
(event) => {
if (end) return;
Expand All @@ -119,7 +139,30 @@ const Notification: React.FC = memo(() => {
void fetchData();
}, [tab]);

return (
return !test ? (
<View className="flex flex-col">
<View className="flex flex-col gap-4 p-4">
{[
{
title: '如何使用课栈',
content: '点击右下角的个人中心,即可查看课程信息',
time: '2024-03-20',
},
{
title: '遇到问题如何反馈?',
content: '您可以通过设置页面的问题反馈向我们报告使用过程中遇到的问题',
time: '2024-03-18',
},
].map((item, index) => (
<View key={index} className="rounded-lg bg-white p-4 shadow">
<Text className="mb-2 text-lg font-bold">{item.title}</Text>
<Text className="mb-2 text-gray-600">{item.content}</Text>
<Text className="text-sm text-gray-400">{item.time}</Text>
</View>
))}
</View>
</View>
) : (
<View className="flex h-screen w-full flex-col items-center gap-4 overflow-y-scroll pb-[13vh]">
<TabBar tab={tab} setTab={setTab} />
<VirtualList
Expand Down
21 changes: 16 additions & 5 deletions src/pages/classInfo/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
/* eslint-disable import/first */
import { Text, View } from '@tarojs/components';
import { Image, Text, View } from '@tarojs/components';
import Taro from '@tarojs/taro';
import { useCallback, useEffect, useMemo, useState } from 'react';
import { AtIcon } from 'taro-ui';

import './index.scss';

import { Icon, TopBackground } from '@/common/assets/img/login';
import { Comment } from '@/common/components';
import AnswerToStudent from '@/common/components/AnswerToStudent';
import LineChart from '@/common/components/chart';
Expand Down Expand Up @@ -218,7 +219,19 @@ export default function Index() {
}
return [];
}, [course?.features]);
return (
return !test ? (
<View className="flex flex-col">
<Image src={TopBackground as string} className="w-full"></Image>
<View className="absolute top-0 mt-[15vh] flex w-full flex-col items-center gap-4">
<View className="h-40 w-40 overflow-hidden rounded-2xl shadow-xl">
<Image src={Icon as string} className="h-full w-full"></Image>
</View>
<Text className="text-3xl font-semibold tracking-widest text-[#FFD777]">
木犀课栈
</Text>
</View>
</View>
) : (
<View className="classInfo">
<View className="theClassnme">{course?.name}</View>
<View className="teacherName">
Expand Down Expand Up @@ -251,9 +264,7 @@ export default function Index() {
</View>
</View>
<>
{!test ? (
<View>因为政策原因暂不能发布课评</View>
) : questionlist.length > 0 ? (
{questionlist.length > 0 ? (
<>
<View className="relative">
{questionlist.slice(0, 3).map((question, index) => (
Expand Down
24 changes: 22 additions & 2 deletions src/pages/evaluate/evaluate.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,22 @@
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
/* eslint-disable react-hooks/rules-of-hooks */
/* eslint-disable import/first */
import { Button, Checkbox, Form, Radio, Text, Textarea, View } from '@tarojs/components';
import {
Button,
Checkbox,
Form,
Image,
Radio,
Text,
Textarea,
View,
} from '@tarojs/components';
import Taro from '@tarojs/taro';
import { useEffect, useState } from 'react';

import './evaluate.scss';

import { Icon, TopBackground } from '@/common/assets/img/login';
import Label3 from '@/common/components/label3/label3';
import Star from '@/common/components/star/star';
import { post } from '@/common/utils';
Expand Down Expand Up @@ -161,7 +171,17 @@ export default function evaluate() {
}
};
return !test ? (
<View>因为政策原因暂不能发布课评</View>
<View className="flex flex-col">
<Image src={TopBackground as string} className="w-full"></Image>
<View className="absolute top-0 mt-[15vh] flex w-full flex-col items-center gap-4">
<View className="h-40 w-40 overflow-hidden rounded-2xl shadow-xl">
<Image src={Icon as string} className="h-full w-full"></Image>
</View>
<Text className="text-3xl font-semibold tracking-widest text-[#FFD777]">
木犀课栈
</Text>
</View>
</View>
) : (
<Form className="view">
<View className="p">
Expand Down
37 changes: 35 additions & 2 deletions src/pages/evaluateInfo/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,19 @@
/* eslint-disable @typescript-eslint/no-unsafe-assignment */

/* eslint-disable import/first */
import { Textarea, View } from '@tarojs/components';
import { Image, Text, Textarea, View } from '@tarojs/components';
import Taro from '@tarojs/taro';
import { useEffect, useRef, useState } from 'react';

import './index.scss';

import { Icon, TopBackground } from '@/common/assets/img/login';
import { Comment } from '@/common/components';
import CommentComponent from '@/common/components/CommentComponent/CommentComponent';
import { get } from '@/common/utils';
import { postBool } from '@/common/utils/fetch';

import { StatusResponse } from '../evaluate/evaluate';
import { useCourseStore } from '../main/store/store';
import { COMMENT_ACTIONS } from '../main/store/types';

Expand Down Expand Up @@ -76,7 +79,25 @@ export default function Index() {
fetchComments();
}
}, [biz_id, commentsLoaded]); // 依赖项中添加biz_id
const [test, setTest] = useState<boolean>(false);
useEffect(() => {
const getParams = async () => {
try {
const res = (await postBool('/checkStatus', {
name: 'kestack',
})) as StatusResponse;

setTest(res.data.status);
} catch (error) {
console.error('Error fetching status:', error);
}
};

void getParams();
}, []);
useEffect(() => {
console.log('test status updated:', test);
}, [test]);
const handleCommentClick = (comment: CommentType | null) => {
if (comment) {
setReplyTo(comment);
Expand Down Expand Up @@ -129,7 +150,19 @@ export default function Index() {
};

// 仅当评论数据加载完成时渲染CommentComponent
return (
return !test ? (
<View className="flex flex-col">
<Image src={TopBackground as string} className="w-full"></Image>
<View className="absolute top-0 mt-[15vh] flex w-full flex-col items-center gap-4">
<View className="h-40 w-40 overflow-hidden rounded-2xl shadow-xl">
<Image src={Icon as string} className="h-full w-full"></Image>
</View>
<Text className="text-3xl font-semibold tracking-widest text-[#FFD777]">
木犀课栈
</Text>
</View>
</View>
) : (
<View className="evaluateInfo" onClick={handleClearReply}>
<Comment
showAll
Expand Down
37 changes: 35 additions & 2 deletions src/pages/main/index.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
/* eslint-disable react-hooks/exhaustive-deps */
/* eslint-disable import/first */
import { ScrollView, View } from '@tarojs/components';
import { Image, ScrollView, Text, View } from '@tarojs/components';
import Taro from '@tarojs/taro';
import { useCallback, useEffect, useMemo, useState } from 'react';

import './index.scss';

import { Icon, TopBackground } from '@/common/assets/img/login';
import { Comment } from '@/common/components';
import SearchInput from '@/common/components/SearchInput/SearchInput';
import { postBool } from '@/common/utils/fetch';

import { StatusResponse } from '../evaluate/evaluate';
import { useCourseStore } from './store/store';
import { COURSE_TYPE } from './store/types';

Expand Down Expand Up @@ -67,7 +70,25 @@ export default function Index() {
const handleSearch = (searchText: string) => {
console.log('搜索文本:', searchText);
};
const [test, setTest] = useState<boolean>(false);
useEffect(() => {
const getParams = async () => {
try {
const res = (await postBool('/checkStatus', {
name: 'kestack',
})) as StatusResponse;

setTest(res.data.status);
} catch (error) {
console.error('Error fetching status:', error);
}
};

void getParams();
}, []);
useEffect(() => {
console.log('test status updated:', test);
}, [test]);
const geneHandler = () => {
let timeNow = Date.now();
return (e) => {
Expand All @@ -94,7 +115,19 @@ export default function Index() {
return geneHandler();
}, [loading]);

return (
return !test ? (
<View className="flex flex-col">
<Image src={TopBackground as string} className="w-full"></Image>
<View className="absolute top-0 mt-[15vh] flex w-full flex-col items-center gap-4">
<View className="h-40 w-40 overflow-hidden rounded-2xl shadow-xl">
<Image src={Icon as string} className="h-full w-full"></Image>
</View>
<Text className="text-3xl font-semibold tracking-widest text-[#FFD777]">
木犀课栈
</Text>
</View>
</View>
) : (
<View className="flex flex-col">
<SearchInput
onSearch={handleSearch} // 传递搜索逻辑
Expand Down
Loading
Loading