| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009 |
- <style lang="scss">
- .content{
- background-color: #f5eedb !important;
- }
- .content_div{
- display: flex;
- overflow: auto;
- min-width: 1200px;
- height: calc(100vh - 170px);
- overflow: auto;
- .left_div{
- width: 820px;
- background-color: gray;
- overflow: auto;
- height: 100%;
- position: relative;
- .page_div{
- height: 1140px;
- }
- .page_cell{
- top: 10px;
- left: 10.3px;
- width: 210mm;
- height: 297mm;
- position: absolute;
- background-color: #fff;
- border: 1px solid #000;
- *{
- box-sizing: content-box;
- font-family: 宋体, SimSun, 'STSong';
- }
-
- .obj{
- position:relative;border:solid 1px black;
- width: 100%;
- height: 100%;
- }
- .item{
- position: absolute;
- }
- .tm_id{
- width: 8mm;
- text-align: center;
- font-size: 3mm;
- height: 2.5mm;
- position: absolute;
- }
- .opLabel{
- padding:0mm 2mm;font-weight:bold; font-size:3mm;line-height:5mm;width:178mm;
- }
- .del{
- position: absolute;
- width: 20px;
- right: 5px;
- display: none;
- cursor: pointer;
- z-index: 999;
- }
- }
- .sub:hover .del{
- display: block !important;
- }
- .act{
- background-color: #000;
- }
- .tk{
- div{
- background-color: #666;
- position: absolute;
- }
- }
- .words{
- display: flex;
- flex-wrap: wrap;
- margin: 8mm auto;
- width: 170mm;
- border: 1px solid #333;
- border-right-width: 2px;
- border-bottom-width: 2px;
- li{
- box-sizing: border-box;
- list-style: none;
- width: 8.5mm;
- height: 8mm;
- border: 1px solid #333;
- margin-bottom: 1.5mm;
- border-right: none;
- position: relative;
- span{
- position: absolute;
- font-size: 2mm;
- top: 100%;
- left: 40%;
- }
- }
- }
- .english{
- padding: 0 5mm;
- li{
- list-style: none;
- height: 10mm;
- border-bottom: 1px solid #333;
- }
- }
- }
- .right_div{
- margin-left: 10px;
- width: 300px;
- height: 100%;
- overflow: auto;
- background-color: #fff;
- border-left: 1px solid #dadada;
- border-right: 1px solid #dadada;
- h3{
- background-color: #f3f3f3;
- border-top: 1px solid #dadada;
- border-bottom: 1px solid #dadada;
- font-size: 16px;
- font-weight: normal;
- padding: 10px;
- }
- .dtk_bs_list{
- padding: 10px;
- li{
- display: inline-block;
- width: 37px;
- height: 37px;
- margin: 0 7px;
- position: relative;
- cursor: pointer;
- img{
- width: 100%;
- height: 100%;
- }
- b{
- position: absolute;
- width: 100%;
- font-size: 12px;
- top: 100%;
- text-align: center;
- left: 0;
- padding: 5px 0;
- }
- &:hover{
- border: 2px solid #18a368;
- &::after{
- content: '';
- width: 18px;
- height: 18px;
- background-image: url(../../assets/correct_on.png);
- position: absolute;
- top: 0;
- bottom: 0;
- left: 0;
- right: 0;
- margin: auto;
- }
- }
- }
- .te_active{
- border: 2px solid #18a368;
- &::after{
- content: '';
- width: 18px;
- height: 18px;
- background-image: url(../../assets/correct_on.png);
- position: absolute;
- top: 0;
- bottom: 0;
- left: 0;
- right: 0;
- margin: auto;
- }
- }
- }
- .tips{
- font-size: 12px;
- color: #999;
- padding: 10px;
- }
- .btns{
- button{
- margin: 5px 5px 5px 0;
- width: 84px;
- text-align: center;
- }
- }
- }
- }
- .tm_list{
- height: 200px;
- overflow: auto;
- border: 1px solid #d9d9d9;
- margin-bottom: 10px;
- li{
- list-style: none;
- border-bottom: 1px solid #d9d9d9;
- padding: 5px 10px;
- min-height: 40px;
-
- span{
- display: inline-block;
- line-height: 30px;
- font-size: 18px;
- }
- div{
- float: right;
- font-weight: 600;
- input{
- width: 50px;
- height: 30px;
- margin-right: 5px;
- text-align: center;
- outline: none;
- font-size: 18px;
- }
- }
- }
- }
- .options{
- position: absolute;
- font-size: 2.5mm;
- border: 1px solid rgb(0, 0, 0);
- text-align: center;
- line-height: 1;
- }
- </style>
- <template>
- <section class="content">
- <div class="breadcrumb">
- <el-breadcrumb separator="/">
- <el-breadcrumb-item><a href="/">试卷管理</a></el-breadcrumb-item>
- <el-breadcrumb-item>答题卡制作</el-breadcrumb-item>
- </el-breadcrumb>
- </div>
- <div class="content_div">
- <div class="left_div">
- <div class="page_div">
- <div class="page_cell">
- <div style="top:11mm;left:6mm;width:5mm;height:5mm;position:absolute;background-color:black;display:block"></div>
- <div style="top:281mm;left:6mm;width:5mm;height:5mm;position:absolute;background-color:black;display:block"></div>
- <div style="top:11mm;left:199mm;width:5mm;height:5mm;position:absolute;background-color:black;display:block"></div>
- <!-- //试卷内容 -->
- <div style="top:20mm;left:15mm;width:180mm;height:257mm;position:absolute;">
- <textarea id="paperNameTextAreaTem" rows="3" cols="78" style="resize:none;width:100%;color:#000;font-size:20px;font-weight:600;height: 15mm;max-height:21mm;text-align: center;word-wrap: normal;line-height:15mm;overflow:hidden" placeholder="请输入试卷名称"></textarea>
- <div style="top:18mm;left:2mm;width:95mm;height:60mm;position:absolute;">
- <div style="line-height:6.6mm">
- <span style="font-weight: bold;font-size: 4mm;">姓名:</span>
- <span style="width:30mm;border-bottom: solid 1px black;display:inline-block"> </span>
- <span style="font-weight: bold;font-size: 4mm;">班级:</span>
- <span style="width:30mm;border-bottom: solid 1px black; display: inline-block"> </span>
- <br>
- <span style="font-weight: bold;font-size: 4mm;">考场号:</span>
- <span style="width:25mm;border-bottom: solid 1px black; display: inline-block"> </span>
- <span style="font-weight: bold;font-size: 4mm;">座位号:</span>
- <span style="width:30mm;border-bottom: solid 1px black; display: inline-block"> </span>
- </div>
- <div style="border:solid 1px black;margin-top: 2mm;padding:1mm;font-size: 3mm;line-height:4.5mm;">
- <p style="text-align: center;font-weight: bold;font-size: 4mm;line-height: 4mm;">注意事项</p>
- <p> 1.答题前,考生先将自己的姓名、班级、准考证号填写清楚。
- <br> 2.客观题答题,必须使用2B铅笔填涂,修改时,要用橡皮擦干净。
- <br> 3.主观题答题,必须使用0.5毫米的黑色墨水签字笔书写,要求字体工整、笔迹清晰。作图时,必须用2B铅笔,并描浓。
- <br> 4.必须在题号所对应的答题区域内作答,超出答题区域书写无效。
- <br>5.保持答卷清洁、完整。严禁折叠,严禁在答题卷上做任何标记,严禁使用涂改液、胶带纸和修正带。<br>
- </p>
- </div> <div style="border:solid 1px black;margin-top:2mm;line-height: 7mm"> <table style="width:100%;height:100%;"><tbody><tr> <td width="30%"> <span style="font-size: 3mm;font-weight: bold;">正确填涂</span></td><td width="25%"> <div style="border: solid 1px black;width:4mm;height: 2mm;background-color: black;"> </div> </td> <td width="30%"> <span style="font-size: 3mm;font-weight: bold;">缺考标记</span> </td> <td width="25%">
- <div style="border:1px solid #000000;width:4mm;height: 2mm;"></div> </td> </tr></tbody></table></div></div>
-
- <div style="top:23mm;left:107mm;width:65mm;height:60mm;position:absolute;font-size:3mm;">
- <table v-if='data.khType == 2' cellpadding="0" cellspacing="0" style="border-collapse:collapse;text-align: center;width:100%;height:100%;line-height: 5mm">
- <tr height='6mm'>
- <td :colspan="data.khLength" style="width:30mm;border:solid 1px black;border-collapse:collapse;text-align:center;">准考证号</td>
- </tr>
- <tr height='6mm'>
- <th v-for='i in data.khLength' style="border:solid 1px #000000;border-collapse:collapse;"> </th>
- </tr>
- <tr>
- <td v-for='i in data.khLength' align="center" style="border:solid 1px #000000;border-collapse:collapse;padding-top: 1mm;border-left-color: #000000;border-bottom-color: #000000">
- <div v-for='j in 10' style="border:1px solid #000000;width:4mm;height: 3.5mm;line-height: 1.2;text-align: center;margin: 6px 0">
- <span style="margin-top: -1.5px;display:block ">{{j-1}}</span>
- </div>
- </td>
- </tr>
- </table>
-
- <div v-else>
- <table style="border-collapse:collapse;text-align: center;width:100%;height:100%;line-height: 5mm" cellpadding="0" cellspacing="0">
- <tbody>
- <tr height="6mm"><td colspan="8" style="width:30mm;border-collapse:collapse;text-align:left;">准考证号:</td></tr>
- <tr height="6mm">
- <th v-for='i in 8' style="border:solid 1px #000000;border-collapse:collapse;"> </th>
- </tr>
- </tbody>
- </table>
- <div style="top:25mm;left:0mm;width:65mm;height:27mm;position:absolute;">
- <div style="top:0mm;left:0mm;width:65mm;height:27mm;position:absolute;line-height:15mm;position:absolute;border: dashed 1px #000000;text-align: center;font-size: 6mm;color:grey;">贴条形码区<p>
- <span style="font-size: 2mm;line-height: 3mm">(正面朝上,切勿贴出虚线方框)</span>
- </p></div>
- </div>
- </div>
- </div>
-
- <!-- 选择题 -->
- <template v-if='paper.obj.list.length>0'>
- <!-- {{paper.obj}} -->
- <div class="sub" :style="{
- width: paper.objAnsPoints[0].w+'mm',
- height: paper.objAnsPoints[0].h+'mm',
- left: paper.objAnsPoints[0].x+'mm',
- top: (paper.objAnsPoints[0].y-5)+'mm',
- position:'absolute'
- }">
- <div class="opLabel">
- {{paper.obj.title}}
- </div>
- <img @click="delTm(0,1)" class="del" src="../../assets/delete.png" alt="">
- <div class="obj" >
- <div v-for='(item,index) in paper.obj.list'>
- <span class="tm_id" :style="{
- left:(item.points[0].x-8)+'mm',
- top:(item.points[0].y)+'mm'
- }">{{item.id}}</span>
- <span v-for='(opt,i) in item.points' class="options" :style="{
- width: opt.w+'mm',
- height: opt.h+'mm',
- left: opt.x+'mm',
- top: opt.y+'mm'
- }">
- <template v-if='item.type == 3'>
- {{pd[i]}}
- </template>
- <template v-else>
- {{options[i]}}
- </template>
- </span>
- </div>
- </div>
- </div>
- </template>
- <!-- 填空题 -->
- <template v-if='paper.sub.length>0'>
- <div class="sub" v-for='(item,i) in paper.stdSujQnoPoints' :style="{
- width: item.w+'mm',
- height: item.h+'mm',
- left: item.x+'mm',
- top: (item.y-5)+'mm',
- position:'absolute'
- }">
- <div class="opLabel">{{paper.sub[i].title}}</div>
- <img @click="delTm(i)" class="del" src="../../assets/delete.png" alt="">
- <div class="obj" v-if='paper.sub[i].title=="填空题"'>
- <div v-for='sub in paper.sub[i].list' class="tk">
- <span class="tm_id" :style="{
- left:(sub.x-6)+'mm',
- top:(sub.y-3)+'mm'
- }">{{sub.id}}.</span>
- <div :style="{
- width:sub.w+'mm',
- height:sub.h+'mm',
- left: sub.x+'mm',
- top: sub.y+'mm',
- }"></div>
- </div>
- </div>
- <div class="obj" v-else-if='paper.sub[i].type=="解答题"'>
- <span class="tm_id" style="top: 2.5mm;">{{paper.sub[i].option.id}}</span>
- </div>
- <div class="obj" v-else-if='paper.sub[i].title=="选做题"' style="padding: 1mm;font-size: 3mm;line-height: 5mm;">
- <span>请考生从<template v-for='(opt,i) in paper.sub[i].list'>{{opt.id}} </template>
- 题任选一题作答,作答时用2B铅笔在答题卡上把所选题目对应的选考标记涂黑,
- 不涂或多涂或填涂和作答不符,均不得分。</span><br>
- <span>我选择的题号为:</span>
- <span v-for='opt in paper.sub[i].list' class="options" :style="{
- width: opt.w+'mm',
- height: opt.h+'mm',
- left: opt.x+'mm',
- top: opt.y+'mm'
- }">{{opt.id}}</span>
- </div>
- <div class="obj" v-else-if='paper.sub[i].title=="语文作文题"'>
- <span class="tm_id" style="top: 2.5mm;">{{paper.sub[i].id}}.</span>
- <ul class="words">
- <li v-for='num in paper.sub[i].words'>
- <span v-if='num%100 == 0'>{{num}}</span>
- </li>
- </ul>
- </div>
- <div class="obj" v-else-if='paper.sub[i].title=="英语作文题"'>
- <span class="tm_id" style="top: 7mm;">{{paper.sub[i].id}}.</span>
- <ul class="english">
- <li v-for='num in paper.sub[i].rows'>
-
- </li>
- </ul>
- </div>
- </div>
- </template>
- </div>
- <!-- //试卷内容 -->
-
-
- <!-- 页码 -->
- <div style="top:281mm;left:15mm;position: absolute;">
- <div v-for='item in pages' :class="item==1?'act':''" style="border:1px solid #000000;width:4mm;height: 2.5mm;line-height: 1;text-align: center;margin: 6px 6px;display:inline-block">
-
- </div>
- </div>
- </div>
- </div>
- </div>
- <div class="right_div">
- <h3>选择答题卡布局</h3>
- <ul class="dtk_bs_list">
- <li v-for='i in 3' :class='data.layout == i ?"te_active":""' @click="data.layout = i">
- <div v-if='i==1'>
- <img src="../../assets/test01.png" alt="">
- <b>一栏</b>
- </div>
- <div v-if='i==2'>
- <img src="../../assets/test02.png" alt="">
- <b>两栏</b>
- </div>
- <div v-if='i==3'>
- <img src="../../assets/test03.png" alt="">
- <b>三栏</b>
- </div>
- </li>
- </ul>
- <div class="tips">
- <p v-if='data.layout==1'>一栏适用于A4、16K、B5纸张</p>
- <p v-if='data.layout==2'>两栏适用于A3、8K、B4纸张</p>
- <p v-if='data.layout==3'>三栏适用于A3、8K、B4纸张</p>
- </div>
- <h3>选择考号版式</h3>
- <div style="padding: 10px;">
- <el-radio v-model="data.khType" :label="1">条形码</el-radio>
- <el-radio v-model="data.khType" :label="2">准考证号</el-radio>
- <select v-model="data.khLength" style="width: 70px;">
- <option v-for="i in 12" v-if='i>=4' :value="i">{{i}}位</option>
- </select>
- </div>
- <h3>设置禁止作答区</h3>
- <div style="padding: 10px;">
- <el-radio v-model="data.noAnsArea" :label="1">启用</el-radio>
- <el-radio v-model="data.noAnsArea" :label="2">禁用</el-radio>
- </div>
- <h3>添加试题</h3>
- <div class="btns" style="padding: 10px;">
- <el-button @click="openAdd(1)" type="info" size="mini" plain icon="el-icon-plus">客观题</el-button>
- <el-button @click="openAdd(2)" type="info" size="mini" plain icon="el-icon-plus">填空题</el-button>
- <el-button @click="openAdd(3)" type="info" size="mini" plain icon="el-icon-plus">解答题</el-button>
- <el-button @click="openAdd(4)" type="info" size="mini" plain icon="el-icon-plus">选做题</el-button>
- <el-button @click="openAdd(5)" type="info" size="mini" plain icon="el-icon-plus">作文(语)</el-button>
- <el-button @click="openAdd(6)" type="info" size="mini" plain icon="el-icon-plus">作文(英)</el-button>
- </div>
- </div>
- </div>
-
- <el-dialog
- title="添加题目"
- :visible.sync="open"
- width="30%">
- <el-form size="small" :inline='true' label-width="80px" label-position="left">
- <el-form-item label="题目名称:" v-if='type <= 3'>
- <el-radio-group fill='#FA0A2F' v-model="addForm.type" v-if='type == 1'>
- <el-radio-button :label="1">单选题</el-radio-button>
- <el-radio-button :label="2">多选题</el-radio-button>
- <el-radio-button :label="3">判断题</el-radio-button>
- </el-radio-group>
- <el-input v-if='type == 2' value="填空题"></el-input>
- <el-input v-if='type == 3' value="解答题"></el-input>
- </el-form-item>
- <el-form-item label="题号:" v-if='type <= 3'>
- 从第 <el-input @input="createList" style="width:100px;" v-model="addForm.start"></el-input>
- 到第 <el-input @input="createList" style="width: 100px;" v-model="addForm.end"></el-input>
- 题
- </el-form-item>
- <el-form-item label="选项个数:" v-if='addForm.type != 3 && type == 1'>
- <el-input @input="numChange" v-model="addForm.num"></el-input>
- </el-form-item>
- <el-form-item label="每行空数:" v-if='type == 2'>
- <el-radio-group fill='#FA0A2F' v-model="addForm.count" >
- <el-radio-button v-for='i in 5' :label="i">{{i}}</el-radio-button>
- </el-radio-group>
- </el-form-item>
- <el-form-item label="选做规则:" v-if='type == 4'>
- <el-input style="width:100px;" v-model="addForm.chooseNum"></el-input>
- 选 <el-input style="width: 100px;" value="1" disabled></el-input>
- </el-form-item>
- <el-form-item label="作文格数:" v-if='type == 5'>
- <el-input v-model="addForm.words"></el-input>
- </el-form-item>
- <el-form-item label="作文栏数:" v-if='type == 6'>
- <el-input v-model="addForm.row"></el-input>
- </el-form-item>
-
- <ul class="tm_list" v-if='type == 1'>
- <li v-for="item in list">
- <span>{{item.id}}</span>
- <div v-if='addForm.type != 3'><input type="text" v-model="item.num">个选项</div>
- </li>
- </ul>
- <ul class="tm_list" v-if='type == 3'>
- <li v-for="item in list" v-if='list.length>0'>
- <span>{{item.id}}</span>
- <div @click="addLeaf(item,item.leaf)" style="cursor: pointer;">+</div>
- <div v-for="(item1,i1) in item.leaf" style="float: none;padding-left: 10px;">
- <span style="font-weight: 500;">{{item1.id}}</span>
- <div @click="item.leaf.splice(i1,1)" style="cursor: pointer;">-</div>
- <div @click="addLeaf(item1,item1.leaf)" style="cursor: pointer;">+</div>
- <div v-for="(item2,i2) in item1.leaf" style="float: none;padding-left: 10px;">
- <span style="font-weight: 500;">{{item2.id}}</span>
- <div @click="item1.leaf.splice(i2,1)" style="cursor: pointer;">-</div>
- <div @click="addLeaf(item2,item2.leaf)" style="cursor: pointer;">+</div>
-
- <div v-for="(item3,i3) in item2.leaf" style="float: none;padding-left: 10px;">
- <span style="font-weight: 500;">{{item3.id}}</span>
- <div @click="item2.leaf.splice(i3,1)" style="cursor: pointer;">-</div>
- </div>
- </div>
- </div>
-
- </li>
- </ul>
- </el-form>
-
- <!-- <p align='center' v-if="type == 1">
- <el-checkbox v-model="addForm.auto" >添加题目自动排版至顶端客观题区域</el-checkbox>
- </p> -->
-
- <span slot="footer" class="dialog-footer">
- <el-button @click="open = false">取 消</el-button>
- <el-button type="primary" @click="addPaper">添 加</el-button>
- </span>
- </el-dialog>
- </section>
- </template>
- <script>
- import Page from "../../components/Page";
- export default {
- components: {
- Page,
- },
- data() {
- return {
- loading: false,
- queryParams: {
- page: 1,
- },
- form: {},
- form1: {},
- form2: {},
- list: [{}, {}],
- total: 0,
- title: "新增用户",
- open: false,
- doctorList: [],
- rules: {},
- pages:1,
- size:[180,118],
- data:{
- layout:1,
- khType:1,
- khLength:8,
- noAnsArea:1
- },
- type:1,
- options:['A','B','C','D','E','F'],
- pd:['T','F'],
- addForm:{
- type:1,
- start:1,
- end:'',
- num:4,
- auto:true,
- count:2,
- chooseNum:3,
- words:900,
- row:10,
- col:5 //客观题一列几行
- },
- list:[
-
- ],
- paper:{
- obj:{
- title:'客观题',
- list:[]
- },
- sub:[], //主观题
- objAnsPoints:[
-
- ],
- stdSujQnoPoints:[
-
- ]
- },
- dft:{
- x:0,
- y:100,
- w:180,
- h:28
- }
-
- };
- },
- watch:{
- "paper.objAnsPoints":{
- handler(newvalue){
- var y
- if(newvalue.length>0){
- y=newvalue[0].y+newvalue[0].h+8
- }else{
- y=this.dft.y
- }
-
- var sub=this.paper.stdSujQnoPoints
- sub.forEach((item,index)=>{
- if(index > 0){
- item.y=item.y-height-8
- }else{
- item.y=y
- }
- })
- },
- deep:true
- }
- },
- methods: {
- decToBin4(decimalNumber) {
- return decimalNumber.toString(2).padStart(4, '0');
- },
- openAdd(type){
- this.type=type
- this.open=true
- },
- //选项个数变化
- numChange(){
- let list=this.list
- list.forEach(item=>{
- item.num=this.addForm.num
- })
- this.list=list
- },
- //添加小题
- addLeaf(item,leaf){
- var l=leaf.length
- leaf.push({
- id:item.id+'.'+(l+1),
- leaf:[]
- })
- },
- //删除主观题目
- delTm(i,flag){
-
- var sub=this.paper.stdSujQnoPoints,list=this.paper.sub
- if(flag){ //客观题
- this.paper.objAnsPoints=[]
- this.paper.obj.list=[]
- if(sub.length == 0){
- this.addForm.start=1
- }
- return
- }
- var height=sub[i].h,item={...list[i]}
- sub.splice(i,1)
- list.splice(i,1)
- sub.forEach((item,index)=>{
- if(index >= i){
- item.y=item.y-height-8
- }
- })
- if(i>=sub.length-1){
- if(item.title == '填空题'){
- this.addForm.start-=item.list.length
- }else{
- this.addForm.start--
- }
- }
- if(this.paper.objAnsPoints.length == 0 && this.paper.stdSujQnoPoints.length == 0){
- this.addForm.start=1
- }
-
- },
- createList(){
- let s=this.addForm.start,e=this.addForm.end
- let list=[]
- if(this.addForm.end >= this.addForm.start){
- for(let i=s;i<=e;i++){
- if(this.type == 1){
- // 客观题
- if(this.addForm.type == 3){ //判断题
- list.push({
- id:i,
- num:2
- })
- }else{
- list.push({
- id:i,
- num:this.addForm.num
- })
- }
-
- }else if(this.type == 2 || this.type == 3){
- // 填空题 解答题
- list.push({
- id:i,
- leaf:[]
- })
- }
- }
- }
- this.list=list
-
- },
- //添加题目
- addPaper(){
- switch(this.type){
- case 1: //客观题
-
- this.calcXY()
-
- break;
- case 2: //填空题
- let list=this.list
- let count=this.addForm.count
- var obj=this.paper.objAnsPoints,sub=this.paper.stdSujQnoPoints
- let h=Math.ceil(list.length/count)*12
- if(sub.length>0){
- let i=sub.length-1
- this.paper.stdSujQnoPoints.push({
- x:sub[i].x,
- y:sub[i].y+sub[i].h+8,
- w:sub[i].w,
- h:h
- })
- }
- else if(obj.length>0 ){
- let i=obj.length-1
- this.paper.stdSujQnoPoints.push({
- x:obj[i].x,
- y:obj[i].y+obj[i].h+8,
- w:obj[i].w,
- h:h
- })
- }else{
- let dft={...this.dft}
- dft.h=h
- this.paper.stdSujQnoPoints.push(dft)
- }
-
- list.forEach((item,index)=>{
- let row=parseInt(index/count),col=(index%count)
- item.w=parseInt(this.dft.w/count-10)
- item.h=0.1
- item.x=8+(8+item.w)*col
- item.y=8+row*10
- })
- this.paper.sub.push({
- title:'填空题',
- list:list,
-
- })
- this.list=[]
- console.log(this.paper)
- break;
- case 3: //解答题
- var _list=this.list,new_list=[]
- function searchLeaf(arr){
- arr.forEach(item=>{
- if(item.leaf.length == 0){
- new_list.push({
- id:item.id
- })
- }else{
- searchLeaf(item.leaf)
- }
- })
- }
- searchLeaf(_list)
- var obj=this.paper.objAnsPoints,sub=this.paper.stdSujQnoPoints
- if(sub.length>0){
- let i=sub.length-1
- this.paper.stdSujQnoPoints.push({
- x:sub[i].x,
- y:sub[i].y+sub[i].h+8,
- w:sub[i].w,
- h:50
- })
- }
- else if(obj.length>0 ){
- let i=obj.length-1
- this.paper.stdSujQnoPoints.push({
- x:obj[i].x,
- y:obj[i].y+obj[i].h+8,
- w:obj[i].w,
- h:50
- })
- }else{
- let dft={...this.dft}
- dft.h=50
- this.paper.stdSujQnoPoints.push(dft)
- }
-
- new_list.forEach((item,index)=>{
- if(index > 0){
- let i=sub.length-1
- let x=index==1?6:1
- this.paper.stdSujQnoPoints.push({
- x:sub[i].x,
- y:sub[i].y+sub[i].h+x,
- w:sub[i].w,
- h:50
- })
- }
- this.paper.sub.push({
- title:index==0?'解答题':'',
- option:item,
- type:'解答题'
- })
- })
- this.list=[]
- break;
- case 4:
- let chooseNum=this.addForm.chooseNum
- var obj=this.paper.objAnsPoints,sub=this.paper.stdSujQnoPoints
- if(sub.length>0){
- let i=sub.length-1
- this.paper.stdSujQnoPoints.push({
- x:sub[i].x,
- y:sub[i].y+sub[i].h+8,
- w:sub[i].w,
- h:50
- })
- }
- else if(obj.length>0 ){
- let i=obj.length-1
- this.paper.stdSujQnoPoints.push({
- x:obj[i].x,
- y:obj[i].y+obj[i].h+8,
- w:obj[i].w,
- h:50
- })
- }else{
- let dft={...this.dft}
- dft.h=50
- this.paper.stdSujQnoPoints.push(dft)
- }
- let start=this.addForm.start,end=Number(start)+Number(this.addForm.chooseNum)-1
- let tihao=[]
- for(let i=start;i<=end;i++){
- tihao.push({
- id:i,
- w:4,
- h:2.5,
- x:24+(i-start)*6,
- y:12
- })
- }
- this.paper.sub.push({
- title:'选做题',
- list:tihao
- })
- this.addForm.end=end
- break;
- case 5:
- let words=Number(this.addForm.words)
- var obj=this.paper.objAnsPoints,sub=this.paper.stdSujQnoPoints
- var row=Math.ceil(words/20)+1,height=row*9.5+30
- if(sub.length>0){
- let i=sub.length-1
- this.paper.stdSujQnoPoints.push({
- x:sub[i].x,
- y:sub[i].y+sub[i].h+8,
- w:sub[i].w,
- h:height
- })
- }
- else if(obj.length>0 ){
- let i=obj.length-1
- this.paper.stdSujQnoPoints.push({
- x:obj[i].x,
- y:obj[i].y+obj[i].h+8,
- w:obj[i].w,
- h:height
- })
- }else{
- let dft={...this.dft}
- dft.h=height
- this.paper.stdSujQnoPoints.push(dft)
- }
-
- this.paper.sub.push({
- title:'语文作文题',
- words:row*20,
- id:this.addForm.start
- })
-
- this.addForm.end=this.addForm.start
- break;
- case 6:
- let rows=Number(this.addForm.row)
- var obj=this.paper.objAnsPoints,sub=this.paper.stdSujQnoPoints
- var height=rows*10+10
- if(sub.length>0){
- let i=sub.length-1
- this.paper.stdSujQnoPoints.push({
- x:sub[i].x,
- y:sub[i].y+sub[i].h+8,
- w:sub[i].w,
- h:height
- })
- }
- else if(obj.length>0 ){
- let i=obj.length-1
- this.paper.stdSujQnoPoints.push({
- x:obj[i].x,
- y:obj[i].y+obj[i].h+8,
- w:obj[i].w,
- h:height
- })
- }else{
- let dft={...this.dft}
- dft.h=height
- this.paper.stdSujQnoPoints.push(dft)
- }
-
- this.paper.sub.push({
- title:'英语作文题',
- rows:rows,
- id:this.addForm.start
- })
-
- this.addForm.end=this.addForm.start
- console.log(this.paper)
- break;
- }
- this.addForm.start=Number(this.addForm.end)+1
- this.addForm.end=''
- this.open=false
-
- },
- calcXY(){
- function sum(arr,start,end) {
- arr=JSON.parse(JSON.stringify(arr))
- arr=arr.splice(start,end)
- return arr.reduce((acc, curr) => Number(acc) + Number(curr), 0);
- }
- let col=this.addForm.col
- let list=this.paper.obj.list,list1=this.list
- let x,y=2.5,max=[0,0,0,0,0,0,0,0,0,0]
-
- list1.forEach(item=>{
- item.type=this.addForm.type
- if(item.type == 3){
- item.num=2
- }
- list.push(item)
- })
- list.forEach((item,index)=>{
- let r=parseInt(index/25),i=parseInt(index/col)
- if(r>0){
- i=parseInt(index%(r*25)/col)
- }
- item.points=[]
-
- if(index>0)y=y+5
- if(index>0 && index%col == 0){
- y=2.5+27*r
- }
-
- x=8+35*i
-
- if(index>0 && (index%25 >= 0 && index%25 < 5)){
- x=8
- }
- for(let i=0;i<item.num;i++){
- if(i>0)x+=6
-
- item.points.push({
- x:x,
- y:y,
- w:4,
- h:2.5
- })
- }
- })
-
- var dft={...this.dft}
- dft.h=Math.ceil(list.length/25)*28
- if(this.paper.objAnsPoints.length>0){
- this.paper.objAnsPoints[0].h=dft.h
- }else{
- this.paper.objAnsPoints.push(dft)
- }
-
- this.list=[]
- console.log(dft)
- },
-
-
- },
- created() {
- this.pages=this.decToBin4(this.pages).split('')
- },
- };
- </script>
|