소스 검색

calendar today

zizhong.wang 3 년 전
부모
커밋
9f84fd4cdc
2개의 변경된 파일20개의 추가작업 그리고 7개의 파일을 삭제
  1. 12 7
      components/lx-calendar/lx-calendar.vue
  2. 8 0
      pages/makeField/selectTime.vue

+ 12 - 7
components/lx-calendar/lx-calendar.vue

@@ -2,9 +2,9 @@
 <template>
 	<view class="date">
 		<view class="head">
-			<view class="icon" @click="switch_month_week('prev',true)"><text class="iconfont icon-fanhui" :class="[currentMonth == nowMonth ? 'disabled' : '']" /></view>
+			<view class="icon" @click="switch_month_week('prev',true)"><text class="iconfont icon-fanhui" :class="[currentMonth == nowMonth ? 'month_disabled' : '']" /></view>
 			<view class="title">{{nowYear+'年'+nowMonth+'月'}}</view>
-			<view class="icon" @click="switch_month_week('next',true)"><text class="iconfont next icon-fanhui" :class="[currentMonth + 1 == nowMonth ? 'disabled' : '']" /></view>
+			<view class="icon" @click="switch_month_week('next',true)"><text class="iconfont next icon-fanhui" :class="[currentMonth + 1 == nowMonth ? 'month_disabled' : '']" /></view>
 		</view>
 		<view class="date_dl" >
 			<view class="dd" v-for="(item,index) in week" :key="index">{{item}}</view>
@@ -235,7 +235,10 @@ export default {
 			this.set_to_day_all();
 		},
 		change_date_month(type){
+			
 			let week_list = this.week_list;
+			
+			
 			if(type == 'prev'){
 				this.week_list = this.week_list_prev
 				this.week_list_prev = this.week_list_next;
@@ -248,6 +251,7 @@ export default {
 		},
 		change_date(e){
 			
+			//return;
 			
 			let primary_current = this.current
 			let current = e.detail.current;
@@ -422,14 +426,14 @@ export default {
 			return Date.parse(str.replace(/-(\d)(?!\d)/g, '-0$1'));
 		},
 		switch_month_week(type = 'next',update_week = false){
-			if (this.currentMonth == this.nowMonth && type=="prev"){
+			if (this.currentMonth >= this.nowMonth && type=="prev"){
 				return;
 			}
-			if (this.currentMonth + 1 == this.nowMonth && type=="next"){
+			if (this.currentMonth < this.nowMonth && type == "next"){
 				return;
 			}
 			
-			this.nowDay = '';
+//			this.nowDay = '';
 			this.date = '';
 			
 			if(this.retract){
@@ -457,6 +461,7 @@ export default {
 			
 		},
 		update_swiper_item(type = 'month'){
+			
 			if(type == 'month'){
 				if(this.current == 0){
 					this.change_date_month('next')
@@ -517,7 +522,7 @@ export default {
 				})
 				
 				if(i == nowDay && type == 'same'){
-				//	this.date = `${nowYear}-${nowMonth}-${i}`;
+//					this.date = `${nowYear}-${nowMonth}-${i}`;
 				}
 				
 			}
@@ -612,7 +617,7 @@ export default {
 	}
 	
 }
-.disabled{
+.month_disabled{
 		color: @color_disabled;
 }
 .retract{

+ 8 - 0
pages/makeField/selectTime.vue

@@ -53,6 +53,14 @@ export default {
 		  this.hourListSelceted.splice(index,1,!this.hourListSelceted[index])
 	  },
 	 goSubmit(){
+		 if (!this.selectDate){
+			 uni.showToast({
+			 	title:"请选择日期",
+			 	icon:'none'
+			 });
+			 return;
+		 }
+		 
 		if(!this.hourListSelceted.includes(true)) {
 			uni.showToast({
 				title:'请选择时间段',