Browse Source

优化图片显示方式和首页打卡提示语

xiaoxin 2 years ago
parent
commit
2010b369c3

+ 16 - 13
pagesClockIn/cardRecord/cardRecord.vue

@@ -29,7 +29,9 @@
 			<view class="box" v-for="(item, index) in list" :key="index">
 				<!-- 人物信息区域 -->
 				<view class="person">
-					<view class="img"><img :src="item.headImage || '../static/imgs/headImage.png'" /></view>
+					<view class="img">
+						<img mode="aspectFill" :src="item.headImage || '../static/imgs/headImage.png'" />
+					</view>
 					<view class="info">
 						<view class="name">{{ item.name }}</view>
 						<view class="college">{{ item.college ? item.college : '南昌交通学院' }}</view>
@@ -38,17 +40,23 @@
 				<!-- 图片区域 -->
 				<view class="imgs" v-if="item.status == 4">
 					<view class="imgs_item" v-if="item.faceImage">
-						<view class="image" @click="handleBigImg(item.faceImage)"><img :src="item.faceImage" /></view>
+						<view class="image" @click="handleBigImg(item.faceImage)">
+							<img mode="aspectFill" :src="item.faceImage" />
+						</view>
 						<view class="title">匹对照片</view>
 					</view>
 
 					<view class="imgs_item" v-if="item.matchFaceImage">
-						<view class="image" @click="handleBigImg(item.matchFaceImage)"><img :src="item.matchFaceImage" /></view>
+						<view class="image" @click="handleBigImg(item.matchFaceImage)">
+							<img mode="aspectFill" :src="item.matchFaceImage" />
+						</view>
 						<view class="title">被匹对照片</view>
 					</view>
 
 					<view class="imgs_item" v-if="item.sceneImage">
-						<view class="image" @click="handleBigImg(item.sceneImage)"><img :src="item.sceneImage" /></view>
+						<view class="image" @click="handleBigImg(item.sceneImage)">
+							<img mode="aspectFill" :src="item.sceneImage" />
+						</view>
 						<view class="title">场景照片</view>
 					</view>
 				</view>
@@ -79,11 +87,6 @@
 			<img src="../static/imgs/nodata.png" />
 			<view class="info">暂无数据</view>
 		</view>
-
-		<!-- 图片放大弹窗区域 -->
-		<uni-popup ref="popup">
-			<view class="popup_img"><img :src="popupImg" mode="aspectFit" /></view>
-		</uni-popup>
 	</view>
 </template>
 
@@ -111,8 +114,6 @@ export default {
 			current: 0,
 			// 列表数组
 			list: [],
-			// 弹窗图片路径
-			popupImg: '',
 			// 当前年份(不会修改的值,用来对比年份)
 			currentYear: ''
 		}
