Skip to content

Commit

Permalink
Merge branch 'MuxiKeStack:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
eleliauk authored Jan 2, 2025
2 parents 6540881 + 0df0447 commit e1fc3f3
Show file tree
Hide file tree
Showing 43 changed files with 131 additions and 122 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<div align="center">
<img width="130" src="https://github.com/eleliauk/muxiK-StackFrontend2.0/blob/main/src/common/assets/img/login/logo.png" alt="muxiK-StackFrontend2.0 logo">
<img width="130" src="https://github.com/MuxiKeStack/muxiK-StackFrontend2.0/blob/main/src/common/assets/img/login/Icon.png" alt="muxiK-StackFrontend2.0 logo">
<h1 align="center">muxiK-StackFrontend2.0</h1>
<h3>muxiK-StackFrontend2.0</h3>
<a href="https://github.com/MuxiKeStack/muxiK-StackFrontend2.0"><strong>探索项目文档 »</strong></a>
Expand Down
6 changes: 3 additions & 3 deletions src/app.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ export default defineAppConfig({
'pages/myCollection/index',
'pages/notification/index',
'pages/feedback/index',
'pages/evaluate/evaluate',
'pages/evaluate/index',
'pages/questionInfo/index',
'pages/myclass/myclass',
'pages/research/research',
'pages/myclass/index',
'pages/research/index',
'pages/index/index',
'pages/editUser/index',
'pages/guide/index',
Expand Down
2 changes: 1 addition & 1 deletion src/common/components/QuestionDetail/QuestionDetail.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ 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 { StatusResponse } from '@/pages/evaluate';
import { useCourseStore } from '@/pages/main/store/store';

interface IUser {
Expand Down
3 changes: 2 additions & 1 deletion src/common/utils/formatIsoDate.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
const formatIsoDate = (isoDateString: string) => {
const formatIsoDate = (isoDateString: string = new Date().toISOString()) => {
const date = new Date(isoDateString);

const year = date.getFullYear();
const month = (date.getMonth() + 1).toString().padStart(2, '0');
const day = date.getDate().toString().padStart(2, '0');
Expand Down
2 changes: 1 addition & 1 deletion src/modules/notification/components/Notification.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ 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 { StatusResponse } from '@/pages/evaluate';

import { MessageItem, OfficialItem } from './Items';
import TabBar from './TabBar';
Expand Down
10 changes: 6 additions & 4 deletions src/pages/classInfo/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import Taro from '@tarojs/taro';
import { useCallback, useEffect, useMemo, useState } from 'react';
import { AtIcon } from 'taro-ui';

import './index.scss';
import './style.scss';

import { Icon, TopBackground } from '@/common/assets/img/login';
import { Comment } from '@/common/components';
Expand All @@ -18,7 +18,7 @@ import ShowStar from '@/common/components/showStar/showStar';
import { get, post } from '@/common/utils';
import { postBool } from '@/common/utils/fetch';

import { StatusResponse } from '../evaluate/evaluate';
import { StatusResponse } from '../evaluate';

const coursePropertyMap = {
CoursePropertyGeneralCore: '通识核心课',
Expand All @@ -39,7 +39,7 @@ function translateCourseProperty(englishDescription) {
return entry ? entry[1] : '未找到对应的中文描述';
}

export default function Index() {
const Page: React.FC = () => {
const [course, setCourse] = useState<Course | null>(null);
const [courseId, setCourseId] = useState<string | null>(null);
const [comments, setComments] = useState<CommentInfoType[]>([]);
Expand Down Expand Up @@ -365,4 +365,6 @@ export default function Index() {
</View>
</View>
);
}
};

export default Page;
File renamed without changes.
6 changes: 3 additions & 3 deletions src/pages/editUser/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ import { Button, Image, Input, View } from '@tarojs/components';
import Taro from '@tarojs/taro';
import React, { useEffect, useState } from 'react';

import './index.scss';
import './style.scss';

import { get } from '@/common/api/get';
import { fetchQiniuToken, fetchToQiniu } from '@/common/api/qiniu';
import { editIcon } from '@/common/assets/img/editPersonal';
import { TitleButton } from '@/common/components';
import { post } from '@/common/utils';

const EditUser: React.FC = () => {
const Page: React.FC = () => {
const [avatarUrl, setAvatarUrl] = useState('');
const [nickName, setNickName] = useState('请修改昵称');
const [isEditingNickname, setIsEditingNickname] = useState(false);
Expand Down Expand Up @@ -204,4 +204,4 @@ const EditUser: React.FC = () => {
);
};

export default EditUser;
export default Page;
File renamed without changes.
File renamed without changes.
10 changes: 6 additions & 4 deletions src/pages/evaluate/evaluate.tsx → src/pages/evaluate/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-disable @typescript-eslint/no-unsafe-argument */
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
/* eslint-disable react-hooks/rules-of-hooks */

/* eslint-disable import/first */
import {
Button,
Expand All @@ -16,7 +16,7 @@ import {
import Taro from '@tarojs/taro';
import { useEffect, useState } from 'react';

import './evaluate.scss';
import './style.scss';

import { Icon, TopBackground } from '@/common/assets/img/login';
import Label3 from '@/common/components/label3/label3';
Expand All @@ -32,7 +32,7 @@ export interface StatusResponse {
msg: string;
}

export default function evaluate() {
const Page: React.FC = () => {
// 初始化状态,存储所有选中的 Radio 项的值
const [selectedValues, setSelectedValues] = useState<string[]>([]);
// 处理 Radio 变化的函数
Expand Down Expand Up @@ -267,4 +267,6 @@ export default function evaluate() {
<Button onClick={postEvaluation}>发布</Button>
</Form>
);
}
};

export default Page;
File renamed without changes.
10 changes: 6 additions & 4 deletions src/pages/evaluateInfo/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,19 @@ import { Image, Text, Textarea, View } from '@tarojs/components';
import Taro from '@tarojs/taro';
import { useEffect, useRef, useState } from 'react';

import './index.scss';
import './style.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 { StatusResponse } from '../evaluate';
import { useCourseStore } from '../main/store/store';
import { COMMENT_ACTIONS } from '../main/store/types';

export default function Index() {
const Page: React.FC = () => {
const [allComments, setAllComments] = useState<CommentType[]>([]);
const [commentsLoaded, setCommentsLoaded] = useState(false); // 新增状态,标记评论是否已加载
const [replyTo, setReplyTo] = useState<CommentType | null>(null); // 新增状态,存储被回复的评论
Expand Down Expand Up @@ -199,4 +199,6 @@ export default function Index() {
</View>
</View>
);
}
};

export default Page;
File renamed without changes.
6 changes: 3 additions & 3 deletions src/pages/feedback/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import { Textarea, View } from '@tarojs/components';
import Taro from '@tarojs/taro';
import React from 'react';

import './index.scss';
import './style.scss';

const Feedback: React.FC = React.memo(() => {
const Page: React.FC = React.memo(() => {
// const [textareaValue, setTextareaValue] = useState('');
const copyText = '764752182';

Expand Down Expand Up @@ -47,4 +47,4 @@ const Feedback: React.FC = React.memo(() => {
);
});

export default Feedback;
export default Page;
File renamed without changes.
2 changes: 1 addition & 1 deletion src/pages/guide/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { memo } from 'react';

import './index.scss';
import './style.scss';

import Guide from '../../modules/guide';

Expand Down
File renamed without changes.
8 changes: 5 additions & 3 deletions src/pages/index/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ import { Navigator, View } from '@tarojs/components';
import { useState } from 'react';
import { AtFloatLayout } from 'taro-ui';

import './index.scss';
import './style.scss';

export default function Index() {
const Page: React.FC = () => {
const [isFloatLayoutVisible, setIsFloatLayoutVisible] = useState(false); // 控制 AtFloatLayout 显示的状态
// 处理打开 FloatLayout 的方法

Expand Down Expand Up @@ -38,4 +38,6 @@ export default function Index() {
</View>
</View>
);
}
};

export default Page;
File renamed without changes.
2 changes: 1 addition & 1 deletion src/pages/login/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { memo } from 'react';

import './index.scss';
import './style.scss';

import Login from '../../modules/login';

Expand Down
File renamed without changes.
11 changes: 7 additions & 4 deletions src/pages/main/index.tsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
/* eslint-disable simple-import-sort/imports */
/* eslint-disable react-hooks/exhaustive-deps */
/* eslint-disable import/first */
import { Image, ScrollView, Swiper, SwiperItem, Text, View } from '@tarojs/components';
import Taro from '@tarojs/taro';
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
import { AtIcon } from 'taro-ui';

import './index.scss';
import './style.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 { StatusResponse } from '../evaluate';
import { useCourseStore } from './store/store';
import { COURSE_TYPE } from './store/types';

Expand All @@ -23,7 +24,7 @@ const COURSE_NAME_MAP = {
[COURSE_TYPE.GENERAL_CORE]: '通核',
};

export default function Index() {
const Page: React.FC = () => {
const handleSearchToggle = () => {
void Taro.navigateTo({
url: '/pages/research/research',
Expand Down Expand Up @@ -232,4 +233,6 @@ export default function Index() {
</View>
</View>
);
}
};

export default Page;
File renamed without changes.
6 changes: 3 additions & 3 deletions src/pages/myCollection/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { useLoad } from '@tarojs/taro';
import React, { useEffect, useState } from 'react';
import { AtIcon } from 'taro-ui';

import './index.scss';
import './style.scss';

import { get } from '@/common/api/get';
import CollectionCourse from '@/common/components/CollectionCourse/CollectionCourse';
Expand All @@ -22,7 +22,7 @@ interface CollectionProps {
type?: string;
}

const MyCollection: React.FC = () => {
const Page: React.FC = () => {
const [collection, setCollection] = useState<CollectionProps[]>([]);

useLoad(() => {
Expand Down Expand Up @@ -75,4 +75,4 @@ const MyCollection: React.FC = () => {
);
};

export default MyCollection;
export default Page;
File renamed without changes.
File renamed without changes.
8 changes: 5 additions & 3 deletions src/pages/myclass/myclass.tsx → src/pages/myclass/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { Picker, Text, View } from '@tarojs/components';
import Taro, { useDidShow } from '@tarojs/taro';
import { useEffect, useState } from 'react';

import './myclass.scss';
import './style.scss';

// eslint-disable-next-line import/first
import { getUserCourses } from '@/common/api/getUserCourses';
Expand All @@ -20,7 +20,7 @@ interface CouresProps {
id: number;
}

export default function Myclass() {
const Page: React.FC = () => {
const [yearSelector] = useState<string[]>([
'2022-2023学年',
'2023-2024学年',
Expand Down Expand Up @@ -128,4 +128,6 @@ export default function Myclass() {
</View>
</View>
);
}
};

export default Page;
File renamed without changes.
2 changes: 1 addition & 1 deletion src/pages/notification/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { memo } from 'react';

import './index.scss';
import './style.scss';

import Notification from '../../modules/notification';

Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion src/pages/profile/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { memo } from 'react';

import './index.scss';
import './style.scss';

import Profile from '../../modules/profile';

Expand Down
File renamed without changes.
33 changes: 8 additions & 25 deletions src/pages/publishQuestion/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@ import { Button, Image, Text, Textarea, View } from '@tarojs/components';
import Taro from '@tarojs/taro';
import { useEffect, useState } from 'react';

import './index.scss';
import './style.scss';

import { Icon, TopBackground } from '@/common/assets/img/login';
import askicon from '@/common/assets/img/publishQuestion/ask.png';
import CourseInfo from '@/common/components/CourseInfo/CourseInfo';
import PublishHeader from '@/common/components/PublishHeader/PublishHeader';
import { get, post } from '@/common/utils';
import { formatIsoDate, get, post } from '@/common/utils';
import { postBool } from '@/common/utils/fetch';

import { StatusResponse } from '../evaluate/evaluate';
import { StatusResponse } from '../evaluate';

export interface UserInfo {
avatarUrl: string; // 用户头像的URL
Expand Down Expand Up @@ -41,22 +41,7 @@ export interface WebUserProfileVo {
utime?: number;
}

const getCurrentDate = () => {
// 创建一个新的Date对象,它将被初始化为当前日期和时间
const now = new Date();

// 获取年、月、日
const year = now.getFullYear();
const month = now.getMonth() + 1; // getMonth() 返回的月份是从0开始的
const day = now.getDate();

// 格式化为 YYYY-MM-DD
const formattedDate = `${year}${month.toString().padStart(2, '0')}${day.toString().padStart(2, '0')}日`;

return formattedDate;
};

export default function Index() {
const Page: React.FC = () => {
const [course, setCourse] = useState<Course | null>(null);

// const courseId = 2347; //先用概率统计A来调试吧!
Expand Down Expand Up @@ -201,11 +186,7 @@ export default function Index() {
<View>
<CourseInfo name={course?.name} school={course?.school} teacher={course?.teacher} />
<View className="publishView">
<PublishHeader
avatarUrl={avatarUrl}
nickName={nickName}
date={getCurrentDate()}
/>
<PublishHeader avatarUrl={avatarUrl} nickName={nickName} date={formatIsoDate()} />
{
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
<Image src={askicon} className="askicon"></Image>
Expand All @@ -223,4 +204,6 @@ export default function Index() {
</Button>
</View>
);
}
};

export default Page;
File renamed without changes.
Loading

0 comments on commit e1fc3f3

Please sign in to comment.