search.vue 6.8 KB

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