From 4ee13894903de6fee0646cf36b7a86af6cb40650 Mon Sep 17 00:00:00 2001 From: wesley <470822125@qq.com> Date: Thu, 14 Apr 2022 12:22:58 +0800 Subject: [PATCH] 给大志哥 --- src/views/QuestionBank/components/EditDimension.vue | 1 + src/views/QuestionBank/index.vue | 68 +++++++++++++++++++++++++++++++++++++++++--------------------------- src/views/TestPaper/ManualTestPaper.vue | 75 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++- src/views/TestPaper/TestPaperList.vue | 34 ++++++++++++++++++++-------------- 4 files changed, 136 insertions(+), 42 deletions(-) diff --git a/src/views/QuestionBank/components/EditDimension.vue b/src/views/QuestionBank/components/EditDimension.vue index 8ac49c4..2d38498 100644 --- a/src/views/QuestionBank/components/EditDimension.vue +++ b/src/views/QuestionBank/components/EditDimension.vue @@ -122,6 +122,7 @@ activeName: '', dialogFormVisible: false, form: {}, + ruleOptions: [ { label: '大于', value: '>' }, { label: '小于', value: '<' }, diff --git a/src/views/QuestionBank/index.vue b/src/views/QuestionBank/index.vue index d36c527..362e593 100644 --- a/src/views/QuestionBank/index.vue +++ b/src/views/QuestionBank/index.vue @@ -6,6 +6,7 @@
+
@@ -18,7 +19,8 @@ {{ node.label }} - + 添加下级 编辑 @@ -45,7 +47,7 @@ box-shadow: 0 0 10px #efefef; margin-top: 10px; " :header-cell-class-name="headerStyle" :stripe="true"> - + @@ -144,12 +146,17 @@ +
+ +
- + @@ -165,7 +172,7 @@ @@ -181,7 +191,7 @@ - + {{ item.option }} @@ -230,7 +240,7 @@ }, data() { return { - FormClassType:0, + FormClassType: 0, loading: false, currentEditDimension: {}, activeTab: "first", @@ -259,12 +269,13 @@ fraction: 0, singleFraction: 0, addTime: "2021-11-12", - state: 1, + state: 1, }, subjectContent: [ { option: "A", optionContent: "", + scorerule:'高' }, ], QuestionClass: [], @@ -279,6 +290,7 @@ firstTreeData: [], secondTreeData: [], CreatClassId: 0, + scoreRules:['高','中','低'], }; }, created() { }, @@ -295,13 +307,15 @@ this.getQuestionClassListHeadler(); }, methods: { - AddSubject(){ + AddSubject() { this.FormClassType = 0; + // if(!this.Dataform.scoperule) + // this.Dataform.scoperule='高'; this.dialogsubjectlVisible = true }, - changequestionclass(a,b,c){ - var item = this.QuestionClass.find(o=>o.id ==a); - if(item) this.FormClassType = item.ClassType; + changequestionclass(a, b, c) { + var item = this.QuestionClass.find(o => o.id == a); + if (item) this.FormClassType = item.ClassType; }, //维度编辑 handleEditDimension(node, data) { @@ -320,10 +334,10 @@ // console.log(node, data); // console.log(this.API); this.API.deleteQuestionClass(data.value).then((res) => { - + this.getQuestionClassListHeadler(); - this.loading = false; + this.loading = false; this.$message.success('操作成功!'); }); }, @@ -341,24 +355,24 @@ }, //添加分类 CreateQuestionClassHealder() { - if(this.loading)return; - this.loading=true; - + if (this.loading) return; + this.loading = true; + this.QuestionClassInfo.Addtime = parseTime(new Date(), ""); CreateQuestionClass(this.QuestionClassInfo).then((res) => { this.getQuestionClassListHeadler(); this.dialogClassIVIsible = false; - setTimeout(()=>{ - this.loading = false; - },1000); + setTimeout(() => { + this.loading = false; + }, 1000); }); }, //获取选择的题目详细信息 GetQuestionBankByIdHeadler(id) { GetQuestionBankById(id).then((res) => { - - var d = this.QuestionClass.find(o=>o.id==res.data.data.QuestionClassId); - if(d)this.FormClassType = d.ClassType; + + var d = this.QuestionClass.find(o => o.id == res.data.data.QuestionClassId); + if (d) this.FormClassType = d.ClassType; this.changeQuestionType(res.data.data.subjectType); //这里先初始化编辑显示内容 this.Dataform = res.data.data; //内容赋值 this.subjectContent = JSON.parse(res.data.data.subjectContent); //赋值选项 @@ -387,7 +401,7 @@ this.GroupVisible = true; }, //选择题目类型来判断是否显示部分表单 - changeQuestionType(val) { + changeQuestionType(val) { if (val == 3) { this.OptionVisible = false; } @@ -395,7 +409,7 @@ this.OptionVisible = true; this.Dataform.answer = []; this.GroupVisible = false; - + } if (val == 1) { this.Dataform.answer = []; @@ -426,7 +440,7 @@ }); }, handleNodeClick(val) { - if(this.loading)return; + if (this.loading) return; this.parameter.QuestionClassId = val.value; this.parameter.pageIndex = 1; this.GetList(); diff --git a/src/views/TestPaper/ManualTestPaper.vue b/src/views/TestPaper/ManualTestPaper.vue index 0afed77..27c9b56 100644 --- a/src/views/TestPaper/ManualTestPaper.vue +++ b/src/views/TestPaper/ManualTestPaper.vue @@ -10,10 +10,14 @@
+
+ 随机抽题 +
+
  • {{ i.subject }}
  • 加载中...

    @@ -113,6 +117,40 @@
    + + + + + + + + + + 删除 + + + 提交 + 新增域名 + 重置 + + + + @@ -122,13 +160,20 @@ import { GetQuestionClassByType } from "@/api/QuestionClass"; import { EditTestPaper, GetToplevel } from "@/api/TestPaper"; import { formatTime } from '@/utils/util' - export default { + export default { //注册draggable组件 components: { draggable, }, data() { return { + dynamicValidateForm: { + domains: [{ + value: '' + }], + email: '' + }, + dialogTableVisible:false, loadingType:false, activeTab: "6", parameter: { @@ -221,6 +266,34 @@ //this.GetList(); }, methods: { + randomSubject(){ + this.dialogTableVisible=true; + }, + submitForm(formName) { + this.$refs[formName].validate((valid) => { + if (valid) { + alert('submit!'); + } else { + console.log('error submit!!'); + return false; + } + }); + }, + resetForm(formName) { + this.$refs[formName].resetFields(); + }, + removeDomain(item) { + var index = this.dynamicValidateForm.domains.indexOf(item) + if (index !== -1) { + this.dynamicValidateForm.domains.splice(index, 1) + } + }, + addDomain() { + this.dynamicValidateForm.domains.push({ + value: '', + key: Date.now() + }); + }, changetimestartend(val, aa) { this.TestPaper.EffectiveStartTime = formatTime(val[0]) this.TestPaper.EffectiveEndTime = formatTime(val[1]) diff --git a/src/views/TestPaper/TestPaperList.vue b/src/views/TestPaper/TestPaperList.vue index f93231b..3afb957 100644 --- a/src/views/TestPaper/TestPaperList.vue +++ b/src/views/TestPaper/TestPaperList.vue @@ -155,9 +155,9 @@ getTestPaperClassList, DeleteTestPaper } from '@/api/TestPaper' - import {formatTime} from '@/utils/util' + import { formatTime } from '@/utils/util' let that - export default { + export default { data() { return { parameter: { @@ -212,10 +212,16 @@ }, filters: { typeFilters(val) { - const data = that.list.filter(t => t.id == val)[0] - if (data) { - return data.ClassTitle - } else { + var that = this; + try { + if (!that.list) return '未知'; + const data = that.list.filter(t => t.id == val)[0] + if (data) { + return data.ClassTitle + } else { + return '未知' + } + } catch (e) { return '未知' } } @@ -231,13 +237,13 @@ this.getQuestionClassListHeadler(); }, methods: { - changetimestartend(val, aa) { + changetimestartend(val, aa) { this.TestPaper.EffectiveStartTime = formatTime(val[0]) - this.TestPaper.EffectiveEndTime = formatTime(val[1]) + this.TestPaper.EffectiveEndTime = formatTime(val[1]) }, closeClassDialog() { this.dialogAddTestPaperVIsible = false - this.TestPaper= { + this.TestPaper = { TestPaperTitle: "", PlateClass: "4", TestPaperClassId: 0, @@ -289,7 +295,7 @@ getQuestionClassListHeadler() { let _this = this; GetToplevel().then(res => { - var gettree = function(titem) { + var gettree = function (titem) { titem.children = [] let childrenList = res.data.data.filter(u => u.ParentId == titem.value); if (childrenList.length == 0) @@ -330,15 +336,15 @@ val.date = []; val.date.push(val.EffectiveStartTime) val.date.push(val.EffectiveEndTime) - } + } this.TestPaper = val } else if (value == 'del') { - DeleteTestPaper(val.id).then(rs=>{ + DeleteTestPaper(val.id).then(rs => { this.$message.success('删除成功!'); this.getTestPaperListHeadler(); }) - + } } @@ -365,4 +371,4 @@ margin-top: 12px; margin-right: 10px; } - + \ No newline at end of file -- libgit2 0.21.4