瀏覽代碼

1.活动列表

guo 2 年之前
父節點
當前提交
fda44d1e47
共有 3 個文件被更改,包括 229 次插入0 次删除
  1. 47 0
      components/nodata/nodata.vue
  2. 9 0
      pages.json
  3. 173 0
      pages/addjk/activity.vue

+ 47 - 0
components/nodata/nodata.vue

@@ -0,0 +1,47 @@
+<template>
+	<view class="" style="padding-bottom: 20rpx;">
+		
+		<view  class="nodataBox">
+			<image src="http://dmsphoto.66km.com.cn/thFiles/3C95A4C5-73F8-4B34-902B-703B8A0825C9.png" mode="widthFix" class="nodataImg"></image>
+			<view class="noTxt">暂无数据</view>
+		</view>
+		
+		
+	</view>
+</template>
+
+<script>
+export default {
+	data() {
+		return {
+			
+		}
+	},
+	onLoad(opt) {
+      
+	},
+	onShow() {
+		
+	},
+	methods: {
+		
+	}
+}
+</script>
+
+<style scoped>
+	
+	.nodataImg{
+	  width: 400rpx;
+	  padding-top: 100rpx;
+	}
+	.noTxt{
+		font-size: 32rpx;
+		color: #999999;
+		padding-top: 50rpx;
+	}
+	.nodataBox{
+		text-align: center;
+	}
+	
+</style>

+ 9 - 0
pages.json

@@ -1,5 +1,14 @@
 {
 	"pages": [ //pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages
+		{
+		    "path" : "pages/addjk/activity",
+		    "style" :                                                                                    
+		    {
+		        "navigationBarTitleText": "活动",
+		        "enablePullDownRefresh": true
+		    }
+		    
+		},
 		{
 			"path": "pages/addjk/choice",
 			"style": {

+ 173 - 0
pages/addjk/activity.vue

@@ -0,0 +1,173 @@
+<template>
+	<view class="box">
+
+		<view class="itemHistory" v-for="(item,index) in itemData" :key="index" @click="goDetail(item.id)">
+			<image :src="item.Img" mode="" class="itemImg"></image>
+			<view class="timeBox">
+				<!-- <image v-if="item.state==2" src="../../static/img/bg_huangse.png" mode="" class="state"></image> -->
+				<!-- <image v-if="item.state==1" src="../../static/img/bg_hongse.png" mode="" class="state"></image> -->
+				<view class="time" v-if="item.StartTime">{{item.StartTime.slice(0,10)}}-{{item.EndTime.slice(0,10)}}</view>
+			</view>
+			<view class="name">{{item.ActivityName}}</view>
+			
+			<view class="name" @click="goEdit(item.id)">编辑</view>
+		</view>
+
+		<!-- 上拉 加载更多 -->
+		<view class="noMore" v-if="noMoreShow && (itemData.length!=0)">没有更多数据</view>
+		<!-- 无数据空白页 -->
+		<nodata v-if="itemData.length==0"></nodata>
+
+
+		
+	</view>
+</template>
+
+<script scoped>
+	import nodata from '../../components/nodata/nodata.vue'
+	export default {
+		components: {
+			nodata,
+		},
+
+		data() {
+			return {
+				
+				page: 1,
+				itemData: [],
+				noMoreShow: false,
+				
+			}
+		},
+		onLoad() {
+			
+			this.page = 1
+			this.myOrderCoupon()
+		},
+
+		methods: {
+			goDetail(id) {
+				// uni.navigateTo({
+				// 	url: 'jkDetail?id=' + id
+				// })
+			},
+			goEdit(id) {
+				// uni.navigateTo({
+				// 	url: 'jkDetail?id=' + id
+				// })
+			},
+			myOrderCoupon() {
+				uni.showLoading({
+					title: '加载中'
+				})
+				this.$http('openH5SetTheGuest/getAtivity', {
+
+					page: this.page,
+					limit: 10,
+					 state:""
+				}, 'GET').then(res => {
+					uni.hideLoading();
+					// var list = res.data.Items
+					var list = res.data.Items
+
+					// 处理 undefined和null转为空白字符串
+					// list.forEach((item, index) => {
+					// 	for (const key in item) {
+					// 		item[key] = this.$praseStrEmpty(item[key])
+					// 	}
+					// })
+
+					if (this.page == 1) {
+						this.itemData = list
+					} else {
+						this.itemData = this.itemData.concat(list)
+					}
+
+					if (list.length < 10) {
+						this.noMoreShow = true
+					} else {
+						this.noMoreShow = false
+					}
+
+
+
+
+
+				})
+			},
+
+
+		},
+
+		// 下拉刷新 上拉加载更多
+		onPullDownRefresh() {
+			this.page = 1
+			this.myOrderCoupon()
+			setTimeout(function() {
+				uni.stopPullDownRefresh();
+			}, 1000);
+		},
+		onReachBottom() {
+			this.page++;
+			this.myOrderCoupon()
+		},
+	}
+</script>
+
+<style scoped lang="less">
+	.box {
+		background: #F4F5F7;
+		min-height: 100vh;
+		padding-top: 20rpx;
+	}
+
+	
+
+	.itemHistory {
+		margin: 0rpx 24rpx 20rpx;
+		background-color: #FFFFFF;
+		border-radius: 10rpx;
+
+	}
+
+	.itemImg {
+		height: 280rpx;
+		width: 702rpx;
+border-radius: 10rpx 10rpx 0px 0px;
+	}
+
+	.timeBox {
+		display: flex;
+		margin-top: -61rpx;
+		align-items: flex-end;
+	}
+	.state{
+		width: 102rpx;
+		height: 53rpx;
+	}
+
+	.time {
+		padding: 5rpx 10rpx;
+		color: #FFFFFF;
+		font-size: 24rpx;
+		background: #000000;
+
+		border-radius: 0 10rpx 0 0;
+	}
+
+	.name {
+		padding: 24rpx 20rpx;
+		color: #333333;
+		font-size: 28rpx;
+		background: #FFFFFF;
+		border-radius: 0 0 10rpx 10rpx;
+	}
+
+
+	.noMore {
+		text-align: center;
+		line-height: 50rpx;
+		color: #999999;
+		font-size: 28rpx;
+	}
+</style>