xuqiaoying %!s(int64=2) %!d(string=hai) anos
pai
achega
850aba37e9
Modificáronse 1 ficheiros con 34 adicións e 11 borrados
  1. 34 11
      pages/index/index.vue

+ 34 - 11
pages/index/index.vue

@@ -56,8 +56,11 @@
 					<view style="width: 100%;display: flex;justify-content:center;margin-top: 20rpx;">
 						<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 style="width: 100%; display: flex; margin-top: 40rpx; flex-wrap: wrap;">
 						<view v-for="(item, index) in date_num" :key="index" class="date_num">
+							<view class="items">
+								{{ item.date }}
+							</view>
 							<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>
@@ -201,16 +204,6 @@
 			</view>
 		</view>
 
-		<!-- <tab-bar v-model="current" :list="tabbarlist" :mid-button="true" :mid-button-size="50" class="tab_items"></tab-bar> -->
-		<!-- <view v-if="isLogin" class="official">
-			<u-icon name="close"></u-icon>
-			<official-account @load='bindload'></official-account>
-		</view> -->
-		<!-- v-if="isLogin && (isFollow != 1) && curClose" -->
-		<!-- <view class="officialsss">
-			<text>asdsufd</text>
-			<official-account></official-account>
-		</view> -->
 		<view :style="{'opacity':opacitys}" class="officials">
 			<view class="weixin_official_account">
 				<image class="off_logo" src="/static/index/official.png"></image>
@@ -772,6 +765,32 @@ export default {
 			}
 		},
 		async init() {
+			let date = new Date();
+			let year = date.getFullYear();//获取当前年份
+			let month = date.getMonth() + 1;//获取当前月份
+			let dd = new Date(year, month, 0);//获取当月总天数
+			console.log('year:', year, 'month:', month, 'dd:',dd, dd.getDate());
+			let current_month = [];
+			let weekList = ["星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"];
+			for (let i = 1; i <= dd.getDate(); i++) {
+				current_month.push({
+					date: i,
+					week: weekList[new Date(date.setDate(i)).getDay()],//获取对应日期的星期
+				});
+			}
+			console.log('current_month[0].week', current_month[0].week);
+			if (current_month[0].week != 0) {
+				for (let index = 0; index < 2; index++) {
+					let item = {
+						date: '',
+						week: index
+					}
+					current_month.splice(index, 0, item)
+				}
+			}
+			console.log('====:', current_month);
+			this.date_num = current_month
+			return
 			if (!this.$method.isLogin()) {
 				//未登录
 				this.date_num = [];
@@ -797,6 +816,7 @@ export default {
 		},
 		initDay() {
 			// d是当前星期一的日期对象
+			console.log('d是当前星期一的日期对象');
 			var d = this.getMonDate();
 			var arr = [];
 			let date = new Date();
@@ -1368,6 +1388,9 @@ page {
 	position: relative;
 	display: inline-block;
 	margin-top: 20rpx;
+	.items {
+		width: 100%;
+	}
 }
 .course_title {
 	color: #2f4379;