he2802 vor 4 Jahren
Ursprung
Commit
f11596401c
7 geänderte Dateien mit 188 neuen und 38 gelöschten Zeilen
  1. 1 2
      common/request.js
  2. 129 16
      components/home.vue
  3. 2 0
      main.js
  4. 6 3
      pages/index/index.vue
  5. 16 5
      pages2/plan/create.vue
  6. 21 11
      pages2/plan/detail.vue
  7. 13 1
      pages2/wd/coupon.vue

+ 1 - 2
common/request.js

@@ -1,7 +1,6 @@
 
 const BASE_URL = 'http://192.168.1.222:8088'
- // const BASE_URL = 'http://192.168.1.104:8088' 
-// const BASE_URL = 'https://api.xyyxt.net' 
+ // const BASE_URL = 'https://api.xyyxt.net' 
 // const BASE_URL = 'http://127.0.0.1:8088' 
 // const BASE_URL = 'https://api.xyyxt.net'  //
 import store from '@/store/index.js'

+ 129 - 16
components/home.vue

@@ -31,9 +31,30 @@
 						<view v-for="(item, index) in date" :key="index" class="card_date">{{ item }}</view>
 					</view>
 					<view style="width: 100%;display: flex;justify-content:center;margin-top: 40rpx;">
-						<view v-for="(item, index) in date_num" :key="index" class="date_num">{{ item }}</view>
+						<view v-for="(item, index) in date_num" :key="index" class="date_num">
+							<view v-if="item.color == 0" class="date_num_color0" v-show="item.date>0">
+								{{ item.date }}
+								<view v-if="item.note > 0" class="date_note">{{ item.note }}</view>
+								<view v-if="item.dot" class="date_dot"></view>
+							</view>
+							<view v-if="item.color == 1" class="date_num_color1">
+								{{ item.date }}
+								<view v-if="item.note > 0" class="date_note">{{ item.note }}</view>
+								<view v-if="item.dot" class="date_dot"></view>
+							</view>
+							<view v-if="item.color == 2" class="date_num_color2">
+								{{ item.date }}
+								<view v-if="item.note > 0" class="date_note">{{ item.note }}</view>
+								<view v-if="item.dot" class="date_dot"></view>
+							</view>
+							<view v-if="item.color == 3" class="date_num_color3">
+								{{ item.date }}
+								<view v-if="item.note > 0" class="date_note">{{ item.note }}</view>
+								<view v-if="item.dot" class="date_dot"></view>
+							</view>
+						</view>
 					</view>
-					<view style="width: 100%;margin-top: 20rpx;"  >
+					<view style="width: 100%;margin-top: 20rpx;" v-if="workList.length>0" >
 						<u-row gutter="16">
 							<u-col span="2" text-align="center">
 								<view><image src="/static/left.png" class="arr-icon" @click="preveItem"></image></view>
