dictionary.vue 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. <template>
  2. <div class="dictionary">
  3. <el-input
  4. style="width: 310px"
  5. v-model="input1"
  6. placeholder="请输入您要查询的字词"
  7. >
  8. <template #append>
  9. <el-button
  10. type="primary"
  11. :loading="is_status === 'load'"
  12. @click="search"
  13. >查询</el-button
  14. >
  15. </template>
  16. </el-input>
  17. <el-card style="margin-top: 1em" v-if="oriD.pinyin">
  18. <el-tabs v-model="activeName">
  19. <el-tab-pane v-if="oriD.cyjs" label="词语解释" name="词语解释">
  20. <div class="tab_pane">
  21. <div class="pinyin" v-text="'拼音:' + oriD.pinyin"></div>
  22. <ul class="dictionary-ul">
  23. <li
  24. v-for="(v, i) in oriD.chinese_words_name"
  25. :key="i"
  26. v-text="v"
  27. ></li>
  28. </ul>
  29. <div class="note" v-html="oriD.cyjs"></div>
  30. </div>
  31. </el-tab-pane>
  32. <el-tab-pane v-if="oriD.gycd" label="国语辞典" name="国语辞典">
  33. <div class="note" v-html="oriD.gycd"></div>
  34. </el-tab-pane>
  35. <el-tab-pane v-if="oriD.wljs" label="网络解释" name="网络解释">
  36. <div class="bknr" v-html="oriD.wljs"></div>
  37. </el-tab-pane>
  38. <el-tab-pane v-if="oriD.bushou" label="基本解释" name="基本解释">
  39. <ul class="dictionary-ul">
  40. <li v-text="oriD.chinese_words_name"></li>
  41. </ul>
  42. <div style="display: inline-block; ,argin-left: 15px">
  43. <div class="pinyin" v-text="'拼音:' + oriD.pinyin"></div>
  44. <div class="pinyin" v-text="'部首:' + oriD.bushou"></div>
  45. </div>
  46. <div class="note" v-html="oriD.jbjs"></div>
  47. </el-tab-pane>
  48. <el-tab-pane v-if="oriD.xxjs" label="详细解释" name="详细解释">
  49. <div class="note" v-html="oriD.xxjs"></div>
  50. </el-tab-pane>
  51. </el-tabs>
  52. </el-card>
  53. <div
  54. v-if="oriD.find === 2"
  55. style="width: 100%; height: 50px; line-height: 50px; text-align: center"
  56. >
  57. 抱歉,没有找到该词语
  58. </div>
  59. </div>
  60. </template>
  61. <script setup>
  62. // 词典
  63. import { getVocabularyInfo } from '@/api/aleditor.js';
  64. import { ref } from 'vue';
  65. const is_status = ref('none');
  66. const input1 = ref('');
  67. const activeName = ref('词语解释');
  68. const oriD = ref({
  69. find: 0,
  70. });
  71. const search = () => {
  72. if (!input1.value) return;
  73. is_status.value = 'load';
  74. oriD.value.find = 1;
  75. getVocabularyInfo({
  76. data: {
  77. isSampleDocument: false,
  78. name: input1.value,
  79. },
  80. })
  81. .then(r => {
  82. console.log(r);
  83. is_status.value = 'none';
  84. oriD.value.bushou && (activeName.value = '基本解释');
  85. !oriD.value.pinyin ? (oriD.value.find = 2) : (oriD.value.find = 0);
  86. })
  87. .catch(() => {
  88. oriD.value.find = 2;
  89. is_status.value = 'none';
  90. });
  91. };
  92. </script>
  93. <style scoped>
  94. .dictionary {
  95. padding: 2px 10px 10px;
  96. }
  97. .pinyin {
  98. margin: 5px 5px 5px 0;
  99. display: block;
  100. font-size: 20px;
  101. color: #000;
  102. }
  103. .tab_pane {
  104. font-family: BlinkMacSystemFont, -apple-system, PingFang SC, Hiragino Sans GB,
  105. Source Han Sans SC, Noto Sans CJK SC, Microsoft YaHei, WenQuanYi Micro Hei,
  106. SimHei, sans-serif;
  107. }
  108. .note {
  109. font-family: 微软雅黑, Helvetica, Arial, sans-serif;
  110. -webkit-font-smoothing: antialiased;
  111. width: 100%;
  112. color: #888;
  113. font-size: 14px;
  114. }
  115. .dictionary-ul {
  116. display: inline-block;
  117. margin-left: 0 !important;
  118. }
  119. .dictionary-ul li {
  120. color: #000 !important;
  121. margin-left: 0 !important;
  122. font-family: '\6977\4F53', '\6977\4F53_gb2312' !important;
  123. display: inline-block !important;
  124. width: 80px;
  125. height: 80px;
  126. font-size: 58px;
  127. text-align: center !important;
  128. line-height: 80px;
  129. background-image: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iODAiIGhlaWdodD0iODAiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTS0yIDQwaDgyTTQwLTJ2ODIiIHN0cm9rZS1kYXNoYXJyYXk9IjQsNCIgc3Ryb2tlPSIjNjY2IiBmaWxsPSJub25lIi8+PHBhdGggZD0iTTEgMWg3OHY3OEgxeiIgc3Ryb2tlLXdpZHRoPSIyIiBzdHJva2U9IiMxMTEiIGZpbGw9Im5vbmUiLz48L3N2Zz4=) !important;
  130. margin: 0 5px 5px 0 !important;
  131. background-size: contain;
  132. }
  133. .bknr {
  134. width: 100%;
  135. color: #888;
  136. font-size: 14px;
  137. font-family: \\5fae软雅黑, Helvetica, Arial, sans-serif;
  138. -webkit-font-smoothing: antialiased;
  139. }
  140. .bknr h3 {
  141. font-weight: 600;
  142. font-size: 20px;
  143. }
  144. </style>