index.vue 24 KB

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