123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625 |
- <template>
- <div
- v-loading="loading"
- class="edit-paper"
- element-loading-text="拼命加载中。。。"
- >
- <div class="edit-header">
- <div class="edit-header-top box-justify">
- <div class="header-info">
- <div class="header-info-item">
- <span>课程代码:</span>
- <span>{{ paper.course.code }}</span>
- </div>
- <div class="header-info-item">
- <span>课程名称:</span>
- <span>{{ paper.course.name }}</span>
- </div>
- <div class="header-info-item">
- <span>试卷名称:</span>
- <span>
- <el-tooltip class="item" effect="dark" placement="top-start">
- <div slot="content">{{ paper.name }}</div>
- <el-input
- v-model="paper.name"
- size="mini"
- class="header-info-input"
- placeholder="试卷名称"
- ></el-input>
- </el-tooltip>
- </span>
- </div>
- <div class="header-info-item">
- <span>试卷总分:</span>
- <span>{{ paper.totalScore }}</span>
- </div>
- </div>
- <div class="header-btns">
- <el-dropdown v-show="isShowAuditBtn()">
- <el-button type="primary" size="small">
- 审核<i class="el-icon-arrow-down el-icon--right"></i>
- </el-button>
- <el-dropdown-menu slot="dropdown">
- <el-dropdown-item>
- <el-button
- size="mini"
- type="success"
- @click="auditPaper('PASS')"
- >
- <i class="el-icon-success"></i>通过
- </el-button>
- </el-dropdown-item>
- <el-dropdown-item>
- <el-button
- size="mini"
- type="danger"
- @click="auditPaper('NOT_PASS')"
- >
- <i class="el-icon-error"></i>不通过
- </el-button>
- </el-dropdown-item>
- </el-dropdown-menu>
- </el-dropdown>
- <el-button
- v-show="isShowEditBtn()"
- type="primary"
- size="small"
- @click="savePaper"
- >保存
- </el-button>
- <el-button
- v-show="isShowEditBtn()"
- type="danger"
- plain
- size="small"
- @click="deletePaper(paper.id)"
- >删除
- </el-button>
- <el-button
- v-if="showCheckDuplicateBtn"
- type="primary"
- size="small"
- plain
- @click="checkDuplicate"
- >
- 进入查重
- </el-button>
- <el-dropdown v-show="isShowEditBtn()">
- <el-button type="primary" size="small" plain>
- 更多 <i class="el-icon-more el-icon--right"></i>
- </el-button>
- <el-dropdown-menu slot="dropdown" class="action-dropdown">
- <el-dropdown-item>
- <el-button type="primary" plain size="small" @click="openDialog"
- >上传音频
- </el-button>
- </el-dropdown-item>
- <el-dropdown-item>
- <el-button
- size="small"
- type="primary"
- plain
- @click="exportPaperAnswer()"
- ><i class="el-icon-download"></i>导出答案</el-button
- >
- </el-dropdown-item>
- <el-dropdown-item>
- <el-button
- type="primary"
- size="small"
- plain
- @click="openAnswerDialog"
- ><i class="el-icon-upload2"></i>导入答案
- </el-button>
- </el-dropdown-item>
- </el-dropdown-menu>
- </el-dropdown>
- <el-button
- size="small"
- type="danger"
- plain
- icon="icon icon-back"
- @click="back"
- >返回</el-button
- >
- </div>
- </div>
- <div class="edit-header-bottom box-justify">
- <div>
- <el-button type="info" size="small" @click="showBasicDialog">
- 基础构成
- </el-button>
- <el-button type="info" size="small" @click="showTypeDialog">
- 题型分布
- </el-button>
- <el-button type="info" size="small" @click="showBlueDialog">
- 蓝图分布
- </el-button>
- <el-button type="info" size="small" @click="showAuditDialog">
- 审核记录
- </el-button>
- </div>
- <div>
- <span class="tips-info margin-right-10"
- >当前状态:{{ paper.auditStatus | paperAuditStatusFilter }}</span
- >
- <el-button type="primary" size="small" plain @click="quesTagShowHide">
- {{ quesTagShow ? "隐藏" : "显示" }}属性
- </el-button>
- <el-button
- type="primary"
- size="small"
- plain
- @click="quesAnswerShowHide"
- >
- {{ quesAnswerShow ? "隐藏" : "显示" }}答案
- </el-button>
- </div>
- </div>
- </div>
- <div class="edit-body">
- <div class="edit-part-list">
- <div class="edit-part">
- <div class="edit-cont">
- <div class="edit-cont-title">
- <h3>考试说明</h3>
- </div>
- <div class="edit-cont-action">
- <el-button
- type="primary"
- plain
- size="small"
- @click="openEditExamPaperRemark"
- >编辑</el-button
- >
- </div>
- <div class="edit-cont-body">
- <div v-html="paper.examRemark"></div>
- </div>
- </div>
- </div>
- </div>
- <!-- 循环大题 -->
- <div
- v-for="(paperDetail, detailIndex) in paper.paperDetails"
- v-show="paperDetailShow(paperDetail)"
- :key="detailIndex"
- class="edit-part-list"
- >
- <div class="edit-part">
- <div
- class="edit-cont"
- @mouseover="quesMouseOver(paperDetail.id)"
- @mouseout="quesMouseOut(paperDetail.id)"
- >
- <div class="edit-cont-title">
- <h3>
- <span>{{ paperDetail.cnNum }}</span> <span>.</span>
- <span>{{ paperDetail.name }}</span>
- <span>
- ({{
- !paperDetail.title ? "本大题" : paperDetail.title + ","
- }}共{{ paperDetail.unitCount }}小题,满分{{
- paperDetail.score
- }}分)
- </span>
- </h3>
- </div>
- <div :id="paperDetail.id" class="edit-cont-action">
- <el-button
- v-show="parentView == 'gen_paper' && isShowEditBtn()"
- size="small"
- type="primary"
- plain
- @click="selectQues(paperDetail.id)"
- >选题
- </el-button>
- <el-button
- v-show="isShowEditBtn()"
- size="small"
- type="primary"
- plain
- @click="openEditPaperDetail(paperDetail)"
- >编辑
- </el-button>
- <el-button
- v-if="showUp(paperDetail)"
- v-show="isShowEditBtn()"
- size="small"
- type="primary"
- plain
- @click="movePaperDetail(paperDetail, 'up')"
- >上移
- </el-button>
- <el-button
- v-if="showDown(paperDetail)"
- v-show="isShowEditBtn()"
- size="small"
- type="primary"
- plain
- @click="movePaperDetail(paperDetail, 'down')"
- >下移
- </el-button>
- <el-button
- v-show="isShowEditBtn()"
- size="small"
- type="danger"
- @click="deletePaperDetail(paperDetail.id)"
- >删除
- </el-button>
- <el-button
- v-show="showButtons[detailIndex].up"
- size="small"
- type="primary"
- plain
- icon="el-icon-arrow-up"
- @click.stop="hideContent(detailIndex)"
- ></el-button>
- <el-button
- v-show="!showButtons[detailIndex].up"
- size="small"
- icon="el-icon-arrow-down"
- type="primary"
- plain
- @click.stop="showContent(detailIndex)"
- ></el-button>
- </div>
- <div
- v-question-audio
- class="edit-cont-body"
- v-html="paperDetail.description"
- ></div>
- </div>
- <div v-show="quesTagShow" class="edit-property">
- <div class="edit-property-box">
- <div
- v-for="(paperDetailTag, tagIndex) in paperDetail.tags"
- :key="tagIndex"
- class="edit-property-item"
- >
- <div class="edit-property-body edit-property-danger">
- <div class="edit-property-title">
- {{ paperDetailTag.tag }}
- </div>
- <div class="edit-property-content">
- {{ paperDetailTag.content }}
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
- <!-- 循环小题 -->
- <div
- v-show="showQuestions[detailIndex].is_show"
- class="edit-paper-questions"
- >
- <template
- v-for="(paperDetailUnit, unitIndex) in paperDetail.paperDetailUnits"
- >
- <div
- v-show="quesShow(paperDetailUnit.id)"
- :key="`question-${unitIndex}`"
- :class="[
- 'edit-part',
- {
- 'question-duplicate':
- paperDetailUnit.question.checkDuplicateStatus ==
- 'TO_BE_DISPOSE',
- },
- ]"
- >
- <div
- class="edit-cont"
- @mouseover="quesMouseOver(paperDetailUnit.id)"
- @mouseout="quesMouseOut(paperDetailUnit.id)"
- >
- <div class="edit-cont-title">
- <span>{{ paperDetailUnit.number }}.</span>
- <span
- v-question-audio
- :hasAudio="paperDetailUnit.question.hasAudio"
- :questionId="paperDetailUnit.question.id"
- v-html="paperDetailUnit.question.quesBody"
- ></span>
- <span> ({{ paperDetailUnit.score }}分) </span>
- </div>
- <div :id="paperDetailUnit.id" class="edit-cont-action">
- <span class="tips-info">
- {{ paperDetailUnit.question.bodyLengthText }}
- </span>
- <el-button
- v-if="
- paperDetailUnit.question.checkDuplicateStatus ==
- 'TO_BE_DISPOSE'
- "
- size="small"
- type="primary"
- plain
- @click="checkDuplicateQuestion(paperDetailUnit.question.id)"
- >进入查重
- </el-button>
- <el-button
- v-show="isShowEditBtn()"
- size="small"
- type="primary"
- plain
- @click="editQues(paperDetailUnit, paperDetailUnit.question)"
- >编辑
- </el-button>
- <el-button
- v-if="showUnitUp(paperDetail, paperDetailUnit.id)"
- v-show="isShowEditBtn()"
- size="small"
- type="primary"
- plain
- @click="
- movePaperDetailUnit(
- paperDetail.id,
- paperDetailUnit.id,
- 'up'
- )
- "
- >上移
- </el-button>
- <el-button
- v-if="showUnitDown(paperDetail, paperDetailUnit.id)"
- v-show="isShowEditBtn()"
- size="small"
- type="primary"
- plain
- @click="
- movePaperDetailUnit(
- paperDetail.id,
- paperDetailUnit.id,
- 'down'
- )
- "
- >下移
- </el-button>
- <el-button
- v-show="isShowEditBtn()"
- type="danger"
- size="small"
- @click="deleteQues(paperDetailUnit)"
- >删除
- </el-button>
- <el-button
- v-show="
- isNested(paperDetailUnit.questionType) &&
- showSubButtons[detailIndex + '-' + unitIndex]
- "
- size="small"
- icon="el-icon-arrow-up"
- @click.stop="hideSubContent(detailIndex + '-' + unitIndex)"
- ></el-button>
- <el-button
- v-show="
- isNested(paperDetailUnit.questionType) &&
- !showSubButtons[detailIndex + '-' + unitIndex]
- "
- size="small"
- type="primary"
- plain
- icon="el-icon-arrow-down"
- @click.stop="showSubContent(detailIndex + '-' + unitIndex)"
- ></el-button>
- </div>
- <div class="edit-cont-body">
- <div
- v-for="(quesOption, optionIndex) in paperDetailUnit.question
- .quesOptions"
- :key="optionIndex"
- class="paper-option"
- >
- <span>{{ optionIndex | optionOrderWordFilter }}. </span>
- <span
- v-question-audio
- :hasAudio="paperDetailUnit.question.hasAudio"
- :questionId="paperDetailUnit.question.id"
- v-html="quesOption.optionBody"
- ></span>
- </div>
- <div v-if="!isNested(paperDetailUnit.questionType)">
- <div v-show="quesAnswerShow">
- <span>答案:</span>
- <span v-html="paperDetailUnit.question.quesAnswer"></span>
- </div>
- </div>
- </div>
- </div>
- <div v-show="quesTagShow" class="edit-property">
- <div class="edit-property-box">
- <div
- v-for="(questionTag, tagIndex) in paperDetailUnit.question
- .tags"
- :key="tagIndex"
- class="edit-property-item"
- >
- <div class="edit-property-body">
- <div class="edit-property-title">
- {{ questionTag.tag }}
- </div>
- <div class="edit-property-content">
- {{ questionTag.content }}
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
- <!-- 子题 -->
- <div
- v-show="showSubQuestions[detailIndex + '-' + unitIndex]"
- :key="`question-sub-${unitIndex}`"
- class="edit-paper-question-subs"
- >
- <div
- v-for="(subQuestion, subIndex) in paperDetailUnit.question
- .subQuestions"
- v-show="quesShow(subQuestion.id)"
- :key="subIndex"
- class="edit-part"
- >
- <div
- class="edit-cont"
- @mouseover="
- quesMouseOver(
- getSubQuesEditId(paperDetailUnit, subQuestion)
- )
- "
- @mouseout="
- quesMouseOut(getSubQuesEditId(paperDetailUnit, subQuestion))
- "
- >
- <div
- v-show="isShowEditBtn()"
- :id="getSubQuesEditId(paperDetailUnit, subQuestion)"
- class="edit-cont-action"
- >
- <el-button
- size="small"
- type="primary"
- plain
- @click="editQues(paperDetailUnit, subQuestion)"
- >编辑
- </el-button>
- <el-button
- v-if="showUnitSubUp(paperDetailUnit, subQuestion.id)"
- size="small"
- type="primary"
- plain
- @click="
- movePaperDetailUnitSub(
- paperDetailUnit.id,
- subQuestion.id,
- 'up'
- )
- "
- >上移
- </el-button>
- <el-button
- v-if="showUnitSubDown(paperDetailUnit, subQuestion.id)"
- size="small"
- type="primary"
- plain
- @click="
- movePaperDetailUnitSub(
- paperDetailUnit.id,
- subQuestion.id,
- 'down'
- )
- "
- >下移
- </el-button>
- </div>
- <div class="edit-cont-title">
- <span>{{ subQuestion.subNumber }}. </span>
- <span v-question-audio v-html="subQuestion.quesBody"></span>
- <span
- >({{ paperDetailUnit.subScoreList[subIndex] }}分)</span
- >
- </div>
- <div
- v-if="!isMatchingQuestion(paperDetailUnit.questionType)"
- class="edit-cont-body"
- >
- <div
- v-for="(
- subQuesOption, subOptIndex
- ) in subQuestion.quesOptions"
- :key="subOptIndex"
- class="paper-option"
- >
- <span>{{ subOptIndex | optionOrderWordFilter }}. </span>
- <span
- v-question-audio
- v-html="subQuesOption.optionBody"
- ></span>
- </div>
- </div>
- <div v-show="quesAnswerShow">
- <span>答案:</span>
- <span v-html="subQuestion.quesAnswer"></span>
- </div>
- </div>
- <div v-show="quesTagShow" class="edit-property">
- <div class="edit-property-box">
- <div
- v-for="(subQuestionTag, tagIndex) in subQuestion.tags"
- :key="tagIndex"
- class="edit-property-item"
- >
- <div class="edit-property-body">
- <div class="edit-property-title">
- {{ subQuestionTag.tag }}
- </div>
- <div class="edit-property-content">
- {{ subQuestionTag.content }}
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
- </template>
- </div>
- </div>
- </div>
- <!-- 编辑大题弹框 -->
- <el-dialog
- v-loading.body="detailLoading"
- width="600px"
- title="大题名称编辑"
- element-loading-text="保存中。。。"
- :visible.sync="paperDatailDialog"
- :modal="false"
- append-to-body
- custom-class="side-dialog"
- @close="closeQuesDialog"
- >
- <el-form :model="editpaperDetail" label-width="80px">
- <el-form-item label="大题名称">
- <el-input
- v-model="editpaperDetail.name"
- placeholder="请输入大题名称"
- ></el-input>
- </el-form-item>
- <el-form-item label="大题描述">
- <ckeditor
- v-model="editpaperDetail.description"
- class="area-ckeditor"
- ></ckeditor>
- </el-form-item>
- </el-form>
- <div slot="footer">
- <el-button type="primary" @click="savePaperDatail(editpaperDetail)"
- >保存</el-button
- >
- <el-button type="danger" plain @click="closePaperDatailDialog()"
- >取消</el-button
- >
- </div>
- </el-dialog>
- <!-- 编辑试题弹框 -->
- <el-dialog
- v-loading.body="dialogLoading"
- title="试题编辑"
- element-loading-text="保存中。。。"
- :visible.sync="quesDialog"
- :modal="false"
- append-to-body
- custom-class="side-dialog"
- @close="closeQuesDialog"
- >
- <el-form :model="quesModel" label-position="right" label-width="80px">
- <el-row :gutter="10">
- <el-col :span="12">
- <el-form-item label="题型">
- <el-select
- v-model="quesModel.questionType"
- :disabled="true"
- placeholder="请输入题型"
- >
- <el-option
- v-for="item in questionTypes"
- :key="item.value"
- :label="item.label"
- :value="item.value"
- >
- </el-option>
- </el-select>
- </el-form-item>
- </el-col>
- <el-col :span="12">
- <el-form-item label="分值">
- <el-input-number
- v-model="quesModel.score"
- placeholder="分值"
- :precision="1"
- :min="0"
- :disabled="isNested(quesModel.questionType)"
- ></el-input-number>
- </el-form-item>
- </el-col>
- <el-col :span="12">
- <el-form-item label="难度">
- <el-select
- v-model="quesModel.difficultyDegree"
- placeholder="请输入难度"
- :disabled="
- isNested(quesModel.questionType) ? true : updatePorperty
- "
- >
- <el-option
- v-for="item in difficultyDegreeList"
- :key="item.value"
- :label="item.label"
- :value="item.value"
- >
- </el-option>
- </el-select>
- </el-form-item>
- </el-col>
- <el-col :span="12">
- <el-form-item label="公开度">
- <el-select
- v-model="quesModel.publicity"
- placeholder="请输入公开度"
- :disabled="updatePorperty"
- >
- <el-option
- v-for="item in publicityList"
- :key="item.value"
- :label="item.label"
- :value="item.value"
- >
- </el-option>
- </el-select>
- </el-form-item>
- </el-col>
- <el-col
- v-if="quesModel.questionType == 'TEXT_ANSWER_QUESTION'"
- :span="12"
- >
- <el-form-item label="作答类型">
- <el-select
- v-model="quesModel.answerType"
- :disabled="updatePorperty"
- >
- <el-option
- v-for="item in answerTypes"
- :key="item.value"
- :label="item.label"
- :value="item.value"
- >
- </el-option>
- </el-select>
- </el-form-item>
- </el-col>
- <el-col
- v-if="quesModel.questionType && !isNested(quesModel.questionType)"
- :span="12"
- >
- <el-form-item label="时长">
- <el-input-number
- v-model="quesModel.control.maxAnswerTime"
- size="small"
- :precision="0"
- :min="1"
- :disabled="updatePorperty"
- ></el-input-number>
- </el-form-item>
- </el-col>
- <el-col v-if="isMatchingQuestion(quesModel.questionType)" :span="12">
- <el-form-item label="答题模式">
- <el-select
- v-model="quesModel.quesParam.matchingMode"
- :disabled="updatePorperty"
- >
- <el-option
- v-for="item in matchingModes"
- :key="item.value"
- :label="item.label"
- :value="item.value"
- >
- </el-option>
- </el-select>
- </el-form-item>
- </el-col>
- </el-row>
- <el-form-item label="属性列表">
- <el-tooltip
- v-for="(content, propIndex) in quesModel.quesProperties"
- :key="propIndex"
- placement="top"
- >
- <div slot="content">
- <span v-if="content.firstProperty != null"
- >一级属性:{{ content.firstProperty.name }}({{
- content.firstProperty.code
- }})</span
- ><br />
- <span v-if="content.secondProperty != null"
- >二级属性:{{ content.secondProperty.name }}({{
- content.secondProperty.code
- }})</span
- >
- </div>
- <span>
- <el-tag
- :key="content.id"
- style="margin-right: 5px"
- :closable="!updatePorperty"
- type="primary"
- effect="dark"
- @close="handleClose(content)"
- >
- {{ content.courseProperty.name }}
- </el-tag>
- </span>
- </el-tooltip>
- </el-form-item>
- <el-row :gutter="10">
- <el-col :span="8">
- <el-form-item label="属性名" label-width="80px">
- <el-select
- v-model="coursePropertyId"
- placeholder="属性名"
- class="property_with"
- :disabled="updatePorperty"
- @change="searchFirst"
- >
- <el-option label="请选择" value=""></el-option>
- <el-option
- v-for="item in coursePropertyList"
- :key="item.id"
- :label="item.name"
- :value="item.id"
- >
- </el-option>
- </el-select>
- </el-form-item>
- </el-col>
- <el-col :span="6">
- <el-form-item label="一级" label-width="48px">
- <el-select
- v-model="firstPropertyId"
- placeholder="一级"
- class="property_with"
- :disabled="updatePorperty"
- @change="searchSecond"
- >
- <el-option label="请选择" value=""></el-option>
- <el-option
- v-for="item in firstPropertyList"
- :key="item.id"
- :label="item.name + '(' + item.code + ')'"
- :value="item.id"
- >
- </el-option>
- </el-select>
- </el-form-item>
- </el-col>
- <el-col :span="6">
- <el-form-item label="二级" label-width="48px">
- <el-select
- v-model="secondPropertyId"
- placeholder="二级"
- class="property_with"
- :disabled="updatePorperty"
- >
- <el-option label="请选择" value=""></el-option>
- <el-option
- v-for="item in secondPropertyList"
- :key="item.id"
- :label="item.name + '(' + item.code + ')'"
- :value="item.id"
- >
- </el-option>
- </el-select>
- </el-form-item>
- </el-col>
- <el-col :span="4">
- <el-form-item label-width="0px">
- <el-button
- type="primary"
- :disabled="updatePorperty"
- @click="insertProperty"
- ><i class="el-icon-plus"></i>新增属性
- </el-button>
- </el-form-item>
- </el-col>
- </el-row>
- <!-- end by weiwenhai -->
- <el-form-item label="题目">
- <ckeditor v-model="quesModel.quesBody"></ckeditor>
- </el-form-item>
- <el-form-item
- v-for="(quesOption, optIndex) in quesModel.quesOptions"
- :key="optIndex"
- >
- <div class="question-edit-option">
- <div class="option-check">
- <div
- v-if="
- !quesModel.parentType ||
- !isMatchingQuestion(quesModel.parentType) ||
- !isInOtherSelect(optIndex, quesModel)
- "
- >
- <el-radio
- v-if="quesModel.questionType === 'SINGLE_ANSWER_QUESTION'"
- v-model="singleRightAnswer"
- :label="optIndex | optionOrderWordFilter"
- ></el-radio>
- <el-checkbox
- v-if="quesModel.questionType === 'MULTIPLE_ANSWER_QUESTION'"
- v-model="multipleRightAnswer"
- :label="optIndex | optionOrderWordFilter"
- ></el-checkbox>
- <span v-if="isMatchingQuestion(quesModel.questionType)">{{
- optIndex | optionOrderWordFilter
- }}</span>
- </div>
- <div
- v-if="
- quesModel.parentType &&
- isMatchingQuestion(quesModel.parentType) &&
- isInOtherSelect(optIndex, quesModel)
- "
- >
- <el-tooltip
- class="item"
- effect="dark"
- :content="otherSelect(optIndex, quesModel)"
- placement="top-start"
- >
- <el-radio
- v-if="quesModel.questionType === 'SINGLE_ANSWER_QUESTION'"
- v-model="singleRightAnswer"
- :disabled="true"
- :label="optIndex | optionOrderWordFilter"
- ></el-radio>
- <el-checkbox
- v-if="quesModel.questionType === 'MULTIPLE_ANSWER_QUESTION'"
- v-model="multipleRightAnswer"
- :disabled="true"
- :label="optIndex | optionOrderWordFilter"
- ></el-checkbox>
- <span v-if="isMatchingQuestion(quesModel.questionType)">{{
- optIndex | optionOrderWordFilter
- }}</span>
- </el-tooltip>
- </div>
- </div>
- <div
- v-if="
- !quesModel.parentType ||
- !isMatchingQuestion(quesModel.parentType)
- "
- class="option-body"
- >
- <ckeditor v-model="quesOption.optionBody"></ckeditor>
- </div>
- <div
- v-if="
- quesModel.parentType && isMatchingQuestion(quesModel.parentType)
- "
- class="option-body"
- >
- <span v-html="quesOption.optionBody"></span>
- </div>
- <div
- v-if="
- !quesModel.parentType ||
- !isMatchingQuestion(quesModel.parentType)
- "
- class="option-delete"
- >
- <el-button
- size="mini"
- circle
- type="danger"
- icon="el-icon-delete"
- title="删除"
- @click.prevent="removeQuesOption(quesOption)"
- ></el-button>
- </div>
- </div>
- </el-form-item>
- <el-form-item>
- <el-button
- v-if="
- (quesModel.questionType == 'SINGLE_ANSWER_QUESTION' ||
- quesModel.questionType == 'MULTIPLE_ANSWER_QUESTION' ||
- isMatchingQuestion(quesModel.questionType)) &&
- !isMatchingQuestion(quesModel.parentType)
- "
- type="primary"
- @click="addQuesOption"
- ><i class="el-icon-plus"></i> 新增选项
- </el-button>
- </el-form-item>
- <!-- 答案 -->
- <!-- 填空,简答 -->
- <div
- v-if="
- quesModel.questionType == 'TEXT_ANSWER_QUESTION' ||
- quesModel.questionType == 'FILL_BLANK_QUESTION'
- "
- >
- <el-form-item label="答案">
- <ckeditor v-model="quesModel.quesAnswer"></ckeditor>
- </el-form-item>
- </div>
- <!-- 单选或多选 -->
- <div
- v-if="
- quesModel.questionType == 'SINGLE_ANSWER_QUESTION' ||
- quesModel.questionType == 'MULTIPLE_ANSWER_QUESTION'
- "
- >
- <el-form-item label="答案">
- <span v-html="answer"></span>
- </el-form-item>
- </div>
- <!-- 判断 -->
- <div v-if="quesModel.questionType == 'BOOL_ANSWER_QUESTION'">
- <el-form-item label="答案" prop="quesAnswer">
- <el-select v-model="quesModel.quesAnswer" placeholder="请选择">
- <el-option
- v-for="op in options"
- :key="op"
- :label="op"
- :value="op"
- >
- </el-option>
- </el-select>
- </el-form-item>
- </div>
- </el-form>
- <div slot="footer">
- <el-button type="primary" @click="savePaperDetailUnit()"
- >保存</el-button
- >
- <el-button type="danger" plain @click="closeQuesDialog">取消</el-button>
- </div>
- </el-dialog>
- <!-- 考试说明弹框 -->
- <el-dialog
- title="考试说明编辑"
- :visible.sync="paperRemarkDialog"
- width="600px"
- :modal="false"
- append-to-body
- custom-class="side-dialog"
- >
- <el-form label-position="top">
- <el-form-item label="考试说明:">
- <ckeditor v-model="examRemark" class="area-ckeditor"></ckeditor>
- </el-form-item>
- </el-form>
- <div slot="footer">
- <el-button type="primary" @click="savePaperRemark">保存</el-button>
- <el-button type="danger" plain @click="closPaperRemark">取消</el-button>
- </div>
- </el-dialog>
- <!-- 上传音频弹框 -->
- <el-dialog
- title="上传音频文件"
- :visible.sync="dialogRadioFile"
- :before-close="closeAudioDialog"
- :modal="false"
- append-to-body
- custom-class="side-dialog"
- >
- <form
- id="radioForm"
- method="post"
- action=""
- enctype="multipart/form-data"
- >
- <input
- id="radioFile"
- name="files"
- type="file"
- value="上传音频文件"
- webkitdirectory
- />
- <el-button type="warning" @click="checkFile">检查文件名</el-button>
- <el-button
- type="info"
- :loading="uploadAudioLoading"
- :disabled="isUpload || uploadAudioLoading"
- @click="uploadAudioFile"
- >
- <span v-show="!uploadAudioLoading">开始上传</span>
- <span v-show="uploadAudioLoading">正在上传中...</span>
- </el-button>
- </form>
- <div v-if="checkResult" style="margin-top: 20px">
- <span>检查结果:</span><br /><br />
- <span v-show="message == 'OK!'" style="color: #13ce66">OK!</span>
- <span v-show="message != 'OK!'" style="color: #ff4949">{{
- message
- }}</span>
- </div>
- </el-dialog>
- <!-- 上传答案文件 -->
- <el-dialog
- title="上传答案文件"
- :visible.sync="dialogAnswerFile"
- :before-close="closeAnswerDialog"
- :modal="false"
- append-to-body
- custom-class="side-dialog"
- >
- <form
- id="answerForm"
- method="post"
- action=""
- enctype="multipart/form-data"
- >
- <input
- id="answerFile"
- name="answerFiles"
- type="file"
- value="上传答案文件"
- accept="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
- />
- <el-button type="primary" @click="downAnswerTemplate">
- <span>下载模板</span>
- </el-button>
- <el-button
- type="primary"
- :loading="uploadAnswerLoading"
- :disabled="uploadAnswerLoading"
- @click="uploadAnswerFile"
- >
- <span v-show="!uploadAnswerLoading">开始上传</span>
- <span v-show="uploadAnswerLoading">正在上传中...</span>
- </el-button>
- </form>
- <div style="margin-top: 20px">
- <span v-show="answerMessage != ''" style="color: #ff4949">{{
- answerMessage
- }}</span>
- </div>
- </el-dialog>
- <!-- 基础构成 -->
- <el-dialog
- title="基础构成"
- width="100%"
- :visible.sync="basicDialog"
- :modal="false"
- append-to-body
- custom-class="side-dialog"
- >
- <PaperBasicComposition
- v-if="basicDialog"
- :paper-id="paperId"
- ></PaperBasicComposition>
- </el-dialog>
- <!-- 题型分布 -->
- <el-dialog
- title="题型分布"
- width="100%"
- :visible.sync="typeDialog"
- :modal="false"
- append-to-body
- custom-class="side-dialog"
- >
- <PaperQuestionType
- v-if="typeDialog"
- :paper-id="paperId"
- ></PaperQuestionType>
- </el-dialog>
- <!-- 蓝图分布 -->
- <el-dialog
- title="蓝图分布"
- width="100%"
- :visible.sync="blueDialog"
- :modal="false"
- append-to-body
- custom-class="side-dialog"
- >
- <PaperBlue
- v-if="blueDialog"
- :paper-id="paperId"
- :course-code="paper.course.code"
- ></PaperBlue>
- </el-dialog>
- <!-- 审核记录 -->
- <el-dialog
- title="审核记录"
- width="700px"
- :visible.sync="auditInfoDialog"
- :modal="false"
- append-to-body
- custom-class="side-dialog"
- >
- <AuditInfo v-if="auditInfoDialog" :paper-id="paperId"></AuditInfo>
- </el-dialog>
- <!-- 审核试卷 -->
- <el-dialog
- title="审核试卷"
- width="700px"
- :visible.sync="auditPaperDialog"
- :modal="false"
- append-to-body
- custom-class="side-dialog"
- >
- <AuditPaper
- v-if="auditPaperDialog"
- :paper-ids="selectedPaperIds"
- :audit-result="auditResult"
- @afterAudit="afterAudit"
- ></AuditPaper>
- </el-dialog>
- </div>
- </template>
- <script>
- import { QUESTION_API } from "@/constants/constants";
- import { isEmptyStr, QUESTION_TYPES } from "../constants/constants";
- import { mapState } from "vuex";
- import ckeditor from "../component/ckeditor.vue";
- import PaperBasicComposition from "./PaperBasicComposition.vue";
- import PaperQuestionType from "./PaperQuestionType.vue";
- import PaperBlue from "./PaperBlue.vue";
- import AuditInfo from "./AuditInfo.vue";
- import AuditPaper from "./AuditPaper.vue";
- export default {
- name: "EditPaperApp",
- components: {
- ckeditor,
- PaperBasicComposition,
- PaperQuestionType,
- PaperBlue,
- AuditInfo,
- AuditPaper,
- },
- data() {
- return {
- showCheckDuplicateBtn: false,
- selectedPaperIds: [],
- auditPaperDialog: false,
- auditResult: "",
- auditInfoDialog: false,
- blueDialog: false,
- typeDialog: false,
- basicDialog: false,
- quesAnswerShow: true,
- quesTagShow: true,
- hValue: "100px",
- wValue: "500px",
- display: "block",
- uploadAction: "",
- fileList: [],
- answerFileList: [],
- paperId: "",
- paperDetailId: "",
- editPaperDetailUnit: "",
- quesDialog: false,
- paperDatailDialog: false,
- paperRemarkDialog: false,
- parentView: "",
- paper: {
- course: {
- code: "",
- name: "",
- },
- examRemark: "",
- },
- loading: false,
- dialogLoading: false,
- detailLoading: false,
- uploadAudioLoading: false,
- uploadAnswerLoading: false,
- questionTypes: QUESTION_TYPES,
- questionType: "",
- quesModel: { quesProperties: [] },
- editpaperDetail: {},
- reduplicateQuestions: [],
- reduplicateGroup: [],
- reduplicateQuesColor: [],
- singleRightAnswer: "", //接收单选答案
- multipleRightAnswer: [], //接收多选答案
- options: ["正确", "错误"],
- duplicateLoading: false,
- dialogRadioFile: false,
- dialogAnswerFile: false,
- isUpload: true,
- isUploadAnswer: true,
- message: "",
- answerMessage: "",
- checkResult: false,
- checkResultAnswer: false,
- fileNameList: [],
- defaultColor: [
- "Red",
- "Blue",
- "LimeGreen",
- "GoldenRod",
- "Black",
- "BlueViolet",
- "Chocolate",
- "DarkCyan",
- "HotPink",
- "Orange",
- "IndianRed",
- "Indigo",
- "Green",
- "Aqua",
- "CadetBlue",
- "SkyBlue",
- "SlateBlue",
- "SlateGray",
- "Tomato",
- "VioletRed",
- ],
- difficultyDegreeList: [
- { label: 0.1, value: 0.1 },
- { label: 0.2, value: 0.2 },
- { label: 0.3, value: 0.3 },
- { label: 0.4, value: 0.4 },
- { label: 0.5, value: 0.5 },
- { label: 0.6, value: 0.6 },
- { label: 0.7, value: 0.7 },
- { label: 0.8, value: 0.8 },
- { label: 0.9, value: 0.9 },
- { label: 1.0, value: 1.0 },
- ],
- publicityList: [
- { label: "公开", value: true },
- { label: "非公开", value: false },
- ],
- answerTypes: [
- { label: "文本", value: "DIVERSIFIED_TEXT" },
- { label: "音频", value: "SINGLE_AUDIO" },
- ],
- matchingTypes: [
- { label: "填词", value: 1 },
- { label: "段落", value: 2 },
- ],
- matchingModes: [
- { label: "单用", value: 1 },
- { label: "复用", value: 2 },
- ],
- coursePropertyList: [],
- coursePropertyId: "", //课程属性名
- firstPropertyList: [], //一级属性集合
- firstPropertyId: "", //一级属性id
- secondPropertyList: [], //二级属性集合
- secondPropertyId: "", //二级属性id
- examRemark: "",
- showQuestions: [],
- showButtons: [],
- showSubQuestions: {},
- showSubButtons: {},
- };
- },
- computed: {
- ...mapState({
- user: (state) => state.user,
- }),
- updatePorperty() {
- return false;
- },
- answer() {
- if (this.quesModel.questionType == "SINGLE_ANSWER_QUESTION") {
- return this.singleRightAnswer;
- } else if (this.quesModel.questionType == "MULTIPLE_ANSWER_QUESTION") {
- var obj = this.multipleRightAnswer;
- return obj.sort().toString();
- }
- return this.quesModel.quesAnswer;
- },
- },
- created() {
- let qt = sessionStorage.getItem("quesTagShow");
- if (qt) {
- this.quesTagShow = qt == "true";
- }
- let qa = sessionStorage.getItem("quesAnswerShow");
- if (qa) {
- this.quesAnswerShow = qa == "true";
- }
- document.getElementsByTagName("body")[0].style = "";
- this.paperId = this.$route.params.id;
- this.parentView = this.$route.params.parentView;
- this.initPaper();
- this.uploadAction = QUESTION_API + "/uploadRadio/" + this.paperId;
- this.uploadHeaders = {
- key: this.user.key,
- token: this.user.token,
- };
- },
- methods: {
- showCheckDuplicate() {
- if (this.paper.checkDuplicateStatus == "DISPOSED") {
- this.showCheckDuplicateBtn = false;
- } else if (this.paper.paperDetails) {
- for (let paperDetilData of this.paper.paperDetails) {
- if (paperDetilData.paperDetailUnits) {
- for (let unit of paperDetilData.paperDetailUnits) {
- if (unit.question.checkDuplicateStatus == "TO_BE_DISPOSE") {
- this.showCheckDuplicateBtn = true;
- return;
- }
- }
- }
- }
- this.showCheckDuplicateBtn = false;
- }
- },
- checkDuplicate() {
- this.$router.push({
- name: "check_duplicate_info",
- params: {
- basePaperId: this.paper.id,
- from: "paper",
- },
- });
- },
- checkDuplicateQuestion(questionId) {
- this.$router.push({
- name: "check_duplicate_info",
- params: {
- quesId: questionId,
- basePaperId: this.paper.id,
- from: "paper",
- },
- });
- },
- isShowEditBtn() {
- if (
- this.paper.creationBy == this.user.userId &&
- (this.paper.auditStatus == "WITHDRAW" ||
- this.paper.auditStatus == "NOT_PASS")
- ) {
- return true;
- } else {
- return false;
- }
- },
- afterAudit() {
- this.auditPaperDialog = false;
- this.back();
- },
- auditPaper(pass) {
- this.auditResult = pass;
- this.selectedPaperIds = [];
- this.selectedPaperIds.push(this.paperId);
- this.auditPaperDialog = true;
- },
- isShowAuditBtn() {
- if (
- this.paper.auditStatus != "WITHDRAW" &&
- this.paper.auditStatus != "NOT_PASS" &&
- this.isMyAudit()
- ) {
- return true;
- } else {
- return false;
- }
- },
- isMyAudit() {
- if (
- this.paper.auditStatus == "FIRST_PENDING_TRIAL" &&
- this.user.auditAuthority == "FIRST"
- ) {
- return true;
- }
- if (
- this.paper.auditStatus == "SECOND_PENDING_TRIAL" &&
- this.user.auditAuthority == "SECOND"
- ) {
- return true;
- }
- if (
- this.paper.auditStatus == "THIRD_PENDING_TRIAL" &&
- this.user.auditAuthority == "THIRD"
- ) {
- return true;
- }
- return false;
- },
- showAuditDialog() {
- this.auditInfoDialog = true;
- },
- showBlueDialog() {
- this.blueDialog = true;
- },
- showTypeDialog() {
- this.typeDialog = true;
- },
- showBasicDialog() {
- this.basicDialog = true;
- },
- quesAnswerShowHide() {
- this.quesAnswerShow = !this.quesAnswerShow;
- sessionStorage.setItem("quesAnswerShow", this.quesAnswerShow);
- },
- quesTagShowHide() {
- this.quesTagShow = !this.quesTagShow;
- sessionStorage.setItem("quesTagShow", this.quesTagShow);
- },
- isMatchingQuestion(questionType) {
- if (
- questionType == "PARAGRAPH_MATCHING" ||
- questionType == "BANKED_CLOZE"
- ) {
- return true;
- } else {
- return false;
- }
- },
- isNested(questionType) {
- if (
- questionType == "PARAGRAPH_MATCHING" ||
- questionType == "BANKED_CLOZE" ||
- questionType == "CLOZE" ||
- questionType == "READING_COMPREHENSION" ||
- questionType == "LISTENING_QUESTION"
- ) {
- return true;
- } else {
- return false;
- }
- },
- otherSelect(optIndex, quesModel) {
- return "该选项被第" + quesModel.optionsSelected[optIndex + 1] + "题选用";
- },
- isInOtherSelect(optIndex, quesModel) {
- if (quesModel.parentQuesParam.matchingMode != 1) {
- return false;
- }
- if (!quesModel.optionsSelected) {
- return false;
- }
- if (!quesModel.optionsSelected[optIndex + 1]) {
- return false;
- }
- if (
- quesModel.optionsSelected[optIndex + 1].includes(quesModel.subNumber)
- ) {
- return false;
- }
- return true;
- },
- movePaperDetailUnitSub(unitid, subid, vector) {
- let vectorStr = vector == "up" ? "上移" : "下移";
- this.$alert("您确定" + vectorStr + "吗?", "提示", {
- confirmButtonText: "确定",
- callback: (action) => {
- if (action == "confirm") {
- this.loading = true;
- this.$http
- .put(
- QUESTION_API +
- "/paperDetailUnit/sub/" +
- unitid +
- "/" +
- subid +
- "/" +
- vector
- )
- .then(() => {
- this.initPaper();
- this.loading = true;
- this.$notify({
- message: vectorStr + "成功",
- type: "success",
- });
- this.loading = false;
- });
- }
- },
- });
- },
- showUnitSubDown(unit, subid) {
- if (unit.question.subQuestions.length <= 1) {
- return false;
- }
- if (
- subid !=
- unit.question.subQuestions[unit.question.subQuestions.length - 1].id
- ) {
- return true;
- } else {
- return false;
- }
- },
- showUnitSubUp(unit, subid) {
- if (unit.question.subQuestions.length <= 1) {
- return false;
- }
- if (subid != unit.question.subQuestions[0].id) {
- return true;
- } else {
- return false;
- }
- },
- movePaperDetailUnit(detailId, unitid, vector) {
- let vectorStr = vector == "up" ? "上移" : "下移";
- this.$alert("您确定" + vectorStr + "吗?", "提示", {
- confirmButtonText: "确定",
- callback: (action) => {
- if (action == "confirm") {
- this.loading = true;
- this.$http
- .put(
- QUESTION_API +
- "/paperDetailUnit/" +
- detailId +
- "/" +
- unitid +
- "/" +
- vector
- )
- .then(() => {
- this.initPaper();
- this.loading = true;
- this.$notify({
- message: vectorStr + "成功",
- type: "success",
- });
- this.loading = false;
- });
- }
- },
- });
- },
- showUnitDown(detail, unitid) {
- if (detail.paperDetailUnits.length <= 1) {
- return false;
- }
- if (
- unitid != detail.paperDetailUnits[detail.paperDetailUnits.length - 1].id
- ) {
- return true;
- } else {
- return false;
- }
- },
- showUnitUp(detail, unitid) {
- if (detail.paperDetailUnits.length <= 1) {
- return false;
- }
- if (unitid != detail.paperDetailUnits[0].id) {
- return true;
- } else {
- return false;
- }
- },
- movePaperDetail(detail, vector) {
- let vectorStr = vector == "up" ? "上移" : "下移";
- this.$alert("您确定" + vectorStr + "吗?", "提示", {
- confirmButtonText: "确定",
- callback: (action) => {
- if (action == "confirm") {
- this.loading = true;
- this.$http
- .put(
- QUESTION_API +
- "/paperDetail/" +
- this.paperId +
- "/" +
- detail.id +
- "/" +
- vector
- )
- .then(() => {
- this.initPaper();
- this.loading = true;
- this.$notify({
- message: vectorStr + "成功",
- type: "success",
- });
- this.loading = false;
- });
- }
- },
- });
- },
- showUp(detail) {
- if (this.paper.paperDetails.length <= 1) {
- return false;
- }
- if (detail.id != this.paper.paperDetails[0].id) {
- return true;
- } else {
- return false;
- }
- },
- showDown(detail) {
- if (this.paper.paperDetails.length <= 1) {
- return false;
- }
- if (
- detail.id !=
- this.paper.paperDetails[this.paper.paperDetails.length - 1].id
- ) {
- return true;
- } else {
- return false;
- }
- },
- downAnswerTemplate() {
- var key = this.user.key;
- var token = this.user.token;
- window.open(
- QUESTION_API + "/paper/answer/template?$key=" + key + "&$token=" + token
- );
- },
- openAnswerDialog() {
- this.checkResultAnswer = false;
- this.isUploadAnswer = true;
- if (document.getElementById("answerFile")) {
- document.getElementById("answerFile").value = "";
- }
- this.dialogAnswerFile = true;
- this.answerFileList = [];
- },
- closeAnswerDialog() {
- this.answerMessage = "";
- this.dialogAnswerFile = this.uploadAnswerLoading;
- },
- uploadAnswerFile() {
- this.answerMessage = "";
- var fileList = document.getElementById("answerFile").files;
- if (fileList.length == 0) {
- this.answerMessage = "请选择文件!";
- return;
- }
- let param = new FormData();
- //循环添加到formData中
- for (var i = 0; i < fileList.length; i++) {
- var file = fileList[i];
- param.append("dataFile", file, file.name);
- }
- let config = {
- headers: { "Content-Type": "multipart/form-data" },
- };
- this.uploadAnswerLoading = true;
- this.$http
- .post(
- QUESTION_API + "/paper/answer/import/" + this.paperId,
- param,
- config
- )
- .then(() => {
- this.dialogAnswerFile = false;
- this.uploadAnswerLoading = false;
- this.checkResultAnswer = false;
- this.isUploadAnswer = true;
- document.getElementById("answerFile").value = "";
- this.initPaper();
- })
- .catch((error) => {
- this.answerMessage = error.response.data.desc;
- document.getElementById("answerFile").value = "";
- this.uploadAnswerLoading = false;
- });
- },
- //隐藏大题下的所有小题
- hideContent(index) {
- this.showQuestions[index].is_show = false;
- this.showButtons[index].up = false;
- },
- //展开大题下所有小题
- showContent(index) {
- this.showQuestions[index].is_show = true;
- this.showButtons[index].up = true;
- },
- //隐藏大题下的所有小题
- hideSubContent(index) {
- this.showSubQuestions[index] = false;
- this.showSubButtons[index] = false;
- this.$forceUpdate();
- },
- //展开大题下所有小题
- showSubContent(index) {
- this.showSubQuestions[index] = true;
- this.showSubButtons[index] = true;
- this.$forceUpdate();
- },
- quesMouseOver(index) {
- document.getElementById(index).style.visibility = "visible";
- },
- quesMouseOut(index) {
- document.getElementById(index).style.visibility = "hidden";
- },
- selectQues(id) {
- this.paperDetailId = id;
- var courseCode = this.paper.course.code;
- var courseName = this.paper.course.name;
- this.$router.push({
- path:
- "/select_question/" +
- this.paper.id +
- "/" +
- courseCode +
- "/" +
- encodeURIComponent(courseName) +
- "/" +
- this.paperDetailId +
- "/" +
- this.parentView,
- });
- },
- //打开编辑大题题目弹窗
- openEditPaperDetail(paperDetail) {
- this.paperDatailDialog = true;
- this.editpaperDetail = Object.assign({}, paperDetail); //浅拷贝
- },
- //关闭编辑大题题目弹窗
- closePaperDatailDialog() {
- this.paperDatailDialog = false;
- this.editpaperDetail = {};
- },
- //保存大题题目信息
- savePaperDatail(editpaperDetail) {
- this.detailLoading = true;
- var paperId = this.paper.id;
- this.$http
- .post(QUESTION_API + "/updatePaperDetail/" + paperId, editpaperDetail)
- .then(() => {
- this.$notify({
- message: "保存成功",
- type: "success",
- });
- this.detailLoading = false;
- this.closePaperDatailDialog();
- this.initPaper();
- });
- },
- //初始化试卷
- initPaper() {
- const scrollPosition =
- document.documentElement.scrollTop || document.body.scrollTop;
- this.loading = true;
- this.paper = {
- course: {
- code: "",
- name: "",
- },
- };
- this.$http
- .get(QUESTION_API + "/paper/" + this.paperId)
- .then((response) => {
- this.paper = response.data;
- //查询所有课程属性名
- this.initCourseProperty(this.paper.course.code);
- //将所有小题分为公开和非公开
- if (this.paper.paperDetails && this.paper.paperDetails.length > 0) {
- let dindx = 0;
- for (let paperDetil of this.paper.paperDetails) {
- this.showQuestions.push({ is_show: true });
- this.showButtons.push({ up: true });
- paperDetil.pubCount = 0;
- paperDetil.noPubCount = 0;
- if (
- paperDetil.paperDetailUnits &&
- paperDetil.paperDetailUnits.length > 0
- ) {
- let uindx = 0;
- for (let paperDetilUt of paperDetil.paperDetailUnits) {
- this.showSubQuestions[dindx + "-" + uindx] = true;
- this.showSubButtons[dindx + "-" + uindx] = true;
- if (!this.isNested(paperDetilUt.question.questionType)) {
- //非套题
- if (paperDetilUt.question.publicity) {
- paperDetil.pubCount = paperDetil.pubCount + 1;
- } else {
- paperDetil.noPubCount = paperDetil.noPubCount + 1;
- }
- } else {
- //循环所有子题
- for (let ques of paperDetilUt.question.subQuestions) {
- if (ques.publicity) {
- paperDetil.pubCount = paperDetil.pubCount + 1;
- } else {
- paperDetil.noPubCount = paperDetil.noPubCount + 1;
- }
- }
- }
- uindx++;
- }
- }
- dindx++;
- }
- }
- this.showCheckDuplicate();
- setTimeout(() => {
- document.documentElement.scrollTop = document.body.scrollTop =
- scrollPosition;
- console.log(scrollPosition);
- }, 1000);
- this.loading = false;
- });
- },
- //查询所有课程属性名
- initCourseProperty(courseCode) {
- this.$http
- .get(QUESTION_API + "/courseProperty/enable/" + courseCode)
- .then((response) => {
- this.coursePropertyList = response.data;
- });
- },
- //删除大题
- deletePaperDetail(paperDetailsId) {
- //先判断大题下面是否还有小题
- var count = 0;
- for (var i = 0, imax = this.paper.paperDetails.length; i < imax; i++) {
- if (paperDetailsId == this.paper.paperDetails[i].id) {
- if (this.paper.paperDetails[i].paperDetailUnits) {
- count += this.paper.paperDetails[i].paperDetailUnits.length;
- break;
- }
- }
- }
- if (count == 0) {
- this.$alert("您确定删除吗?", "提示", {
- confirmButtonText: "确定",
- callback: (action) => {
- if (action == "confirm") {
- this.loading = true;
- this.$http
- .delete(
- QUESTION_API +
- "/paperDetail/" +
- this.paperId +
- "/" +
- paperDetailsId
- )
- .then(() => {
- this.initPaper();
- this.loading = true;
- this.$notify({
- message: "删除成功",
- type: "success",
- });
- this.loading = false;
- });
- }
- },
- });
- } else {
- this.$alert("大题下还有小题,不可删除!", "提示", {
- confirmButtonText: "确定",
- callback: () => {},
- });
- }
- },
- quesShow(id) {
- if (this.reduplicateGroup.length < 1) {
- return true;
- }
- for (var i = 0, imax = this.reduplicateGroup.length; i < imax; i++) {
- if (id == this.reduplicateGroup[i]) {
- return true;
- }
- }
- return false;
- },
- //编辑题目
- editQues(paperDetailUnit, question) {
- console.log("question:", question);
- this.coursePropertyId = "";
- this.firstPropertyId = "";
- this.secondPropertyId = "";
- this.editPaperDetailUnit = paperDetailUnit;
- this.quesModel = JSON.parse(JSON.stringify(question)); //深拷贝
- if (!this.quesModel.control) {
- this.quesModel.control = {};
- }
- this.quesModel.score = paperDetailUnit.score;
- //如果是套题下面的小题编辑 ( paperDetailUnit的类型是套题,question的类型不是套题)
- if (
- this.isNested(paperDetailUnit.questionType) &&
- question.questionType != paperDetailUnit.questionType
- ) {
- for (var i = 0; i < paperDetailUnit.question.subQuestions.length; i++) {
- if (
- paperDetailUnit.question.subQuestions[i].id == this.quesModel.id
- ) {
- this.quesModel.score = paperDetailUnit.subScoreList[i];
- this.quesModel.parentType = paperDetailUnit.questionType;
- this.quesModel.optionsSelected = paperDetailUnit.optionsSelected;
- this.quesModel.parentQuesParam = paperDetailUnit.question.quesParam;
- break;
- }
- }
- }
- if (isEmptyStr(this.quesModel.answerType)) {
- this.quesModel.answerType = "DIVERSIFIED_TEXT";
- }
- if (this.quesModel.questionType == "FILL_BLANK_QUESTION") {
- this.quesModel.quesBody = this.quesModel.quesBody.replace(
- /______/g,
- "###"
- );
- }
- if (this.isNested(this.quesModel.questionType)) {
- this.quesModel.quesBody = this.quesModel.quesBody.replace(
- /___([1-9][0-9]*)___/g,
- "##$1##"
- );
- }
- this.assignAnswers(); //给singleRightAnswer或multipleRightAnswer赋值
- this.openQuesDialog();
- },
- //给singleRightAnswer和multipleRightAnswer赋值
- assignAnswers() {
- if (this.quesModel.quesOptions && this.quesModel.quesOptions.length > 0) {
- this.singleRightAnswer = "";
- this.multipleRightAnswer = [];
- for (let i = 0; i < this.quesModel.quesOptions.length; i++) {
- let option = this.quesModel.quesOptions[i];
- if (
- this.quesModel.questionType == "SINGLE_ANSWER_QUESTION" &&
- option.isCorrect == 1
- ) {
- this.singleRightAnswer = String.fromCharCode(65 + i);
- }
- if (
- this.quesModel.questionType == "MULTIPLE_ANSWER_QUESTION" &&
- option.isCorrect == 1
- ) {
- this.multipleRightAnswer.push(String.fromCharCode(65 + i));
- }
- }
- }
- },
- //打开修改试题编辑框
- openQuesDialog() {
- this.quesDialog = true;
- },
- //关闭试题编辑框
- closeQuesDialog() {
- this.quesDialog = false;
- this.quesModel = {};
- },
- //删除属性
- handleClose(tag) {
- this.quesModel.quesProperties.splice(
- this.quesModel.quesProperties.indexOf(tag),
- 1
- );
- },
- //查询一级属性
- searchFirst() {
- this.firstPropertyId = "";
- this.secondPropertyId = "";
- this.secondPropertyList = [];
- if (this.coursePropertyId) {
- for (let courseProperty of this.coursePropertyList) {
- if (courseProperty.id == this.coursePropertyId) {
- this.$http
- .get(QUESTION_API + "/property/first/" + courseProperty.id)
- .then((response) => {
- this.firstPropertyList = response.data;
- });
- }
- }
- }
- },
- //查询二级属性
- searchSecond() {
- this.secondPropertyId = "";
- if (this.firstPropertyId) {
- this.$http
- .get(QUESTION_API + "/property/second/" + this.firstPropertyId)
- .then((response) => {
- this.secondPropertyList = response.data;
- });
- }
- },
- //新增属性
- insertProperty() {
- if (!this.checkInsertPro()) {
- return false;
- }
- var quesProperty = {
- id: "",
- courseProperty: {},
- firstProperty: {},
- secondProperty: {},
- };
- if (
- this.quesModel.quesProperties == null ||
- this.quesModel.quesProperties.length == 0
- ) {
- this.quesModel.quesProperties = [];
- }
- if (this.secondPropertyId) {
- quesProperty.id =
- this.coursePropertyId +
- "-" +
- this.firstPropertyId +
- "-" +
- this.secondPropertyId;
- } else {
- quesProperty.id = this.coursePropertyId + "-" + this.firstPropertyId;
- }
- for (let quesPro of this.quesModel.quesProperties) {
- if (quesPro.id == quesProperty.id) {
- this.$notify({
- message: "该属性已存在,请重新选择",
- type: "error",
- });
- return false;
- }
- }
- for (let courseProperty of this.coursePropertyList) {
- if (courseProperty.id == this.coursePropertyId) {
- quesProperty.courseProperty = courseProperty;
- }
- }
- //取到一级属性对象
- for (let property of this.firstPropertyList) {
- if (property.id == this.firstPropertyId) {
- quesProperty.firstProperty = property;
- }
- }
- //判断是否有二级属性
- if (
- this.secondPropertyList != undefined &&
- this.secondPropertyList.length > 0
- ) {
- if (!this.secondPropertyId) {
- this.$notify({
- message: "请选择二级属性",
- type: "error",
- });
- return false;
- }
- }
- //取到二级属性对象
- for (let property of this.secondPropertyList) {
- if (property.id == this.secondPropertyId) {
- quesProperty.secondProperty = property;
- }
- }
- this.quesModel.quesProperties.push(quesProperty);
- this.quesModel = Object.assign({}, this.quesModel);
- //清空下拉框
- this.coursePropertyId = "";
- this.firstPropertyId = "";
- this.secondPropertyId = "";
- this.firstPropertyList = [];
- this.secondPropertyList = [];
- },
- //新增属性验证
- checkInsertPro() {
- if (!this.coursePropertyId) {
- this.$notify({
- message: "请选择属性",
- type: "error",
- });
- return false;
- }
- if (!this.firstPropertyId) {
- this.$notify({
- message: "请选择一级属性",
- type: "error",
- });
- return false;
- }
- return true;
- },
- //删除选项
- removeQuesOption(option) {
- if (this.quesModel.quesOptions.length == 1) {
- this.$notify({
- message: "不能删除最后一个选项",
- type: "error",
- });
- return;
- }
- this.singleRightAnswer = "";
- this.multipleRightAnswer = [];
- let index = this.quesModel.quesOptions.indexOf(option);
- if (index !== -1) {
- this.quesModel.quesOptions.splice(index, 1);
- }
- if (this.quesModel.quesOptions.length > 0) {
- for (var i = 0; i < this.quesModel.quesOptions.length; i++) {
- var quesOption = this.quesModel.quesOptions[i];
- quesOption["number"] = i + 1;
- if (quesOption.isCorrect == 1) {
- var answerOrderNum = String.fromCharCode(65 + i);
- if (this.quesModel.questionType == "SINGLE_ANSWER_QUESTION") {
- this.singleRightAnswer = answerOrderNum;
- }
- if (this.quesModel.questionType == "MULTIPLE_ANSWER_QUESTION") {
- this.multipleRightAnswer.push(answerOrderNum);
- }
- }
- }
- }
- },
- //新增选项
- addQuesOption() {
- this.quesModel.quesOptions.push({
- number: "",
- optionBody: "",
- isCorrect: "",
- });
- for (var i = 0; i < this.quesModel.quesOptions.length; i++) {
- this.quesModel.quesOptions[i]["number"] = i + 1;
- }
- },
- savePaperDetailUnit() {
- //跟新难度值
- if (this.quesModel.difficultyDegree < 0.4) {
- this.quesModel.difficulty = "难";
- } else if (
- this.quesModel.difficultyDegree > 0.3 &&
- this.quesModel.difficultyDegree < 0.8
- ) {
- this.quesModel.difficulty = "中";
- } else {
- this.quesModel.difficulty = "易";
- }
- this.setRightAnswer();
- if (/^\d+(?=\.{0,1}\d+$|$)/.test(this.quesModel.score)) {
- console.log("正确");
- } else {
- this.$notify({
- message: "分数只能为正数",
- type: "error",
- });
- return;
- }
- if (this.paper.paperType == "GENERATE") {
- this.$confirm(
- "试题内容修改,会影响所有关联试卷,是否确定进行?",
- "提示",
- {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning",
- }
- ).then(() => {
- this.submitPaperDetailUnit();
- });
- } else {
- this.submitPaperDetailUnit();
- }
- },
- submitPaperDetailUnit() {
- let paperDetailUnitExp = {
- id: this.editPaperDetailUnit.id,
- question: this.quesModel,
- score: this.quesModel.score,
- };
- if (
- this.quesModel.quesOptions &&
- this.quesModel.quesOptions.length == 0
- ) {
- this.$confirm("无选项将删除该试题, 是否继续?", "提示", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning",
- }).then(() => {
- this.dialogLoading = true;
- this.$http
- .delete(
- QUESTION_API +
- "/paper/deleteQuestion/" +
- this.editPaperDetailUnit.id +
- "/" +
- this.quesModel.id
- )
- .then((response) => {
- if (response.data.length > 0) {
- var deleteInfo =
- "该试题被试卷:" +
- response.data.join(" , ") +
- "使用,不能删除";
- this.$notify({
- message: deleteInfo,
- type: "error",
- });
- } else {
- this.$notify({
- message: "保存成功",
- type: "success",
- });
- }
- this.dialogLoading = false;
- });
- });
- } else {
- this.dialogLoading = true;
- //校验音频重复
- let audiomap = new Map();
- let regex = new RegExp(
- '<a id="[^<>]+" name="([^<>]+\\.mp3)"></a>',
- "ig"
- );
- let ret = "";
- let quesBodyStr = paperDetailUnitExp.question.quesBody;
- if (quesBodyStr) {
- while ((ret = regex.exec(quesBodyStr))) {
- if (audiomap.get(ret[1])) {
- this.dialogLoading = false;
- this.$notify({
- type: "error",
- message: "题干中存在相同的音频文件",
- });
- return;
- } else {
- audiomap.set(ret[1], ret[1]);
- }
- }
- }
- let quesAnswerStr = paperDetailUnitExp.question.quesAnswer;
- if (quesAnswerStr) {
- while ((ret = regex.exec(quesAnswerStr))) {
- if (audiomap.get(ret[1])) {
- this.dialogLoading = false;
- this.$notify({
- type: "error",
- message: "答案中存在相同的音频文件",
- });
- return;
- } else {
- audiomap.set(ret[1], ret[1]);
- }
- }
- }
- let quesOptions = paperDetailUnitExp.question.quesOptions;
- if (quesOptions) {
- for (let i = 0; i < quesOptions.length; i++) {
- let quesOptionStr = quesOptions[i].optionBody;
- while ((ret = regex.exec(quesOptionStr))) {
- if (audiomap.get(ret[1])) {
- this.dialogLoading = false;
- this.$notify({
- type: "error",
- message: "选项中存在相同的音频文件",
- });
- return;
- } else {
- audiomap.set(ret[1], ret[1]);
- }
- }
- }
- }
- paperDetailUnitExp.question.quesAnswer = this.answer;
- this.$http
- .put(QUESTION_API + "/paperDetailUnit", paperDetailUnitExp)
- .then(() => {
- this.$notify({
- message: "保存成功",
- type: "success",
- });
- this.dialogLoading = false;
- this.closeQuesDialog();
- this.initPaper();
- })
- .catch((err) => {
- this.dialogLoading = false;
- this.$notify({
- type: "error",
- message: err.response.data.desc,
- });
- });
- }
- },
- //在正确的option上设置isCorrect=1
- setRightAnswer() {
- if (
- !this.quesModel.quesOptions ||
- this.quesModel.quesOptions.length == 0
- ) {
- return false;
- }
- for (var i = 0; i < this.quesModel.quesOptions.length; i++) {
- var option = this.quesModel.quesOptions[i];
- var answerOrderNum = String.fromCharCode(65 + i);
- if (this.quesModel.questionType == "SINGLE_ANSWER_QUESTION") {
- option["isCorrect"] =
- answerOrderNum == this.singleRightAnswer ? 1 : 0;
- }
- if (this.quesModel.questionType == "MULTIPLE_ANSWER_QUESTION") {
- option["isCorrect"] =
- this.multipleRightAnswer.indexOf(answerOrderNum) > -1 ? 1 : 0;
- }
- }
- },
- //删除试题
- deleteQues(paperDetailUnit) {
- let paperDetailUnitId = paperDetailUnit.id;
- if (this.paper.paperType == "GENERATE") {
- this.deleteQues01(paperDetailUnitId);
- } else {
- let questionId = paperDetailUnit.question.id;
- this.deleteQues02(questionId, paperDetailUnitId);
- }
- },
- deleteQues01(paperDetailUnitId) {
- this.$alert("您确定删除吗?", "提示", {
- confirmButtonText: "确定",
- callback: (action) => {
- if (action == "confirm") {
- this.loading = true;
- this.$http
- .delete(QUESTION_API + "/paperDetailUnit/" + paperDetailUnitId)
- .then(() => {
- this.initPaper();
- this.reduplicateGroup = [];
- this.loading = true;
- this.$notify({
- message: "删除成功",
- type: "success",
- });
- this.loading = false;
- });
- }
- },
- });
- },
- deleteQues02(questionId, paperDetailUnitId) {
- this.$alert("您确定删除吗?", "提示", {
- confirmButtonText: "确定",
- callback: (action) => {
- if (action == "confirm") {
- this.loading = true;
- this.$http
- .delete(
- QUESTION_API +
- "/paper/deleteQuestion/" +
- paperDetailUnitId +
- "/" +
- questionId
- )
- .then((response) => {
- if (response.data.length > 0) {
- var deleteInfo =
- "该试题被试卷:" +
- response.data.join(" , ") +
- "使用,不能删除";
- this.$notify({
- message: deleteInfo,
- type: "error",
- });
- } else {
- this.initPaper();
- this.reduplicateGroup = [];
- this.loading = true;
- this.$notify({
- message: "保存成功",
- type: "success",
- });
- }
- this.loading = false;
- });
- }
- },
- });
- },
- exportPaperAnswer() {
- var key = this.user.key;
- var token = this.user.token;
- window.open(
- QUESTION_API +
- "/paper/answer/export/" +
- this.paperId +
- "?$key=" +
- key +
- "&$token=" +
- token
- );
- },
- getSubQuesEditId(paperDetailUnit, subQuestion) {
- return paperDetailUnit.question.id + "_" + subQuestion.subNumber;
- },
- //打开考试说明编辑框
- openEditExamPaperRemark() {
- if (this.paper.examRemark) {
- this.examRemark = this.paper.examRemark;
- } else {
- this.examRemark = "";
- }
- this.paperRemarkDialog = true;
- },
- //保存考试说明
- savePaperRemark() {
- this.paper.examRemark = this.examRemark;
- this.savePaper();
- this.paperRemarkDialog = false;
- },
- //关闭考试说明编辑框
- closPaperRemark() {
- this.examRemark = "";
- this.paperRemarkDialog = false;
- },
- //保存试卷
- savePaper() {
- this.loading = true;
- this.$http
- .put(QUESTION_API + "/paper", this.paper)
- .then(() => {
- this.$notify({
- message: "保存成功",
- type: "success",
- });
- this.loading = false;
- this.initPaper();
- })
- .catch((error) => {
- this.loading = false;
- this.$notify({
- type: "error",
- message: error.response.data.desc,
- });
- });
- },
- //删除试卷
- deletePaper() {
- this.$confirm("确认删除试卷吗?", "提示", {
- type: "warning",
- }).then(() => {
- this.loading = true;
- this.selectedPaperIds = [];
- this.selectedPaperIds.push(this.paper.id);
- this.$http
- .post(
- QUESTION_API + "/paper/audit/delete",
- new URLSearchParams({ paperIds: this.selectedPaperIds })
- )
- .then(
- () => {
- this.$notify({
- message: "删除成功",
- type: "success",
- });
- this.back();
- },
- (error) => {
- this.$notify({
- message: error.response.data.desc,
- type: "error",
- });
- this.loading = false;
- }
- );
- });
- },
- //打开上传音频弹框
- openDialog() {
- this.checkResult = false;
- this.isUpload = true;
- if (document.getElementById("radioFile")) {
- document.getElementById("radioFile").value = "";
- }
- this.dialogRadioFile = true;
- this.fileList = [];
- },
- //关闭音频弹框
- closeAudioDialog() {
- this.dialogRadioFile = this.uploadAudioLoading;
- },
- //返回
- back() {
- if (sessionStorage.getItem("question_back") == "true") {
- this.$router.push({
- path: "/questions/" + this.parentView + "/0",
- });
- } else {
- this.$router.push({
- path: "/questions/" + this.parentView + "/1",
- });
- }
- },
- paperDetailShow(paperDetail) {
- if (this.reduplicateGroup.length == 0) {
- return true;
- }
- let paperDetailUnits = paperDetail.paperDetailUnits;
- for (let i = 0, imax = paperDetailUnits.length; i < imax; i++) {
- for (var j = 0, jmax = this.reduplicateGroup.length; j < jmax; j++) {
- if (paperDetailUnits[i].id == this.reduplicateGroup[j]) {
- return true;
- }
- }
- }
- return false;
- },
- //上传文件检查
- checkFile() {
- this.fileNameList = [];
- //读取选取的文件夹里面的文件
- this.checkResult = true;
- var files = document.getElementById("radioFile").files;
- if (files.length == 0) {
- this.message = "请选择音频文件夹!";
- return;
- }
- var size = 0;
- var isGo = false;
- //取到所有文件的文件名
- for (var i = 0; i < files.length; i++) {
- this.fileNameList.push(files[i].name);
- if (files[i].size > 5 * 1024 * 1024) {
- isGo = true;
- break;
- }
- size = files[i].size + size;
- }
- if (isGo) {
- this.message = "上传单个文件不能超过5M";
- this.isUpload = true;
- }
- if (size > 50 * 1024 * 1024) {
- this.message = "上传文件总和不能超过50M";
- this.isUpload = true;
- return;
- }
- this.$http
- .post(
- QUESTION_API + "/checkRadioFile/" + this.paperId,
- this.fileNameList
- )
- .then((response) => {
- console.log("response:", response);
- this.message = response.data.errorMsg;
- if (this.message == "OK") {
- this.message = "OK!";
- this.isUpload = false;
- } else {
- this.isUpload = true;
- }
- })
- .catch((error) => {
- console.log(error);
- });
- },
- //读取文件
- uploadAudioFile() {
- let param = new FormData();
- var fileList = document.getElementById("radioFile").files;
- //循环添加到formData中
- for (var i = 0; i < fileList.length; i++) {
- var file = fileList[i];
- param.append("files", file, file.name);
- }
- let config = {
- headers: { "Content-Type": "multipart/form-data" },
- };
- this.$http
- .post(QUESTION_API + "/uploadRadio/" + this.paperId, param, config)
- .then(() => {
- this.dialogRadioFile = false;
- this.uploadAudioLoading = false;
- this.checkResult = false;
- this.isUpload = true;
- document.getElementById("radioFile").value = "";
- this.initPaper();
- })
- .catch((error) => {
- this.message = error.response.data.desc;
- this.uploadAudioLoading = false;
- });
- },
- },
- };
- </script>
|