修改前端的部分bug

main
yuan 3 months ago
parent a438890b30
commit 7d2a04fdc0

@ -84,6 +84,7 @@ public class StudentExamPaperController {
continue;
}
ExamPaperDO1 examPaperDO1 = new ExamPaperDO1();
examPaperDO1.setGrade(examPaper.getGrade());
examPaperDO1.setId(examPaper.getId());
examPaperDO1.setName(examPaper.getName());
examPaperDO1.setTime(examPaper.getTime());

@ -67,9 +67,7 @@ public class StudentHomePageController {
@ApiOperation("更新消息记录状态")
@PutMapping("updateMessage")
public R<Integer> updateMessage(@RequestBody Map<String, Long> params) {
System.out.println("============="+params);
Long id = params.get("id");
System.out.println("================="+id);
return R.ok(iMessageService.updateMessage(id));
}

@ -6,6 +6,7 @@ import lombok.Data;
public class ExamPaperDO1 {
private Long id;
private Long glId;
private String grade;
private String name;
private String subject;
private Integer totalquestion;

@ -45,6 +45,7 @@ public class AnswerSheetDOServiceImpl extends ServiceImpl<AnswerSheetDOMapper, A
@Override
public AnswerSheetDO testPaper(String subject, String grade, String name) {
System.out.println("subject:"+subject+" grade:"+grade+" name:"+name);
Long pid = iExamPaperService.selectIdBySubjectAndGradeAndName(subject,grade,name);
LambdaQueryWrapper<ExamCreate> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(ExamCreate::getPid,pid);

@ -59,7 +59,7 @@
<button
v-else
class="start-button"
@click="startExam(paper.id, paper.name, paper.subject, paper.time)"
@click="startExam(paper.id, paper.name, paper.subject, paper.time, paper.grade)"
>
开始答题
</button>
@ -82,7 +82,7 @@ export default {
components: {Aside, Header},
data() {
return {
paperTypes: ["固定试卷","班级试卷"], //
paperTypes: ["班级试卷","固定试卷"], //
subjects: ["语文", "数学"], //
selectedType: "班级试卷", //
selectedSubject: "语文", //
@ -132,8 +132,8 @@ export default {
this.logoTextShow = true
}
},
startExam(id,name,subject,time) {
this.$router.push({ name: "ExamPaper", query: { userId: this.userId ,id:id ,name: name, subject: subject ,time:time} });
startExam(id,name,subject,time,grade) {
this.$router.push({ name: "ExamPaper", query: { userId: this.userId ,id:id ,name: name, subject: subject ,time:time, grade:grade} });
},
handleTypeChange(type) {
this.selectedType = type; //
@ -190,7 +190,6 @@ export default {
},
}
);
console.log("responser",response.data);
if (response.data.code === 200) {
const data = response.data.data;
@ -200,6 +199,7 @@ export default {
const hasTaken = await this.checkExamStatus(record.id);
return {
id: record.id,
grade: record.grade,
name: record.name,
subject: record.subject,
questionCount: record.totalquestion,
@ -209,9 +209,7 @@ export default {
};
})
);
console.log("updatedRecords",updatedRecords);
this.papers = updatedRecords;
console.log("更新后的试卷数据:", updatedRecords);
} else {
alert("数据加载失败:" + response.data.msg);
// this.$router.push('/login'); //
@ -275,7 +273,6 @@ button.active {
flex-wrap: wrap;
gap: 20px;
padding: 20px;
justify-content: space-between; /* Ensures spacing between cards */
}
.card {

@ -142,14 +142,18 @@ export default {
headers: { Authorization: `Bearer ${token}` },
});
console.log("11"+res.data);
if (res.data && res.data.data && res.data.data.grade) {
const grade = res.data.data.grade;
const examRes = await axios.get(`http://localhost:8080/student/homepage/task_paper`, {
params: { name: this.name, subject: this.subject, grade },
params: { name: this.name, subject: this.subject, grade: this.grade },
headers: { Authorization: `Bearer ${token}` },
});
console.log("22"+examRes.data);
if (examRes.data.code === 200) {
const { name, list } = examRes.data.data;
this.examTitle = name;
@ -176,7 +180,7 @@ export default {
});
} else {
alert("加载试题失败:" + examRes.data.msg);
this.$router.push('/login'); //
// this.$router.push('/login'); //
}
} else {
alert("返回数据缺少年级信息!");
@ -302,6 +306,9 @@ export default {
this.name = this.$route.query.name;
this.examId = this.$route.query.id;
this.time = this.$route.query.time;
this.grade = this.$route.query.grade;
console.log(this.grade);
if (!this.subject || !this.name) {
alert("未获取到试卷,请重新选择!");

@ -1,12 +1,12 @@
<template>
<el-container style="min-height: 100vh">
<!-- 左侧导航 -->
<el-aside :width="sideWidth + 'px'" style="background-color: rgb(238, 241, 246); box-shadow: 2px 0 6px rgb(0 21 41 / 35%)">
<el-aside :width="sideWidth + 'px'" style="background-color: rgb(238, 241, 246); box-shadow: 2px 0 6px rgb(0 21 41 / 35%); position: fixed; height: 100vh; z-index: 10;">
<Aside :isCollapse="isCollapse" :logoTextShow="logoTextShow" />
</el-aside>
<!-- 右侧内容 -->
<el-container>
<el-container style="margin-left: 200px">
<!-- 顶部导航 -->
<el-header style="border-bottom:1px solid #ccc;">
<Header :collapseBtnClass="collapseBtnClass" :collapse="collapse" />

@ -20,6 +20,7 @@
<el-table-column prop="id" label="ID" width="100"></el-table-column>
<el-table-column prop="name" label="名称"></el-table-column>
<el-table-column prop="subject" label="学科"></el-table-column>
<el-table-column prop="grade" label="年级"></el-table-column>
<el-table-column prop="type" label="类型"></el-table-column>
<el-table-column label="操作" width="200">
<template slot-scope="scope">

@ -190,7 +190,7 @@ export default {
const token = this.$store.state.tokens[this.userId];
if (!token) {
alert("用户未登录,请重新登录!");
this.$router.push('/login');
await this.$router.push('/login');
return false;
}
const response = await axios.get(`http://localhost:8080/student/homepage/getUser`, {
@ -207,23 +207,21 @@ export default {
console.error(error);
}
},
saveUserProfile() {
const token = this.$store.state.token[this.userId];
async saveUserProfile() {
const token = this.$store.state.tokens[this.userId];
if (!token) {
alert("用户未登录,请重新登录!");
this.$router.push('/login');
return false;
}
console.log('保存用户资料', this.userForm);
//
console.log("保存用户资料:", this.userForm);
axios.put('http://localhost:8080/system/user/profile', this.userForm,{
await axios.put('http://localhost:8080/system/user/profile', this.userForm,{
headers: {
Authorization: `Bearer ${token}`,
'Content-Type': 'application/json',
},
})
.then(response => {
console.log(response.data);
if (response.data.code==200) {
this.$message.success("更新成功");
//
@ -238,10 +236,9 @@ export default {
});
},
updatePassword() {
const token = this.$store.state.token[this.userId];
const token = this.$store.state.tokens[this.userId];
if (!token) {
alert("用户未登录,请重新登录!");
this.$router.push('/login');
return false;
}
if (this.passwordForm.newPassword !== this.passwordForm.confirmPassword) {
@ -249,8 +246,7 @@ export default {
return;
}
//
// console.log(":", this.passwordForm);
axios.put('http://localhost:8080/system/user/profile/updatePwd', this.passwordForm,{
axios.put('http://localhost:8080/system/user/profile/updatePwd',this.passwordForm,{
params:{oldPassword:this.passwordForm.oldPassword,
newPassword: this.passwordForm.newPassword,},
headers: {
@ -259,6 +255,7 @@ export default {
},
})
.then(response => {
console.log('response', response);
if (response.data.code==200) {
this.$message.success("密码更新成功,请重新登录");
this.$store.dispatch("clearToken",this.userId); // Vuex

Loading…
Cancel
Save