<template>
	<view class="page">
		<!-- 自定义导航栏 -->
		<view class="navbar">
			<view class="nav-back" @click="goBack">
				<image src="/static/ic_back.png" class="back-icon" mode="aspectFit"></image>
			</view>
			<text class="nav-title">{{ $t('me.about') }}</text>
		</view>
		
		<!-- Logo和版本号 -->
		<view class="logo-container">
			<view class="logo-box">
				<image 
					v-if="appLogo" 
					:src="appLogo" 
					class="logo-image" 
					mode="aspectFit"
				></image>
				<text v-else class="logo-placeholder">LOGO</text>
			</view>
			<text class="version-text">{{ appName }}</text>
			<text class="version-number">v{{ version }}</text>
		</view>
		
		<!-- 关于我们图片 -->
		<view v-if="aboutUsImage" class="about-image-container">
			<image :src="aboutUsImage" class="about-image" mode="widthFix"></image>
		</view>
	</view>
</template>

<script>
import Config from '@/modules/Config.js'

export default {
	data() {
		return {
			appLogo: '',
			appName: '',
			aboutUsImage: '',
			version: '1.0.0',
			loading: true
		}
	},
	onLoad() {
		this.loadConfig()
	},
	methods: {
		goBack() {
			uni.navigateBack()
		},
		async loadConfig() {
			try {
				this.loading = true
				const config = await Config.getPublicConfig()
				
				if (config.app_logo) {
					this.appLogo = Config.getImageUrl(config.app_logo)
				}
				if (config.app_name) {
					this.appName = config.app_name
				}
				if (config.about_us_image) {
					this.aboutUsImage = Config.getImageUrl(config.about_us_image)
				}
			} catch (error) {
				console.error('加载配置失败:', error)
			} finally {
				this.loading = false
			}
		}
	}
}
</script>

<style lang="scss" scoped>
.page {
	min-height: 100vh;
	background-color: #F3F4F8;
}

.navbar {
	width: 100%;
	padding-top: 100rpx;
	padding-bottom: 20rpx;
	display: flex;
	flex-direction: row;
	align-items: center;
	justify-content: center;
	position: relative;
	
	.nav-back {
		position: absolute;
		left: 32rpx;
		width: 80rpx;
		height: 50rpx;
		display: flex;
		align-items: center;
		justify-content: center;
		
		.back-icon {
			width: 48rpx;
			height: 48rpx;
		}
	}
	
	.nav-title {
		font-size: 34rpx;
		font-weight: 500;
		color: #333;
	}
}

.logo-container {
	display: flex;
	flex-direction: column;
	align-items: center;
	padding: 80rpx 30rpx 40rpx;
	
	.logo-box {
		width: 300rpx;
		height: 300rpx;
		background-color: #fff;
		border-radius: 20rpx;
		display: flex;
		align-items: center;
		justify-content: center;
		box-shadow: 0 4rpx 20rpx rgba(0, 0, 0, 0.08);
		
		.logo-image {
			width: 260rpx;
			height: 260rpx;
		}
		
		.logo-placeholder {
			font-size: 48rpx;
			color: #ccc;
		}
	}
	
	.version-text {
		margin-top: 30rpx;
		font-size: 32rpx;
		color: #333;
		font-weight: 500;
	}
	
	.version-number {
		margin-top: 10rpx;
		font-size: 26rpx;
		color: #999;
	}
}

.about-image-container {
	padding: 20rpx 30rpx;
	
	.about-image {
		width: 100%;
		border-radius: 16rpx;
	}
}
</style>
