dbsd_kczx/src/views/kc/wjxCswj/WjxCywjV2List.vue

1738 lines
66 KiB
Vue
Raw Normal View History

2024-08-09 14:08:22 +08:00
<template>
<div style="background: #fafafa; height: calc(100vh - 225px); overflow-y: auto; margin: 10px 0; padding: 8px 0 0 0">
<div v-if="showType == 0">
<a-row>
<a-col :span="24"><span class="title">课程测验次数设置</span><a-divider /></a-col>
<div class="work-img">
<img class="work-img-img" src="../../../assets/images/homework.png" />
</div>
<a-col :span="24" style="text-align: center; color: #494b56">
<div>老师您好</div>
<div>请根据课程目标及课程教学大纲的要求设置学生修完本课程需要完成的课程测验次数</div>
<div style="margin-top: 30px" class="ant-btn buttonClass"><a @click="handleShowType(1)">设置测验次数</a></div>
<div class="tishi">温馨提示设置完成后您也可以在课程教学过程中随时根据实际情况进行调整</div>
</a-col>
</a-row>
</div>
2024-08-12 09:14:57 +08:00
2024-08-09 14:08:22 +08:00
<div v-if="showType == 1">
<a-row>
<a-col :span="24"><span class="title">课程测验次数设置</span><a-divider /></a-col>
<a-col :span="24" style="padding: 0 0 0 30px">
<a-row>
<a-col :span="18" style="margin-top: 5px">
<span style="color: #777777">学生修完本课程需要完成的测验次数</span>
<a-input-number style="width: 30%" v-model:value="zycs" @change="handleZycs" :max="100" /><span style="margin-left: 5px"></span>
</a-col>
<a-col :span="6" style="text-align: right; padding: 5px 0 0 0">
<a @click="handleAddZycs" class="ant-btn buttonClass mar-right20"><Icon icon="ant-design:file-add-outlined" />新增测验</a>
</a-col>
</a-row>
</a-col>
<a-col :span="24" style="margin-top: 10px">
<a-table :columns="columns" :data-source="tableData" :pagination="false">
<template #bodyCell="{ column, record }">
<template v-if="column.key === 'score'">
<span>
<a-input-number v-model:value="record.score" :min="0" :max="100"> <template #addonAfter> % </template></a-input-number>
</span>
</template>
<template v-else-if="column.key === 'lstitle'">
<span> {{ record.sort }}次测验 </span>
</template>
<template v-else-if="column.key === 'action'">
<span>
<a @click="handleDelZycs(record.sort)">删除</a>
</span>
</template>
</template>
</a-table>
</a-col>
<a-col :span="24" style="margin-top: 30px; font-size: 18px">
<div style="text-align: center">
<a-button class="buttonClass" @click="handleBatchAdd"><Icon icon="ant-design:save-outlined" />保存</a-button>
<a-divider type="vertical" />
<a-button class="buttonClass" @click="reloadZy"><Icon icon="ant-design:export-outlined" />返回</a-button>
</div>
</a-col>
</a-row>
</div>
2024-08-12 09:14:57 +08:00
2024-08-09 14:08:22 +08:00
<div v-if="showType == 2">
<a-spin :spinning="confirmLoading">
<a-row>
<a-col :span="24">
2024-08-12 09:14:57 +08:00
<span class="title">编辑测验</span> - <span class="title2">布置测验设置第{{ zyInfo.sort }}次测验内容及要求</span>
2024-08-09 14:08:22 +08:00
<a-divider />
</a-col>
<a-col :span="24">
<a-form ref="formRef" class="antd-modal-form" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-row>
<a-col :span="24">
<div class="region">
<div class="region-title">基本信息</div>
<a-col :span="24">
<a-form-item label="测验名称" v-bind="validateInfos.title">
2024-08-12 09:14:57 +08:00
<a-input v-model:value="zyInfo.title" placeholder="请输入测验题目" :disabled="editDisabled"></a-input>
2024-08-09 14:08:22 +08:00
</a-form-item>
</a-col>
<!-- <a-col :span="24">
<a-form-item label="考察内容" v-bind="validateInfos.kcnr">
<a-textarea v-model:value="zyInfo.kcnr" placeholder="请输入描述" hidden></a-textarea>
<a-button type="primary" @click="handleKcnr" :disabled="editDisabled">选择</a-button>
</a-form-item>
</a-col>
<a-col :span="24" style="padding: 0 20px" v-if="dataKhnr.length > 0">
<a-table :columns="columnsKhnr" rowKey="id" :data-source="dataKhnr" :pagination="false" />
</a-col> -->
<a-col :span="24">
<a-form-item label="测验开始时间" v-bind="validateInfos.startTime">
<a-date-picker
placeholder="请选择测验开始时间"
v-model:value="zyInfo.startTime"
:disabled-date="disabledDate"
:show-time="{ format: 'YYYY-MM-DD HH:mm' }"
valueFormat="YYYY-MM-DD HH:mm"
format="YYYY-MM-DD HH:mm"
style="width: 90%"
:disabled="editDisabled"
/>
<span>
<a-popover title="温馨提示">
<template #content>
<p
2024-08-12 09:14:57 +08:00
>填写测验开始时间则测验在指定时间进行发布如未填写测验开始时间则布置完成测验后可手动点击发布测验进行测验发布</p
2024-08-09 14:08:22 +08:00
>
</template>
<Icon
icon="ant-design:question-circle-outlined"
:size="20"
style="float: right; margin-top: 5px; color: #029c88; margin-right: 19px"
/>
</a-popover>
</span>
</a-form-item>
</a-col>
<a-col :span="24">
2024-08-12 09:14:57 +08:00
<a-form-item label="测验结束时间" v-bind="validateInfos.endTime">
2024-08-09 14:08:22 +08:00
<a-date-picker
2024-08-12 09:14:57 +08:00
placeholder="请选择测验结束时间"
2024-08-09 14:08:22 +08:00
v-model:value="zyInfo.endTime"
:disabled-date="disabledDate"
:show-time="{ format: 'YYYY-MM-DD HH:mm' }"
valueFormat="YYYY-MM-DD HH:mm"
format="YYYY-MM-DD HH:mm"
style="width: 100%"
/>
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item label="描述" v-bind="validateInfos.content">
<j-editor v-model:value="zyInfo.content" v-if="zyyqShow" @blur="handleZyyqShow(0)" />
<div style="color: #777777" v-html="zyInfo.content" v-if="!zyyqShow"></div>
2024-08-12 09:14:57 +08:00
<div @click="handleZyyqShow(1)" class="tishi" style="width: 100%" :disabled="!editDisabled">温馨提示点击可编辑描述</div>
2024-08-09 14:08:22 +08:00
</a-form-item>
</a-col>
</div>
</a-col>
<a-col :span="24">
2024-08-12 09:14:57 +08:00
<a-row style="min-height: 100px">
2024-08-09 14:08:22 +08:00
<a-col :span="4" style="padding: 10px">
<a-card title="可选题型" style="height: 300px; border: 1px solid #e8e8e8">
2024-08-12 09:14:57 +08:00
<p
><a-button type="primary" preIcon="ant-design:check-circle-outlined" @click="addTigan(3)" :disabled="editDisabled"
>单选</a-button
></p
>
<p
><a-button type="primary" preIcon="ant-design:check-square-outlined" @click="addTigan(4)" :disabled="editDisabled"
>多选</a-button
></p
>
<p
><a-button type="primary" preIcon="ant-design:check-square-outlined" @click="addTigan(5)" :disabled="editDisabled"
>填空</a-button
></p
>
2024-08-09 14:08:22 +08:00
</a-card>
<a-card title="引用题库">
2024-08-12 09:14:57 +08:00
<p><a-button type="primary" @click="handleYylx('0')" :disabled="editDisabled">我的题库</a-button></p>
<p><a-button type="primary" @click="handleYylx('1')" :disabled="editDisabled">公有题库</a-button></p>
2024-08-09 14:08:22 +08:00
</a-card>
</a-col>
2024-08-12 09:14:57 +08:00
<a-col :span="20" style="overflow-y: scroll; min-height: 100px">
2024-08-09 14:08:22 +08:00
<draggable @end="end" v-model="tiganData" item-key="id">
<template #item="{ index, element: item }">
<div>
<!-- 单选题 -->
<div style="width: 100%" v-if="item.wjType == 3">
<a-card>
<template #title>
<span>{{ index + 1 }}</span>
<a-textarea
placeholder="请填写单选题题干"
v-model:value="item.wjTitle"
:bordered="false"
:style="{ width: handinpwei(item.wjTitle) }"
:auto-size="{ minRows: 1, maxRows: 5 }"
2024-08-12 09:14:57 +08:00
:disabled="editDisabled"
2024-08-09 14:08:22 +08:00
/>
<span style="color: #c2bfbf">[单选]</span>
</template>
<template #extra>
<a-tooltip placement="topLeft" title="题目分数" v-if="isShow">
2024-08-12 09:14:57 +08:00
<a-select
style="width: 120px"
v-model:value="item.wjScore"
placeholder="请选择分数"
v-if="item.wjSfqh == '0'"
:disabled="editDisabled"
>
2024-08-09 14:08:22 +08:00
<a-select-option value="5">5</a-select-option>
<a-select-option value="4">4</a-select-option>
<a-select-option value="3">3</a-select-option>
<a-select-option value="2">2</a-select-option>
<a-select-option value="1">1</a-select-option>
</a-select>
2024-08-12 09:14:57 +08:00
<span v-if="item.wjSfqh == '0'" @click="handleQiehuan(item, '1')" style="color: #9e9e9e" :disabled="editDisabled"
>自定义分数</span
>
<a-input-number
v-model:value="item.wjScore"
style="width: 120px"
v-if="item.wjSfqh == '1'"
:disabled="editDisabled"
></a-input-number>
<span v-if="item.wjSfqh == '1'" @click="handleQiehuan(item, '0')" style="color: #9e9e9e" :disabled="editDisabled"
>返回</span
>
2024-08-09 14:08:22 +08:00
</a-tooltip>
<a-tooltip placement="topRight" title="删除此题"
><Icon
icon="ant-design:delete-outlined"
style="cursor: pointer; font-size: 20px; margin: 10px"
@click="handleDelTigan(item, index)"
2024-08-12 09:14:57 +08:00
v-if="!editDisabled"
2024-08-09 14:08:22 +08:00
/></a-tooltip>
</template>
<a-row v-if="isShow">
<a-col :span="24" style="color: darkgrey; font-size: 13px"> 选中即为正确答案 </a-col>
</a-row>
<a-radio-group v-model:value="item.itemSelected" style="width: 100%" size="default" :disabled="!isShow">
<div style="width: 100%" v-for="(tmxx, index) in item.wjxWjxxTmxxList" :key="index">
<a-radio :value="tmxx.itemIndex + ``" style="width: 100%">
<a-input
placeholder="请填写选项"
v-model:value="tmxx.itemTitle"
:style="{ width: handinpwei(tmxx.itemTitle) }"
:bordered="false"
2024-08-12 09:14:57 +08:00
:disabled="editDisabled"
2024-08-09 14:08:22 +08:00
/>
<span style="color: #ecb646" v-if="item.itemSelected == tmxx.itemIndex">(正确答案)</span>
<a-tooltip placement="topLeft" title="在下方添加新的选项"
><Icon
icon="ant-design:plus-circle-outlined"
style="cursor: pointer; margin: 5px; font-size: 20px; color: #1890ff"
@click="handleAddTmxx(tmxx, index, item.wjxWjxxTmxxList)"
2024-08-12 09:14:57 +08:00
v-if="!editDisabled"
2024-08-09 14:08:22 +08:00
/></a-tooltip>
<a-tooltip placement="topLeft" title="删除选项"
><Icon
icon="ant-design:minus-circle-outlined"
style="cursor: pointer; margin: 5px; font-size: 20px; color: #1890ff"
@click="handleRemTmxx(tmxx, index, item.wjxWjxxTmxxList)"
2024-08-12 09:14:57 +08:00
v-if="!editDisabled"
2024-08-09 14:08:22 +08:00
/></a-tooltip>
</a-radio>
</div>
</a-radio-group>
</a-card>
</div>
<!-- 多选题 -->
<div style="width: 100%" v-else-if="item.wjType == 4">
<a-card>
<template #title>
<span>{{ index + 1 }}</span
><a-textarea
placeholder="请填写多选题题干"
v-model:value="item.wjTitle"
:bordered="false"
:style="{ width: handinpwei(item.wjTitle) }"
:auto-size="{ minRows: 1, maxRows: 5 }"
2024-08-12 09:14:57 +08:00
:disabled="editDisabled"
2024-08-09 14:08:22 +08:00
/>
<span style="color: #c2bfbf">[多选]</span>
</template>
<template #extra>
<a-tooltip placement="topLeft" title="题目分数" v-if="isShow">
2024-08-12 09:14:57 +08:00
<a-select
style="width: 120px"
v-model:value="item.wjScore"
placeholder="请选择分数"
v-if="item.wjSfqh == '0'"
:disabled="editDisabled"
>
2024-08-09 14:08:22 +08:00
<a-select-option value="5">5</a-select-option>
<a-select-option value="4">4</a-select-option>
<a-select-option value="3">3</a-select-option>
<a-select-option value="2">2</a-select-option>
<a-select-option value="1">1</a-select-option>
</a-select>
2024-08-12 09:14:57 +08:00
<span v-if="item.wjSfqh == '0'" @click="handleQiehuan(item, '1')" style="color: #9e9e9e" :disabled="editDisabled"
>自定义分数</span
>
<a-input-number
v-model:value="item.wjScore"
style="width: 120px"
v-if="item.wjSfqh == '1'"
:disabled="editDisabled"
></a-input-number>
<span v-if="item.wjSfqh == '1'" @click="handleQiehuan(item, '0')" style="color: #9e9e9e" :disabled="editDisabled"
>返回</span
>
2024-08-09 14:08:22 +08:00
</a-tooltip>
<a-tooltip placement="topRight" title="删除此题"
><Icon
icon="ant-design:delete-outlined"
style="cursor: pointer; font-size: 20px; margin: 10px"
@click="handleDelTigan(item, index)"
2024-08-12 09:14:57 +08:00
v-if="!editDisabled"
2024-08-09 14:08:22 +08:00
/></a-tooltip>
</template>
<a-row v-if="isShow">
<a-col :span="24" style="color: darkgrey; font-size: 13px"> 选中即为正确答案 </a-col>
</a-row>
2024-08-12 09:14:57 +08:00
<a-checkbox-group v-model:value="item.itemSelected" style="width: 100%" :disabled="!isShow" @change="handleChecked">
2024-08-09 14:08:22 +08:00
<a-row>
<a-col :span="24" v-for="(tmxx, index) in item.wjxWjxxTmxxList" :key="index">
<!-- -{{item.itemSelected}}-{{tmxx.itemIndex}} -->
<a-checkbox :value="tmxx.itemIndex"
><a-input
placeholder="请填写选项"
v-model:value="tmxx.itemTitle"
:bordered="false"
:style="{ width: handinpwei(tmxx.itemTitle) }"
2024-08-12 09:14:57 +08:00
:disabled="editDisabled"
2024-08-09 14:08:22 +08:00
/></a-checkbox>
<span style="color: #ecb646" v-if="cheGrp(item.itemSelected, tmxx.itemIndex)">(正确答案)</span>
<a-tooltip placement="topLeft" title="在下方添加新的选项"
><Icon
icon="ant-design:plus-circle-outlined"
style="cursor: pointer; margin: 5px; font-size: 20px; color: #1890ff"
@click="handleAddTmxx(tmxx, index, item.wjxWjxxTmxxList)"
2024-08-12 09:14:57 +08:00
v-if="!editDisabled"
2024-08-09 14:08:22 +08:00
/></a-tooltip>
<a-tooltip placement="topLeft" title="删除选项"
><Icon
icon="ant-design:minus-circle-outlined"
style="cursor: pointer; margin: 5px; font-size: 20px; color: #1890ff"
@click="handleRemTmxx(tmxx, index, item.wjxWjxxTmxxList)"
2024-08-12 09:14:57 +08:00
v-if="!editDisabled"
2024-08-09 14:08:22 +08:00
/></a-tooltip>
</a-col>
</a-row>
</a-checkbox-group>
</a-card>
</div>
<!-- 填空题 -->
<div style="width: 100%" v-else-if="item.wjType == 5">
<a-card>
<template #title>
<span>{{ index + 1 }}</span
><a-textarea
placeholder="请填写填空题题干"
v-model:value="item.wjTitle"
:bordered="false"
:style="{ width: handinpwei(item.wjTitle) }"
:auto-size="{ minRows: 1, maxRows: 5 }"
2024-08-12 09:14:57 +08:00
:disabled="editDisabled"
2024-08-09 14:08:22 +08:00
/>
<span style="color: #c2bfbf">[填空]</span>
</template>
<template #extra>
<a-tooltip placement="topLeft" title="题目分数" v-if="isShow">
2024-08-12 09:14:57 +08:00
<a-select
style="width: 120px"
v-model:value="item.wjScore"
placeholder="请选择分数"
v-if="item.wjSfqh == '0'"
:disabled="editDisabled"
>
2024-08-09 14:08:22 +08:00
<a-select-option value="5">5</a-select-option>
<a-select-option value="4">4</a-select-option>
<a-select-option value="3">3</a-select-option>
<a-select-option value="2">2</a-select-option>
<a-select-option value="1">1</a-select-option>
</a-select>
2024-08-12 09:14:57 +08:00
<span v-if="item.wjSfqh == '0'" @click="handleQiehuan(item, '1')" style="color: #9e9e9e" :disabled="editDisabled"
>自定义分数</span
>
<a-input-number
v-model:value="item.wjScore"
style="width: 120px"
v-if="item.wjSfqh == '1'"
:disabled="editDisabled"
></a-input-number>
<span v-if="item.wjSfqh == '1'" @click="handleQiehuan(item, '0')" style="color: #9e9e9e" :disabled="editDisabled"
>返回</span
>
2024-08-09 14:08:22 +08:00
</a-tooltip>
<a-tooltip placement="topRight" title="删除此题"
><Icon
icon="ant-design:delete-outlined"
style="cursor: pointer; font-size: 20px; margin: 10px"
@click="handleDelTigan(item, index)"
2024-08-12 09:14:57 +08:00
v-if="!editDisabled"
2024-08-09 14:08:22 +08:00
/></a-tooltip>
</template>
<a-row v-if="isShow">
<a-col :span="24">
<a-textarea
placeholder="请填写答案"
v-model:value="item.wjAnswer"
:bordered="false"
style="width: 100%"
:auto-size="{ minRows: 1, maxRows: 5 }"
2024-08-12 09:14:57 +08:00
:disabled="editDisabled"
2024-08-09 14:08:22 +08:00
/>
</a-col>
</a-row>
</a-card>
</div>
<div v-else> 无对应类型 </div>
</div>
</template>
</draggable>
<!-- 题干信息 -->
<div style="width: 100%" v-for="(item, index) in tiganData" :key="index"> </div>
</a-col>
</a-row>
</a-col>
<a-col :span="24" style="text-align: center; margin-top: 10px; margin-bottom: 40px">
2024-08-12 09:14:57 +08:00
<a-button type="primary" @click="submitForm" v-if="!editDisabled">保存</a-button>
2024-08-09 14:08:22 +08:00
<a-button type="primary" @click="reloadZy" style="margin-left: 15px">返回</a-button>
</a-col>
</a-row>
</a-form>
</a-col>
</a-row>
</a-spin>
</div>
2024-08-12 09:14:57 +08:00
<div v-if="showType == 3">
<a-row>
<a-col :span="24">
<a-row>
<a-col :span="20">
<span class="title">统计分析</span>
</a-col>
<a-col :span="4" style="text-align: right">
<a-button class="buttonClass" @click="reloadZy"><Icon icon="ant-design:export-outlined" />返回</a-button>
</a-col>
</a-row>
<a-divider />
</a-col>
<a-col :span="24">
<a-row>
<a-col :span="12" class="tjfx-col"> 测验名称{{ zyInfo.title }} </a-col>
<a-col :span="12" class="tjfx-col">
测验时间{{ dayjs(zyInfo.startTime).format('MM.DD HH:mm') }} ~ {{ dayjs(zyInfo.endTime).format('MM.DD HH:mm') }}
</a-col>
<a-col :span="8" class="tjfx-col"> 总人数{{ zyInfo.xkrs }} </a-col>
<a-col :span="8" class="tjfx-col"> 已完成人数{{ zyInfo.ywcrs }} </a-col>
<a-col :span="8" class="tjfx-col"> 未完成人数{{ zyInfo.wwcrs }} </a-col>
<a-col :span="24">
<div class="region-title">基本信息</div>
</a-col>
<a-col :span="24" v-for="(item, index) in tiganData" :key="index">
<div style="width: 100%">
<!-- 单选题 -->
<div style="width: 100%" v-if="item.wjType == 3">
<!-- <span style="text-align: left;width: 50%;font-weight: bold;font-size: 18px;padding: 20px;">单选题</span> -->
<!-- <span class="tjfx-zql">正确率15%</span> -->
<a-card>
<template #title>
<span>{{ index + 1 }}</span><span v-html="item.wjTitle" style="white-space: pre-wrap; word-wrap: break-word"></span>
</template>
<template #extra v-if="zyInfo.atype == 6">
<span style="margin-left: 40px">[单选题]</span>
<span style="margin-left: 40px">题目分值 {{ item.wjScore }} </span>
</template>
<a-radio-group v-model:value="item.itemSelected" style="width: 100%" size="default" disabled>
<div style="width: 100%" v-for="(tmxx, index2) in item.wjxWjxxTmxxList" :key="index2">
<a-radio :value="tmxx.itemIndex + ``" style="width: 100%; margin-bottom: 5px">
<span v-html="tmxx.itemTitle" style="width: 80%; font-size: 16px; color: #000"></span>
<span v-if="tmxx.itemSelected == 'true'" style="color: #9e9e9e; margin-left: 30px; font-size: 12px">(正确答案)</span>
<span class="tjfx-xzrs">选择人数{{ tmxx.num }}</span>
</a-radio>
</div>
</a-radio-group>
</a-card>
</div>
<!-- 多选题 -->
<div style="width: 100%" v-else-if="item.wjType == 4">
<!-- <span style="text-align: left;width: 50%;font-weight: bold;font-size: 18px;padding: 20px;">多选题</span> -->
<!-- <span class="tjfx-zql">正确率15%</span> -->
<a-card>
<template #title>
<span>{{ index + 1 }}</span><span v-html="item.wjTitle" style="white-space: pre-wrap; word-wrap: break-word" />
</template>
<template #extra v-if="zyInfo.atype == 6">
<span style="margin-left: 40px">[多选题]</span>
<span style="margin-left: 40px">题目分值 {{ item.wjScore }} </span>
</template>
<a-checkbox-group v-model:value="item.itemSelected" style="width: 100%" size="default" disabled>
<a-row>
<a-col :span="24" v-for="(tmxx, index2) in item.wjxWjxxTmxxList" :key="index2">
<a-checkbox :value="tmxx.itemIndex" style="width: 100%; margin-bottom: 5px">
<span v-html="tmxx.itemTitle" style="width: 80%; font-size: 16px; color: #000"></span>
<span v-if="tmxx.itemSelected == 'true'" style="color: #9e9e9e; margin-left: 30px; font-size: 12px">(正确答案)</span>
<span class="tjfx-xzrs">选择人数{{ tmxx.num }}</span>
</a-checkbox>
</a-col>
</a-row>
</a-checkbox-group>
</a-card>
</div>
<!-- 填空题 -->
<div style="width: 100%" v-else-if="item.wjType == 5">
<!-- <span style="text-align: left;width: 50%;font-weight: bold;font-size: 18px;padding: 20px;">填空题</span> -->
<!-- <span class="tjfx-zql">正确率15%</span> -->
<a-card>
<template #title>
<span>{{ index + 1 }}</span><span v-html="item.wjTitle" style="white-space: pre-wrap; word-wrap: break-word" />
<span v-if="item.wjAnswer" style="color: #9e9e9e; margin-left: 30px; font-size: 12px">(正确答案:{{ item.wjAnswer }})</span>
<span class="tjfx-xzrs" style="color: #9e9e9e">选择人数{{ item.num }}</span>
</template>
<template #extra v-if="zyInfo.atype == 6">
<span style="margin-left: 40px">[填空题]</span>
<span style="margin-left: 40px">题目分值 {{ item.wjScore }} </span>
</template>
</a-card>
</div>
<div v-else> 无对应类型 </div>
</div>
</a-col>
</a-row>
</a-col>
</a-row>
</div>
2024-08-09 14:08:22 +08:00
<div v-if="showType == 999">
<a-row>
<a-col :span="24"><span class="title">布置测验</span><a-divider /></a-col>
<a-col :span="24" style="text-align: right; margin-top: 5px">
<a @click="handleShowType(1)" class="ant-btn buttonClass"><Icon icon="ant-design:edit-outlined" />修改课程测验次数</a>
<a-divider type="vertical" />
<a @click="handleAddOne" class="ant-btn buttonClass mar-right20"><Icon icon="ant-design:file-add-outlined" />新增测验</a>
</a-col>
<a-col :span="24">
<a-row style="padding: 10px">
<a-col :lg="24" v-for="(item, index) in tableData" style="padding: 0 5px 5px 5px" :key="index">
2024-08-12 09:14:57 +08:00
<!-- :title="'11第' + item.sort + '次测验(占比' + item.score + '%)'" -->
<!-- class="cardClass" -->
<a-card v-if="!item.endTime" bodyStyle="background: #fff;">
<template #title>{{item.sort}}次测验暂未设置测验信息 </template>
2024-08-09 14:08:22 +08:00
<template #extra
><span style="color: #ff8710; font-weight: bold"><Icon icon="ant-design:setting-outlined" /> 待设置</span>
</template>
2024-08-12 09:14:57 +08:00
<!-- <p class="sznrClass">尚未布置测验题目及具体要求</p> -->
<a-row>
<a-col :span="12">
<span style="margin-left: 10px">
<a-dropdown>
<a class="ant-dropdown-link" @click.prevent> <Icon icon="ant-design:setting-outlined" />设计测验 </a>
<template #overlay>
<a-menu>
<a-menu-item>
<a href="javascript:;" @click="handleEdit(item, false)">设置测验</a>
</a-menu-item>
<a-menu-item>
<a href="javascript:;" @click="handleEdit(item, false)">修改题目</a>
</a-menu-item>
<a-menu-item>
<a href="javascript:;" @click="handleEdit(item, true)">测验详情</a>
</a-menu-item>
</a-menu>
</template>
</a-dropdown>
</span>
<span style="margin-left: 30px">
<a-dropdown>
<a class="ant-dropdown-link" @click.prevent><Icon icon="ant-design:setting-outlined" />发送问卷 </a>
<template #overlay>
<a-menu>
<a-menu-item>
<a href="javascript:;" disabled style="color: #9e9e9e">链接&二维码</a>
</a-menu-item>
</a-menu>
</template>
</a-dropdown>
</span>
<span style="margin-left: 30px">
<a-dropdown>
<a class="ant-dropdown-link" @click.prevent><Icon icon="ant-design:setting-outlined" />测验结果 </a>
<template #overlay>
<a-menu>
<a-menu-item>
<a href="javascript:;" disabled style="color: #9e9e9e">测验结果</a>
</a-menu-item>
<a-menu-item>
<a href="javascript:;" disabled style="color: #9e9e9e">统计分析</a>
</a-menu-item>
</a-menu>
</template>
</a-dropdown>
</span>
</a-col>
<a-col :span="12">
<div style="text-align: right">
<a @click="handleEdit(item, false)">设置测验内容及要求</a>
<a-divider type="vertical" />
<a @click="handleDelete(item)">删除</a>
</div>
</a-col>
</a-row>
2024-08-09 14:08:22 +08:00
</a-card>
2024-08-12 09:14:57 +08:00
<a-card v-if="item.endTime && item.qpublish == '1'" bodyStyle="background: #fff;">
<template #title>
<span>{{item.sort}}次测验{{ item.title }}</span>
2024-08-09 14:08:22 +08:00
</template>
2024-08-12 09:14:57 +08:00
<template #extra>
<span>ID:{{ item.id }}</span>
<span style="margin-left: 10px; color: #02aa56; font-weight: bold"><Icon icon="ant-design:check-outlined" />已发布</span>
<span style="margin-left: 10px">{{ dayjs(item.endTime).format('MM.DD HH:mm') }}</span>
</template>
<a-row>
<a-col :span="12">
<span style="margin-left: 10px">
<a-dropdown>
<a class="ant-dropdown-link" @click.prevent> <Icon icon="ant-design:setting-outlined" />设计测验 </a>
<template #overlay>
<a-menu>
<a-menu-item>
<a href="javascript:;" disabled style="color: #9e9e9e">设置测验</a>
</a-menu-item>
<a-menu-item>
<a href="javascript:;" disabled style="color: #9e9e9e">修改题目</a>
</a-menu-item>
<a-menu-item>
<a href="javascript:;" disabled style="color: #9e9e9e">测验详情</a>
</a-menu-item>
</a-menu>
</template>
</a-dropdown>
</span>
<span style="margin-left: 30px">
<a-dropdown>
<a class="ant-dropdown-link" @click.prevent><Icon icon="ant-design:setting-outlined" />发送问卷 </a>
<template #overlay>
<a-menu>
<a-menu-item>
<a href="javascript:;">链接&二维码</a>
<!-- <QrCode :value="qrCodeUrl" class="enter-x flex justify-center xl:justify-start" :width="280" /> -->
<QrCode :value="goewm(item)" class="enter-x flex justify-center xl:justify-start" :width="280" />
<span
>链接<a-input :value="goewm(item)" disabled style="width: 200px"></a-input>
<a-button @click="copyToClipboard(item)">复制</a-button>
</span>
<!-- -->
</a-menu-item>
</a-menu>
</template>
</a-dropdown>
</span>
<span style="margin-left: 30px">
<a-dropdown>
<a class="ant-dropdown-link" @click.prevent><Icon icon="ant-design:setting-outlined" />测验结果 </a>
<template #overlay>
<a-menu>
<a-menu-item>
<a href="javascript:;" @click="handleDjjgs(item, '')">测验结果</a>
</a-menu-item>
<a-menu-item>
<a href="javascript:;" @click="handleTjfx(item)">统计分析</a>
</a-menu-item>
</a-menu>
</template>
</a-dropdown>
</span>
</a-col>
<a-col :span="12">
<div style="text-align: right">
<a @click="handleEdit(item, true)" v-if="item.ytjnum > 0">编辑测验</a>
<a-divider type="vertical" />
<a @click="handleDelete(item)" v-if="item.ytjnum == '0'">删除</a>
</div>
</a-col>
</a-row>
2024-08-09 14:08:22 +08:00
</a-card>
2024-08-12 09:14:57 +08:00
<a-card v-if="item.endTime && item.qpublish == '0'" bodyStyle="background: #fff;">
<template #title>
<span>{{item.sort}}次测验{{ item.title }}</span>
2024-08-09 14:08:22 +08:00
</template>
2024-08-12 09:14:57 +08:00
<template #extra>
<span>ID:{{ item.id }}</span>
<span style="margin-left: 10px; color: #ff8710; font-weight: bold"><Icon icon="ant-design:send-outlined" />待发布</span>
<span style="margin-left: 10px">{{ dayjs(item.endTime).format('MM.DD HH:mm') }}</span>
</template>
<a-row>
<a-col :span="12">
<span style="margin-left: 10px">
<a-dropdown>
<a class="ant-dropdown-link" @click.prevent><Icon icon="ant-design:setting-outlined" />设计测验 </a>
<template #overlay>
<a-menu>
<a-menu-item>
<a href="javascript:;" @click="handleEdit(item, false)">设置测验</a>
</a-menu-item>
<a-menu-item>
<a href="javascript:;" @click="handleEdit(item, false)">修改题目</a>
</a-menu-item>
<a-menu-item>
<a href="javascript:;" @click="handleEdit(item, true)">测验详情</a>
</a-menu-item>
</a-menu>
</template>
</a-dropdown>
</span>
<span style="margin-left: 30px">
<a-dropdown>
<a class="ant-dropdown-link" @click.prevent><Icon icon="ant-design:setting-outlined" />发送问卷 </a>
<template #overlay>
<a-menu>
<a-menu-item>
<a href="javascript:;" disabled style="color: #9e9e9e">链接&二维码</a>
</a-menu-item>
</a-menu>
</template>
</a-dropdown>
</span>
<span style="margin-left: 30px">
<a-dropdown>
<a class="ant-dropdown-link" @click.prevent><Icon icon="ant-design:setting-outlined" />测验结果 </a>
<template #overlay>
<a-menu>
<a-menu-item>
<a href="javascript:;" disabled style="color: #9e9e9e">测验结果</a>
</a-menu-item>
<a-menu-item>
<a href="javascript:;" disabled style="color: #9e9e9e">统计分析</a>
</a-menu-item>
</a-menu>
</template>
</a-dropdown>
</span>
</a-col>
<a-col :span="12">
<div style="text-align: right">
<a @click="handleEdit(item, false)">编辑测验</a>
<a-divider type="vertical" />
<a @click="handleFabu(item)">发布测验</a>
<a-divider type="vertical" />
<a @click="handleDelete(item)">删除</a>
</div>
</a-col>
</a-row>
2024-08-09 14:08:22 +08:00
</a-card>
</a-col>
</a-row>
</a-col>
</a-row>
</div>
<KcTeachingUnitContentOneListModal ref="registerZcjcModal" @success="handleCheckZcjcSuccess"></KcTeachingUnitContentOneListModal>
<WjxWjxxTmlbDjjgsModal ref="WjxWjxxTmlbDjjgsModalPage"></WjxWjxxTmlbDjjgsModal>
<XxhbbksListModal ref="XxhbbksListModalPage"></XxhbbksListModal>
<YinyongTikuListModal ref="YinyongTikuListModalpage" @success="handleYytkSuccess" />
<YinyongTikuDcListModal ref="YinyongTikuDcListModalpage" @success="handleYytkSuccess" />
</div>
</template>
<script lang="ts" name="zyInfo-zyInfo" setup>
import { ref, reactive, onMounted, unref } from 'vue';
import { defHttp } from '/@/utils/http/axios';
import { useMessage } from '/@/hooks/web/useMessage';
import { useRouter } from 'vue-router';
import dayjs, { Dayjs } from 'dayjs';
import { list, deleteOne, saveOrUpdate } from '/@/views/kc/wjxWjxx/WjxWjxx.api';
import { Form } from 'ant-design-vue';
import { getValueType } from '/@/utils';
import JEditor from '/@/components/Form/src/jeecg/components/JEditor.vue';
import { useUserStore } from '/@/store/modules/user';
import draggable from 'vuedraggable';
2024-08-12 09:14:57 +08:00
import { QrCode } from '/@/components/Qrcode/index';
import { useGlobSetting } from '/@/hooks/setting';
2024-08-09 14:08:22 +08:00
import WjxWjxxTmlbDjjgsModal from '/@/views/kc/wjxWjxx/components/WjxWjxxTmlbDjjgsModal.vue';
import XxhbbksListModal from '/@/views/kc/xxhbbks/XxhbbksListModal.vue';
import KcTeachingUnitContentOneListModal from '/@/views/zy/zyInfo/zyCheckZcjc/KcTeachingUnitContentOneListModal.vue';
import YinyongTikuListModal from '/@/views/kc/wjxWjxxTmlb/YinyongTikuListModal.vue';
import YinyongTikuDcListModal from '/@/views/kc/wjxWjxxTmlb/YinyongTikuDcListModal.vue';
2024-08-12 09:14:57 +08:00
import { create } from 'sortablejs';
const globSetting = useGlobSetting();
2024-08-09 14:08:22 +08:00
//当前路由信息
const { currentRoute } = useRouter();
const { query } = unref(currentRoute);
const { rwbh, xqxn, type, teano } = query; //获取传递参数
const { createConfirm, createMessage } = useMessage();
//用户相关
const userStore = useUserStore();
const XxhbbksListModalPage = ref();
const WjxWjxxTmlbDjjgsModalPage = ref();
const registerZcjcModal = ref();
const YinyongTikuListModalpage = ref();
const YinyongTikuDcListModalpage = ref();
const showType = ref<number>(0);
const zycs = ref<number>(0);
const tableData = ref<any>([]);
const queryParamZy = ref<any>({});
const current = ref<number>(0);
const total = ref<number>(0);
const pageNo = ref<number>(0);
const pageSize = ref<number>(100);
const editDisabled = ref<boolean>(false);
const zyInfo = ref<any>({});
const dataKhnr = ref<any>([]);
const confirmLoading = ref<boolean>(false);
const zyyqShow = ref<boolean>(false);
const useForm = Form.useForm;
const formRef = ref();
const tiganData = ref<any>([]);
const isShow = ref<boolean>(false);
const mainId = ref<string>('');
const wjLeixing = ref<string>('6');
2024-08-12 09:14:57 +08:00
const qrCodeUrl = ref<string>('');
2024-08-09 14:08:22 +08:00
2024-08-12 09:14:57 +08:00
//设置测验删除功能
2024-08-09 14:08:22 +08:00
const disabledDate = (current: Dayjs) => {
return current && current < dayjs().subtract(1, 'days').endOf('day');
};
//表单验证
const validatorRules = {
2024-08-12 09:14:57 +08:00
title: [{ required: true, message: '请输入测验名称!' }],
2024-08-09 14:08:22 +08:00
endTime: [{ required: true, message: '请输入结束时间!' }],
};
const { resetFields, validate, validateInfos } = useForm(zyInfo, validatorRules, { immediate: true });
const labelCol = reactive({
xs: { span: 24 },
sm: { span: 4 },
});
const wrapperCol = reactive({
xs: { span: 24 },
sm: { span: 16 },
});
const labelCol2 = reactive({
sm: { span: 6 },
});
const wrapperCol2 = reactive({
sm: { span: 18 },
});
const labelCol3 = reactive({
sm: { span: 4 },
});
const wrapperCol3 = reactive({
sm: { span: 20 },
});
const labelCol4 = reactive({
sm: { span: 10 },
});
const wrapperCol4 = reactive({
sm: { span: 12 },
});
2024-08-12 09:14:57 +08:00
//统计分析
function handleTjfx(record) {
console.log('🥺', record);
zyInfo.value = record;
defHttp.get({ url: '/wjxWjxxTmlb/wjxWjxxTmlb/getTmxxPeop', params: { id: record.id } }).then((res) => {
tiganData.value = res;
});
handleShowType(3);
}
function handleChecked(record) {
console.log('👙', record);
record = record + '';
console.log('🙃', record);
}
function goewm(record) {
var baseUrl = window.location.origin;
var url = baseUrl + '/site/studentDjcy?cytitle=' + record.title + '&cyid=' + record.id + '&cyatype=' + record.atype + '&sfzd=0&sfbs=xs';
return url;
}
async function copyToClipboard(record) {
try {
var baseUrl = window.location.origin;
var url = baseUrl + '/site/studentDjcy?cytitle=' + record.title + '&cyid=' + record.id + '&cyatype=' + record.atype + '&sfzd=0&sfbs=xs';
await navigator.clipboard.writeText(url);
createMessage.success('内容已复制到剪贴板');
console.log('内容已复制到剪贴板');
} catch (err) {
console.error('复制到剪贴板失败:', err);
}
}
2024-08-09 14:08:22 +08:00
//切换题目分数类型
function handleQiehuan(record, type) {
console.log(`🚀 ~ handleQiehuan ~ type:`, type);
console.log(`🚀 ~ handleQiehuan ~ record:`, record);
record.wjSfqh = type;
}
//引用题库
function handleYylx(sylx) {
var createBy = '';
var wjSytype = '';
if (sylx == '0') {
//我的题库
createBy = userStore.getUserInfo.username;
} else {
//公有题库
wjSytype = '1';
}
var record = { wjLeixing, createBy, wjSytype };
if (wjLeixing.value == '6') {
YinyongTikuListModalpage.value.disableSubmit = false;
YinyongTikuListModalpage.value.init(record);
} else {
YinyongTikuDcListModalpage.value.disableSubmit = false;
YinyongTikuDcListModalpage.value.init(record);
}
}
//引用题库回调
function handleYytkSuccess(record) {
for (var i = 0; i < record.length; i++) {
var type = record[i].wjType;
var list = tiganData.value;
var wjxWjxxTmxxList = record[i].wjxWjxxTmxxList;
if (type == 3) {
var addwjxWjxxTmxxList = [];
var sfxz = '';
for (var j = 0; j < wjxWjxxTmxxList.length; j++) {
if (wjxWjxxTmxxList[j].itemSelected == 'true') {
sfxz = wjxWjxxTmxxList[j].itemIndex;
}
addwjxWjxxTmxxList.push({ itemTitle: wjxWjxxTmxxList[j].itemTitle, itemIndex: wjxWjxxTmxxList[j].itemIndex });
}
if (wjLeixing.value == '1') {
sfxz = '';
}
let params = {
wjType: parseInt(type),
wjIndex: list.length + 1,
mainId: mainId,
wjTitle: record[i].wjTitle,
wjScore: record[i].wjScore,
wjLeixing,
itemSelected: sfxz + '',
wjSfqh: '0',
wjxWjxxTmxxList: addwjxWjxxTmxxList,
};
list.push(params);
tiganData.value = [...list];
} else if (type == 4) {
var addwjxWjxxTmxxList = [];
let sfxz = [];
for (var j = 0; j < wjxWjxxTmxxList.length; j++) {
if (wjxWjxxTmxxList[j].itemSelected == 'true') {
sfxz.push(wjxWjxxTmxxList[j].itemIndex);
}
addwjxWjxxTmxxList.push({ itemTitle: wjxWjxxTmxxList[j].itemTitle, itemIndex: wjxWjxxTmxxList[j].itemIndex });
}
if (wjLeixing.value == '1') {
sfxz = [];
}
let params = {
wjType: parseInt(type),
wjIndex: list.length + 1,
mainId: mainId,
wjTitle: record[i].wjTitle,
wjScore: record[i].wjScore,
wjLeixing,
itemSelected: sfxz,
wjSfqh: '0',
wjxWjxxTmxxList: addwjxWjxxTmxxList,
};
list.push(params);
tiganData.value = [...list];
} else if (type == 5) {
var huida = record[i].wjAnswer;
if (wjLeixing.value == '1') {
huida = '';
}
let params = {
wjType: parseInt(type),
wjIndex: list.length + 1,
mainId: mainId,
wjTitle: record[i].wjTitle,
wjScore: record[i].wjScore,
wjLeixing,
wjAnswer: huida,
wjSfqh: '0',
};
list.push(params);
tiganData.value = [...list];
}
}
}
//添加选项
function handleAddTmxx(record, index, list) {
var itemIndex = 0;
for (var i = 0; i < list.length; i++) {
var lssx = list[i].itemIndex;
if (itemIndex < parseInt(lssx)) {
itemIndex = lssx;
}
}
list.push({ itemTitle: null, itemIndex: parseInt(itemIndex) + 1 });
}
2024-08-12 09:14:57 +08:00
2024-08-09 14:08:22 +08:00
//删除选项
function handleRemTmxx(record, index, list) {
if (list.length <= 2) {
createMessage.error('至少保留两个选项');
} else {
list.splice(index, 1);
}
}
2024-08-12 09:14:57 +08:00
2024-08-09 14:08:22 +08:00
//删除题目
function handleDelTigan(record, index) {
tiganData.value.splice(index, 1);
}
2024-08-12 09:14:57 +08:00
//计算输入框宽度
2024-08-09 14:08:22 +08:00
function handinpwei(value) {
if (!value) {
return '20rem';
} else {
if (String(value).length * 1.1 < 20) {
return '20rem';
} else if (String(value).length * 1.1 > 60) {
return '60rem';
} else {
return String(value).length * 1.1 + 'rem';
}
}
}
2024-08-12 09:14:57 +08:00
2024-08-09 14:08:22 +08:00
//添加单选题
function addTigan(type) {
console.log('😸', type);
var list = tiganData.value;
console.log('👩‍🦱', list);
if (type == 3) {
console.log('11111111111111111111');
var chk = '';
if (isShow.value) {
chk = '1';
}
console.log('2222222222222222222');
let params = {
wjType: parseInt(type),
wjIndex: list.length + 1,
mainId: mainId,
wjTitle: null,
wjScore: null,
wjLeixing,
itemSelected: chk,
wjSfqh: '0',
wjxWjxxTmxxList: [
{ itemTitle: null, itemIndex: '1' },
{ itemTitle: null, itemIndex: '2' },
],
};
2024-08-12 09:14:57 +08:00
console.log('💇‍♀️', params);
2024-08-09 14:08:22 +08:00
list.push(params);
2024-08-12 09:14:57 +08:00
console.log('👩‍🔬', list);
2024-08-09 14:08:22 +08:00
tiganData.value = [...list];
} else if (type == 4) {
2024-08-12 09:14:57 +08:00
let chk = '';
2024-08-09 14:08:22 +08:00
if (isShow.value) {
chk = '1,2';
}
let params = {
wjType: parseInt(type),
wjIndex: list.length + 1,
mainId: mainId,
wjTitle: null,
wjScore: null,
wjLeixing,
itemSelected: chk,
wjSfqh: '0',
wjxWjxxTmxxList: [
{ itemTitle: null, itemIndex: '1' },
{ itemTitle: null, itemIndex: '2' },
],
};
list.push(params);
tiganData.value = [...list];
} else if (type == 5) {
let params = {
wjType: parseInt(type),
wjIndex: list.length + 1,
mainId: mainId,
wjTitle: null,
wjScore: null,
wjLeixing,
wjAnswer: null,
wjSfqh: '0',
};
list.push(params);
tiganData.value = [...list];
}
}
/**
* 拖动结束事件
* @param evt
*/
function end(evt) {
for (var i = 0; i < tiganData.value.length; i++) {
tiganData.value[i].wjIndex = i + 1;
}
console.log(`🚀 ~ end ~ tiganData:`, tiganData);
}
function cheGrp(a, b) {
var retChe = false;
if (a) {
for (var i = 0; i < a.length; i++) {
if (a[i] == b) {
retChe = true;
break;
}
}
}
return retChe;
}
//显示第几个类型模块
function handleShowType(val) {
showType.value = val;
}
/**
* 发布
*/
function handleFabu(record: Recordable) {
createConfirm({
iconType: 'warning',
title: '发布测验',
content: '是否发布此测验?',
okText: '确认',
cancelText: '取消',
onOk: () => {
2024-08-12 09:14:57 +08:00
defHttp.get({ url: '/wjxWjxx/wjxWjxx/fbwj', params: { id: record.id, wjlx: wjLeixing.value } }).then((res) => {
2024-08-09 14:08:22 +08:00
reloadZy();
});
},
});
}
//动态添加测验次数
function handleZycs() {
var dataList = tableData.value;
var changeZycs = zycs.value;
if (changeZycs > dataList.length) {
for (var i = dataList.length; i < changeZycs; i++) {
dataList.push({
sort: i + 1,
lstitle: '第' + (i + 1) + '次测验',
score: '',
rwbh: rwbh,
xqxn: xqxn,
createBy: teano,
2024-08-12 09:14:57 +08:00
atype: wjLeixing.value,
2024-08-09 14:08:22 +08:00
});
}
} else if (changeZycs < dataList.length) {
for (var i = dataList.length; i > changeZycs; i--) {
dataList.pop();
}
} else {
for (let i = 0; i < dataList.length; i++) {
var ppar = dataList[i];
ppar.sort = i + 1;
dataList[i] = ppar;
}
}
tableData.value = dataList;
}
//新增一次测验,再最后面添加
function handleAddZycs() {
var changeZycs = zycs.value;
zycs.value = changeZycs + 1;
handleZycs();
}
//删除指定第几次测验
function handleDelZycs(index) {
var dataList = tableData.value;
dataList.splice(index - 1, 1);
tableData.value = dataList;
zycs.value = dataList.length;
handleZycs();
}
//批量进行保存
function handleBatchAdd() {
var list = tableData.value;
var sfjx = 0; //是否继续
var cjbfb = 0; //成绩百分比
if (list.length == 0) {
createMessage.error('测验次数不能为空!');
return;
}
for (var i = 0; i < list.length; i++) {
console.log('🥵', list);
var score = list[i].score;
console.log('👨‍❤️‍💋‍👨', !score);
console.log('🤖', score == null);
console.log('🤖', score + '' == '');
if (score == null || score + '' == '') {
createMessage.error('第' + (i + 1) + '次测验占期末总成绩的百分比不能为空!');
sfjx = 1;
break;
}
cjbfb = parseInt(cjbfb) + parseInt(score);
if (score < 0 || score > 100) {
createMessage.error('测验成绩百分比必须在0-100之间');
sfjx = 1;
break;
}
}
if (sfjx == 1) {
return;
}
if (cjbfb > 100) {
createMessage.error('本次测验占期末总成绩的百分比不得超过100%,当前测验总百分比为:' + cjbfb + '%');
return;
}
createConfirm({
iconType: 'warning',
title: '确认保存',
content: '设置完课程测验次数后,需要对每次测验的内容和要求进行设置,然后进行发布',
okText: '确认',
cancelText: '取消',
onOk: () => {
defHttp.post({ url: '/wjxWjxx/wjxWjxx/batchAdd', data: list }).then((res) => {
reloadZy();
});
},
});
}
const columns = [
{
title: '序号',
dataIndex: 'sort',
key: 'sort',
},
{
title: '测验次数',
dataIndex: 'lstitle',
key: 'lstitle',
},
{
title: '本次测验占期末总成绩的百分比',
dataIndex: 'score',
key: 'score',
},
{
title: '操作',
key: 'action',
},
];
const columnsKhnr = [
{
title: '序号',
dataIndex: 'no',
key: 'no',
customRender: (text) => {
return text.index + 1;
},
width: 80,
},
{
title: '章次',
dataIndex: 'title',
key: 'title',
},
{
title: '节次',
dataIndex: 'twoTitle',
key: 'twoTitle',
},
];
/**
* 提交数据
*/
async function submitForm() {
// 触发表单验证
await validate();
confirmLoading.value = true;
const isUpdate = ref<boolean>(false);
//时间格式化
let model = zyInfo.value;
if (model.id) {
isUpdate.value = true;
}
//循环数据
for (let data in model) {
//如果该数据是数组并且是字符串类型
if (model[data] instanceof Array) {
let valueType = getValueType(formRef.value.getProps, data);
//如果是字符串类型的需要变成以逗号分割的字符串
if (valueType === 'string') {
model[data] = model[data].join(',');
}
}
}
console.log('👕', model);
var endTime = model.endTime;
var startTime = model.startTime;
if (endTime && startTime) {
var endTimestamp = Date.parse(endTime);
var startTimestamp = Date.parse(startTime);
if (endTimestamp < startTimestamp) {
2024-08-12 09:14:57 +08:00
createMessage.warning('测验发布时间不能大于测验结束时间!');
2024-08-09 14:08:22 +08:00
confirmLoading.value = false;
return;
}
}
const data = tiganData.value;
2024-08-12 09:14:57 +08:00
2024-08-09 14:08:22 +08:00
const values = Object.assign([], data);
2024-08-12 09:14:57 +08:00
if(values.length>0){
var sfjx = "1";
for(let i=0;i<values.length;i++){
let param = values[i];
values[i].itemSelected = param.itemSelected+"";
if(!param.wjTitle){
createMessage.error('请填写题目信息');
sfjx = "0";
confirmLoading.value = false;
return;
}
if(isShow.value){
if(!param.wjScore){
createMessage.error('请填写题目分数');
sfjx = "0";
confirmLoading.value = false;
return;
}
}
var wjType = param.wjType;
if(wjType != 5){
var itemlist = param.wjxWjxxTmxxList;
for(let j=0;j < itemlist.length; j++){
if(!itemlist[j].itemTitle){
createMessage.error('请填写选项信息');
sfjx = "0";
confirmLoading.value = false;
return;
}
}
if(isShow.value){
var zqda = values[i].itemSelected;
if(!zqda||zqda=='NaN'||zqda=='undefined'){
createMessage.error('请选择正确答案');
sfjx = "0";
confirmLoading.value = false;
return;
}
}
}else{
if(isShow.value){
var wjAnswer = values[i].wjAnswer;
if(!wjAnswer||wjAnswer=='NaN'||wjAnswer=='undefined'){
createMessage.error('请选择正确答案');
sfjx = "0";
confirmLoading.value = false;
return;
}
}
}
}
if(sfjx=='0'){
return;
}
}else{
createMessage.error('至少创建一个试题');
}
2024-08-09 14:08:22 +08:00
model.list = values;
console.log('😨', model);
confirmLoading.value = false;
await saveOrUpdate(model, isUpdate.value)
.then((res) => {
if (res.success) {
createMessage.success(res.message);
reloadZy();
} else {
createMessage.warning(res.message);
}
})
.finally(() => {
confirmLoading.value = false;
});
}
/**
* 编辑事件
*/
function handleEdit(record, type) {
2024-08-12 09:14:57 +08:00
console.log('🤲', record);
2024-08-09 14:08:22 +08:00
if (!type) {
isShow.value = true;
} else {
isShow.value = false;
}
if (!record.sturead) {
record.sturead = '1';
}
if (!record.xshpkg) {
record.xshpkg = '1';
}
if (!record.sfzzcj) {
record.sfzzcj = '1';
}
if (!record.xssfck) {
record.xssfck = '1';
}
editDisabled.value = type;
zyInfo.value = record;
dataKhnr.value = [];
mainId.value = record.id;
2024-08-12 09:14:57 +08:00
defHttp.get({ url: '/wjxWjxxTmlb/wjxWjxxTmlb/queryByMainId', params: { id: record.id } }).then((res) => {
tiganData.value = res;
});
2024-08-09 14:08:22 +08:00
handleShowType(2);
}
2024-08-12 09:14:57 +08:00
//测验要求切换
2024-08-09 14:08:22 +08:00
function handleZyyqShow(type) {
console.log('👯', type);
if (type == 1) {
zyyqShow.value = true;
} else {
zyyqShow.value = false;
}
}
//查询列表数据
function reloadZy() {
queryParamZy.value.pageNo = current.value;
queryParamZy.value.pageSize = pageSize.value;
queryParamZy.value.rwbh = rwbh;
queryParamZy.value.xqxn = xqxn;
2024-08-12 09:14:57 +08:00
queryParamZy.value.atype = wjLeixing.value;
2024-08-09 14:08:22 +08:00
defHttp.get({ url: '/wjxWjxx/wjxWjxx/list', params: queryParamZy.value }).then((res) => {
total.value = res.total;
pageNo.value = res.pages;
current.value = res.current;
tableData.value = res.records;
if (tableData.value.length > 0) {
showType.value = 999;
} else {
showType.value = 0;
}
});
}
/**
* 删除事件
*/
async function handleDelete(record) {
if (record.endTime) {
createConfirm({
iconType: 'warning',
title: '删除',
2024-08-12 09:14:57 +08:00
content: '您已经对测验的内容和要求进行了设置,如果继续删除,内容和要求将一并删除,确认进行删除吗?',
2024-08-09 14:08:22 +08:00
okText: '确认',
cancelText: '取消',
onOk: () => {
deleteOne({ id: record.id }, reloadZy);
},
});
} else {
deleteOne({ id: record.id }, reloadZy);
}
}
2024-08-12 09:14:57 +08:00
2024-08-09 14:08:22 +08:00
//新增一次测验
function handleAddOne() {
2024-08-12 09:14:57 +08:00
defHttp.post({ url: '/wjxWjxx/wjxWjxx/addOne', params: { rwbh, xqxn, atype: wjLeixing.value } }).then((res) => {
2024-08-09 14:08:22 +08:00
reloadZy();
});
}
//选择考察内容
function handleKcnr() {
registerZcjcModal.value.disableSubmit = false;
registerZcjcModal.value.init({ rwbh, xnxq: xqxn, createBy: teano });
}
//选择章次节次后的回调
function handleCheckZcjcSuccess(record) {
console.log('🙅‍♂️', record);
console.log('🙅‍♂️', record[0]);
var kcnr = '';
kcnr = kcnr ? kcnr : '';
for (var i = 0; i < record.length; i++) {
kcnr = kcnr + record[i] + ',';
}
if (kcnr.indexOf(',') > -1) {
kcnr = kcnr.substring(0, kcnr.length - 1);
}
zyInfo.value.kcnr = kcnr;
console.log('💑', kcnr);
if (kcnr) {
defHttp.get({ url: '/teachingunitcontent/kcTeachingUnitContentOne/getAllList', params: { id: kcnr } }).then((res) => {
console.log('🤦‍♀️', res);
dataKhnr.value = res;
});
} else {
dataKhnr.value = [];
}
}
2024-08-12 09:14:57 +08:00
2024-08-09 14:08:22 +08:00
/**
* 学生答卷列表
*/
function handleDjjgs(record: Recordable, flag) {
WjxWjxxTmlbDjjgsModalPage.value.disableSubmit = true;
WjxWjxxTmlbDjjgsModalPage.value.edit(record, flag);
}
2024-08-12 09:14:57 +08:00
2024-08-09 14:08:22 +08:00
/**
* 获取选课人数
*/
function openXkrs(record) {
XxhbbksListModalPage.value.disableSubmit = true;
XxhbbksListModalPage.value.init(record);
}
onMounted(() => {
reloadZy();
});
</script>
<style lang="less" scoped>
.title {
margin-left: 20px;
font-size: 18px;
}
.title2 {
font-size: 18px;
}
.ant-divider-horizontal {
display: flex;
clear: both;
width: 100%;
min-width: 100%;
margin: 3px 0 5px;
}
.tishi {
width: 100%;
font-size: 12px;
color: #fd8f02;
margin-top: -4px;
background: #fffbf2;
text-align: center;
padding: 6px 0;
}
.cardClass {
min-height: 200px;
}
.sznrClass {
line-height: 40px;
text-align: center;
}
.ant-card {
box-sizing: border-box;
margin: 0;
padding: 0;
color: rgb(0 0 0);
font-size: 14px;
font-variant: tabular-nums;
line-height: 1.5715;
list-style: none;
font-feature-settings: tnum;
position: relative;
border-radius: 5px;
border: 1px solid #dadada;
background: #f7f7f7;
}
.ant-card-head {
min-height: 48px;
margin-bottom: -1px;
padding: 0 24px;
color: rgba(0, 0, 0, 0.85);
font-weight: 500;
font-size: 16px;
background: transparent;
border-bottom: 1px solid #dadada;
border-radius: 2px 2px 0 0;
}
.ellipsis {
overflow: hidden; /* 确保超出容器的内容被裁剪 */
white-space: nowrap; /* 确保文本在一行内显示 */
text-overflow: ellipsis; /* 超出部分显示省略号 */
}
.ellip-title {
display: flex;
justify-content: space-between;
}
.elli-title {
font-size: 16px;
font-weight: bold;
}
.ellip-word {
font-size: 14px;
color: #666666;
}
.zuanqu:hover {
cursor: pointer;
color: #18a689;
}
.data-suggest {
display: flex;
flex-direction: column;
text-align: center;
width: 25%;
margin-right: 3px;
padding: 8px 3px;
border-radius: 5px;
background: #f7f7f7;
margin-top: 10px;
}
.data-suggest span:nth-child(1) {
font-size: 16px;
font-weight: bold;
}
.data-suggest span:nth-child(2) {
font-size: 12px;
}
.work-img {
width: 100%;
display: flex;
justify-content: center;
margin-top: 80px;
margin-bottom: 30px;
}
.work-img-img {
width: 180px;
height: 139px;
}
.buttonClass {
background: #1ab394;
font-weight: 600;
color: #fff;
border-radius: 3px;
border: none;
}
.mar-right20 {
margin-right: 14px;
}
.button-zhta {
color: #666666;
cursor: pointer;
}
.button-zhta:hover {
cursor: pointer;
color: #18a689;
}
.sear-distance {
padding: 0 10px;
}
.ant-form-item {
box-sizing: border-box;
margin: 10px 0;
padding: 0;
color: rgba(0, 0, 0, 0.85);
font-size: 14px;
font-variant: tabular-nums;
line-height: 1.5715;
list-style: none;
font-feature-settings: tnum;
/* margin-bottom: 24px; */
vertical-align: top;
}
.bled-countenance {
color: #333333;
}
.bled-countenance2 {
color: #999999;
font-size: 12px;
}
.region {
margin: 5px 10px;
padding-bottom: 20px;
background: #fff;
border-radius: 5px;
}
.region-title {
font-size: 16px;
color: #029c88;
padding: 8px 20px;
border-left: 5px solid #029c88;
margin-bottom: 20px;
}
2024-08-12 09:14:57 +08:00
.tjfx-col {
font-size: 16px;
padding: 8px 20px;
line-height: 25px;
}
.tjfx-title {
width: 90%;
float: left;
}
.tjfx-type {
width: 10%;
float: left;
}
.tjfx-xzrs {
margin-left: 30px;
font-size: 12px;
}
.tjfx-zql {
text-align: right;
width: 50%;
font-size: 16px;
padding: 20px;
}
2024-08-09 14:08:22 +08:00
</style>