feat:考试和作业数据接入

This commit is contained in:
王熙东
2022-11-01 10:21:29 +08:00
parent df086b071d
commit 88cbb07567
4 changed files with 150 additions and 5 deletions

View File

@@ -43,7 +43,7 @@
</div>
<div class="textarea">
<a-textarea
v-model:value="textV1"
v-model:value="testV1"
placeholder="请输入考试说明"
allow-clear
maxlength="150"
@@ -66,6 +66,7 @@
style="width: 424px"
placeholder="请输入考试名称"
:options="options1"
v-model:value="choosedTest"
allowClear
showSearch
/>
@@ -83,6 +84,7 @@
</div>
<div class="btnbox">
<a-range-picker
v-model:value="testTime"
style="width: 424px"
:placeholder="[' 开始时间', ' 结束时间']"
/>
@@ -199,14 +201,17 @@
</div>
</div>
<div class="main_btns">
<button class="btn1">取消</button>
<button class="btn2">确定</button>
<button class="btn1" @click="closeDrawer">取消</button>
<button class="btn2" @click="addTest">确定</button>
</div>
</div>
</a-drawer>
</template>
<script>
import { reactive, toRefs, ref } from "vue";
import {message} from"ant-design-vue";
import {createExamination} from "@/api/indexExam"
import dayjs from 'dayjs';
const rowSelection = ref({
checkStrictly: false,
onChange: (selectedRowKeys, selectedRows) => {
@@ -244,7 +249,19 @@ export default {
radioV2: "",
radioV3: "",
radioV4: "",
choosedTest: "",
testTime:"",
});
const options1 = ref([
{
label:'math',
value:'math',
},
{
label:'eng',
value:'eng',
},
])
const closeDrawer = () => {
ctx.emit("update:addtestVisible", false);
state.radioV1 = "";
@@ -252,6 +269,44 @@ export default {
state.radioV3 = "";
state.radioV4 = "";
};
const addTest = () => {
if(state.testTime.length
&& state.inputV1&& state.inputV2&& state.inputV3&& state.inputV4
&& state.radioV1&& state.radioV2&& state.radioV3
){
createExamination({
"createTime": "",
"createUser": 0,
"examinationDuration": state.inputV2,
"examinationEndTime": dayjs(state.testTime[1]).format("YYYY-MM-DD"),
"examinationExplain": state.testV1,
"examinationFlag": "",
"examinationId": 0,
"examinationLimit": state.inputV3,
"examinationName": state.inputV1,
"examinationPaperId": 0,
"examinationPaperName": state.choosedTest,
"examinationStartTime": dayjs(state.testTime[0]).format("YYYY-MM-DD"),
"examinationTag": "",
"passLine": state.inputV4,
"questionArrangement": state.radioV4,
"scoringModel": state.radioV3,
"showAnalysis": state.radioV2,
"showAnswers": state.radioV1,
"updateTime": "",
"updateUser": 0
}).then((res)=>{
message.success(`添加成功${res}`)
ctx.emit("update:addtestVisible", false);
}).catch((err)=>{
message.error(`添加失败${err}`)
})
}
else{
message.error(`字段不能为空`)
return 0
}
}
const afterVisibleChange = (bool) => {
console.log("state", bool);
};
@@ -284,6 +339,8 @@ export default {
cloradio2,
cloradio3,
cloradio4,
addTest,
options1,
};
},
};