mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/fe-manage.git
synced 2025-12-15 05:46:45 +08:00
feat:考试和作业数据接入
This commit is contained in:
14
src/api/indexExam.js
Normal file
14
src/api/indexExam.js
Normal file
@@ -0,0 +1,14 @@
|
||||
import http from "./config";
|
||||
// 创建考试信息接口
|
||||
export const createExamination = (obj) => http.post('/examination/createExamination',obj,{
|
||||
headers: {
|
||||
'token': '123'
|
||||
}
|
||||
});
|
||||
// 根据Id删除考试信息
|
||||
export const deleteExaminationById = (obj) => http.post('/examination/deleteExaminationById',obj);
|
||||
// 根据ID获取考试信息详情
|
||||
export const queryExaminationDetailById = (obj) => http.post('/examination/queryExaminationDetailById',obj);
|
||||
// 创建考试信息接口
|
||||
export const updateExamination = (obj) => http.post('/examination/updateExamination',obj);
|
||||
|
||||
14
src/api/indexWork.js
Normal file
14
src/api/indexWork.js
Normal file
@@ -0,0 +1,14 @@
|
||||
import http from "./config";
|
||||
// 创建作业信息接口
|
||||
export const createWorkTask = (obj) => http.post('/work/createWorkTask',obj,{
|
||||
headers: {
|
||||
'token': '123'
|
||||
}
|
||||
});
|
||||
// 删除作业信息接口
|
||||
export const deleteWorkTask = (obj) => http.post('/work/deleteWorkTask',obj);
|
||||
// 根据ID获取作业信息详情
|
||||
export const queryWorkDetailById = (obj) => http.post('/work/queryWorkDetailById',obj);
|
||||
// 修改作业信息接口
|
||||
export const updateWorkTaskUsing = (obj) => http.post('/work/updateWorkTask',obj);
|
||||
|
||||
@@ -63,6 +63,7 @@
|
||||
<div class="btnbox">
|
||||
<a-range-picker
|
||||
style="width: 424px"
|
||||
v-model:value="choosedTime"
|
||||
:placeholder="[' 开始时间', ' 结束时间']"
|
||||
/>
|
||||
</div>
|
||||
@@ -78,7 +79,15 @@
|
||||
<span style="margin-right: 3px">附件:</span>
|
||||
</div>
|
||||
<div class="btnbox">
|
||||
<a-upload
|
||||
v-model:file-list="fileList"
|
||||
name="file"
|
||||
action="/api/file/upload"
|
||||
:headers="headers"
|
||||
@change="handleChange"
|
||||
>
|
||||
<button class="xkbtn">上传附件</button>
|
||||
</a-upload>
|
||||
</div>
|
||||
</div>
|
||||
<div class="main_item" style="margin-top:-25px;">
|
||||
@@ -91,14 +100,18 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="main_btns">
|
||||
<button class="btn1">取消</button>
|
||||
<button class="btn2">确定</button>
|
||||
<button class="btn1" @click="closeDrawer">取消</button>
|
||||
<button class="btn2" @click="addHomework">确定</button>
|
||||
</div>
|
||||
</div>
|
||||
</a-drawer>
|
||||
</template>
|
||||
<script>
|
||||
import { reactive, toRefs, ref } from "vue";
|
||||
import {message} from"ant-design-vue";
|
||||
import {createWorkTask} from "@/api/indexWork"
|
||||
import dayjs from 'dayjs';
|
||||
|
||||
const rowSelection = ref({
|
||||
checkStrictly: false,
|
||||
onChange: (selectedRowKeys, selectedRows) => {
|
||||
@@ -129,18 +142,65 @@ export default {
|
||||
const state = reactive({
|
||||
inputV1: "",
|
||||
textV1:"",
|
||||
choosedTime:[],
|
||||
});
|
||||
const handleChange = info => {
|
||||
if (info.file.status !== 'uploading') {
|
||||
console.log(info.file, info.fileList);
|
||||
}
|
||||
|
||||
if (info.file.status === 'done') {
|
||||
message.success(`${info.file.name} 文件上传成功`);
|
||||
} else if (info.file.status === 'error') {
|
||||
message.error(`${info.file.name} 文件上传失败.`);
|
||||
}
|
||||
};
|
||||
|
||||
const fileList = ref([]);
|
||||
const closeDrawer = () => {
|
||||
ctx.emit("update:addhomeworkVisible", false);
|
||||
};
|
||||
const afterVisibleChange = (bool) => {
|
||||
console.log("state", bool);
|
||||
};
|
||||
const addHomework = () => {
|
||||
if(state.choosedTime.length && state.inputV1 && state.textV1){
|
||||
createWorkTask({
|
||||
"createTime": "",
|
||||
"createUser": 0,
|
||||
"submitEndTime": dayjs(state.choosedTime[1]).format("YYYY-MM-DD"),
|
||||
"submitStartTime": dayjs(state.choosedTime[0]).format("YYYY-MM-DD"),
|
||||
"updateTime": "",
|
||||
"updateUser": 0,
|
||||
"workEnclosureAddress": "",
|
||||
"workFlag": "",
|
||||
"workId": 0,
|
||||
"workName": state.inputV1,
|
||||
"workRequirement": state.textV1,
|
||||
"workTag": ""
|
||||
}).then((res)=>{
|
||||
message.success(`添加成功${res}`)
|
||||
ctx.emit("update:addhomeworkVisible", false);
|
||||
}).catch((err)=>{
|
||||
message.error(`添加失败${err}`)
|
||||
})
|
||||
}
|
||||
else{
|
||||
message.error(`字段不能为空`)
|
||||
return 0
|
||||
}
|
||||
}
|
||||
return {
|
||||
...toRefs(state),
|
||||
afterVisibleChange,
|
||||
closeDrawer,
|
||||
rowSelection,
|
||||
addHomework,
|
||||
handleChange,
|
||||
fileList,
|
||||
headers: {
|
||||
"token":"123"
|
||||
},
|
||||
};
|
||||
},
|
||||
};
|
||||
|
||||
@@ -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,
|
||||
};
|
||||
},
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user