index.vue 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356
  1. <template>
  2. <view class="content">
  3. <view class="swiper-box" style="width: 100%">
  4. <swiper
  5. class="swiper"
  6. indicator-dots="true"
  7. autoplay="true"
  8. duration="500"
  9. style="height: 300rpx"
  10. >
  11. <swiper-item v-for="(item, index) in swiperList" :key="index">
  12. <image
  13. :src="item.pic_path"
  14. mode="aspectFill"
  15. style="width: 100%; height: 100%"
  16. ></image>
  17. </swiper-item>
  18. </swiper>
  19. </view>
  20. <view class="input-box">
  21. <image src="/static/policy/u377.png" alt="" />
  22. <input type="text" placeholder="请输入政策关键词搜索" confirm-type="search" @confirm="searchPoliy()" v-model="searchVal"/>
  23. </view>
  24. <view class="policy-box">
  25. <view class="policy-title"><p>最新政策</p></view>
  26. <view class="policy-item-box">
  27. <view
  28. v-for="(item, idx) in policyList"
  29. :key="idx"
  30. :class="{ active: active === idx }"
  31. class="policy-item-name"
  32. @click="changePolicyTabs(idx)"
  33. >
  34. {{ item }}
  35. </view>
  36. </view>
  37. <view class="policy-content">
  38. <view
  39. class="policy-content-item"
  40. v-for="(item, idx) in policyData"
  41. :key="idx"
  42. @click="enterPolicyDeatil(item.id)"
  43. >
  44. <view class="policy-content-item-left">
  45. <p class="policy-content-item-left-title" style="height: 70rpx;">{{ item.title }}</p>
  46. <view class="policy-content-item-left-time">
  47. <p class="moment">{{ item.publish_time | globalTime }}</p>
  48. <p class="maxMony">{{ item.project_money }}</p>
  49. <p class="leftDay">{{ (item.project_end_date | globalTime) || '长期可申报' }}</p>
  50. </view>
  51. </view>
  52. <view class="policy-content-item-img">
  53. <image :src="item.pic_url" alt="" />
  54. </view>
  55. </view>
  56. </view>
  57. </view>
  58. </view>
  59. </template>
  60. <script>
  61. import md5 from "@/common/md5.js";
  62. export default {
  63. data() {
  64. return {
  65. swiperList: [
  66. // {
  67. // img: "/static/swiper/swiper1.jpg",
  68. // },
  69. // {
  70. // img: "/static/swiper/swiper2.jpg",
  71. // },
  72. ],
  73. policyList: ["省级政策", "市级政策", "区级政策", "新城政策"],
  74. active: 0,
  75. searchVal:'',
  76. policyData: new Array(5).fill({
  77. title:"工业金额信息化部办公厅 组织开2021念工业互联网平台创新互联网工业文化产业项目征集工作。",
  78. moment: "2021-07-12",
  79. maxMony: "最高500.00万",
  80. leftDay: "剩5天",
  81. img: "/static/policy/u388.jpg",
  82. }),
  83. };
  84. },
  85. onLoad() {
  86. this.getPolicySwiper()
  87. this.getPolicyList()
  88. },
  89. methods: {
  90. enterPolicyDeatil(id) {
  91. uni.navigateTo({
  92. url: "/pages/policy/policy_deatil?id=" + id,
  93. });
  94. },
  95. changePolicyTabs(idx){
  96. let that = this;
  97. that.active = idx;
  98. switch (idx){
  99. case 0:
  100. that.getPolicyList('1')
  101. break;
  102. case 1:
  103. that.getPolicyList('2')
  104. break;
  105. case 2:
  106. that.getPolicyList('3')
  107. break;
  108. case 3:
  109. that.getPolicyList('4')
  110. break;
  111. }
  112. },
  113. searchPoliy(){
  114. let md5Sign = md5(
  115. "method=" +
  116. "common" +
  117. "&timestamp=" +
  118. getApp().globalData.globalTimestamp +
  119. "&secret=" +
  120. getApp().globalData.secret
  121. );
  122. let url = getApp().globalData.shareUrl +"api/api.php" +"?method=common&source=policy&action=list&timestamp=" +getApp().globalData.globalTimestamp +"&sign=" +md5Sign;
  123. uni.request({
  124. url: url,
  125. method: "POST",
  126. header: {
  127. "content-type": "application/x-www-form-urlencoded",
  128. },
  129. data: {
  130. ss_content_text:this.searchVal //1.省 2.市 3.区 4.新城
  131. },
  132. success: (res) => {
  133. console.log(res);
  134. if (res.data.code === 200) {
  135. }
  136. },
  137. fail: () => {
  138. console.log("连接失败");
  139. },
  140. });
  141. },
  142. getPolicySwiper() {
  143. let md5Sign = md5(
  144. "method=" +
  145. "common" +
  146. "&timestamp=" +
  147. getApp().globalData.globalTimestamp +
  148. "&secret=" +
  149. getApp().globalData.secret
  150. );
  151. let url =
  152. getApp().globalData.shareUrl +
  153. "api/api.php" +
  154. "?method=common&source=policy_pics&action=list&timestamp=" +
  155. getApp().globalData.globalTimestamp +
  156. "&sign=" +
  157. md5Sign;
  158. uni.request({
  159. url: url,
  160. method: "POST",
  161. header: {
  162. "content-type": "application/x-www-form-urlencoded",
  163. },
  164. data: {
  165. order_by: "weight desc",
  166. s_status: 1,
  167. // page: 1,
  168. // page_size: 7,
  169. },
  170. success: (res) => {
  171. console.log(res);
  172. if (res.data.code === 200) {
  173. res.data.data.list.forEach((item) => {
  174. item.pic_path = getApp().globalData.shareUrl + item.pic_path;
  175. });
  176. this.swiperList = res.data.data.list;
  177. }
  178. },
  179. fail: () => {
  180. console.log("连接失败");
  181. },
  182. });
  183. },
  184. getPolicyList(level) {
  185. let md5Sign = md5(
  186. "method=" +
  187. "common" +
  188. "&timestamp=" +
  189. getApp().globalData.globalTimestamp +
  190. "&secret=" +
  191. getApp().globalData.secret
  192. );
  193. let url = getApp().globalData.shareUrl +"api/api.php" +"?method=common&source=policy&action=list&timestamp=" +getApp().globalData.globalTimestamp +"&sign=" +md5Sign;
  194. uni.request({
  195. url: url,
  196. method: "POST",
  197. header: {
  198. "content-type": "application/x-www-form-urlencoded",
  199. },
  200. data: {
  201. s_level:level || '1' //1.省 2.市 3.区 4.新城
  202. },
  203. success: (res) => {
  204. console.log(res);
  205. if (res.data.code === 200) {
  206. res.data.data.list.forEach((item) => {
  207. item.pic_url = getApp().globalData.shareUrl + item.pic_url;
  208. });
  209. this.policyData = res.data.data.list;
  210. }
  211. },
  212. fail: () => {
  213. console.log("连接失败");
  214. },
  215. });
  216. },
  217. },
  218. };
  219. </script>
  220. <style lang="scss">
  221. .content {
  222. display: flex;
  223. flex-direction: column;
  224. align-items: center;
  225. justify-content: center;
  226. box-sizing: border-box;
  227. .input-box {
  228. width: 100%;
  229. height: 100rpx;
  230. background-color: #6ea0ec;
  231. display: flex;
  232. justify-content: center;
  233. align-items: center;
  234. position: relative;
  235. image {
  236. position: absolute;
  237. left: 72rpx;
  238. width: 30rpx;
  239. height: 30rpx;
  240. }
  241. input {
  242. background-color: #ffffff;
  243. width: 90%;
  244. height: 70%;
  245. border-radius: 50rpx;
  246. padding: 3rpx;
  247. font-size: 26rpx;
  248. padding-left: 80rpx;
  249. box-sizing: border-box;
  250. }
  251. }
  252. .policy-box {
  253. margin-top: 50rpx;
  254. width: 100%;
  255. display: flex;
  256. flex-direction: column;
  257. .policy-title {
  258. width: 100%;
  259. p {
  260. background-color: #02a7f0;
  261. width: 190rpx;
  262. height: 70rpx;
  263. color: #ffffff;
  264. border-radius: 0 40rpx 40rpx 0rpx;
  265. font-size: 28rpx;
  266. display: flex;
  267. justify-content: center;
  268. align-items: center;
  269. }
  270. }
  271. .policy-item-box {
  272. display: flex;
  273. justify-content: space-between;
  274. margin: 0 20rpx;
  275. margin-top: 20rpx;
  276. .policy-item-name {
  277. padding-bottom: 10rpx;
  278. font-size: 27rpx;
  279. }
  280. .active {
  281. font-weight: 600;
  282. border-bottom: 7rpx solid #02a7f0;
  283. }
  284. }
  285. .policy-content {
  286. width: 100%;
  287. display: flex;
  288. box-sizing: border-box;
  289. flex-direction: column;
  290. margin-top: 10rpx;
  291. .policy-content-item {
  292. margin: 0 20rpx;
  293. display: flex;
  294. box-shadow: 0px 4rpx 32rpx rgba(0, 0, 0, 0.1);
  295. border-radius: 32rpx;
  296. padding-bottom: 10rpx;
  297. margin-top: 20rpx;
  298. padding: 30rpx;
  299. justify-content: space-between;
  300. .policy-content-item-left {
  301. display: flex;
  302. flex-direction: column;
  303. width: 70%;
  304. .policy-content-item-left-title {
  305. text-overflow: -o-ellipsis-lastline;
  306. overflow: hidden;
  307. text-overflow: ellipsis;
  308. display: -webkit-box;
  309. -webkit-line-clamp: 2;
  310. line-clamp: 2;
  311. -webkit-box-orient: vertical;
  312. font-size: 25rpx;
  313. margin-bottom: 10rpx;
  314. }
  315. .policy-content-item-left-time {
  316. width: 100%;
  317. display: flex;
  318. align-items: center;
  319. .moment {
  320. color: #c1c1c1;
  321. font-size: 20rpx;
  322. margin-right: 20rpx;
  323. }
  324. .maxMony {
  325. font-size: 20rpx;
  326. color: #00bfbf;
  327. border: 1px solid #00bfbf;
  328. padding: 10rpx;
  329. margin-right: 20rpx;
  330. border-radius: 12rpx;
  331. }
  332. .leftDay {
  333. font-size: 20rpx;
  334. background: #f7bbc3;
  335. color: #e32579;
  336. padding: 10rpx;
  337. border: 1px solid #f7bbc3;
  338. border-radius: 12rpx;
  339. }
  340. }
  341. }
  342. .policy-content-item-img {
  343. image {
  344. width: 180rpx;
  345. height: 120rpx;
  346. border-radius: 12rpx;
  347. }
  348. }
  349. }
  350. }
  351. }
  352. }
  353. </style>