<template>
	<view class="max-w-4xl mx-auto p-6 relative">
		<!-- 页面标题 -->
		<view class="bg-[#1d1e3a] text-white p-4 rounded-t-lg">
			<view class="flex justify-between items-center">
				<view class="text-sm">No.{{ candidateInfo.idNumber }}</view>
				<view class="text-sm">2025-03-07 14:42:14</view>
			</view>
		</view>

		<view class="bg-white rounded-b-lg shadow-lg p-6">
			<!-- 头部信息 -->
			<view class="flex justify-between items-center mb-8 pb-4 border-b">
				<view class="flex items-center space-x-4">
					<view class="w-20 h-20 bg-gray-200 rounded-lg overflow-hidden">
						<image :src="candidateInfo.additionalInfo.faceVerification.images[0]" mode="aspectFill" class="w-full h-full"></image>
					</view>
					<view>
						<text class="text-2xl font-bold">{{ candidateInfo.name }}</text>
						<text class="text-gray-600 block">{{ candidateInfo.phoneNumber }}</text>
					</view>
				</view>
				<view class="text-right">
					<view class="text-4xl font-bold text-yellow-500">{{ candidateInfo.score }}<text class="text-base ml-1">分</text></view>
					<view class="text-sm text-yellow-500">推荐 👍</view>
				</view>
			</view>

			<!-- 基本信息 -->
			<view class="grid grid-cols-1 gap-4 mb-8">
				<view>
					<text class="text-gray-600 block">身份证号</text>
					<text>{{ candidateInfo.idNumber }}</text>
				</view>
				<view>
					<text class="text-gray-600 block">入职之后，您缺岗的班次时间段是？</text>
					<text>{{ candidateInfo.availabilityPeriod }}</text>
				</view>
				<view>
					<text class="text-gray-600 block">请问您通过面试之后多久可以入职？</text>
					<text>{{ candidateInfo.onboardingTime }}</text>
				</view>
			</view>

			<!-- AI维度分析 -->
			<view class="mb-8">
				<text class="text-xl font-bold mb-6 block">1. AI维度分析</text>
				<view class="space-y-6">
					<view v-for="(value, key) in candidateInfo.dimensions" :key="key" class="border-b pb-4">
						<view class="flex items-center mb-2">
							<text class="text-gray-600 w-32">{{ dimensionLabels[key] }}</text>
							<text class="ml-4" :class="{
								'text-red-500': value === '欠佳',
								'text-green-500': value === '优秀',
								'text-yellow-500': value === '中等'
							}">{{ value }}</text>
						</view>
						<text class="text-gray-600 text-sm block">{{ candidateInfo.dimensionDetails[key] }}</text>
					</view>
				</view>
			</view>

			<!-- DUV分析评估 -->
			<view class="mb-8">
				<text class="text-xl font-bold mb-6 block">2. DUV分析评估</text>
				<view class="space-y-4">
					<view v-for="(item, index) in candidateInfo.duvAnalysis" :key="index" class="border-b pb-4">
						<view class="flex items-center justify-between mb-2">
							<text class="text-gray-600">{{ item.title }}</text>
							<text :class="{
								'text-green-500': item.type === 'positive',
								'text-red-500': item.type === 'negative',
								'text-yellow-500': item.type === 'neutral'
							}">{{ item.score }}</text>
						</view>
						<text class="text-gray-600 text-sm block">{{ item.content }}</text>
					</view>
				</view>
			</view>

			<!-- 面试记录 -->
			<view class="mb-8">
				<text class="text-xl font-bold mb-6 block">3. 面试记录</text>
				<view class="space-y-6">
					<view v-for="(record, index) in candidateInfo.interviewRecord" :key="index" class="border-b pb-4">
						<view class="mb-2">
							<text class="font-semibold block">问题：{{ record.question }}</text>
							<text class="text-gray-600 mt-2 block">答案：{{ record.answer }}</text>
							<text class="text-gray-500 mt-2 text-sm block">分析：{{ record.analysis }}</text>
							
							<!-- 视频回放 -->
							<view v-if="record.videoUrl" class="mt-4">
								<view class="video-container">
									<video
										class="w-full h-full"
										:src="record.videoUrl"
										:poster="record.thumbnail"
										controls
									></video>
								</view>
							</view>
							
							<view class="mt-2 flex justify-end">
								<text class="text-blue-500">得分：{{ record.score }}</text>
							</view>
						</view>
					</view>
				</view>
			</view>

			<!-- 视频记录 -->
			<view class="mb-8">
				<text class="text-xl font-bold mb-6 block">4. 视频记录</text>
				<view class="space-y-8">
					<view v-for="(category, index) in candidateInfo.videoRecords" :key="index">
						<text class="text-lg font-semibold mb-4 block">{{ category.category }}</text>
						<view class="grid grid-cols-1 gap-4">
							<view v-for="(video, vIndex) in category.videos" :key="vIndex" class="bg-gray-50 rounded-lg p-4">
								<view class="video-container">
									<video
										class="w-full h-full"
										:src="video.url"
										:poster="video.thumbnail"
										controls
									></video>
								</view>
								<text class="text-sm text-gray-600 mt-2 block">{{ video.description }}</text>
							</view>
						</view>
					</view>
				</view>
			</view>

			<!-- 其他信息 -->
			<view class="mb-8">
				<text class="text-xl font-bold mb-6 block">5. 其他信息</text>
				<view class="space-y-6">
					<!-- 验证状态 -->
					<view class="grid grid-cols-1 gap-4 mb-4">
						<view class="flex items-center space-x-2">
							<text class="text-gray-600">身份证验证:</text>
							<text class="text-green-500">{{ candidateInfo.additionalInfo.idVerification }}</text>
						</view>
						<view class="flex items-center space-x-2">
							<text class="text-gray-600">手机号验证:</text>
							<text class="text-green-500">{{ candidateInfo.additionalInfo.phoneVerification }}</text>
						</view>
					</view>

					<!-- 手势验证 -->
					<view class="mb-6">
						<text class="font-semibold mb-4 block">手势验证</text>
						<view class="grid grid-cols-2 gap-8">
							<!-- 左手手势 -->
							<view>
								<text class="text-sm font-medium mb-2 block">左手手势验证</text>
								<view class="grid grid-cols-3 gap-2">
									<view v-for="(image, index) in candidateInfo.additionalInfo.leftHandGestures.images" :key="index"
										class="aspect-square rounded-lg overflow-hidden bg-gray-100">
										<image :src="image" mode="aspectFill" class="w-full h-full"></image>
									</view>
								</view>
							</view>
							<!-- 右手手势 -->
							<view>
								<text class="text-sm font-medium mb-2 block">右手手势验证</text>
								<view class="grid grid-cols-3 gap-2">
									<view v-for="(image, index) in candidateInfo.additionalInfo.rightHandGestures.images" :key="index"
										class="aspect-square rounded-lg overflow-hidden bg-gray-100">
										<image :src="image" mode="aspectFill" class="w-full h-full"></image>
									</view>
								</view>
							</view>
						</view>
					</view>

					<!-- 人脸验证 -->
					<view>
						<text class="font-semibold mb-4 block">人脸验证</text>
						<view class="grid grid-cols-3 gap-2">
							<view v-for="(image, index) in candidateInfo.additionalInfo.faceVerification.images" :key="index"
								class="aspect-square rounded-lg overflow-hidden bg-gray-100">
								<image :src="image" mode="aspectFill" class="w-full h-full"></image>
							</view>
						</view>
					</view>
				</view>
			</view>

			<!-- 评估表单 -->
			<view>
				<!-- 评分 -->
				<view class="mb-8">
					<text class="text-xl font-bold mb-4 block">6. 面试评分</text>
					<view class="form-item">
						<text class="block mb-2">请为候选人打分</text>
						<uni-rate v-model="evaluationScore" :max="5" allow-half />
					</view>
				</view>

				<!-- 评价 -->
				<view class="mb-8">
					<text class="text-xl font-bold mb-4 block">评价意见</text>
					<view class="form-item">
						<text class="block mb-2">请输入评价意见</text>
						<textarea
							v-model="evaluationComments"
							class="w-full border p-2 rounded"
							placeholder="请输入您的评价意见..."
							:rows="4"
						></textarea>
					</view>
				</view>

				<!-- 提交按钮 -->
				<view class="flex justify-end">
					<button 
						class="bg-blue-500 text-white px-4 py-2 rounded"
						@click="handleSubmit"
					>提交评估</button>
				</view>
			</view>
		</view>

		<!-- 悬浮按钮 -->
		<!-- <view class="fixed-buttons">
			<button class="action-button share-button" @click="handleShare">
				<text class="iconfont">&#xe600;</text>
			</button>
			<button class="action-button download-button" @click="handleDownload">
				<text class="iconfont">&#xe601;</text>
			</button>
			<button class="action-button top-button" @click="scrollToTop">
				<text class="iconfont">&#xe602;</text>
			</button>
		</view> -->
	</view>
