index.vue 5.0 KB

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