<template>
	<view class="content">
		<view class="card-list">
			<view class="card" v-for="(item, index) in questionList" :key="index" @click="handleCardClick(item)">
				<view class="card-header">
					<view class="student-info">
						<text class="name">{{ item.person_name }}</text>
						<view class="tag" :style="{ backgroundColor: '#F56C6C' }">{{ item.risk_memo }}</view>
					</view>
					<text class="time">{{ item.create_time }}</text>
				</view>
				<view class="card-content">
					<view class="question-title">问题内容：</view>
					<view class="question">{{ item.user_input }}</view>
				</view>
				<view class="card-foot">
					<u-row justify="space-between" gutter="10">
						<u-col span="5">
							<view class="demo-layout bg-purple-light"></view>
						</u-col>
						<u-col span="4">
							<view class="demo-layout bg-purple"></view>
						</u-col>
						<u-col span="3">
							<u-button type="warning" shape="circle" size="small" text="去处理"></u-button>
						</u-col>
					</u-row>

				</view>
			</view>
		</view>
	</view>
</template>

<script>
import {
	getRiskListApi
} from '@/api/services/index.js';
export default {
	data() {
		return {
			questionList: []
		}
	},
	onShow() {
		// uni.hideHomeButton()
	},
	onLoad(options) {
		uni.setNavigationBarTitle({
			title: '详情列表'
		})

		getRiskListApi({
			risk_flag: '1',
			page: '1',
			page_size: '100',
			person_id: options.person_id
		}).then((res) => {
			if (res.success) {
				if (res.data.total) {
					this.questionList = res.data.logs
				}
			}

		}).catch((err) => {
			console.log(err)
		})
	},
	methods: {
		getTagColor(type) {
			const colors = {
				'焦虑': '#FFB74D',
				'抑郁': '#7986CB',
				'人际关系': '#4DB6AC',
				'学习压力': '#FF8A65'
			}
			return colors[type] || '#9E9E9E'
		},
		handleCardClick(item) {
			// 处理卡片点击事件
			console.log('查看详情:', item)
		}
	}
}
</script>

<style lang="scss" scoped>
.content {
	min-height: 100vh;
	background-color: #F4F4F5;
	padding: 24rpx;
}

.card-list {
	.card {
		background-color: #FFFFFF;
		border-radius: 24rpx;
		padding: 32rpx;
		margin-bottom: 24rpx;
		box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.05);

		.card-header {
			display: flex;
			justify-content: space-between;
			align-items: center;
			margin-bottom: 24rpx;
			padding-bottom: 20rpx;
			border-bottom: 2rpx solid #F5F5F5;

			.student-info {
				display: flex;
				align-items: center;

				.name {
					font-size: 32rpx;
					font-weight: 600;
					color: #333333;
					margin-right: 16rpx;
				}

				.tag {
					font-size: 24rpx;
					color: #FFFFFF;
					padding: 4rpx 16rpx;
					border-radius: 100rpx;
				}
			}

			.time {
				font-size: 24rpx;
				color: #999999;
			}
		}

		.card-content {
			.question-title {
				font-size: 28rpx;
				color: #666666;
				margin-bottom: 12rpx;
				font-weight: 500;
			}

			.question {
				font-size: 28rpx;
				color: #333333;
				line-height: 1.6;
				white-space: pre-wrap;
				word-break: break-all;
				text-align: justify;
			}
		}
	}
}

.card-foot {
	border-top: 2rpx solid #F5F5F5;
	margin-top: 24rpx;
	padding-top: 20rpx;
}
</style>