cread.vue 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931
  1. <template>
  2. <div class="cread" v-loading="loading">
  3. <template v-if="!showCard">
  4. <Header v-if="!userID" />
  5. <div class="go-back-box" :class="[userID ? 'go-back-box-user' : '']" v-if="!isPreview">
  6. <a v-if="!userID" class="go-back" :class="[editCardflag ? '' : 'go-back-preview']" @click="goBack">
  7. <i class="el-icon-arrow-left"></i>
  8. 返回
  9. </a>
  10. <template v-if="editCardflag">
  11. <div class="name-box">
  12. <label>卡片名称</label>
  13. <el-input v-model="saveName"></el-input>
  14. </div>
  15. <div class="btn-box">
  16. <el-button small @click="addCard"><i class="el-icon-plus"></i>增加卡片</el-button>
  17. <el-upload
  18. ref="upload"
  19. :action="url"
  20. accept=".xlsx,.xls"
  21. :limit="9999"
  22. :on-exceed="handleExceed"
  23. :on-success="handleSuccess"
  24. :show-file-list="false"
  25. class="btn"
  26. style="margin: 0 8px"
  27. >
  28. <el-button>通过模版导入</el-button>
  29. </el-upload>
  30. <el-button type="primary" plain small @click="save">结束编辑并保存</el-button>
  31. </div>
  32. </template>
  33. <template v-else>
  34. <h3>{{ saveName }}</h3>
  35. <div class="btn-box">
  36. <span class="checked-number" v-if="filtCardflag && filtTable.length > 0">已选{{ filtTable.length }}张</span>
  37. <!-- <el-button @click="changeRowLength">{{ showRoeText[showRowLength] }}</el-button> -->
  38. <el-button small @click="handleSureFilt" v-if="filtCardflag">类举</el-button>
  39. <el-button
  40. small
  41. @click="
  42. filtCardflag = true;
  43. showRowLength = filtTable.length > 4 ? 6 : filtTable.length;
  44. filtTableShows = JSON.parse(JSON.stringify(newEditTable)).splice(
  45. (currentPages - 1) * showRowLengths,
  46. showRowLengths,
  47. );
  48. "
  49. v-else
  50. >筛选</el-button
  51. >
  52. <el-button
  53. small
  54. @click="
  55. editCardflag = true;
  56. filtCardflag = false;
  57. "
  58. ><i class="el-icon-edit"></i>编辑</el-button
  59. >
  60. <el-button small @click="download2"
  61. ><img src="../../assets/teacherdev/word-eyes.png" alt="" />打印</el-button
  62. >
  63. </div>
  64. </template>
  65. </div>
  66. <div
  67. class="content"
  68. :class="[
  69. editCardflag
  70. ? ''
  71. : filtCardflag
  72. ? 'content-flex content-flex-' + showRowLengths
  73. : 'content-flex content-flex-' + showRowLength,
  74. ,
  75. ]"
  76. :style="{ minHeight: innerHeight - 220 + 'px' }"
  77. >
  78. <div
  79. v-for="(item, index) in filtCardflag ? filtTableShows : editCardflag ? newEditTable : filtTableShow"
  80. :key="index"
  81. :class="[editCardflag ? '' : 'item-flex']"
  82. >
  83. <writeTable
  84. :key="
  85. filtCardflag
  86. ? filtId.indexOf(item.id) + currentPages + index
  87. : filtId.indexOf(item.id) + currentPage + index
  88. "
  89. :editCardflag="editCardflag"
  90. :dataConfig="writeTableData"
  91. :data="item"
  92. :pageNumber="index + 1"
  93. :totalNumber="filtCardflag ? showRowLengths : showRowLength"
  94. :isPreview="true"
  95. @handleDelItem="handleDelItem"
  96. :filtCardflag="filtCardflag"
  97. :filtId="filtId"
  98. :filtTable="filtTable"
  99. @zoomInCard="zoomInCard"
  100. />
  101. </div>
  102. </div>
  103. <el-pagination
  104. background
  105. :current-page="currentPages"
  106. :page-size="showRowLengths"
  107. :page-sizes="[1, 2, 3, 4, 6]"
  108. :total="newEditTable.length"
  109. layout="total, prev, pager, next, sizes, jumper"
  110. @size-change="(val) => handleSizeChange(val, 'showRowLengths', 'currentPages')"
  111. @current-change="(val) => handleCurrentChange(val, 'currentPages')"
  112. v-if="filtCardflag && !editCardflag"
  113. />
  114. <el-pagination
  115. background
  116. :current-page="currentPage"
  117. :page-size="showRowLength"
  118. :page-sizes="[1, 2, 3, 4, 6]"
  119. :total="filtTable.length"
  120. layout="total, prev, pager, next, sizes, jumper"
  121. @size-change="(val) => handleSizeChange(val, 'showRowLength', 'currentPage')"
  122. @current-change="(val) => handleCurrentChange(val, 'currentPage')"
  123. v-if="!filtCardflag && !editCardflag"
  124. />
  125. </template>
  126. <el-dialog title="" :visible.sync="showCard" width="100%" class="wordCard-dialog" top="0">
  127. <i class="el-icon-arrow-left" :class="[showIndex === 0 ? 'disabled' : '']" @click="changeShowIndex('-')"></i>
  128. <writeTableZoom
  129. :editCardflag="false"
  130. :dataConfig="writeTableData"
  131. :data="filtTable[showIndex]"
  132. :pageNumber="showIndex"
  133. :totalNumber="0"
  134. :isPreview="true"
  135. :filtCardflag="false"
  136. ref="writeTableZoom"
  137. />
  138. <p style="width: 100%; text-align: center; font-size: 20px; color: #fff">
  139. {{ showIndex + 1 }} / {{ filtTable.length }}
  140. </p>
  141. <i
  142. class="el-icon-arrow-right"
  143. :class="[showIndex === filtTable.length - 1 ? 'disabled' : '']"
  144. @click="changeShowIndex('+')"
  145. ></i>
  146. </el-dialog>
  147. <!-- <div class="preview_dv" v-if="isPreview" :style="{ top: userID ? '0' : '' }">
  148. <img class="close" src="../../assets/teacherdev/creadCad-close.png" alt="" @click="closepreviewEvent" />
  149. <el-button type="primary" class="print-btn" small @click="download2">打印</el-button>
  150. <div class="preview_main">
  151. <img
  152. class="left"
  153. src="../../assets/teacherdev/creadCad-left.png"
  154. alt=""
  155. @click="changepreviewIndex('remove')"
  156. />
  157. <div class="word_main">
  158. <div class="word_main_table">
  159. <writeTable
  160. :type="typeIndex"
  161. :dataConfig="newEditTable"
  162. :data="newEditTable[previewIndex]"
  163. :pageNumber="previewIndex + 1"
  164. :totalNumber="newEditTable.length"
  165. :isPreview="true"
  166. :showLeft="showLeft"
  167. @changeShowLeft="changeShowLeft"
  168. ref="writeTable"
  169. />
  170. </div>
  171. </div>
  172. <img class="right" src="../../assets/teacherdev/creadCad-right.png" alt="" @click="changepreviewIndex('add')" />
  173. </div>
  174. </div> -->
  175. </div>
  176. </template>
  177. <script>
  178. //这里可以导入其它文件(比如:组件,工具js,第三方插件js,json文件,图片文件等等)
  179. //例如:import 《组件名称》from ‘《组件路径》';
  180. import Header from '@/components/Header';
  181. import { getLogin, LearnWebSI, getHZChineseInfo, getContentFile } from '@/api/api';
  182. import writeTable from './writeTableNew.vue';
  183. import writeTableZoom from './writeTableZoom.vue';
  184. import { getToken } from '@/utils/auth';
  185. import html2canvas from 'html2canvas';
  186. import { jsPDF } from 'jspdf';
  187. import canvg from 'canvg';
  188. import cnchar from 'cnchar';
  189. import 'cnchar-radical';
  190. import FileSaver from 'file-saver';
  191. import htmlDocx from 'html-docx-js/dist/html-docx';
  192. export default {
  193. //import引入的组件需要注入到对象中才能使用
  194. components: {
  195. Header,
  196. writeTable,
  197. writeTableZoom,
  198. },
  199. props: {},
  200. data() {
  201. //这里存放数据
  202. return {
  203. saveName: '',
  204. typeIndex: 0,
  205. loading: false,
  206. writeTableData: null,
  207. isPreview: false,
  208. previewIndex: 0,
  209. saveShow: false,
  210. hzDetailList: null,
  211. userID: this.$route.query.userID ? this.$route.query.userID : '',
  212. editCardflag: this.$route.query.id ? false : true, // 是否编辑卡片
  213. newEditTable: [
  214. // {
  215. // borderColor: '#243C97',
  216. // fontColor: '#243C97',
  217. // fontAlign: 'left',
  218. // label: '',
  219. // headerCon: '',
  220. // left: {
  221. // fileList: [],
  222. // con: '',
  223. // },
  224. // right: {
  225. // definition: '',
  226. // collocation: '',
  227. // exampleSent: '',
  228. // hz_info: [],
  229. // pinyin: '',
  230. // audio_file: '',
  231. // cixing: '',
  232. // },
  233. // },
  234. ],
  235. showLeft: true,
  236. showRowLength: 1, // 一页展示几个,有一行一列,一行两列,一行三列和两行两列
  237. showRowLengths: 1, // 一页展示几个,有一行一列,一行两列,一行三列和两行两列
  238. showRoeText: {
  239. 1: '一行一列',
  240. 2: '一行两列',
  241. 3: '一行三列',
  242. 4: '两行两列',
  243. 5: '两行三列',
  244. },
  245. innerHeight: window.innerHeight,
  246. filtCardflag: true, // 筛选状态
  247. filtTable: [], // 筛选卡片
  248. filtTableShow: [], //分页后的筛选卡片
  249. filtTableShows: [], //分页后的筛选卡片
  250. filtId: [], // 筛选卡片id数组
  251. currentPage: 1,
  252. currentPages: 1,
  253. showCard: false, //卡片放大
  254. showIndex: null, // 卡片放大索引
  255. };
  256. },
  257. //计算属性 类似于data概念
  258. computed: {
  259. url() {
  260. let userInfo = getToken()
  261. ? JSON.parse(getToken())
  262. : sessionStorage.getItem('GCLS_Token_Tc')
  263. ? JSON.parse(sessionStorage.getItem('GCLS_Token_Tc'))
  264. : null;
  265. if (!userInfo) return `${process.env.VUE_APP_BASE_API}/GCLSFileServer/WebFileUpload`;
  266. return `${process.env.VUE_APP_BASE_API}/GCLSFileServer/WebFileUpload?AccessToken=${userInfo.access_token}&SecurityLevel=Mid"`;
  267. },
  268. },
  269. //监控data中数据变化
  270. watch: {},
  271. //方法集合
  272. methods: {
  273. addCard() {
  274. this.newEditTable.push({
  275. borderColor: '#243C97',
  276. fontColor: '#243C97',
  277. fontAlign: 'left',
  278. label: '',
  279. headerCon: '',
  280. left: {
  281. fileList: [],
  282. con: '',
  283. },
  284. right: {
  285. definition: '',
  286. collocation: '',
  287. exampleSent: '',
  288. hz_info: [],
  289. pinyin: '',
  290. audio_file: '',
  291. cixing: '',
  292. hideHanzi: false,
  293. },
  294. id: Math.random().toString(36).substring(2, 10),
  295. });
  296. },
  297. // 删除一条卡片
  298. handleDelItem(index, id) {
  299. this.newEditTable.splice(index, 1);
  300. if (this.filtId.indexOf(id) > -1) {
  301. this.filtTable.splice(this.filtId.indexOf(id), 1);
  302. this.filtId.splice(this.filtId.indexOf(id), 1);
  303. }
  304. },
  305. // 返回上一页
  306. goBack() {
  307. this.$router.push({
  308. path: '/wordcard/table',
  309. });
  310. },
  311. // 保存
  312. save() {
  313. if (!this.saveName || !this.saveName.trim()) {
  314. this.$message.warning('请填写卡片名称');
  315. return;
  316. }
  317. this.loading = this.$loading({
  318. lock: true,
  319. text: 'Loading',
  320. spinner: 'el-icon-loading',
  321. background: 'rgba(0, 0, 0, 0.7)',
  322. });
  323. let text = '';
  324. this.newEditTable.forEach((items) => {
  325. text += items.left.con.trim() + '\n';
  326. });
  327. if (this.$route.query.id) {
  328. // 编辑
  329. let Mname = 'tr_tool-wsc_manager-UpdateMyWordSentenceCard';
  330. LearnWebSI(Mname, {
  331. id: this.$route.query.id,
  332. name: this.saveName,
  333. type: this.typeIndex == 0 ? 'WORD' : 'SENTENCE',
  334. text: text,
  335. content: JSON.stringify(this.newEditTable),
  336. update_scope: 0,
  337. })
  338. .then((res) => {
  339. this.loading.close();
  340. this.loading = false;
  341. this.editCardflag = false;
  342. this.filtCardflag = true;
  343. this.$message.success('保存成功');
  344. this.currentPage = 1;
  345. this.currentPages = 1;
  346. this.showRowLength = this.filtTable.length > 4 ? 6 : this.filtTable.length;
  347. this.showRowLengths = this.newEditTable.length > 4 ? 6 : this.newEditTable.length;
  348. this.filtTableShows = JSON.parse(JSON.stringify(this.newEditTable)).splice(
  349. (this.currentPages - 1) * this.showRowLengths,
  350. this.showRowLengths,
  351. );
  352. })
  353. .catch((res) => {
  354. this.loading.close();
  355. this.loading = false;
  356. });
  357. } else {
  358. // 新建
  359. let Mname = 'tr_tool-wsc_manager-CreateMyWordSentenceCard';
  360. LearnWebSI(Mname, {
  361. name: this.saveName,
  362. type: this.typeIndex == 0 ? 'WORD' : 'SENTENCE',
  363. text: text,
  364. content: JSON.stringify(this.newEditTable),
  365. app_user_id: this.userID,
  366. })
  367. .then((res) => {
  368. this.$router.replace({
  369. path: '/wordcard/cread',
  370. query: {
  371. id: res.id,
  372. userID: this.userID,
  373. },
  374. });
  375. this.loading.close();
  376. this.loading = false;
  377. this.editCardflag = false;
  378. this.filtCardflag = true;
  379. this.$message.success('保存成功');
  380. this.currentPage = 1;
  381. this.currentPages = 1;
  382. this.showRowLength = this.filtTable.length > 4 ? 6 : this.filtTable.length;
  383. this.showRowLengths = this.newEditTable.length > 4 ? 6 : this.newEditTable.length;
  384. this.filtTableShows = JSON.parse(JSON.stringify(this.newEditTable)).splice(
  385. (this.currentPages - 1) * this.showRowLengths,
  386. this.showRowLengths,
  387. );
  388. })
  389. .catch((res) => {
  390. this.loading.close();
  391. this.loading = false;
  392. });
  393. }
  394. this.filtCardflag = true;
  395. },
  396. // 字句详情
  397. getdetai() {
  398. this.loading = true;
  399. let Mname = 'tr_tool-wsc_manager-GetWordSentenceCard';
  400. LearnWebSI(Mname, {
  401. id: this.$route.query.id,
  402. })
  403. .then((res) => {
  404. this.saveName = res.name;
  405. this.newEditTable = JSON.parse(res.content);
  406. this.newEditTable.forEach((item) => {
  407. if (!item.hasOwnProperty('id')) {
  408. this.$set(item, 'id', Math.random().toString(36).substring(2, 10));
  409. }
  410. });
  411. this.loading = false;
  412. this.showRowLength = this.filtTable.length > 4 ? 6 : this.filtTable.length;
  413. this.showRowLengths = this.newEditTable.length > 4 ? 6 : this.newEditTable.length;
  414. this.filtTableShows = JSON.parse(JSON.stringify(this.newEditTable)).splice(
  415. (this.currentPages - 1) * this.showRowLengths,
  416. this.showRowLengths,
  417. );
  418. })
  419. .catch((res) => {
  420. this.loading = false;
  421. });
  422. },
  423. // 预览
  424. previewEvent() {
  425. this.previewIndex = 0;
  426. this.showLeft = true;
  427. this.isPreview = true;
  428. },
  429. // 关闭预览
  430. closepreviewEvent() {
  431. this.isPreview = false;
  432. },
  433. changepreviewIndex(type) {
  434. if (type == 'add') {
  435. if (this.previewIndex == this.newEditTable.length - 1) {
  436. this.$message.warning('当前已经是最后一页');
  437. return;
  438. }
  439. this.previewIndex++;
  440. } else {
  441. if (this.previewIndex == 0) {
  442. this.$message.warning('当前已经是第一页');
  443. return;
  444. }
  445. this.previewIndex--;
  446. }
  447. this.$refs.writeTable.changeRota();
  448. this.showLeft = true;
  449. this.$forceUpdate();
  450. },
  451. changeShowLeft() {
  452. this.showLeft = !this.showLeft;
  453. },
  454. download2() {
  455. if (this.filtTable.length === 0) {
  456. this.$message.warning('未选中卡片');
  457. return;
  458. }
  459. this.$nextTick(() => {
  460. if (this.filtTable) {
  461. let str = JSON.stringify(this.filtTable);
  462. localStorage.setItem('newEditTable', str);
  463. this.$router.replace({
  464. path: '/wordcard/printNew',
  465. query: {
  466. userID: this.userID,
  467. id: this.$route.query.id,
  468. },
  469. });
  470. }
  471. });
  472. },
  473. async handleSuccess(res, file, fileList) {
  474. if (res.status !== 1) {
  475. this.$message.error(res.message);
  476. return;
  477. }
  478. let file_id = file.response.file_info_list[0].file_id;
  479. this.loading = true;
  480. // 通过 fileList 的 response 判断是否已全部完成上传
  481. this.loading = true;
  482. this.$refs.upload.clearFiles();
  483. await LearnWebSI('tr_tool-wsc_manager-ParseWordSentenceCardImportFile', {
  484. file_id: file_id,
  485. })
  486. .then((res) => {
  487. this.loading = false;
  488. this.$message.success('导入成功');
  489. res.content_json_text.forEach((items) => {
  490. if (
  491. items.headerCon ||
  492. items.label ||
  493. items.left.con ||
  494. items.right.cixing ||
  495. items.right.collocation ||
  496. items.right.definition ||
  497. items.right.exampleSent ||
  498. items.right.pinyin
  499. ) {
  500. items.borderColor = '#243C97';
  501. items.fontAlign = 'left';
  502. items.fontColor = '#243C97';
  503. let con = items.left.con.trim();
  504. if (con) {
  505. let MethodName = 'hz_resource_manager-GetMultHZStrokesContent';
  506. let data = {
  507. hz_str: con,
  508. };
  509. getLogin(MethodName, data)
  510. .then((res) => {
  511. this.loading = false;
  512. for (let key in res) {
  513. if (key != 'status' && key != ',' && res[key]) {
  514. res[key] = JSON.parse(res[key]);
  515. }
  516. }
  517. let hzDetailList = res;
  518. let hz_list = [];
  519. con.split('').forEach((items) => {
  520. let res = JSON.parse(JSON.stringify(hzDetailList[items]));
  521. let obj = {
  522. con: items,
  523. hzDetail: {
  524. hz_json: res,
  525. },
  526. };
  527. hz_list.push(obj);
  528. });
  529. items.right.hz_info = hz_list;
  530. let MethodName = 'tool-TextToVoiceFile';
  531. if (con) {
  532. let datas = {
  533. text: con,
  534. };
  535. getLogin(MethodName, datas).then((res) => {
  536. if (res.status === 1) {
  537. items.right.audio_file = res.file_id;
  538. }
  539. });
  540. }
  541. })
  542. .catch(() => {
  543. this.loading = false;
  544. });
  545. }
  546. this.newEditTable.push(items);
  547. }
  548. });
  549. })
  550. .catch((res) => {
  551. this.loading = false;
  552. });
  553. },
  554. handleExceed(files) {
  555. this.$message.warning(`当前限制选择 9999 个文件,本次选择了 ${files.length} 个文件`);
  556. },
  557. changeRowLength() {
  558. if (this.showRowLength === 4) {
  559. this.showRowLength = 6;
  560. } else if (this.showRowLength === 6) {
  561. this.showRowLength = 1;
  562. } else {
  563. this.showRowLength++;
  564. }
  565. },
  566. handleSureFilt() {
  567. if (this.filtTable.length === 0) {
  568. this.$message.warning('请勾选要类举的卡片');
  569. return;
  570. }
  571. this.filtTable.slice().reverse();
  572. this.filtCardflag = false;
  573. this.showRowLength = this.filtTable.length > 4 ? 6 : this.filtTable.length;
  574. this.getList();
  575. },
  576. handleSizeChange(val, type, page) {
  577. this[type] = val;
  578. this[page] = 1;
  579. this.getList();
  580. },
  581. handleCurrentChange(val, type) {
  582. this[type] = val;
  583. this.getList();
  584. },
  585. getList() {
  586. if (this.filtCardflag) {
  587. this.filtTableShows = JSON.parse(JSON.stringify(this.newEditTable)).splice(
  588. (this.currentPages - 1) * this.showRowLengths,
  589. this.showRowLengths,
  590. );
  591. } else {
  592. this.filtTableShow = JSON.parse(JSON.stringify(this.filtTable)).splice(
  593. (this.currentPage - 1) * this.showRowLength,
  594. this.showRowLength,
  595. );
  596. }
  597. },
  598. zoomInCard(index) {
  599. this.showIndex = index;
  600. this.showCard = true;
  601. },
  602. changeShowIndex(type) {
  603. if (type === '+') {
  604. if (this.showIndex !== this.filtTable.length - 1) {
  605. this.showIndex++;
  606. }
  607. } else {
  608. if (this.showIndex !== 0) {
  609. this.showIndex--;
  610. }
  611. }
  612. this.$refs.writeTableZoom.changeRota();
  613. },
  614. },
  615. //生命周期 - 创建完成(可以访问当前this实例)
  616. created() {},
  617. //生命周期 - 挂载完成(可以访问DOM元素)
  618. mounted() {},
  619. //生命周期-创建之前
  620. beforeCreated() {},
  621. //生命周期-挂载之前
  622. beforeMount() {},
  623. //生命周期-更新之前
  624. beforUpdate() {},
  625. //生命周期-更新之后
  626. updated() {},
  627. //生命周期-销毁之前
  628. beforeDestory() {},
  629. //生命周期-销毁完成
  630. destoryed() {},
  631. //如果页面有keep-alive缓存功能,这个函数会触发
  632. activated() {
  633. if (this.$route.query.cachesType == 'pop') {
  634. this.saveName = '';
  635. this.typeIndex = 0;
  636. this.loading = false;
  637. this.newEditTable = [
  638. // {
  639. // borderColor: '#243C97', // 卡片边框颜色
  640. // fontColor: '#243C97', // 字体颜色
  641. // fontAlign: 'left', // 页眉对齐方式
  642. // label: '', // 标签内容
  643. // headerCon: '', // 页眉内容
  644. // left: {
  645. // fileList: [], // 上传文件
  646. // con: '', // 字词卡片内容(即卡片显示的字词)
  647. // },
  648. // right: {
  649. // definition: '', // 释义
  650. // collocation: '', // 搭配
  651. // exampleSent: '', // 例句
  652. // hz_info: [], // 汉字笔顺等内容
  653. // pinyin: '', // 拼音
  654. // audio_file: '', // 字词生成的音频
  655. // cixing: '', // 词性
  656. // },
  657. // },
  658. ];
  659. this.previewIndex = 0;
  660. this.saveShow = false;
  661. this.showLeft = true;
  662. this.editCardflag = this.$route.query.id ? false : true;
  663. this.isPreview = false;
  664. this.filtCardflag = false;
  665. this.filtTableShow = [];
  666. this.filtTableShows = [];
  667. this.filtId = [];
  668. if (this.$route.query.id) {
  669. // 需要请求详情接口
  670. this.getdetai();
  671. this.filtCardflag = true; // 筛选状态
  672. this.filtTable = []; // 筛选卡片
  673. this.filtTableShow = []; //分页后的筛选卡片
  674. this.filtTableShows = []; //分页后的筛选卡片
  675. this.filtId = []; // 筛选卡片id数组
  676. this.currentPage = 1;
  677. this.currentPages = 1;
  678. this.showCard = false; //卡片放大
  679. this.showIndex = null; // 卡片放大索引
  680. }
  681. }
  682. },
  683. };
  684. </script>
  685. <style lang="scss" scoped>
  686. /* @import url(); 引入css类 */
  687. .cread {
  688. min-height: 100%;
  689. position: relative;
  690. background: #f2f2f2;
  691. .go-back-box {
  692. width: 1200px;
  693. display: flex;
  694. border-radius: 8px;
  695. background: #fff;
  696. padding: 8px;
  697. margin: 20px auto;
  698. // position: fixed;
  699. // top: 83px;
  700. // left: 50%;
  701. // margin-left: -610px;
  702. // z-index: 1000;
  703. border: 1px solid rgba(0, 0, 0, 0.15);
  704. &-user {
  705. top: 19px;
  706. }
  707. h3 {
  708. font-size: 24px;
  709. font-weight: 500;
  710. line-height: 150%;
  711. flex: 1;
  712. text-align: center;
  713. }
  714. img {
  715. width: 20px;
  716. margin-right: 6px;
  717. }
  718. .el-button {
  719. padding: 8px 16px;
  720. height: 40px;
  721. line-height: 24px;
  722. }
  723. }
  724. .go-back {
  725. display: flex;
  726. color: #333;
  727. font-size: 24px;
  728. font-weight: 500;
  729. line-height: 36px;
  730. padding: 0 16px 0 0;
  731. align-items: center;
  732. cursor: pointer;
  733. &-preview {
  734. width: 300px;
  735. }
  736. .el-icon-arrow-left {
  737. font-size: 16px;
  738. margin-right: 8px;
  739. }
  740. }
  741. .name-box {
  742. flex: 1;
  743. display: flex;
  744. align-items: center;
  745. label {
  746. color: #4e5969;
  747. font-size: 14px;
  748. font-weight: 400;
  749. line-height: 22px;
  750. margin-right: 16px;
  751. }
  752. .el-input {
  753. width: 227px;
  754. border-radius: 2px;
  755. background: #f2f3f5;
  756. }
  757. }
  758. .btn-box {
  759. display: flex;
  760. i {
  761. margin-right: 8px;
  762. font-size: 16px;
  763. }
  764. .checked-number {
  765. margin-right: 8px;
  766. font-size: 14px;
  767. color: red;
  768. line-height: 40px;
  769. }
  770. }
  771. .content {
  772. // padding-top: 88px;
  773. &-flex {
  774. display: flex;
  775. width: 1470px;
  776. margin: 0 auto;
  777. flex-flow: wrap;
  778. gap: 50px 120px;
  779. justify-content: center;
  780. align-content: center;
  781. padding: 10px 0;
  782. &-3,
  783. &-4 {
  784. gap: 50px 80px;
  785. .item-flex {
  786. width: 350px !important;
  787. }
  788. }
  789. &-2,
  790. &-4,
  791. &-6 {
  792. justify-content: start;
  793. }
  794. &-1 {
  795. width: 500px;
  796. }
  797. &-2 {
  798. width: 920px;
  799. }
  800. &-4 {
  801. width: 780px;
  802. }
  803. &-6 {
  804. width: 1120px;
  805. gap: 50px 80px;
  806. .item-flex {
  807. width: 320px !important;
  808. }
  809. }
  810. }
  811. .item-flex {
  812. width: 400px;
  813. flex-shrink: 0;
  814. }
  815. }
  816. }
  817. .preview_dv {
  818. position: absolute;
  819. left: 0;
  820. top: 64px;
  821. width: 100%;
  822. min-height: calc(100% - 64px);
  823. background: #f2f2f2;
  824. > img {
  825. width: 40px;
  826. height: 40px;
  827. cursor: pointer;
  828. position: absolute;
  829. top: 24px;
  830. right: 31px;
  831. }
  832. .print-btn {
  833. cursor: pointer;
  834. position: absolute;
  835. top: 24px;
  836. left: 31px;
  837. }
  838. .preview_main {
  839. padding: 24px 0;
  840. width: 740px;
  841. display: flex;
  842. align-items: center;
  843. height: 450px;
  844. position: absolute;
  845. top: 50%;
  846. margin-top: -225px;
  847. left: 50%;
  848. margin-left: -370px;
  849. > div {
  850. margin: 0 24px;
  851. }
  852. img {
  853. width: 48px;
  854. height: 48px;
  855. cursor: pointer;
  856. }
  857. }
  858. }
  859. :deep .el-pagination {
  860. text-align: right;
  861. width: 1200px;
  862. margin: 0 auto;
  863. }
  864. :deep .el-dialog {
  865. background: transparent;
  866. }
  867. :deep .el-dialog__headerbtn {
  868. right: 20px;
  869. top: 20px;
  870. position: fixed;
  871. }
  872. :deep .el-dialog__headerbtn .el-dialog__close {
  873. color: #f2f3f5;
  874. font-size: 34px;
  875. font-weight: bold;
  876. }
  877. .wordCard-dialog {
  878. display: flex;
  879. align-items: center;
  880. :deep .el-dialog {
  881. box-shadow: none;
  882. }
  883. .el-icon-arrow-left,
  884. .el-icon-arrow-right {
  885. color: #f2f2f2;
  886. font-size: 50px;
  887. font-weight: bold;
  888. position: fixed;
  889. top: 50%;
  890. margin-top: -20px;
  891. left: 200px;
  892. cursor: pointer;
  893. &.disabled {
  894. color: darkgrey;
  895. cursor: not-allowed;
  896. }
  897. }
  898. .el-icon-arrow-right {
  899. left: auto;
  900. right: 200px;
  901. }
  902. }
  903. </style>
  904. <style lang="scss">
  905. .cread {
  906. .name-box {
  907. .el-input__inner {
  908. border-radius: 2px;
  909. background: #f2f3f5;
  910. border: none;
  911. }
  912. }
  913. .btn-box {
  914. .el-button {
  915. span {
  916. display: flex;
  917. align-items: center;
  918. }
  919. }
  920. }
  921. }
  922. </style>