search.vue 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  1. <template>
  2. <view class="content">
  3. <view class="input-box">
  4. <image src="/static/policy/u377.png" alt="" />
  5. <input type="text" placeholder="请输入政策关键词搜索" confirm-type="search" @confirm="searchPoliy()" v-model="searchVal"/>
  6. </view>
  7. <view class="policy-box">
  8. <view class="policy-content">
  9. <view
  10. class="policy-content-item"
  11. v-for="(item, idx) in policyData"
  12. :key="idx"
  13. @click="enterPolicyDeatil(item.id)"
  14. >
  15. <view class="policy-content-item-left">
  16. <p class="policy-content-item-left-title" style="height: 70rpx;">{{ item.title }}</p>
  17. <view class="policy-content-item-left-time">
  18. <p class="moment">{{ item.publish_time | globalTime }}</p>
  19. <p class="maxMony">{{ item.project_money }}</p>
  20. <p class="leftDay">{{ (item.project_end_date | globalTime) || '长期可申报' }}</p>
  21. </view>
  22. </view>
  23. <view class="policy-content-item-img">
  24. <image :src="'https://kiq.xazhima.com'+item.pic_url" alt="" />
  25. </view>
  26. </view>
  27. </view>
  28. </view>
  29. </view>
  30. </template>
  31. <script>
  32. import md5 from "@/common/md5.js";
  33. export default {
  34. data() {
  35. return {
  36. active: 0,
  37. searchVal:'',
  38. policyData: [],
  39. };
  40. },
  41. methods: {
  42. enterPolicyDeatil(id) {
  43. uni.navigateTo({
  44. url: "/pages/policy/policy_deatil?id=" + id,
  45. });
  46. },
  47. searchPoliy(){
  48. let md5Sign = md5(
  49. "method=" +
  50. "common" +
  51. "&timestamp=" +
  52. getApp().globalData.globalTimestamp +
  53. "&secret=" +
  54. getApp().globalData.secret
  55. );
  56. let url = getApp().globalData.shareUrl +"api/api.php" +"?method=common&source=policy&action=list&timestamp=" +getApp().globalData.globalTimestamp +"&sign=" +md5Sign;
  57. uni.request({
  58. url: url,
  59. method: "POST",
  60. header: {
  61. "content-type": "application/x-www-form-urlencoded",
  62. },
  63. data: {
  64. ss_content_text:this.searchVal //1.省 2.市 3.区 4.新城
  65. },
  66. success: (res) => {
  67. if (res.data.code === 200) {
  68. this.policyData = res.data.data.list
  69. console.log(res.data.data.list);
  70. }
  71. },
  72. fail: () => {
  73. console.log("连接失败");
  74. },
  75. });
  76. },
  77. },
  78. };
  79. </script>
  80. <style lang="scss">
  81. .content {
  82. display: flex;
  83. flex-direction: column;
  84. align-items: center;
  85. justify-content: center;
  86. box-sizing: border-box;
  87. .input-box {
  88. width: 100%;
  89. height: 100rpx;
  90. background-color: #02a7f0;
  91. display: flex;
  92. justify-content: center;
  93. align-items: center;
  94. position: relative;
  95. image {
  96. position: absolute;
  97. left: 72rpx;
  98. width: 30rpx;
  99. height: 30rpx;
  100. }
  101. input {
  102. background-color: #ffffff;
  103. width: 90%;
  104. height: 70%;
  105. border-radius: 50rpx;
  106. padding: 3rpx;
  107. font-size: 26rpx;
  108. padding-left: 80rpx;
  109. box-sizing: border-box;
  110. }
  111. }
  112. .policy-box {
  113. width: 100%;
  114. display: flex;
  115. flex-direction: column;
  116. .policy-content {
  117. width: 100%;
  118. display: flex;
  119. box-sizing: border-box;
  120. flex-direction: column;
  121. margin-top: 10rpx;
  122. .policy-content-item {
  123. margin: 0 20rpx;
  124. display: flex;
  125. box-shadow: 0px 4rpx 32rpx rgba(0, 0, 0, 0.1);
  126. border-radius: 32rpx;
  127. padding-bottom: 10rpx;
  128. margin-top: 20rpx;
  129. padding: 30rpx;
  130. justify-content: space-between;
  131. .policy-content-item-left {
  132. display: flex;
  133. flex-direction: column;
  134. width: 70%;
  135. .policy-content-item-left-title {
  136. text-overflow: -o-ellipsis-lastline;
  137. overflow: hidden;
  138. text-overflow: ellipsis;
  139. display: -webkit-box;
  140. -webkit-line-clamp: 2;
  141. line-clamp: 2;
  142. -webkit-box-orient: vertical;
  143. font-size: 25rpx;
  144. margin-bottom: 10rpx;
  145. }
  146. .policy-content-item-left-time {
  147. width: 100%;
  148. display: flex;
  149. align-items: center;
  150. .moment {
  151. color: #c1c1c1;
  152. font-size: 20rpx;
  153. margin-right: 20rpx;
  154. }
  155. .maxMony {
  156. font-size: 20rpx;
  157. color: #00bfbf;
  158. border: 1px solid #00bfbf;
  159. padding: 10rpx;
  160. margin-right: 20rpx;
  161. border-radius: 12rpx;
  162. }
  163. .leftDay {
  164. font-size: 20rpx;
  165. background: #f7bbc3;
  166. color: #e32579;
  167. padding: 10rpx;
  168. border: 1px solid #f7bbc3;
  169. border-radius: 12rpx;
  170. }
  171. }
  172. }
  173. .policy-content-item-img {
  174. image {
  175. width: 180rpx;
  176. height: 120rpx;
  177. border-radius: 12rpx;
  178. }
  179. }
  180. }
  181. }
  182. }
  183. }
  184. </style>