123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199 |
- <!-- -->
- <template>
- <div v-loading="loading" class="Big-Book-container adult-book-input-sty">
- <Header />
- <div class="Big-Book-content">
- <div class="content-tree">
- <Catelog
- :book-id="bookId"
- :book-level="bookLevel"
- :book-node-index="bookIndex"
- :change-id="changeId"
- :change-tree-data="changeTreeData"
- :current-tree-i-d="currentTreeID"
- :emptyQustion="emptyQustion"
- />
- </div>
- <div v-if="currentTreeID" class="Book-content">
- <div class="Big-Book-save Big-Book-input-save">
- <el-button type="primary" @click="onSave">保 存</el-button>
- <el-button type="danger" plain @click="onPreview">预 览</el-button>
- </div>
- <!-- <el-tabs
- v-model="editableTabsValue"
- type="card"
- editable
- @edit="handleTabsEdit"
- @tab-click="tabClick"
- >
- <el-tab-pane
- v-for="(item, index) in question_list"
- :key="item.name"
- :label="item.title"
- :name="item.name"
- > -->
- <div
- v-for="(fc, fcIndex) in question_list.detailList"
- :key="'fc' + fcIndex"
- style="
- position: relative;
- margin-bottom: 20px;
- padding-bottom: 10px;
- border-bottom: 1px dotted #ccc;
- "
- >
- <SentenceSegwordChs :cur-que="fc.detail" type="adultinput" />
- <img
- style="position: absolute; right: 20px; top: 2px"
- class="close"
- src="../assets/adult/del-close.png"
- alt=""
- @click="deleteDetail(fcIndex)"
- />
- <div class="Big-Book-top" style="margin: 10px 0">
- <span>英文</span>
- <el-input
- v-model="fc.en"
- style="width: 80%"
- type="textarea"
- autosize
- placeholder="请输入英文"
- maxlength="200"
- show-word-limit
- @blur="onBlur(fc, 'en')"
- />
- </div>
- </div>
- <div class="addoption" @click="addDetail">添加分句</div>
- <div
- v-for="(kt, ktIndex) in question_list.classTopic"
- :key="'kt' + ktIndex"
- style="
- position: relative;
- margin-bottom: 20px;
- padding-bottom: 10px;
- border-bottom: 1px dotted #ccc;
- "
- >
- <div class="Big-Book-top" style="margin: 10px 0">
- <span>课题</span>
- <el-input
- v-model="kt.con"
- style="width: 80%"
- type="textarea"
- autosize
- placeholder="请输入课题"
- maxlength="200"
- show-word-limit
- @blur="onBlur(kt, 'con')"
- />
- <img
- style="position: absolute; right: 20px; top: 2px"
- class="close"
- src="../assets/adult/del-close.png"
- alt=""
- @click="deleteClassTopic(ktIndex)"
- />
- </div>
- <div class="Big-Book-top" style="margin: 10px 0">
- <span>字体</span>
- <el-radio-group v-model="kt.font">
- <el-radio label="cn">中文字体</el-radio>
- <el-radio label="en">英文字体</el-radio>
- <el-radio label="pinyin">拼音字体</el-radio>
- </el-radio-group>
- </div>
- </div>
- <div class="addoption" @click="addClassTopic">添加课题</div>
- <div class="createTable">
- <el-input
- v-model="row"
- maxlength="2"
- style="width: 50px"
- type="text"
- @input="rowLine('row')"
- />*<el-input
- v-model="line"
- style="width: 50px"
- type="text"
- maxlength="2"
- @input="rowLine('line')"
- />
- <el-button
- style="margin-left: 10px"
- type="primary"
- @click="createTable"
- >增加题</el-button
- >
- </div>
- <div
- v-for="(topic, toindex) in question_list.cur_fn_data"
- :key="'topic' + toindex"
- >
- <div class="topTitle">
- <div style="display: flex; align-items: center">
- <p>第{{ toindex + 1 }}题</p>
- <el-checkbox
- v-model="groupIndexList"
- :label="toindex"
- style="margin: 0 10px"
- ><br /></el-checkbox
- ><span>{{ topic.group_name }}</span>
- <el-button size="small" @click="deleteElement(toindex)"
- >删除</el-button
- >
- <el-button
- type="primary"
- size="small"
- icon="el-icon-top"
- @click="moveElement(topic, toindex, 'up')"
- >上移</el-button
- >
- <el-button
- type="primary"
- size="small"
- icon="el-icon-bottom"
- @click="moveElement(topic, toindex, 'down')"
- >下移</el-button
- >
- </div>
- <span @click="handleChangeTab(topic)">
- {{ topic.contentShow ? "收起" : "展开" }}
- <img
- v-if="topic.contentShow"
- src="../assets/NPC/down-black.png"
- alt=""
- />
- <img v-else src="../assets/NPC/up-black.png" alt="" />
- </span>
- </div>
- <el-collapse-transition>
- <div v-show="topic.contentShow" class="collapse-box">
- <div class="adult-book-input-item">
- <span class="adult-book-lable">序号:</span>
- <el-input
- v-model="topic.number"
- type="textarea"
- :autosize="{ minRows: 2 }"
- placeholder="请输入序号"
- maxlength="200"
- show-word-limit
- @blur="onBlur(topic, 'number')"
- />
- </div>
- <div class="adult-book-input-item">
- <span class="adult-book-lable">正标题:</span>
- <el-input
- v-model="topic.z_title"
- type="textarea"
- :autosize="{ minRows: 2 }"
- placeholder="请输入正标题"
- maxlength="500"
- show-word-limit
- @blur="onBlur(topic, 'z_title')"
- />
- </div>
- <div class="adult-book-input-item">
- <span class="adult-book-lable">副标题:</span>
- <el-input
- v-model="topic.f_title"
- :autosize="{ minRows: 2 }"
- type="textarea"
- placeholder="请输入副标题"
- maxlength="500"
- show-word-limit
- @blur="onBlur(topic, 'f_title')"
- />
- </div>
- <div class="adult-book-input-item">
- <span class="adult-book-lable">标题:</span>
- <div style="width: 100%">
- <div
- style="
- display: flex;
- align-items: flex-start;
- margin-bottom: 10px;
- "
- >
- <el-input
- v-model="topic.little_title_number"
- style="width: 20%"
- type="textarea"
- placeholder="请输入标题题号"
- maxlength="200"
- show-word-limit
- @input="forupdata"
- @blur="onBlur(topic, 'little_title_number')"
- />
- <el-input
- v-model="topic.little_title"
- style="width: 70%; margin-left: 10px"
- type="textarea"
- placeholder="请输入标题内容"
- maxlength="500"
- show-word-limit
- @input="forupdata"
- @blur="onBlur(topic, 'little_title')"
- />
- </div>
- </div>
- </div>
- <div class="Big-Book-top">
- <span>正副标题缩进</span>
- <el-radio v-model="topic.is_textIndex" :label="true"
- >是</el-radio
- >
- <el-radio v-model="topic.is_textIndex" :label="false"
- >否</el-radio
- >
- </div>
- <div class="Big-Book-top">
- <span>是否有背景色</span>
- <el-radio v-model="topic.is_bg" :label="true">有</el-radio>
- <el-radio v-model="topic.is_bg" :label="false">无</el-radio>
- </div>
- <div class="Big-Book-top">
- <span>是否有背景图</span>
- <el-radio v-model="topic.is_layout" :label="true">有</el-radio>
- <el-radio v-model="topic.is_layout" :label="false">无</el-radio>
- </div>
- <div
- v-for="(rowItem, rowIndex) in topic.table_list"
- :key="'row' + rowIndex"
- >
- <div
- v-for="(topicIitem, lineIndex) in rowItem"
- :key="lineIndex"
- :style="{ 'border-bottom': '2px #999 dotted' }"
- >
- <p>{{ topicIitem.text }}</p>
- <div>
- <template
- v-if="
- topicIitem.type == 'article_chs' ||
- (topicIitem.data &&
- topicIitem.data.type == 'article_chs')
- "
- >
- <template v-if="topicIitem.is_edit">
- <ArticleTemChs
- :cur-que="topicIitem.data"
- :change-cur-que="changeCurQue"
- v-if="refresh"
- />
- </template>
- <template v-else>
- <!-- <ArticleView :cur-que="topicIitem.data" /> -->
- </template>
- </template>
- <template v-if="topicIitem.type == 'sentence_segword_chs'">
- <template v-if="topicIitem.is_edit">
- <SentenceSegwordChs
- :cur-que="topicIitem.data"
- :change-cur-que="changeCurQue"
- v-if="refresh"
- />
- </template>
- <template v-else>
- <!-- <ArticleView :cur-que="topicIitem.data" /> -->
- </template>
- </template>
- <template v-if="topicIitem.type == 'dialogue_article_chs'">
- <template v-if="topicIitem.is_edit">
- <DialogueArticleChs
- :cur-que="topicIitem.data"
- :change-cur-que="changeCurQue"
- v-if="refresh"
- />
- </template>
- <template v-else>
- <!-- <ArticleView :curQue="topicIitem.que" /> -->
- </template>
- </template>
- <template v-if="topicIitem.type == 'dialogue_answer_chs'">
- <template v-if="topicIitem.is_edit">
- <DialogueAnswerChs
- :cur-que="topicIitem.data"
- :change-cur-que="changeCurQue"
- v-if="refresh"
- />
- </template>
- <template v-else>
- <!-- <ArticleView :curQue="topicIitem.que" /> -->
- </template>
- </template>
- <template v-if="topicIitem.type == 'NewWord_chs'">
- <template v-if="topicIitem.is_edit">
- <Neword
- :cur-que="topicIitem.data"
- :change-cur-que="changeCurQue"
- v-if="refresh"
- />
- </template>
- <template v-else>
- <NewordPhraseview :cur-que="topicIitem.data" />
- </template>
- </template>
- <template v-if="topicIitem.type == 'notes_chs'">
- <template v-if="topicIitem.is_edit">
- <Notes
- :cur-que="topicIitem.data"
- :change-cur-que="changeCurQue"
- v-if="refresh"
- />
- </template>
- <template v-else>
- <NewordPhraseview :cur-que="topicIitem.data" />
- </template>
- </template>
- <template v-if="topicIitem.type == 'input_record_chs'">
- <template v-if="topicIitem.is_edit">
- <InputRecord
- :cur-que="topicIitem.data"
- :fn_data="fn_data"
- :change-cur-que="changeCurQue"
- v-if="refresh"
- />
- </template>
- <template v-else />
- </template>
- <template
- v-if="
- topicIitem.type == 'recordHZ_inputPY_chs' ||
- topicIitem.type == 'inputItem_chs' ||
- topicIitem.type == 'sentence_input_chs' ||
- topicIitem.type == 'sentence_judge_chs' ||
- topicIitem.type == 'sentence_record_chs' ||
- topicIitem.type == 'sentence_input_record_chs' ||
- topicIitem.type == 'sentence_listen_read_chs'
- "
- >
- <template v-if="topicIitem.is_edit">
- <Sentence
- :cur-que="topicIitem.data"
- :type="topicIitem.type"
- :fn_data="fn_data"
- :change-cur-que="changeCurQue"
- v-if="refresh"
- />
- </template>
- <template v-else />
- </template>
- <template v-if="topicIitem.type == 'sudoku_chs'">
- <template v-if="topicIitem.is_edit">
- <Sudoku
- :cur-que="topicIitem.data"
- :type="topicIitem.type"
- :fn_data="fn_data"
- :change-cur-que="changeCurQue"
- v-if="refresh"
- />
- </template>
- <template v-else />
- </template>
- <template v-if="topicIitem.type == 'NumberCombination_chs'">
- <template v-if="topicIitem.is_edit">
- <NumberCombination
- :cur-que="topicIitem.data"
- :type="topicIitem.type"
- :fn_data="fn_data"
- :change-cur-que="changeCurQue"
- v-if="refresh"
- />
- </template>
- <template v-else />
- </template>
- <template v-if="topicIitem.type == 'toneSelect_chs'">
- <template v-if="topicIitem.is_edit">
- <ToneSelect
- :cur-que="topicIitem.data"
- :type="topicIitem.type"
- :fn_data="fn_data"
- :change-cur-que="changeCurQue"
- v-if="refresh"
- />
- </template>
- <template v-else />
- </template>
- <template v-if="topicIitem.type === 'voice_matrix'">
- <template v-if="topicIitem.is_edit">
- <voice-matrix
- :cur-que="topicIitem.data"
- :change-cur-que="changeCurQue"
- v-if="refresh"
- />
- </template>
- </template>
- <template v-if="topicIitem.type === 'select_drag'">
- <select-drag
- :cur-que="topicIitem.data"
- :change-cur-que="changeCurQue"
- v-if="refresh"
- />
- </template>
- <template v-if="topicIitem.type === 'config_table'">
- <configurable-table
- :cur-que="topicIitem.data"
- :change-cur-que="changeCurQue"
- />
- </template>
- <template v-if="topicIitem.type === 'header_separate'">
- <header-separate
- :cur-que="topicIitem.data"
- :change-cur-que="changeCurQue"
- v-if="refresh"
- />
- </template>
- <template v-if="topicIitem.type === 'fill_drag'">
- <fill-drag
- :cur-que="topicIitem.data"
- :change-cur-que="changeCurQue"
- v-if="refresh"
- />
- </template>
- <template v-if="topicIitem.type == 'ligature_chs'">
- <template v-if="topicIitem.is_edit">
- <Ligature
- :cur-que="topicIitem.data"
- :fn_data="fn_data"
- :change-cur-que="changeCurQue"
- :type="topicIitem.type"
- v-if="refresh"
- />
- </template>
- <template v-else>
- <Ligatureview :cur-que="topicIitem.data" />
- </template>
- </template>
- <template
- v-if="topicIitem.type == 'image_question_input_record'"
- >
- <template v-if="topicIitem.is_edit">
- <ImageQuestion
- :cur-que="topicIitem.data"
- :type="topicIitem.type"
- :fn_data="fn_data"
- :change-cur-que="changeCurQue"
- v-if="refresh"
- />
- </template>
- <template v-else />
- </template>
- <template
- v-if="
- topicIitem.type == 'single_chs' ||
- topicIitem.type == 'checkbox_chs' ||
- topicIitem.type == 'listen_record_single_chs'
- "
- >
- <template v-if="topicIitem.is_edit">
- <Single
- :cur-que="topicIitem.data"
- :type="topicIitem.type"
- :fn_data="fn_data"
- :change-cur-que="changeCurQue"
- v-if="refresh"
- />
- </template>
- <template v-else />
- </template>
- <template
- v-if="
- topicIitem.type == 'text_problem_chs' ||
- topicIitem.type == 'newWord_preview_chs' ||
- topicIitem.type == 'listen_record_single_syllable_chs'
- "
- >
- <template v-if="topicIitem.is_edit">
- <PurePreview
- :cur-que="topicIitem.data"
- :type="topicIitem.type"
- :fn_data="fn_data"
- :change-cur-que="changeCurQue"
- v-if="refresh"
- />
- </template>
- <template v-else />
- </template>
- <template
- v-if="topicIitem.type == 'zi_transverse_line_chs'"
- >
- <template v-if="topicIitem.is_edit">
- <ZiLine
- :cur-que="topicIitem.data"
- :type="topicIitem.type"
- :fn_data="fn_data"
- :change-cur-que="changeCurQue"
- v-if="refresh"
- />
- </template>
- <template v-else />
- </template>
- <template v-if="topicIitem.type == 'select_input_chs'">
- <template v-if="topicIitem.is_edit">
- <SelectInpue
- :cur-que="topicIitem.data"
- :type="topicIitem.type"
- :fn_data="fn_data"
- :change-cur-que="changeCurQue"
- v-if="refresh"
- />
- </template>
- <template v-else />
- </template>
- <template v-if="topicIitem.type == 'play_input_record_chs'">
- <template v-if="topicIitem.is_edit">
- <PlayInputReacord
- :cur-que="topicIitem.data"
- :type="topicIitem.type"
- :fn_data="fn_data"
- :change-cur-que="changeCurQue"
- v-if="refresh"
- />
- </template>
- <template v-else />
- </template>
- <template
- v-if="
- topicIitem.type == 'imgage_image' ||
- topicIitem.type == 'image_checkBox' ||
- topicIitem.type == 'image_judge' ||
- topicIitem.type == 'image_single' ||
- topicIitem.type == 'image_dobleinput' ||
- topicIitem.type == 'image_gdcy' ||
- topicIitem.type == 'image_input'
- "
- >
- <template v-if="topicIitem.is_edit">
- <Picture
- :cur-que="topicIitem.data"
- :type="topicIitem.type"
- :fn_data="fn_data"
- :change-cur-que="changeCurQue"
- v-if="refresh"
- />
- </template>
- <template v-else />
- </template>
- <!-- <template v-if="topicIitem.type == 'drag_chs'">
- <template v-if="topicIitem.is_edit">
- <Drag
- :curQue="topicIitem.data"
- :type="topicIitem.type"
- :fn_data="fn_data"
- :changeCurQue="changeCurQue"
- />
- </template>
- <template v-else> </template>
- </template> -->
- <template
- v-if="topicIitem.type == 'checkbox_self_assessment_chs'"
- >
- <template v-if="topicIitem.is_edit">
- <SelfAssessment
- :cur-que="topicIitem.data"
- :type="topicIitem.type"
- :fn_data="fn_data"
- :change-cur-que="changeCurQue"
- v-if="refresh"
- />
- </template>
- <template v-else />
- </template>
- <template v-if="topicIitem.type == 'sort_chs'">
- <template v-if="topicIitem.is_edit">
- <Sort
- :cur-que="topicIitem.data"
- :type="topicIitem.type"
- :fn_data="fn_data"
- :change-cur-que="changeCurQue"
- v-if="refresh"
- />
- </template>
- <template v-else>
- <SentenceSortQP
- :cur-que="topicIitem.data"
- :type="topicIitem.type"
- :fn_data="fn_data"
- />
- </template>
- </template>
- <template v-if="topicIitem.type == 'CourseStart_chs'">
- <template v-if="topicIitem.is_edit">
- <CourseStart
- :cur-que="topicIitem.data"
- :type="topicIitem.type"
- :fn_data="fn_data"
- :change-cur-que="changeCurQue"
- v-if="refresh"
- />
- </template>
- <template v-else />
- </template>
- <template
- v-if="
- topicIitem.type == 'record_control_mini' ||
- topicIitem.type == 'record_control_normal' ||
- topicIitem.type == 'record_control_pro' ||
- topicIitem.type == 'record_control_promax'
- "
- >
- <template v-if="topicIitem.is_edit">
- <RecordControl
- :cur-que="topicIitem.data"
- :type="topicIitem.type"
- :fn_data="fn_data"
- :change-cur-que="changeCurQue"
- v-if="refresh"
- />
- </template>
- <template v-else />
- </template>
- <template
- v-if="
- topicIitem.type == 'upload_control_chs' ||
- topicIitem.type == 'upload_control_preview_chs'
- "
- >
- <template v-if="topicIitem.is_edit">
- <UploadControl
- :cur-que="topicIitem.data"
- :type="topicIitem.type"
- :fn_data="fn_data"
- :change-cur-que="changeCurQue"
- v-if="refresh"
- />
- </template>
- <template v-else>
- <UploadControlView
- :type="topicIitem.type"
- :cur-que="topicIitem.data"
- :fn_data="fn_data"
- />
- </template>
- </template>
- <template v-if="topicIitem.type == 'tinydemo_chs'">
- <template v-if="topicIitem.is_edit">
- <Tinydemo
- :cur-que="topicIitem.data"
- :type="topicIitem.type"
- :fn_data="fn_data"
- :change-cur-que="changeCurQue"
- :number="
- currentTreeID + toindex + rowIndex + lineIndex
- "
- v-if="refresh"
- />
- </template>
- <template v-else />
- </template>
- <template v-if="topicIitem.type == 'switch_control_chs'">
- <template v-if="topicIitem.is_edit">
- <SuitchControl
- :cur-que="topicIitem.data"
- :type="topicIitem.type"
- :fn_data="fn_data"
- :change-cur-que="changeCurQue"
- v-if="refresh"
- />
- </template>
- <template v-else />
- </template>
- <template v-if="topicIitem.type == 'video_chs'">
- <template v-if="topicIitem.is_edit">
- <VideoControl
- :cur-que="topicIitem.data"
- :type="topicIitem.type"
- :fn_data="fn_data"
- :change-cur-que="changeCurQue"
- v-if="refresh"
- />
- </template>
- <template v-else>
- <!-- <VideoControlView
- :curQue="topicIitem.data"
- :type="topicIitem.type"
- :fn_data="fn_data"
- /> -->
- </template>
- </template>
- <template v-if="topicIitem.type == 'table_chs'">
- <template v-if="topicIitem.is_edit">
- <Table
- :cur-que="topicIitem.data"
- :type="topicIitem.type"
- :fn_data="fn_data"
- :change-cur-que="changeCurQue"
- v-if="refresh"
- />
- </template>
- <template v-else>
- <TableView
- :cur-que="topicIitem.data"
- :type="topicIitem.type"
- :fn_data="fn_data"
- />
- </template>
- </template>
- <template v-if="topicIitem.type == 'play_record_chs'">
- <template v-if="topicIitem.is_edit">
- <PlayRecord
- :cur-que="topicIitem.data"
- :type="topicIitem.type"
- :fn_data="fn_data"
- :change-cur-que="changeCurQue"
- v-if="refresh"
- />
- </template>
- <template v-else>
- <PlayRecordView
- :cur-que="topicIitem.data"
- :type="topicIitem.type"
- :fn_data="fn_data"
- />
- </template>
- </template>
- <template v-if="topicIitem.type == 'upload_pdf_chs'">
- <template v-if="topicIitem.is_edit">
- <UploadPdf
- :cur-que="topicIitem.data"
- :type="topicIitem.type"
- :fn_data="fn_data"
- :change-cur-que="changeCurQue"
- v-if="refresh"
- />
- </template>
- <template v-else />
- </template>
- <template v-if="topicIitem.type == 'sentence_segtemp_chs'">
- <template v-if="topicIitem.is_edit">
- <SentenceModule
- :curQue="topicIitem.data"
- :type="topicIitem.type"
- :changeCurQue="changeCurQue"
- v-if="refresh"
- />
- </template>
- <template v-else> </template>
- </template>
- <template v-if="topicIitem.type == 'options_list_chs'">
- <template v-if="topicIitem.is_edit">
- <OptionsList
- :curQue="topicIitem.data"
- :type="topicIitem.type"
- :changeCurQue="changeCurQue"
- v-if="refresh"
- />
- </template>
- <template v-else> </template>
- </template>
- </div>
- <div
- v-if="topicIitem.data && topicIitem.is_edit"
- class="addoption"
- @click="
- remoeModule(toindex, rowIndex, lineIndex, topicIitem)
- "
- >
- 删除模板 <br />{{
- topicIitem.data.name + "( " + topicIitem.type + " )"
- }}
- </div>
- <div
- v-else-if="
- TopicIndex == toindex &&
- RowIndex == rowIndex &&
- lineIndex == LineIndex
- "
- class="addoption"
- >
- 选择模板
- </div>
- <div
- v-if="!topicIitem.data && topicIitem.is_add_module"
- class="addoption"
- @click="addModule(toindex, rowIndex, lineIndex, topicIitem)"
- >
- 添加模板
- </div>
- <template v-if="topicIitem.data">
- <div v-if="topicIitem.is_edit" class="Big-Book-save">
- <el-button
- type="success"
- size="small"
- @click="onSure(topicIitem)"
- >确定</el-button
- >
- </div>
- <div v-else class="Big-Book-save">
- <el-button
- type="primary"
- size="small"
- @click.stop="editCurQue(topicIitem)"
- >编辑</el-button
- >
- </div>
- </template>
- </div>
- <div style="display: flex">
- <div class="addoption" @click="removeRow(rowIndex, toindex)">
- 删除当前行
- </div>
- <div
- style="margin-left: 10px"
- class="addoption"
- @click="addRow('front', rowIndex, toindex)"
- >
- 在当前行前增加行
- </div>
- <div
- style="margin-left: 10px"
- class="addoption"
- @click="addRow('behind', rowIndex, toindex)"
- >
- 在当前行后增加行
- </div>
- </div>
- </div>
- </div>
- </el-collapse-transition>
- </div>
- <!-- </el-tab-pane> -->
- <!-- </el-tabs> -->
- </div>
- <div v-if="currentTreeID" class="Book-function">
- <el-button type="success" @click="handleSetGroup" size="medium"
- >设置分组</el-button
- >
- <ul class="function-list">
- <li
- v-for="(item, index) in fn_data"
- :key="'fn' + index"
- @click="selectedFnType(item, index)"
- >
- <el-dropdown v-if="item.list">
- <span class="fn-name">
- {{ item.name }}<i class="el-icon-arrow-down el-icon--right" />
- </span>
- <el-dropdown-menu slot="dropdown" trigger="click">
- <el-dropdown-item
- v-for="(child, i) in item.list"
- :key="i"
- style="color: #000000"
- @click.native="selectSmallModule(item, child, index, i)"
- >{{ child.name }}</el-dropdown-item
- >
- </el-dropdown-menu>
- </el-dropdown>
- <span v-else class="fn-name">{{ item.name }}</span>
- </li>
- </ul>
- <div class="yunmu">
- <span>点击可复制</span>
- <table border="1" class="yunmu-table">
- <tr v-for="(item, index) in tableData" :key="'tableData' + index">
- <td
- v-for="(tdItem, tdIndex) in item"
- :key="'td' + index + tdIndex"
- :id="'td' + index + tdIndex"
- @click="CopyToClipboard('td' + index + tdIndex)"
- >
- {{ tdItem }}
- </td>
- </tr>
- </table>
- </div>
- </div>
- </div>
- <el-dialog
- :visible.sync="previewVisible"
- title="预览"
- top="0"
- width="100%"
- @close="handleClosePre"
- >
- <div class="chooseCon">
- <Preview
- ref="preview"
- :context="context"
- :que-index="queIndex"
- :father-name="fatherName"
- :current-tree-i-d="currentTreeID"
- :father-tree-data="FatherTreeData"
- :change-id="changeId"
- :theme-color="themeColor"
- :is-show-title="true"
- :task-model="TaskModel"
- />
- </div>
- <span slot="footer" class="dialog-footer">
- <!-- <el-button @click="saveAnswer">保 存</el-button> -->
- <el-button @click="handleClosePre">关 闭</el-button>
- </span>
- </el-dialog>
- </div>
- </template>
- <script>
- import Header from "@/components/Header.vue";
- import Catelog from "@/components/Adult/inputModules/Catelog";
- import ArticleTemChs from "@/components/Adult/inputModules/ArticleTemChs/index.vue";
- import SentenceSegwordChs from "@/components/Adult/inputModules/SentenceSegwordChs/index.vue";
- import DialogueArticleChs from "@/components/Adult/inputModules/DialogueArticleChs/index.vue";
- import Single from "@/components/Adult/inputModules/Single.vue";
- import Judge from "@/components/Adult/inputModules/Judge.vue";
- import Dialogue from "@/components/Adult/inputModules/Dialogue.vue";
- import MatrixSingle from "@/components/Adult/inputModules/MatrixSingle.vue";
- import MultiRowInput from "@/components/Adult/inputModules/MultiRowInput.vue";
- import Ligature from "@/components/Adult/inputModules/Ligature.vue";
- import Neword from "@/components/Adult/inputModules/Neword.vue";
- import Notes from "@/components/Adult/inputModules/Notes.vue";
- import InputRecord from "@/components/Adult/inputModules/InputRecord.vue";
- import AudioControl from "@/components/Adult/inputModules/AudioControl.vue";
- import SuitchControl from "@/components/Adult/inputModules/SuitchControl.vue";
- import BgControl from "@/components/Adult/inputModules/BgControl.vue";
- import UploadControl from "@/components/Adult/inputModules/UploadControl.vue";
- import TextItem from "@/components/Adult/inputModules/TextItem.vue";
- import Sentence from "@/components/Adult/inputModules/Sentence.vue";
- import Sudoku from "@/components/Adult/inputModules/Sudoku.vue";
- import ToneSelect from "@/components/Adult/inputModules/ToneSelect.vue";
- import NumberCombination from "@/components/Adult/inputModules/NumberCombination.vue";
- import DialogueAnswerChs from "@/components/Adult/inputModules/DialogueAnswerChs";
- import VoiceMatrix from "@/components/Adult/inputModules/VoiceMatrix.vue";
- import SelectDrag from "@/components/Adult/inputModules/SelectDrag.vue";
- import ConfigurableTable from "@/components/Adult/inputModules/ConfigurableTable/index.vue";
- import HeaderSeparate from "@/components/Adult/inputModules/HeaderSeparate/index.vue";
- import FillDrag from "@/components/Adult/inputModules/FillDrag.vue";
- import ImageQuestion from "@/components/Adult/inputModules/ImageQuestion.vue";
- import PurePreview from "@/components/Adult/inputModules/PurePreview.vue";
- import ZiLine from "@/components/Adult/inputModules/ZiLine.vue";
- import SelectInpue from "@/components/Adult/inputModules/SelectInpue.vue";
- import PlayInputReacord from "@/components/Adult/inputModules/PlayInputReacord.vue";
- import Drag from "@/components/Adult/inputModules/Drag.vue";
- import SelfAssessment from "@/components/Adult/inputModules/SelfAssessment.vue";
- import Sort from "@/components/Adult/inputModules/Sort.vue";
- import CourseStart from "@/components/Adult/inputModules/CourseStart.vue";
- import RecordControl from "@/components/Adult/inputModules/RecordControl.vue";
- import Tinydemo from "@/components/Adult/inputModules/Tinydemo.vue";
- import VideoControl from "@/components/Adult/inputModules/VideoControl.vue";
- import Table from "@/components/Adult/inputModules/Table.vue";
- import PlayRecord from "@/components/Adult/inputModules/PlayRecord.vue";
- import UploadPdf from "@/components/Adult/inputModules/UploadPdf.vue";
- import OptionsList from "@/components/Adult/inputModules/OptionsList.vue";
- import Textdes from "@/components/Adult/inputModules/Textdes.vue";
- import Record from "@/components/Adult/inputModules/Record.vue";
- import Hanzi from "@/components/Adult/inputModules/Hanzi.vue";
- import Picture from "@/components/Adult/inputModules/Picture.vue";
- import SentenceModule from "@/components/Adult/inputModules/SentenceModule.vue";
- import Singleview from "@/components/Adult/preview/Single.vue";
- import Judgeview from "@/components/Adult/preview/Judge.vue";
- import Textdesview from "@/components/Adult/preview/Textdes.vue";
- import Hanziview from "@/components/Adult/preview/Hanzi.vue";
- import Pictureview from "@/components/Adult/preview/Picture.vue";
- import Dialogueview from "@/components/Adult/preview/Dialogue.vue";
- import MatrixSingleview from "@/components/Adult/preview/MatrixSingle.vue";
- import MultiRowInputview from "@/components/Adult/preview/MultiRowInput.vue";
- import Ligatureview from "@/components/Adult/preview/Ligature.vue";
- import InputRecordview from "@/components/Adult/preview/InputRecord.vue";
- import BgControlview from "@/components/Adult/preview/BgControl.vue";
- import NewordPhraseview from "@/components/Adult/preview/WordPhrase.vue";
- import UploadControlView from "@/components/Adult/preview/UploadControlView.vue";
- import VideoControlView from "@/components/Adult/preview/VideoControl.vue";
- import SentenceSortQP from "@/components/Adult/preview/SentenceSortQP.vue";
- import TableView from "@/components/Adult/preview/TableView.vue";
- import PlayRecordView from "@/components/Adult/preview/PlayRecordView.vue";
- import Preview from "@/components/Adult/Preview.vue";
- import fn from "@/components/Adult/common/data.js";
- import { getContent, getStaticContent } from "@/api/ajax";
- export default {
- components: {
- Header,
- Catelog,
- Single,
- Textdes,
- Record,
- Singleview,
- Textdesview,
- Hanziview,
- Pictureview,
- Preview,
- Hanzi,
- Picture,
- Judge,
- Judgeview,
- Dialogue,
- Dialogueview,
- MatrixSingle,
- MatrixSingleview,
- MultiRowInput,
- MultiRowInputview,
- Ligature,
- Ligatureview,
- Neword,
- Notes,
- InputRecord,
- ArticleTemChs,
- SentenceSegwordChs,
- DialogueArticleChs,
- AudioControl,
- SuitchControl,
- BgControl,
- InputRecordview,
- BgControlview,
- NewordPhraseview,
- UploadControl,
- TextItem,
- Sentence,
- UploadControlView,
- Sudoku,
- NumberCombination,
- ToneSelect,
- DialogueAnswerChs,
- VoiceMatrix,
- FillDrag,
- SelectDrag,
- ConfigurableTable,
- HeaderSeparate,
- ImageQuestion,
- PurePreview,
- ZiLine,
- SelectInpue,
- PlayInputReacord,
- Drag,
- SelfAssessment,
- Sort,
- CourseStart,
- RecordControl,
- Tinydemo,
- VideoControl,
- VideoControlView,
- SentenceSortQP,
- Table,
- TableView,
- PlayRecord,
- PlayRecordView,
- UploadPdf,
- SentenceModule,
- OptionsList,
- },
- data() {
- return {
- bookId: 1,
- bookLevel: "",
- bookIndex: "",
- fn_data: [],
- fn_type: "",
- cur_fn_data: null, // 当前模块的数据结构
- cur_page_queIsEdit: [], // 当前页数的某个题
- org_question_list: {
- detailList: [
- {
- detail: {
- type: "detail",
- pyPosition: "top", // top 拼音在上面;bottom 拼音在下面
- sentence: "", // 句子
- segList: [], // 分词结果
- seg_words: "",
- wordsList: [],
- },
- en: "",
- },
- ], // 目录分词
- classTopic: [
- {
- con: "",
- font: "",
- },
- ], // 课题
- cur_fn_data: [],
- },
- // 总的数据列表
- question_list: {
- detailList: [
- {
- detail: {
- type: "detail",
- pyPosition: "top", // top 拼音在上面;bottom 拼音在下面
- sentence: "", // 句子
- segList: [], // 分词结果
- seg_words: "",
- wordsList: [],
- },
- en: "",
- },
- ], // 目录分词
- classTopic: [
- {
- con: "",
- font: "",
- },
- ], // 课题
- cur_fn_data: [],
- }, // 总的数据列表
- cur_page_que_index: 0,
- editableTabsValue: "tab1",
- tabIndex: 0,
- previewVisible: false,
- context: [],
- queIndex: 0,
- currentTreeID: null,
- row: null, // 行
- line: null, // 列
- TopicIndex: null, // 第几题的索引
- RowIndex: null, // 第几行
- LineIndex: null, // 第几列
- bgControlX: null, // 背景图插入模板的 x
- bgControlY: null, // 背景图插入模板的 y
- bgControlIndex: null, // 插入第几个
- DeletebgControlIndex: null, // 删除第几个
- fatherName: "",
- module_type: "",
- tmInde: "",
- FatherTreeData: null,
- themeColor: "", // 主题颜色
- loading: false,
- NumberList: [
- "①",
- "②",
- "③",
- "④",
- "⑤",
- "⑥",
- "⑦",
- "⑧",
- "⑨",
- "⑩",
- "⑪",
- "⑫",
- "⑬",
- "⑭",
- "⑮",
- "⑯",
- "⑰",
- "⑱",
- "⑲",
- "⑳",
- ],
- TaskModel: "",
- groupIndexList: [],
- tableData: [
- ["ā", "á", "ǎ", "à"],
- ["ō", "ó", "ǒ", "ò"],
- ["ē", "é", "ě", "è"],
- ["ī", "í", "ǐ", "ì"],
- ["ū", "ú", "ǔ", "ù"],
- ["ǖ", "ǘ", "ǚ", "ǜ"],
- ["Ā", "Á", "Â", "À"],
- ["Ō", "Ó", "Ô", "Ò"],
- ["Ē", "É", "Ê", "È"],
- ["Ī", "Í", "Î", "Ì"],
- ["Ū", "Ú", "Û", "Ù"],
- ],
- refresh: true,
- };
- },
- computed: {
- getCurrentQuestionView() {
- const function_type = this.fn_type;
- switch (function_type) {
- case "single":
- return Single;
- case "text":
- return Textdes;
- case "record":
- return Record;
- }
- },
- },
- watch: {},
- // 生命周期 - 创建完成(可以访问当前this实例)
- created() {
- console.log("2022.07.04");
- this.fn_data = fn.fnData;
- },
- // 生命周期 - 挂载完成(可以访问DOM元素)
- mounted() {
- console.log(this.question_list);
- if (localStorage.getItem("Bookanswer")) {
- this.TaskModel = "ANSWER";
- }
- document.getElementsByClassName("content-tree")[0].style.height =
- window.innerHeight - 120 + "px";
- },
- beforeCreate() {}, // 生命周期 - 创建之前
- beforeMount() {}, // 生命周期 - 挂载之前
- beforeUpdate() {}, // 生命周期 - 更新之前
- updated() {}, // 生命周期 - 更新之后
- beforeDestroy() {}, // 生命周期 - 销毁之前
- destroyed() {}, // 生命周期 - 销毁完成
- activated() {},
- // 方法集合
- methods: {
- handleChangeTab(item) {
- item.contentShow = !item.contentShow;
- },
- saveAnswer() {
- let answer = this.$refs.preview.saveAnswer();
- console.log("保存答案:");
- console.log(answer);
- let answerStr = JSON.stringify(answer);
- localStorage.setItem("Bookanswer", answerStr);
- },
- forupdata() {
- this.$forceUpdate();
- },
- // 增加列
- addCol(tyoe, rowindex, colindex, toindex) {},
- // 添加行
- addRow(type, rowindex, toindex) {
- let arr = [
- {
- text: ``,
- is_add_module: true,
- is_edit: true,
- },
- ];
- if (type == "front") {
- // 加到当前行前面
- if (rowindex == 0) {
- this.question_list.cur_fn_data[toindex].table_list.splice(0, 0, arr);
- } else {
- this.question_list.cur_fn_data[toindex].table_list.splice(
- rowindex - 1,
- 0,
- arr
- );
- }
- } else {
- // 加到当前行后面
- this.question_list.cur_fn_data[toindex].table_list.splice(
- rowindex + 1,
- 0,
- arr
- );
- }
- this.question_list.cur_fn_data[toindex].table_list.forEach(
- (item, rowIndex) => {
- item.forEach((it, colIndex) => {
- it.text = `第${rowIndex + 1}行,第${colIndex + 1}列`;
- });
- }
- );
- this.TopicIndex = null;
- this.RowIndex = null;
- this.LineIndex = null;
- this.$forceUpdate();
- },
- // 删除行
- removeRow(index, toindex) {
- this.$confirm("确定要删除当前行吗?", "提示", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning",
- }).then(() => {
- // 里面是不是剩下最后一行了
- if (this.question_list.cur_fn_data[toindex].table_list.length == 1) {
- this.question_list.cur_fn_data[toindex].table_list.splice(index, 1);
- this.question_list.cur_fn_data.splice(toindex, 1);
- } else {
- this.question_list.cur_fn_data[toindex].table_list.splice(index, 1);
- }
- this.question_list.cur_fn_data[toindex].table_list.forEach(
- (item, rowIndex) => {
- item.forEach((it, colIndex) => {
- it.text = `第${rowIndex + 1}行,第${colIndex + 1}列`;
- });
- }
- );
- this.TopicIndex = null;
- this.RowIndex = null;
- this.LineIndex = null;
- this.$forceUpdate();
- });
- },
- changeCurrentTreeID(val) {
- this.currentTreeID = val;
- },
- changeTreeData(val) {
- this.FatherTreeData = JSON.parse(JSON.stringify(val));
- },
- // 增加当前页的分词
- addDetail() {
- let obj = {
- detail: {
- type: "detail",
- pyPosition: "top", // top 拼音在上面;bottom 拼音在下面
- sentence: "", // 句子
- segList: [], // 分词结果
- seg_words: "",
- wordsList: [],
- },
- en: "",
- };
- this.question_list.detailList.push(obj);
- },
- // 删除当前页的分词
- deleteDetail(fcindex) {
- this.$confirm("确定要删除此模块吗?", "提示", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning",
- }).then(() => {
- if (this.question_list.detailList.length <= 1) {
- this.$message.warning("至少要保留一一个");
- return;
- }
- this.question_list.detailList.splice(fcindex, 1);
- });
- },
- // 增加课题
- addClassTopic() {
- let obj = {
- con: "",
- font: "",
- };
- this.question_list.classTopic.push(obj);
- },
- // 删除课题
- deleteClassTopic(ktindex) {
- this.$confirm("确定要删除此课题内容吗?", "提示", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning",
- }).then(() => {
- if (this.question_list.classTopic.length <= 1) {
- this.$message.warning("至少要保留一一个");
- return;
- }
- this.question_list.classTopic.splice(ktindex, 1);
- });
- },
- // 随意插入模板获取位置
- changeSite(x, y) {
- this.bgControlX = x;
- this.bgControlY = y;
- },
- // 插入索引
- changebgControlIndex(index) {
- this.bgControlIndex = index;
- },
- // 删除索引
- changeDeletebgControlIndex(index) {
- this.DeletebgControlIndex = index;
- },
- rowLine(value) {
- this[value] = this[value].match(/^\d*(\.?\d{0,2})/g)[0] || "";
- },
- createTable() {
- if (this.row && this.line) {
- let groupid = (
- new Date().toLocaleString().replace(/\s|:|\/*/g, "") +
- new Date().getMilliseconds() +
- Math.random().toString(36).substr(2) +
- new Date().getMilliseconds() +
- Math.random().toString(36).substr(2)
- ).substring(0, 32);
- let arr = {
- z_title: "",
- f_title: "",
- little_title_number: "",
- little_title: "",
- is_bg: false, // 是否有背景色
- is_layout: false, // 是不是按背景图布局
- is_textIndex: false,
- table_list: [],
- group_name: "", // 设置分组name
- group_id: [groupid], // 分组id
- contentShow: true, // 是否显示这一题
- };
- for (let i = 0; i < this.row; i++) {
- let rowArr = [];
- for (let j = 0; j < this.line; j++) {
- let obj = {
- text: `第${i + 1}行,第${j + 1}列`,
- is_add_module: true,
- is_edit: true,
- };
- rowArr.push(obj);
- }
- arr.table_list.push(rowArr);
- }
- this.question_list.cur_fn_data.push(arr);
- this.row = null;
- this.line = null;
- } else {
- this.$message.warning("请输入行和列");
- }
- },
- // 添加模板
- addModule(topicIndex, rowindex, lineIndex, item) {
- this.TopicIndex = topicIndex;
- this.RowIndex = rowindex;
- this.LineIndex = lineIndex;
- this.question_list.cur_fn_data.forEach((pic) => {
- pic.table_list.forEach((row) => {
- row.forEach((col) => {
- col.is_add_module = true;
- });
- });
- });
- item.is_add_module = false;
- },
- // 删除模板
- remoeModule(topicIndex, rowindex, lineIndex, item) {
- this.$confirm("确定要删除此模板吗?", "提示", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning",
- }).then(() => {
- item.type = "";
- item.data = null;
- this.TopicIndex = null;
- this.RowIndex = null;
- this.LineIndex = null;
- item.is_add_module = true;
- });
- },
- handleClosePre() {
- if (window.stopAudioVoice) window.stopAudioVoice();
- if (window.stopAudioAudio) window.stopAudioAudio();
- if (window.stopAudioSound) window.stopAudioSound();
- this.previewVisible = false;
- },
- onBlur(item, field) {
- item[field] = item[field] ? item[field].trim() : "";
- },
- // 当前目录id name 父级name/当前 name
- changeId(id, name, fatherName) {
- this.loading = true;
- this.TopicIndex = null;
- this.RowIndex = null;
- this.LineIndex = null;
- this.fatherName = fatherName;
- this.currentTreeID = id;
- this.refresh = false;
- // 根据当前目录切换题
- let MethodName = "book-courseware_manager-GetCoursewareContent";
- let data = {
- id,
- };
- console.log(this.question_list);
- getContent(MethodName, data)
- .then((res) => {
- this.themeColor = res.book_theme_color ? res.book_theme_color : "";
- this.question_list = res.content
- ? JSON.parse(res.content)
- : JSON.parse(JSON.stringify(this.org_question_list));
- let data = JSON.parse(JSON.stringify(this.question_list));
- data.cur_fn_data.forEach((item) => {
- if (!item.group_id) {
- let groupid = (
- new Date().toLocaleString().replace(/\s|:|\/*/g, "") +
- new Date().getMilliseconds() +
- Math.random().toString(36).substr(2) +
- new Date().getMilliseconds() +
- Math.random().toString(36).substr(2)
- ).substring(0, 32);
- item.group_name = ""; // 设置分组name
- item.group_id = [groupid]; // 分组id
- }
- if (!item.hasOwnProperty("contentShow")) {
- item.contentShow = true;
- }
- });
- data.detailList.forEach((item) => {
- if (!item.detail) {
- let obj = JSON.parse(JSON.stringify(item));
- item.detail = obj;
- }
- if (!item.en) {
- item.en = "";
- }
- });
- this.question_list = JSON.parse(JSON.stringify(data));
- if (this.previewVisible) {
- this.onPreview();
- }
- this.loading = false;
- document.getElementsByClassName(
- "Big-Book-input-save"
- )[0].style.width =
- document.getElementsByClassName("Book-content")[0].clientWidth -
- 20 +
- "px";
- document.getElementsByClassName("Book-function")[0].style.height =
- window.innerHeight - 120 + "px";
- // this.cur_page_que_index =
- // this.question_list[this.tabIndex].cur_fn_data.length - 1;
- this.$nextTick(() => {
- // 重新渲染组件
- this.refresh = true;
- });
- })
- .catch((error) => {
- this.loading = false;
- this.$nextTick(() => {
- // 重新渲染组件
- this.refresh = true;
- });
- });
- },
- handleTabsEdit(targetName, action) {
- if (action === "add") {
- let leg = this.question_list.cur_fn_data.length;
- let obj = {
- name: `tab${leg + 1}`,
- title: `第${leg + 1}页`,
- cur_fn_data: [],
- };
- this.question_list.push(obj);
- }
- if (action === "remove") {
- let tabs = JSON.parse(JSON.stringify(this.question_list));
- let activeName = this.editableTabsValue;
- if (activeName === targetName) {
- tabs.forEach((tab, index) => {
- if (tab.name === targetName) {
- let nextTab = tabs[index + 1] || tabs[index - 1];
- if (nextTab) {
- activeName = nextTab.name;
- }
- }
- });
- }
- this.editableTabsValue = activeName;
- let question_list = tabs.filter((tab) => tab.name !== targetName);
- question_list.map((item, index) => {
- item.name = `tab${index + 1}`;
- item.title = `第${index + 1}页`;
- return item;
- });
- this.question_list = question_list;
- this.TopicIndex = null;
- this.RowIndex = null;
- this.LineIndex = null;
- }
- },
- tabClick(tab) {
- this.tabIndex = tab.index;
- },
- // 大模板
- selectedFnType(item, index) {
- if (item.list) {
- return;
- }
- if (
- Object.prototype.toString.call(this.TopicIndex).indexOf("Number") ==
- -1 &&
- Object.prototype.toString.call(this.LineIndex).indexOf("Number") == -1
- ) {
- this.$message.warning("请先选择添加模板的位置");
- return;
- }
- if (
- this.question_list.cur_fn_data[this.TopicIndex].table_list[
- this.RowIndex
- ][this.LineIndex].data
- ) {
- this.$message.warning("每列只能添加一个模板");
- } else {
- console.log("不存在");
- this.$set(
- this.question_list.cur_fn_data[this.TopicIndex].table_list[
- this.RowIndex
- ][this.LineIndex],
- "type",
- item.type
- );
- this.$set(
- this.question_list.cur_fn_data[this.TopicIndex].table_list[
- this.RowIndex
- ][this.LineIndex],
- "data",
- undefined
- );
- console.log(this.question_list);
- }
- },
- changeCurQue(data_stru) {
- console.log(this.RowIndex, this.LineIndex);
- this.$set(
- this.question_list.cur_fn_data[this.TopicIndex].table_list[
- this.RowIndex
- ][this.LineIndex],
- "data",
- JSON.parse(JSON.stringify(data_stru))
- );
- console.log(this.question_list);
- },
- // 小模板
- selectSmallModule(item, child, itemIndex, childIndex) {
- console.log("选择了小模版");
- if (
- Object.prototype.toString.call(this.TopicIndex).indexOf("Number") ==
- -1 &&
- Object.prototype.toString.call(this.LineIndex).indexOf("Number") == -1
- ) {
- this.$message.warning("请先选择添加模板的位置");
- return;
- }
- if (
- this.question_list.cur_fn_data[this.TopicIndex].table_list[
- this.RowIndex
- ][this.LineIndex].data
- ) {
- this.$message.warning("每列只能添加一个模板");
- } else {
- this.$set(
- this.question_list.cur_fn_data[this.TopicIndex].table_list[
- this.RowIndex
- ][this.LineIndex],
- "type",
- child.type
- );
- this.$set(
- this.question_list.cur_fn_data[this.TopicIndex].table_list[
- this.RowIndex
- ][this.LineIndex],
- "data",
- null
- );
- }
- },
- // 删除某页中一个部分
- deleteCurQue(item, queIndex) {
- item.queList.splice(queIndex, 1);
- },
- saveNewwordAndSentences() {
- let question_list = JSON.parse(JSON.stringify(this.question_list));
- let sentence_list = [];
- let sentence_list_mp = [];
- let new_word_list = [];
- question_list.cur_fn_data.forEach((curItem) => {
- curItem.table_list.forEach((tabItem) => {
- tabItem.forEach((topicIitem) => {
- if (
- topicIitem.type == "article_chs" ||
- topicIitem.type == "dialogue_article_chs"
- ) {
- topicIitem.data.detail.forEach((item) => {
- let obj = this.handleSentences(item.sentences, item.segList);
- sentence_list = sentence_list.concat(obj.sentenceArr); // 句子数组
- sentence_list_mp = sentence_list_mp.concat(obj.res); // 句子+分词数组
- });
- } else if (topicIitem.type == "NewWord_chs") {
- let audio_file_id = "";
- audio_file_id =
- topicIitem.data.mp3_list && topicIitem.data.mp3_list.length > 0
- ? topicIitem.data.mp3_list[0].id
- .replace("[FID##", "")
- .replace("##FID]", "")
- : "";
- topicIitem.data.option.forEach((item) => {
- item.map((sItem) => {
- sItem.audio_file_id = audio_file_id;
- sItem.audio_begin_time =
- topicIitem.data.wordTime &&
- topicIitem.data.wordTime[sItem.sIndex]
- ? Number(topicIitem.data.wordTime[sItem.sIndex].bg)
- : 0;
- sItem.audio_end_time =
- topicIitem.data.wordTime &&
- topicIitem.data.wordTime[sItem.sIndex]
- ? Number(topicIitem.data.wordTime[sItem.sIndex].ed)
- : 0;
- return sItem;
- });
- console.log(item);
- new_word_list = new_word_list.concat(item);
- });
- }
- });
- });
- });
- return {
- new_word_list,
- sentence_list,
- sentence_list_mp,
- };
- },
- handleSentences(list, segList) {
- let res = [];
- let sentenceArr = [];
- list.forEach((Litem, index) => {
- Litem = Litem.replace(/#/g, "");
- this.NumberList.forEach((nitem) => {
- if (Litem.indexOf(nitem) > -1) {
- let reg = new RegExp(nitem, "g");
- Litem = Litem.replace(reg, "");
- }
- });
- let segItem = this.handleSegItem(segList[index]);
- let obj = {
- sentence: Litem,
- word_list: segItem,
- };
- res.push(obj);
- sentenceArr.push(Litem);
- });
- return { res, sentenceArr };
- },
- handleSegItem(list) {
- let resArr = [];
- list.forEach((item) => {
- if (item != "#" && this.NumberList.indexOf(item) < 0) {
- let obj = {
- word: item,
- word_bt: "",
- };
- resArr.push(obj);
- }
- });
- return resArr;
- },
- onSave() {
- let isProof = true;
- for (let j = 0; j < this.question_list.cur_fn_data.length; j++) {
- for (
- let l = 0;
- l < this.question_list.cur_fn_data[j].table_list.length;
- l++
- ) {
- for (
- let m = 0;
- m < this.question_list.cur_fn_data[j].table_list[l].length;
- m++
- ) {
- if (
- this.question_list.cur_fn_data[j].table_list[l][m].type ==
- "tinydemo_chs" ||
- this.question_list.cur_fn_data[j].table_list[l][m].type ==
- "toneSelect_chs"
- ) {
- for (let i = 0; i < tinymce.editors.length; i++) {
- let content = tinymce.editors[i].getContent();
- let arr = content.split(/[\n]/);
- let newstr = "";
- arr.forEach((item) => {
- newstr += item;
- });
- if (newstr.length > 5000) {
- this.$message.warning("富文本已超出字数限制");
- this.loading = false;
- return false;
- }
- }
- }
- }
- }
- }
- let question_list_str = JSON.stringify(this.question_list);
- console.log(this.question_list);
- localStorage.setItem("question_list", question_list_str);
- let result = this.saveNewwordAndSentences();
- const MethodName = "book-courseware_manager-SaveCoursewareContent";
- let data = {
- id: this.currentTreeID,
- content: JSON.stringify(this.question_list),
- is_use_manual_proofreading_word_sentence: isProof,
- new_word_list: result.new_word_list,
- sentence_list: result.sentence_list,
- sentence_list_mp: result.sentence_list_mp,
- ui_type: "NPC",
- category: "NPC",
- };
- getContent(MethodName, data)
- .then((res) => {
- this.$message.success("保存成功!");
- })
- .catch((error) => {});
- },
- async onPreview() {
- let _this = this;
- let question_data = null;
- if (_this.question_list) {
- const question2 = JSON.parse(JSON.stringify(_this.question_list));
- question_data = await _this.getFileUrl_preview(question2);
- _this.previewVisible = true;
- _this.context = question_data;
- console.log("预览数据");
- console.log(this.question_list);
- } else {
- _this.$message.warning("还没有录入数据");
- }
- },
- getFileUrl_preview(question) {
- let questionStr = JSON.stringify(question);
- const reg = /\[FID##(.*?)##FID\]/g;
- let regConArr = [];
- if (reg.test(questionStr)) {
- regConArr = questionStr.match(reg);
- }
- if (regConArr.length > 0) {
- regConArr = regConArr.map((item) => {
- item = item.replace("[FID##", "").replace("##FID]", "");
- return item;
- });
- }
- return new Promise((resolve, reject) => {
- const MethodName = "file_store_manager-GetFileURLMap";
- const data = {
- file_id_list: regConArr,
- };
- getStaticContent(MethodName, data).then((res) => {
- const backData = res.url_map;
- for (const key in backData) {
- const url = backData[key];
- if (questionStr.indexOf(key) > -1) {
- const d = `\\[FID##${key}##FID\\]`;
- const regD = new RegExp(d, "g");
- questionStr = questionStr.replace(regD, url);
- }
- }
- const question3 = JSON.parse(questionStr);
- resolve(question3);
- });
- });
- },
- onSure(curItem) {
- this.TopicIndex = null;
- this.RowIndex = null;
- this.LineIndex = null;
- curItem.is_edit = false;
- },
- onDel(item, curIndex) {
- item.cur_fn_data.splice(curIndex, 1);
- if (this.question_list.cur_fn_data.length > 0) {
- this.cur_page_que_index = this.question_list.cur_fn_data.length - 1;
- } else {
- this.cur_page_que_index = 0;
- }
- // let question_list_str = JSON.stringify(this.question_list);
- // localStorage.setItem("question_list", question_list_str);
- },
- // 编辑当前题型
- editCurQue(curItem) {
- curItem.is_edit = true;
- // if (!curItem.isEdit) {
- // let count = 0;
- // let tabIndex = this.tabIndex;
- // let leg = this.question_list[tabIndex].cur_fn_data.length;
- // this.question_list[tabIndex].cur_fn_data.forEach((item) => {
- // if (item.isEdit) {
- // count++;
- // }
- // });
- // if (count == 0) {
- // if (!curItem.isEdit) {
- // curItem.isEdit = true;
- // }
- // } else {
- // this.$message.warning("有题目未保存");
- // }
- // }
- },
- emptyQustion() {
- this.currentTreeID = "";
- },
- // 设置分组
- handleSetGroup() {
- let groupname = "";
- let groupid = (
- new Date().toLocaleString().replace(/\s|:|\/*/g, "") +
- new Date().getMilliseconds() +
- Math.random().toString(36).substr(2) +
- new Date().getMilliseconds() +
- Math.random().toString(36).substr(2)
- ).substring(0, 32);
- this.groupIndexList.forEach((item) => {
- groupname += item + 1 + "-";
- });
- groupname = groupname.substring(0, groupname.length - 1);
- this.question_list.cur_fn_data.forEach((curItem, indexItem) => {
- if (this.groupIndexList.indexOf(indexItem) > -1) {
- curItem.group_name = "打包组" + groupname;
- curItem.group_id = [groupid];
- }
- });
- this.groupIndexList = [];
- this.$forceUpdate();
- },
- CopyToClipboard(element) {
- var doc = document,
- text = doc.getElementById(element),
- range,
- selection;
- if (doc.body.createTextRange) {
- range = doc.body.createTextRange();
- range.moveToElementText(text);
- range.select();
- } else if (window.getSelection) {
- selection = window.getSelection();
- range = doc.createRange();
- range.selectNodeContents(text);
- selection.removeAllRanges();
- selection.addRange(range);
- }
- document.execCommand("copy");
- this.$message({
- message: "复制成功",
- type: "success",
- });
- window.getSelection().removeAllRanges();
- },
- deleteElement(index) {
- this.$confirm(`确定要删除吗?`, "提示", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning",
- }).then(() => {
- if(this.question_list.cur_fn_data.length>1){
- this.question_list.cur_fn_data.splice(index, 1);
- }else{
- this.question_list.cur_fn_data = [];
- }
- });
- },
- moveElement(dItem, index, type) {
- let obj = JSON.parse(JSON.stringify(dItem));
- if (type == "up" && index > 0) {
- this.question_list.cur_fn_data.splice(index - 1, 0, obj);
- this.question_list.cur_fn_data.splice(index + 1, 1);
- }
- if (type == "down" && index < this.question_list.cur_fn_data.length - 1) {
- this.question_list.cur_fn_data[index] = this.question_list.cur_fn_data.splice(index + 1, 1, this.question_list.cur_fn_data[index])[0]
- }
- },
- }, // 如果页面有keep-alive缓存功能,这个函数会触发
- };
- </script>
- <style lang="scss" scoped>
- //@import url(); 引入公共css类
- .topTitle {
- width: 100%;
- height: 48px;
- display: flex;
- justify-content: space-between;
- padding: 0 16px;
- align-items: center;
- background: #f5f5f5 !important;
- border: 1px rgba(0, 0, 0, 0.1) solid;
- border-radius: 4px 4px 0 0;
- margin-top: 10px;
- > :nth-child(1) {
- font-weight: 500;
- font-size: 16px;
- line-height: 150%;
- color: rgba(0, 0, 0, 0.85);
- }
- > :nth-child(2) {
- display: flex;
- align-items: center;
- font-weight: normal;
- font-size: 14px;
- line-height: 22px;
- color: rgba(0, 0, 0, 0.85);
- cursor: pointer;
- }
- img {
- width: 16px;
- height: 16px;
- margin-left: 4px;
- }
- .rotate {
- animation-name: firstrotate;
- animation-direction: 2s;
- animation-fill-mode: both;
- animation-timing-function: linear;
- }
- }
- .collapse-box {
- padding: 10px;
- border: 1px rgba(0, 0, 0, 0.1) solid;
- border-top: none;
- }
- .Big-Book-container {
- width: 100%;
- min-height: 100vh;
- .Big-Book-content {
- padding: 26px 0;
- display: flex;
- justify-content: flex-start;
- align-items: flex-start;
- }
- .content-tree {
- width: 280px;
- overflow: auto;
- }
- .Book-content {
- flex: 1;
- box-sizing: border-box;
- padding: 90px 30px 30px;
- height: 859px;
- overflow-y: auto;
- position: relative;
- box-sizing: border-box;
- &-inner {
- // width: 860px;
- }
- .addoption {
- padding: 0 20px;
- width: auto;
- display: inline-block;
- height: 40px;
- background: #f3f3f3;
- border: 1px dashed rgba(0, 0, 0, 0.15);
- box-sizing: border-box;
- border-radius: 4px;
- text-align: center;
- line-height: 40px;
- cursor: pointer;
- font-size: 14px;
- color: #000000;
- margin-top: 20px;
- }
- .createTable {
- }
- }
- .Big-Book-save {
- width: 100%;
- display: flex;
- justify-content: flex-end;
- padding: 0 0 20px 0;
- &.Big-Book-input-save {
- position: fixed;
- top: 74px;
- left: 280px;
- z-index: 1;
- background: #fff;
- }
- }
- .Big-Book {
- &-add {
- position: absolute;
- top: -40px;
- right: 0;
- z-index: 1;
- width: 73px;
- height: 40px;
- background: #f7f7f7;
- border: 1px solid #d9d9d9;
- line-height: 40px;
- text-align: center;
- font-weight: bold;
- font-size: 18px;
- text-align: center;
- color: #000000;
- }
- &-name {
- display: flex;
- justify-content: flex-start;
- align-items: center;
- margin-bottom: 10px;
- > p {
- font-size: 14px;
- }
- }
- &-delete {
- width: 16px;
- height: 16px;
- margin-left: 15px;
- cursor: pointer;
- }
- &-curPage {
- margin-bottom: 20px;
- &.Big-Book-curPage-edit {
- border-top: 1px solid #e0e0e0;
- border-bottom: 1px solid #e0e0e0;
- background-color: #fafafa;
- }
- &.Big-Book-curPage-preview {
- border-top: 1px solid #fff;
- border-bottom: 1px solid #fff;
- display: flex;
- justify-content: flex-start;
- align-items: flex-start;
- &:hover {
- background-color: #fafafa;
- border-top: 1px solid #e0e0e0;
- border-bottom: 1px solid #e0e0e0;
- }
- }
- }
- &-queBox {
- padding: 10px 0;
- }
- }
- .Book-function {
- width: 204px;
- background: #f7f7f7;
- box-sizing: border-box;
- padding: 30px 16px;
- height: 859px;
- overflow-y: auto;
- text-align: center;
- .function-list {
- width: 100%;
- margin-top: 5px;
- > li {
- width: 100%;
- width: 172px;
- height: 40px;
- background: #ffffff;
- border: 1px solid rgba(0, 0, 0, 0.15);
- box-sizing: border-box;
- border-radius: 4px;
- cursor: pointer;
- margin-bottom: 5px;
- display: flex;
- justify-content: center;
- align-items: center;
- > span {
- font-weight: normal;
- font-size: 16px;
- line-height: 150%;
- color: #000000;
- }
- .el-dropdown {
- color: #000000;
- }
- }
- }
- }
- .Big-Book-top {
- margin-top: 20px;
- display: flex;
- align-items: center;
- span {
- margin-right: 10px;
- }
- }
- }
- .yunmu {
- &-table {
- width: 172px;
- > tr {
- td {
- cursor: pointer;
- text-align: center;
- font-size: 16px;
- height: 26px;
- }
- }
- }
- }
- </style>
|