<template>
	<view>
		<NavBar :title="data.navBar.title" :bgColor="data.navBar.bgColor" />
		<view class="list-container">
			<view class="item" v-for="item in source" :key="item.id"  @click="goPage(item.callUrl,item.name)"
				:style="{ 'background-image': `url('/static/image/other/score/${item.icon}bg.png')` }">
				<view class="content flex flex-align-center">
					<image class="logo" :src="`/static/image/other/score/${item.icon}.png`" mode=""></image>
					<view class="name flex-1">{{ item.name }}</view>
					<view class="right-button">
						<!-- <uni-icons type="right" size="16"></uni-icons> -->
					</view>
				</view>
				<!-- <view class="line" :style="{ background: item.color.lineColor }"></view> -->
			</view>
		</view>
	</view>
</template>

<script setup>
	import NavBar from '@/components/nav-bar/nav-bar.vue'
	import {
		ref,
		reactive,
		getCurrentInstance
	} from 'vue'
	import {
		onLoad
	} from "@dcloudio/uni-app";
	import {
		util
	} from '@/utils/common.js';

	const {
		appContext,
		proxy
	} = getCurrentInstance();
	// 列表
	const source = ref([{
			name: '查询中心',
			color: {
				bgColor: '#F3EAFF',
				lineColor: '#B78EF5',
				buttonColor: '#BA8DFF',
			},
			icon: 'icon1',
			callUrl: "/pages/other/score/center"
		},
		{
			name: '广东省',
			color: {
				bgColor: '#FFE9E9',
				lineColor: '#FF6969',
				buttonColor: '#FB6767',
			},
			icon: 'guandong',
			callUrl: "/pages/other/score/guandong"
		},
		{
			name: '重庆市',
			color: {
				bgColor: '#FFF0DD',
				lineColor: '#FFA143',
				buttonColor: '#FFA64D',
			},
			icon: 'chongqing',
			callUrl: "/pages/other/score/chongqing"
		},
		{
			name: '河北省',
			color: {
				bgColor: '#E0FFD9',
				lineColor: '#56B745',
				buttonColor: '#5DCD49',
			},
			icon: 'hebei',
			callUrl: "/pages/other/score/hebei"
		}
	])

	const data = reactive({
		navBar: {
			title: '高考成绩',
			bgColor: '#F0F4F9',
		},
		type: "message"
	})

	onLoad((options) => {
		if (options.type) {
			data.type = options.type
		}
		proxy.$apiUserEvent('all', {
			type: 'event',
			key: 'score',
			prefix: '.uni.other.',
			value:'高考查询'
		})
	// #ifdef APP-PLUS&&!APP-HARMONY
	util.setAndroidSystemBarColor('#ffffff')
	// 保存定时器引用，以便在页面卸载时清理
	setTimeout(() => {
		plus.navigator.setStatusBarStyle("dark");
	}, 500)
	// #endif
	})

	function goPage(url,name) {
		if (url) {
			proxy.$apiUserEvent('all', {
				type: 'event',
				key: 'score',
				prefix: '.uni.other.',
				value:name
			})
			util.goPage(url)
		} else {
			uni.showToast({
				title: '开发中',
				icon: 'none'
			})
		}
	}
</script>

<style>
	@import '@/common/main.css';
</style>
<style lang="less">
	.list-container {
		background-color: #F0F4F9;
		padding: 24rpx 32rpx;
	}

	.item {
		width: 100%;
		height: 160rpx;
		border-radius: 24rpx;
		margin-bottom: 24rpx;
		padding: 40rpx 36rpx 24rpx 28rpx;

				background-repeat: no-repeat;
				background-size: 100% 100%;
		.content {
			.logo {
				width: 96rpx;
				height: 96rpx;
				flex-shrink: 0;
			}

			.name {
				margin-left: 32rpx;
				color: #1A1A1A;
				font-size: 36rpx;
				font-weight: 500;
			}

			.right-button {
				width: 140rpx;
				height: 64rpx;
				border-radius: 16rpx;
				color: #ffffff;
				font-size: 28rpx;
				line-height: 64rpx !important;
				text-align: right;
				// display: flex;
				// align-items: center;
				// justify-content: center;
			}
		}

		.line {
			width: 100rpx;
			height: 8rpx;
			filter: blur(5px);
			opacity: 0.5;
			margin-top: 4rpx;
		}
	}
</style>