diff --git a/src/common/components/QuestionDetail/QuestionDetail.tsx b/src/common/components/QuestionDetail/QuestionDetail.tsx index fc3ebff..99f8390 100644 --- a/src/common/components/QuestionDetail/QuestionDetail.tsx +++ b/src/common/components/QuestionDetail/QuestionDetail.tsx @@ -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 { @@ -182,8 +185,38 @@ const QuestionDetail: React.FC = ({ }); } }; + const [test, setTest] = useState(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 ? ( + + + + + + + + 木犀课栈 + + + + ) : ( { console.error('Error fetching data:', error); } }; + const [test, setTest] = useState(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; @@ -119,7 +139,30 @@ const Notification: React.FC = memo(() => { void fetchData(); }, [tab]); - return ( + return !test ? ( + + + {[ + { + title: '如何使用课栈', + content: '点击右下角的个人中心,即可查看课程信息', + time: '2024-03-20', + }, + { + title: '遇到问题如何反馈?', + content: '您可以通过设置页面的问题反馈向我们报告使用过程中遇到的问题', + time: '2024-03-18', + }, + ].map((item, index) => ( + + {item.title} + {item.content} + {item.time} + + ))} + + + ) : ( + + + + + + + 木犀课栈 + + + + ) : ( {course?.name} @@ -251,9 +264,7 @@ export default function Index() { <> - {!test ? ( - 因为政策原因暂不能发布课评 - ) : questionlist.length > 0 ? ( + {questionlist.length > 0 ? ( <> {questionlist.slice(0, 3).map((question, index) => ( diff --git a/src/pages/evaluate/evaluate.tsx b/src/pages/evaluate/evaluate.tsx index 7dfdce4..e4c3909 100644 --- a/src/pages/evaluate/evaluate.tsx +++ b/src/pages/evaluate/evaluate.tsx @@ -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'; @@ -161,7 +171,17 @@ export default function evaluate() { } }; return !test ? ( - 因为政策原因暂不能发布课评 + + + + + + + + 木犀课栈 + + + ) : (
diff --git a/src/pages/evaluateInfo/index.tsx b/src/pages/evaluateInfo/index.tsx index 094de94..35387c4 100644 --- a/src/pages/evaluateInfo/index.tsx +++ b/src/pages/evaluateInfo/index.tsx @@ -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'; @@ -76,7 +79,25 @@ export default function Index() { fetchComments(); } }, [biz_id, commentsLoaded]); // 依赖项中添加biz_id + const [test, setTest] = useState(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); @@ -129,7 +150,19 @@ export default function Index() { }; // 仅当评论数据加载完成时渲染CommentComponent - return ( + return !test ? ( + + + + + + + + 木犀课栈 + + + + ) : ( { console.log('搜索文本:', searchText); }; + const [test, setTest] = useState(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) => { @@ -94,7 +115,19 @@ export default function Index() { return geneHandler(); }, [loading]); - return ( + return !test ? ( + + + + + + + + 木犀课栈 + + + + ) : ( (''); const [nickName, setNickName] = useState('昵称'); + const [test, setTest] = useState(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]); useEffect(() => { // eslint-disable-next-line @typescript-eslint/require-await const getCourseData = async () => { @@ -155,7 +177,19 @@ export default function Index() { console.error('发布问题请求失败:', error); }); }; - return ( + return !test ? ( + + + + + + + + 木犀课栈 + + + + ) : ( diff --git a/src/pages/questionInfo/index.tsx b/src/pages/questionInfo/index.tsx index ef150cf..fbc79bc 100644 --- a/src/pages/questionInfo/index.tsx +++ b/src/pages/questionInfo/index.tsx @@ -11,6 +11,9 @@ import CommentComponent from '@/common/components/CommentComponent/CommentCompon import CourseInfo from '@/common/components/CourseInfo/CourseInfo'; import QuestionDetail from '@/common/components/QuestionDetail/QuestionDetail'; import { get, post } from '@/common/utils'; +import { postBool } from '@/common/utils/fetch'; + +import { StatusResponse } from '../evaluate/evaluate'; interface IQuestion { id: number; @@ -58,6 +61,33 @@ const Index: React.FC = () => { const [answers, setAnswers] = useState(null); const [courseId, setCourseId] = useState(''); const [questionId, setQuestionId] = useState(null); + const [test, setTest] = useState(false); + useEffect(() => { + const getParams = async () => { + try { + const res = (await postBool('/checkStatus', { + name: 'kestack', + })) as StatusResponse; + + setTest(res.data.status); + + // const instance = Taro.getCurrentInstance(); + // const params = instance?.router?.params || {}; + + // setId(params.id ? Number(params.id) : null); + // setName( + // params.name ? decodeURIComponent(params.name) : '只能评价自己学过的课程哦' + // ); + } catch (error) { + console.error('Error fetching status:', error); + } + }; + + void getParams(); + }, []); + useEffect(() => { + console.log('test status updated:', test); + }, [test]); useEffect(() => { const getParams = () => { const instance = Taro.getCurrentInstance(); diff --git a/src/pages/questionList/index.tsx b/src/pages/questionList/index.tsx index 5f93038..7ac260d 100644 --- a/src/pages/questionList/index.tsx +++ b/src/pages/questionList/index.tsx @@ -1,12 +1,16 @@ /* eslint-disable no-console */ -import { Button, View } from '@tarojs/components'; +import { Button, Image, Text, View } from '@tarojs/components'; import Taro from '@tarojs/taro'; import { useEffect, useState } from 'react'; // import './index.scss'; +import { Icon, TopBackground } from '@/common/assets/img/login'; import CourseInfo from '@/common/components/CourseInfo/CourseInfo'; import QuestionListComponent from '@/common/components/QuestionListComponent/QuestionListComponent'; import { get } from '@/common/utils'; +import { postBool } from '@/common/utils/fetch'; + +import { StatusResponse } from '../evaluate/evaluate'; interface IQuestion { id: number; @@ -31,6 +35,25 @@ const App = () => { const [course, setCourse] = useState(null); const [questions, setQuestions] = useState(null); const [courseId, setCourseId] = useState(''); + const [test, setTest] = useState(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]); useEffect(() => { const getParams = () => { const instance = Taro.getCurrentInstance(); @@ -84,7 +107,19 @@ const App = () => { }); }; - return ( + return !test ? ( + + + + + + + + 木犀课栈 + + + + ) : ( {questions !== null &&