推广小程序前端代码
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

277 lines
6.9 KiB

5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
  1. <template>
  2. <view class="travelList">
  3. <view class="head-box"></view>
  4. <uv-navbar autoBack title="活动列表" leftIconColor="#fff" :bgColor="bgColor" height="100rpx" :titleStyle="{color:'#fff'}"></uv-navbar>
  5. <view class="content">
  6. <view class="drop">
  7. <uv-drop-down ref="dropDown" text-color="#fff" text-size="30rpx" sign="dropDown_1" text-active-color="#fff"
  8. :extra-icon="{name:'arrow-down-fill',color:'#666',size:'26rpx'}"
  9. :extra-active-icon="{name:'arrow-up-fill',color:'#fff',size:'26rpx'}" :defaultValue="defaultValue"
  10. :custom-style="{padding: '0 30rpx'}" @click="selectMenu">
  11. <uv-drop-down-item name="order" type="2" :label="dropItem('order').label" :value="dropItem('order').value">
  12. </uv-drop-down-item>
  13. <uv-drop-down-item name="type" type="2" :label="dropItem('type').label" :value="dropItem('type').value">
  14. </uv-drop-down-item>
  15. <!-- <uv-drop-down-item name="type" type="2" :label="dropItem('type').label" :value="dropItem('type').value">
  16. </uv-drop-down-item> -->
  17. </uv-drop-down>
  18. <uv-drop-down-popup sign="dropDown_1" :click-overlay-on-close="true" :currentDropItem="currentDropItem"
  19. @clickItem="clickItem" @popupChange="change"></uv-drop-down-popup>
  20. </view>
  21. <active-item :cardListData="cardListData"/>
  22. <uv-load-more :status="status" fontSize="24rpx" dashed line />
  23. <!-- <view class="info cardStyle_">
  24. <view class="left">
  25. <image src="https://img0.baidu.com/it/u=4274003247,920124130&fm=253&fmt=auto&app=138&f=JPEG?w=800&h=1031"
  26. alt="">
  27. </view>
  28. <view class="right">
  29. <view class="detailed">
  30. <view class="title">夏日去撒野旅游计划</view>
  31. <view class="date">2024.10.28 10:00</view>
  32. <view class="address">成都市东丽湖露营地32号</view>
  33. </view>
  34. <view class="data">
  35. <text>¥233.00</text>
  36. <text>11/40</text>
  37. <text class="btn">已开票</text>
  38. </view>
  39. </view>
  40. </view> -->
  41. </view>
  42. </view>
  43. </template>
  44. <script>
  45. import Navbar from '@/pages/components/Navbar.vue'
  46. import activeItem from '@/components/active/active-item.vue'
  47. // import { globalMixin } from '../pages/mixins/globalMixin';
  48. export default {
  49. components:{
  50. activeItem
  51. },
  52. onPageScroll(e) {
  53. if(e.scrollTop > 50) {
  54. this.bgColor = '#49070c'
  55. }else{
  56. this.bgColor = 'transparent'
  57. }
  58. // this.$refs.dropDown.init();
  59. },
  60. onReachBottom() {
  61. if(this.params.pageNo >= this.totalPage) return
  62. this.params.pageNo ++
  63. this.getActivityPageList()
  64. },
  65. // mixins: [globalMixin],
  66. // components:{
  67. // Navbar
  68. // },
  69. computed: {
  70. dropItem(name) {
  71. return (name) => {
  72. const result = {};
  73. const find = this.result.find(item => item.name === name);
  74. if (find) {
  75. result.label = find.label;
  76. result.value = find.value;
  77. } else {
  78. result.label = this[name].label;
  79. result.value = this[name].value;
  80. }
  81. return result;
  82. }
  83. },
  84. // 获取当前下拉筛选项
  85. currentDropItem() {
  86. return this[this.activeName];
  87. }
  88. },
  89. data() {
  90. return {
  91. status:"loading",
  92. bgColor:'transparent',
  93. // 表示value等于这些值,就属于默认值
  94. defaultValue: ['', 'all', '0'],
  95. // 筛选结果
  96. result: [{
  97. name: 'order',
  98. label: '全部',
  99. value: ''
  100. }],
  101. // { name: 'order', label: '最新发布', value: 'new' }
  102. activeName: 'order',
  103. order: {
  104. label: '全部',
  105. value: '',
  106. activeIndex: 0,
  107. color: '#333',
  108. activeColor: '#FF4546',
  109. child: [{
  110. label: '全部',
  111. value: ''
  112. },{
  113. label: '报名中',
  114. value: '0'
  115. }, {
  116. label: '已结束',
  117. value: '1'
  118. }]
  119. },
  120. type: {
  121. label: '时间',
  122. value: 'all',
  123. activeIndex: 0,
  124. color: '#333',
  125. activeColor: '#FF4546',
  126. child: [{
  127. label: '全部',
  128. value: 'all'
  129. }, {
  130. label: 'PDF',
  131. value: 'pdf'
  132. }, {
  133. label: 'WROD',
  134. value: 'word'
  135. }, {
  136. label: 'PPT',
  137. value: 'ppt'
  138. }]
  139. },
  140. totalPage:0,
  141. cardListData:[],
  142. params:{
  143. state:'',
  144. pageNo:1,
  145. pageSize:10
  146. },
  147. }
  148. },
  149. onLoad() {
  150. this.getActivityPageList()
  151. },
  152. methods: {
  153. getActivityPageList() {
  154. this.$api('activityPageList',this.params,res=>{
  155. if(res.code == 200) {
  156. this.totalPage = res.result.pages
  157. this.cardListData = [...this.cardListData,...res.result.records]
  158. if(this.params.pageNo >= this.totalPage) {
  159. this.status = "nomore"
  160. }else {
  161. this.status = "loadmore"
  162. }
  163. }
  164. })
  165. },
  166. change(e) {
  167. console.log('弹窗打开状态:', e);
  168. },
  169. selectMenu(e) {
  170. const {
  171. name,
  172. active,
  173. type
  174. } = e;
  175. this.activeName = name;
  176. // type 等于1 的需要特殊处理:type不等于1可以忽略
  177. if (type == 1) {
  178. this.clickItem({
  179. name: 'vip_type',
  180. label: 'VIP文档',
  181. value: e.active ? 1 : 0
  182. });
  183. } else {
  184. const find = this.result.find(item => item.name == this.activeName);
  185. if (find) {
  186. const findIndex = this[this.activeName].child.findIndex(item => item.label == find.label && item.value ==
  187. find.value);
  188. this[this.activeName].activeIndex = findIndex;
  189. } else {
  190. this[this.activeName].activeIndex = 0;
  191. }
  192. }
  193. },
  194. clickItem(e) {
  195. // 下面有重新赋值,所以用let
  196. let {
  197. label,
  198. value
  199. } = e;
  200. const findIndex = this.result.findIndex(item => item.name == this.activeName);
  201. // if (this.defaultValue.indexOf(value) > -1 && this[this.activeName].label) {
  202. // label = this[this.activeName].label;
  203. // }
  204. // // 已经存在筛选项
  205. if (findIndex > -1) {
  206. this.$set(this.result, findIndex, {
  207. name: this.activeName,
  208. label,
  209. value
  210. })
  211. } else {
  212. this.result.push({
  213. name: this.activeName,
  214. label,
  215. value
  216. });
  217. }
  218. let stateInfo = this.result.find(item=>item.name == 'order')
  219. this.params.state = stateInfo.value
  220. this.params.pageNo = 1
  221. this.cardListData = []
  222. this.getActivityPageList()
  223. }
  224. }
  225. }
  226. </script>
  227. <style scoped lang="scss">
  228. .head-box {
  229. background: url('@/static/image/nav-bg.png') no-repeat;
  230. background-size: 100% 100%;
  231. width: 100%;
  232. height: 534rpx;
  233. position: absolute;
  234. }
  235. .content {
  236. padding-top: calc(var(--status-bar-height) + 110rpx);
  237. }
  238. /deep/.uv-sticky__content {
  239. .uv-drop-down {
  240. justify-content: normal;
  241. border: 0;
  242. background: transparent;
  243. }
  244. }
  245. .travelList {
  246. // margin-bottom: 500rpx;
  247. .content {
  248. padding-left: 20rpx;
  249. padding-right: 20rpx;
  250. .info {
  251. position: relative;
  252. margin: 10rpx 32rpx 36rpx;
  253. ;
  254. padding: 35rpx 0 35rpx 24rpx;
  255. border-radius: 26rpx;
  256. .right {
  257. .data {
  258. display: flex;
  259. justify-content: space-between;
  260. align-items: center;
  261. .btn {
  262. background: #381615;
  263. color: $uni-color-primary;
  264. padding: 10rpx 40rpx;
  265. border-radius: 30rpx 0px 0px 30rpx;
  266. }
  267. }
  268. }
  269. }
  270. }
  271. }
  272. </style>