index.vue 25 KB

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