index.vue 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193
  1. <template>
  2. <view class="content">
  3. <view class="input-box">
  4. <image src="/static/policy/u377.png" alt="" />
  5. <input
  6. type="text"
  7. placeholder="请输入政策关键词搜索"
  8. v-model="input"
  9. @confirm="getNotice"
  10. />
  11. </view>
  12. <view class="notices">
  13. <view
  14. class="notice-content-box"
  15. v-for="(item, index) in noticeList"
  16. :key="index"
  17. confirm-type="search"
  18. @click="goNoticeDeatil(item.id)"
  19. >
  20. <image
  21. :src="imgUrl[item.type - 1]"
  22. mode="aspectFit"
  23. style="width: 34px; height: 34px"
  24. ></image>
  25. <view class="notice-content display-around-column">
  26. <view class="notice-content-font">{{
  27. titleList[item.type - 1] + item.title
  28. }}</view>
  29. <view class="notice-content-time">{{
  30. item.publish_time | globalTime
  31. }}</view>
  32. </view>
  33. </view>
  34. </view>
  35. </view>
  36. </template>
  37. <script>
  38. import md5 from "@/common/md5.js";
  39. export default {
  40. data() {
  41. return {
  42. noticeList: [
  43. // {
  44. // url: "/static/navList/policy-icon.png",
  45. // title: "政策速览 | 小微企业、个体工商户税费...",
  46. // time: "2021-08-05",
  47. // },
  48. // {
  49. // url: "/static/navList/activity-icon.png",
  50. // title: "活动预告 | 想了解跨境电商?8月5日带...",
  51. // time: "2021-08-04",
  52. // },
  53. // {
  54. // url: "/static/navList/notice-icon.png",
  55. // title: "通知公告 | 2022年首批次重点新材料扶...",
  56. // time: "2021-08-03",
  57. // },
  58. ],
  59. input: "",
  60. imgUrl: [
  61. "/static/navList/activity-icon.png", //活动 1
  62. "/static/navList/policy-icon.png", //政策 type2
  63. "/static/navList/notice-icon.png", //通知 3
  64. ],
  65. titleList: ["活动预告 | ", "政策速览 | ", "通知公告 | "],
  66. };
  67. },
  68. onLoad() {
  69. this.getNotice();
  70. },
  71. methods: {
  72. goNoticeDeatil(id) {
  73. uni.navigateTo({
  74. url: "/pages/notice/notice_deatil?id=" + id,
  75. });
  76. },
  77. getNotice() {
  78. let md5Sign = md5(
  79. "method=" +
  80. "common" +
  81. "&timestamp=" +
  82. getApp().globalData.globalTimestamp +
  83. "&secret=" +
  84. getApp().globalData.secret
  85. );
  86. let url =
  87. getApp().globalData.shareUrl +
  88. "api/api.php" +
  89. "?method=common&source=notice&action=list&timestamp=" +
  90. getApp().globalData.globalTimestamp +
  91. "&sign=" +
  92. md5Sign;
  93. let postData = {
  94. // s_title: this.input,
  95. };
  96. uni.request({
  97. url: url,
  98. method: "POST",
  99. header: {
  100. "content-type": "application/x-www-form-urlencoded",
  101. },
  102. data: postData,
  103. success: (res) => {
  104. if (res.data.code === 200) {
  105. // console.log(res.data.data.list);
  106. this.noticeList = res.data.data.list;
  107. }
  108. },
  109. fail: () => {
  110. console.log("连接失败");
  111. },
  112. });
  113. },
  114. },
  115. };
  116. </script>
  117. <style lang="scss" scoped>
  118. .content {
  119. display: flex;
  120. flex-direction: column;
  121. align-items: center;
  122. justify-content: center;
  123. width: 100%;
  124. .notices {
  125. display: flex;
  126. // justify-content: center;
  127. align-items: center;
  128. flex-direction: column;
  129. .notice-content-box {
  130. width: 100%;
  131. display: flex;
  132. padding: 30rpx;
  133. background-color: #ffffff;
  134. box-shadow: 0px 4rpx 32rpx rgba(0, 0, 0, 0.1);
  135. border-radius: 32rpx;
  136. margin-top: 20rpx;
  137. // justify-content: space-between;
  138. .notice-content-font {
  139. margin-left: 40rpx;
  140. font-size: 26rpx;
  141. color: #0d1937;
  142. font-weight: 600;
  143. overflow: hidden;
  144. text-overflow: ellipsis;
  145. white-space: nowrap;
  146. }
  147. .attract-content {
  148. color: #697594;
  149. font-weight: 600;
  150. font-size: 20rpx;
  151. margin-top: 8rpx;
  152. overflow: hidden;
  153. text-overflow: ellipsis;
  154. white-space: nowrap;
  155. }
  156. .notice-content-time {
  157. margin-left: 40rpx;
  158. font-size: 18rpx;
  159. letter-spacing: 0.02em;
  160. color: #cfcfcf;
  161. margin-right: 14rpx;
  162. }
  163. }
  164. }
  165. .input-box {
  166. width: 100%;
  167. height: 100rpx;
  168. display: flex;
  169. justify-content: center;
  170. align-items: center;
  171. position: relative;
  172. image {
  173. position: absolute;
  174. left: 72rpx;
  175. width: 40rpx;
  176. height: 40rpx;
  177. }
  178. input {
  179. background-color: rgba($color: #000000, $alpha: 0.1);
  180. width: 90%;
  181. height: 70%;
  182. border-radius: 50rpx;
  183. padding: 3rpx;
  184. font-size: 26rpx;
  185. padding-left: 80rpx;
  186. box-sizing: border-box;
  187. }
  188. }
  189. }
  190. </style>