| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316 |
- <template>
- <div class="print-model">
- <div class="print-model-top">
- <a class="goback" @click="goBack"
- ><i class="el-icon-arrow-left"></i>回到文章</a
- >
- <div class="border"></div>
- <p class="article-title">打印预览</p>
- </div>
- <div class="print-model-bottom">
- <div
- class="print-model-bottom-left"
- ref="printArea"
- id="showWaterMark"
- :style="{ width: isPrint ? '220mm' : '' }"
- >
- <div class="print-inner">
- <h2>
- <span
- :style="{
- color: colorObj.titleColor,
- fontSize: titleFontsize + 'px',
- lineHeight: titleFontsize + 8 + 'px',
- marginRight: '10px',
- fontWeight: '700',
- cursor: 'pointer',
- wordBreak: 'break-word',
- }"
- >{{ articleInfo.art_title }}</span
- >
- </h2>
- <h6
- class="nnpe-article-author"
- :style="{
- color: colorObj.sourceColor,
- fontSize: wordFontsize - 4 + 'px',
- lineHeight: wordFontsize + 4 + 'px',
- fontWeight: '400',
- }"
- >
- {{
- articleInfo.art_author +
- " · " +
- articleInfo.study_phase_name +
- "版 · 第 " +
- articleInfo.iss_no +
- " 期 · " +
- articleInfo.release_date +
- " · " +
- articleInfo.chn_item +
- (articleInfo.page_no_in_pub
- ? " · P" + articleInfo.page_no_in_pub
- : "")
- }}
- {{ printForm.info.length > 0 ? " | " : "" }}
- {{
- printForm.info.indexOf("wordLength") > -1
- ? " 长度 " + articleInfo.art_corpus_data.artStatInfo.wc
- : ""
- }}
- {{
- printForm.info.indexOf("wordNumber") > -1
- ? " · 词数 " + articleInfo.art_corpus_data.artStatInfo.wdc
- : ""
- }}
- {{
- printForm.info.indexOf("difficulty") > -1
- ? " · 难度 " +
- articleInfo.art_corpus_data.artStatInfo.vocabHardLevel
- : ""
- }}
- </h6>
- <template v-if="resArr.length > 0 && articleInfo.en_flag">
- <div class="table-box">
- <div
- :class="['NNPE-detail']"
- v-for="(item, index) in resArr"
- :key="'detail' + index"
- >
- <div class="wordsList-box">
- <template v-if="index !== 0">
- <div class="nnpe-sentence-box">
- <div
- v-for="(pItem, pIndex) in item.wordsList"
- :key="'wordsList' + pIndex"
- class="word-box"
- :class="[
- pItem.isExplain || pItem.explainNumber
- ? 'hasExplain'
- : '',
- ]"
- >
- <!-- <template v-if="pItem.isShow"> -->
- <template v-if="pItem.tokens[2] === '#@@#'">
- <span
- class="NNPE-chs"
- :style="{
- width: printForm.fontSize + 'px',
- height:
- printForm.fontSize * printForm.lineHeight +
- 'px',
- display: 'block',
- fontFamily: printForm.fontFamily,
- }"
- ></span>
- </template>
- <template v-else>
- <div :class="['NNPE-words']">
- <span
- class="NNPE-chs"
- :class="[
- pItem.noBefore ? 'marginLeft' : '',
- pItem.noAfter ? 'marginRight' : '',
- (pItem.highIndex &&
- printForm.bold.indexOf(pItem.types) > -1) ||
- (printForm.bold.indexOf('sentence') > -1 &&
- longSentIds.indexOf(pItem.sent_id) > -1)
- ? 'fontWeight'
- : '',
- pItem.marginRigh ? 'marginSingleRight' : '',
- ]"
- :style="{
- fontSize: printForm.fontSize + 'px',
- color: printForm.color,
- lineHeight: printForm.lineHeight,
- fontFamily: printForm.fontFamily,
- }"
- >{{ pItem.tokens[2] }}</span
- >
- <!-- <span
- class="NNPE-chs NNPE-chs-both"
- v-if="
- item.wordsList[pIndex + 1] &&
- item.wordsList[pIndex + 1].tokens[2] &&
- enFhList.indexOf(
- item.wordsList[pIndex + 1].tokens[2]
- ) > -1
- "
- :class="[
- item.wordsList[pIndex + 1].tokens[8] === ''
- ? 'marginLeft'
- : '',
- (item.wordsList[pIndex + 1].highIndex &&
- printForm.bold.indexOf(
- item.wordsList[pIndex + 1].types
- ) > -1) ||
- (printForm.bold.indexOf('sentence') > -1 &&
- longSentIds.indexOf(
- item.wordsList[pIndex + 1].sent_id
- ) > -1)
- ? 'fontWeight'
- : '',
- item.wordsList[pIndex + 1].marginRight
- ? 'marginSingleRight'
- : '',
- ]"
- :style="{
- fontSize: printForm.fontSize + 'px',
- color: printForm.color,
- lineHeight: printForm.lineHeight,
- fontFamily: printForm.fontFamily,
- }"
- >{{
- item.wordsList[pIndex + 1].tokens[2]
- }}</span
- > -->
- </div>
- </template>
- <!-- </template> -->
- </div>
- </div>
- </template>
- </div>
- <template
- v-if="
- articleImg &&
- articleImg[index] &&
- printForm.range.indexOf('image') > -1
- "
- >
- <figure
- v-for="(itemI, indexI) in articleImg[index]"
- :key="indexI"
- style="text-align: center"
- >
- <img
- @load="handleImageLoad($event, itemI)"
- :style="{
- width: itemI.width,
- height: itemI.height,
- maxWidth: isPrint ? '630px' : '',
- }"
- :src="itemI.newSrc ? itemI.newSrc : itemI.src"
- />
- <!-- <el-image
- :src="itemI.src"
- fit="contain"
- :style="{
- width: itemI.width,
- height: itemI.height,
- }"
- :preview-src-list="[itemI.src]"
- @load="handleImageLoad($event, itemI)"
- ></el-image> -->
- </figure>
- </template>
- </div>
- </div>
- </template>
- <div
- v-else
- class="cn-content"
- v-html="articleInfo.art_content"
- :style="{
- color: printForm.color,
- fontSize: printForm.fontSize + 'px',
- lineHeight: printForm.lineHeight,
- }"
- ></div>
- <template v-if="printForm.range.indexOf('vocab') > -1">
- <h5>词表</h5>
- <ul class="newwordlist">
- <li
- v-for="(itemW, indexW) in wordLit"
- :key="indexW"
- :class="['li-' + colorObj.type]"
- >
- <div class="word-info">
- <div class="word-info-top">
- <b class="word" :style="{ color: colorObj.newWordColor }">{{
- itemW.word
- }}</b>
- <span
- class="symbol"
- :style="{ color: colorObj.newWordOtherColor }"
- >{{ itemW.symbol }}</span
- >
- <label
- class="word-type"
- :style="{
- color: colorObj.newWordType[itemW.type]
- ? colorObj.newWordType[itemW.type].color
- : '',
- background: colorObj.newWordType[itemW.type]
- ? colorObj.newWordType[itemW.type].bg
- : '',
- }"
- >{{ itemW.typeCn }}</label
- >
- <span class="star" v-if="itemW.rate">
- <svg-icon
- icon-class="star-filled"
- v-for="(itemS, indexS) in itemW.rate"
- :key="indexS"
- :style="{ color: colorObj.newWordStar }"
- ></svg-icon>
- </span>
- <div class="para-list">
- <div
- class="para"
- v-for="(itemP, indexP) in itemW.paraList"
- :key="indexP"
- >
- <span
- class="cixing"
- :style="{ color: colorObj.newWordOtherColor }"
- >{{ itemP.cixing }}</span
- >
- <span
- class="shiyi"
- :style="{ color: colorObj.newWordOtherColor }"
- >{{ itemP.para }}</span
- >
- </div>
- </div>
- </div>
- </div>
- </li>
- </ul>
- <h5
- v-if="
- articleInfo.art_phrase_data &&
- articleInfo.art_phrase_data.length > 0
- "
- >
- 短语
- </h5>
- <ul
- class="phraselist"
- v-if="
- articleInfo.art_phrase_data &&
- articleInfo.art_phrase_data.length > 0
- "
- >
- <li v-for="(itemW, indexW) in phraseList" :key="indexW">
- <div class="word-info">
- <div class="word-info-top">
- <b
- class="phrase"
- :style="{ color: colorObj.phraseColor }"
- @click="showItem(itemW, indexW)"
- >{{ itemW.exp_title }}</b
- >
- <div class="para-list">
- <div class="para">
- <span
- class="shiyi"
- :style="{ color: colorObj.phraseOhterColor }"
- >{{ itemW.exp_content }}</span
- >
- </div>
- </div>
- </div>
- </div>
- </li>
- </ul>
- <h5
- v-if="
- articleInfo.art_explain_data &&
- articleInfo.art_explain_data.length > 0
- "
- >
- 注释
- </h5>
- <ul
- class="explainlist"
- v-if="
- articleInfo.art_explain_data &&
- articleInfo.art_explain_data.length > 0
- "
- >
- <li
- v-for="(itemW, indexW) in articleInfo.art_explain_data"
- :key="indexW"
- >
- <b
- class="prefix"
- :style="{ color: colorObj.phraseOhterColor }"
- >{{ itemW.exp_title }}</b
- >
- <div
- class="para-list"
- :style="{ color: colorObj.newWordOtherColor }"
- v-html="itemW.exp_content"
- ></div>
- </li>
- </ul>
- </template>
- <template v-if="printForm.range.indexOf('ciyun') > -1">
- <iframe
- class="ciyun-box"
- width="100%"
- height="720px"
- border="none"
- :src="
- './ciyun/ciyunPrint.html?partitionKey=1&searchType=2&articleId=' +
- articleId
- "
- ></iframe>
- </template>
- <template v-if="printForm.range.indexOf('notes') > -1">
- <h5 v-if="notesList.length > 0">笔记</h5>
- <ul class="explainlist">
- <li v-for="(itemW, indexW) in notesList" :key="indexW">
- <b
- class="prefix"
- :style="{ color: colorObj.phraseOhterColor }"
- >{{ itemW.select_text }}</b
- >
- <div
- class="para-list"
- :style="{ color: colorObj.newWordOtherColor }"
- v-html="itemW.note"
- ></div>
- </li>
- </ul>
- </template>
- </div>
- <footer
- class="print-footer"
- v-if="
- printForm.school ||
- printForm.className ||
- printForm.name ||
- printForm.dateStr ||
- printForm.momo
- "
- >
- <span>{{ printForm.school }}</span>
- <span>{{ printForm.className }}</span>
- <span>{{ printForm.name }}</span>
- <span style="flex: 1"></span>
- <span>{{ printForm.dateStr }}</span>
- <span>{{ printForm.momo }}</span>
- </footer>
- </div>
- <div class="print-model-bottom-right">
- <h3><svg-icon icon-class="print"></svg-icon>打印设置</h3>
- <div class="config-box">
- <div class="item-page">
- <label>字体:</label>
- <el-select v-model="printForm.fontFamily" placeholder="请选择">
- <el-option
- v-for="item in fontList"
- :key="item.value"
- :label="item.name"
- :value="item.value"
- >
- </el-option>
- </el-select>
- </div>
- <div class="item-page">
- <label>字号:</label>
- <el-input-number
- v-model="printForm.fontSize"
- :step="2"
- ></el-input-number>
- </div>
- <div class="item-page">
- <label>颜色:</label>
- <el-color-picker
- v-model="printForm.color"
- size="small"
- ></el-color-picker>
- </div>
- <el-divider class="print-divider"></el-divider>
- <div class="item-page">
- <label>行距:</label>
- <el-select v-model="printForm.lineHeight" placeholder="请选择">
- <el-option
- v-for="item in lineHeightList"
- :key="item.value"
- :label="item.name"
- :value="item.value"
- >
- </el-option>
- </el-select>
- </div>
- <el-divider class="print-divider"></el-divider>
- <div class="item-page">
- <label>打印/下载范围:</label>
- <el-checkbox-group v-model="printForm.range">
- <el-checkbox
- v-for="(itemT, indexT) in rangeList"
- :key="indexT"
- :label="itemT.value"
- >{{ itemT.name }}</el-checkbox
- >
- </el-checkbox-group>
- </div>
- <div class="item-page" v-if="articleInfo.en_flag">
- <label>加粗显示:</label>
- <el-checkbox-group v-model="printForm.bold">
- <el-checkbox
- v-for="(itemT, indexT) in boldList"
- :key="indexT"
- :label="itemT.value"
- >{{ itemT.name }}</el-checkbox
- >
- </el-checkbox-group>
- </div>
- <el-divider class="print-divider"></el-divider>
- <div class="item-page">
- <label>附加信息:</label>
- <b @click="handleClear"
- ><svg-icon icon-class="clear"></svg-icon>清除</b
- >
- </div>
- <div class="item-page">
- <label>姓名:</label>
- <el-input
- v-model="printForm.name"
- autocomplete="off"
- placeholder="请输入"
- maxlength="20"
- >
- </el-input>
- </div>
- <div class="item-page">
- <label>学校:</label>
- <el-input
- v-model="printForm.school"
- autocomplete="off"
- placeholder="请输入"
- maxlength="20"
- >
- </el-input>
- </div>
- <div class="item-page">
- <label>班级:</label>
- <el-input
- v-model="printForm.className"
- autocomplete="off"
- placeholder="请输入"
- maxlength="20"
- >
- </el-input>
- </div>
- <div class="item-page">
- <label>日期:</label>
- <el-input
- v-model="printForm.dateStr"
- autocomplete="off"
- placeholder="请输入"
- maxlength="20"
- >
- </el-input>
- </div>
- <div class="item-page">
- <label>备注:</label>
- <el-input
- v-model="printForm.momo"
- autocomplete="off"
- placeholder="请输入"
- maxlength="20"
- >
- </el-input>
- </div>
- <el-divider class="print-divider"></el-divider>
- <div class="item-page">
- <label>统计信息:</label>
- <el-checkbox-group v-model="printForm.info">
- <el-checkbox
- v-for="(itemT, indexT) in infoList"
- :key="indexT"
- :label="itemT.value"
- >{{ itemT.name }}</el-checkbox
- >
- </el-checkbox-group>
- </div>
- <el-divider class="print-divider"></el-divider>
- </div>
- <p style="color: red; width: 100%; margin: 10px 0; text-align: center">
- 若点击打印按钮无法显示,下一个页面点击更多设置,勾选背景图形
- </p>
- <div class="item-page" style="padding: 0 24px">
- <el-button @click="goBack" size="small">取消</el-button>
- <el-button
- type="primary"
- @click="generatePDF(articleInfo.art_title)"
- size="small"
- >下载</el-button
- >
- <el-button type="primary" @click="handlePrint" size="small"
- >打印</el-button
- >
- <el-button type="primary" @click="handleManyPrint" size="small"
- >打印多篇</el-button
- >
- </div>
- </div>
- </div>
- <el-dialog
- :visible.sync="printManyFlag"
- width="500px"
- append-to-body
- :show-close="true"
- title="选择打印的文章"
- :close-on-click-modal="false"
- >
- <el-form ref="form">
- <el-form-item prop="name">
- <el-cascader
- v-model="printManyId"
- :props="{ multiple: true }"
- collapse-tags
- :options="printManyMenu"
- style="width: 470px"
- />
- </el-form-item>
- <el-form-item style="text-align: right">
- <el-button @click="printManyFlag = false">取 消</el-button>
- <el-button :loading="loading" type="primary" @click="submitPrintMore"
- >确 定</el-button
- ></el-form-item
- >
- </el-form>
- </el-dialog>
- <div
- class="print-model-bottom-left"
- ref="printAreaManys"
- id="showWaterMarks"
- v-if="isPrintMore"
- :style="{
- width: '220mm',
- }"
- >
- <div
- class="print-inner"
- v-for="(itemA, index) in printManyDetails"
- :key="index"
- >
- <h2>
- <span
- :style="{
- color: colorObj.titleColor,
- fontSize: titleFontsize + 'px',
- lineHeight: titleFontsize + 8 + 'px',
- marginRight: '10px',
- fontWeight: '700',
- cursor: 'pointer',
- wordBreak: 'break-word',
- }"
- >{{ itemA.art_title }}</span
- >
- </h2>
- <h6
- class="nnpe-article-author"
- :style="{
- color: colorObj.sourceColor,
- fontSize: wordFontsize - 4 + 'px',
- lineHeight: wordFontsize + 4 + 'px',
- fontWeight: '400',
- }"
- >
- {{
- itemA.art_author +
- " · " +
- itemA.study_phase_name +
- "版 · 第 " +
- itemA.iss_no +
- " 期 · " +
- itemA.release_date +
- " · " +
- itemA.chn_item +
- (itemA.page_no_in_pub ? " · P" + itemA.page_no_in_pub : "")
- }}
- {{ printForm.info.length > 0 ? " | " : "" }}
- {{
- printForm.info.indexOf("wordLength") > -1
- ? " 长度 " + itemA.art_corpus_data.artStatInfo.wc
- : ""
- }}
- {{
- printForm.info.indexOf("wordNumber") > -1
- ? " · 词数 " + itemA.art_corpus_data.artStatInfo.wdc
- : ""
- }}
- {{
- printForm.info.indexOf("difficulty") > -1
- ? " · 难度 " + itemA.art_corpus_data.artStatInfo.vocabHardLevel
- : ""
- }}
- </h6>
- <template v-if="itemA.resArr.length > 0 && itemA.en_flag">
- <div class="table-box">
- <div
- :class="['NNPE-detail']"
- v-for="(item, index) in itemA.resArr"
- :key="'detail' + index"
- >
- <div class="wordsList-box">
- <template v-if="index !== 0">
- <div class="nnpe-sentence-box">
- <div
- v-for="(pItem, pIndex) in item.wordsList"
- :key="'wordsList' + pIndex"
- class="word-box"
- :class="[
- pItem.isExplain || pItem.explainNumber
- ? 'hasExplain'
- : '',
- ]"
- >
- <!-- <template v-if="pItem.isShow"> -->
- <template v-if="pItem.tokens[2] === '#@@#'">
- <span
- class="NNPE-chs"
- :style="{
- width: printForm.fontSize + 'px',
- height:
- printForm.fontSize * printForm.lineHeight + 'px',
- display: 'block',
- fontFamily: printForm.fontFamily,
- }"
- ></span>
- </template>
- <template v-else>
- <div :class="['NNPE-words']">
- <span
- class="NNPE-chs"
- :class="[
- pItem.noBefore ? 'marginLeft' : '',
- pItem.noAfter ? 'marginRight' : '',
- (pItem.highIndex &&
- printForm.bold.indexOf(pItem.types) > -1) ||
- (printForm.bold.indexOf('sentence') > -1 &&
- longSentIds.indexOf(pItem.sent_id) > -1)
- ? 'fontWeight'
- : '',
- pItem.marginRigh ? 'marginSingleRight' : '',
- ]"
- :style="{
- fontSize: printForm.fontSize + 'px',
- color: printForm.color,
- lineHeight: printForm.lineHeight,
- fontFamily: printForm.fontFamily,
- }"
- >{{ pItem.tokens[2] }}</span
- >
- <!-- <span
- class="NNPE-chs NNPE-chs-both"
- v-if="
- item.wordsList[pIndex + 1] &&
- item.wordsList[pIndex + 1].tokens[2] &&
- enFhList.indexOf(
- item.wordsList[pIndex + 1].tokens[2]
- ) > -1
- "
- :class="[
- item.wordsList[pIndex + 1].tokens[8] === ''
- ? 'marginLeft'
- : '',
- (item.wordsList[pIndex + 1].highIndex &&
- printForm.bold.indexOf(
- item.wordsList[pIndex + 1].types
- ) > -1) ||
- (printForm.bold.indexOf('sentence') > -1 &&
- longSentIds.indexOf(
- item.wordsList[pIndex + 1].sent_id
- ) > -1)
- ? 'fontWeight'
- : '',
- item.wordsList[pIndex + 1].marginRight
- ? 'marginSingleRight'
- : '',
- ]"
- :style="{
- fontSize: printForm.fontSize + 'px',
- color: printForm.color,
- lineHeight: printForm.lineHeight,
- fontFamily: printForm.fontFamily,
- }"
- >{{ item.wordsList[pIndex + 1].tokens[2] }}</span
- > -->
- </div>
- </template>
- <!-- </template> -->
- </div>
- </div>
- </template>
- </div>
- <template
- v-if="
- itemA.articleImg &&
- itemA.articleImg[index] &&
- printForm.range.indexOf('image') > -1
- "
- >
- <figure
- v-for="(itemI, indexI) in itemA.articleImg[index]"
- :key="indexI"
- style="text-align: center"
- >
- <img
- @load="handleImageLoad($event, itemI)"
- :style="{
- width: itemI.width,
- height: itemI.height,
- }"
- :src="itemI.src"
- />
- <!-- <el-image
- :src="itemI.src"
- fit="contain"
- :style="{
- width: itemI.width,
- height: itemI.height,
- }"
- :preview-src-list="[itemI.src]"
-
- ></el-image> -->
- </figure>
- </template>
- </div>
- </div>
- </template>
- <div
- v-else
- class="cn-content"
- v-html="itemA.art_content"
- :style="{
- color: printForm.color,
- fontSize: printForm.fontSize + 'px',
- lineHeight: printForm.lineHeight,
- }"
- ></div>
- <template v-if="printForm.range.indexOf('vocab') > -1">
- <h5>词表</h5>
- <ul class="newwordlist">
- <li
- v-for="(itemW, indexW) in itemA.wordLit"
- :key="indexW"
- :class="['li-' + colorObj.type]"
- >
- <div class="word-info">
- <div class="word-info-top">
- <b class="word" :style="{ color: colorObj.newWordColor }">{{
- itemW.word
- }}</b>
- <span
- class="symbol"
- :style="{ color: colorObj.newWordOtherColor }"
- >{{ itemW.symbol }}</span
- >
- <label
- class="word-type"
- :style="{
- color: colorObj.newWordType[itemW.type]
- ? colorObj.newWordType[itemW.type].color
- : '',
- background: colorObj.newWordType[itemW.type]
- ? colorObj.newWordType[itemW.type].bg
- : '',
- }"
- >{{ itemW.typeCn }}</label
- >
- <span class="star" v-if="itemW.rate">
- <svg-icon
- icon-class="star-filled"
- v-for="(itemS, indexS) in itemW.rate"
- :key="indexS"
- :style="{ color: colorObj.newWordStar }"
- ></svg-icon>
- </span>
- <div class="para-list">
- <div
- class="para"
- v-for="(itemP, indexP) in itemW.paraList"
- :key="indexP"
- >
- <span
- class="cixing"
- :style="{ color: colorObj.newWordOtherColor }"
- >{{ itemP.cixing }}</span
- >
- <span
- class="shiyi"
- :style="{ color: colorObj.newWordOtherColor }"
- >{{ itemP.para }}</span
- >
- </div>
- </div>
- </div>
- </div>
- </li>
- </ul>
- <h5 v-if="itemA.art_phrase_data && itemA.art_phrase_data.length > 0">
- 短语
- </h5>
- <ul
- class="phraselist"
- v-if="itemA.art_phrase_data && itemA.art_phrase_data.length > 0"
- >
- <li v-for="(itemW, indexW) in itemA.phraseList" :key="indexW">
- <div class="word-info">
- <div class="word-info-top">
- <b
- class="phrase"
- :style="{ color: colorObj.phraseColor }"
- @click="showItem(itemW, indexW)"
- >{{ itemW.exp_title }}</b
- >
- <div class="para-list">
- <div class="para">
- <span
- class="shiyi"
- :style="{ color: colorObj.phraseOhterColor }"
- >{{ itemW.exp_content }}</span
- >
- </div>
- </div>
- </div>
- </div>
- </li>
- </ul>
- <h5
- v-if="itemA.art_explain_data && itemA.art_explain_data.length > 0"
- >
- 注释
- </h5>
- <ul
- class="explainlist"
- v-if="itemA.art_explain_data && itemA.art_explain_data.length > 0"
- >
- <li v-for="(itemW, indexW) in itemA.art_explain_data" :key="indexW">
- <b class="prefix" :style="{ color: colorObj.phraseOhterColor }">{{
- itemW.exp_title
- }}</b>
- <div
- class="para-list"
- :style="{ color: colorObj.newWordOtherColor }"
- v-html="itemW.exp_content"
- ></div>
- </li>
- </ul>
- </template>
- <template v-if="printForm.range.indexOf('ciyun') > -1">
- <iframe
- class="ciyun-box"
- width="100%"
- height="720px"
- border="none"
- :src="
- './ciyun/ciyunPrint.html?partitionKey=1&searchType=2&articleId=' +
- itemA.id
- "
- ></iframe>
- </template>
- <template v-if="printForm.range.indexOf('notes') > -1">
- <h5 v-if="itemA.notesList.length > 0">笔记</h5>
- <ul class="explainlist">
- <li v-for="(itemW, indexW) in itemA.notesList" :key="indexW">
- <b class="prefix" :style="{ color: colorObj.phraseOhterColor }">{{
- itemW.select_text
- }}</b>
- <div
- class="para-list"
- :style="{ color: colorObj.newWordOtherColor }"
- v-html="itemW.note"
- ></div>
- </li>
- </ul>
- </template>
- </div>
- <footer class="print-footer">
- <span>{{ printForm.school }}</span>
- <span>{{ printForm.className }}</span>
- <span>{{ printForm.name }}</span>
- <span style="flex: 1"></span>
- <span>{{ printForm.dateStr }}</span>
- <span>{{ printForm.momo }}</span>
- </footer>
- </div>
- </div>
- </template>
- <script>
- import waterMark from "../../../store/watermark";
- import { getToken } from "@/utils/auth";
- import { getLogin } from "@/api/ajax";
- import html2pdf from "html2pdf.js";
- export default {
- props: [
- "titleFontsize",
- "wordFontsize",
- "colorObj",
- "articleType",
- "articleInfo",
- "likePhraseList",
- "likeWord",
- "articleImg",
- ],
- data() {
- return {
- userMessage: getToken() ? JSON.parse(getToken()) : null,
- articleId: this.$route.query.id ? this.$route.query.id : "",
- issId: this.$route.query.iss_id ? this.$route.query.iss_id : "",
- resArr: [],
- enFhList: [
- ",",
- ".",
- ";",
- "?",
- "!",
- ":",
- ">",
- "<",
- "'",
- "’",
- "n't",
- "n’t",
- "n’ts",
- "n‘t",
- "'t",
- "’t",
- "‘t",
- "'s",
- "’s",
- "‘s",
- "'m",
- "’m",
- "‘m",
- "'re",
- "’re",
- "‘re",
- "'d",
- "’d",
- "‘d",
- "'ve",
- "’ve",
- "‘ve",
- ")",
- "'ll",
- "’ll",
- "‘ll",
- "”",
- ],
- firstEnFhlist: ["'", "‘", "“", '"', "("],
- sentenceList: [],
- longSentIds: [], // 长句id
- allWordList: [], // 生词短语注释总列表
- wordLit: [],
- annotationList: [],
- phraseList: [],
- notesList: [], // 笔记列表
- fontList: [
- {
- value: "roman",
- name: "Times New Roman",
- },
- {
- value: "Arial",
- name: "Arial",
- },
- ],
- lineHeightList: [
- {
- value: "0.8",
- name: "0.8倍",
- },
- {
- value: "1.0",
- name: "1.0倍",
- },
- {
- value: "1.5",
- name: "1.5倍",
- },
- {
- value: "2.0",
- name: "2.0倍",
- },
- ],
- rangeList: [
- {
- value: "image",
- name: "图片",
- },
- {
- value: "vocab",
- name: "词表",
- },
- // {
- // value: "ciyun",
- // name: "词云",
- // },
- {
- value: "notes",
- name: "笔记",
- },
- ],
- boldList: [
- {
- value: "newWord",
- name: "生词",
- },
- {
- value: "phrase",
- name: "短语",
- },
- {
- value: "sentence",
- name: "长句",
- },
- ],
- infoList: [
- {
- value: "wordLength",
- name: "长度",
- },
- {
- value: "wordNumber",
- name: "词数",
- },
- {
- value: "difficulty",
- name: "难度",
- },
- ],
- printForm: {
- fontFamily: "roman",
- fontSize: 24,
- color: "#2F3742",
- lineHeight: "1.5",
- range: [],
- bold: ["newWord", "phrase"],
- info: [],
- name: "",
- school: "",
- className: "",
- dateStr: "",
- momo: "",
- },
- isPrint: false,
- printNumber: 0,
- issDetail: null, // 整期文章内容
- issDetailMap: {}, // 整期文章详情map
- printManyFlag: false,
- printManyId: [], // 打印多篇文章id
- loading: false,
- printManyMenu: [], // 打印多篇文章目录
- printManyDetails: [], // 最终确定打印文章内容详情
- isPrintMore: false,
- };
- },
- created() {
- if (this.articleInfo.en_flag) {
- this.rangeList = [
- {
- value: "image",
- name: "图片",
- },
- {
- value: "vocab",
- name: "词表",
- },
- // {
- // value: "ciyun",
- // name: "词云",
- // },
- {
- value: "notes",
- name: "笔记",
- },
- ];
- } else {
- this.rangeList = [
- {
- value: "vocab",
- name: "词表",
- },
- // {
- // value: "ciyun",
- // name: "词云",
- // },
- {
- value: "notes",
- name: "笔记",
- },
- ];
- }
- this.getIssueDetail();
- },
- methods: {
- goBack() {
- this.$emit("closePrint");
- },
- handleData() {
- let explainNumber = 1;
- let resArr = [];
- let articleInfo = JSON.parse(JSON.stringify(this.articleInfo));
- this.sentenceList =
- articleInfo.art_corpus_data && articleInfo.art_corpus_data.sentList
- ? articleInfo.art_corpus_data.sentList
- : [];
- this.longSentIds =
- articleInfo.art_corpus_data && articleInfo.art_corpus_data.artStatInfo
- ? articleInfo.art_corpus_data.artStatInfo.longSentIds
- : [];
- this.wordLit = articleInfo.art_voc_data ? articleInfo.art_voc_data : [];
- this.annotationList = articleInfo.art_phrase_data
- ? articleInfo.art_explain_data
- : [];
- this.phraseList = articleInfo.art_explain_data
- ? articleInfo.art_phrase_data
- : [];
- this.wordLit.forEach((item) => {
- item.types = "newWord";
- item.exp_title = item.word_name;
- let paraStr = "";
- if (item.word_explain && item.word_explain.word_para_list) {
- item.word_explain.word_para_list.forEach((items) => {
- paraStr += items.para;
- });
- }
- item.exp_content = paraStr;
- item.word = item.word_name;
- item.symbol = item.word_explain.ph ? item.word_explain.ph : "";
- item.paraList = item.word_explain.word_para_list;
- item.type = item.word_explain.vl_level
- ? item.word_explain.vl_level
- : "";
- item.typeCn = item.word_explain.vl_level_name
- ? item.word_explain.vl_level_name
- : "";
- item.rate = item.word_explain.star ? item.word_explain.star : null;
- });
- this.phraseList.forEach((item) => {
- item.type = "phrase";
- });
- this.annotationList.forEach((item) => {
- item.type = "explain";
- });
- this.allWordList = this.wordLit.concat(this.phraseList);
- let leg = articleInfo.art_corpus_data
- ? articleInfo.art_corpus_data.sentList[
- articleInfo.art_corpus_data.sentList.length - 1
- ].pno
- : 0;
- this.sentenceList.forEach((item, index) => {
- let flag = "";
- item.StyleTokens = [];
- item.tokens.forEach((items, indexs) => {
- let obj = {
- tokens: items,
- marginRight: indexs === item.tokens.length - 1,
- noBefore: indexs !== 0 && !items[8],
- noAfter: !items[9],
- };
- this.allWordList.forEach((itema, indexa) => {
- itema.bind_sent_data.bind_sents.forEach((itemb, indexb) => {
- if (itemb.sent_id === item.id) {
- if (itema.type === "explain") {
- if (
- indexs ===
- itemb.sel_token_idxes[itemb.sel_token_idxes.length - 1]
- ) {
- obj.highIndex = true;
- obj.type = itema.type;
- obj.types = itema.type;
- obj.word_id = itema.id; // 生词注释短语的id
- obj.explainNumber = explainNumber;
- explainNumber++;
- }
- } else {
- itemb.sel_token_idxes.forEach((itemi) => {
- if (indexs === itemi) {
- obj.highIndex = true;
- obj.type = itema.type;
- obj.types = itema.types ? itema.types : itema.type;
- obj.word_id = itema.id; // 生词注释短语的id
- }
- });
- }
- if (
- itemb.sel_token_idxes.length === 0 &&
- itema.type === "explain" &&
- indexs === item.tokens.length - 1
- ) {
- flag = itema.id;
- }
- }
- });
- });
- item.StyleTokens.push(obj);
- if (flag) {
- item.StyleTokens.push({
- tokens: [
- 0,
- 8,
- "Students",
- "",
- "",
- "",
- "",
- "",
- "",
- " ",
- 0,
- "",
- "",
- "",
- ],
- type: "explain",
- word_id: flag,
- isExplain: true,
- explainNumber: explainNumber,
- });
- explainNumber++;
- }
- });
- });
- for (let i = 0; i < leg + 1; i++) {
- let obgs = {
- isShow: true,
- marginRight: false,
- tokens: [
- "",
- "",
- "#@@#",
- "",
- "",
- "",
- "",
- "",
- " ",
- " ",
- "",
- "",
- "",
- "",
- "",
- ],
- };
- let obj = {
- wordsList: i === 0 ? [] : [obgs, obgs],
- };
- resArr.push(obj);
- }
- this.sentenceList.forEach((item, index) => {
- item.StyleTokens.forEach((items, indexs) => {
- items.isShow = this.enFhList.indexOf(items.tokens[2]) == -1;
- items.sent_id = item.id;
- resArr[item.pno].wordsList.push(items);
- });
- });
- this.resArr = resArr;
- setTimeout(() => {
- waterMark.set(
- this.userMessage.user_name + " " + this.userMessage.phone,
- "",
- "showWaterMark"
- );
- }, 1000);
- },
- // 打印
- handlePrint() {
- let MethodName =
- "/ShopServer/Client/PrintRecordManager/GetMyPrintCount_Article";
- getLogin(MethodName, {
- goods_type: 21,
- date_range: "ALL",
- article_id: this.articleId,
- }).then((res) => {
- if (res.status === 1) {
- if (res.print_count < 5) {
- getLogin(
- "/ShopServer/Client/PrintRecordManager/AddPrintRecord_Article",
- {
- goods_type: 21,
- article_id: this.articleId,
- }
- ).then((res) => {
- if (res.status === 1) {
- }
- });
- this.$nextTick(() => {
- this.$print(this.$refs["printArea"], {
- noPrint: ".noPrint",
- type: "html",
- scanStyles: true,
- showModal: true,
- // style: style,// 亦可使用引入的外部css;
- onStart: () => {
- // console.log("打印开始");
- },
- onEnd: () => {
- // console.log("打印完成");
- },
- });
- });
- } else {
- this.$message.warning("每篇文章打印+下载次数共5次,现已达上限。");
- }
- }
- });
- },
- // 清除
- handleClear() {
- this.printForm.name = "";
- this.printForm.school = "";
- this.printForm.className = "";
- this.printForm.dateStr = "";
- this.printForm.momo = "";
- },
- // 高亮笔记句子
- handleHighSentence() {
- let MethodName = "/PaperServer/Client/Article/ArtNoteListInArt";
- let data = {
- id: this.$route.query.id,
- };
- getLogin(MethodName, data).then((res) => {
- if (res.status === 1) {
- this.notesList = res.data;
- }
- });
- },
- // 下载pdf
- async generatePDF(title) {
- let MethodName =
- "/ShopServer/Client/PrintRecordManager/GetMyPrintCount_Article";
- getLogin(MethodName, {
- goods_type: 21,
- date_range: "ALL",
- article_id: this.articleId,
- }).then((res) => {
- if (res.status === 1) {
- if (res.print_count < 5) {
- getLogin(
- "/ShopServer/Client/PrintRecordManager/AddPrintRecord_Article",
- {
- goods_type: 21,
- article_id: this.articleId,
- }
- ).then((res) => {
- if (res.status === 1) {
- }
- });
- this.$nextTick(() => {
- this.isPrint = true;
- const element = document.getElementById("showWaterMark");
- const opt = {
- margin: [0, 0, 0, 0],
- useCORS: true,
- filename: title + ".pdf",
- image: { type: "jpeg", quality: 0.98 },
- html2canvas: { scale: 2 }, // 或其他自定义设置,例如scale可以放大内容以便更容易阅读和打印。
- jsPDF: { unit: "mm", format: "a4", orientation: "portrait" }, // A4尺寸的PDF,纵向打印。
- };
- html2pdf().set(opt).from(element).save();
- setTimeout(() => {
- this.isPrint = false;
- }, 100);
- });
- } else {
- this.$message.warning("每篇文章打印+下载次数共5次,现已达上限。");
- }
- }
- });
- },
- // 获取整期报刊内容
- getIssueDetail() {
- this.issDetail = null;
- this.issDetailMap = {};
- let MethodName = "/PaperServer/Client/Article/GetIssueDetail";
- getLogin(MethodName, {
- id: this.issId,
- }).then((res) => {
- if (res.status === 1) {
- this.issDetail = res.data;
- if (res.data.articles) {
- this.issDetailMap = res.data.articles.reduce((acc, user) => {
- acc[user.id] = user;
- return acc;
- }, {});
- res.data.articles.forEach((itemA) => {
- let explainNumber = 1;
- let resArr = [];
- let articleInfo = JSON.parse(JSON.stringify(itemA));
- let sentenceList = articleInfo.art_corpus_data
- ? articleInfo.art_corpus_data.sentList
- : [];
- let longSentIds =
- articleInfo.art_corpus_data &&
- articleInfo.art_corpus_data.artStatInfo
- ? articleInfo.art_corpus_data.artStatInfo.longSentIds
- : [];
- let wordLit = articleInfo.art_voc_data
- ? articleInfo.art_voc_data
- : [];
- let annotationList = articleInfo.art_phrase_data
- ? articleInfo.art_explain_data
- : [];
- let phraseList = articleInfo.art_explain_data
- ? articleInfo.art_phrase_data
- : [];
- wordLit.forEach((item) => {
- item.types = "newWord";
- item.exp_title = item.word_name;
- let paraStr = "";
- if (item.word_explain && item.word_explain.word_para_list) {
- item.word_explain.word_para_list.forEach((items) => {
- paraStr += items.para;
- });
- }
- item.exp_content = paraStr;
- item.word = item.word_name;
- item.symbol = item.word_explain.ph ? item.word_explain.ph : "";
- item.paraList = item.word_explain.word_para_list;
- item.type = item.word_explain.vl_level
- ? item.word_explain.vl_level
- : "";
- item.typeCn = item.word_explain.vl_level_name
- ? item.word_explain.vl_level_name
- : "";
- item.rate = item.word_explain.star
- ? item.word_explain.star
- : null;
- });
- phraseList.forEach((item) => {
- item.type = "phrase";
- });
- annotationList.forEach((item) => {
- item.type = "explain";
- });
- let allWordList = wordLit.concat(phraseList);
- let leg =
- articleInfo.art_corpus_data &&
- articleInfo.art_corpus_data.sentList
- ? articleInfo.art_corpus_data.sentList[
- articleInfo.art_corpus_data.sentList.length - 1
- ].pno
- : 0;
- sentenceList.forEach((item, index) => {
- let flag = "";
- item.StyleTokens = [];
- item.tokens.forEach((items, indexs) => {
- let obj = {
- tokens: items,
- marginRight: indexs === item.tokens.length - 1,
- noBefore: indexs !== 0 && !items[8],
- noAfter: !items[9],
- };
- allWordList.forEach((itema, indexa) => {
- itema.bind_sent_data.bind_sents.forEach((itemb, indexb) => {
- if (itemb.sent_id === item.id) {
- if (itema.type === "explain") {
- if (
- indexs ===
- itemb.sel_token_idxes[
- itemb.sel_token_idxes.length - 1
- ]
- ) {
- obj.highIndex = true;
- obj.type = itema.type;
- obj.types = itema.type;
- obj.word_id = itema.id; // 生词注释短语的id
- obj.explainNumber = explainNumber;
- explainNumber++;
- }
- } else {
- itemb.sel_token_idxes.forEach((itemi) => {
- if (indexs === itemi) {
- obj.highIndex = true;
- obj.type = itema.type;
- obj.types = itema.types
- ? itema.types
- : itema.type;
- obj.word_id = itema.id; // 生词注释短语的id
- }
- });
- }
- if (
- itemb.sel_token_idxes.length === 0 &&
- itema.type === "explain" &&
- indexs === item.tokens.length - 1
- ) {
- flag = itema.id;
- }
- }
- });
- });
- item.StyleTokens.push(obj);
- if (flag) {
- item.StyleTokens.push({
- tokens: [
- 0,
- 8,
- "Students",
- "",
- "",
- "",
- "",
- "",
- "",
- " ",
- 0,
- "",
- "",
- "",
- ],
- type: "explain",
- word_id: flag,
- isExplain: true,
- explainNumber: explainNumber,
- });
- explainNumber++;
- }
- });
- });
- for (let i = 0; i < leg + 1; i++) {
- let obgs = {
- isShow: true,
- marginRight: false,
- tokens: [
- "",
- "",
- "#@@#",
- "",
- "",
- "",
- "",
- "",
- " ",
- " ",
- "",
- "",
- "",
- "",
- "",
- ],
- };
- let obj = {
- wordsList: i === 0 ? [] : [obgs, obgs],
- };
- resArr.push(obj);
- }
- sentenceList.forEach((item, index) => {
- item.StyleTokens.forEach((items, indexs) => {
- items.isShow = this.enFhList.indexOf(items.tokens[2]) == -1;
- items.sent_id = item.id;
- resArr[item.pno].wordsList.push(items);
- });
- });
- itemA.resArr = resArr;
- itemA.longSentIds = longSentIds;
- itemA.sentenceList = sentenceList;
- itemA.wordLit = wordLit;
- itemA.annotationList = annotationList;
- itemA.phraseList = phraseList;
- itemA.allWordList = allWordList;
- itemA.articleImg = {};
- let articleArr = itemA.art_content.split('<p class="para"');
- articleArr.forEach((itema) => {
- if (itema.indexOf("<img") > -1) {
- // 当前段落有图片
- let imgArr = [];
- let pno =
- itema.indexOf('pno="') > -1
- ? itema.substring(
- itema.indexOf('pno="') + 5,
- itema
- .substring(itema.indexOf('pno="') + 5)
- .indexOf('"') +
- 1 +
- 5
- )
- : 0;
- let itemArr = itema.split("<img");
- itemArr.forEach((items) => {
- if (items.indexOf('src="') > -1) {
- let indexS =
- items
- .substring(items.indexOf('src="') + 5)
- .indexOf('"') + items.indexOf('src="'); // src所在索引
- let indexW =
- items.indexOf('width="') > -1
- ? items
- .substring(items.indexOf('width="') + 7)
- .indexOf('"')
- : items.indexOf("width: ") > -1
- ? items
- .substring(items.indexOf("width: ") + 7)
- .indexOf(";")
- : -1; // width所在索引
- let indexH =
- items.indexOf('height="') > -1
- ? items
- .substring(items.indexOf('height="') + 8)
- .indexOf('"')
- : items.indexOf("height: ") > -1
- ? items
- .substring(items.indexOf("height: ") + 8)
- .indexOf(";")
- : -1; // height所在索引
- let imgobj = {
- src: items.substring(
- items.indexOf('src="') + 5,
- indexS + 5
- ),
- width:
- items.indexOf('width="') > -1
- ? items.substring(
- items.indexOf('width="') + 7,
- items.indexOf('width="') + indexW + 7
- )
- : items.indexOf("width: ") > -1
- ? items.substring(
- items.indexOf("width: ") + 7,
- items.indexOf("width: ") + indexW + 7
- )
- : null,
- height:
- items.indexOf('height="') > -1
- ? items.substring(
- items.indexOf('height="') + 8,
- items.indexOf('height="') + indexH + 8
- )
- : items.indexOf("height: ") > -1
- ? items.substring(
- items.indexOf("height: ") + 8,
- items.indexOf('height="') + indexH + 8
- )
- : null,
- };
- imgArr.push(imgobj);
- }
- });
- itemA.articleImg[pno] = imgArr;
- }
- });
- let MethodNames = "/PaperServer/Client/Article/ArtNoteListInArt";
- let data = {
- id: itemA.id,
- };
- getLogin(MethodNames, data).then((res) => {
- if (res.status === 1) {
- itemA.notesList = res.data;
- }
- });
- });
- }
- if (res.data.issueInfo) {
- let arr = [];
- res.data.issueInfo.chn_art_data.forEach((item) => {
- let arrs = [];
- item.arts.forEach((items) => {
- arrs.push({
- value: items.id,
- label: items.art_title,
- });
- });
- arr.push({
- value: item.chn_idx,
- label: item.chn_name,
- children: arrs,
- });
- });
- this.printManyMenu = [
- {
- value: res.data.issueInfo.id,
- label: res.data.issueInfo.iss_name,
- children: arr,
- },
- ];
- }
- }
- });
- },
- // 打印多篇按钮
- handleManyPrint() {
- this.printManyFlag = true;
- },
- // 确定打印多篇
- submitPrintMore() {
- this.loading = true;
- let printManyIds = [];
- let printManyDetails = [];
- this.printManyId.forEach((item) => {
- printManyIds.push(item[2]);
- printManyDetails.push(this.issDetailMap[item[2]]);
- });
- this.printManyDetails = printManyDetails;
- this.isPrintMore = true;
- setTimeout(() => {
- waterMark.set(
- this.userMessage.user_name + " " + this.userMessage.phone,
- "",
- "showWaterMarks"
- );
- }, 1000);
- setTimeout(() => {
- this.handlePrintManyDetails();
- }, 1500);
- },
- handlePrintManyDetails() {
- let MethodName =
- "/ShopServer/Client/PrintRecordManager/GetMyPrintCount_Article";
- getLogin(MethodName, {
- goods_type: 21,
- date_range: "ALL",
- article_id: this.articleId,
- }).then((res) => {
- if (res.status === 1) {
- if (res.print_count < 5) {
- getLogin(
- "/ShopServer/Client/PrintRecordManager/AddPrintRecord_Article",
- {
- goods_type: 21,
- article_id: this.articleId,
- }
- ).then((res) => {
- if (res.status === 1) {
- }
- });
- this.$nextTick(() => {
- this.$print(this.$refs["printAreaManys"], {
- noPrint: ".noPrint",
- type: "html",
- scanStyles: true,
- showModal: true,
- // style: style,// 亦可使用引入的外部css;
- onStart: () => {
- // console.log("打印开始");
- },
- onEnd: () => {
- // console.log("打印完成");
- },
- });
- this.loading = false;
- this.printManyFlag = false;
- this.isPrintMore = false;
- });
- } else {
- this.loading = false;
- this.printManyFlag = false;
- this.isPrintMore = false;
- this.$message.warning("每篇文章打印+下载次数共5次,现已达上限。");
- }
- }
- });
- },
- handleImageLoad(event, item) {
- if (!item.width || item.width > 870) {
- item.width =
- event.target.naturalWidth > 870
- ? 870 + "px"
- : event.target.naturalWidth + "px";
- }
- if (!item.height) {
- item.height =
- item.width === "870px" ? "" : event.target.naturalHeight + "px";
- }
- // item.src = this.getBase64Image(
- // "http://cms-bucket.ws.126.net/2021/0114/003bc5dej00qmxg5o0089c000s600e3c.jpg"
- // );
- this.getBase64Image(item);
- },
- getBase64Image(item) {
- var image = new Image();
- image.src = item.src + "?v=" + Math.random(); // 处理缓存
- image.crossOrigin = "*"; // 支持跨域图片
- image.onload = () => {
- var canvas = document.createElement("canvas");
- canvas.width = image.width;
- canvas.height = image.height;
- var context = canvas.getContext("2d");
- context.drawImage(image, 0, 0, image.width, image.height);
- var quality = 0.8;
- let dataurl = canvas.toDataURL("image/jpeg", quality);
- // this.url = dataurl;
- item.src = dataurl;
- this.$forceUpdate();
- };
- },
- },
- mounted() {
- if (this.articleInfo) {
- this.handleData();
- this.handleHighSentence();
- }
- this.$nextTick(() => {
- document.onselectstart = new Function("event.returnValue=false");
- });
- },
- beforeDestroy() {
- document.onselectstart = new Function("event.returnValue=true");
- },
- };
- </script>
- <style lang="scss" scoped>
- .print-model {
- background: #f2f3f5;
- &-top {
- padding: 8px 16px;
- border-bottom: 1px solid #ebebeb;
- background: #fff;
- display: flex;
- align-items: center;
- width: 100%;
- position: fixed;
- top: 0;
- left: 0;
- z-index: 10000;
- .goback {
- color: #2f3742;
- font-size: 20px;
- font-weight: 500;
- line-height: 28px;
- padding-right: 12px;
- .el-icon-arrow-left {
- width: 24px;
- height: 24px;
- }
- }
- .border {
- background: #e5e6eb;
- height: 16px;
- margin-top: 2px;
- width: 1px;
- }
- p {
- margin: 0 12px;
- color: #1c2129;
- font-size: 14px;
- font-weight: 500;
- line-height: 22px;
- }
- }
- &-bottom {
- display: flex;
- justify-content: center;
- padding-top: 46px;
- &-left {
- // width: 1070px;
- flex: 1;
- margin: 8px 370px 8px 8px;
- background: #fff;
- flex-shrink: 0;
- .print-inner {
- overflow: auto;
- padding: 120px 100px 30px 100px;
- }
- .nnpe-article-author {
- margin: 24px 0;
- text-align: center;
- }
- h2 {
- display: flex;
- flex-flow: wrap;
- justify-content: center;
- }
- .table-box {
- // background: #f7f7f7;
- // border-top: 1px solid rgba(0, 0, 0, 0.1);
- :last-child {
- :last-child.wordsList-box {
- padding-bottom: 40px;
- }
- }
- .wordsList-box {
- flex: 1;
- // padding: 6px 0 12px 0;
- .nnpe-sentence-box {
- display: flex;
- flex-flow: wrap;
- .word-box {
- position: relative;
- }
- }
- > img {
- max-width: 50%;
- display: block;
- padding: 16px 0;
- margin: 0 auto;
- }
- }
- }
- .NNPE-detail {
- clear: both;
- overflow: hidden;
- // display: flex;
- .NNPE-words {
- float: left;
- padding: 0;
- &.noPadding {
- padding: 0;
- }
- &.sentActive {
- background: rgba(24, 144, 255, 0.1);
- }
- &.overActive {
- background: rgba(0, 0, 0, 0.06);
- }
- > span {
- float: left;
- &.NNPE-chs {
- // font-size: 24px;
- font-family: "Smartisan";
- line-height: 150%;
- color: #000000;
- padding: 0 3px;
- &.wordActive {
- color: #175dff !important;
- }
- &.marginRight {
- padding-right: 0;
- }
- &.marginLeft {
- padding-left: 0;
- }
- &.marginSingleRight {
- padding-right: 3px;
- }
- &.fontWeight {
- font-weight: bold;
- }
- &.newWord {
- color: #3459d2 !important;
- }
- &.phrase {
- color: #ff802b !important;
- }
- &.explain {
- // color: #23C847 !important;
- font-weight: 400;
- }
- }
- &.padding {
- padding: 0 3px;
- cursor: pointer;
- }
- }
- }
- }
- h5 {
- color: #000;
- font-size: 36px;
- font-weight: 700;
- line-height: 44px;
- margin: 24px 0;
- }
- .newwordlist,
- .phraselist {
- li {
- padding: 4px;
- display: flex;
- margin: 1px 0;
- border-radius: 4px;
- .word-info {
- flex: 1;
- }
- .sentence {
- font-size: 14px;
- line-height: 22px;
- color: #2f3742;
- }
- .word-type {
- padding: 0px 8px;
- border-radius: 2px;
- font-weight: 500;
- font-size: 12px;
- line-height: 20px;
- height: 20px;
- margin: 4px 8px 0 0;
- }
- .el-icon-arrow-right {
- width: 24px;
- height: 24px;
- color: #929ca8;
- text-align: center;
- line-height: 24px;
- cursor: pointer;
- }
- .word-info-top {
- display: flex;
- .word {
- font-weight: 700;
- font-size: 20px;
- line-height: 28px;
- color: #175dff;
- margin-right: 8px;
- font-family: "Arial";
- cursor: pointer;
- }
- .phrase {
- font-weight: 500;
- font-size: 24px;
- line-height: 32px;
- color: #ed5f00;
- max-width: 60%;
- word-break: break-word;
- }
- .symbol {
- font-size: 20px;
- line-height: 28px;
- color: #667180;
- margin-right: 8px;
- font-family: "Arial";
- }
- .star {
- margin-right: 8px;
- line-height: 20px;
- }
- .para-list {
- flex: 1;
- .para {
- display: flex;
- font-size: 16px;
- line-height: 24px;
- color: #1c2129;
- margin-bottom: 4px;
- .cixing {
- margin-right: 4px;
- }
- }
- }
- }
- .word-info-bottom {
- font-size: 12px;
- line-height: 20px;
- color: #929ca8;
- margin: 4px 8px 0 0;
- span {
- margin-right: 8px;
- }
- }
- }
- }
- .phraselist {
- .para {
- line-height: 32px !important;
- margin-left: 8px;
- margin-bottom: 0 !important;
- }
- }
- .explainlist {
- li {
- padding: 8px;
- margin: 4px 0;
- .prefix {
- color: #151515;
- font-size: 24px;
- font-weight: 700;
- line-height: 32px;
- }
- .para-list {
- color: #2f3742;
- font-size: 16px;
- font-weight: 500;
- line-height: 24px;
- margin-top: 8px;
- }
- }
- }
- }
- &-right {
- width: 360px;
- padding: 24px 0;
- background: #fff;
- position: fixed;
- z-index: 1;
- top: 46px;
- right: 0px;
- height: calc(100% - 48px);
- .config-box {
- height: calc(100% - 110px);
- overflow: auto;
- padding: 0 24px;
- }
- h3 {
- color: #2f3742;
- font-size: 24px;
- font-weight: 400;
- line-height: 32px;
- margin: 0;
- padding: 0 24px;
- .svg-icon {
- width: 24px;
- height: 24px;
- margin-right: 8px;
- }
- }
- }
- }
- }
- .item-page {
- display: flex;
- padding-top: 24px;
- > label {
- color: #2f3742;
- text-align: right;
- font-size: 14px;
- font-weight: 500;
- line-height: 30px;
- width: 72px;
- margin-right: 16px;
- flex-shrink: 0;
- }
- .el-select {
- height: 32px;
- border-radius: 2px;
- width: 202px;
- }
- .el-button {
- width: 70px;
- padding: 8px 0;
- color: rgba(0, 0, 0, 0.91);
- font-size: 14px;
- font-weight: 400;
- line-height: 22px;
- border-radius: 4px;
- background: #ebebeb;
- border: none;
- }
- .el-button--primary {
- background: #3459d2;
- color: #fff;
- }
- > b {
- flex: 1;
- text-align: right;
- cursor: pointer;
- line-height: 30px;
- color: #175dff;
- font-size: 14px;
- font-weight: 400;
- .svg-icon {
- width: 12px;
- margin-right: 4px;
- }
- }
- }
- .print-divider {
- margin: 24px 0 0 0;
- background-color: #f2f3f5;
- }
- #showWaterMark,
- #showWaterMarks {
- overflow: hidden;
- position: relative;
- z-index: 9999;
- // width: 210mm;
- }
- .print-footer {
- width: 100%;
- min-height: 22px;
- padding: 30px 96px;
- color: #667180;
- font-size: 14px;
- font-weight: 700;
- line-height: 22px;
- display: flex;
- justify-content: space-between;
- span {
- margin: 0 4px;
- }
- }
- .ciyun-box {
- width: 870px;
- height: 720px;
- border: none;
- overflow: hidden;
- }
- @media print {
- .no-print {
- display: none;
- }
- body {
- margin-top: 0;
- margin-bottom: 0;
- padding-top: 0;
- padding-bottom: 0;
- }
- .printheader {
- font-size: 50px;
- color: green;
- font-weight: bold;
- position: fixed;
- top: 0;
- left: 0;
- z-index: 10000;
- }
- .printFotter {
- position: fixed;
- left: 0;
- bottom: 0;
- z-index: 100000;
- }
- .print-footer {
- position: fixed;
- bottom: -30px;
- left: 10px;
- }
- @page {
- margin: 30px 30px 60px 30px;
- }
- #showWaterMark,
- #showWaterMarks {
- margin: 0;
- }
- }
- :deep .image img {
- max-width: 100%;
- }
- :deep figure {
- margin: 1em 0;
- text-align: center;
- img {
- max-width: 70%;
- }
- }
- </style>
- <style lang="scss">
- .item-page {
- .el-input__inner {
- height: 32px;
- line-height: 32px;
- background: #f2f3f5;
- border: none;
- }
- .el-input__icon {
- line-height: 32px;
- }
- .el-input-number {
- line-height: 30px;
- width: 202px;
- }
- .el-input-number__decrease,
- .el-input-number__increase {
- height: 30px;
- width: 30px;
- }
- .el-checkbox {
- margin-right: 12px;
- line-height: 30px;
- }
- .el-checkbox__input.is-checked + .el-checkbox__label {
- color: #2f3742;
- }
- .el-checkbox__input.is-checked .el-checkbox__inner,
- .el-checkbox__input.is-indeterminate .el-checkbox__inner {
- background-color: #3459d2;
- border-color: #3459d2;
- }
- }
- </style>
|