wkyy 2 лет назад
Родитель
Сommit
f6f2d2826e
3 измененных файлов с 53 добавлено и 31 удалено
  1. 12 3
      pages/index/index.vue
  2. 24 9
      pages/news/activityDetails.vue
  3. 17 19
      pages/news/index.vue

+ 12 - 3
pages/index/index.vue

@@ -66,7 +66,7 @@
 				<view class="title">
 					新闻资讯
 				</view>
-				<view class="more" @click="toNews">
+				<view class="more" @click="toNewsTZGG">
 					更多<u-icon name="arrow-right" color="#999999" size="28"></u-icon>
 				</view>
 			</view>
@@ -94,7 +94,7 @@
 				<view class="title">
 					相亲活动
 				</view>
-				<view class="more" @click="toNews">
+				<view class="more" @click="toNewsHDBG">
 					更多<u-icon name="arrow-right" color="#999999" size="28"></u-icon>
 				</view>
 			</view>
@@ -149,6 +149,8 @@
 				uuid: '',
 				newsList: [],
 				activityList: [],
+				type1: 'TZGG',
+				type2: 'HDBG',
 			}
 		},
 		// onReachBottom() {
@@ -183,7 +185,14 @@
 			}
 		},
 		methods: {
-			toNews() {
+			toNewsTZGG() {
+				this.carhelp.set("newsTypeCurrent", 0);
+				uni.switchTab({
+					url: '/pages/news/index'
+				})
+			},
+			toNewsHDBG() {
+				this.carhelp.set("newsTypeCurrent", 3);
 				uni.switchTab({
 					url: '/pages/news/index'
 				})

+ 24 - 9
pages/news/activityDetails.vue

@@ -1,10 +1,6 @@
 <template>
 	<view>
-		<u-navbar title="">
-			<view class="slot-wrap">
-				<view class="slot-title">{{detail.title}}</view>
-			</view>
-		</u-navbar>
+		<u-navbar :title="detail.title"></u-navbar>
 		<!-- <view class="img">
 			<img src="../../static/img/activity.png" alt="">
 		</view> -->
@@ -59,10 +55,13 @@
 				</view>
 			</view> -->
 		</view>
-		<u-modal v-model="show" :show-title="false" :content="content" 
-			:content-style="{color: '#101010',fontSize: '16px'}"
-			@confirm="confirm" confirm-color="#FF7C70" ref="uModal" :async-close="true"></u-modal>
+		<view>
+			<u-toast ref="uToast" />
+		</view>
 		<view class="bottom">
+			<u-modal v-model="show" :show-title="false" :content="content"
+				:content-style="{color: '#101010',fontSize: '16px'}"	@confirm="confirm" confirm-color="#FF7C70" 
+				:show-cancel-button="true" @cancel="cancel" ref="uModal" :async-close="true"></u-modal>
 			<u-button v-if="detail.isShow && !detail.isJoin" @click="signUp">立即报名</u-button>
 			<u-button v-if="detail.isShow && detail.isJoin" style="background-color: #CCCCCC;">已报名</u-button>
 		</view>
@@ -112,15 +111,31 @@
 					})
 				})
 			},
+			showToast() {
+				this.$refs.uToast.show({
+					title: '不在报名时段内!',
+					type: 'warning '
+				})
+			},
 			signUp() {
 				if(this.userId) {
-					this.show = true;
+					var date = new Date();
+					var oDate1 = new Date(this.detail.startTime);
+					var oDate2 = new Date(this.detail.endTime);
+					if(date.getTime() > oDate1.getTime() && date.getTime() < oDate2.getTime()){
+						this.show = true;
+					} else {
+						this.showToast();
+					}
 				} else {
 					uni.navigateTo({
 						url:'../../pagesA/pages/login/index'
 					})
 				}
 			},
+			cancel() {
+				this.show = false;
+			},
 			confirm() {
 				uni.showLoading({
 					title: "加载中",

+ 17 - 19
pages/news/index.vue

@@ -47,18 +47,11 @@
 				pageIndex: 1,
 				recordsTotal: 0,
 				list: [],
-				tabList: [{
-					name: '通知公告'
-				}, {
-					name: '活动报道'
-				},{
-					name: '婚恋课堂'
-				},{
-					name: '问题解答'
-				}],
+				tabList: [],
 				current: 0,
 				wrapList: [
 				],
+				newsTypeCurrent: 0,
 			}
 		},
 		onReachBottom() {
@@ -67,7 +60,15 @@
 				this.myLoadmore();
 			}
 		},
-		
+		onShow() {
+			if(this.carhelp.get("newsTypeCurrent") != null) {
+				this.newsTypeCurrent = this.carhelp.get("newsTypeCurrent");
+				this.current = this.newsTypeCurrent;
+			}
+			
+			this.getType()
+			//this.getBannerInfo()
+		},
 		methods: {
 			toDetail(item) {
 				if(this.newstype.shortName == 'HDBG') {
@@ -131,7 +132,6 @@
 				
 			},
 			getType() {
-				
 				uni.showLoading({
 					title: "加载中",
 					mask: true,
@@ -141,10 +141,11 @@
 				API.newsTypeList().then((res) => {
 					
 					this.tabList = res.data;
-					if(this.tabList.length){
-						this.newstype=this.tabList[0]	
-					}
 					
+					if(this.tabList.length) {
+						this.newstype = this.tabList[this.newsTypeCurrent];
+					}
+
 					if(this.newstype.shortName == 'HDBG') {
 						this.getActivityList(true)
 					} else {
@@ -209,6 +210,8 @@
 			},
 			change(index) {
 				this.current = index;
+				this.carhelp.set("newsTypeCurrent", index);
+				
 				if(this.tabList.length){
 					this.newstype=this.tabList[index]
 				}
@@ -220,11 +223,6 @@
 				}
 				this.getBannerInfo(this.newstype.shortName)
 			},
-			onReady() {
-			
-				this.getType()
-				//this.getBannerInfo()
-			}
 		},
 		
 	}