index.vue 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211
  1. <template>
  2. <view class="content">
  3. <view class="header">
  4. <image src="/static/attract/u2043.png" alt="" class="header-image" mode="aspectFill" />
  5. </view>
  6. <view class="attracts">
  7. <view class="activity-theme">活动主题</view>
  8. <view
  9. class="notice-content-box"
  10. v-for="(item, index) in attractList"
  11. :key="index"
  12. style="justify-content: start"
  13. @click="goAttractDeatil(item.id, item.time_type)">
  14. <view class="maskModal" v-if="item.time_type == 0">
  15. <text>敬请期待</text>
  16. </view>
  17. <image
  18. :src="item.pic_url"
  19. mode="aspectFill"
  20. style="
  21. width: 112rpx;
  22. height: 112rpx;
  23. margin-right: 20rpx;
  24. border-radius: 10rpx;
  25. "
  26. ></image>
  27. <view
  28. class="notice-content"
  29. style="
  30. width: 75%;
  31. "
  32. >
  33. <view class="notice-content-font">{{ item.title }}</view>
  34. <view class="attract-content">{{ item.desc }}</view>
  35. <view
  36. class="notice-content-time"
  37. style="margin-top: 20rpx"
  38. v-if="item.time_type == 1"
  39. >时间:{{ item.time | globalTime }}</view
  40. >
  41. <view class="notice-content-time" style="margin-top: 20rpx" v-else
  42. >时间:待定</view
  43. >
  44. </view>
  45. </view>
  46. </view>
  47. </view>
  48. </template>
  49. <script>
  50. import md5 from "@/common/md5.js";
  51. export default {
  52. data() {
  53. return {
  54. attractList: [
  55. // {
  56. // url: "/static/attract/1.png",
  57. // title: "工业互联网",
  58. // subtitle: "工业互联网是全球工业系统与高级计算、分析、...",
  59. // time: "2021-09-05",
  60. // },
  61. // {
  62. // url: "/static/attract/2.png",
  63. // title: "生产性服务业",
  64. // subtitle: "生产性服务业是指为保持工业生产过程的连续性...",
  65. // time: "2021-09-05",
  66. // },
  67. ],
  68. };
  69. },
  70. onLoad() {
  71. this.getAttract();
  72. },
  73. methods: {
  74. goAttractDeatil(id, type) {
  75. if (type == 0) return;
  76. uni.navigateTo({
  77. url: "/pages/attract/attract_deatil?id=" + id,
  78. });
  79. },
  80. getAttract() {
  81. let md5Sign = md5(
  82. "method=" +
  83. "common" +
  84. "&timestamp=" +
  85. getApp().globalData.globalTimestamp +
  86. "&secret=" +
  87. getApp().globalData.secret
  88. );
  89. let url =
  90. getApp().globalData.shareUrl +
  91. "api/api.php" +
  92. "?method=common&source=business&action=list&timestamp=" +
  93. getApp().globalData.globalTimestamp +
  94. "&sign=" +
  95. md5Sign;
  96. let postData = {
  97. // page: 1,
  98. // page_size: 5,
  99. };
  100. uni.request({
  101. url: url,
  102. method: "POST",
  103. header: {
  104. "content-type": "application/x-www-form-urlencoded",
  105. },
  106. data: postData,
  107. success: (res) => {
  108. if (res.data.code === 200) {
  109. console.log(res.data.data.list);
  110. res.data.data.list.forEach((item) => {
  111. item.pic_url = getApp().globalData.shareUrl + item.pic_url;
  112. });
  113. this.attractList = res.data.data.list.filter(
  114. (item) => item.show != 0
  115. );
  116. }
  117. },
  118. fail: () => {
  119. console.log("连接失败");
  120. },
  121. });
  122. },
  123. },
  124. };
  125. </script>
  126. <style lang="scss" scoped>
  127. .unclick {
  128. background-color: #bfbfbf !important;
  129. }
  130. .content {
  131. box-sizing: border-box;
  132. display: flex;
  133. flex-direction: column;
  134. .header {
  135. .header-image {
  136. width: 100%;
  137. height: 350rpx;
  138. }
  139. }
  140. .attracts {
  141. display: flex;
  142. box-sizing: border-box;
  143. // justify-content: center;
  144. padding: 80rpx;
  145. padding-top: 30rpx;
  146. align-items: center;
  147. flex-direction: column;
  148. .activity-theme {
  149. font-size: 34rpx;
  150. font-weight: 600;
  151. border-left: 10rpx solid #02a7f0;
  152. padding-left: 20rpx;
  153. width: 100%;
  154. justify-items: start;
  155. margin-bottom: 10rpx;
  156. }
  157. .notice-content-box {
  158. width: 100%;
  159. position: relative;
  160. display: flex;
  161. padding: 30rpx;
  162. background-color: #ffffff;
  163. box-shadow: 0px 4rpx 32rpx rgba(0, 0, 0, 0.1);
  164. border-radius: 32rpx;
  165. margin-top: 20rpx;
  166. justify-content: space-between;
  167. .maskModal {
  168. width: 100%;
  169. position: absolute;
  170. background-color: rgba(0, 0, 0, 0.4);
  171. border-radius: 32rpx;
  172. height: 100%;
  173. top: 0;
  174. right: 0;
  175. display: flex;
  176. align-items: center;
  177. justify-content: center;
  178. color: #fff;
  179. font-size: 30rpx;
  180. font-weight: bold;
  181. }
  182. .notice-content-font {
  183. font-size: 32rpx;
  184. color: #0d1937;
  185. // font-weight: 600;
  186. overflow: hidden;
  187. text-overflow: ellipsis;
  188. white-space: nowrap;
  189. }
  190. .attract-content {
  191. color: #697594;
  192. // font-weight: 600;
  193. font-size: 24rpx;
  194. margin-top: 8rpx;
  195. overflow: hidden;
  196. text-overflow: ellipsis;
  197. white-space: nowrap;
  198. }
  199. .notice-content-time {
  200. font-size: 26rpx;
  201. letter-spacing: 0.02em;
  202. color: #cfcfcf;
  203. margin-right: 14rpx;
  204. }
  205. }
  206. }
  207. }
  208. </style>