search.vue 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233
  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 class="policy-content-item" v-for="(item, idx) in policyData" :key="idx" @click="enterPolicyDeatil(item.id)" >
  10. <p class="policy-content-item-left-title" style="height: 86rpx">
  11. {{ item.title }}
  12. </p>
  13. <view class="policy-content-item-left-time" v-if="item.level != '5'">
  14. <p class="moment">{{ item.publish_time | globalTime }}</p>
  15. <p class="maxMony" v-if="item.project_money!=='-' && item.project_money ">{{ item.project_money }}</p>
  16. <p class="leftDay" v-if=" item.project_end_date && Math.floor( new Date( new Date(item.project_end_date).getTime() -new Date().getTime() ).getTime() /(1 * 24 * 60 * 60 * 1000) ) +1 >= 1">
  17. 剩{{ Math.floor(new Date(new Date(item.project_end_date).getTime() -new Date().getTime()).getTime() /(1 * 24 * 60 * 60 * 1000)) + 1}}天
  18. </p>
  19. <p class="leftDay" v-if="item.project_end_date && Math.floor(new Date(new Date(item.project_end_date).getTime() - new Date().getTime()).getTime() / (1 * 24 * 60 * 60 * 1000)) + 1 < 1 ">
  20. 申报结束
  21. </p>
  22. <p class="leftDay" v-if="!item.project_end_date">长期可申报</p>
  23. </view>
  24. <view class="policy-content-item-left-time" v-if="item.level == '5'">
  25. <p class="moment">{{ item.publish_time | globalTime }}</p>
  26. </view>
  27. <!-- <view class="policy-content-item-img">
  28. <image :src="item.pic_url" alt="" mode="aspectFill"/>
  29. </view> -->
  30. </view>
  31. </view>
  32. </view>
  33. <image src="../../static/nodata.svg" mode="aspectFit" style="width: 100%;" v-if="policyData.length === 0"></image>
  34. </view>
  35. </template>
  36. <script>
  37. import md5 from "@/common/md5.js";
  38. export default {
  39. data() {
  40. return {
  41. active: 0,
  42. searchVal:'',
  43. policyData: [],
  44. };
  45. },
  46. onLoad(option) {
  47. if(option.val){
  48. this.searchPolicy(option.val)
  49. }
  50. },
  51. // onBackPress(event){
  52. // uni.navigateBack();
  53. // },
  54. methods: {
  55. enterPolicyDeatil(id) {
  56. uni.navigateTo({
  57. url: "/pages/policy/policy_deatil?id=" + id,
  58. });
  59. },
  60. searchPolicy(val){
  61. let md5Sign = md5(
  62. "method=" +
  63. "common" +
  64. "&timestamp=" +
  65. getApp().globalData.globalTimestamp +
  66. "&secret=" +
  67. getApp().globalData.secret
  68. );
  69. let url = getApp().globalData.shareUrl +"api/api.php" +"?method=common&source=policy&action=list&timestamp=" +getApp().globalData.globalTimestamp +"&sign=" +md5Sign;
  70. uni.request({
  71. url: url,
  72. method: "POST",
  73. header: {
  74. "content-type": "application/x-www-form-urlencoded",
  75. },
  76. data: {
  77. ss_content_text:val || this.searchVal //1.省 2.市 3.区 4.新城
  78. },
  79. success: (res) => {
  80. if (res.data.code === 200) {
  81. this.policyData = res.data.data.list
  82. }
  83. },
  84. fail: () => {
  85. console.log("连接失败");
  86. },
  87. });
  88. },
  89. },
  90. };
  91. </script>
  92. <style lang="scss">
  93. .content {
  94. display: flex;
  95. flex-direction: column;
  96. align-items: center;
  97. justify-content: center;
  98. box-sizing: border-box;
  99. .input-box {
  100. width: 100%;
  101. height: 100rpx;
  102. background-color: #02a7f0;
  103. display: flex;
  104. justify-content: center;
  105. align-items: center;
  106. position: relative;
  107. image {
  108. position: absolute;
  109. left: 72rpx;
  110. width: 30rpx;
  111. height: 30rpx;
  112. }
  113. input {
  114. background-color: #ffffff;
  115. width: 90%;
  116. height: 70%;
  117. border-radius: 50rpx;
  118. padding: 3rpx;
  119. font-size: 28rpx;
  120. padding-left: 80rpx;
  121. box-sizing: border-box;
  122. }
  123. }
  124. .policy-box {
  125. margin-top: 50rpx;
  126. width: 100%;
  127. display: flex;
  128. flex-direction: column;
  129. .policy-title {
  130. width: 100%;
  131. p {
  132. background-color: #02a7f0;
  133. width: 190rpx;
  134. height: 70rpx;
  135. color: #ffffff;
  136. border-radius: 0 40rpx 40rpx 0rpx;
  137. font-size: 30rpx;
  138. display: flex;
  139. justify-content: center;
  140. align-items: center;
  141. }
  142. }
  143. .policy-item-box {
  144. display: flex;
  145. justify-content: space-between;
  146. margin: 0 20rpx;
  147. margin-top: 20rpx;
  148. .policy-item-name {
  149. padding-bottom: 10rpx;
  150. font-size: 30rpx;
  151. }
  152. .active {
  153. font-weight: 600;
  154. border-bottom: 7rpx solid #02a7f0;
  155. }
  156. }
  157. .policy-content {
  158. width: 100%;
  159. display: flex;
  160. box-sizing: border-box;
  161. flex-direction: column;
  162. margin-top: 10rpx;
  163. .policy-content-item {
  164. margin: 0 20rpx;
  165. display: flex;
  166. box-shadow: 0px 4rpx 32rpx rgba(0, 0, 0, 0.1);
  167. border-radius: 32rpx;
  168. padding-bottom: 10rpx;
  169. margin-top: 20rpx;
  170. padding: 30rpx;
  171. justify-content: space-between;
  172. align-items: center;
  173. flex-direction: column;
  174. .policy-content-item-left-title {
  175. width: 100%;
  176. text-overflow: -o-ellipsis-lastline;
  177. overflow: hidden;
  178. text-overflow: ellipsis;
  179. display: -webkit-box;
  180. -webkit-line-clamp: 2;
  181. line-clamp: 2;
  182. -webkit-box-orient: vertical;
  183. font-size: 32rpx;
  184. margin-bottom: 10rpx;
  185. }
  186. .policy-content-item-left-time {
  187. width: 100%;
  188. display: flex;
  189. align-items: center;
  190. .moment {
  191. color: #c1c1c1;
  192. font-size: 24rpx;
  193. margin-right: 20rpx;
  194. white-space: nowrap;
  195. }
  196. .maxMony {
  197. font-size: 24rpx;
  198. color: #00bfbf;
  199. border: 1px solid #00bfbf;
  200. padding: 10rpx;
  201. margin-right: 20rpx;
  202. border-radius: 12rpx;
  203. overflow: hidden;
  204. text-overflow: ellipsis;
  205. white-space: nowrap;
  206. // width: 46%;
  207. // text-align: center;
  208. }
  209. .leftDay {
  210. font-size: 24rpx;
  211. background: #f7bbc3;
  212. color: #e32579;
  213. padding: 10rpx;
  214. border: 1px solid #f7bbc3;
  215. border-radius: 12rpx;
  216. white-space: nowrap;
  217. }
  218. }
  219. .policy-content-item-img {
  220. image {
  221. width: 170rpx;
  222. height: 120rpx;
  223. border-radius: 12rpx;
  224. }
  225. }
  226. }
  227. }
  228. }
  229. }
  230. </style>