Geen omschrijving

index.vue 4.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. <template>
  2. <div class="main-content">
  3. <div class="wrapper-left">
  4. <div class="block-wrapper search-wrapper">
  5. <el-input v-model="keyVal" @keyup.enter.native="keywordSearch" placeholder="请输入服务内容、发布者或相关关键词" class="input-with-select">
  6. <el-button slot="append" icon="el-icon-search" @click="keywordSearch">搜索</el-button>
  7. </el-input>
  8. </div>
  9. <div class="block-wrapper">
  10. <!-- <div class="content-wrapper tab-wrapper">
  11. <div class="tab-lable">服务类型:</div>
  12. <ul class="tab-sort">
  13. <li>不限</li>
  14. <li>检测服务</li>
  15. </ul>
  16. </div> -->
  17. <div class="tab-contain">
  18. <div v-show="!ifDefault" v-if="platServices.length">
  19. <baseService v-for="item in platServices" :key="item.index" :itemSingle="item"></baseService>
  20. <Loading v-show="loadingModalShow" :loadingComplete="loadingComplete" :isLoading="isLoading" v-on:upup="searchLower"></Loading>
  21. </div>
  22. <defaultPage v-show="ifDefault"></defaultPage>
  23. </div>
  24. </div>
  25. </div>
  26. <div class="wrapper-right" v-if="adinfo.length">
  27. <div class="block-wrapper" v-for="item in adinfo" :key="item.index">
  28. <a class="ad-wrapper" :href="item.adUrl" target="_blank">
  29. <img :src="item.imgUrl" width="280" height="200">
  30. </a>
  31. </div>
  32. </div>
  33. <BackTop></BackTop>
  34. </div>
  35. </template>
  36. <script>
  37. import { urlParse } from '@/libs/util';
  38. import baseService from '@/components/subTemplate/BaseService';
  39. export default {
  40. data() {
  41. return {
  42. /* eslint-disable no-undef */
  43. adinfo: PLAT.info.adinfo,
  44. rows: 20,
  45. dataO: {
  46. serSortFirst: '',
  47. serTime: '',
  48. serId: ''
  49. },
  50. keyVal: '',
  51. platServices: [],
  52. loadingModalShow: true, // 是否显示按钮
  53. loadingComplete: false, // 是否全部加载
  54. isFormSearch: false, // 数据加载
  55. isLoading: false, // button style...
  56. ifDefault: false // 是否缺省
  57. };
  58. },
  59. created() {
  60. this.keyVal = urlParse('key');
  61. this.searchService();
  62. },
  63. methods: {
  64. searchService() {
  65. this.$axios.getk('/ajax/ware/index/search', {
  66. key: this.keyVal,
  67. sortFirst: this.dataO.serSortFirst,
  68. time: this.dataO.serTime,
  69. id: this.dataO.serId,
  70. rows: this.rows
  71. }, (res) => {
  72. if (res.success) {
  73. var $info = res.data;
  74. if ($info.length > 0) {
  75. this.dataO.serSortFirst = $info[$info.length - 1].sortFirst;
  76. this.dataO.serTime = $info[$info.length - 1].modifyTime;
  77. this.dataO.serId = $info[$info.length - 1].id;
  78. this.platServices = this.isFormSearch ? this.platServices.concat($info) : $info;
  79. this.isFormSearch = true;
  80. if ($info.length < this.rows) {
  81. this.loadingModalShow = false;
  82. this.isFormSearch = false;
  83. };
  84. } else {
  85. this.loadingModalShow = false;
  86. this.isFormSearch = false;
  87. };
  88. var liLen = this.platServices.length;
  89. if ($info.length === 0 && liLen === 0) {
  90. this.ifDefault = true;
  91. };
  92. };
  93. });
  94. },
  95. searchLower() {
  96. if (this.loadingModalShow && !this.isLoading) {
  97. this.searchService();
  98. }
  99. },
  100. keywordSearch() {
  101. if (this.keyVal) {
  102. this.dataO.serSortFirst = '';
  103. this.dataO.serTime = '';
  104. this.dataO.serId = '';
  105. this.isFormSearch = true;
  106. this.loadingModalShow = false;
  107. this.loadingComplete = true;
  108. this.isLoading = false;
  109. this.platServices = [];
  110. this.ifDefault = false;
  111. this.searchService();
  112. } else {
  113. this.keyVal = '';
  114. this.$message({
  115. message: '请填写搜索服务的关键词',
  116. type: 'warning'
  117. });
  118. }
  119. }
  120. },
  121. components: {
  122. baseService
  123. }
  124. };
  125. </script>
  126. <style>
  127. @import '../ViewFindResource/css.css';
  128. </style>