<template>
	<view class="page-full-width">
		<view class="home-container"
			:style="{ width: $systemInfo.screenWidth }"
		>
			<view v-if="showHead" class="home-head"
				:style="{
					'--position': headPosition == 'left' ? 'flex-start' : 'center'
				}"
			>
				<image class="logo" src="@/static/logo.png" mode="heightFix"></image>
				<view class="head-title-box">
					<view v-if="pageName" class="head-title-cn">{{ pageName }}</view>
					<view v-if="pageNameEn" class="head-title-en">{{ pageNameEn }}</view>
				</view>
			</view>
			<view class="content-box">
				<scroll-view scroll-y="true" style="height: 100%; width: 100%;">
					<!-- 默认插槽，直接在组件内部自定义内容，无需具名插槽<template #xxxx> -->
					<slot></slot>
				</scroll-view>
			</view>
			<view v-if="showFooter" class="footer-box">
				<view class="version">{{ $systemInfo.appName }} <text style="margin-left: 8px;">v{{ $systemInfo.appVersion }}</text></view>
				<view class="copyright">{{ `© Copyright ${startYear && startYear != year ? startYear + '-' : ''}${year} China Kunlene` }}</view>
			</view>
		</view>
	</view>
</template>

<script>
	/**
	 * app首页外框架组件
	 * @description app首页外框架组件
	 * @property {Boolean} showHead 是否显示头部标题等内容
	 * @property {Boolean} headPosition 头部APP名称等位置（默认：center， 可选：left）
	 * @property {Boolean} showFooter 是否显示底部
	 * @property {String} pageName 头部中文名称
	 * @property {String} pageNameEn 头部英文名称
	 * @property {String} startYear 底部版权起始年限
	 */
	export default {
		name: 'k-index-table',
		props: {
			 // 是否显示头部
			showHead: {
				type: Boolean,
				default: true
			},
			// 头部位置（默认：center， 可选：left）
			headPosition: {
				type: String,
				default: 'center'
			},
			// 是否显示底部
			showFooter: {
				type: Boolean,
				default: true
			},
			// 头部中文名称
			pageName: String,
			// 头部英文名称
			pageNameEn: String,
			// 底部 应用起始年限
			startYear: String, 
		},
		data() {
			return {
				isScreenChange: false,
				year: '',
			}
		},
		mounted() {
			let date = new Date()
			this.year = date.getFullYear()
		},
		methods: {}
	}
</script>

<style scoped lang="scss">
	.page-full-width {
		width: 100vw;
		height: 100vh;
		display: flex;
		justify-content: center;
		background: #fff;
	}
	/* 首页 目录页面 */
	.home-container {
		height: 100vh;
		display: flex;
		flex-direction: column;
	}
	.home-head {
		height:  100px;
		display: flex;                                   
		justify-content: var(--position);
		align-items: flex-end;
		margin-bottom: 10px;
		margin-left: 10px;
	}
	.logo {
		height: 60px;
	}
	.head-title-box {
		height: 60%;
		display: flex;
		flex-direction: column;
		justify-content: center;
		margin-left: 0px;
	}
	.head-title-cn-parent {
		font-size: 18px;
	}
	.head-title-cn {
		font-size: 30px;
		letter-spacing: -1px;
		line-height: 35px;
		color: #555;
	}
	.head-title-en {
		font-size: 15px;
		margin-left: 3px;
		margin-top: -3px;
		letter-spacing: 0px;
		color: #777;
	}
	.content-box {
		flex: 1;
		height: 0;
		width: 100%;
	}
	.footer-box {
		height: 50px;
		width: 100%;
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
		color: #999;
		letter-spacing: -0.5px;
	}
	.version {
		font-size: 10px;
	}
	.copyright {
		font-size: 10px;
	}
</style>