</template>

<script>
	export default {
		data() {
			return {
				candidateInfo: {
					name: '孙壁涵',
					idNumber: '152201199809150015',
					phoneNumber: '19943770171',
					score: 71,
					availabilityPeriod: '全天任意时间段',
					onboardingTime: '1周内',
					dimensions: {
						teamwork: '欠佳',
						learningAbility: '优秀',
						attention: '欠佳',
						workAdaptability: '优秀',
						serviceAwareness: '中等'
					},
					dimensionDetails: {
						teamwork: '主动交流但缺乏倾听与尊重。',
						learningAbility: '积极向上，具备优秀的学习意愿。',
						attention: '对细节处理不够严谨，需提高标准意识。',
						workAdaptability: '快速适应，表现出强烈的责任心。',
						serviceAwareness: '关注客户需求，但缺乏提升顾客体验的具体措施。'
					},
					duvAnalysis: [
						{
							title: '工作经验',
							content: '有相关工作经验，能够胜任岗位要求',
							score: '优秀',
							type: 'positive'
						},
						{
							title: '学历背景',
							content: '学历符合岗位要求',
							score: '良好',
							type: 'positive'
						}
					],
					interviewRecord: [
						{
							question: '请问您对餐饮服务工作有什么理解？',
							answer: '餐饮服务工作需要具备良好的服务意识和沟通能力，要以客户满意为目标，及时响应客户需求，保持微笑和耐心。同时要注意个人卫生和仪容仪表，遵守餐饮服务规范。',
							analysis: '答案表现出对岗位的基本理解，但缺乏深入思考',
							score: '中等',
							videoUrl: 'https://interactive-examples.mdn.mozilla.net/media/cc0-videos/flower.mp4',
							thumbnail: '/images/video-placeholder.jpg'
						},
						{
							question: '您如何处理顾客投诉？',
							answer: '首先我会认真倾听顾客的意见，表示理解和歉意。然后了解具体情况，及时向主管报告，并根据公司规定提供合适的解决方案。最后会总结经验，避免类似问题再次发生。',
							analysis: '回答显示了基本的服务意识，但处理方法较为简单',
							score: '良好',
							videoUrl: 'https://interactive-examples.mdn.mozilla.net/media/cc0-videos/flower.mp4',
							thumbnail: '/images/video-placeholder.jpg'
						}
					],
					videoRecords: [
						{
							category: '服务态度测评',
							videos: [
								{
									url: 'https://interactive-examples.mdn.mozilla.net/media/cc0-videos/flower.mp4',
									thumbnail: '/images/thumbnail1.jpg',
									description: '微笑服务示范'
								},
								{
									url: 'https://interactive-examples.mdn.mozilla.net/media/cc0-videos/flower.mp4',
									thumbnail: '/images/thumbnail2.jpg',
									description: '礼貌用语展示'
								}
							]
						}
					],
					additionalInfo: {
						idVerification: '通过',
						phoneVerification: '通过',
						leftHandGestures: {
							passed: true,
							images: [
								'/images/left-hand-1.jpg',
								'/images/left-hand-2.jpg',
								'/images/left-hand-3.jpg'
							]
						},
						rightHandGestures: {
							passed: true,
							images: [
								'/images/right-hand-1.jpg',
								'/images/right-hand-2.jpg',
								'/images/right-hand-3.jpg'
							]
						},
						faceVerification: {
							passed: true,
							images: [
								'/images/face-1.jpg',
								'/images/face-2.jpg',
								'/images/face-3.jpg',
								'/images/face-4.jpg',
								'/images/face-5.jpg',
								'/images/face-6.jpg'
							]
						}
					}
				},
				evaluationScore: 0,
				evaluationComments: '',
				dimensionLabels: {
					teamwork: '团队合作能力',
					learningAbility: '学习能力',
					attention: '细致严谨',
					workAdaptability: '工作适应性',
					serviceAwareness: '服务意识'
				}
			}
		},
		methods: {
			handleSubmit() {
				if (this.evaluationScore === 0 || !this.evaluationComments.trim()) {
					uni.showToast({
						title: '请完成所有必填项',
						icon: 'none'
					});
					return;
				}
				
				uni.showToast({
					title: '评估已提交',
					icon: 'success'
				});
			},
			
			scrollToTop() {
				uni.pageScrollTo({
					scrollTop: 0,
					duration: 300
				});
			},
			
			handleShare() {
				uni.showToast({
					title: '分享链接已复制',
					icon: 'success'
				});
			},
			
			handleDownload() {
				uni.showToast({
					title: '报告下载中...',
					icon: 'loading'
				});
			}
		}
	}
