浏览代码

第二期

xiaoxin 2 年之前
父节点
当前提交
f6ce2f3344

+ 14 - 6
pages/affirmOrder/affirmOrder.vue

@@ -195,17 +195,14 @@ export default {
 			}
 		})
 	},
-	onShow() {
-		this.getCouponNum()
-	},
 	onLoad(options) {
 		this.info = JSON.parse(options.info)
-		// console.log(this.info)
 		this.hotelName = this.info.hotelName
 		this.getDayList()
 		uni.$on('change', this.change)
 		uni.$on('choose', this.choose)
 	},
+	// 计算属性
 	computed: {
 		// 总费用
 		totalPrice() {
@@ -219,6 +216,16 @@ export default {
 			}
 		}
 	},
+	// 监听属性
+	watch: {
+		totalPrice: {
+			handler(newVal, oldVal) {
+				console.log(newVal)
+				console.log(oldVal)
+				this.getCouponNum()
+			}
+		}
+	},
 	methods: {
 		async getDayList() {
 			const res = await this.$myRequest({
@@ -242,7 +249,8 @@ export default {
 					hotelId: this.info.hotelId,
 					page: 1,
 					rows: 1,
-					userId: uni.getStorageSync('userInfo').id
+					userId: uni.getStorageSync('userInfo').id,
+					totalPrice: (this.roomCount * this.totalMoney).toFixed(2)
 				}
 			})
 			// console.log(res);
@@ -821,4 +829,4 @@ export default {
 		}
 	}
 }
-</style>
+</style>

+ 51 - 4
pages/appraise/appraise.vue

@@ -70,7 +70,26 @@
 
 				<!-- 图片区域 -->
 				<view class="box_img">
-					<img v-for="(ele, index) in item.url" :key="index" mode="aspectFill" :src="ele" @click.stop="handleClickImg(item.url, index)" />
+					<img
+						v-for="(ele, index) in item.url"
+						:key="index"
+						mode="aspectFill"
+						v-if="ele.indexOf('jpg') !== -1 || ele.indexOf('png') !== -1"
+						:src="ele"
+						@click.stop="handleClickImg(ele, index)"
+					/>
+					<video
+						:id="item.id + index2"
+						class="video"
+						:show-fullscreen-btn="false"
+						:show-play-btn="false"
+						v-for="(video, index2) in item.url"
+						:key="index2"
+						v-if="video.indexOf('mp4') !== -1"
+						:src="video"
+						@fullscreenchange="fullscreenchange"
+						@click.stop="handleClickVideo(item.id + index2)"
+					></video>
 				</view>
 
 				<!-- 评论按钮区域 -->
