feat: 题库管理页面添加

This commit is contained in:
kun 2024-04-09 11:57:45 +08:00
parent d66715fdbe
commit c8ef570794
8 changed files with 655 additions and 14 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 308 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 516 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 722 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 865 B

View File

@ -83,7 +83,7 @@ if (process.env.NODE_ENV == 'development') {
// axios.defaults.baseURL ='http://101.43.164.214:45001/' //上海张江
// axios.defaults.baseURL ='http://101.43.164.214:45011/' //上海优益(上海建工)
// axios.defaults.baseURL = 'http://192.168.34.221:28889/' //郭圣雄本地
// axios.defaults.baseURL ='http://192.168.34.221:9111/' //郭圣雄本地
axios.defaults.baseURL ='http://192.168.34.221:9111/' //郭圣雄本地
// axios.defaults.baseURL = 'http://192.168.34.155:19111/' //彭洁本地
// axios.defaults.baseURL = 'http://182.90.224.237:51234' //郭圣雄远程
// axios.defaults.baseURL ='http://101.43.164.214:45020/' //沈阳和盈
@ -91,7 +91,7 @@ if (process.env.NODE_ENV == 'development') {
// axios.defaults.baseURL ='http://101.43.164.214:11111/' // 百色三标段项目
// axios.defaults.baseURL = 'http://125.88.207.86:8088/'//中建四局线上(最新)地址
// axios.defaults.baseURL = 'http://125.88.207.86:8099/'//中建四局(沙湖)线上(最新)地址
axios.defaults.baseURL = 'http://jxj.zhgdyun.com:15551/'//测试地址
// axios.defaults.baseURL = 'http://jxj.zhgdyun.com:15551/'//测试地址
} else if (process.env.NODE_ENV == 'debug') {

View File

@ -48,20 +48,20 @@ export default new Vuex.Store({
PAGESIZRS: [10, 20, 30, 50],
// UPLOADURL:' http://101.43.164.214:11111/upload/image/',// 百色
// FILEURL:' http://101.43.164.214:11111/image/',// 百色
// UPLOADURL:'http://192.168.34.221:9111/upload/image/',// 郭圣雄
// FILEURL:'http://192.168.34.221:9111/image/',//郭圣雄
UPLOADURL:'http://192.168.34.221:9111/upload/image/',// 郭圣雄
FILEURL:'http://192.168.34.221:9111/image/',//郭圣雄
// WORKFLOWURL: 'http://192.168.34.138:88/#/workspace/forms',//测试工作流地址(本地)
// UPLOADURL:'http://10.0.1.43:6023/upload/image',//测试
// FILEURL:'http://10.0.1.43:6023/image/',//测试
BASEURL: baseUrl
? baseUrl
: window.location.protocol + "//" + window.location.host + "/", //正式环境
UPLOADURL:
window.location.protocol +
"//" +
window.location.host +
"/upload/image", //正式环境
FILEURL: window.location.protocol + "//" + window.location.host + "/image/", //正式环境
// BASEURL: baseUrl
// ? baseUrl
// : window.location.protocol + "//" + window.location.host + "/", //正式环境
// UPLOADURL:
// window.location.protocol +
// "//" +
// window.location.host +
// "/upload/image", //正式环境
// FILEURL: window.location.protocol + "//" + window.location.host + "/image/", //正式环境
WORKFLOWURL: 'http://jxj.zhgdyun.com:9811/#/workspace/forms',//正式工作流地址
//---------------------------------------------------------------------------------------------
// BASEURL: baseUrl

View File

@ -62,3 +62,9 @@ export function dateFormat(oDate, fmt) {
}
return fmt;
}
// 根据下标返回英文字母(用作试题答案)
export function filterAnswer(index) {
const englishUppercaseWord = "ABCDEFGHIJKLMNOPQRSTUVWXYZ".split('')
return englishUppercaseWord[index];
}

View File

@ -31,16 +31,403 @@
</div>
</div>
<div class="right">
<div class="reportTable"></div>
<div class="search_wrap">
<el-button type="primary" size="medium" @click="addQuestionBtn"
>添加试题</el-button
>
<el-upload
style="display: inline-block; margin-left: 15px;margin-right: auto;"
class="upload-demo"
name="excelFile"
:action="
$http.defaults.baseURL + 'xmgl/workerInfo/uploadExcelWorkerInfo'
"
:on-change="handleChangeE"
:on-success="handleSuccessE"
:on-error="handleErrorE"
:show-file-list="false"
:headers="headers"
:data="{ projectSn: $store.state.projectSn }"
:limit="1"
accept="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.ms-excel"
:auto-upload="true"
>
<el-button size="medium" type="primary" plain>导入</el-button>
</el-upload>
<el-form
:model="tableParameter"
size="medium"
:inline="true"
class="demo-form-inline"
>
<el-form-item label="试题名称">
<el-input
v-model="tableParameter.name"
suffix-icon="el-icon-search"
:placeholder="$t('message.laborMange.placeholder2')"
></el-input>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="inquireBtn">{{
$t("message.laborMange.inquire")
}}</el-button>
<el-button type="warning" @click="refreshBtn" plain>{{
$t("message.laborMange.refresh")
}}</el-button>
<el-button type="primary" @click="exportFn" plain>{{
$t("message.laborMange.export")
}}</el-button>
</el-form-item>
</el-form>
</div>
<vue-scroll style="height: calc(100% - 120px)">
<el-table
ref="multipleTable"
:data="tableListData"
tooltip-effect="dark"
style="width: 100%; color: #737996"
@selection-change="handleCheckedCitiesChange"
>
<el-table-column
type="selection"
width="55"
label="序号"
></el-table-column>
<el-table-column prop="workerName" label="题干内容"></el-table-column>
<el-table-column prop="phoneNumber" label="题目类型">
<template slot-scope="scope">
<!-- <div>
{{ $t('message.laborMange.contactNumber') }}
<span class="values">{{ scope.row.phoneNumber }}</span>
</div>
<div class="personItemBottom">
{{ $t('message.laborMange.belongsToTeam') }}
<span class="values">{{ scope.row.teamName }}</span>
</div> -->
</template>
</el-table-column>
<el-table-column prop="workerName" label="难易程度"></el-table-column>
<el-table-column prop="workerName" label="试题答案"></el-table-column>
<el-table-column prop="workerName" label="创建时间"></el-table-column>
<el-table-column prop="workerName" label="状态"></el-table-column>
<el-table-column
:label="$t('message.deviceManage.operation')"
align="center"
width="420px"
>
<template slot-scope="scope">
<div class="operation-style">
<div class="operationText" @click="editQuestionBtn(scope.row)">
<img
src="@/assets/images/tableIcon/icon-edit.png"
width="15px"
height="15px"
/>
<span>编辑</span>
</div>
<div class="operationText" @click="previewDialogVisible = true">
<img
src="@/assets/images/tableIcon/preview.png"
width="15px"
height="15px"
/>
<span>预览</span>
</div>
<div class="operationText" @click="moveDialogVisible = true">
<img
src="@/assets/images/tableIcon/move.png"
width="15px"
height="15px"
/>
<span>移动</span>
</div>
<div class="operationText">
<img
src="@/assets/images/tableIcon/icon-delete.png"
width="15px"
height="15px"
/>
<span>删除</span>
</div>
</div>
</template>
</el-table-column>
</el-table>
</vue-scroll>
<div class="flex table_wrap_bottom">
<div>
<el-pagination
class="pagerBox"
style="margin-top: 0;margin-right: 600px;"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:current-page="page"
:page-size="pageSize"
layout="total, sizes, prev, pager, next"
:total="Number(total)"
background
></el-pagination>
<!-- -->
</div>
</div>
</div>
<!-- 新增试题 -->
<el-dialog
:title="title"
:append-to-body="true"
:visible.sync="dialogVisible"
width="667px"
>
<div class="dialog_content">
<el-form
ref="questionForm"
label-width="110px"
size="medium"
:rules="questionFormRules"
:model="questionForm"
style="width: 75%;margin: 0 auto;"
>
<el-form-item label="题干内容" prop="content">
<el-input
v-model="questionForm.content"
placeholder="请输入"
type="textarea"
:rows="2"
></el-input>
</el-form-item>
<el-form-item label="题目类型" prop="type">
<el-select
v-model="questionForm.type"
placeholder="请选择"
style="width: 100%;"
>
<el-option
v-for="(item, index) in typeArr"
:key="index"
:label="item.name"
:value="item.value"
>
</el-option>
</el-select>
</el-form-item>
<el-form-item label="难易程度" prop="level">
<el-select
v-model="questionForm.level"
placeholder="请选择"
style="width: 100%;"
>
<el-option
v-for="(item, index) in levelArr"
:key="index"
:label="item.name"
:value="item.value"
>
</el-option>
</el-select>
</el-form-item>
<el-form-item label="试题选型及答案"> </el-form-item>
<!-- <vue-scroll style="height: 300px;"> -->
<div class="question-list">
<div
class="question-list-item"
v-for="(item, index) in questionArr"
:key="index"
>
<el-radio
:value="item.isCheck"
:label="true"
v-if="questionForm.type == 1"
>{{ index | filterAnswerIndex }}</el-radio
>
<el-checkbox v-if="questionForm.type == 2"
>{{ index | filterAnswerIndex }}</el-checkbox
>
<el-input
v-model="item.questionContent"
placeholder="请输入"
size="medium"
></el-input>
<i
class="el-icon-remove"
@click="deleteQuestionAnswer(index)"
></i>
</div>
</div>
<!-- </vue-scroll> -->
<div class="add-btn">
<el-button
size="medium"
type="primary"
plain
@click="addQuestionAnswer(index)"
>新增选项</el-button
>
</div>
<el-form-item label="是否应用" prop="isApplication">
<el-radio-group v-model="questionForm.isApplication">
<el-radio :label="1"></el-radio>
<el-radio :label="0"></el-radio>
</el-radio-group>
</el-form-item>
</el-form>
</div>
<div class="dialog-footer">
<el-button
class="cancleBtn"
@click="dialogVisible = false"
icon="el-icon-circle-close"
size="medium"
>取消
</el-button>
<el-button
type="primary"
icon="el-icon-circle-check"
@click="submitQuestion"
size="medium"
>确定
</el-button>
</div>
</el-dialog>
<!-- 移动 -->
<el-dialog
title="移动"
:append-to-body="true"
:visible.sync="moveDialogVisible"
class="moveDialog"
width="50%"
>
<div class="move-tree-content">
<div class="tree-part">
<el-tree
:data="level1CompanyData"
:highlight-current="true"
:check-on-click-node="false"
:props="defaultProps"
ref="groupTree"
>
<span class="custom-tree-node" slot-scope="{ node, data }">
<span
style="
width: 100%;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
display: inline-block;
"
class="courseName"
:title="node.label"
>{{ node.label }}</span
>
</span>
</el-tree>
</div>
</div>
<div class="dialog-footer">
<el-button
class="cancleBtn"
@click="moveDialogVisible = false"
icon="el-icon-circle-close"
size="medium"
>取消
</el-button>
<el-button
type="primary"
icon="el-icon-circle-check"
@click="moveDialogVisible = false"
size="medium"
>确定
</el-button>
</div>
</el-dialog>
<!-- 预览 -->
<el-dialog
title="预览"
:append-to-body="true"
:visible.sync="previewDialogVisible"
class="previewDialog"
width="40%"
>
<div class="preview-content">
<div class="preview-question-title">
1第一个题目
</div>
<div class="preview-question-content">
<div class="preview-question-item">
<el-radio :label="true" v-if="questionForm.type == 1"
><span></span></el-radio
>
<el-checkbox v-if="questionForm.type == 2"
><span></span></el-checkbox
>
<span class="active-style">{{ 0 | filterAnswerIndex }}123</span>
</div>
<div class="preview-question-item">
<el-radio :label="true" v-if="questionForm.type == 1"
><span></span></el-radio
>
<el-checkbox v-if="questionForm.type == 2"
><span></span></el-checkbox
>
<span class="default-style">{{ 1 | filterAnswerIndex }}456</span>
</div>
</div>
</div>
</el-dialog>
</div>
</template>
<script>
import { filterAnswer } from "@/util/nowDate/index";
export default {
name: "questionManagement",
data() {
return {
questionArr: [{ isCheck: true, questionContent: "" }],
levelArr: [
{ name: "简单", value: 1 },
{ name: "一般", value: 2 },
{ name: "困难", value: 3 },
],
typeArr: [
{ name: "单选题", value: 1 },
{ name: "多选题", value: 2 },
],
questionFormRules: {
type: [
{
required: true,
message: "请选择",
trigger: "change",
},
],
level: [
{
required: true,
message: "请选择",
trigger: "change",
},
],
isApplication: [
{
required: true,
message: "请选择",
trigger: "change",
},
],
},
questionForm: {
content: "",
type: 1,
level: 1,
isApplication: 1,
},
title: "添加试题",
previewDialogVisible: false,
moveDialogVisible: false,
dialogVisible: false,
page: 1,
pageSize: 10,
total: 0,
activeNav: 1,
level1CompanyData: [
{
@ -103,9 +490,156 @@ export default {
children: "children",
label: "label",
},
//
tableParameter: {
name: "",
},
tableListData: [{ name: 111 }], //
};
},
created() {
console.log(filterAnswer(0));
},
filters: {
filterAnswerIndex(index) {
return filterAnswer(index);
},
},
computed: {
headers() {
return {
Authorization: this.$store.state.userInfo.token,
};
},
},
methods: {
//
submitQuestion() {
let findIndex = this.questionArr.findIndex(
(item) => !item.questionContent
); //
let findCheckIndex = this.questionArr.findIndex((item) => !item.isCheck); //
if (
this.questionArr.length == 0 ||
findIndex != -1 ||
findCheckIndex != -1
) {
this.$message.error("请添加试题并完整填写以及选中答案");
return;
}
this.$refs.questionForm.validate((valid) => {
if (valid) {
// editstandardDevApi(params).then(result => {
// if (result.success) {
// // console.log('', result);
// this.$message.success(result.message);
// this.getList();
// this.Popup.show = false;
// }
// })
} else {
return false;
}
});
},
//
editQuestionBtn(item) {
console.log(item);
this.title = "编辑试题";
this.dialogVisible = true;
},
//
addQuestionBtn() {
this.title = "添加试题";
this.dialogVisible = true;
},
//
addQuestionAnswer() {
this.questionArr.push({ isCheck: false, questionContent: "" });
},
//
deleteQuestionAnswer(index) {
this.questionArr.splice(index, 1);
},
handleSizeChange(val) {
console.log(val);
},
handleCurrentChange(val) {
console.log(val);
},
//
handleCheckedCitiesChange(value) {
console.log(value);
},
handleChangeE(file, fileList) {
// this.fileTemp = file.raw
// console.log(file)
// if (this.fileTemp) {
// if (
// this.fileTemp.type ==
// 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' ||
// this.fileTemp.type == 'application/vnd.ms-excel'
// ) {
// } else {
// this.$message.error(this.$t('message.laborMange.hint5'))
// }
// }
},
handleSuccessE(file) {
// this.refreshPage = false
// console.log('==========', file)
// if (file.code == 200) {
// this.$message.success(file.message) //
// this.refreshBtn()
// this.getTeamList()
// } else {
// this.$message.error(file.message)
// }
// this.$nextTick(() => {
// this.refreshPage = true
// })
},
handleErrorE() {
// this.$message.error(this.$t('message.laborMange.hint7'))
// this.refreshBtn()
},
exportFn() {
// window.location.href =
// this.$http.defaults.baseURL +
// 'xmgl/download/exporZipWorkerInfo?idCard=' +
// this.tableParameter.idCard +
// '&projectSn=' +
// this.tableParameter.projectSn +
// '&teamId=' +
// this.tableParameter.teamId +
// '&workerName=' +
// this.tableParameter.workerName +
// '&personType=' +
// this.tableParameter.personType +
// '&enterDate=' +
// this.tableParameter.enterDate +
// '&codeState=' +
// this.tableParameter.codeState +
// '&enterpriseId=' +
// this.checkedId
},
//
refreshBtn() {
// window._paq.push(['trackEvent', '', '', ''])
// this.page = 1
// this.tableParameter.idCard = ''
// this.tableParameter.workerName = ''
// this.tableParameter.inserviceType = ''
// this.tableParameter.enterDate = ''
// this.tableParameter.codeState = ''
// this.getTableData()
},
//
inquireBtn() {
// window._paq.push(['trackEvent', '', '', ''])
// this.page = 1
// this.getTableData()
},
checkNav(val) {
this.activeNav = val;
},
@ -165,6 +699,107 @@ export default {
.right {
width: calc(100% - 300px);
height: 100%;
.search_wrap {
padding: 40px 10px 30px 50px;
border-bottom: 1px solid #eaeaea;
.flex();
.demo-form-inline {
/deep/.el-form-item {
display: inline-block;
margin-bottom: 0px;
}
}
}
.operation-style {
.flex();
justify-content: center;
.operationText:not(:last-child) {
margin-right: 10px;
}
}
}
}
// /
.question-list {
&-item {
.flex();
position: relative;
/deep/.el-radio {
margin-right: 10px;
margin-left: 55px;
}
.el-icon-remove {
color: #eb4f47;
cursor: pointer;
position: absolute;
right: -20px;
}
}
&-item:not(:last-child) {
margin-bottom: 20px;
}
}
.add-btn {
margin: 15px 0 20px 75px;
}
//
.moveDialog {
/deep/.el-dialog__body {
padding-top: 10px;
}
}
.move-tree-content {
padding-top: 10px;
background: #f7f7f7;
.tree-part {
.custom-tree-node {
width: 100%;
.courseName {
font-size: 16px;
font-weight: bold;
display: inline-block;
width: 192px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
}
}
}
//
.preview-content {
margin-left: 60px;
.flexColumn();
.preview-question-title {
font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: 400;
font-size: 16px;
color: #272d45;
margin-bottom: 20px;
}
.preview-question-content {
margin-left: 25px;
.preview-question-item {
.flex();
/deep/.el-radio {
margin-right: 0px;
}
.active-style{
font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: 400;
font-size: 14px;
color: #5181F6;
}
.default-style{
font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: 400;
font-size: 14px;
color: #272D45;
}
}
.preview-question-item:not(:last-child){
margin-bottom: 20px;
}
}
}
</style>