Переглянути джерело

1. 解决日历收起后手机端无法点击的问题

Cee Yang 3 роки тому
батько
коміт
8a6c6abc6f

+ 15 - 0
api/api.js

@@ -2,10 +2,25 @@ import request from './request'
 
 
 class Api {
 class Api {
 	
 	
+	///
+	/// LOGIN
+	///
+	
 	/// 登录 { "account": lishuming, "password": 123456}
 	/// 登录 { "account": lishuming, "password": 123456}
 	static login(data) { return request({url: '/api/v1/sso_v2/app_login', method: "POST", data: data}) }
 	static login(data) { return request({url: '/api/v1/sso_v2/app_login', method: "POST", data: data}) }
 
 
+	///
+	/// SCHEDULE
+	/// 
+	
+	/// 获取日程 /api/v1/school_app_class_schedule_page/page?time=202201
+	/// @time: String, eg: 202201
+	static classSchedule(time) { return request({url: `/api/v1/school_app_class_schedule_page/page?time=${time}`}) }
+
+	///
 	/// LESON
 	/// LESON
+	///
+	
 	static lessonDetail(id) { return request({ url: `/api/v1/lesson_detail/${id}` }) }
 	static lessonDetail(id) { return request({ url: `/api/v1/lesson_detail/${id}` }) }
 }
 }
 
 

+ 13 - 3
api/request.js

