<template>
|
<view class="activity-container" :data-theme='theme()' :class="theme() || ''">
|
<!--内容-->
|
<view class="activity-box">
|
<scroll-view scroll-y="true" class="scroll-Y" :style="'height:' + scrollviewHigh + 'px;'" lower-threshold="50" @scrolltolower="scrolltolowerFunc">
|
<view :class="topRefresh ? 'top-refresh open' : 'top-refresh'">
|
<view class="circle" v-for="(circle, n) in 3" :key="n"></view>
|
</view>
|
<view class="activity-list">
|
<view @click="gotoDetail(item)" class="card-list" v-for="item in listData" :key="item.activity_id">
|
<view class="card-top" :style="'background-image: url('+(item.image?item.image.file_path:remoteImg('activity_bg'))+')'"></view>
|
<view class="card-bottom pr">
|
<view class="title text-ellipsis-2">{{item.name}}</view>
|
<view class="bottom d-b-e">
|
<view>
|
<view class="item">
|
<view class="name">已报名人数:</view>
|
<view class="count">
|
{{item.total}}人
|
</view>
|
</view>
|
<view class="item">
|
<view class="name">报名截止时间:</view>
|
<view class="count">
|
{{item.status_text.reg_end_time}}
|
</view>
|
</view>
|
</view>
|
<view v-if="item.total==item.limit_num && item.limit_num!=0" class="go-sign disabled">已报满</view>
|
<view v-else class="go-sign" :class="{'disabled' : item.status_text.reg_status==0}">{{(item.status_text.reg_status==2 || item.is_reg)?'查看' : item.status_text.reg_status==0?'未开始':'去报名'}}</view>
|
</view>
|
<view class="status-image" v-if="item.status_text.status==2">
|
<image :src="remoteImg('finish')"></image>
|
</view>
|
<view class="status-image" v-else-if="item.status_text.status==1">
|
<image :src="remoteImg('in_progress')"></image>
|
</view>
|
</view>
|
</view>
|
</view>
|
<!--列表-->
|
<!-- 没有记录 -->
|
<view class="none-data-box" v-if="listData.length==0 && !loading">
|
<image :src="remoteImg('no_thing')" mode="widthFix"></image>
|
<text>暂无数据</text>
|
</view>
|
<uni-load-more v-else :loadingType="loadingType"></uni-load-more>
|
</scroll-view>
|
</view>
|
</view>
|
</template>
|
|
<script>
|
import uniLoadMore from '@/components/uni-load-more.vue';
|
export default {
|
components: {
|
uniLoadMore
|
},
|
data() {
|
return {
|
/*手机高度*/
|
phoneHeight: 0,
|
/*可滚动视图区域高度*/
|
scrollviewHigh: 0,
|
/*商品列表*/
|
listData: [],
|
status: 0,
|
/*最后一页码数*/
|
last_page: 0,
|
/*当前页面*/
|
page: 1,
|
/*每页条数*/
|
list_rows: 10,
|
/*有没有更多*/
|
no_more: false,
|
/*是否正在加载*/
|
loading: true,
|
/*顶部刷新*/
|
topRefresh: false,
|
branch_id: 0, // 分会ID
|
is_first_show: true, // 处理授权返回加载数据空白的问题
|
};
|
},
|
computed: {
|
/*加载中状态*/
|
loadingType() {
|
if (this.loading) {
|
return 1;
|
} else {
|
if (this.listData.length != 0 && this.no_more) {
|
return 2;
|
} else {
|
return 0;
|
}
|
}
|
}
|
},
|
onLoad(e) {
|
if (e.branch_id != undefined) {
|
this.branch_id = e.branch_id;
|
}
|
},
|
onShow() {
|
/*获取列表*/
|
if (this.is_first_show) {
|
this.getData();
|
}
|
},
|
mounted() {
|
this.init();
|
},
|
onReachBottom() {},
|
methods: {
|
/*初始化*/
|
init() {
|
let _this = this;
|
uni.getSystemInfo({
|
success(res) {
|
_this.scrollviewHigh = res.windowHeight;
|
}
|
});
|
},
|
|
/*获取活动列表*/
|
getData() {
|
let self = this;
|
// uni.showLoading({
|
// title: '加载中'
|
// });
|
let status = self.status;
|
self.loading = true;
|
self._get(
|
'branch.activity/index', {
|
branch_id: self.branch_id,
|
status: status,
|
page: self.page || 1,
|
list_rows: self.list_rows,
|
},
|
function(res) {
|
self.listData = self.listData.concat(res.data.list.data);
|
self.last_page = res.data.list.last_page;
|
if (res.data.list.last_page <= 1) {
|
self.no_more = true;
|
} else {
|
self.no_more = false;
|
}
|
// uni.hideLoading();
|
self.loading = false;
|
self.is_first_show = false;
|
}
|
);
|
},
|
|
/*可滚动视图区域到底触发*/
|
scrolltolowerFunc() {
|
let self = this;
|
if (self.no_more) {
|
return;
|
}
|
self.page++;
|
if (self.page <= self.last_page) {
|
self.getData();
|
} else {
|
self.no_more = true;
|
}
|
},
|
|
/*跳转详情*/
|
gotoDetail(e) {
|
let url = 'pages/branch/activity/detail/detail?activity_id=' + e.activity_id
|
this.gotoPage(url);
|
},
|
|
}
|
};
|
</script>
|
|
<style lang="scss" scoped>
|
page {
|
background: #f5f5f5;
|
}
|
.activity-list {
|
padding: 0 30rpx;
|
.card-list {
|
width: 100%;
|
background-color: #ffffff;
|
margin-top: 20rpx;
|
border-radius: 16rpx 16rpx 24rpx 24rpx;
|
.card-top{
|
background-size: 100% 100%;
|
background-repeat: no-repeat;
|
width: 690rpx;
|
height: 322rpx;
|
border-radius: 16rpx 16rpx 0 0;
|
}
|
.card-bottom {
|
padding: 30rpx;
|
.title{
|
font-size: 30rpx;
|
color: #333333;
|
font-weight: 500;
|
}
|
.bottom{
|
margin-top: 30rpx;
|
align-items: flex-end;
|
justify-content: space-between;
|
.item{
|
display: flex;
|
align-items: center;
|
color: #999999;
|
font-size: 24rpx;
|
&:last-child{
|
margin-top: 20rpx;
|
}
|
&::before{
|
content: "";
|
width: 6rpx;
|
height: 6rpx;
|
background: #FFAA00;
|
border-radius: 100%;
|
margin-right: 10rpx;
|
}
|
.count{
|
color: #666666;
|
text{
|
display: inline-block;
|
margin-left: 6rpx;
|
}
|
}
|
}
|
.go-sign{
|
font-size: 26rpx;
|
color: #ffffff;
|
width: 120rpx;
|
height: 56rpx;
|
display: flex;
|
align-items: center;
|
justify-content: center;
|
border-radius: 50rpx;
|
@include background_color('background_color');
|
&.disabled{
|
background: #BBBBBB !important;
|
}
|
}
|
}
|
.status-image {
|
width: 100rpx;
|
height: 100rpx;
|
position: absolute;
|
right: 180rpx;
|
bottom: 10rpx;
|
|
image {
|
width: 100%;
|
height: 100%;
|
}
|
}
|
}
|
}
|
}
|
|
|
</style>
|