<template>
	<view class="app-page" :class="themeClass">
		<view class="surface-card page-hero">
			<text class="hero-kicker">ABOUT</text>
			<text class="hero-title">关于与隐私</text>
			<text class="hero-desc">查看应用定位、数据说明与发布前应补齐的正式信息。</text>
			<view class="hero-tags">
				<!-- <text class="hero-tag">版本 1.0.0</text> -->
				<text class="hero-tag soft">发布说明</text>
			</view>
		</view>
		<ad-custom unit-id="adunit-64707ea333329399"></ad-custom>
		<section-card title="关于应用" subtitle="面向日常收支记录、预算控制与月度复盘的轻量工具">
			<view class="about-card surface-strong">
				<text class="app-name">账单小管家</text>
				<!-- <text class="app-version">版本 1.0.0</text> -->
				<text class="about-text">定位为轻量、无广告的本地记账工具，适合学生、情侣、合租和个人日常记账场景。</text>
			</view>
		</section-card>

		<section-card title="隐私与数据" subtitle="">
			<view class="info-list">
				<view class="info-item surface-strong">
					<text class="info-title">本地存储</text>
					<text class="info-text">账单、预算、分类、账户和设置默认保存在当前设备本地。</text>
				</view>
				<view class="info-item surface-strong">
					<text class="info-title">本地昵称</text>
					<text class="info-text">昵称仅保存在当前设备，用于个人页展示和首字头像。</text>
				</view>
				<view class="info-item surface-strong">
					<text class="info-title">数据迁移</text>
					<text class="info-text">如需换机迁移，可在“备份与恢复”中导出 JSON 并在新设备恢复。</text>
				</view>
			</view>
		</section-card>

	</view>
</template>

<script setup>
import { computed } from 'vue'
import { onShow } from '@dcloudio/uni-app'
import SectionCard from '../../../components/SectionCard.vue'
import { useAppStore } from '../../../utils/store'

const store = useAppStore()

onShow(()=>{
	showIt()
})

function showIt(){
	let interstitialAd = null;
	if (wx.createInterstitialAd) {
		interstitialAd = wx.createInterstitialAd({
	    adUnitId: 'adunit-0abc32053b19a4e9'  
	  })
	  interstitialAd.onLoad(() => {})
	  interstitialAd.onError((err) => {
	    console.error('插屏广告加载失败', err)
	  })
	  interstitialAd.onClose(() => {})
	}
	
	setTimeout(()=>{
		if (interstitialAd) {
		  interstitialAd.show().catch((err) => {
		    console.error('插屏广告显示失败', err)
		  })
		}
	}, 2280)
}

const themeClass = computed(() => (store.state.settings.theme === 'dark' ? 'theme-dark' : ''))

</script>

<style lang="scss" scoped>
.page-hero {
	padding: 30rpx;
	background: linear-gradient(145deg, rgba(16, 42, 67, 0.96) 0%, rgba(31, 111, 95, 0.88) 60%, rgba(212, 108, 67, 0.82) 100%);
	color: #ffffff;
}

.hero-kicker,
.hero-desc,
.hero-tag.soft {
	color: rgba(255, 255, 255, 0.76);
}

.hero-kicker {
	font-size: 20rpx;
	letter-spacing: 4rpx;
}

.hero-title {
	display: block;
	margin-top: 12rpx;
	font-size: 44rpx;
	font-weight: 700;
}

.hero-desc {
	display: block;
	margin-top: 14rpx;
	font-size: 24rpx;
	line-height: 1.7;
}

.hero-tags {
	display: flex;
	flex-wrap: wrap;
	gap: 14rpx;
	margin-top: 22rpx;
}

.hero-tag {
	padding: 12rpx 18rpx;
	border-radius: 999rpx;
	background: rgba(255, 255, 255, 0.16);
	font-size: 22rpx;
}

.about-card,
.info-item,
.tips-card {
	padding: 26rpx;
	border-radius: 28rpx;
}

.app-name,
.info-title {
	display: block;
	font-size: 31rpx;
	font-weight: 700;
	color: var(--text-primary);
}

.app-version {
	display: block;
	margin-top: 10rpx;
	font-size: 23rpx;
	color: var(--brand);
}

.about-text,
.info-text,
.tip-line {
	display: block;
	margin-top: 12rpx;
	font-size: 24rpx;
	line-height: 1.8;
	color: var(--text-secondary);
}

.info-list {
	display: flex;
	flex-direction: column;
	gap: 16rpx;
}

.tip-row {
	display: flex;
	align-items: flex-start;
	gap: 16rpx;
	padding: 10rpx 0;
}

.tip-index {
	width: 56rpx;
	font-size: 24rpx;
	font-weight: 700;
	color: var(--brand);
}
</style>

