seekPage.vue 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  1. <template>
  2. <div class="corpus_seekpage">
  3. <Header :projectShow="true" :seekOptions="false" :seekOption="true" v-if="!userID" />
  4. <template v-if="showPage">
  5. <div class="title">
  6. <p>语料库词典</p>
  7. <p>Corpus Dictionary</p>
  8. </div>
  9. <div class="seek" @keydown="downSeek">
  10. <input type="text" v-model="keyword" />
  11. <button @click="seekEvent">搜索</button>
  12. </div>
  13. </template>
  14. <!-- <div class="txt">请搜索汉字,例如:好</div> -->
  15. </div>
  16. </template>
  17. <script>
  18. //这里可以导入其它文件(比如:组件,工具js,第三方插件js,json文件,图片文件等等)
  19. //例如:import 《组件名称》from ‘《组件路径》';
  20. import Header from '@/components/Header';
  21. import { getConfigInfor } from '@/utils/index';
  22. import { getStaticContent } from '@/api/api';
  23. import { setToken } from '@/utils/auth';
  24. export default {
  25. name: 'corpus_seekpage',
  26. //import引入的组件需要注入到对象中才能使用
  27. components: {
  28. Header,
  29. },
  30. props: {},
  31. data() {
  32. //这里存放数据
  33. return {
  34. keyword: null,
  35. AccessToken: this.$route.query.AccessToken,
  36. AppID: this.$route.query.AppID,
  37. showPage: false,
  38. userID: this.$route.query.UserID ? this.$route.query.UserID : '',
  39. };
  40. },
  41. //计算属性 类似于data概念
  42. computed: {},
  43. //监控data中数据变化
  44. watch: {},
  45. //方法集合
  46. methods: {
  47. downSeek(e) {
  48. if (e.keyCode == 13) {
  49. if (!this.keyword) {
  50. this.$message.warning('请输入要搜索的内容');
  51. return;
  52. }
  53. this.seekEvent();
  54. }
  55. },
  56. seekEvent() {
  57. if (!this.keyword) {
  58. this.$message.warning('请输入要搜索的内容');
  59. return;
  60. }
  61. this.$router.push({
  62. path: '/corpus/Result',
  63. query: {
  64. keyword: this.keyword,
  65. AppID: this.AppID,
  66. AccessToken: this.AccessToken,
  67. UserID: this.UserID,
  68. },
  69. });
  70. },
  71. },
  72. //生命周期 - 创建完成(可以访问当前this实例)
  73. async created() {
  74. const _this = this;
  75. if (this.AccessToken) {
  76. const Mname = 'login_control-ParseAccessToken';
  77. await getStaticContent(Mname, {
  78. access_token: _this.AccessToken,
  79. }).then((res) => {
  80. res.access_token = _this.AccessToken;
  81. setToken(res);
  82. sessionStorage.setItem('GCLS_Token_Tc', JSON.stringify(res));
  83. this.showPage = true;
  84. });
  85. await getConfigInfor();
  86. }
  87. localStorage.removeItem('seekPageData');
  88. this.showPage = true;
  89. },
  90. //生命周期 - 挂载完成(可以访问DOM元素)
  91. mounted() {},
  92. //生命周期-创建之前
  93. beforeCreated() {},
  94. //生命周期-挂载之前
  95. beforeMount() {},
  96. //生命周期-更新之前
  97. beforUpdate() {},
  98. //生命周期-更新之后
  99. updated() {},
  100. //生命周期-销毁之前
  101. beforeDestory() {},
  102. //生命周期-销毁完成
  103. destoryed() {},
  104. //如果页面有keep-alive缓存功能,这个函数会触发
  105. activated() {},
  106. };
  107. </script>
  108. <style lang="scss" scoped>
  109. /* @import url(); 引入css类 */
  110. .corpus_seekpage {
  111. .title {
  112. margin-top: 200px;
  113. > :nth-child(1) {
  114. font-weight: 700;
  115. font-size: 48px;
  116. line-height: 56px;
  117. color: #000000;
  118. margin-bottom: 12px;
  119. }
  120. > :nth-child(2) {
  121. font-weight: 400;
  122. font-size: 20px;
  123. line-height: 23px;
  124. }
  125. > p {
  126. margin: 0;
  127. text-align: center;
  128. }
  129. }
  130. .seek {
  131. margin-top: 41px;
  132. display: flex;
  133. justify-content: center;
  134. height: 51px;
  135. input {
  136. width: 468px;
  137. height: 51px;
  138. border: 1px solid #669aff;
  139. outline: none;
  140. box-sizing: border-box;
  141. padding: 0 10px;
  142. }
  143. button {
  144. width: 96px;
  145. height: 100%;
  146. background: #669aff;
  147. border-width: 1px 1px 1px 0px;
  148. border-style: solid;
  149. border-color: #669aff;
  150. text-align: center;
  151. font-weight: 400;
  152. font-size: 16px;
  153. line-height: 51px;
  154. color: #ffffff;
  155. cursor: pointer;
  156. box-sizing: border-box;
  157. }
  158. }
  159. .txt {
  160. margin-top: 41px;
  161. text-align: center;
  162. font-weight: 400;
  163. font-size: 16px;
  164. line-height: 19px;
  165. color: #000000;
  166. opacity: 0.65;
  167. }
  168. }
  169. </style>