123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122 |
- <template>
- <view class="content">
- <empty v-if="loaded && list.length == 0"></empty>
- <view class="action" v-for="item in list" @click="goAction(item)">
- <image :src="item.image_input[0]" mode="" class="action-img"></image>
- <view class="action-tit">
- {{item.title}}
- </view>
- <view class=" time">
- <view class="">
- 活动时间:{{getTime(item.start_time)}} - {{getTime(item.end_time)}}
- </view>
- </view>
- </view>
- <uni-load-more :status="loadingType"></uni-load-more>
- </view>
- </template>
- <script>
- import { getTime } from '@/utils/rocessor.js'
- import {
- articleList,
- record,
- } from '@/api/index.js'
- export default {
- data() {
- return {
- page: 1,
- limit: 10,
- list: [],
- loadingType: 'more',
- loaded: false,
- type: 0,
- };
- },
- onLoad(opt) {
- if(opt.type) {
- this.type = opt.type
- }
- },
- onShow() {
- this.getActionList()
- },
- onReachBottom() {
- },
- methods: {
- getTime,
- goAction(item) {
- if(this.type == 0) {
- let time = new Date().getTime()
- console.log(time);
- if(time < item.start_time*1000) {
- return this.$api.msg('活动未开始,请耐心等待')
- }
- if(time > item.end_time*1000) {
- return this.$api.msg('活动已结束')
- }
- uni.navigateTo({
- url: '/pages/index/action?id=' + item.id
- })
- }
-
- },
- getActionList() {
- if (this.loadingType == 'loading' || this.loadingType == 'noMore') {
- return
- }
- this.loadingType = 'more'
- articleList({
- page: this.page,
- limit: this.limit
- },2).then(res => {
- this.list = this.list.concat(res.data.data)
- this.page++
- if (res.data.lengt == this.limit) {
- this.loadingType = 'more'
- } else {
- this.loadingType = 'noMore'
- }
- this.loaded = true
- })
- }
- }
- };
- </script>
- <style lang="scss" scoped>
- page {
- background-color: #f2f2f2;
- height: auto;
- min-height: 100%;
- }
- .action {
- width: 700rpx;
- margin: 25rpx auto;
- border-radius: 35rpx;
- overflow: hidden;
- background-color: #fff;
- .action-img {
- width: 700rpx;
- height: 300rpx;
- background-color: #333;
- }
- .action-tit {
- min-height: 100rpx;
- font-size: 34rpx;
- font-weight: 500;
- color: #0E0E0E;
- display: flex;
- align-items: center;
- padding: 15rpx;
- padding-left: 30rpx;
- }
- .time {
- font-size: 12rpx;
- padding: 20rpx;
- padding-top: 0;
- }
- }
- </style>
|