<script setup>
	// 数据中心
	import {
		reactive
	} from 'vue';
	// 
	import apex from '@/components/header/apex.vue'

	// 图表数据
	const chartData = reactive({
		categories: ["1", "2", "3", "4", "5", "6", '7', '8', '9', '10', '11', '12', '13', '14', '15', '16', '17',
			'18', '19', '20'
		],
		series: [{
				name: "自己",
				data: [11, 6, 31, 33, 13, 34]
			},
			{
				name: "浏览推流",
				data: [15, 14, 50, 37, 17, 38]
			},
			{
				name: "陌生人",
				data: [17, 10, 23, 26, 8, 30]
			},
			{
				name: "已关注",
				data: [11, 6, 31, 33, 13, 34]
			}
		]
	})
	// 配置项
	const opts = reactive({
		color: ["#D8D8D8", "#C2ECFF", "#FFD2D2", "#C2FFCC", "#73C0DE", "#3CA272", "#FC8452", "#9A60B4", "#ea7ccc"],
		padding: [0, 35, 0, 0],
		touchMoveLimit: 24,
		enableScroll: true,
		legend: {
			padding: 20,
			margin: 30,
			position: 'top',
			backgroundColor: 'rgb(0,0,0)',
			fontColor: '#fff',
			itemGap: 10,
		},
		xAxis: {
			titleFontSize: 16,
			disableGrid: true,
			scrollShow: true,
			itemCount: 10,
			showTitle: true,
			title: '秒数',
		},
		yAxis: {
			data: [{
				min: 0,
				titleFontSize: 16,
				title: '人数',
			}],
			showTitle: true,
		},
		extra: {
			column: {
				type: "group",
				width: 5,
				activeBgColor: "#000000",
				activeBgOpacity: 0.08
			},
		}
	})

	/**
	 * 跳转
	 * @param {Object} url 路径参数
	 */
	function link(url) {
		uni.navigateTo({
			url,
		})
	}
</script>

<template>
	<view class="app">
		<apex title="数据中心">
			<template #right>
				<view class="rows c999 f24" @click="link('/pages/index/dataCenter/like')">
					<view class="ver mr10">
						<image class="wh26" src="/static/indexLike1.png" mode="aspectFit" />
						<view>公开赞</view>
					</view>
					<view class="ver mr10">
						<image class="wh26" src="/static/privateLike.png" mode="aspectFit" />
						<view>隐私赞</view>
					</view>
				</view>
			</template>
		</apex>

		<!-- 顶部 -->
		<view class="apex  ptb30 plr30 bfff">
			<view class="rows">
				<view class="title c333 f36 b">统计中心</view>
			</view>
			<!-- 查看时间 -->
			<view class="line mt20 c999 f26">统计时间：2024.12.08 18:00</view>
		</view>

		<!-- 视频详情 -->
		<view class="video df mtb20 ptb20 plr30 bfff">
			<image class="poster br10" src="/static/openPage.png" mode=""></image>
			<view class="info df fdc jcsb f1 ml30">
				<view class="title t2hd f34 c111">我上传了一个视频，这里是视频标题</view>
				<view class="desc t2hd f28 c666">视频简介</view>
				<view class="time f26 c999">2024年11月20日</view>
			</view>
		</view>

		<view class="container">
			<view class="rows">
				<view class="title">流量统计</view>

				<view class="lock rows ptb5 plr20 bar cfff f28" :class="{'active': 1}">
					<image class="lockImg wh30" src="/static/dataLock.png" mode="aspectFit" />
					<image class="unlockImg wh30" src="/static/dataUnlock.png" mode="aspectFit" />
					<view class="ml5">
						<text v-if="0">去</text>
						<text v-else>已</text>
						<text>解锁</text>
					</view>
				</view>
			</view>

			<view class="charts" v-if="0">
				<qiun-data-charts type="column" :opts="opts" :chartData="chartData" :ontouch="true" />
			</view>
			<view class="mtb30 fmid" v-else>
				<view>点击消耗榴莲果</view>
				<image class="wh30" src="/static/fruit.png" mode="aspectFit" />
				<view>30解锁查看24h</view>
			</view>
		</view>

		<view class="container">
			<view class="title">数据统计</view>

			<view class="dataList">
				<view class="main">
					<!-- <view class="item tac">
						<view class="key">公开赞</view>
						<view class="value">1000</view>
					</view>
					<view class="item tac">
						<view class="key">隐私赞</view>
						<view class="value">20</view>
					</view> -->
					<view class="item tac">
						<view class="key">展播量推流</view>
						<view class="value">10</view>
					</view>
					<view class="item tac">
						<view class="key">完播量推流</view>
						<view class="value">2</view>
					</view>
					<view class="item tac">
						<view class="key">评论</view>
						<view class="value">40</view>
					</view>
					<view class="item tac">
						<view class="key">收藏</view>
						<view class="value">3</view>
					</view>
				</view>
				<view class="item tac mt20" @click="link('/pages/index/dataCenter/otherPush')">
					<view class="key">他人推广</view>
					<view class="value">10</view>
				</view>
				<view class="item tac mt20">
					<view class="key">下单数量</view>
					<view class="value">10</view>
				</view>
			</view>
		</view>

		<view class="fill" style="height: 30rpx;"></view>
	</view>
</template>

<style lang="scss" scoped>
	// 页面标题
	.apex {
		border-bottom: 2rpx solid #eee;
	}

	// 视频
	.video {

		.poster {
			height: 288rpx;
			width: 162rpx;
		}
	}

	// 锁
	.lock {
		background-color: #FF9B27;

		.lockImg {
			display: none;
		}

		.unlockImg {
			display: block;
		}

		&.active {
			background-color: #ddd;

			.lockImg {
				display: block;
			}

			.unlockImg {
				display: none;
			}
		}
	}

	// 内容
	.container {
		margin: 30rpx;
		padding: 30rpx 20rpx;
		background-color: #fff;
		border-radius: 20rpx;

		// 标题
		.title {
			margin: 0 30rpx;
			font-size: 30rpx;
			font-weight: bold;
		}

		// 图表
		.charts {
			height: 700rpx;
		}

		// 数据列表
		.dataList {
			margin-top: 30rpx;

			.main {
				display: grid;
				grid-template-columns: repeat(2, 1fr);
				grid-gap: 20rpx;
			}

			.item {
				padding: 30rpx 0;
				background-color: #f8f8f8;
				border-radius: 20rpx;

				.value {
					margin-top: 10rpx;
					font-size: 40rpx;
					font-weight: bold;
				}
			}
		}
	}
</style>