index.vue 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261
  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. position: relative;
  168. }
  169. .type::after,
  170. .state::after {
  171. content: "";
  172. position: absolute;
  173. right: 20%;
  174. top: 20%;
  175. width: 0;
  176. height: 0;
  177. border-top: 15rpx solid rgb(173, 173, 173);
  178. border-left: 15rpx solid transparent;
  179. border-right: 15rpx solid transparent;
  180. }
  181. }
  182. .actives {
  183. margin-top: 50rpx;
  184. padding: 0 40rpx;
  185. display: flex;
  186. flex-direction: column;
  187. .actives-item {
  188. height: 150rpx;
  189. box-shadow: 0px 4rpx 32rpx rgba(0, 0, 0, 0.1);
  190. border-radius: 32rpx;
  191. margin-top: 20px;
  192. padding: 50rpx;
  193. display: flex;
  194. flex-direction: column;
  195. .active-content {
  196. display: flex;
  197. .img-box {
  198. margin-right: 20rpx;
  199. width: 120rpx;
  200. height: 120rpx;
  201. img {
  202. width: 100%;
  203. height: 100%;
  204. }
  205. }
  206. .right {
  207. height: 120rpx;
  208. box-sizing: border-box;
  209. display: flex;
  210. flex-direction: column;
  211. .right-title {
  212. margin-bottom: 20rpx;
  213. font-size: 27rpx;
  214. font-weight: 600;
  215. letter-spacing: 3rpx;
  216. }
  217. .right-inf {
  218. display: flex;
  219. font-size: 22rpx;
  220. color: $uni-text-color-grey;
  221. .inf-type {
  222. margin-right: 20rpx;
  223. display: flex;
  224. align-items: center;
  225. .originColor {
  226. margin-right: 8rpx;
  227. height: 25rpx;
  228. width: 25rpx;
  229. border-radius: 50%;
  230. background-color: #ffcf86;
  231. }
  232. }
  233. .inf-way {
  234. margin-right: 20rpx;
  235. }
  236. }
  237. }
  238. }
  239. .readShare {
  240. display: flex;
  241. justify-content: flex-end;
  242. font-size: 20rpx;
  243. color: rgba(0, 0, 0, 0.3);
  244. margin-top: 20rpx;
  245. .read {
  246. margin-right: 60rpx;
  247. }
  248. }
  249. }
  250. }
  251. }
  252. .active {
  253. color: $uni-color-primary;
  254. }
  255. .color {
  256. background-color: #589cff !important;
  257. }
  258. </style>