@@ -12,13 +12,22 @@ class Env {
 /// 公共请求处理
 /// 公共请求处理
 const request = (config) => {
 const request = (config) => {
 	
 	
+	const defaultHeader = {
+		"content-type": "application/json"
+	}
+	
 	config.url = Env.currentEnv().url + config.url
 	config.url = Env.currentEnv().url + config.url
-	if(!config.data) config.data = {}
-	if(!config.method) config.method = 'GET'
+	
+	if (!config.data) config.data = {}
+	if (!config.method) config.method = 'GET'
+	if (!config.header) config.header = defaultHeader
+	if (config.url.indexOf('app_login') === -1) {
+		config.header['token'] = store.state.userInfo.token
+	}
 	console.log(JSON.stringify(config));
 	console.log(JSON.stringify(config));
 	let promise = new Promise(function(resolve, reject) {
 	let promise = new Promise(function(resolve, reject) {
 		uni.request(config).then(responses => {
 		uni.request(config).then(responses => {
-			// 异常
+			console.log(responses)
 			if (responses[0]) {
 			if (responses[0]) {
 				reject({message : "网络超时"})
 				reject({message : "网络超时"})
 			} else {
 			} else {
@@ -26,6 +35,7 @@ const request = (config) => {
 				resolve(response)
 				resolve(response)
 			}
 			}
 		}).catch(error => {
 		}).catch(error => {
+			console.log(error)
 			reject(error)
 			reject(error)
 		})
 		})
 	})
 	})

+ 2 - 1
components/uni-calendar/README.md

@@ -1,4 +1,5 @@
 # 导入 uniCalendar 并自定义, 解决以下问题:
 # 导入 uniCalendar 并自定义, 解决以下问题:
 
 
 1. uniCalendar 自带的本地化不支持自动切换, 自定义采用本地自动化, 跟随语言切换变化
 1. uniCalendar 自带的本地化不支持自动切换, 自定义采用本地自动化, 跟随语言切换变化
-2. uniCalendar 不支持删除头部, 自定义显示隐藏头部
+2. uniCalendar 不支持删除头部, 自定义显示隐藏头部
+3. 添加折叠展开功能

+ 3 - 0
components/uni-calendar/uni-calendar-item.vue

@@ -81,6 +81,9 @@
 			todayText() {
 			todayText() {
 				return this.$i18n.t("uni-calender.today")
 				return this.$i18n.t("uni-calender.today")
 			},
 			},
+		},
+		mounted() {
+			
 		},
 		},
 		methods: {
 		methods: {
 			choiceDate(weeks) {
 			choiceDate(weeks) {

+ 20 - 8
components/uni-calendar/uni-calendar.vue

@@ -52,10 +52,12 @@
 					</view>
 					</view>
 				</view>
 				</view>
 				<view class="uni-calendar__weeks" v-for="(item,weekIndex) in weeks" :key="weekIndex">
 				<view class="uni-calendar__weeks" v-for="(item,weekIndex) in weeks" :key="weekIndex">
-					<view v-if="fold == false" class="uni-calendar__weeks-item" v-for="(weeks,weeksIndex) in item" :key="weeksIndex">
-						<calendar-item class="uni-calendar-item--hook" :weeks="weeks" :calendar="calendar" :selected="selected" :lunar="lunar" @change="choiceDate"></calendar-item>
-					</view>
-					<view v-if="fold && foldIndex===weekIndex" class="uni-calendar__weeks-item" v-for="(weeks,weeksIndex) in item" :key="weeksIndex">
+					<view v-if="fold" class="uni-calendar__weeks-box">
+						<view v-if="foldIndex===weekIndex" class="uni-calendar__weeks-item" v-for="(weeks,weeksIndex) in item" :key="weeksIndex">
+							<calendar-item class="uni-calendar-item--hook" :weeks="weeks" :calendar="calendar" :selected="selected" :lunar="lunar" @change="choiceDate"></calendar-item>
+						</view>
+					</view>
+					<view v-else class="uni-calendar__weeks-item" v-for="(weeks,weeksIndex) in item" :key="weeksIndex">
 						<calendar-item class="uni-calendar-item--hook" :weeks="weeks" :calendar="calendar" :selected="selected" :lunar="lunar" @change="choiceDate"></calendar-item>
 						<calendar-item class="uni-calendar-item--hook" :weeks="weeks" :calendar="calendar" :selected="selected" :lunar="lunar" @change="choiceDate"></calendar-item>
 					</view>
 					</view>
 				</view>
 				</view>
@@ -139,7 +141,7 @@
 			/// 是否能够折叠
 			/// 是否能够折叠
 			foldAble: {
 			foldAble: {
 				type: Boolean,
 				type: Boolean,
-				default: true
+				default: false
 			}
 			}
 		},
 		},
 		data() {
 		data() {
@@ -149,7 +151,7 @@
 				calendar: {},
 				calendar: {},
 				nowDate: '',
 				nowDate: '',
 				aniMaskShow: false,
 				aniMaskShow: false,
-				fold: false,
+				fold: true,
 				showMonthed: false,
 				showMonthed: false,
 				foldIndex: -1
 				foldIndex: -1
 			}
 			}
@@ -339,7 +341,8 @@
 			 * 选择天触发
 			 * 选择天触发
 			 * @param {Object} weeks
 			 * @param {Object} weeks
 			 */
 			 */
-			choiceDate(weeks) {
+			choiceDate(weeks) {
+				console.log('fuck')
 				if (weeks.disable) return
 				if (weeks.disable) return
 				this.calendar = weeks
 				this.calendar = weeks
 				// 设置多选
 				// 设置多选
@@ -531,6 +534,14 @@
 		/* #endif */
 		/* #endif */
 		flex-direction: row;
 		flex-direction: row;
 	}
 	}
+
+	.uni-calendar__weeks-box {
+		/* #ifndef APP-NVUE */
+		display: flex;
+		/* #endif */
+		flex-direction: row;
+		flex: 1;
+	}
 
 
 	.uni-calendar__weeks-item {
 	.uni-calendar__weeks-item {
 		flex: 1;
 		flex: 1;
@@ -587,5 +598,6 @@
 		flex-direction: row;
 		flex-direction: row;
 		justify-content: center;
 		justify-content: center;
 		align-items: center;
 		align-items: center;
-	}
+	}
+	
 </style>
 </style>

+ 37 - 1
manifest.json

@@ -43,7 +43,43 @@
             /* ios打包配置 */
             /* ios打包配置 */
             "ios" : {},
             "ios" : {},
             /* SDK配置 */
             /* SDK配置 */
-            "sdkConfigs" : {}
+            "sdkConfigs" : {},
+            "icons" : {
+                "android" : {
+                    "hdpi" : "unpackage/res/icons/72x72.png",
+                    "xhdpi" : "unpackage/res/icons/96x96.png",
+                    "xxhdpi" : "unpackage/res/icons/144x144.png",
+                    "xxxhdpi" : "unpackage/res/icons/192x192.png"
+                },
+                "ios" : {
+                    "appstore" : "unpackage/res/icons/1024x1024.png",
+                    "ipad" : {
+                        "app" : "unpackage/res/icons/76x76.png",
+                        "app@2x" : "unpackage/res/icons/152x152.png",
+                        "notification" : "unpackage/res/icons/20x20.png",
+                        "notification@2x" : "unpackage/res/icons/40x40.png",
+                        "proapp@2x" : "unpackage/res/icons/167x167.png",
+                        "settings" : "unpackage/res/icons/29x29.png",
+                        "settings@2x" : "unpackage/res/icons/58x58.png",
+                        "spotlight" : "unpackage/res/icons/40x40.png",
+                        "spotlight@2x" : "unpackage/res/icons/80x80.png"
+                    },
+                    "iphone" : {
+                        "app@2x" : "unpackage/res/icons/120x120.png",
+                        "app@3x" : "unpackage/res/icons/180x180.png",
+                        "notification@2x" : "unpackage/res/icons/40x40.png",
+                        "notification@3x" : "unpackage/res/icons/60x60.png",
+                        "settings@2x" : "unpackage/res/icons/58x58.png",
+                        "settings@3x" : "unpackage/res/icons/87x87.png",
+                        "spotlight@2x" : "unpackage/res/icons/80x80.png",
+                        "spotlight@3x" : "unpackage/res/icons/120x120.png"
+                    }
+                }
+            },
+            "splashscreen" : {
+                "androidStyle" : "common",
+                "iosStyle" : "common"
+            }
         }
         }
     },
     },
     /* 快应用特有相关 */
     /* 快应用特有相关 */

