index.vue 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854
  1. <!-- -->
  2. <template>
  3. <div
  4. class="NPC-Book-Article Big-Book-Maxwidth"
  5. v-if="curQue"
  6. v-loading="loading"
  7. >
  8. <div class="adult-book-input-item">
  9. <span class="adult-book-lable">序号:</span>           
  10. <el-input
  11. style="width: 300px"
  12. placeholder="请输入序号"
  13. v-model="curQue.title"
  14. @blur="onBlur(curQue, 'number')"
  15. class="adult-book-input"
  16. ></el-input>
  17. </div>
  18. <div class="Big-Book-img">
  19. <UploadArt
  20. :change-fill-id="changeImage"
  21. :datafile-list="fileCon.img_list"
  22. upload-type="image"
  23. class="article_pdf"
  24. :filleNumber="imageNumber"
  25. />
  26. <ul
  27. class="uploadArt_list"
  28. v-if="curQue.img_list && curQue.img_list.length > 0"
  29. >
  30. <li
  31. v-for="(artItem, artIndex) in curQue.img_list"
  32. :key="'articleImgList' + artIndex"
  33. >
  34. <img :src="artItem.url" style="width: 26px" />
  35. <span class="art_name">{{ artItem.name }}</span>
  36. <p>
  37. 图片放到第<el-input
  38. class="imgNumber"
  39. type="number"
  40. v-model="artItem.imgNumber"
  41. size="mini"
  42. @input="forceUpdate"
  43. ></el-input
  44. >段落的后面
  45. </p>
  46. <img
  47. src="@/assets/adult/del-close.png"
  48. class="del-close"
  49. @click="delImage(artIndex)"
  50. />
  51. </li>
  52. </ul>
  53. </div>
  54. <div class="Big-Book-mp3">
  55. <Upload
  56. type="mp3"
  57. :changeFillId="changeMp3"
  58. :datafileList="fileCon.mp3_list"
  59. :filleNumber="mp3Number"
  60. :uploadType="'mp3'"
  61. :handleMp3Base64="handleChange"
  62. />
  63. </div>
  64. <div class="adult-book-input-item">
  65. <span class="adult-book-lable">功能配置:</span>
  66. <div class="adult-book-main" v-if="curQue.checkList">
  67. <el-checkbox-group v-model="curQue.checkList">
  68. <el-checkbox :label="1">显示生词功能</el-checkbox>
  69. <el-checkbox :label="2">语音练习模式</el-checkbox>
  70. <el-checkbox :label="3">取词功能</el-checkbox>
  71. </el-checkbox-group>
  72. </div>
  73. </div>
  74. <div class="adult-book-input-item">
  75. <span class="adult-book-lable">文章提示:</span>
  76. <el-input
  77. class="adult-book-input"
  78. type="textarea"
  79. :autosize="{ minRows: 2 }"
  80. placeholder="请输入文章提示"
  81. v-model="curQue.notice"
  82. @blur="onBlur(curQue, 'notice')"
  83. ></el-input>
  84. </div>
  85. <div class="NPC-Book-role">
  86. <ul class="adult-book-input-role" v-if="curQue.roleList.length > 0">
  87. <li
  88. v-for="(rItem, rIndex) in curQue.roleList"
  89. :key="'roleList' + rIndex"
  90. >
  91. <div class="rItem" @click="editRole(rItem)">
  92. <span v-if="rItem.role" class="adult-book-input-roleText">{{
  93. rItem.role
  94. }}</span>
  95. <img
  96. v-else
  97. :src="rItem.img_list[0] && rItem.img_list[0].url"
  98. class="adult-book-input-roleImg"
  99. />
  100. <template v-if="rItem.detail.wordsList.length > 0">
  101. <span class="pinyin">{{
  102. rItem.detail.wordsList | handlePinyin
  103. }}</span>
  104. <span class="chs">{{ rItem.detail.wordsList | handleChs }}</span>
  105. </template>
  106. </div>
  107. <i class="el-icon-circle-close" @click="delRole(rIndex)"></i>
  108. </li>
  109. </ul>
  110. <el-button type="primary" @click="addRole">添加角色</el-button>
  111. </div>
  112. <div class="NPC-Book-article">
  113. <ArticleChs
  114. :curQue="curQue"
  115. :isPara="isPara"
  116. :changeIsPara="changeIsPara"
  117. />
  118. </div>
  119. <template
  120. v-if="
  121. curQue.mp3_list &&
  122. curQue.mp3_list.length > 0 &&
  123. curQue.mp3_list[0].source
  124. "
  125. >
  126. <div class="create_mp3_list">
  127. <span>引擎音频:</span>
  128. <span class="mp3_file_name">{{ curQue.mp3_list[0].name }}</span>
  129. <img
  130. src="../../../../assets/adult/del-close.png"
  131. class="mp3_del"
  132. @click="delMp3"
  133. />
  134. </div>
  135. </template>
  136. <template v-else>
  137. <el-button :loading="CreadMp3loading" size="small" @click="CreadMp3"
  138. >生成音频</el-button
  139. >
  140. </template>
  141. <div class="NPC-Book-Paragraph" v-if="isPara">
  142. <Paragraph :curQue="curQue" :isClause="isClause" :sureSeg="sureSeg" />
  143. </div>
  144. <div class="NPC-Book-model">
  145. <span class="adult-book-input-lable">拼音位置:</span>
  146. <el-radio-group v-model="curQue.pyPosition">
  147. <el-radio :label="'top'">字上面</el-radio>
  148. <el-radio :label="'bottom'">字下面</el-radio>
  149. </el-radio-group>
  150. </div>
  151. <!---上传rlc文件-->
  152. <!-- <div class="NPC-Book-Paragraph" v-if="isClause">
  153. <el-button
  154. type="warning"
  155. size="small"
  156. @click="uploadLRC"
  157. v-if="curQue.detail[0].timeList.length == 0"
  158. >上传lrc文件</el-button
  159. >
  160. <div v-else class="lrc-box">
  161. <span>已有字幕时间节点</span>
  162. <el-button type="text" @click="editTimeList">去编辑</el-button>
  163. </div>
  164. </div> -->
  165. <!---分句-->
  166. <div class="NPC-Book-Paragraph" v-if="isClause">
  167. <Clauseresult :curQue="curQue" :segByWord="segByWord" />
  168. </div>
  169. <div class="lrc-box">
  170. <div
  171. v-if="this.curQue.wordTime && this.curQue.wordTime.length > 0"
  172. class="lrc-box"
  173. >
  174. <span>已有字幕时间节点</span>
  175. <el-button type="text" @click="againWordTime">重新生成</el-button>
  176. <el-button @click="compareTime('句子')" size="medium"
  177. >校对句子字幕时间</el-button
  178. >
  179. <el-button @click="compareTime('文字')" size="medium"
  180. >校对文字字幕时间</el-button
  181. >
  182. </div>
  183. <template v-else>
  184. <el-button v-if="!isWordTime" size="medium" @click="createWordTime"
  185. >自动生成字幕节点</el-button
  186. >
  187. <p v-else>字幕节点生成中...请等待</p>
  188. </template>
  189. </div>
  190. <!---分词-->
  191. <div class="NPC-Book-Word" v-if="isByWord">
  192. <Segbyword :curQue="curQue" :paraIndex="paraIndex" :segList="segList" />
  193. </div>
  194. <el-dialog title="段落分句字幕打点" :visible.sync="cTVisible" width="30%">
  195. <Createtimelist ref="createtimelist" :curQue="curQue" />
  196. <span slot="footer" class="dialog-footer">
  197. <el-button @click="cTVisible = false">取 消</el-button>
  198. <el-button type="primary" @click="saveTimeList">保 存</el-button>
  199. </span>
  200. </el-dialog>
  201. <el-dialog
  202. :title="roleStatus == 1 ? '添加角色' : '编辑角色'"
  203. :visible.sync="roleVisible"
  204. width="60%"
  205. >
  206. <template v-if="roleStatus == 1">
  207. <RoleChs
  208. ref="createRolelist"
  209. :curRole="curQue.roleList[curQue.roleList.length - 1]"
  210. />
  211. </template>
  212. <template v-else>
  213. <RoleChs ref="createRolelist" :curRole="curRole" />
  214. </template>
  215. <span slot="footer" class="dialog-footer">
  216. <el-button @click="roleVisible = false">取 消</el-button>
  217. <el-button type="primary" @click="saveRoleList">保 存</el-button>
  218. </span>
  219. </el-dialog>
  220. <el-dialog
  221. title="校对字幕时间"
  222. :visible.sync="compareShow"
  223. width="50%"
  224. :before-close="handleClose"
  225. top="0"
  226. >
  227. <CompareTime
  228. :data="compareData"
  229. :type="compareType"
  230. :changewordsResultList="changewordsResultList"
  231. />
  232. <span slot="footer" class="dialog-footer">
  233. <el-button @click="handleClose">取 消</el-button>
  234. <el-button :loading="compareloading" type="primary" @click="saveCompare"
  235. >确 定</el-button
  236. >
  237. </span>
  238. </el-dialog>
  239. </div>
  240. </template>
  241. <script>
  242. import {
  243. segSentences,
  244. BatchSegContent,
  245. createPinyin,
  246. prepareTranscribe,
  247. getWordTime,
  248. compareSenTenceTime,
  249. getContentFile,
  250. textCreadMp3,
  251. } from "@/api/ajax";
  252. const Base64 = require("js-base64").Base64;
  253. import Upload from "../../common/Upload.vue";
  254. import UploadArt from "../../common/UploadArt.vue";
  255. import ArticleChs from "./components/ArticleChs.vue";
  256. import Paragraph from "./components/ParagraphChs.vue";
  257. import Clauseresult from "./components/ClauseresultChs.vue";
  258. import Segbyword from "./components/SegbywordChs.vue";
  259. import Createtimelist from "./components/CreatetimelistChs.vue";
  260. import RoleChs from "./components/RoleChs.vue";
  261. import CompareTime from "../ArticleTemChs/components/CompareTime.vue";
  262. export default {
  263. name: "DialogueAnswerChs",
  264. components: {
  265. Upload,
  266. UploadArt,
  267. ArticleChs,
  268. Paragraph,
  269. Clauseresult,
  270. Segbyword,
  271. Createtimelist,
  272. RoleChs,
  273. CompareTime,
  274. },
  275. props: ["curQue", "changeCurQue", "tmIndex"],
  276. filters: {
  277. handlePinyin(wordsList) {
  278. let str = "";
  279. wordsList.forEach((item, index) => {
  280. if (index < wordsList.length - 1) {
  281. str += item.pinyin + " ";
  282. } else {
  283. str += item.pinyin;
  284. }
  285. });
  286. return str;
  287. },
  288. handleChs(wordsList) {
  289. let str = "";
  290. wordsList.forEach((item, index) => {
  291. if (index < wordsList.length - 1) {
  292. str += item.chs + " ";
  293. } else {
  294. str += item.chs;
  295. }
  296. });
  297. return str;
  298. },
  299. },
  300. data() {
  301. return {
  302. imageNumber: 1000,
  303. mp3Number: 1,
  304. fileCon: {
  305. img_list: [],
  306. mp3_list: [],
  307. },
  308. isPara: false,
  309. isClause: false,
  310. isByWord: false,
  311. paraIndex: 0, //段落索引
  312. cTVisible: false,
  313. roleVisible: false,
  314. roleStatus: 1, //1添加;2是编辑
  315. curRole: null,
  316. loading: false,
  317. segList: null,
  318. data_structure: {
  319. type: "dialogue_article_chs",
  320. name: "课文",
  321. model: 1,
  322. pyPosition: "top", //top 拼音在上面;bottom 拼音在下面
  323. notice: "", //文章提示信息
  324. mp3_list: [],
  325. img_list: [],
  326. article: "",
  327. roleList: [],
  328. detail: [],
  329. wordTime: [],
  330. taskId: "",
  331. checkList: [1, 2, 3],
  332. },
  333. isWordTime: false,
  334. compareType: "", //校对类型
  335. compareShow: false,
  336. compareData: null,
  337. compareloading: false,
  338. CreadMp3loading: false,
  339. };
  340. },
  341. computed: {},
  342. watch: {},
  343. //方法集合
  344. methods: {
  345. // 得到文件流
  346. getfillLiu() {
  347. this.loading = true;
  348. let _this = this;
  349. return new Promise(function (resolve, reject) {
  350. if (
  351. _this.curQue.mp3_list &&
  352. _this.curQue.mp3_list.length > 0 &&
  353. _this.curQue.mp3_list[0].id
  354. ) {
  355. let Mname = "file_store_manager-GetFileByteBase64Text";
  356. let id = _this.curQue.mp3_list[0].id
  357. .replace("[FID##", "")
  358. .replace("##FID]", "");
  359. let data = {
  360. file_id: id,
  361. };
  362. getContentFile(Mname, data).then((res) => {
  363. let taskIddata = {
  364. fileName: _this.curQue.mp3_list[0].name,
  365. speechBase64: res.base64_text,
  366. language: "ch",
  367. };
  368. prepareTranscribe(taskIddata).then((res) => {
  369. _this.$set(_this.curQue, "taskId", res.data.taskId);
  370. _this.loading = false;
  371. resolve();
  372. });
  373. });
  374. } else {
  375. _this.$message.warning("请先上传音频");
  376. }
  377. });
  378. },
  379. // 根据文章生成MP3
  380. CreadMp3() {
  381. let _this = this;
  382. if (_this.curQue.mp3_list.length > 0) {
  383. _this.$message.warning("已有音频,请勿重复生成");
  384. return;
  385. }
  386. if (!_this.curQue.article) {
  387. _this.$message.warning("请先输入内容,在生成音频");
  388. return;
  389. }
  390. _this.CreadMp3loading = true;
  391. textCreadMp3({
  392. text: _this.curQue.article,
  393. }).then((res) => {
  394. res.data.fileInfo.id = "[FID##" + res.data.fileInfo.file_id + "##FID]";
  395. res.data.fileInfo.name = res.data.fileInfo.file_name;
  396. let fileList = [res.data.fileInfo];
  397. _this.$set(_this.curQue, "mp3_list", fileList);
  398. _this.CreadMp3loading = false;
  399. _this.$message.success("生成成功");
  400. });
  401. },
  402. //删除生成的mp3
  403. delMp3() {
  404. this.curQue.mp3_list.splice(0, 1);
  405. },
  406. // 保存校对
  407. saveCompare() {
  408. this.compareloading = true;
  409. compareSenTenceTime({ matchList: JSON.stringify(this.compareData) }).then(
  410. (res) => {
  411. console.log(res);
  412. this.compareloading = false;
  413. this.curQue.wordTime = res.data.result;
  414. }
  415. );
  416. },
  417. // 校对时间
  418. compareTime(type) {
  419. this.compareType = type;
  420. this.compareData = JSON.parse(JSON.stringify(this.curQue.wordTime));
  421. this.compareShow = true;
  422. },
  423. handleClose() {
  424. this.compareShow = false;
  425. this.compareData = null;
  426. this.compareType = "";
  427. },
  428. // 校对每个字的时间
  429. changewordsResultList(index, item) {
  430. this.curQue.wordTime[index].wordsResultList = JSON.parse(
  431. JSON.stringify(item)
  432. );
  433. },
  434. onBlur(item, field) {
  435. item[field] = item[field] ? item[field].trim() : "";
  436. },
  437. changeMp3(fileList) {
  438. const articleImgList = JSON.parse(JSON.stringify(fileList));
  439. const articleImgRes = [];
  440. articleImgList.forEach((item) => {
  441. if (item.response) {
  442. const obj = {
  443. name: item.name,
  444. duration: item.response.file_info_list[0].media_duration,
  445. url: item.response.file_info_list[0].file_url,
  446. id: "[FID##" + item.response.file_info_list[0].file_id + "##FID]",
  447. media_duration: item.response.file_info_list[0].media_duration, //音频时长
  448. };
  449. articleImgRes.push(obj);
  450. }
  451. });
  452. this.curQue.mp3_list = JSON.parse(JSON.stringify(articleImgRes));
  453. },
  454. changeImage(file) {
  455. console.log(file);
  456. if (file.response) {
  457. const obj = {
  458. name: file.name,
  459. url: file.response.file_info_list[0].file_url,
  460. id: "[FID##" + file.response.file_info_list[0].file_id + "##FID]",
  461. imgNumber: 0,
  462. };
  463. this.curQue.img_list.push(obj);
  464. this.$forceUpdate();
  465. }
  466. },
  467. forceUpdate() {
  468. this.$forceUpdate();
  469. },
  470. delImage(index) {
  471. this.curQue.img_list.splice(index, 1);
  472. this.fileCon.img_list.splice(index, 1);
  473. },
  474. //添加角色
  475. addRole() {
  476. this.roleVisible = true;
  477. this.roleStatus = 1;
  478. let id = Math.random().toString(36).substr(2);
  479. let roleCon = {
  480. id: id,
  481. role: "",
  482. img_list: [],
  483. detail: {
  484. fullName: "",
  485. seg_words: "",
  486. wordsList: [],
  487. },
  488. };
  489. this.curQue.roleList.push(JSON.parse(JSON.stringify(roleCon)));
  490. },
  491. //保存角色
  492. saveRoleList() {
  493. this.roleVisible = false;
  494. this.$message.success("保存成功!");
  495. console.log(this.curQue);
  496. },
  497. //删除角色
  498. delRole(index) {
  499. this.curQue.roleList.splice(index, 1);
  500. },
  501. //点击角色
  502. editRole(item) {
  503. this.roleVisible = true;
  504. this.roleStatus = 2;
  505. this.curRole = item;
  506. },
  507. changeIsPara() {
  508. this.isPara = true;
  509. },
  510. //生成分句
  511. sureSeg() {
  512. let detail = JSON.parse(JSON.stringify(this.curQue.detail));
  513. let leg = detail.length;
  514. let flag = false;
  515. for (let i = 0; i < leg; i++) {
  516. if (!detail[i].para) {
  517. flag = true;
  518. break;
  519. }
  520. }
  521. if (!flag) {
  522. let textList = [];
  523. detail.forEach((item) => {
  524. let str = Base64.encode(item.para);
  525. textList.push(str);
  526. });
  527. this.loading = true;
  528. let data = {
  529. textList: textList,
  530. };
  531. segSentences(data).then((res) => {
  532. this.loading = false;
  533. let result = res.data.result;
  534. result.forEach((item, index) => {
  535. this.$set(this.curQue.detail[index], "sentences", item);
  536. for (let i = 0; i < item.length; i++) {
  537. this.curQue.detail[index].sentencesEn.push("");
  538. }
  539. });
  540. this.isClause = true;
  541. });
  542. } else {
  543. this.$message.warning("段落不能为空");
  544. }
  545. },
  546. changeIsClause(isClause) {
  547. this.isClause = isClause;
  548. },
  549. //生成分词
  550. segByWord(sentences, paraIndex) {
  551. console.log(sentences);
  552. this.loading = true;
  553. let textList = [];
  554. sentences.forEach((item) => {
  555. let str = Base64.encode(item);
  556. textList.push(str);
  557. });
  558. let data = {
  559. textList: textList,
  560. };
  561. BatchSegContent(data).then((res) => {
  562. this.loading = false;
  563. let list = res.data.result.list;
  564. this.$set(this.curQue.detail[paraIndex], "segList", list);
  565. console.log(this.curQue);
  566. this.segList = list;
  567. this.isByWord = true;
  568. this.paraIndex = paraIndex;
  569. });
  570. },
  571. // 上传音频文件
  572. handleChange(file, fileList) {
  573. let _this = this;
  574. _this.getBase64(file.raw).then((res) => {
  575. let base_res = res.split("base64,");
  576. let data = {
  577. fileName: file.raw.name,
  578. speechBase64: base_res[1],
  579. language: "ch",
  580. };
  581. prepareTranscribe(data).then((res) => {
  582. _this.$set(_this.curQue, "taskId", res.data.taskId);
  583. });
  584. });
  585. },
  586. getBase64(file) {
  587. return new Promise(function (resolve, reject) {
  588. let reader = new FileReader();
  589. let imgResult = "";
  590. reader.readAsDataURL(file);
  591. reader.onload = function () {
  592. imgResult = reader.result;
  593. };
  594. reader.onerror = function (error) {
  595. reject(error);
  596. };
  597. reader.onloadend = function () {
  598. resolve(imgResult);
  599. };
  600. });
  601. },
  602. createWordTime() {
  603. this.getfillLiu().then(() => {
  604. if (this.curQue.taskId) {
  605. let verseList = [];
  606. this.curQue.detail.forEach((item) => {
  607. verseList = verseList.concat(item.sentences);
  608. });
  609. console.log(verseList);
  610. if (verseList.length > 0) {
  611. this.isWordTime = true;
  612. let data = {
  613. taskId: this.curQue.taskId,
  614. verseList: JSON.stringify(verseList),
  615. matchType: "chinese",
  616. language: "ch",
  617. };
  618. getWordTime(data).then((res) => {
  619. this.curQue.wordTime = res.data.result;
  620. this.isWordTime = false;
  621. });
  622. }
  623. } else {
  624. this.$message.warning("请先上传音频");
  625. }
  626. });
  627. },
  628. againWordTime() {
  629. this.isWordTime = false;
  630. this.$set(this.curQue, "wordTime", []);
  631. },
  632. uploadLRC() {
  633. this.cTVisible = true;
  634. },
  635. //保存字幕节点
  636. saveTimeList() {
  637. this.cTVisible = false;
  638. let detail = JSON.parse(JSON.stringify(this.$refs.createtimelist.detail));
  639. let detailRes = detail.map((item) => {
  640. let timeList = item.time_str.split("\n");
  641. item.timeList = this.handleTimeReg(timeList);
  642. return item;
  643. });
  644. this.curQue.detail = JSON.parse(JSON.stringify(detailRes));
  645. console.log(this.curQue.detail);
  646. },
  647. handleTimeReg(list) {
  648. list = list.map((item) => {
  649. let regArr = item.split("]");
  650. let reg = regArr[0];
  651. item = reg.replace("[", "");
  652. return item;
  653. });
  654. return list;
  655. },
  656. //点击字幕节点
  657. editTimeList() {
  658. this.cTVisible = true;
  659. },
  660. initCurQueData() {
  661. let res_data = JSON.parse(JSON.stringify(this.data_structure));
  662. this.changeCurQue(res_data);
  663. },
  664. },
  665. //生命周期 - 创建完成(可以访问当前this实例)
  666. created() {},
  667. //生命周期 - 挂载完成(可以访问DOM元素)
  668. mounted() {
  669. console.log("文章保存");
  670. console.log(this.curQue);
  671. if (this.curQue) {
  672. if (!this.curQue.taskId) {
  673. this.curQue.taskId = "";
  674. }
  675. if (!this.curQue.notice) {
  676. this.curQue.notice = "";
  677. }
  678. if (!this.curQue.checkList) {
  679. this.$set(this.curQue, "checkList", [1, 2, 3]);
  680. }
  681. if (this.curQue.detail && this.curQue.detail.length > 0) {
  682. if (this.curQue.detail[0].para) {
  683. this.isPara = true;
  684. }
  685. if (this.curQue.detail[0].sentences.length > 0) {
  686. this.isClause = true;
  687. }
  688. if (this.curQue.detail[0].seg_words.length > 0) {
  689. this.isByWord = true;
  690. }
  691. }
  692. if (!this.curQue.sentencesEn) {
  693. this.curQue.sentencesEn = [];
  694. }
  695. if (!this.curQue.img_list) {
  696. this.curQue.img_list = [];
  697. }
  698. if (!this.curQue.mp3_list) {
  699. this.curQue.mp3_list = [];
  700. }
  701. this.fileCon.img_list = JSON.parse(JSON.stringify(this.curQue.img_list));
  702. let mp3_list = JSON.parse(JSON.stringify(this.curQue.mp3_list));
  703. this.fileCon.mp3_list = mp3_list.filter((item) => item.source !== "tts");
  704. } else {
  705. this.initCurQueData();
  706. }
  707. },
  708. beforeCreate() {}, //生命周期 - 创建之前
  709. beforeMount() {}, //生命周期 - 挂载之前
  710. beforeUpdate() {}, //生命周期 - 更新之前
  711. updated() {}, //生命周期 - 更新之后
  712. beforeDestroy() {}, //生命周期 - 销毁之前
  713. destroyed() {}, //生命周期 - 销毁完成
  714. activated() {}, //如果页面有keep-alive缓存功能,这个函数会触发
  715. };
  716. </script>
  717. <style lang='scss' scoped>
  718. //@import url(); 引入公共css类
  719. .create_mp3_list {
  720. display: flex;
  721. justify-content: flex-start;
  722. align-items: center;
  723. > span {
  724. font-size: 16px;
  725. font-weight: bold;
  726. margin-right: 10px;
  727. }
  728. > img {
  729. width: 24px;
  730. height: 24px;
  731. cursor: pointer;
  732. }
  733. }
  734. p {
  735. margin: 0;
  736. padding: 0;
  737. }
  738. .adult-book-input-role {
  739. clear: both;
  740. overflow: hidden;
  741. > li {
  742. float: left;
  743. display: flex;
  744. justify-content: flex-start;
  745. align-items: center;
  746. padding: 4px 8px;
  747. border: 1px #a7a7a7 solid;
  748. border-radius: 8px;
  749. margin: 0 10px 10px 0px;
  750. .rItem {
  751. display: flex;
  752. justify-content: flex-start;
  753. align-items: center;
  754. .adult-book-input {
  755. &-roleText {
  756. width: 40px;
  757. height: 40px;
  758. background: #a7a7a7;
  759. border-radius: 100%;
  760. text-align: center;
  761. line-height: 40px;
  762. }
  763. &-roleImg {
  764. width: 40px;
  765. height: 40px;
  766. }
  767. }
  768. .pinyin {
  769. font-family: "GB-PINYINOK-B";
  770. font-size: 14px;
  771. line-height: 22px;
  772. color: rgba(0, 0, 0, 0.85);
  773. margin-right: 8px;
  774. margin-left: 8px;
  775. }
  776. .chs {
  777. font-family: "FZJCGFKTK";
  778. font-size: 16px;
  779. line-height: 24px;
  780. color: #000000;
  781. margin-right: 16px;
  782. }
  783. }
  784. > i {
  785. cursor: pointer;
  786. }
  787. }
  788. }
  789. .uploadArt_list {
  790. border: 1px #ccc solid;
  791. border-bottom: 0;
  792. margin-top: 10px;
  793. > li {
  794. display: flex;
  795. justify-content: flex-start;
  796. align-items: center;
  797. border-bottom: 1px #ccc solid;
  798. > span {
  799. width: 320px;
  800. word-wrap: break-word;
  801. font-size: 14px;
  802. color: rgb(112, 110, 110);
  803. border-right: 1px #ccc solid;
  804. padding: 5px 10px;
  805. }
  806. > p {
  807. flex: 1;
  808. padding: 5px 10px;
  809. }
  810. .imgNumber {
  811. width: 80px;
  812. }
  813. .del-close {
  814. width: 24px;
  815. height: 24px;
  816. cursor: pointer;
  817. margin-right: 10px;
  818. }
  819. }
  820. }
  821. .NPC-Book-Article {
  822. > div {
  823. margin-bottom: 20px;
  824. }
  825. }
  826. .NPC-Book-model {
  827. display: flex;
  828. justify-content: flex-start;
  829. align-items: center;
  830. > span {
  831. margin: 0;
  832. }
  833. }
  834. .lrc-box {
  835. display: flex;
  836. justify-content: flex-start;
  837. align-items: center;
  838. > span {
  839. font-size: 14px;
  840. margin-right: 16px;
  841. }
  842. }
  843. </style>