Skip to content

Commit

Permalink
✨ feat:新增成绩共享计划
Browse files Browse the repository at this point in the history
  • Loading branch information
eleliauk committed Sep 17, 2024
1 parent bcb6462 commit a562b03
Show file tree
Hide file tree
Showing 9 changed files with 76 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/app.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export default defineAppConfig({
'pages/index/index',
'pages/editUser/index',
'pages/guide/index',
'pages/shareGrades/index',
],
subpackages: [
{
Expand Down
Binary file added src/common/assets/img/publishQuestion/img.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions src/common/components/AnswerToStudent/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,7 @@
width: 80%;
justify-content: center;
}
.img{
width: 80rpx;
height: 80rpx;
}
7 changes: 6 additions & 1 deletion src/common/components/AnswerToStudent/index.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
import { View } from '@tarojs/components';
import { Image, View } from '@tarojs/components';

import './index.scss';

// eslint-disable-next-line import/first
import Ask from '@/common/assets/img/publishQuestion/img.png';

function AnswerToStudent() {
return (
<View className="question-container">
{/* eslint-disable-next-line @typescript-eslint/no-unsafe-assignment */}
<Image src={Ask} className="img"></Image>
<View>问题问题问题问题问题:</View>
<View>1个回答</View>
</View>
Expand Down
3 changes: 1 addition & 2 deletions src/modules/profile/components/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ const Header: React.FC = memo(() => {
};
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
return (title: string) => titleMap[title] || title;
// todo 刷新方式
}, []);

useEffect(() => {
Expand All @@ -60,7 +59,7 @@ const Header: React.FC = memo(() => {
}
};
void fetchUserData();
}, [translateTitle]);
}, []);

if (user.newUser) {
void Taro.navigateTo({ url: '/pages/editUser/index' });
Expand Down
1 change: 1 addition & 0 deletions src/modules/profile/components/List.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ const ListItems: { title: string; icon: string; url: string }[] = [
icon: ClockIcon as string,
url: '/subpackages/profile/pages/history/index',
},
{ title: '成绩共享计划', icon: MailIcon as string, url: '/pages/shareGrades/index' },
{ title: '意见反馈', icon: MailIcon as string, url: '/pages/feedback/index' },
];

Expand Down
1 change: 1 addition & 0 deletions src/pages/classInfo/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ export default function Index() {
// };
// }, []);
useEffect(() => {
console.log('test', courseId);
const fetchGrades = async () => {
try {
await get(`/grades/courses/${courseId}`, true).then((res) => {
Expand Down
14 changes: 14 additions & 0 deletions src/pages/shareGrades/index.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
.title {
font-size: 50rpx;
text-align: center;
font-weight: bold;
margin: auto;
display: block;
}
.card {
padding-top: 10rpx;
width: 80%;
height: 60%;
margin: auto;
font-size: 35rpx;
}
48 changes: 48 additions & 0 deletions src/pages/shareGrades/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import { Button, Text, View } from '@tarojs/components';
// eslint-disable-next-line import/first
import Taro from '@tarojs/taro';

import './index.scss';

// eslint-disable-next-line import/first
import { post } from '@/common/utils/fetch';

const ShareGrades = () => {
const handleSubmit = () => {
try {
void post('/grades/sign', { wants_to_sign: true }, true).then((r) => {
console.log(r);
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
if (r.msg === '重复签约') {
void Taro.showToast({
icon: 'error',
title: '请勿重复签约',
});
}
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
if (r.msg === '签约成功') {
void Taro.showToast({
icon: 'success',
title: '签约成功!',
});
}
});
} catch (err) {
console.log(err);
}
};

return (
<View>
<Text className="title">成绩共享计划</Text>
<View className="card">
该部分的课程成绩信息是我们在征得用户同意后,
<Text className="font-extrabold">匿名</Text>
收集用户成绩数据所得到的统计结果。查看该信息需要您加入我们的 课程成绩共享计划
,提供自己的过往成绩信息作为数据分析的一部分。我们将根据隐私条例中的内容,保证您的个人信息受到安全保护。
</View>
<Button onClick={handleSubmit}>我同意成绩共享计划</Button>
</View>
);
};
export default ShareGrades;

0 comments on commit a562b03

Please sign in to comment.