+ 4 - 2
pages.json

@@ -15,7 +15,8 @@
 		{
 		{
 			"path": "pages/index/index",
 			"path": "pages/index/index",
 			"style": {
 			"style": {
-				"navigationStyle":"custom"
+				"navigationStyle":"custom",
+				"enablePullDownRefresh": true
 			}
 			}
 		},
 		},
 		{
 		{
@@ -35,6 +36,7 @@
 		"navigationBarTextStyle": "black",
 		"navigationBarTextStyle": "black",
 		"navigationBarTitleText": "uni-app",
 		"navigationBarTitleText": "uni-app",
 		"navigationBarBackgroundColor": "#F8F8F8",
 		"navigationBarBackgroundColor": "#F8F8F8",
-		"backgroundColor": "#F8F8F8"
+		"backgroundColor": "#F8F8F8",
+		"enablePullDownRefresh": true
 	}
 	}
 }
 }

+ 19 - 15
pages/calendar/index.vue

@@ -9,12 +9,13 @@
 			<view class="u-nav-slot" slot="right"></view>
 			<view class="u-nav-slot" slot="right"></view>
 		</u-navbar>
 		</u-navbar>
 		
 		
-		 <uni-calendar insert :selected="selected" @change="change" />
+		 <uni-calendar insert foldAble :selected="selected" @change="change" />
 		
 		
 	</view>
 	</view>
 </template>
 </template>
 
 
 <script>
 <script>
+	import Api from '../../api/api.js'
 	import UniCalendar from "../../components/uni-calendar/uni-calendar.vue"
 	import UniCalendar from "../../components/uni-calendar/uni-calendar.vue"
 	export default {
 	export default {
 		components:{
 		components:{
@@ -22,7 +23,7 @@
 		},
 		},
 		data() {
 		data() {
 			return {
 			return {
-				currentDate: '2021-12',
+				currentDate: '',
 				show: false,
 				show: false,
 				mode: 'range',
 				mode: 'range',
 				selected: [
 				selected: [
@@ -36,28 +37,31 @@
 			
 			
 		},
 		},
 		mounted() {
 		mounted() {
+			// let now = new Date()
+			// let ye = new Intl.DateTimeFormat('en', { year: 'numeric' }).format(now)
+			// let mo = new Intl.DateTimeFormat('en', { month: '2-digit' }).format(now)
+			// this.currentDate = `${ye}${mo}` /// 202201
 			
 			
+			let now = new Date();
+			var year = now.getFullYear()
+			var month = now.getMonth()+1
+			this.currentDate = `${year}${month}` /// 202201
+			console.log(this.currentDate)
+			
+			this.getClassSchedule()
 		},
 		},
 		methods:{
 		methods:{
+			async getClassSchedule() {
+				Api.classSchedule(this.currentDate).then(res=>{
+					console.log(res)
+				})
+			},
 			previousBtnDidClick(){
 			previousBtnDidClick(){
 				console.log('previousBtnDidClick');
 				console.log('previousBtnDidClick');
 			},
 			},
 			nextBtnDidClick(){
 			nextBtnDidClick(){
 				console.log('nextBtnDidClick');
 				console.log('nextBtnDidClick');
 			},
 			},
-			confirm(e) {
-				console.log(e)
-			},
-			formatter(day) {
-				const d = new Date()
-				let month = d.getMonth() + 1
-				const date = d.getDate()
-				if(day.month == month && day.day == date + 3) {
-					day.bottomInfo = '有优惠'
-					day.dot = true
-				}
-				return day
-			},
 			change(e) {
 			change(e) {
 				console.log(e)
 				console.log(e)
 			}
 			}

BIN
static/icon-1024.png