Tang 4 лет назад
Родитель
Сommit
aa7364da6f
7 измененных файлов с 151 добавлено и 41 удалено
  1. 2 0
      common/request.js
  2. 29 0
      components/home.vue
  3. 1 1
      pages2/plan/create.vue
  4. 9 2
      pages2/plan/detail.vue
  5. 1 1
      pages2/plan/edit.vue
  6. 15 20
      pages2/study/index.vue
  7. 94 17
      pages2/wd/coupon.vue

+ 2 - 0
common/request.js

@@ -2,6 +2,8 @@
 // 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 = 'http://127.0.0.1:8088' 
+// const BASE_URL = 'https://api.xyyxt.net'  //
 import store from '@/store/index.js'
 import api from './api.js'
 var num = 1

+ 29 - 0
components/home.vue

@@ -167,8 +167,37 @@ export default {
 		this.windowHeight = uni.getSystemInfoSync().windowHeight;
 		this.initList();
 		this.advertisingList();
+		// d是当前星期一的日期对象
+		var d=this.getMonDate();
+		var arr=[];
+		for(var i=0; i<7; i++)
+		{
+		arr.push(d.getFullYear()+'年'+(d.getMonth()+1)+'月'+d.getDate()+'日 ('+getDayName(d.getDay())+')');
+		d.setDate(d.getDate()+1);
+		}
 	},
 	methods: {
+		getMonDate()
+		{
+			var d=new Date(),
+			day=d.getDay(),
+			date=d.getDate();
+			if(day==1)
+			return d;
+			if(day==0)
+			d.setDate(date-6);
+			else
+			d.setDate(date-day+1);
+			return d;
+		},
+		getDayName(day)
+		{
+			var day=parseInt(day);
+			if(isNaN(day) || day<0 || day>6)
+			return false;
+			var weekday=["星期天","星期一","星期二","星期三","星期四","星期五","星期六"];
+			return weekday[day];
+		},
 		swiperClick(index){
 			let item = this.list[index]
 			uni.navigateTo({

+ 1 - 1
pages2/plan/create.vue

@@ -220,7 +220,7 @@ export default {
 		},
 		getMyCourse() {
 			let data = {
-				typeId: 0
+				typeId: 1
 			};
 			let self = this;
 			this.$api.getUserBuy(data).then(result => {

+ 9 - 2
pages2/plan/detail.vue

@@ -1,6 +1,6 @@
 <template>
 	<view style="padding: 30rpx;">
-		<view class="card">
+		<view class="card" v-if="havePlan">
 			<view class="date_t1">
 				<u-icon name="arrow-left"  size="28" v-if="havePreviousMonth" @click="swipeMonth(-1)"></u-icon>
 			<text style="padding: 0 15rpx;">{{calendarStudyVo.year}}年 {{calendarStudyVo.month}}月</text>
@@ -79,6 +79,7 @@
 				</uni-swipe-action-item>
 			</uni-swipe-action>
 		</view>
+		
 		<view class="newPlan" @click="newPlan()">新建计划</view>
 	</view>
 </template>
@@ -158,7 +159,8 @@ export default {
 			],
 			dayStudyList:[],
 			listItem:{},
-			currentMonth:0
+			currentMonth:0,
+			havePlan:false
 		};
 	},
 	onLoad(option) {
@@ -298,6 +300,11 @@ export default {
 				self.listItem = self.list[0]
 				self.dealMonth()
 	//			self.calendarStudyVo = result.data.data[0].calendarStudyVo[1];
+				if(self.list.length>0){
+					self.listItem = self.list[0]
+					self.dealMonth()
+					self.havePlan = true
+				}
 			});
 		},
 		newPlan() {

+ 1 - 1
pages2/plan/edit.vue

@@ -224,7 +224,7 @@ export default {
 		},
 		getMyCourse() {
 			let data = {
-				typeId: 0
+				typeId: 1
 			};
 			let self = this;
 			this.$api.getUserBuy(data).then(result => {

+ 15 - 20
pages2/study/index.vue

@@ -5,9 +5,7 @@
 		</view>
 		<view>
 			<view v-show="current === 0">
-				<view v-if="list1.length === 0" class="mar-t">
-					<u-empty text="未购买课程" mode="list"></u-empty>
-				</view>
+				<view v-if="list1.length === 0" class="mar-t"><u-empty text="未购买课程" mode="list"></u-empty></view>
 				<view v-else class="content" v-for="(item, index) in list1" :key="index" @click="jumpDetail(item)">
 					<view>
 						<u-row>
@@ -24,10 +22,8 @@
 				</view>
 			</view>
 			<view v-show="current === 1">
-				<view v-if="list2.length === 0" class="mar-t">
-					<u-empty text="未购买题库" mode="list"></u-empty>
-				</view>
-				<view v-else class="content" v-for="(item, index) in list2" :key="index" @click="jumpDetail(item)" >
+				<view v-if="list2.length === 0" class="mar-t"><u-empty text="未购买题库" mode="list"></u-empty></view>
+				<view v-else class="content" v-for="(item, index) in list2" :key="index" @click="jumpDetail(item)">
 					<view>
 						<u-row>
 							<u-col span="5">
@@ -43,10 +39,8 @@
 				</view>
 			</view>
 			<view v-show="current === 2">
-				<view v-if="list3.length === 0" class="mar-t">
-					<u-empty text="未购买考点重点" mode="list"></u-empty>
-				</view>
-				<view v-else class="content" v-for="(item, index) in list3" :key="index" @click="jumpDetail(item)" >
+				<view v-if="list3.length === 0" class="mar-t"><u-empty text="未购买考点重点" mode="list"></u-empty></view>
+				<view v-else class="content" v-for="(item, index) in list3" :key="index" @click="jumpDetail(item)">
 					<view>
 						<u-row>
 							<u-col span="5">
@@ -124,8 +118,8 @@ export default {
 			var self = this;
 			var param = this.paramList[0];
 			this.$api.getUserBuy(param).then(result => {
-				if(result.data.data.courseVoList !== null){
-				self.list1.push.apply(self.list1, result.data.data.courseVoList);
+				if (result.data.data.courseVoList !== null) {
+					self.list1.push.apply(self.list1, result.data.data.courseVoList);
 				}
 			});
 		},
@@ -133,16 +127,17 @@ export default {
 			var self = this;
 			var param = this.paramList[1];
 			this.$api.getUserBuy(param).then(result => {
-				if(result.data.data.questionBankList !== null){
-				self.list2.push.apply(self.list2, result.data.data.questionBankList);}
+				if (result.data.data.questionBankList !== null) {
+					self.list2.push.apply(self.list2, result.data.data.questionBankList);
+				}
 			});
 		},
 		getMyNote() {
 			var self = this;
 			var param = this.paramList[2];
 			this.$api.getUserBuy(param).then(result => {
-				if(result.data.data.examNoteList !== null){
-				self.list3.push.apply(self.list3, result.data.data.examNoteList);
+				if (result.data.data.examNoteList !== null) {
+					self.list3.push.apply(self.list3, result.data.data.examNoteList);
 				}
 			});
 		}
@@ -151,9 +146,9 @@ export default {
 </script>
 
 <style scope>
-	.mar-t{
-		margin-top: 30rpx;
-	}
+.mar-t {
+	margin-top: 30rpx;
+}
 .c_log {
 	font-size: 20rpx;
 	font-family: PingFang SC;

+ 94 - 17
pages2/wd/coupon.vue

@@ -6,12 +6,12 @@
 		<view class="box">
 			<view >
 			    <view v-show="current === 0">
-			        <view class="content" v-for="(item,index) in list" :key="index">
+			        <view class="content" v-for="(item,index) in list1" :key="index">
 						<view>
 							<u-row >
 								<u-col span="4" >
 									<view class="price_box">
-										<text class="price_num">20</text>
+										<text class="price_num">{{item.price}}</text>
 										<text class="price_unit">元</text>
 									</view>
 								</u-col>
@@ -34,10 +34,10 @@
 										有效期:
 									</view>
 									<view class="time">
-										2021-03-23 ~ 2021-04-22
+										{{ $method.timestampToTime(item.createTime) }} ~ {{ $method.timestampToTime(item.endTime) }}
 									</view>
 									<view class="tip">
-										所有题库均可使用
+										仅部分课程使用
 									</view>
 								</u-col>
 							</u-row>
@@ -45,12 +45,12 @@
 					</view>
 			    </view>
 			    <view v-show="current === 1">
-			        <view class="content" v-for="(item,index) in list" :key="index">
+			        <view class="content" v-for="(item,index) in list2" :key="index">
 			        	<view>
 			        		<u-row >
 			        			<u-col span="4" >
 			        				<view class="price_box">
-			        					<text class="price_num">8.8</text>
+			        					<text class="price_num">{{item.price}}</text>
 			        					<text class="price_unit">折</text>
 			        				</view>
 			        			</u-col>
@@ -59,7 +59,7 @@
 			        					<u-row >
 			        						<u-col span="6" >
 			        							<view class="coupon_title">
-			        								题库折扣券
+			        								课程折扣券
 			        							</view>
 			        						</u-col>
 			        						<u-col span="4" offset="2">
@@ -73,10 +73,10 @@
 			        					有效期:
 			        				</view>
 			        				<view class="time">
-			        					2021-03-23 ~ 2021-04-22
+			        					{{ $method.timestampToTime(item.createTime) }} ~ {{ $method.timestampToTime(item.endTime) }}
 			        				</view>
 			        				<view class="tip">
-			        					所有题库均可使用
+			        					仅部分课程可使用
 			        				</view>
 			        			</u-col>
 			        		</u-row>
@@ -93,7 +93,7 @@
 		<u-popup v-model="show" mode="bottom" :safe-area-inset-bottom="true">
 			<view class="popup_box" >
 				<scroll-view scroll-y="true" class="popup_list" >
-				<view class="content" v-for="(item,index) in list1" :key="index" v-show="current === 0">
+				<view class="content" v-for="(item,index) in list3" :key="index" v-show="current === 0">
 					<view style="position: relative;">
 						<u-row >
 							<u-col span="4" >
@@ -117,10 +117,10 @@
 									有效期:
 								</view>
 								<view class="time">
-									2021-03-23 ~ 2021-04-22
+									{{ $method.timestampToTime(item.createTime) }} ~ {{ $method.timestampToTime(item.endTime) }}
 								</view>
 								<view class="tip">
-									所有题库均可使用
+									仅部分课程可使用
 								</view>
 							</u-col>
 						</u-row>
@@ -129,7 +129,7 @@
 						</view>
 					</view>
 				</view>
-				<view class="content" v-for="(item,index) in list2" :key="index" v-show="current === 1">
+				<view class="content" v-for="(item,index) in list4" :key="index" v-show="current === 1">
 					<view style="position: relative;">
 						<u-row >
 							<u-col span="4" >
@@ -153,10 +153,10 @@
 									有效期:
 								</view>
 								<view class="time">
-									2021-03-23 ~ 2021-04-22
+									{{ $method.timestampToTime(item.createTime) }} ~ {{ $method.timestampToTime(item.endTime) }}
 								</view>
 								<view class="tip">
-									所有题库均可使用
+									仅部分课程可使用
 								</view>
 							</u-col>
 						</u-row>
@@ -186,15 +186,92 @@
 				list1:['/static/coupon/overdue.png',
 				'/static/coupon/used.png','/static/coupon/used.png',
 				'/static/coupon/overdue.png','/static/coupon/overdue.png'],
+				paramList: [
+					{
+						pageNum: 1,
+						pageSize: 10,
+						total: 0,
+						showStatus: 0,
+						couponType:0,
+						userStatus:0
+					},
+					{
+						pageNum: 1,
+						pageSize: 10,
+						total: 0,
+						showStatus: 0,
+						couponType:1,
+						userStatus:0
+					}
+				],
+				list1: [],
+				list2: [],
+				list3: [],
+				list4: [],
+				userParamList: [
+					{
+						pageNum: 1,
+						pageSize: 10,
+						total: 0,
+						couponType:0,
+						userStatus:2
+					},
+					{
+						pageNum: 1,
+						pageSize: 10,
+						total: 0,
+						couponType:1,
+						userStatus:2
+					}
+				],
 			}
 		},
+		onReachBottom() {
+			console.log(32423)
+		},
 		onLoad(option) {
-			this.current = parseInt(option.menuStatus) -1
-			console.log(this.current)
+			this.getList1()
+			this.getList2()
+			this.getList3()
+			this.getList4()
 		},
 		onShow(){
 		},
 		methods: {
+			getList1(){
+				let self = this
+				let param = this.paramList[0]
+				self.$api.configurationlistCoupon(param).then(res => {
+					self.list1 = res.data.rows;
+					self.paramList[0].total = res.data.total;
+					self.items[0] = '现金券('+res.data.total+')'
+				});
+			},
+			getList2(){
+				let self = this
+				let param = this.paramList[1]
+				self.$api.configurationlistCoupon(param).then(res => {
+					self.list2 = res.data.rows;
+					self.paramList[1].total = res.data.total;
+					self.items[1] = '折扣券('+res.data.total+')'
+				});
+			},
+			getList3(){
+				let self = this
+				let param = this.userParamList[0]
+				self.$api.configurationlistCoupon(param).then(res => {
+					self.list3 = res.data.rows;
+					self.userParamList[0].total = res.data.total;
+				});
+			},
+			getList4(){
+				let self = this
+				let param = this.userParamList[1]
+				self.$api.configurationlistCoupon(param).then(res => {
+					self.list4 = res.data.rows;
+					self.userParamList[1].total = res.data.total;
+				});
+			},
 			onClickItem(e){
 				this.current = e.currentIndex
 			},