-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
79 changed files
with
538 additions
and
802 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
#!/usr/bin/env sh | ||
export GIT_TERMINAL_PROMPT=0 | ||
. "$(dirname -- "$0")/_/husky.sh" | ||
. "$(dirname -- "$0")/common.sh" | ||
|
||
yarn lint |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,117 @@ | ||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */ | ||
/* eslint-disable @typescript-eslint/no-redundant-type-constituents */ | ||
/* eslint-disable @typescript-eslint/no-unsafe-argument */ | ||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */ | ||
/* eslint-disable simple-import-sort/imports */ | ||
/* eslint-disable @typescript-eslint/no-floating-promises */ | ||
// import React, { useEffect } from "react"; | ||
import { Image, Navigator, Text, View } from '@tarojs/components'; | ||
import Taro from '@tarojs/taro'; | ||
import { useEffect, useTransition } from 'react'; | ||
|
||
import { useCourseStore } from '@/pages/main/store/store'; | ||
|
||
import './comment.scss'; | ||
|
||
import { CommentInfo } from '../../assets/types'; | ||
import ShowStar from '../showStar/showStar'; | ||
|
||
export default function Comment(props: CommentInfo & { type?: string }) { | ||
const { course_id, ctime, publisher_id } = props; | ||
// 创建一个新的Date对象,传入时间戳 | ||
const ctimeDate = new Date(ctime || 0); | ||
const courseDetail = useCourseStore((state) => state.courseDetail); | ||
const publisher = useCourseStore((state) => state.publishers); | ||
const [isPublisherInfoPending, startPublisherTransition] = useTransition(); | ||
const [isCoursePending, startCourseTransition] = useTransition(); | ||
const handleClick = () => { | ||
const serializedComment = encodeURIComponent(JSON.stringify(props)); | ||
Taro.navigateTo({ | ||
url: `/pages/evaluateInfo/index?comment=${serializedComment}`, | ||
}); | ||
}; | ||
useEffect(() => { | ||
startCourseTransition(() => { | ||
useCourseStore.getState().getCourseDetail(course_id || 0); | ||
}); | ||
startPublisherTransition(() => { | ||
useCourseStore.getState().getPublishers(publisher_id || 0); | ||
}); | ||
}, [course_id, publisher_id]); | ||
|
||
return ( | ||
<View className="bigcomment" onClick={handleClick}> | ||
<View className="commentplus"> | ||
{isCoursePending ? ( | ||
<> | ||
<View className="classTitle">pending</View> | ||
</> | ||
) : ( | ||
<> | ||
<View className="classTitle"> | ||
{courseDetail[course_id || 0]?.name + | ||
' (' + | ||
courseDetail[course_id || 0]?.teacher + | ||
') '} | ||
</View> | ||
</> | ||
)} | ||
<View className="comment"> | ||
{isPublisherInfoPending || !publisher_id ? ( | ||
<> | ||
<View>pending</View> | ||
</> | ||
) : ( | ||
<> | ||
<View | ||
className="tx" | ||
style={`background-image: url(${publisher[publisher_id].avatar});`} | ||
></View> | ||
<View className="userName">{publisher[publisher_id].nickname}</View> | ||
<View className="time">{ctimeDate.toLocaleString()}</View> | ||
<View className="stars"> | ||
<ShowStar score={props.star_rating}></ShowStar> | ||
</View> | ||
<Image | ||
// style={`display:${props.isHot ? 'block' : 'none'}`} | ||
className="fire" | ||
src="https://s2.loli.net/2023/11/12/2ITKRcDPMZaQCvk.png" | ||
></Image> | ||
</> | ||
)} | ||
<View className="content">{props.content}</View> | ||
<View | ||
className="likes" | ||
style={`display:${props.type == 'inner' ? 'block' : 'none'}`} | ||
> | ||
<View className="icon"> | ||
<Navigator className="iconfont"></Navigator> | ||
</View> | ||
<Text className="text1">{props.total_support_count}</Text> | ||
<View className="icon"> | ||
<Navigator className="iconfont"></Navigator> | ||
</View> | ||
<Text className="text1">{props.total_comment_count}</Text> | ||
</View> | ||
</View> | ||
</View> | ||
<View | ||
className="likes" | ||
style={`display:${props.type == 'inner' ? 'none' : 'block'}`} | ||
> | ||
<View className="icon"> | ||
<Navigator className="iconfont"></Navigator> | ||
</View> | ||
<Text className="text1">{props.total_support_count}</Text> | ||
<View className="icon"> | ||
<Navigator className="iconfont"></Navigator> | ||
</View> | ||
<Text className="text1">{props.total_comment_count}</Text> | ||
<View className="icon"> | ||
<Navigator className="iconfont"></Navigator> | ||
</View> | ||
<Text className="text1">{props.total_oppose_count}</Text> | ||
</View> | ||
</View> | ||
); | ||
} |
File renamed without changes.
File renamed without changes.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.