RetrievalView.vue 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319
  1. <template>
  2. <div class="containe">
  3. <div class="picture">
  4. <img src="../../assets/img/Group 467.png" alt="" />
  5. </div>
  6. <div class="search">
  7. <el-select v-model="type">
  8. <el-option value="1">公共文档</el-option>
  9. <el-option value="2">部门文档</el-option>
  10. <el-option value="3">个人文档</el-option>
  11. </el-select>
  12. <el-input auto-complete="on" type="text" name="content" placeholder="请输入查询关键字" v-model="input"
  13. @keyup.enter.native="searchPre"></el-input>
  14. <span class="cen—top-span" @click="searchPre">快速搜索</span>
  15. <img src="../../assets/img/ri:search-2-line@2x.png" class="cen—top-img" />
  16. </div>
  17. <div class="mains" @scroll="handleScroll" v-if="mains_data2">
  18. <div v-for="item in count" :key="item.id" class="main-main">
  19. <div class="one" @click="docName(item.id, item.content.info)">
  20. {{ item.content.info.docName }}
  21. </div>
  22. <div class="two">
  23. <div class="two1">
  24. <img src="../../assets/img/UserCircle.png" />
  25. {{ item.content.info.createBy }}
  26. </div>
  27. <div>
  28. <img src="../../assets/img/Clock.png" />
  29. {{ item.content.info.createTime }}
  30. </div>
  31. </div>
  32. <div class="three" v-for="highlightFieldsContentItem in item.highlightFields.content"
  33. :key="highlightFieldsContentItem.id" v-html="highlightFieldsContentItem" style="white-space: normal"></div>
  34. <ul class="four">
  35. <li v-for="tagName in item.content.info.tagList" :key="tagName.id">
  36. {{ tagName.tagName }}
  37. </li>
  38. </ul>
  39. </div>
  40. </div>
  41. <div class="mains_prompt" v-if="mains_data2">
  42. <span>滚动显示更多内容</span>
  43. <img src="../../assets/img/chevrons-down.png" alt="" />
  44. </div>
  45. <div class="empty" v-if="mains_data">
  46. <img src="../../assets/img/Empty.png" alt="" />
  47. <p>您搜索的内容暂无数据,建议更换关键词</p>
  48. </div>
  49. </div>
  50. </template>
  51. <script>
  52. import {
  53. ret
  54. } from "@/api/doc/share1.js";
  55. export default {
  56. data() {
  57. return {
  58. //搜索框绑定
  59. input: "",
  60. type: "",
  61. //搜索出来的数据
  62. count: [],
  63. page: 0,
  64. size: 3,
  65. mains_data: false,
  66. mains_data2: false,
  67. };
  68. },
  69. created() {
  70. this.input = this.$route.query.datas;
  71. if (this.input) {
  72. this.searchs();
  73. }
  74. },
  75. watch: {
  76. $route: {
  77. handler(val, oldval) {
  78. this.input = this.$route.query.datas;
  79. this.count = [];
  80. if (this.input != "") {
  81. this.searchs();
  82. } else {
  83. this.mains_data = true;
  84. this.mains_data2 = false;
  85. }
  86. },
  87. // 深度观察监听
  88. deep: true,
  89. },
  90. },
  91. mounted() {
  92. //添加滚动条事件
  93. window.addEventListener("scroll", this.handleScroll, true);
  94. },
  95. methods: {
  96. // 点击搜索调用的方法
  97. searchPre() {
  98. this.$router.push("/home/retrieval?datas=" + this.input);
  99. },
  100. handleScroll() {
  101. const container = document.querySelector(".mains");
  102. const {
  103. scrollTop,
  104. scrollHeight,
  105. clientHeight
  106. } = container;
  107. // console.log('scrollHeight',scrollHeight);
  108. // console.log('clientHeight',clientHeight);
  109. // console.log(scrollTop);
  110. // 是否达到页面底部
  111. if (scrollTop + clientHeight >= scrollHeight) {
  112. // console.log('滚动到底部了!')
  113. this.page += 1;
  114. // 执行加载
  115. this.searchs();
  116. }
  117. },
  118. //查找返回的数据
  119. searchs() {
  120. ret({
  121. content: this.input,
  122. type: this.type,
  123. page: this.page,
  124. size: this.size,
  125. }).then((item) => {
  126. // console.log('item=',item)
  127. if (item.length > 0) {
  128. this.count.push(...item);
  129. this.mains_data = false;
  130. this.mains_data2 = true;
  131. } else {
  132. this.input = "";
  133. this.mains_data = true;
  134. this.mains_data2 = false;
  135. }
  136. });
  137. },
  138. //预览界面
  139. docName(curentDocId, value) {
  140. this.$tab.openPage(
  141. // window.open("/individual/Pre/user/" + curentDocId, "_blank"),
  142. window.open(
  143. "/individual/Pre/user/" +
  144. curentDocId +
  145. "?value=" +
  146. JSON.stringify(value),
  147. "_blank"
  148. )
  149. );
  150. },
  151. },
  152. };
  153. </script>
  154. <style lang='scss'>
  155. .three {
  156. margin-bottom: calc(100vw * (10 / 1920));
  157. em {
  158. color: #f00 !important;
  159. }
  160. }
  161. </style>
  162. <style scoped lang='scss'>
  163. .containe {
  164. color: #7ea4c8;
  165. font-size: 0.14rem;
  166. font-family: PingFang SC-Medium, PingFang SC;
  167. font-weight: 500;
  168. }
  169. .picture {
  170. width: calc(100vw * (220 / 1920));
  171. height: calc(100vh * (57 / 1080));
  172. margin-left: calc(100vw * (860 / 1920));
  173. margin-top: calc(100vh * (100 / 1080));
  174. margin-bottom: calc(100vh * (40 / 1080));
  175. img {
  176. width: 100%;
  177. height: 100%;
  178. display: block;
  179. }
  180. }
  181. .search {
  182. width: calc(100vw * (864 / 1920));
  183. height: calc(100vh * (50 / 1080));
  184. margin-left: calc(100vw * (528 / 1920));
  185. margin-bottom: calc(100vh * (50 / 1080));
  186. position: relative;
  187. }
  188. .cen—top-img {
  189. width: calc(100vw * (24 / 1920));
  190. height: calc(100vh * (24 / 1080));
  191. position: absolute;
  192. left: calc(100vw * (15 / 1920));
  193. top: calc(100vh * (15 / 1080));
  194. }
  195. .el-input {
  196. width: calc(100vw * (750 / 1920));
  197. height: calc(100vh * (50 / 1080));
  198. margin-right: calc(100vw * (14 / 1920));
  199. }
  200. .cen—top-span {
  201. display: inline-block;
  202. width: calc(100vw * (100 / 1920));
  203. height: calc(100vh * (50 / 1080));
  204. background: #2e8aecff;
  205. color: #ffffffcc;
  206. text-align: center;
  207. line-height: calc(100vh * (50 / 1080));
  208. &:hover {
  209. cursor: pointer;
  210. }
  211. }
  212. .mains {
  213. width: calc(100vw * (1450 / 1920));
  214. height: calc(100vh * (600 / 1080));
  215. // background: seagreen;
  216. margin-left: calc(100vw * (230 / 1920));
  217. overflow: auto;
  218. }
  219. .mains_prompt {
  220. display: flex;
  221. align-items: center;
  222. margin-left: calc(100vw * (850 / 1920));
  223. margin-top: calc(100vh * (20 / 1080));
  224. }
  225. .empty {
  226. width: 100%;
  227. display: flex;
  228. flex-direction: column;
  229. justify-content: center;
  230. align-items: center;
  231. img {
  232. width: calc(100vw * (160 / 1920));
  233. height: calc(100vh * (160 / 1080));
  234. margin-top: calc(100vh * (150 / 1080));
  235. }
  236. }
  237. .main-main {
  238. width: calc(100vw * (1430 / 1920));
  239. // height: calc(100vh * (220 / 1080));
  240. padding: calc(100vh * (20 / 1080));
  241. border-bottom: 1px dashed #083b61ff;
  242. }
  243. .one {
  244. margin-bottom: calc(100vw * (10 / 1920));
  245. color: #2e8aecff;
  246. font-size: 14px;
  247. text-decoration: underline;
  248. }
  249. .two {
  250. margin-bottom: calc(100vh * (10 / 1080));
  251. display: flex;
  252. .two1 {
  253. margin-right: calc(100vw * (30 / 1920));
  254. }
  255. img {
  256. vertical-align: middle;
  257. }
  258. }
  259. .four {
  260. display: flex;
  261. list-style: none;
  262. padding: 0;
  263. li {
  264. // width: calc(100vw * (62 / 1920));
  265. // height: calc(100vh * (24 / 1080));
  266. border: 1px solid #ff9839ff;
  267. background: #bba99240;
  268. padding: 0 5px;
  269. margin-right: calc(100vw * (5 / 1920));
  270. }
  271. }
  272. //滚动条样式
  273. ::-webkit-scrollbar {
  274. width: 3.5px;
  275. }
  276. ::-webkit-scrollbar-track {
  277. background-color: rgba(0, 0, 0, 0);
  278. }
  279. ::-webkit-scrollbar-thumb {
  280. background: #2e8aec;
  281. border-radius: 3px;
  282. }
  283. ::-webkit-scrollbar-thumb:hover {
  284. background: #2e8aec;
  285. }
  286. ::v-deep .el-input--medium .el-input__inner {
  287. padding-left: calc(100vw * (50 / 1920));
  288. background: #14265e80;
  289. border: 1px solid #01d1ffff;
  290. color: #7ea4c8ff;
  291. }
  292. </style>