From e289c3f45357d161c0ce9fcd68e7d56390b635bb Mon Sep 17 00:00:00 2001 From: zty Date: Fri, 14 Jun 2024 14:53:49 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20exam/view=20=E4=BF=AE=E6=94=B9=E5=88=A0?= =?UTF-8?q?=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/src/views/exam/testPaperCreate.vue | 7 +++---- server/apps/exam/models.py | 4 ++-- server/apps/exam/parse_word.py | 2 +- .../0051_alter_qualification_change_date.py | 20 +++++++++++++++++++ .../0052_alter_qualification_change_date.py | 20 +++++++++++++++++++ 5 files changed, 46 insertions(+), 7 deletions(-) create mode 100644 server/apps/information/migrations/0051_alter_qualification_change_date.py create mode 100644 server/apps/information/migrations/0052_alter_qualification_change_date.py diff --git a/client/src/views/exam/testPaperCreate.vue b/client/src/views/exam/testPaperCreate.vue index 81733d4..cc5d839 100644 --- a/client/src/views/exam/testPaperCreate.vue +++ b/client/src/views/exam/testPaperCreate.vue @@ -201,10 +201,8 @@ let that =this; if (res.code == 201){ that.impForm.doc_path = res.data.path; - console.log(that.impForm) UploadPaper(that.impForm).then(res => { if (res.code == 200) { - console.log(res.data) that.questions = res.data; that.$message({ @@ -258,10 +256,11 @@ this.questions.splice(val, 1); }, handleDelete2(item, val){ + let that = this deleteQuestion(item.id).then(res=>{ if (res.code == 200) { - this.questions.splice(val, 1); - this.$message({ + that.questions.splice(val, 1); + that.$message({ type: "success", message: "删除成功!" }); diff --git a/server/apps/exam/models.py b/server/apps/exam/models.py index 5227ce6..78ac629 100644 --- a/server/apps/exam/models.py +++ b/server/apps/exam/models.py @@ -1,5 +1,5 @@ from django.db import models -from apps.system.models import CommonAModel, CommonBModel, CommonBDModel +from apps.system.models import CommonAModel, CommonADModel, CommonBDModel from django.contrib.postgres.fields import JSONField from utils.model import BaseModel from apps.edu.models import Course @@ -20,7 +20,7 @@ class Questioncat(CommonAModel): return self.questioncat.count() -class Question(CommonAModel): +class Question(CommonADModel): type_choices = ( ('单选', '单选'), ('多选', '多选'), diff --git a/server/apps/exam/parse_word.py b/server/apps/exam/parse_word.py index 3819af1..e69225e 100644 --- a/server/apps/exam/parse_word.py +++ b/server/apps/exam/parse_word.py @@ -94,6 +94,6 @@ def interpret_text(start:int, excel_path:str, doc_path:str, field=None): if __name__ == '__main__': - doc_path = "C:\code\data\\test.docx" + doc_path = "C:\code\data\\判断题.docx" excel_path = "C:\code\data\question.xlsx" interpret_text(3, excel_path, doc_path) \ No newline at end of file diff --git a/server/apps/information/migrations/0051_alter_qualification_change_date.py b/server/apps/information/migrations/0051_alter_qualification_change_date.py new file mode 100644 index 0000000..6c21402 --- /dev/null +++ b/server/apps/information/migrations/0051_alter_qualification_change_date.py @@ -0,0 +1,20 @@ +# Generated by Django 3.2.12 on 2024-06-14 05:35 + +import datetime +from django.db import migrations, models +from django.utils.timezone import utc + + +class Migration(migrations.Migration): + + dependencies = [ + ('information', '0050_alter_qualification_change_date'), + ] + + operations = [ + migrations.AlterField( + model_name='qualification', + name='change_date', + field=models.DateField(blank=True, default=datetime.datetime(2024, 6, 14, 5, 35, 33, 230280, tzinfo=utc), null=True, verbose_name='变更日期'), + ), + ] diff --git a/server/apps/information/migrations/0052_alter_qualification_change_date.py b/server/apps/information/migrations/0052_alter_qualification_change_date.py new file mode 100644 index 0000000..aa641aa --- /dev/null +++ b/server/apps/information/migrations/0052_alter_qualification_change_date.py @@ -0,0 +1,20 @@ +# Generated by Django 3.2.12 on 2024-06-14 06:51 + +import datetime +from django.db import migrations, models +from django.utils.timezone import utc + + +class Migration(migrations.Migration): + + dependencies = [ + ('information', '0051_alter_qualification_change_date'), + ] + + operations = [ + migrations.AlterField( + model_name='qualification', + name='change_date', + field=models.DateField(blank=True, default=datetime.datetime(2024, 6, 14, 6, 51, 53, 747831, tzinfo=utc), null=True, verbose_name='变更日期'), + ), + ]