</script>

<style>
.max-w-4xl {
	max-width: 56rem;
	margin: 0 auto;
}

.p-6 {
	padding: 1.5rem;
}

.relative {
	position: relative;
}

/* .bg-\[\#1d1e3a\] {
	background-color: #1d1e3a;
} */

.text-white {
	color: white;
}

.p-4 {
	padding: 1rem;
}

.rounded-t-lg {
	border-top-left-radius: 0.5rem;
	border-top-right-radius: 0.5rem;
}

.flex {
	display: flex;
}

.justify-between {
	justify-content: space-between;
}

.items-center {
	align-items: center;
}

.text-sm {
	font-size: 0.875rem;
}

.bg-white {
	background-color: white;
}

.rounded-b-lg {
	border-bottom-left-radius: 0.5rem;
	border-bottom-right-radius: 0.5rem;
}

.shadow-lg {
	box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

.mb-8 {
	margin-bottom: 2rem;
}

.pb-4 {
	padding-bottom: 1rem;
}

.border-b {
	border-bottom-width: 1px;
	border-bottom-style: solid;
	border-bottom-color: #e5e7eb;
}

/* .space-x-4 > * + * {
	margin-left: 1rem;
} */

.w-20 {
	width: 5rem;
}

.h-20 {
	height: 5rem;
}

.bg-gray-200 {
	background-color: #e5e7eb;
}

.rounded-lg {
	border-radius: 0.5rem;
}

.overflow-hidden {
	overflow: hidden;
}

.w-full {
	width: 100%;
}

.h-full {
	height: 100%;
}

.object-cover {
	object-fit: cover;
}

.text-2xl {
	font-size: 1.5rem;
}

.font-bold {
	font-weight: bold;
}

.text-gray-600 {
	color: #4b5563;
}

.text-right {
	text-align: right;
}

.text-4xl {
	font-size: 2.25rem;
}

.text-yellow-500 {
	color: #f59e0b;
}

.ml-1 {
	margin-left: 0.25rem;
}

.text-base {
	font-size: 1rem;
}

.grid {
	display: grid;
}

.grid-cols-1 {
	grid-template-columns: repeat(1, minmax(0, 1fr));
}

.grid-cols-2 {
	grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid-cols-3 {
	grid-template-columns: repeat(3, minmax(0, 1fr));
}

.gap-4 {
	gap: 1rem;
}

.gap-2 {
	gap: 0.5rem;
}

.gap-8 {
	gap: 2rem;
}

.text-xl {
	font-size: 1.25rem;
}

.mb-6 {
	margin-bottom: 1.5rem;
}

.mb-4 {
	margin-bottom: 1rem;
}

.mb-2 {
	margin-bottom: 0.5rem;
}

/* .space-y-6 > * + * {
	margin-top: 1.5rem;
}

.space-y-4 > * + * {
	margin-top: 1rem;
}

.space-y-8 > * + * {
	margin-top: 2rem;
} */

.w-32 {
	width: 8rem;
}

.text-red-500 {
	color: #ef4444;
}

.text-green-500 {
	color: #10b981;
}

.text-sm {
	font-size: 0.875rem;
}

.font-semibold {
	font-weight: 600;
}

.mt-2 {
	margin-top: 0.5rem;
}

.text-gray-500 {
	color: #6b7280;
}

.mt-4 {
	margin-top: 1rem;
}

.video-container {
	position: relative;
	width: 100%;
	max-width: 240px;
	aspect-ratio: 3/4;
	margin: 0 auto;
	background: #000;
	border-radius: 12px;
	overflow: hidden;
}

.justify-end {
	justify-content: flex-end;
}

.text-blue-500 {
	color: #3b82f6;
}

.text-lg {
	font-size: 1.125rem;
}

.bg-gray-50 {
	background-color: #f9fafb;
}

.aspect-square {
	aspect-ratio: 1 / 1;
}

.bg-gray-100 {
	background-color: #f3f4f6;
}

.form-item {
	margin-bottom: 1.5rem;
}

.border {
	border-width: 1px;
	border-style: solid;
	border-color: #e5e7eb;
}

.rounded {
	border-radius: 0.25rem;
}

.bg-blue-500 {
	background-color: #3b82f6;
}

.px-4 {
	padding-left: 1rem;
	padding-right: 1rem;
}

.py-2 {
	padding-top: 0.5rem;
	padding-bottom: 0.5rem;
}

.fixed-buttons {
	position: fixed;
	right: 2rem;
	bottom: 6rem;
	display: flex;
	flex-direction: column;
	gap: 1rem;
	z-index: 100;
}

.action-button {
	width: 40px;
	height: 40px;
	border-radius: 50%;
	background-color: #3b82f6;
	color: white;
	display: flex;
	align-items: center;
	justify-content: center;
	box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

/* 为了模拟图标，你可能需要引入字体图标或使用其他方式 */
@font-face {
	font-family: "iconfont";
	src: url('data:font/woff2;charset=utf-8;base64,...') format('woff2');
}

.iconfont {
	font-family: "iconfont" !important;
	font-style: normal;
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
}

/* 媒体查询适配移动端 */
@media (max-width: 768px) {
	.p-6 {
		padding: 1rem;
	}
	
	.fixed-buttons {
		right: 1rem;
	}
}
</style>
