Result.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513
  1. <template>
  2. <div class="result" v-loading="loading">
  3. <Header :projectShow="true" />
  4. <div class="main">
  5. <div
  6. class="hanzi_list"
  7. :style="{
  8. overflowY: unfold ? 'scroll' : 'hidden',
  9. }"
  10. >
  11. <div class="top_jf">
  12. <div class="j_f">
  13. <div :class="[JFIndex == 0 ? 'sele' : '']" @click="jfEvent(0)">
  14. </div>
  15. <div :class="[JFIndex == 1 ? 'sele' : '']" @click="jfEvent(1)">
  16. </div>
  17. </div>
  18. </div>
  19. <div
  20. class="list_one"
  21. v-for="(item, index) in ShowHzData"
  22. :key="'index' + index"
  23. >
  24. <Strockplayredline
  25. v-if="item.hzDetail.hz_json"
  26. :Book_text="JFIndex == 0 ? item.con : item.fanti"
  27. :playStorkes="true"
  28. :curItem="item.hzDetail"
  29. :targetDiv="'bwcHanziIntp' + index + item.con"
  30. :isHighlight="false"
  31. :judgeAnswer="2"
  32. />
  33. <div class="Highlight" v-if="item.hzDetail.hz_json">
  34. <div class="play_audio">
  35. <img src="../../assets/teacherdev/speaker-one.png" alt="" />
  36. <span>{{ item.pinyin }}</span>
  37. </div>
  38. <div
  39. v-for="(items, indexs) in item.hzDetail.hz_json.medians.length"
  40. :key="'row' + indexs"
  41. class="row"
  42. >
  43. <Strockplayredline
  44. :Book_text="JFIndex == 0 ? item.con : item.fanti"
  45. :playStorkes="false"
  46. :curItem="item.hzDetail"
  47. :targetDiv="'bwcHanziIntp_height' + index + item.con + indexs"
  48. :isHighlight="true"
  49. :judgeAnswer="indexs + 1"
  50. />
  51. <div class="number">{{ indexs + 1 }}</div>
  52. </div>
  53. </div>
  54. </div>
  55. <div class="shouqi">
  56. <span @click="updownHz">
  57. <template v-if="unfold">
  58. <img src="../../assets/teacherdev/up.png" alt="" />
  59. 收起
  60. </template>
  61. <template v-else>
  62. <img src="../../assets/teacherdev/down.png" alt="" />
  63. 展开
  64. </template>
  65. </span>
  66. </div>
  67. </div>
  68. <div class="txt_imgtable">
  69. <div class="left">
  70. <div class="top">
  71. <div class="pattern">
  72. <div
  73. :class="[patternIndex == 0 ? 'sele' : '']"
  74. @click="cutPattern(0)"
  75. >
  76. 引语模式
  77. </div>
  78. <div
  79. :class="[patternIndex == 1 ? 'sele' : '']"
  80. @click="cutPattern(1)"
  81. >
  82. KWIC模式
  83. </div>
  84. </div>
  85. <div class="lang_sort">
  86. 长度
  87. <img src="" alt="" />
  88. </div>
  89. <div class="refresh">
  90. <img src="../../assets/teacherdev/refresh.png" alt="" />
  91. </div>
  92. <el-switch
  93. v-model="pinyinShow"
  94. active-text="拼音"
  95. active-color="#424242"
  96. style="margin-left: 32px"
  97. >
  98. </el-switch>
  99. <el-switch
  100. v-model="shiyiShow"
  101. active-text="释义"
  102. active-color="#424242"
  103. style="margin-left: 16px"
  104. >
  105. </el-switch>
  106. </div>
  107. </div>
  108. <div class="right">
  109. <div class="top">
  110. <div>
  111. <div
  112. :class="[rightTopIndex == 0 ? 'sele' : '']"
  113. @click="cutsyly(0)"
  114. >
  115. 释义
  116. </div>
  117. <div
  118. :class="[rightTopIndex == 1 ? 'sele' : '']"
  119. @click="cutsyly(1)"
  120. >
  121. 来源
  122. </div>
  123. </div>
  124. </div>
  125. </div>
  126. </div>
  127. </div>
  128. </div>
  129. </template>
  130. <script>
  131. //这里可以导入其它文件(比如:组件,工具js,第三方插件js,json文件,图片文件等等)
  132. //例如:import 《组件名称》from ‘《组件路径》';
  133. import Header from "@/components/Header";
  134. import { getLogin } from "@/api/api";
  135. import Strockplayredline from "@/components/corpus/Strockplayredline";
  136. import "@/utils/pinyin_dict_withtone";
  137. import "@/utils/pinyinUtil";
  138. import seekWord from "@/utils/lang.js";
  139. const OpenCC = require("opencc-js");
  140. const converter = OpenCC.Converter({ from: "cn", to: "tw" });
  141. export default {
  142. //import引入的组件需要注入到对象中才能使用
  143. components: {
  144. Header,
  145. Strockplayredline,
  146. },
  147. props: {},
  148. data() {
  149. //这里存放数据
  150. return {
  151. shiyiShow: false,
  152. pinyinShow: false,
  153. JFIndex: 0,
  154. hzData: [],
  155. ShowHzData: [],
  156. loading: true,
  157. lang: null,
  158. unfold: true,
  159. patternIndex: 0,
  160. rightTopIndex: 0,
  161. rightList: [
  162. {
  163. name: "",
  164. value: "",
  165. ratio: "",
  166. },
  167. ],
  168. };
  169. },
  170. //计算属性 类似于data概念
  171. computed: {},
  172. //监控data中数据变化
  173. watch: {},
  174. //方法集合
  175. methods: {
  176. // 切换模式
  177. cutPattern(index) {
  178. this.patternIndex = index;
  179. },
  180. // 切换释义来源
  181. cutsyly(index) {
  182. this.rightTopIndex = index;
  183. },
  184. updownHz() {
  185. this.unfold = !this.unfold;
  186. if (this.unfold) {
  187. this.ShowHzData = JSON.parse(JSON.stringify(this.hzData));
  188. } else {
  189. this.ShowHzData.splice(2);
  190. }
  191. },
  192. jfEvent(index) {
  193. this.JFIndex = index;
  194. if (index == 0) {
  195. //简体
  196. } else {
  197. //繁体
  198. this.hzData.forEach((item) => {
  199. // let a = seekWord(item.con);
  200. // item.fanti = a;
  201. let a = converter(item.con);
  202. item.fanti = a;
  203. });
  204. this.gethzJSON();
  205. }
  206. },
  207. // 获取汉字josn
  208. gethzJSON() {
  209. this.loading = true;
  210. let MethodName = "hz_resource_manager-GetHZStrokesContent";
  211. this.hzData.forEach((item, i) => {
  212. let data = {
  213. hz: this.JFIndex == 0 ? item.con : item.fanti,
  214. };
  215. item.hzDetail = {
  216. hz_json: null,
  217. };
  218. this.$forceUpdate();
  219. getLogin(MethodName, data)
  220. .then((res) => {
  221. this.$set(item.hzDetail, "hz_json", res);
  222. this.$forceUpdate();
  223. this.ShowHzData = JSON.parse(JSON.stringify(this.hzData));
  224. if (i == this.hzData.length - 1) {
  225. this.loading = false;
  226. }
  227. })
  228. .catch(() => {
  229. this.loading = false;
  230. });
  231. });
  232. },
  233. },
  234. //生命周期 - 创建完成(可以访问当前this实例)
  235. created() {
  236. if (this.$route.query.keyword) {
  237. let arr = this.$route.query.keyword.split("");
  238. arr.forEach((item) => {
  239. let result = pinyinUtil.getPinyin(item);
  240. let obj = {
  241. con: item,
  242. pinyin: result,
  243. hzDetail: {
  244. hz_json: null,
  245. },
  246. };
  247. this.hzData.push(obj);
  248. this.ShowHzData = JSON.parse(JSON.stringify(this.hzData));
  249. });
  250. this.gethzJSON();
  251. }
  252. },
  253. //生命周期 - 挂载完成(可以访问DOM元素)
  254. mounted() {},
  255. //生命周期-创建之前
  256. beforeCreated() {},
  257. //生命周期-挂载之前
  258. beforeMount() {},
  259. //生命周期-更新之前
  260. beforUpdate() {},
  261. //生命周期-更新之后
  262. updated() {},
  263. //生命周期-销毁之前
  264. beforeDestory() {},
  265. //生命周期-销毁完成
  266. destoryed() {},
  267. //如果页面有keep-alive缓存功能,这个函数会触发
  268. activated() {},
  269. };
  270. </script>
  271. <style lang="scss" scoped>
  272. /* @import url(); 引入css类 */
  273. .result {
  274. min-height: 100%;
  275. .main {
  276. min-height: 100%;
  277. background: #f2f2f2;
  278. padding-top: 33px;
  279. padding-bottom: 66px;
  280. }
  281. .hanzi_list {
  282. width: 1120px;
  283. max-height: 858px;
  284. margin: 0 auto;
  285. background: #ffffff;
  286. border-radius: 8px;
  287. padding: 40px;
  288. .top_jf {
  289. width: 128px;
  290. }
  291. .j_f {
  292. display: flex;
  293. width: 60px;
  294. height: 24px;
  295. margin-bottom: 16px;
  296. margin-left: 33px;
  297. > :nth-child(1) {
  298. border-top-left-radius: 2px;
  299. border-bottom-left-radius: 2px;
  300. border-right: none;
  301. }
  302. > :nth-child(2) {
  303. border-top-right-radius: 2px;
  304. border-bottom-right-radius: 2px;
  305. border-left: none;
  306. }
  307. div {
  308. width: 30px;
  309. height: 24px;
  310. font-weight: 400;
  311. font-size: 14px;
  312. line-height: 24px;
  313. text-align: center;
  314. color: #de4444;
  315. cursor: pointer;
  316. border: 2px solid #de4444;
  317. }
  318. .sele {
  319. color: #ffffff;
  320. background: #de4444;
  321. }
  322. }
  323. .list_one {
  324. margin-bottom: 20px;
  325. display: flex;
  326. align-items: flex-start;
  327. .Highlight {
  328. flex: 1;
  329. margin-left: 22px;
  330. display: flex;
  331. flex-wrap: wrap;
  332. .play_audio {
  333. width: 100%;
  334. display: flex;
  335. align-items: center;
  336. margin-bottom: 13px;
  337. img {
  338. width: 16px;
  339. height: 16px;
  340. cursor: pointer;
  341. }
  342. span {
  343. font-family: "GB-PINYINOK-B";
  344. font-weight: 400;
  345. font-size: 12px;
  346. margin-left: 5px;
  347. color: #000000;
  348. }
  349. }
  350. }
  351. .row {
  352. margin-right: 8px;
  353. margin-bottom: 8px;
  354. .number {
  355. margin-top: 9px;
  356. width: 64px;
  357. height: 20px;
  358. background: #e9e9e9;
  359. border-radius: 22px;
  360. text-align: center;
  361. line-height: 20px;
  362. }
  363. }
  364. }
  365. .shouqi {
  366. margin-top: 21;
  367. display: flex;
  368. justify-content: flex-end;
  369. span {
  370. cursor: pointer;
  371. display: flex;
  372. align-items: center;
  373. }
  374. img {
  375. width: 24px;
  376. height: 24px;
  377. margin-right: 4px;
  378. }
  379. }
  380. }
  381. .txt_imgtable {
  382. width: 1200px;
  383. margin: 0 auto;
  384. margin-top: 8px;
  385. display: flex;
  386. .left {
  387. width: 562px;
  388. background: #ffffff;
  389. border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  390. border-radius: 8px;
  391. margin-right: 8px;
  392. .top {
  393. border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  394. height: 44px;
  395. display: flex;
  396. align-items: center;
  397. font-weight: 400;
  398. font-size: 12px;
  399. .pattern {
  400. margin-left: 16px;
  401. width: 144px;
  402. height: 28px;
  403. background: #eeeeee;
  404. border-radius: 4px;
  405. display: flex;
  406. justify-content: center;
  407. align-items: center;
  408. > div {
  409. width: 64px;
  410. height: 24px;
  411. text-align: center;
  412. line-height: 24px;
  413. color: #888888;
  414. cursor: pointer;
  415. font-weight: 400;
  416. font-size: 12px;
  417. border-radius: 2px;
  418. }
  419. .sele {
  420. background: #ffffff;
  421. box-shadow: 0px 2px 2px rgba(0, 0, 0, 0.08);
  422. color: #000000;
  423. }
  424. }
  425. .lang_sort {
  426. width: 54px;
  427. height: 28px;
  428. background: #eeeeee;
  429. border-radius: 4px;
  430. margin-left: 24px;
  431. display: flex;
  432. justify-content: center;
  433. align-items: center;
  434. }
  435. .refresh {
  436. width: 28px;
  437. height: 28px;
  438. background: #eeeeee;
  439. border-radius: 4px;
  440. display: flex;
  441. justify-content: center;
  442. align-items: center;
  443. margin-left: 8px;
  444. cursor: pointer;
  445. img {
  446. width: 16px;
  447. height: 16px;
  448. }
  449. }
  450. }
  451. }
  452. .right {
  453. width: 630px;
  454. height: 100px;
  455. background: #ffffff;
  456. border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  457. border-radius: 8px;
  458. .top {
  459. border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  460. height: 44px;
  461. display: flex;
  462. align-items: center;
  463. > div {
  464. margin-left: 16px;
  465. width: 84px;
  466. height: 28px;
  467. background: #eeeeee;
  468. border-radius: 4px;
  469. display: flex;
  470. justify-content: center;
  471. align-items: center;
  472. > div {
  473. border-radius: 2px;
  474. width: 40px;
  475. height: 24px;
  476. text-align: center;
  477. line-height: 24px;
  478. color: #888888;
  479. cursor: pointer;
  480. font-weight: 400;
  481. font-size: 12px;
  482. }
  483. .sele {
  484. background: #ffffff;
  485. box-shadow: 0px 2px 2px rgba(0, 0, 0, 0.08);
  486. color: #000000;
  487. }
  488. }
  489. }
  490. }
  491. }
  492. }
  493. </style>
  494. <style lang="scss">
  495. .result {
  496. .el-switch__core {
  497. width: 26px !important;
  498. height: 16px;
  499. }
  500. .el-switch__core:after {
  501. width: 8px;
  502. height: 8px;
  503. top: 2px;
  504. }
  505. .el-switch.is-checked .el-switch__core::after {
  506. margin-left: -10px;
  507. }
  508. }
  509. </style>