search.vue 5.1 KB

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