@@ -119,7 +138,11 @@ export default {
 			// 卫生评分
 			scoreWs: '',
 			// 位置评分
-			scoreWz: ''
+			scoreWz: '',
+			// video 上下文 videoContext 对象
+			videoContext: null,
+			// 是否是全屏状态
+			isFullScreen: false
 		}
 	},
 	onLoad(options) {
@@ -138,6 +161,21 @@ export default {
 		}
 	},
 	methods: {
+		// 进入全屏和退出全屏时触发的回调
+		fullscreenchange(e) {
+			this.isFullScreen = e.detail.fullScreen
+		},
+		// 点击视频控件时触发的回调
+		handleClickVideo(id) {
+			this.videoContext = uni.createVideoContext(id)
+			if (this.isFullScreen) {
+				this.videoContext.stop()
+				this.videoContext.exitFullScreen()
+			} else {
+				this.videoContext.requestFullScreen()
+				this.videoContext.play()
+			}
+		},
 		async getData() {
 			const res = await this.$myRequest({
 				url: '/mhotel/abcaevaluatePage.action',
@@ -156,7 +194,7 @@ export default {
 				this.scoreSs = res.score.scoreSs.toFixed(1)
 				this.scoreWs = res.score.scoreWs.toFixed(1)
 				this.scoreWz = res.score.scoreWz.toFixed(1)
-				this.commentList = res.page.pageList || []
+				this.commentList = [...this.commentList, ...(res.page.pageList || [])]
 				this.total = res.page.total
 			}
 		},
@@ -175,10 +213,13 @@ export default {
 		},
 		// 点击评价图片回调
 		handleClickImg(url, index) {
+			if (this.videoContext) {
+				this.videoContext.stop()
+			}
 			// 预览图片
 			uni.previewImage({
 				current: index,
-				urls: url
+				urls: [url]
 			})
 		}
 	}
@@ -303,6 +344,12 @@ export default {
 					height: 216rpx;
 					border-radius: 20rpx;
 				}
+
+				.video {
+					width: 216rpx;
+					height: 216rpx;
+					border-radius: 20rpx;
+				}
 			}
 
 			.box_comment {

+ 50 - 4
pages/appraiseDetail/appraiseDetail.vue

@@ -22,7 +22,26 @@
 
 			<!-- 图片列表区域 -->
 			<view class="header_img">
-				<img v-for="(ele, index) in info.url" :key="index" mode="aspectFill" :src="ele" @click="handleLookImg(info.url, index)" />
+				<img
+					v-for="(ele, index) in info.url"
+					:key="index"
+					mode="aspectFill"
+					v-if="ele.indexOf('jpg') !== -1 || ele.indexOf('png') !== -1"
+					:src="ele"
+					@click="handleLookImg(ele, index)"
+				/>
+				<video
+					id="myVideo"
+					class="video"
+					:show-fullscreen-btn="false"
+					:show-play-btn="false"
+					v-for="(video, index2) in info.url"
+					:key="index2"
+					v-if="video.indexOf('mp4') !== -1"
+					:src="video"
+					@fullscreenchange="fullscreenchange"
+					@click="handleClickVideo"
+				></video>
 			</view>
 		</view>
 
@@ -104,15 +123,35 @@ export default {
 			// 评价列表信息
 			infoList: [],
 			id: null,
-			inputValue: ''
+			inputValue: '',
+			videoContext: null,
+			// 是否是全屏状态
+			isFullScreen: false
 		}
 	},
+	onReady() {
+		this.videoContext = uni.createVideoContext('myVideo')
+	},
 	onLoad(options) {
 		// console.log(options)
 		this.id = options.id
 		this.getData()
 	},
 	methods: {
+		// 进入全屏和退出全屏时触发的回调
+		fullscreenchange(e) {
+			this.isFullScreen = e.detail.fullScreen
+		},
+		// 点击视频控件时触发的回调
+		handleClickVideo() {
+			if (this.isFullScreen) {
+				this.videoContext.stop()
+				this.videoContext.exitFullScreen()
+			} else {
+				this.videoContext.requestFullScreen()
+				this.videoContext.play()
+			}
+		},
 		handleComment(item) {
 			uni.showModal({
 				title: '请输入评论',
@@ -203,9 +242,10 @@ export default {
 			}
 		},
 		// 点击图片回调
-		handleLookImg(urls, current) {
+		handleLookImg(url, current) {
+			this.videoContext.stop()
 			uni.previewImage({
-				urls,
+				urls: [url],
 				current
 			})
 		}
@@ -279,6 +319,12 @@ export default {
 				height: 216rpx;
 				border-radius: 20rpx;
 			}
+
+			.video {
+				width: 216rpx;
+				height: 216rpx;
+				border-radius: 20rpx;
+			}
 		}
 	}
 

+ 1 - 1
pages/collect/collect.vue

@@ -15,7 +15,7 @@
 				<view class="box_info">
 					<view class="info_name">{{ item.hotel_name }}</view>
 					<view class="info_rate">
-						<view class="rate_num">{{ item.score === 0 ? '5.0' : item.score }}</view>
+						<view class="rate_num">{{ item.score === 0 ? '5.0' : item.score.toFixed(1) }}</view>
 						<view v-if="item.score < 1 && item.score > 0" class="rate_msg">很差</view>
 						<view v-if="item.score < 2 && item.score > 1" class="rate_msg">差</view>
 						<view v-if="item.score < 3 && item.score > 2" class="rate_msg">一般</view>

+ 170 - 36
pages/complaint/complaint.vue

@@ -29,8 +29,18 @@
 					<img class="img" src="../../static/index/photo.png" />
 					<view class="msg">照片/视频</view>
 				</view>
-				<view class="uploading_box" v-for="(ele, index) in subImgList" :key="index">
-					<img class="img2" mode="aspectFill" :src="ele" />
+				<view class="uploading_box" v-for="(ele, index) in viewImgList" :key="index">
+					<img class="img2" mode="aspectFill" v-if="ele.fileType === 'image'" :src="ele.url" @click="handleLook(ele.url, index)" />
+					<video
+						id="myVideo"
+						class="video"
+						:show-fullscreen-btn="false"
+						:show-play-btn="false"
+						v-if="ele.fileType === 'video'"
+						:src="ele.url"
+						@fullscreenchange="fullscreenchange"
+						@click="handleClickVideo('myVideo')"
+					></video>
 					<view class="icon" @click="handleDelete(index)">
 						<img src="../../static/index/close2.png" />
 					</view>
@@ -40,10 +50,25 @@
 
 		<!-- 提交按钮区域 -->
 		<view class="btn" @click="handleSub">提交</view>
+
+		<!-- 用于图片压缩的canvas画布 -->
+		<canvas
+			:style="{
+				width: cw + 'px',
+				height: cw + 'px',
+				position: 'absolute',
+				zIndex: -1,
+				left: '-10000rpx',
+				top: '-10000rpx'
+			}"
+			canvas-id="zipCanvas"
+		></canvas>
+		<!--画布结束-->
 	</view>
 </template>
 
 <script>
+import getLessLimitSizeImage from '../../util/imageCompress.js'
 var dayjs = require('dayjs')
 export default {
 	data() {
@@ -56,12 +81,20 @@ export default {
 			textareaValuelength: 0,
 			// 上传的图片数据
 			subImgList: [],
+			// 显示的图片数据
+			viewImgList: [],
 			// 订单id
 			bookingId: '',
 			// 民宿id
 			hotelId: '',
 			// 房间id
-			houseId: ''
+			houseId: '',
+			//画板边长默认是屏幕宽度,正方形画布
+			cw: uni.getSystemInfoSync().windowWidth,
+			// video 上下文 videoContext 对象
+			videoContext: null,
+			// 是否是全屏状态
+			isFullScreen: false
 		}
 	},
 	onLoad(options) {
@@ -70,6 +103,21 @@ export default {
 		this.houseId = options.houseId
 	},
 	methods: {
+		// 进入全屏和退出全屏时触发的回调
+		fullscreenchange(e) {
+			this.isFullScreen = e.detail.fullScreen
+		},
+		// 点击视频控件时触发的回调
+		handleClickVideo(id) {
+			this.videoContext = uni.createVideoContext(id)
+			if (this.isFullScreen) {
+				this.videoContext.stop()
+				this.videoContext.exitFullScreen()
+			} else {
+				this.videoContext.requestFullScreen()
+				this.videoContext.play()
+			}
+		},
 		// 评价输入框输入回调
 		handleInput(e) {
 			this.textareaValuelength = e.detail.cursor
@@ -77,54 +125,116 @@ export default {
 		// 上传图片回调
 		handleUpLoad() {
 			uni.chooseMedia({
-				count: 9,
-				maxDuration: 15,
+				count: 6,
+				mediaType: ['mix'],
 				success: (res) => {
-					console.log(res)
-					console.log(res.tempFiles)
-					if (this.subImgList.length + res.tempFiles.length > 9) {
+					// console.log(res)
+					// console.log(res.tempFiles)
+					// 判断文件不能超过6个
+					if (this.subImgList.length + res.tempFiles.length > 6) {
 						uni.showToast({
-							title: '最多只能上传9个图片/视频',
+							title: '最多只能上传6个图片/视频',
 							icon: 'none'
 						})
 						return
 					}
-					uni.showLoading({
-						title: '上传中'
-					})
-					// reverse()
+					// 判断视频文件不能超过1个
+					let temList = [...this.viewImgList, ...res.tempFiles]
+					let temList2 = temList.filter((ele) => ele.fileType === 'video')
+					if (temList2.length > 1) {
+						uni.showToast({
+							title: '最多只能上传1个视频',
+							icon: 'none'
+						})
+						return
+					}
+
 					res.tempFiles.forEach((ele) => {
-						uni.uploadFile({
-							url: `https://chtech.ncjti.edu.cn/hotelReservation/mhotel/mhotel/uploadhimage.action`,
-							filePath: ele.tempFilePath,
-							name: 'myFile',
-							success: (uploadFileRes) => {
-								console.log(JSON.parse(uploadFileRes.data))
-								let temRes = JSON.parse(uploadFileRes.data)
-								if (temRes.code === 200) {
-									this.subImgList.push(temRes.data.url)
-									console.log(this.subImgList)
-									uni.hideLoading()
-								} else {
-									uni.showToast({
-										title: temRes.message,
-										icon: 'none'
-									})
+						if (ele.fileType === 'image' && ele.size > 1024 * 1024 * 3) {
+							//这里的id和页面中写的html代码的canvas的id要一致
+							let canvasId = 'zipCanvas'
+							//原图的路径
+							let imagePath = ele.tempFilePath
+							//大小限制1024kb
+							let limitSize = 1024 * 3
+							//初始绘画区域是画布自身的宽度也就是屏幕宽度
+							let drawWidth = uni.getSystemInfoSync().windowWidth
+							// 图片过大压缩
+							getLessLimitSizeImage(canvasId, imagePath, limitSize, drawWidth, (resPath) => {
+								this.handleUploadMini({ tempFilePath: resPath, fileType: ele.fileType })
+							})
+						} else if (ele.fileType === 'video' && ele.size > 1024 * 1024 * 5) {
+							// 视频过大压缩
+							uni.compressVideo({
+								src: ele.tempFilePath,
+								quality: 'low',
+								// bitrate: 60000,
+								// fps: 30,
+								// resolution: 1,
+								success: (res) => {
+									// console.log('压缩后', res)
+									this.handleUploadMini({ tempFilePath: res.tempFilePath, fileType: ele.fileType })
+								},
+								fail: (err) => {
+									// console.log(err)
+									uni.showToast(
+										{
+											title: '视频压缩失败',
+											icon: 'none'
+										},
+										2000
+									)
 								}
-							},
-							fail: () => {
-								uni.showToast({
-									title: '上传失败',
-									icon: 'error'
-								})
-							}
+							})
+						} else {
+							this.handleUploadMini(ele)
+						}
+					})
+				}
+			})
+		},
+		handleUploadMini(ele) {
+			// console.log(ele)
+			// 开始上传
+			uni.showLoading({
+				title: '上传中'
+			})
+			uni.uploadFile({
+				// url: `https://chtech.ncjti.edu.cn/hotelReservation/mhotel/mhotel/uploadhimage.action`,
+				url: `https://chtech.ncjti.edu.cn/homestay/file/cos/upload`,
+				filePath: ele.tempFilePath,
+				// name: 'myFile',
+				name: 'files',
+				success: (uploadFileRes) => {
+					// console.log(JSON.parse(uploadFileRes.data))
+					let temRes = JSON.parse(uploadFileRes.data)
+					if (temRes.code === 200 || temRes.code === 1) {
+						this.subImgList.push(temRes.data)
+						// console.log(this.subImgList)
+						this.viewImgList.push({
+							url: temRes.data,
+							fileType: ele.fileType === 'image' ? 'image' : 'video'
 						})
+						// console.log(this.viewImgList)
+					} else {
+						uni.showToast({
+							title: temRes.message || '上传失败',
+							icon: 'none'
+						})
+					}
+					uni.hideLoading()
+				},
+				fail: () => {
+					uni.showToast({
+						title: '上传失败',
+						icon: 'error'
 					})
 				}
 			})
 		},
 		// 提交按钮回调
 		async handleSub() {
+			const reg = new RegExp("[`~!@#$^&*()=|{}':;',\\[\\].<>《》/?~!@#¥……&*()——|{}【】‘;:”“'。,、? ]")
 			if (!this.inputValue) {
 				uni.showToast({
 					title: '请输入标题',
@@ -133,6 +243,14 @@ export default {
 				})
 				return
 			}
+			if (reg.test(this.inputValue)) {
+				uni.showToast({
+					title: '标题不能含有特殊字符和标点符号',
+					icon: 'none',
+					mask: true
+				})
+				return
+			}
 			if (!this.textareaValue) {
 				uni.showToast({
 					title: '请输入投诉内容',
@@ -171,6 +289,16 @@ export default {
 		// 删除图片回调
 		handleDelete(index) {
 			this.subImgList.splice(index, 1)
+			this.viewImgList.splice(index, 1)
+		},
+		handleLook(url, current) {
+			if (this.videoContext) {
+				this.videoContext.stop()
+			}
+			uni.previewImage({
+				urls: [url],
+				current
+			})
 		}
 	}
 }
@@ -277,6 +405,12 @@ export default {
 					border-radius: 7rpx;
 				}
 
+				.video {
+					width: 124rpx;
+					height: 124rpx;
+					border-radius: 7rpx;
+				}
+
 				.icon {
 					position: absolute;
 					top: 0;

+ 56 - 6
pages/complaintProgress/complaintProgress.vue

@@ -17,7 +17,7 @@
 				</view>
 				<view class="info_box">
 					<view class="box_key">反馈时间</view>
-					<view class="box_value">{{ info.dateTime }}</view>
+					<view class="box_value">{{ info.dateTime.slice(0, 19) }}</view>
 				</view>
 			</view>
 		</view>
@@ -44,7 +44,26 @@
 						<view class="right_bottom" v-if="item.urlList.length">
 							<view class="bottom_key">图片:</view>
 							<view class="bottom_value">
-								<img mode="aspectFill" v-for="(img, index2) in item.urlList" :key="index2" :src="img" @click="() => handleClickImg(item.urlList, index2)" />
+								<img
+									mode="aspectFill"
+									v-for="(img, index2) in item.urlList"
+									:key="index2"
+									:src="img"
+									v-if="img.indexOf('jpg') !== -1 || img.indexOf('png') !== -1"
+									@click="handleClickImg(img, index2)"
+								/>
+								<video
+									id="myVideo"
+									class="video"
+									:show-fullscreen-btn="false"
+									:show-play-btn="false"
+									v-for="(video, index3) in item.urlList"
+									:key="index3"
+									v-if="video.indexOf('mp4') !== -1"
+									:src="video"
+									@fullscreenchange="fullscreenchange"
+									@click="handleClickVideo"
+								></video>
 							</view>
 						</view>
 					</view>
@@ -69,14 +88,34 @@ export default {
 			list: [],
 			id: '',
 			// 进度详情数据
-			info: null
+			info: null,
+			videoContext: null,
+			// 是否是全屏状态
+			isFullScreen: false
 		}
 	},
+	onReady() {
+		this.videoContext = uni.createVideoContext('myVideo')
+	},
 	onLoad(options) {
 		this.id = options.id
 		this.getData()
 	},
 	methods: {
+		// 进入全屏和退出全屏时触发的回调
+		fullscreenchange(e) {
+			this.isFullScreen = e.detail.fullScreen
+		},
+		// 点击视频控件时触发的回调
+		handleClickVideo() {
+			if (this.isFullScreen) {
+				this.videoContext.stop()
+				this.videoContext.exitFullScreen()
+			} else {
+				this.videoContext.requestFullScreen()
+				this.videoContext.play()
+			}
+		},
 		// 获取进度详情数据
 		async getData() {
 			const res = await this.$myRequest({
@@ -118,10 +157,15 @@ export default {
 			})
 		},
 		// 点击进度条图片回调
-		handleClickImg(urls, index) {
+		handleClickImg(url, index) {
+			console.log(url)
+			console.log(index)
+			if (this.videoContext) {
+				this.videoContext.stop()
+			}
 			uni.previewImage({
-				urls,
-				current: index
+				current: index,
+				urls: [url]
 			})
 		}
 	}
@@ -265,6 +309,12 @@ export default {
 								height: 122rpx;
 								border-radius: 5rpx;
 							}
+
+							.video {
+								width: 120rpx;
+								height: 122rpx;
+								border-radius: 5rpx;
+							}
 						}
 					}
 				}

+ 12 - 6
pages/coupon/coupon.vue

@@ -18,9 +18,9 @@
 						<view class="left_title">{{ item.name }}</view>
 						<view class="left_tags">
 							<view class="tag">有限期至{{ item.effectiveEndDate.slice(0, 10) }}</view>
-							<view class="tag" v-if="item.hotelIds.includes('-1')">全宿</view>
+							<view class="tag" v-if="item.hotelIds.includes('-1')">全宿</view>
 							<view class="tag" v-else @click="handleClickTag(item.hotelIds)">
-								指定宿
+								指定宿
 								<img src="../../static/index/right2.png" />
 							</view>
 						</view>
@@ -75,6 +75,7 @@ export default {
 		}
 	},
 	onLoad(options) {
+		console.log(options)
 		this.hotelId = options.id
 		this.totalPrice = options.totalPrice
 		this.complaintId = options.complaintId
@@ -135,7 +136,8 @@ export default {
 					hotelId: this.hotelId,
 					page: this.page,
 					rows: this.rows,
-					userId: uni.getStorageSync('userInfo').id
+					userId: uni.getStorageSync('userInfo').id,
+					totalPrice: this.totalPrice
 				}
 			})
 			// console.log(res);
@@ -315,7 +317,7 @@ export default {
 		flex-direction: column;
 		align-items: center;
 		width: 481rpx;
-		height: 404rpx;
+		// height: 404rpx;
 		border-radius: 22.5rpx;
 		background-color: #fff;
 
@@ -340,17 +342,21 @@ export default {
 
 		.popup_center {
 			box-sizing: border-box;
-			padding: 0 20rpx;
-			height: 135rpx;
+			padding: 0 20rpx 20rpx;
+			max-height: 400rpx;
+			// height: 135rpx;
+			line-height: 42rpx;
 			color: rgba(15, 25, 77, 0.6);
 			font-size: 28rpx;
 			font-weight: bold;
+			overflow-y: auto;
 		}
 
 		.popup_btn {
 			display: flex;
 			justify-content: center;
 			align-items: center;
+			margin-bottom: 20rpx;
 			width: 396rpx;
 			height: 76rpx;
 			color: #fff;

+ 11 - 7
pages/couponCenter/couponCenter.vue

@@ -96,11 +96,11 @@ export default {
 			})
 			// console.log(res);
 			if (res.code === 200 && res.page.pageList) {
-				this.list = [...this.list, ...res.page.pageList]
-				this.total = res.page.total
-				this.list.forEach((ele) => {
+				res.page.pageList.forEach((ele) => {
 					ele.hotelIds = ele.hotelIds.split(',')
 				})
+				this.list = [...this.list, ...res.page.pageList]
+				this.total = res.page.total
 			}
 		},
 		// 点击指定民宿tag回调
@@ -156,7 +156,7 @@ export default {
 .container {
 	box-sizing: border-box;
 	padding: 20rpx 30rpx;
-	height: 100vh;
+	min-height: 100vh;
 	overflow-y: auto;
 	background-color: #f2f3f5;
 
@@ -305,7 +305,7 @@ export default {
 		flex-direction: column;
 		align-items: center;
 		width: 481rpx;
-		height: 404rpx;
+		// height: 404rpx;
 		border-radius: 22.5rpx;
 		background-color: #fff;
 
@@ -330,17 +330,21 @@ export default {
 
 		.popup_center {
 			box-sizing: border-box;
-			padding: 0 20rpx;
-			height: 135rpx;
+			padding: 0 20rpx 20rpx;
+			max-height: 400rpx;
+			// height: 135rpx;
+			line-height: 42rpx;
 			color: rgba(15, 25, 77, 0.6);
 			font-size: 28rpx;
 			font-weight: bold;
+			overflow-y: auto;
 		}
 
 		.popup_btn {
 			display: flex;
 			justify-content: center;
 			align-items: center;
+			margin-bottom: 20rpx;
 			width: 396rpx;
 			height: 76rpx;
 			color: #fff;

+ 77 - 14
pages/detail/detail.vue

@@ -253,7 +253,26 @@
 
 					<!-- 图片区域 -->
 					<view class="box_img">
-						<img v-for="(ele, index) in item.url" :key="index" mode="aspectFill" :src="ele" @click.stop="handleClickImg(item.url, index)" />
+						<img
+							v-for="(ele, index) in item.url"
+							:key="index"
+							mode="aspectFill"
+							v-if="ele.indexOf('jpg') !== -1 || ele.indexOf('png') !== -1"
+							:src="ele"
+							@click.stop="handleClickImg(ele, index)"
+						/>
+						<video
+							:id="item.id + index2"
+							class="video"
+							:show-fullscreen-btn="false"
+							:show-play-btn="false"
+							v-for="(video, index2) in item.url"
+							:key="index2"
+							v-if="video.indexOf('mp4') !== -1"
+							:src="video"
+							@fullscreenchange="fullscreenchange"
+							@click.stop="handleClickVideo(item.id + index2)"
+						></video>
 					</view>
 				</view>
 
@@ -321,7 +340,11 @@ export default {
 			// 评论总条数
 			total: null,
 			// 是否收藏
-			ischecked: false
+			ischecked: false,
+			// video 上下文 videoContext 对象
+			videoContext: null,
+			// 是否是全屏状态
+			isFullScreen: false
 		}
 	},
 	onLoad(options) {
@@ -353,23 +376,54 @@ export default {
 		}
 	},
 	methods: {
+		// 进入全屏和退出全屏时触发的回调
+		fullscreenchange(e) {
+			this.isFullScreen = e.detail.fullScreen
+		},
+		// 点击视频控件时触发的回调
+		handleClickVideo(id) {
+			this.videoContext = uni.createVideoContext(id)
+			if (this.isFullScreen) {
+				this.videoContext.stop()
+				this.videoContext.exitFullScreen()
+			} else {
+				this.videoContext.requestFullScreen()
+				this.videoContext.play()
+			}
+		},
 		// 点击收藏按钮回调
 		async changeCollect(is_collect_hotel) {
-			const res = await this.$myRequest({
-				url: is_collect_hotel ? '/mhotel/ahpdelCollectHotel.action' : '/mhotel/ahpcollectHotel.action',
-				data: {
-					userId: uni.getStorageSync('userInfo').id,
-					hotelId: this.hotelId
+			let userInfo = uni.getStorageSync('userInfo')
+			let openid = uni.getStorageSync('openid')
+
+			if (userInfo && openid) {
+				const res = await this.$myRequest({
+					url: is_collect_hotel ? '/mhotel/ahpdelCollectHotel.action' : '/mhotel/ahpcollectHotel.action',
+					data: {
+						userId: uni.getStorageSync('userInfo').id,
+						hotelId: this.hotelId
+					}
+				})
+				// console.log(res)
+				if (res.code === 200) {
+					uni.showToast({
+						title: is_collect_hotel ? '取消收藏成功' : '收藏成功',
+						icon: 'success',
+						mask: true
+					})
+					this.info.is_collect_hotel = !this.info.is_collect_hotel
 				}
-			})
-			// console.log(res)
-			if (res.code === 200) {
+			} else {
 				uni.showToast({
-					title: is_collect_hotel ? '取消收藏成功' : '收藏成功',
-					icon: 'success',
+					title: '请先登录',
+					icon: 'none',
 					mask: true
 				})
-				this.info.is_collect_hotel = !this.info.is_collect_hotel
+				setTimeout(() => {
+					uni.navigateTo({
+						url: '/pages/login/login'
+					})
+				}, 1500)
 			}
 		},
 		// 获取评论数据
@@ -612,10 +666,13 @@ export default {
 		},
 		// 点击评价图片回调
 		handleClickImg(url, index) {
+			if (this.videoContext) {
+				this.videoContext.stop()
+			}
 			// 预览图片
 			uni.previewImage({
 				current: index,
-				urls: url
+				urls: [url]
 			})
 		},
 		handleGoPage() {
@@ -1288,6 +1345,12 @@ export default {
 						height: 216rpx;
 						border-radius: 20rpx;
 					}
+
+					.video {
+						width: 216rpx;
+						height: 216rpx;
+						border-radius: 20rpx;
+					}
 				}
 			}
 

+ 146 - 37
pages/evaluate/evaluate.vue

@@ -35,8 +35,18 @@
 					<view class="msg">照片/视频</view>
 				</view>
 
-				<view class="uploading_box" v-for="(ele, index) in subImgList" :key="index">
-					<img class="img2" mode="aspectFill" :src="ele" />
+				<view class="uploading_box" v-for="(ele, index) in viewImgList" :key="index">
+					<img class="img2" mode="aspectFill" v-if="ele.fileType === 'image'" :src="ele.url" @click="handleLook(ele.url, index)" />
+					<video
+						id="myVideo"
+						class="video"
+						:show-fullscreen-btn="false"
+						:show-play-btn="false"
+						v-if="ele.fileType === 'video'"
+						:src="ele.url"
+						@fullscreenchange="fullscreenchange"
+						@click="handleClickVideo('myVideo')"
+					></video>
 					<view class="icon" @click="handleDelete(index)">
 						<img src="../../static/index/close2.png" />
 					</view>
@@ -111,6 +121,8 @@ export default {
 			textareaValuelength: 0,
 			// 上传的图片数据
 			subImgList: [],
+			// 显示的图片数据
+			viewImgList: [],
 			// 民宿位置评分
 			rateLocation: 0,
 			msgLocation: '',
@@ -128,7 +140,13 @@ export default {
 			// 民宿id
 			hotelId: '',
 			// 房间id
-			houseId: ''
+			houseId: '',
+			//画板边长默认是屏幕宽度,正方形画布
+			cw: uni.getSystemInfoSync().windowWidth,
+			// video 上下文 videoContext 对象
+			videoContext: null,
+			// 是否是全屏状态
+			isFullScreen: false
 		}
 	},
 	created() {
@@ -150,6 +168,21 @@ export default {
 		this.houseId = options.houseId
 	},
 	methods: {
+		// 进入全屏和退出全屏时触发的回调
+		fullscreenchange(e) {
+			this.isFullScreen = e.detail.fullScreen
+		},
+		// 点击视频控件时触发的回调
+		handleClickVideo(id) {
+			this.videoContext = uni.createVideoContext(id)
+			if (this.isFullScreen) {
+				this.videoContext.stop()
+				this.videoContext.exitFullScreen()
+			} else {
+				this.videoContext.requestFullScreen()
+				this.videoContext.play()
+			}
+		},
 		// 点击页面标题返回箭头回调
 		handleBack() {
 			uni.showModal({
@@ -209,7 +242,7 @@ export default {
 					mask: true
 				})
 				setTimeout(() => {
-					uni.navigateTo({
+					uni.reLaunch({
 						url: `/pages/evaluateStatus/evaluateStatus?status=1`
 					})
 				}, 1500)
@@ -229,48 +262,108 @@ export default {
 		// 上传图片回调
 		handleUpLoad() {
 			uni.chooseMedia({
-				count: 9,
-				maxDuration: 15,
+				count: 6,
+				mediaType: ['mix'],
 				success: (res) => {
-					console.log(res)
-					console.log(res.tempFiles)
-					if (this.subImgList.length + res.tempFiles.length > 9) {
+					// console.log(res)
+					// console.log(res.tempFiles)
+					// 判断文件不能超过6个
+					if (this.subImgList.length + res.tempFiles.length > 6) {
 						uni.showToast({
-							title: '最多只能上传9个图片/视频',
+							title: '最多只能上传6个图片/视频',
 							icon: 'none'
 						})
 						return
 					}
-					uni.showLoading({
-						title: '上传中'
-					})
-					// reverse()
+					// 判断视频文件不能超过1个
+					let temList = [...this.viewImgList, ...res.tempFiles]
+					let temList2 = temList.filter((ele) => ele.fileType === 'video')
+					if (temList2.length > 1) {
+						uni.showToast({
+							title: '最多只能上传1个视频',
+							icon: 'none'
+						})
+						return
+					}
+
 					res.tempFiles.forEach((ele) => {
-						uni.uploadFile({
-							url: `https://chtech.ncjti.edu.cn/hotelReservation/mhotel/mhotel/uploadhimage.action`,
-							filePath: ele.tempFilePath,
-							name: 'myFile',
-							success: (uploadFileRes) => {
-								console.log(JSON.parse(uploadFileRes.data))
-								let temRes = JSON.parse(uploadFileRes.data)
-								if (temRes.code === 200) {
-									this.subImgList.push(temRes.data.url)
-									console.log(this.subImgList)
-									uni.hideLoading()
-								} else {
-									uni.showToast({
-										title: temRes.message,
-										icon: 'none'
-									})
+						if (ele.fileType === 'image' && ele.size > 1024 * 1024 * 3) {
+							//这里的id和页面中写的html代码的canvas的id要一致
+							let canvasId = 'zipCanvas'
+							//原图的路径
+							let imagePath = ele.tempFilePath
+							//大小限制1024kb
+							let limitSize = 1024 * 3
+							//初始绘画区域是画布自身的宽度也就是屏幕宽度
+							let drawWidth = uni.getSystemInfoSync().windowWidth
+							// 图片过大压缩
+							getLessLimitSizeImage(canvasId, imagePath, limitSize, drawWidth, (resPath) => {
+								this.handleUploadMini({ tempFilePath: resPath, fileType: ele.fileType })
+							})
+						} else if (ele.fileType === 'video' && ele.size > 1024 * 1024 * 5) {
+							uni.compressVideo({
+								src: ele.tempFilePath,
+								quality: 'low',
+								// bitrate: 60000,
+								// fps: 30,
+								// resolution: 1,
+								success: (res) => {
+									// console.log('压缩后', res)
+									this.handleUploadMini({ tempFilePath: res.tempFilePath, fileType: ele.fileType })
+								},
+								fail: (err) => {
+									// console.log(err)
+									uni.showToast(
+										{
+											title: '视频压缩失败',
+											icon: 'none'
+										},
+										2000
+									)
 								}
-							},
-							fail: () => {
-								uni.showToast({
-									title: '上传失败',
-									icon: 'error'
-								})
-							}
+							})
+						} else {
+							this.handleUploadMini(ele)
+						}
+					})
+				}
+			})
+		},
+		handleUploadMini(ele) {
+			// console.log(ele)
+			// 开始上传
+			uni.showLoading({
+				title: '上传中'
+			})
+			uni.uploadFile({
+				// url: `https://chtech.ncjti.edu.cn/hotelReservation/mhotel/mhotel/uploadhimage.action`,
+				url: `https://chtech.ncjti.edu.cn/homestay/file/cos/upload`,
+				filePath: ele.tempFilePath,
+				// name: 'myFile',
+				name: 'files',
+				success: (uploadFileRes) => {
+					// console.log(JSON.parse(uploadFileRes.data))
+					let temRes = JSON.parse(uploadFileRes.data)
+					if (temRes.code === 200 || temRes.code === 1) {
+						this.subImgList.push(temRes.data)
+						// console.log(this.subImgList)
+						this.viewImgList.push({
+							url: temRes.data,
+							fileType: ele.fileType === 'image' ? 'image' : 'video'
 						})
+						// console.log(this.viewImgList)
+					} else {
+						uni.showToast({
+							title: temRes.message || '上传失败',
+							icon: 'none'
+						})
+					}
+					uni.hideLoading()
+				},
+				fail: () => {
+					uni.showToast({
+						title: '上传失败',
+						icon: 'error'
 					})
 				}
 			})
@@ -347,6 +440,16 @@ export default {
 		// 删除图片回调
 		handleDelete(index) {
 			this.subImgList.splice(index, 1)
+			this.viewImgList.splice(index, 1)
+		},
+		handleLook(url, current) {
+			if (this.videoContext) {
+				this.videoContext.stop()
+			}
+			uni.previewImage({
+				urls: [url],
+				current
+			})
 		}
 	}
 }
@@ -460,6 +563,12 @@ export default {
 					border-radius: 7rpx;
 				}
 
+				.video {
+					width: 124rpx;
+					height: 124rpx;
+					border-radius: 7rpx;
+				}
+
 				.icon {
 					position: absolute;
 					top: 0;

+ 1 - 1
pages/evaluateStatus/evaluateStatus.vue

@@ -104,7 +104,7 @@ export default {
 		// 点击按钮回调
 		handleClickBtn() {
 			if (this.status === '1') {
-				uni.navigateTo({
+				uni.reLaunch({
 					url: '/pages/myEvaluate/myEvaluate'
 				})
 			} else {

+ 20 - 1
pages/home3/home3.vue

@@ -70,7 +70,7 @@
 			</view> -->
 
 			<!-- 轮播图区域 -->
-			<swiper class="swiper" indicator-dots circular indicator-color="#BBD8FE" indicator-active-color="#1E7DFB" autoplay interval="3000">
+			<swiper class="swiper" indicator-dots circular indicator-color="#BBD8FE" indicator-active-color="#1E7DFB" autoplay interval="3000" v-if="townList.length">
 				<swiper-item v-for="(ele, index) in townList" :key="index">
 					<view class="swiper_item">
 						<view class="item_box" v-for="(swi, index2) in ele" :key="index2" @click="handleChooseTown2(swi.name)">
@@ -154,6 +154,11 @@
 						</view>
 					</view>
 				</view>
+
+				<view class="noData" v-if="!hotelList.length">
+					<img src="../../static/images/noData.png" />
+					暂无推荐数据
+				</view>
 			</view>
 		</view>
 
@@ -933,6 +938,20 @@ export default {
 					}
 				}
 			}
+
+			.noData {
+				display: flex;
+				flex-direction: column;
+				justify-content: center;
+				align-items: center;
+				padding-bottom: 65rpx;
+
+				img {
+					margin-top: 80rpx;
+					width: 600rpx;
+					height: 600rpx;
+				}
+			}
 		}
 	}
 

+ 35 - 6
pages/my/my.vue

@@ -1,7 +1,9 @@
 <template>
 	<view class="container">
 		<!-- 页面标题 -->
-		<view class="title">我的</view>
+		<view class="title" :style="{ height: customBarH * 2 + 'rpx', top: statusBarH * 2 + 'rpx' }" v-if="!headerType">我的</view>
+
+		<view class="title" :style="{ height: customBarH * 2 + 'rpx', paddingTop: statusBarH * 2 + 'rpx', backgroundColor: '#fff', color: '#000' }" v-else>我的</view>
 
 		<!-- 顶部用户信息区域 -->
 		<view class="header">
@@ -101,7 +103,32 @@ export default {
 			// 是否登录标识
 			flag: false,
 			// 用户信息
-			userInfo: {}
+			userInfo: {},
+			// 状态栏高度
+			statusBarH: 0,
+			// 胶囊按钮栏高度
+			customBarH: 0,
+			// 顶部页面标题栏显示隐藏控制
+			headerType: false
+		}
+	},
+	created() {
+		// 获取系统信息
+		uni.getSystemInfo({
+			success: (e) => {
+				// 获取状态栏高度
+				this.statusBarH = e.statusBarHeight + 10
+				// // 获取菜单按钮栏高度
+				let custom = uni.getMenuButtonBoundingClientRect()
+				this.customBarH = custom.height + 10
+			}
+		})
+	},
+	onPageScroll(e) {
+		if (e.scrollTop > 50) {
+			this.headerType = true
+		} else {
+			this.headerType = false
 		}
 	},
 	onLoad() {
@@ -214,10 +241,12 @@ export default {
 	.title {
 		z-index: 999;
 		position: fixed;
-		top: 65rpx;
-		left: 342rpx;
+		top: 0;
+		left: 0;
+		right: 0;
 		font-size: 28rpx;
 		color: #fff;
+		text-align: center;
 	}
 
 	.header {
@@ -241,7 +270,7 @@ export default {
 
 		.name {
 			position: absolute;
-			top: 178rpx;
+			top: 200rpx;
 			left: 202rpx;
 			font-size: 40rpx;
 			font-weight: bold;
@@ -249,7 +278,7 @@ export default {
 
 		.number {
 			position: absolute;
-			top: 240rpx;
+			top: 265rpx;
 			left: 202rpx;
 			font-size: 24rpx;
 			opacity: 0.5;

+ 1 - 1
pages/myComplaint/myComplaint.vue

@@ -24,7 +24,7 @@
 				<!-- 反馈时间区域 -->
 				<view class="box_time">
 					<view class="time_left">反馈时间</view>
-					<view class="time_right">{{ item.dateTime }}</view>
+					<view class="time_right">{{ item.dateTime.slice(0, 19) }}</view>
 				</view>
 			</view>
 		</view>

+ 7 - 3
pages/myCoupon/myCoupon.vue

@@ -386,7 +386,7 @@ export default {
 			flex-direction: column;
 			align-items: center;
 			width: 481rpx;
-			height: 404rpx;
+			// height: 404rpx;
 			border-radius: 22.5rpx;
 			background-color: #fff;
 
@@ -411,17 +411,21 @@ export default {
 
 			.popup_center {
 				box-sizing: border-box;
-				padding: 0 20rpx;
-				height: 135rpx;
+				padding: 0 20rpx 20rpx;
+				max-height: 400rpx;
+				line-height: 42rpx;
+				// height: 135rpx;
 				color: rgba(15, 25, 77, 0.6);
 				font-size: 28rpx;
 				font-weight: bold;
+				overflow-y: auto;
 			}
 
 			.popup_btn {
 				display: flex;
 				justify-content: center;
 				align-items: center;
+				margin-bottom: 20rpx;
 				width: 396rpx;
 				height: 76rpx;
 				color: #fff;

+ 43 - 7
pages/orderDetail/orderDetail.vue

@@ -5,7 +5,12 @@
 			<!-- 背景图片区域 -->
 			<img src="https://chtech.ncjti.edu.cn/hotelReservation/image/18.png" />
 			<!-- 标题区域 -->
-			<view class="header_title" :style="{ height: customBarH * 2 + 'rpx', paddingTop: statusBarH * 2 + 'rpx' }">订单详情</view>
+			<view class="header_title" :style="{ height: customBarH * 2 + 'rpx', paddingTop: statusBarH * 2 + 'rpx' }" v-if="!headerType">订单详情</view>
+			<view class="header_title2" :style="{ height: customBarH * 2 + 'rpx', paddingTop: statusBarH * 2 + 'rpx' }" v-else>
+				<img :style="{ paddingTop: statusBarH * 2 + 'rpx' }" src="../../static/index/left2.png" @click="handleBack" />
+				订单详情
+			</view>
+
 			<!-- 返回图标区域 -->
 			<view class="header_icon" :style="{ height: customBarH * 2 + 'rpx', paddingTop: statusBarH * 2 + 'rpx' }" @click="handleBack">
 				<img src="../../static/index/left.png" />
@@ -168,7 +173,9 @@ export default {
 			// 状态栏高度
 			statusBarH: 0,
 			// 胶囊按钮栏高度
-			customBarH: 0
+			customBarH: 0,
+			// 顶部页面标题栏显示隐藏控制
+			headerType: false
 		}
 	},
 	onLoad(options) {
@@ -176,6 +183,13 @@ export default {
 		this.distance = options.distance
 		this.getData()
 	},
+	onPageScroll(e) {
+		if (e.scrollTop > 50) {
+			this.headerType = true
+		} else {
+			this.headerType = false
+		}
+	},
 	created() {
 		// 获取系统信息
 		uni.getSystemInfo({
@@ -402,9 +416,31 @@ export default {
 		.header_title {
 			position: absolute;
 			top: 0;
-			left: 308rpx;
+			left: 0;
+			right: 0;
 			color: #fff;
 			font-size: 28rpx;
+			text-align: center;
+		}
+
+		.header_title2 {
+			z-index: 999;
+			position: fixed;
+			top: 0;
+			left: 0;
+			right: 0;
+			color: #000;
+			text-align: center;
+			font-size: 28rpx;
+			background-color: #fff;
+
+			img {
+				position: absolute;
+				top: 0;
+				left: 0;
+				width: 47rpx;
+				height: 47rpx;
+			}
 		}
 
 		.header_icon {
@@ -473,11 +509,11 @@ export default {
 		left: 0;
 		right: 0;
 		box-sizing: border-box;
-		padding: 20rpx;
-		height: calc(100vh - 430rpx);
+		padding: 20rpx 20rpx 30rpx;
+		min-height: calc(100vh - 430rpx);
 		border-radius: 20rpx 20rpx 0 0;
 		background-color: #ebeced;
-		overflow-y: auto;
+		// overflow-y: auto;
 
 		.body_box {
 			box-sizing: border-box;
@@ -706,4 +742,4 @@ export default {
 ::v-deep .uv-count-down .uv-count-down__text {
 	color: #fff;
 }
-</style>
+</style>

+ 3 - 0
pages/pay/pay.vue

@@ -60,6 +60,9 @@ export default {
 		this.id = options.id
 		this.getData()
 	},
+	onUnload() {
+		uni.$emit('choose', { data: {} })
+	},
 	methods: {
 		async getData() {
 			const res = await this.$myRequest({

+ 18 - 10
util/api.js

@@ -16,27 +16,35 @@ export const myRequest = (options) => {
 			},
 			data: options.data || {},
 			success: (res) => {
-				uni.hideLoading();
-				if (res.data.code === 200) {
-					resolve(res.data)
-				} else if (res.data.code === 205) {
+				if (res.data.code === 200 || res.data.code === 205) {
 					resolve(res.data)
 				} else {
-					uni.showToast({
-						title: res.data.message,
-						icon: "none",
-						mask: true
-					})
+
 				}
 			},
 			fail: (err) => {
-				uni.hideLoading();
 				uni.showToast({
 					title: "请求发送失败",
 					icon: "none",
 					mask: true
 				})
 				reject(err)
+			},
+			complete: (res) => {
+				uni.hideLoading({
+					complete: (hide) => {
+						// console.log(hide);
+						if (res.data.code === 200 || res.data.code === 205) {
+
+						} else {
+							uni.showToast({
+								title: res.data.message,
+								icon: "none",
+								mask: true
+							})
+						}
+					}
+				});
 			}
 		})
 	})