index.vue 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209
  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
  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;
  114. }
  115. },
  116. fail: () => {
  117. console.log("连接失败");
  118. },
  119. });
  120. },
  121. },
  122. };
  123. </script>
  124. <style lang="scss" scoped>
  125. .unclick {
  126. background-color: #bfbfbf !important;
  127. }
  128. .content {
  129. box-sizing: border-box;
  130. display: flex;
  131. flex-direction: column;
  132. .header {
  133. .header-image {
  134. width: 100%;
  135. height: 350rpx;
  136. }
  137. }
  138. .attracts {
  139. display: flex;
  140. box-sizing: border-box;
  141. // justify-content: center;
  142. padding: 80rpx;
  143. padding-top: 30rpx;
  144. align-items: center;
  145. flex-direction: column;
  146. .activity-theme {
  147. font-size: 28rpx;
  148. font-weight: 600;
  149. border-left: 10rpx solid #02a7f0;
  150. padding-left: 20rpx;
  151. width: 100%;
  152. justify-items: start;
  153. margin-bottom: 10rpx;
  154. }
  155. .notice-content-box {
  156. width: 100%;
  157. position: relative;
  158. display: flex;
  159. padding: 30rpx;
  160. background-color: #ffffff;
  161. box-shadow: 0px 4rpx 32rpx rgba(0, 0, 0, 0.1);
  162. border-radius: 32rpx;
  163. margin-top: 20rpx;
  164. justify-content: space-between;
  165. .maskModal {
  166. width: 100%;
  167. position: absolute;
  168. background-color: rgba(0, 0, 0, 0.4);
  169. border-radius: 32rpx;
  170. height: 100%;
  171. top: 0;
  172. right: 0;
  173. display: flex;
  174. align-items: center;
  175. justify-content: center;
  176. color: #fff;
  177. font-size: 28rpx;
  178. font-weight: bold;
  179. }
  180. .notice-content-font {
  181. font-size: 26rpx;
  182. color: #0d1937;
  183. font-weight: 600;
  184. overflow: hidden;
  185. text-overflow: ellipsis;
  186. white-space: nowrap;
  187. }
  188. .attract-content {
  189. color: #697594;
  190. font-weight: 600;
  191. font-size: 20rpx;
  192. margin-top: 8rpx;
  193. overflow: hidden;
  194. text-overflow: ellipsis;
  195. white-space: nowrap;
  196. }
  197. .notice-content-time {
  198. font-size: 20rpx;
  199. letter-spacing: 0.02em;
  200. color: #cfcfcf;
  201. margin-right: 14rpx;
  202. }
  203. }
  204. }
  205. }
  206. </style>