@@ -172,8 +173,10 @@ export default {
 
 		// 点击放大图片
 		handleBigImg(url) {
-			this.popupImg = url
-			this.$refs.popup.open()
+			uni.previewImage({
+				urls: [url],
+				current: 1
+			})
 		},
 
 		// 点击分段器回调

+ 11 - 4
pagesClockIn/home/home.vue

@@ -360,8 +360,7 @@ export default {
 							let R = 6378137
 							let distance = R * 2 * Math.asin(Math.sqrt(Math.pow(Math.sin(a / 2), 2) + Math.cos(red1) * Math.cos(red2) * Math.pow(Math.sin(b / 2), 2)))
 							this.distance = distance.toFixed(2) * 1
-							// console.log(this.distance);
-							// console.log(this.radius);
+
 							if (this.distance <= this.radius) {
 								return 1
 							} else {
@@ -371,7 +370,7 @@ export default {
 						let temFlag = temList.indexOf(1)
 						if (temFlag == -1) {
 							this.flags = false
-							this.notes = '不在管理员设定范围内,无法打卡'
+							this.notes = `不在管理员设定范围内,无法打卡,距离打卡点${this.distance}米,管理员设定的范围为${this.radius}米`
 						} else {
 							this.flags = true
 						}
@@ -573,7 +572,11 @@ export default {
 					padding-left: 30rpx;
 
 					.title {
+						line-height: 30rpx;
 						font-size: 28rpx;
+						overflow: hidden;
+						white-space: nowrap;
+						text-overflow: ellipsis;
 					}
 
 					.time {
@@ -611,7 +614,11 @@ export default {
 					padding-left: 30rpx;
 
 					.title {
+						line-height: 30rpx;
 						font-size: 28rpx;
+						overflow: hidden;
+						white-space: nowrap;
+						text-overflow: ellipsis;
 					}
 
 					.time {
@@ -687,8 +694,8 @@ export default {
 		}
 
 		.address {
+			padding: 0 10rpx;
 			margin-top: 34rpx;
-			height: 35rpx;
 			line-height: 35rpx;
 			text-align: center;
 			font-size: 24rpx;

+ 168 - 175
pagesClockIn/rulesDetail/rulesDetail.vue

@@ -2,240 +2,233 @@
 	<view class="container">
 		<!-- 顶部搜索框区域 -->
 		<view class="search">
-			<uni-search-bar bgColor="#fff" placeholder="请输入名字或院系" cancelButton="none" v-model="searchValue"
-				@input="input">
-			</uni-search-bar>
+			<uni-search-bar bgColor="#fff" placeholder="请输入名字或院系" cancelButton="none" v-model="searchValue" @input="input"></uni-search-bar>
 		</view>
 
 		<view class="list">
 			<!-- 分段器区域 -->
 			<view class="control">
-				<uni-segmented-control :current="current" :values="items" styleType="text" @clickItem="onClickItem"
-					activeColor="#0082FC"></uni-segmented-control>
+				<uni-segmented-control :current="current" :values="items" styleType="text" @clickItem="onClickItem" activeColor="#0082FC"></uni-segmented-control>
 			</view>
 			<!-- 列表区域 -->
 			<view class="listbox" v-if="list.length">
 				<!-- 每一个盒子区域 -->
 				<view class="item" v-for="item in list" :key="item.id" @click="handleGoStatDetail(item.userId)">
 					<view class="left">
-						<img :src="item.headImage||'../static/imgs/headImage.png'">
+						<img mode="aspectFill" :src="item.headImage || '../static/imgs/headImage.png'" />
 					</view>
 					<view class="center">
 						<view class="name">
-							{{item.name}}
+							{{ item.name }}
 						</view>
 						<view class="college">
-							{{item.college?item.college:"南昌交通学院"}}
+							{{ item.college ? item.college : '南昌交通学院' }}
 						</view>
 					</view>
 					<view class="right">
-						{{item.status==4?"正常":"缺卡"}}
+						{{ item.status == 4 ? '正常' : '缺卡' }}
 					</view>
 				</view>
 			</view>
 
 			<view class="listbox2" v-else>
-				<img src="../static/imgs/nodata.png">
-				<view class="info">
-					暂无数据
-				</view>
+				<img src="../static/imgs/nodata.png" />
+				<view class="info">暂无数据</view>
 			</view>
-
 		</view>
-
 	</view>
 </template>
 
 <script>
-	export default {
-		data() {
-			return {
-				// 总人数
-				peopleTotal: 0,
-				// 打卡失败人数
-				failCount: 0,
-				// 打卡成功人数
-				successCount: 0,
-				// 搜索框绑定值
-				searchValue: "",
-				// 分段器绑定数组
-				items: ['打卡成功', '打卡失败'],
-				// 当前分段器所在的索引
-				current: 0,
-				// 列表数组
-				list: [],
-				// 规则ID
-				taskId: "",
-				// 打卡状态 3代表失败 4代表成功
-				status: 4,
-				// 当前页
-				page: 1,
-				// 列表总条数
-				total: 0
-			}
-		},
-		onLoad(options) {
-			let info = JSON.parse(options.info)
-			// console.log(info);
-			this.peopleTotal = info.peopleTotal
-			this.failCount = info.failCount
-			this.successCount = info.peopleTotal - info.failCount
-			this.items[0] = `打卡成功(${this.successCount}/${this.peopleTotal}人)`
-			this.items[1] = `打卡失败(${this.failCount}/${this.peopleTotal}人)`
-			this.taskId = info.taskId
+export default {
+	data() {
+		return {
+			// 总人数
+			peopleTotal: 0,
+			// 打卡失败人数
+			failCount: 0,
+			// 打卡成功人数
+			successCount: 0,
+			// 搜索框绑定值
+			searchValue: '',
+			// 分段器绑定数组
+			items: ['打卡成功', '打卡失败'],
+			// 当前分段器所在的索引
+			current: 0,
+			// 列表数组
+			list: [],
+			// 规则ID
+			taskId: '',
+			// 打卡状态 3代表失败 4代表成功
+			status: 4,
+			// 当前页
+			page: 1,
+			// 列表总条数
+			total: 0
+		}
+	},
+	onLoad(options) {
+		let info = JSON.parse(options.info)
+		// console.log(info);
+		this.peopleTotal = info.peopleTotal
+		this.failCount = info.failCount
+		this.successCount = info.peopleTotal - info.failCount
+		this.items[0] = `打卡成功(${this.successCount}/${this.peopleTotal}人)`
+		this.items[1] = `打卡失败(${this.failCount}/${this.peopleTotal}人)`
+		this.taskId = info.taskId
+		this.getData()
+	},
+	onReachBottom() {
+		if (this.list.length < this.total) {
+			this.page++
 			this.getData()
+		} else {
+			uni.showToast({
+				title: '没有更多数据了',
+				icon: 'none'
+			})
+		}
+	},
+	methods: {
+		handleGoStatDetail(id) {
+			// console.log(id);
+			uni.navigateTo({
+				url: `/pagesClockIn/statDetail/statDetail?id=${id}`
+			})
+		},
+		// 获取列表数据
+		async getData() {
+			let res = await this.$myRequest_clockIn({
+				url: '/attendance/api/sign/check/in/rule',
+				data: {
+					name: this.searchValue,
+					page: this.page,
+					status: this.status,
+					taskId: this.taskId
+				}
+			})
+			// console.log(res);
+			if (res.code == 200) {
+				this.total = res.data.total
+				this.list = [...this.list, ...res.data.list]
+			}
 		},
-		onReachBottom() {
-			if (this.list.length < this.total) {
-				this.page++
-				this.getData()
+		// 点击分段器回调
+		onClickItem(e) {
+			// console.log(e.currentIndex);
+			this.list = []
+			this.page = 1
+			if (e.currentIndex == 0) {
+				this.status = 4
 			} else {
-				uni.showToast({
-					title: "没有更多数据了",
-					icon: 'none'
-				})
+				this.status = 3
 			}
+			this.getData()
 		},
-		methods: {
-			handleGoStatDetail(id) {
-				// console.log(id);
-				uni.navigateTo({
-					url: `/pagesClockIn/statDetail/statDetail?id=${id}`
-				})
-			},
-			// 获取列表数据
-			async getData() {
-				let res = await this.$myRequest_clockIn({
-					url: "/attendance/api/sign/check/in/rule",
-					data: {
-						name: this.searchValue,
-						page: this.page,
-						status: this.status,
-						taskId: this.taskId
-					}
-				})
-				// console.log(res);
-				if (res.code == 200) {
-					this.total = res.data.total
-					this.list = [...this.list, ...res.data.list]
-				}
-			},
-			// 点击分段器回调
-			onClickItem(e) {
-				// console.log(e.currentIndex);
-				this.list = []
-				this.page = 1
-				if (e.currentIndex == 0) {
-					this.status = 4
-				} else {
-					this.status = 3
-				}
-				this.getData()
-			},
-			// 搜索框输入时的回调
-			input() {
-				this.list = []
-				this.page = 1
-				this.getData()
-			},
+		// 搜索框输入时的回调
+		input() {
+			this.list = []
+			this.page = 1
+			this.getData()
 		}
 	}
+}
 </script>
 
 <style lang="scss" scoped>
-	.container {
-		padding-top: 20rpx;
-		background-color: #F2F2F2;
+.container {
+	padding-top: 20rpx;
+	height: 100vh;
+	background-color: #f2f2f2;
+
+	.search {
+		width: 750rpx;
+		height: 90rpx;
+		border-radius: 171rpx;
+		background-color: #fff;
+	}
 
-		.search {
-			width: 750rpx;
-			height: 90rpx;
-			border-radius: 171rpx;
-			background-color: #fff;
-		}
+	.list {
+		margin-top: 20rpx;
+		width: 750rpx;
+		background-color: #fff;
 
-		.list {
-			margin-top: 20rpx;
+		.control {
+			display: flex;
+			flex-direction: column;
+			justify-content: center;
 			width: 750rpx;
-			min-height: 85vh;
-			background-color: #fff;
+			height: 102rpx;
+		}
 
-			.control {
+		.listbox {
+			.item {
 				display: flex;
-				flex-direction: column;
-				justify-content: center;
-				width: 750rpx;
-				height: 102rpx;
-			}
-
-			.listbox {
-				.item {
+				align-items: center;
+				margin: 0 30rpx;
+				height: 114rpx;
+				border-bottom: 1rpx solid #e5e5e5;
+				background-color: #fff;
+
+				.left {
+					flex: 1;
 					display: flex;
+					justify-content: center;
 					align-items: center;
-					margin: 0 30rpx;
-					height: 114rpx;
-					border-bottom: 1rpx solid #E5E5E5;
-					background-color: #fff;
-
-					.left {
-						flex: 1;
-						display: flex;
-						justify-content: center;
-						align-items: center;
-
-						img {
-							width: 70rpx;
-							height: 70rpx;
-							border-radius: 35rpx;
-						}
-					}
 
-					.center {
-						flex: 5;
-						display: flex;
-						flex-direction: column;
-						justify-content: space-evenly;
-						margin-left: 10rpx;
-						height: 90rpx;
-
-						.name {
-							font-size: 28rpx;
-						}
-
-						.college {
-							font-size: 24rpx;
-							color: #808080;
-						}
+					img {
+						width: 70rpx;
+						height: 70rpx;
+						border-radius: 35rpx;
 					}
+				}
 
-					.right {
-						flex: 1;
-						display: flex;
-						justify-content: center;
-						align-items: center;
+				.center {
+					flex: 5;
+					display: flex;
+					flex-direction: column;
+					justify-content: space-evenly;
+					margin-left: 10rpx;
+					height: 90rpx;
+
+					.name {
 						font-size: 28rpx;
 					}
+
+					.college {
+						font-size: 24rpx;
+						color: #808080;
+					}
+				}
+
+				.right {
+					flex: 1;
+					display: flex;
+					justify-content: center;
+					align-items: center;
+					font-size: 28rpx;
 				}
 			}
+		}
 
-			.listbox2 {
-				margin-top: 230rpx;
-				text-align: center;
+		.listbox2 {
+			margin-top: 230rpx;
+			text-align: center;
 
-				img {
-					width: 480rpx;
-					height: 508rpx;
-				}
+			img {
+				width: 480rpx;
+				height: 508rpx;
+			}
 
-				.info {
-					color: #5792F0;
-				}
+			.info {
+				color: #5792f0;
 			}
 		}
 	}
+}
 
-	// 解决输入框不居中问题
-	::v-deep .uni-searchbar {
-		padding: 10rpx;
-	}
+// 解决输入框不居中问题
+::v-deep .uni-searchbar {
+	padding: 10rpx;
+}
 </style>

+ 4 - 2
pagesClockIn/stat/stat.vue

@@ -87,7 +87,9 @@
 
 				<view class="e_list" v-if="errList.length">
 					<view class="e_box" v-for="item in errList" :key="item.userId">
-						<view class="e_img"><img :src="item.headImage || '../static/imgs/headImage.png'" /></view>
+						<view class="e_img">
+							<img mode="aspectFill" :src="item.headImage || '../static/imgs/headImage.png'" />
+						</view>
 						<view class="e_name">{{ item.name }}</view>
 						<view class="e_msg">未打卡{{ item.times }}次</view>
 					</view>
@@ -399,7 +401,7 @@ export default {
 				uni.showModal({
 					title: '提示',
 					content: `当前列表中有 ${this.total} 位异常人员,确定需要全部通知吗?`,
-					success: async res => {
+					success: async (res) => {
 						if (res.confirm) {
 							let data = JSON.stringify(this.nowTime)
 							let res = await this.$myRequest_clockIn({

+ 16 - 13
pagesClockIn/statDetail/statDetail.vue

@@ -29,7 +29,9 @@
 			<view class="box" v-for="(item, index) in list" :key="index">
 				<!-- 人物信息区域 -->
 				<view class="person">
-					<view class="img"><img :src="item.headImage || '../static/imgs/headImage.png'" /></view>
+					<view class="img">
+						<img mode="aspectFill" :src="item.headImage || '../static/imgs/headImage.png'" />
+					</view>
 					<view class="info">
 						<view class="name">{{ item.name }}</view>
 						<view class="college">{{ item.college ? item.college : '南昌交通学院' }}</view>
@@ -38,17 +40,23 @@
 				<!-- 图片区域 -->
 				<view class="imgs" v-if="item.status == 4">
 					<view class="imgs_item" v-if="item.faceImage">
-						<view class="image" @click="handleBigImg(item.faceImage)"><img :src="item.faceImage" /></view>
+						<view class="image" @click="handleBigImg(item.faceImage)">
+							<img mode="aspectFill" :src="item.faceImage" />
+						</view>
 						<view class="title">匹对照片</view>
 					</view>
 
 					<view class="imgs_item" v-if="item.matchFaceImage">
-						<view class="image" @click="handleBigImg(item.matchFaceImage)"><img :src="item.matchFaceImage" /></view>
+						<view class="image" @click="handleBigImg(item.matchFaceImage)">
+							<img mode="aspectFill" :src="item.matchFaceImage" />
+						</view>
 						<view class="title">被匹对照片</view>
 					</view>
 
 					<view class="imgs_item" v-if="item.sceneImage">
-						<view class="image" @click="handleBigImg(item.sceneImage)"><img :src="item.sceneImage" /></view>
+						<view class="image" @click="handleBigImg(item.sceneImage)">
+							<img mode="aspectFill" :src="item.sceneImage" />
+						</view>
 						<view class="title">场景照片</view>
 					</view>
 				</view>
@@ -79,11 +87,6 @@
 			<img src="../static/imgs/nodata.png" />
 			<view class="info">暂无数据</view>
 		</view>
-
-		<!-- 图片放大弹窗区域 -->
-		<uni-popup ref="popup">
-			<view class="popup_img"><img :src="popupImg" mode="aspectFit" /></view>
-		</uni-popup>
 	</view>
 </template>
 
@@ -109,8 +112,6 @@ export default {
 			time: null,
 			// 列表数组
 			list: [],
-			// 弹窗图片路径
-			popupImg: '',
 			peopleId: ''
 		}
 	},
@@ -153,8 +154,10 @@ export default {
 
 		// 点击放大图片
 		handleBigImg(url) {
-			this.popupImg = url
-			this.$refs.popup.open()
+			uni.previewImage({
+				urls: [url],
+				current: 1
+			})
 		},
 
 		// 获取打卡记录列表数组