123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177 |
- <template>
- <view>
- <view class="card" v-for="(item,index) in plist" :key="index" @click="goDetail(item.activity_id)">
- <view class="card-left">
- <image class="card-left-image" :src="item.activity.main_image"></image>
- </view>
- <view class="card-right">
- <view class="right-title">{{item.activity.title}}</view>
- <view class="right-box">
- <view class="box-content">
- <view class="content-text">报名时间:{{item.create_time}}</view>
- <view class="content-text" style="margin-top: 20rpx;">{{item.status_text}}</view>
- </view>
- <view class="box-btn" v-if="item.status == 1" @click.stop="cancel(item.activity_id)">取消报名</view>
- </view>
- </view>
- </view>
- <uni-load-more :status="pstatus"></uni-load-more>
- </view>
- </template>
- <script>
- var _this;
- export default {
- data() {
- return {
- ppage: 1,
- psize: 20,
- pstatus: 'more',
- plist: [],
- userinfo: null,
- }
- },
- onLoad() {
- _this = this;
- _this.userinfo = uni.getStorageSync('userinfo') || false;
- _this.getMore();
- },
- onReachBottom: function() {
- if (_this.pstatus !== 'more') {
- return;
- }
- _this.getMore();
- },
- methods: {
- pageRefresh: function() {
- _this.pstatus = 'more';
- _this.ppage = 1;
- _this.plist = [];
- _this.getMore();
- },
-
- goDetail: function(id) {
- uni.navigateTo({
- url: '/pages/activity/activityDetail?id=' + id
- });
- },
-
- cancel(id) {
- _this.$req.ajax({
- path: "activity/cancelJoin",
- data: {
- id: id
- }
- }).then((data) => {
- _this.pageRefresh();
- console.log("取消报名", data)
- }).catch((err) => {
- uni.showModal({
- title: '信息提示',
- content: err,
- showCancel: false
- });
- });
- },
-
- getMore() {
- _this.$req.ajax({
- path: "activity/joinList",
- data: {
- ppage: _this.ppage,
- psize: _this.psize,
- userid: _this.userinfo.id,
- }
- }).then((data) => {
- _this.pstatus = data.pstatus;
- _this.plist = _this.plist.concat(data.plist);
- _this.ppage += 1;
- console.log("列表数据", data)
- }).catch((err) => {
- uni.showModal({
- title: '信息提示',
- content: err,
- showCancel: false
- });
- });
- }
- }
- }
- </script>
- <style lang="scss">
- .card {
- margin: 10rpx 20rpx 30rpx;
- padding: 20rpx 20rpx;
- border-radius: 12rpx;
- background-color: #FFFFFF;
- box-shadow: 5rpx 5rpx 10rpx 2rpx rgba(149, 149, 149, 0.3);
- display: flex;
- align-items: center;
-
- .card-left {
- width: 250rpx;
- height: 170rpx;
- border-radius: 12rpx;
-
- .card-left-image {
- width: 250rpx;
- height: 170rpx;
- border-radius: 12rpx;
- }
- }
-
- .card-right {
- flex: 1;
- height: 170rpx;
- margin-left: 20rpx;
- display: flex;
- flex-direction: column;
- justify-content: space-between;
-
- .right-title {
- width: 100%;
- font-weight: bold;
- overflow: hidden;
- text-overflow: ellipsis;
- -webkit-line-clamp: 1;
- display: -webkit-box;
- -webkit-box-orient: vertical;
- }
-
- .right-box {
- display: flex;
- align-items: center;
- justify-content: space-between;
-
- .box-content {
- flex: 1;
-
- .content-text {
- width: 100%;
- font-size: 23rpx;
- color: #afafaf;
- overflow: hidden;
- text-overflow: ellipsis;
- -webkit-line-clamp: 1;
- display: -webkit-box;
- -webkit-box-orient: vertical;
- }
- }
-
- .box-btn {
- margin-left: 15rpx;
- width: 130rpx;
- height: 50rpx;
- font-size: 25rpx;
- color: #FFFFFF;
- display: flex;
- align-items: center;
- justify-content: center;
- border-radius: 12rpx;
- background-color: #CA151C;
- }
- }
- }
- }
- </style>
|