index.vue 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248
  1. <template>
  2. <view class="content">
  3. <div class="choose-box">
  4. <div
  5. class="type"
  6. :class="{ active: typeActive }"
  7. @click="openPicker('type')"
  8. >
  9. 类型
  10. </div>
  11. <div
  12. class="state"
  13. :class="{ active: !typeActive }"
  14. @click="openPicker('state')"
  15. >
  16. 状态
  17. </div>
  18. </div>
  19. <div class="actives">
  20. <div v-for="(active, idx) in activeList" :key="idx" class="actives-item">
  21. <div class="active-content">
  22. <div class="img-box"><img :src="active.url" alt="" /></div>
  23. <div class="right">
  24. <div class="right-title">{{ active.title }}</div>
  25. <div class="right-inf">
  26. <div class="inf-type">
  27. <div
  28. :class="{ color: active.type == 1 }"
  29. class="originColor"
  30. ></div>
  31. <div>{{ active.type === 1 ? "线下" : "线上" }}</div>
  32. </div>
  33. <div class="inf-way">
  34. {{ active.way }}
  35. </div>
  36. <div class="inf-date">
  37. {{ active.date }}
  38. </div>
  39. </div>
  40. </div>
  41. </div>
  42. <div class="readShare">
  43. <div class="read">浏览 {{ active.read }}</div>
  44. <div class="share">分享 {{ active.share }}</div>
  45. </div>
  46. </div>
  47. </div>
  48. <mpvue-picker
  49. :themeColor="themeColor"
  50. ref="mpvuePicker"
  51. :mode="mode"
  52. :deepLength="deepLength"
  53. :pickerValueDefault="pickerValueDefault"
  54. @onConfirm="onConfirm"
  55. @onCancel="onCancel"
  56. :pickerValueArray="pickerValueArray"
  57. ></mpvue-picker>
  58. </view>
  59. </template>
  60. <script>
  61. import mpvuePicker from "@/components/mpvue-picker/mpvuePicker.vue";
  62. export default {
  63. components: {
  64. mpvuePicker,
  65. },
  66. data() {
  67. return {
  68. message: "找活动",
  69. themeColor: "#007AFF",
  70. mode: "selector",
  71. typeActive: true,
  72. deepLength: 1,
  73. pickerValueDefault: [0],
  74. pickerValueArray: [],
  75. pickerTypeArray: [
  76. {
  77. label: "全部",
  78. value: 1,
  79. },
  80. {
  81. label: "线上",
  82. value: 2,
  83. },
  84. {
  85. label: "线下",
  86. value: 3,
  87. },
  88. ],
  89. pickerStateArray: [
  90. {
  91. label: "全部",
  92. value: 4,
  93. },
  94. {
  95. label: "待开始",
  96. value: 5,
  97. },
  98. {
  99. label: "已开始",
  100. value: 6,
  101. },
  102. {
  103. label: "已结束",
  104. value: 7,
  105. },
  106. ],
  107. activeList: [
  108. {
  109. url: "/static/activity/1.png",
  110. title: "400场讲座,200门课程,免费送上门!就等你申请",
  111. way: "区人力资源局",
  112. date: "2021-08-08",
  113. read: 322,
  114. share: 1,
  115. type: 1, //1线上
  116. },
  117. {
  118. url: "/static/activity/2.png",
  119. title: "智能制造商标品牌培育系列培训活动",
  120. way: "市场监督管理局",
  121. date: "2021-08-07",
  122. read: 322,
  123. share: 1,
  124. type: 0, //0线下
  125. },
  126. ],
  127. };
  128. },
  129. onLoad() {},
  130. methods: {
  131. onConfirm() {},
  132. onCancel() {},
  133. openPicker(op) {
  134. switch (op) {
  135. case "type":
  136. this.pickerValueArray = this.pickerTypeArray;
  137. this.typeActive = true;
  138. break;
  139. case "state":
  140. this.pickerValueArray = this.pickerStateArray;
  141. this.typeActive = false;
  142. }
  143. this.$refs.mpvuePicker.show();
  144. },
  145. },
  146. };
  147. </script>
  148. <style lang="scss" scoped>
  149. .content {
  150. display: flex;
  151. flex-direction: column;
  152. align-items: center;
  153. width: 100%;
  154. .choose-box {
  155. padding: 20rpx 0;
  156. width: 100%;
  157. display: flex;
  158. position: fixed;
  159. height: 50rpx;
  160. top: 0;
  161. margin-bottom: 50rpx;
  162. .type,
  163. .state {
  164. width: 50%;
  165. display: flex;
  166. justify-content: center;
  167. }
  168. }
  169. .actives {
  170. margin-top: 50rpx;
  171. padding: 0 40rpx;
  172. display: flex;
  173. flex-direction: column;
  174. .actives-item {
  175. height: 150rpx;
  176. box-shadow: 0px 4rpx 32rpx rgba(0, 0, 0, 0.1);
  177. border-radius: 32rpx;
  178. margin-top: 20px;
  179. padding: 50rpx;
  180. display: flex;
  181. flex-direction: column;
  182. .active-content {
  183. display: flex;
  184. .img-box {
  185. margin-right: 20rpx;
  186. width: 120rpx;
  187. height: 120rpx;
  188. img {
  189. width: 100%;
  190. height: 100%;
  191. }
  192. }
  193. .right {
  194. height: 120rpx;
  195. box-sizing: border-box;
  196. display: flex;
  197. flex-direction: column;
  198. .right-title {
  199. margin-bottom: 20rpx;
  200. font-size: 27rpx;
  201. font-weight: 600;
  202. letter-spacing: 3rpx;
  203. }
  204. .right-inf {
  205. display: flex;
  206. font-size: 22rpx;
  207. color: $uni-text-color-grey;
  208. .inf-type {
  209. margin-right: 20rpx;
  210. display: flex;
  211. align-items: center;
  212. .originColor {
  213. margin-right: 8rpx;
  214. height: 25rpx;
  215. width: 25rpx;
  216. border-radius: 50%;
  217. background-color: #ffcf86;
  218. }
  219. }
  220. .inf-way {
  221. margin-right: 20rpx;
  222. }
  223. }
  224. }
  225. }
  226. .readShare {
  227. display: flex;
  228. justify-content: flex-end;
  229. font-size: 20rpx;
  230. color: rgba(0, 0, 0, 0.3);
  231. margin-top: 20rpx;
  232. .read {
  233. margin-right: 60rpx;
  234. }
  235. }
  236. }
  237. }
  238. }
  239. .active {
  240. color: $uni-color-primary;
  241. }
  242. .color {
  243. background-color: #589cff !important;
  244. }
  245. </style>