From ee2d4b656c06782dc18629cca0ec0801d5af54ea Mon Sep 17 00:00:00 2001 From: eleliauk <2831336720@qq.com> Date: Sun, 20 Oct 2024 11:21:04 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=F0=9F=90=9E=20fix=EF=BC=9A=E4=BF=AE?= =?UTF-8?q?=E5=A4=8Dcomment=E6=98=BE=E7=A4=BA=E6=97=B6=E5=8C=BA=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/common/components/Comment/index.tsx | 6 +++++- src/pages/main/index.tsx | 2 -- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/common/components/Comment/index.tsx b/src/common/components/Comment/index.tsx index b4a4bd3..9adf978 100644 --- a/src/common/components/Comment/index.tsx +++ b/src/common/components/Comment/index.tsx @@ -9,6 +9,7 @@ import './style.scss'; import { useCourseStore } from '@/pages/main/store/store'; import IconFont from '@/common/components/iconfont'; +import { formatIsoDate } from '@/common/utils'; import { CourseDetailsType, PublisherDetailsType } from '@/pages/main/store/types'; import ShowStar from '../showStar/showStar'; @@ -72,7 +73,10 @@ const CommentHeader: React.FC = memo((props) => { style={`background-image: url(${publisher_info?.avatar});`} > {publisher_info?.nickname} - {new Date(ctime as number).toLocaleString()} + + {' '} + {formatIsoDate(new Date(ctime as number).toISOString())} + diff --git a/src/pages/main/index.tsx b/src/pages/main/index.tsx index bf494d3..db92f86 100644 --- a/src/pages/main/index.tsx +++ b/src/pages/main/index.tsx @@ -54,8 +54,6 @@ export default function Index() { const handleSearch = (searchText: string) => { console.log('搜索文本:', searchText); - // 这里可以添加发送API请求的代码 - // 例如: fetchSearchResults(searchText); }; const geneHandler = () => { From 6bdaf8d130192233e83a3bab718e7fb4032ae3f6 Mon Sep 17 00:00:00 2001 From: eleliauk <2831336720@qq.com> Date: Sun, 20 Oct 2024 17:24:17 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=F0=9F=90=9E=20fix=EF=BC=9A=E4=BF=AE?= =?UTF-8?q?=E5=A4=8Dbug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/research/research.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/src/pages/research/research.tsx b/src/pages/research/research.tsx index 2597713..3bb5070 100644 --- a/src/pages/research/research.tsx +++ b/src/pages/research/research.tsx @@ -64,7 +64,6 @@ const Research: React.FC = () => { const handleSearch = (searchText: string) => { console.log('搜索文本:', searchText); setSpread(true); - // 这里可以添加发送API请求的代码 get(`/search?biz=Course&keyword=${searchText}&search_location=Home`).then((res) => { console.log(res); setClasses(res.data); From dabd80e13759fb3cfcae149b7745f1c69fdec695 Mon Sep 17 00:00:00 2001 From: eleliauk <2831336720@qq.com> Date: Sat, 26 Oct 2024 19:14:02 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=F0=9F=90=9E=20fix=EF=BC=9A=E4=BF=AE?= =?UTF-8?q?=E5=A4=8Dstyle?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CommentComponent/CommentComponent.tsx | 22 +++++++++++-------- .../components/SearchInput/SearchInput.tsx | 14 ------------ src/pages/classInfo/index.tsx | 2 +- 3 files changed, 14 insertions(+), 24 deletions(-) diff --git a/src/common/components/CommentComponent/CommentComponent.tsx b/src/common/components/CommentComponent/CommentComponent.tsx index 94a54be..e733ea7 100644 --- a/src/common/components/CommentComponent/CommentComponent.tsx +++ b/src/common/components/CommentComponent/CommentComponent.tsx @@ -9,10 +9,9 @@ import { Image, Text, View } from '@tarojs/components'; import React, { useEffect, useState } from 'react'; -import './index.scss'; - -import { get } from '@/common/utils'; +import { formatIsoDate, get } from '@/common/utils'; import { useCourseStore } from '@/pages/main/store/store'; +import './index.scss'; interface CommentProps { comments: CommentType[]; @@ -72,10 +71,11 @@ const CommentComponent: React.FC = ({ comments, onCommentClick }) void fetchAllReplies(); }, []); - const ctimeToString = (ctime: number) => { - const ctimeDate = new Date(ctime); - return {ctimeDate.toLocaleString()}; - }; + // const ctimeToString = (ctime: number) => { + // return ( + // formatIsoDate(new Date(ctime as number).toISOString()) + // ); + // }; // 辅助函数:获取回复者的昵称 const getReplyToNickname = (replyToUid: number): string => { @@ -103,7 +103,9 @@ const CommentComponent: React.FC = ({ comments, onCommentClick }) {comment.user?.nickname} - {ctimeToString(comment.ctime)} + + {formatIsoDate(new Date(comment.ctime).toISOString())} + {comment.content} @@ -128,7 +130,9 @@ const CommentComponent: React.FC = ({ comments, onCommentClick }) ) : null} - {ctimeToString(reply.ctime)} + + {formatIsoDate(new Date(comment.ctime).toISOString())} + {reply.content} diff --git a/src/common/components/SearchInput/SearchInput.tsx b/src/common/components/SearchInput/SearchInput.tsx index e443fe7..4e091cd 100644 --- a/src/common/components/SearchInput/SearchInput.tsx +++ b/src/common/components/SearchInput/SearchInput.tsx @@ -26,20 +26,6 @@ const SearchInput: React.FC = ({ // const [isSearchActive, setIsSearchActive] = useState(true); const [searchText, setSearchText] = useState(''); // 添加状态来存储搜索文本 - // const handleClick = () => { - // // if (!isSearchActive) { - // // setIsSearchActive(true); - // onSearchToggle(); - // // } - // }; - - // const handleBlur = () => { - // // if (isSearchActive) { - // // setIsSearchActive(false); - // onSearchToggle(); - // // } - // }; - // 添加点击图片时的搜索逻辑 const handleImageClick = (e: any) => { // 阻止事件冒泡 diff --git a/src/pages/classInfo/index.tsx b/src/pages/classInfo/index.tsx index 58be3fb..a5c39a1 100644 --- a/src/pages/classInfo/index.tsx +++ b/src/pages/classInfo/index.tsx @@ -202,7 +202,7 @@ export default function Index() { )} {questionlist.length === 0 && ( - + 暂无内容敬请期待 )} From 7fc9d3cdd1bd57cd2ff4d72bbe62c25112d99c99 Mon Sep 17 00:00:00 2001 From: eleliauk <2831336720@qq.com> Date: Sun, 17 Nov 2024 23:58:53 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=F0=9F=94=A7=20chore=EF=BC=9A=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=E5=AE=A1=E6=A0=B8=E5=A4=A7=E6=B3=95=EF=BC=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CommentComponent/CommentComponent.tsx | 7 +++-- src/common/types/projectType.ts | 0 src/common/utils/checkToken.ts | 6 +++- src/pages/evaluate/evaluate.tsx | 30 +++---------------- src/pages/index/index.tsx | 3 +- src/pages/questionList/index.tsx | 2 -- 6 files changed, 16 insertions(+), 32 deletions(-) create mode 100644 src/common/types/projectType.ts diff --git a/src/common/components/CommentComponent/CommentComponent.tsx b/src/common/components/CommentComponent/CommentComponent.tsx index e733ea7..1d1b85f 100644 --- a/src/common/components/CommentComponent/CommentComponent.tsx +++ b/src/common/components/CommentComponent/CommentComponent.tsx @@ -4,14 +4,17 @@ /* eslint-disable @typescript-eslint/no-unsafe-call */ /* eslint-disable @typescript-eslint/no-unsafe-assignment */ /* eslint-disable @typescript-eslint/no-unsafe-member-access */ -/* eslint-disable import/first */ + // Comment.tsx import { Image, Text, View } from '@tarojs/components'; import React, { useEffect, useState } from 'react'; +import './index.scss'; + +// eslint-disable-next-line import/first import { formatIsoDate, get } from '@/common/utils'; +// eslint-disable-next-line import/first import { useCourseStore } from '@/pages/main/store/store'; -import './index.scss'; interface CommentProps { comments: CommentType[]; diff --git a/src/common/types/projectType.ts b/src/common/types/projectType.ts new file mode 100644 index 0000000..e69de29 diff --git a/src/common/utils/checkToken.ts b/src/common/utils/checkToken.ts index cbf4e13..50899cd 100644 --- a/src/common/utils/checkToken.ts +++ b/src/common/utils/checkToken.ts @@ -2,7 +2,11 @@ import Taro from '@tarojs/taro'; const checkToken = () => { const token: string = Taro.getStorageSync('shortToken'); - + const accountInfo = Taro.getAccountInfoSync(); + void Taro.setStorage({ + key: 'accountInfo', + data: accountInfo, + }); if (token) { void Taro.switchTab({ url: '/pages/main/index' }); } else { diff --git a/src/pages/evaluate/evaluate.tsx b/src/pages/evaluate/evaluate.tsx index cd65842..4e34c6d 100644 --- a/src/pages/evaluate/evaluate.tsx +++ b/src/pages/evaluate/evaluate.tsx @@ -14,17 +14,7 @@ import Star from '@/common/components/star/star'; import { post } from '@/common/utils'; export default function evaluate() { - // function generateUniqueID() { - // const timestamp = Date.now().toString(36); // 时间戳转换为36进制 - // const randomString = Math.random().toString(36).substr(2, 5); // 随机数转换为36进制并截取部分字符 - - // const uniqueID = timestamp + randomString; - // return uniqueID; - // } - - // 示例用法 - //const uniqueID = generateUniqueID(); - + const accoutInfo = Taro.getStorageSync('accountInfo'); // 初始化状态,存储所有选中的 Radio 项的值 const [selectedValues, setSelectedValues] = useState([]); @@ -51,20 +41,6 @@ export default function evaluate() { { value: 'NoAssessment', text: '无考核' }, ]; - // const [checkedClass,setCheckedClass] = useState([{ content: '只能评价自己学过的课程哦' }]); - - // enum FeatureTag { - // EasyToLearn = '课程简单易学', - // RichInContent = '课程干货满满', - // Challenging = '课程很有挑战', - // RigorousAndResponsible = '老师严谨负责', - // KindAndEasygoing = '老师温柔随和', - // Humorous = '老师风趣幽默', - // LessHomework = '平时作业少', - // KeyPointsForFinal = '期末划重点', - // ComprehensiveOnlineMaterials = '云课堂资料全', - // } - const features = [ { value: 'EasyToLearn', content: '课程简单易学' }, { value: 'RichInContent', content: '课程干货满满' }, @@ -177,7 +153,9 @@ export default function evaluate() { } }; - return ( + return accoutInfo.miniProgram.envVersion !== 'develop' ? ( + <>因为政策原因,暂时无法评价课程 + ) : (
选择课程 : diff --git a/src/pages/index/index.tsx b/src/pages/index/index.tsx index c284022..2bb2545 100644 --- a/src/pages/index/index.tsx +++ b/src/pages/index/index.tsx @@ -1,4 +1,5 @@ import { Navigator, View } from '@tarojs/components'; +// import Taro from '@tarojs/taro'; import { useState } from 'react'; import { AtFloatLayout } from 'taro-ui'; @@ -6,8 +7,8 @@ import './index.scss'; export default function Index() { const [isFloatLayoutVisible, setIsFloatLayoutVisible] = useState(false); // 控制 AtFloatLayout 显示的状态 - // 处理打开 FloatLayout 的方法 + const handleFloatLayoutChange = (isVisible: boolean) => { console.log(1); setIsFloatLayoutVisible(isVisible); diff --git a/src/pages/questionList/index.tsx b/src/pages/questionList/index.tsx index 4539ba3..5cbf01b 100644 --- a/src/pages/questionList/index.tsx +++ b/src/pages/questionList/index.tsx @@ -1,11 +1,9 @@ -/* eslint-disable import/first */ /* eslint-disable no-console */ import { Button, View } from '@tarojs/components'; import Taro from '@tarojs/taro'; import { useEffect, useState } from 'react'; // import './index.scss'; - import CourseInfo from '@/common/components/CourseInfo/CourseInfo'; import QuestionListComponent from '@/common/components/QuestionListComponent/QuestionListComponent'; import { get } from '@/common/utils';