<template>
	<view class="eqLog">
		<view class="bg"></view>
		<view class="tophead" :style="{height: `${CustomBar}px`}">
			<view class="topheads" :style="{height: `${CustomBar}px`,paddingTop: `${StatusBar}px`}">
				<view class="eqno">
					<image @click="back" class="backs" src="@/static/images/back.png" mode=""></image>
					<view class="middle">
						设备日志
					</view>
				</view>
				<!-- 背景色 -->
				<view class="eqNo-bg"></view>
			</view>
		</view>

		<view class="eqNo">
			<view class="noInfo">
				<view class="left">
					<text style="font-weight: 500;">设备编号：{{ info.imei || '' }}</text>
					<text>录音说明：{{ info.recordExplain || '' }}</text>
				</view>
				<view class="right">
					<text>{{state(info.recording)}}</text>
				</view>
			</view>
		</view>
		<view class="eqMain">
			<view class="recordingStart">
				<view class="items">
					<text>录音开启用时</text>
					<text class="font"
						:style="{color: info.recording==1?'red':'#333'}">{{info.startActionTime || 0}}min</text>
				</view>
				<view class="line"></view>
				<view class="items">
					<text>待上传文件</text>
					<text class="font" :style="{color: info.fileCount==0?'#333':'red'}">{{info.fileCount || 0}}个</text>
				</view>
			</view>
			<view class="recording">
				<view class="left-box">
					<view class="cycle"></view>
					<view class="point"></view>
					<view class="cycle"></view>
				</view>
				<view class="recordingBox">
					<text class="recordingBoxItem-title">录音开启</text>
					<view class="recordingBoxItem">
						<text class="left">指派人：</text>
						<text class="right">{{info.owenrName}}</text>
					</view>
					<view class="recordingBoxItem">
						<text class="left">指派时间：</text>
						<text class="right">{{info.assignTime}}</text>
					</view>
					<view class="recordingBoxItem">
						<text class="left">录音开始时间：</text>
						<view class="right" style="font-weight: bold;font-size: 28rpx;">
							<text :style="{color: info.recording==1?'red':'#333'}">
								{{info.recordStartTime}}
							</text>
						</view>
					</view>
					<view class="recordingBoxItem">
						<text class="left">设备电量：</text>
						<view class="right" style="font-weight: bold;font-size: 28rpx;">
							<text :style="{color: info.electricityStart <= 20 ?'red':'#333'}">
								{{info.electricityStart || ''}}
							</text>
						</view>
					</view>
				</view>
				<view class="recordingBox" style="margin-top: 40rpx;">
					<text class="recordingBoxItem-title">录音关闭</text>
					<view class="recordingBoxItem">
						<text class="left">结束人：</text>
						<text class="right">{{info.userName || '--'}}</text>
					</view>
					<view class="recordingBoxItem">
						<text class="left">结束时间：</text>
						<text class="right">{{info.assignEndTime || '--'}}</text>
					</view>
					<view class="recordingBoxItem">
						<text class="left">录音结束时间：</text>
						<view class="right" style="font-weight: bold;font-size: 28rpx;">
							<text :style="{color: info.recording==1?'red':'#333'}">
								{{info.recordEndTime || '--'}}
							</text>
						</view>
					</view>
					
					<view class="recordingBoxItem">
						<text class="left">设备电量：</text>
						<view class="right" style="font-weight: bold;font-size: 28rpx;">
							<text :style="{color: info.electricityEnd <= 20 ?'red':'#333'}">
								{{info.electricityEnd || ''}}
							</text>
						</view>
					</view>
				</view>
			</view>
			<view class="offlineRec">
				<text style="font-size:32rpx;font-weight: 700;">离线记录</text>
				<view class="recMain">
					<block v-for="(item,index) in info.offLineList" :key="index">
						<text>{{index+1}}、 {{item}}</text>
					</block>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				info: {},
			}
		},
		computed: {
			state() {
				return (e => {
					switch (e) {
						case 0:
							return "接待中";
						case 1:
							return "部分录音";
						default:
							return "完整录音";
					}
				})
			},
		},

		onLoad(options) {
			this.$u.get("/equipment/equipmentLog", {
				id: options.id
			}).then(res => {
				// console.log(res)
				this.info = res
			})
		},
		methods: {
			back() {
				uni.navigateBack()
			}
		}
	}