@@ -172,23 +193,39 @@ export default {
 		this.windowHeight = uni.getSystemInfoSync().windowHeight;
 		this.initList();
 		this.advertisingList();
-		if(!this.$method.isLogin()){
-			//未登录
+		
+	},
+	methods: {
+		init(){
+			if(!this.$method.isLogin()){
+				//未登录
+				this.date_num = []
+				this.workList = []
+				this.initDay()
+			}else{
+				this.date_num = []
+				this.workList = []
+				this.userPlanSeven()
+			}
+		},
+		initDay(){
 			// d是当前星期一的日期对象
 			var d=this.getMonDate();
 			var arr=[];
+			let date = new Date();
+			let num = date.getDate();
 			for(var i=0; i<7; i++)
 			{
-				this.date_num.push(d.getDate())
+				let item = {date:d.getDate()}
+				item.color = 0
+				if(d.getDate()==num){
+					item.color = 3;
+				}
+				this.date_num.push(item)
 				d.setDate(d.getDate()+1);
 			}
-		}else{
-			this.userPlanSeven()
-		}
-		
-		console.log(arr)
-	},
-	methods: {
+			console.log(this.date_num,66)
+		},
 		preveItem(){
 			if(self.courseIndex>0){
 				self.courseIndex  = self.courseIndex-1
@@ -215,10 +252,36 @@ export default {
 		userPlanSeven() {
 			let self = this;
 			this.$api.userPlanSeven().then(result => {
-				 self.workList = result.data.data.coursePlanVo;
-				 if(self.workList.length>0){
-					 self.courseItem = self.workList[self.courseIndex]
-				 }
+				if(result.data.data.coursePlanVo!=null){
+					self.workList = result.data.data.coursePlanVo;
+					if(self.workList!=null&&self.workList.length>0){
+						self.courseItem = self.workList[self.courseIndex]
+					}
+					let date = new Date();
+					let num = date.getDate();
+					let list = result.data.data.calendarStudyVo[0].dayStudyList;
+					for(let i = 0; i < list.length; i++) {
+					    let item = list[i]
+						item.color = 0
+						if (item.date == num) {
+							item.color = 3;
+						}
+						if (item.perform == 1) {
+							item.color = 1;
+						}
+						if (item.perform == 2) {
+							item.color = 2;
+						}
+						item.note = item.studyCourseKnob
+						if(item.note>0){
+							item.dot = true
+						}
+						self.date_num.push(item)
+					}
+				}else{
+					self.initDay()
+				}
+				 
 			});
 		},
 		getMonDate()
@@ -427,11 +490,61 @@ export default {
 .u-row {
 	margin: 40rpx 0;
 }
+.date_dot {
+	width: 6rpx;
+	height: 6rpx;
+	background: #ffcc00;
+	border-radius: 50%;
+	margin: 0 auto;
+}
+.date_note {
+	border-radius: 50%;
+	width: 29rpx;
+	height: 29rpx;
+	border: 1px solid #ffcc00;
+	font-size: 18rpx;
+	color: #ffcc00;
+	text-align: center;
+	display: inline-block;
+	position: absolute;
+	top: -19rpx;
+	right: 9rpx;
+}
+.circle_num {
+	border-radius: 50%;
+	width: 29rpx;
+	height: 29rpx;
+	border: 1px solid #ffcc00;
+	font-size: 18rpx;
+	color: #ffcc00;
+	text-align: center;
+	display: inline-block;
+	margin: 5rpx;
+}
 .date_num {
 	width: 14%;
 	text-align: center;
+	position: relative;
+	display: inline-block;
+	margin-top: 20rpx;
+}
+.date_num_color0 {
+	color: #32467b;
+}
+.date_num_color1 {
 	color: #34c759;
 }
+.date_num_color2 {
+	color: #ff3b30;
+}
+.date_num_color3 {
+	color: #ffffff;
+	background-color: #ffcc00;
+	border-radius: 50%;
+	width: 40rpx;
+	height: 40rpx;
+	display: inline-block;
+}
 .card_date {
 	width: 14%;
 	text-align: center;

+ 2 - 0
main.js

@@ -15,6 +15,8 @@ Vue.prototype.$navTo = navTo
 import method from '@/common/methodTool'
 Vue.prototype.$method = method
 
+//import share from '@/js_sdk/share.js'
+//Vue.mixin(share)
 import uView from "uview-ui";
 Vue.use(uView);
 

+ 6 - 3
pages/index/index.vue

@@ -1,6 +1,6 @@
 <template>
 	<view>
-		<home v-show="current == 0"></home>
+		<home v-show="current == 0" ref="home"></home>
 		<my v-show="current == 1" ref="refMy"></my>
 
 		<u-tabbar v-model="current" :list="list" active-color="#2F4379" :before-switch="beforeSwitch"></u-tabbar>
@@ -36,13 +36,16 @@ export default {
 		};
 	},
 	onLoad(option) {},
-	onShow() {},
-	onShareAppMessage: function(res) {
+	onShow() {
+		this.$refs.home.init();
+	},
+	onShareAppMessage(res) {
 		var self = this;
 		return {
 			title: '中正',
 			path: `/pages/index/index`,
 			success(res) {
+				console.log('已分享');
 				if (self.$store.state.userInfo !== null) {
 					console.log('已登录');
 					var data = {

+ 16 - 5
pages2/plan/create.vue

@@ -36,7 +36,7 @@
 				</u-form-item>
 			</u-form>
 		</view>
-		<u-calendar v-model="calendar_show" :mode="calendar" @change="change" :max-date="maxDate"></u-calendar>
+		<u-calendar v-model="calendar_show" :min-date="minDate" :mode="calendar" @change="change" :max-date="maxDate"></u-calendar>
 		<!-- 弹框-->
 		<u-popup v-model="week_show" mode="bottom">
 			<view style="height: 400rpx;text-align: center">
@@ -91,7 +91,7 @@ export default {
 				time: '20:30',
 				startDate: '2021-05-07',
 				endDate: '2021-05-31',
-				week: '一'
+				week: '一,三,五'
 			},
 			calendar: 'range',
 			list: [],
@@ -99,6 +99,7 @@ export default {
 			show: false,
 			calendar_show: false,
 			maxDate: '2023-01-01',
+			minDate:'',
 			list3: [
 				{
 					name: '一',
@@ -149,8 +150,9 @@ export default {
 		};
 	},
 	onLoad(option) {
-		this.form.startDate = this.$method.timestampToTime(new Date().getTime() / 1000);
-		this.form.endDate = this.$method.timestampToTime(new Date().getTime() / 1000 + 24 * 3600 * 10);
+		this.minDate = this.$method.timestampToTime(new Date().getTime() / 1000);
+		this.form.startDate = this.minDate;
+		this.form.endDate = this.$method.timestampToTime(new Date().getTime() / 1000 + 24 * 3600 * 30);
 		this.getMyCourse();
 	},
 	onShow() {},
@@ -208,7 +210,16 @@ export default {
 				if (result.data.code == 200) {
 					uni.showModal({
 						title: '提示',
-						content: '提交成功'
+						content: '提交成功',
+						success: function(resst) {
+							uni.navigateBack()
+						}
+					});
+				}else{
+					uni.showToast({
+						title: result.data.msg,
+						icon: 'none',
+						duration: 2000
 					});
 				}
 				console.log(result);

+ 21 - 11
pages2/plan/detail.vue

@@ -166,9 +166,13 @@ export default {
 	onLoad(option) {
 		this.date_use = this.date_num;
 		
-		this.getList();
+		
 	},
 	onShow() {
+		this.workList = []
+		this.showDayList = []
+		this.calendarStudyVo = {}
+		this.getList();
 		
 	},
 	methods: {
@@ -178,8 +182,9 @@ export default {
 				planId: option.planId,
 				status: 0
 			}
+			let self = this
 			this.$api.planupdateGenerate(data).then(res => {
-				this.getList()
+				self.getList()
 			})
 		},
 		swipeMonth(index){
@@ -293,18 +298,23 @@ export default {
 		getList() {
 			let self = this;
 			this.$api.planUserPlan().then(result => {
-				result.data.data.forEach((item, index) => {
-					item.show = 'none';
-				});
-				self.list = result.data.data;
-				self.listItem = self.list[0]
-				self.dealMonth()
-	//			self.calendarStudyVo = result.data.data[0].calendarStudyVo[1];
-				if(self.list.length>0){
+				
+					result.data.data.forEach((item, index) => {
+						item.show = 'none';
+					});
+					self.list = result.data.data;
+				if(result.data.data.length>0){
 					self.listItem = self.list[0]
 					self.dealMonth()
-					self.havePlan = true
+					if(self.list.length>0){
+						self.listItem = self.list[0]
+						self.dealMonth()
+						self.havePlan = true
+					}
+				}else{
+					self.havePlan = false
 				}
+
 			});
 		},
 		newPlan() {

+ 13 - 1
pages2/wd/coupon.vue

@@ -227,7 +227,19 @@
 			}
 		},
 		onReachBottom() {
-			console.log(32423)
+			if (this.current == 0) {
+				if (this.list1.length < this.paramList[0].total) {
+					this.paramList[0].pageNum++;
+					this.getList1()
+				}
+			}
+			if (this.current == 1) {
+				if (this.list1.length < this.paramList[1].total) {
+					this.paramList[1].pageNum++;
+					this.getList2()
+				}
+			}
+
 		},
 		onLoad(option) {
 			this.getList1()