</script>

<style lang="scss">
	.eqLog {
		position: relative;
		width: 100vw;
		min-height: 100vh;
		background: #F8F8F8;

		.bg {
			position: absolute;
			top: 0;
			left: 0;
			right: 0;
			z-index: 0;
			width: 100%;
			height: 420rpx;
			background: linear-gradient(180deg, #2671E2 0%, #3B9CF4 54%, #93C8F7 100%);
		}

		.tophead {
			position: sticky;
			top: 0;
			z-index: 999;
			width: 100%;

			.topheads {
				position: relative;
				z-index: 1;
				overflow: hidden;

				.eqno {
					position: relative;
					z-index: 1;
					width: 100%;
					height: 100%;
					display: flex;
					align-items: center;

					.backs {
						margin-left: 24rpx;
						width: 48rpx;
						height: 48rpx;
					}

					.middle {
						position: absolute;
						left: 50%;
						top: 50%;
						transform: translate(-50%, -50%);
						font-size: 32rpx;
						color: #fff;
					}
				}

				.eqNo-bg {
					position: absolute;
					top: 0;
					left: 0;
					right: 0;
					z-index: 0;
					width: 100%;
					height: 420rpx;
					background: linear-gradient(180deg, #2671E2 0%, #3B9CF4 54%, #93C8F7 100%);
				}
			}
		}


		.eqNo {
			position: relative;
			z-index: 1;
			width: 100%;

			.noInfo {
				margin: 24rpx auto 0;
				padding: 24rpx;
				width: 690rpx;
				min-height: 152rpx;
				background: #FFFFFF;
				border-radius: 8rpx;
				display: flex;
				justify-content: space-between;

				.left {
					display: flex;
					flex-direction: column;
					justify-content: space-between;
					font-size: 32rpx;
					font-weight: 400;
				}

				.right {
					flex-shrink: 0;
					font-size: 32rpx;
					font-weight: 400;
				}
			}
		}

		.eqMain {
			position: relative;
			z-index: 1;
			padding: 0 30rpx;

			.recordingStart {
				margin-top: 20rpx;
				width: 100%;
				height: 164rpx;
				display: flex;
				align-items: center;
				border-radius: 8rpx;
				background: #FFFFFF;

				.items {
					flex-grow: 1;
					display: flex;
					flex-direction: column;
					align-items: center;
					justify-content: center;
					color: #1C1010;
					font-size: 30rpx;

					.font {
						margin-top: 20rpx;
						font-weight: 700;
					}
				}

				.line {
					width: 1rpx;
					height: 88rpx;
					background: #E0E0E0;
				}
			}

			.recording {
				position: relative;
				z-index: 1;
				margin-top: 20rpx;
				padding: 30rpx 30rpx 30rpx 68rpx;
				display: flex;
				flex-direction: column;
				background: #FFFFFF;
				border-radius: 8rpx;

				.left-box {
					position: absolute;
					left: 30rpx;
					top: 40rpx;
					width: 24rpx;
					height: 300rpx;
					display: flex;
					flex-direction: column;
					align-items: center;

					.cycle {
						width: 24rpx;
						height: 24rpx;
						flex-shrink: 0;
						border-radius: 50%;
						border: 4rpx solid #2671E2;
					}


					.point {
						flex-grow: 1;
						border-left: 5rpx dotted #2671E2;
					}


				}

				.recordingBox {
					width: 100%;
					display: flex;
					flex-direction: column;

					.recordingBoxItem-title {
						font-size: 32rpx;
						font-weight: 700;
					}

					.recordingBoxItem {
						margin-top: 24rpx;
						display: flex;

						.left {
							flex-shrink: 0;
							width: 210rpx;
							color: #505050;
							font-size: 30rpx;
						}

						.right {
							flex-grow: 1;
							font-size: 30rpx !important;
							overflow: hidden;
							text-overflow: ellipsis;
							white-space: nowrap;
						}
					}
				}
			}

			.offlineRec {
				margin-top: 20rpx;
				padding: 28rpx 24rpx;
				border-radius: 8rpx;
				background: #FFFFFF;

				.recMain {
					display: flex;
					flex-direction: column;

					text {
						margin: 24rpx 0;
						font-size: 30rpx;
					}
				}
			}
		}
	}
</style>
