<template>
    <view class="container">
        <!-- 自定义头部 -->
        <view class="custom-header">
            <view class="header-left" @click="navBack">
                <image class="back-icon" src="/static/icons/chevron_right_dark.svg" style="transform: rotate(180deg);">
                </image>
            </view>
            <text class="header-title">关于我们</text>
            <view class="header-right"></view>
        </view>
        <view class="header-placeholder"></view>

        <view class="logo-area">
            <image class="app-logo" src="/static/app.png" mode="aspectFit"></image>
            <text class="app-name">{{ appName }}</text>
            <text class="app-version">Version {{ version }}</text>
        </view>

        <view class="group-card">
            <view class="list-item" @click="goToDetail(1)">
                <text class="item-title">服务协议</text>
                <image class="arrow-icon" src="/static/icons/chevron_right.svg"></image>
            </view>
            <view class="list-item" @click="goToDetail(2)">
                <text class="item-title">隐私政策</text>
                <image class="arrow-icon" src="/static/icons/chevron_right.svg"></image>
            </view>
            <!-- <view class="list-item no-border" @click="checkUpdate">
                <text class="item-title">版本更新</text>
                <view class="item-right">
                    <view class="badge-yellow">1</view>
                    <image class="arrow-icon" src="/static/icons/chevron_right.svg"></image>
                </view>
            </view> -->
        </view>

    </view>
</template>

<script>

export default {
    data() {
        return {
            version: '2.0.6',
            appName: '履约者'
        }
    },
    onLoad() {
        this.getAppInfo();
    },
    methods: {
        navBack() {
            uni.navigateBack({
                delta: 1
            });
        },
        goToDetail(id) {
            uni.navigateTo({
                url: `/pages/mine/settings/about/agreement-detail/index?id=${id}`
            });
        },
        checkUpdate() {
            uni.showToast({ title: '已是最新版本', icon: 'none' });
        },
        getAppInfo() {
            // #ifdef APP-PLUS
            plus.runtime.getProperty(plus.runtime.appid, (widgetInfo) => {
                this.version = widgetInfo.version || '2.0.6';
                this.appName = widgetInfo.name || '履约者';
            });
            // #endif
            // #ifndef APP-PLUS
            const systemInfo = uni.getSystemInfoSync();
            this.version = systemInfo.appVersion || '2.0.6';
            this.appName = systemInfo.appName || '履约者';
            // #endif
        }
    }
}
</script>

<style>
page {
    background-color: #F8F8F8;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

.custom-header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 88rpx;
    padding-top: var(--status-bar-height);
    background-color: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-left: 30rpx;
    padding-right: 30rpx;
    box-sizing: content-box;
    z-index: 100;
}

.header-placeholder {
    height: calc(88rpx + var(--status-bar-height));
}

.back-icon {
    width: 40rpx;
    height: 40rpx;
}

.header-title {
    font-size: 32rpx;
    font-weight: bold;
    color: #333;
}

.header-right {
    width: 40rpx;
}

.container {
    padding: 20rpx 30rpx;
}

.logo-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 100rpx 0 60rpx;
}

.app-logo {
    width: 160rpx;
    height: 160rpx;
    border-radius: 30rpx;
    margin-bottom: 20rpx;
    /* gradient background is usually part of the logo image itself, assuming logo.png is complete */
}

.app-name {
    font-size: 36rpx;
    font-weight: bold;
    color: #333;
    margin-bottom: 10rpx;
}

.app-version {
    font-size: 28rpx;
    color: #999;
}

.group-card {
    background-color: #fff;
    border-radius: 20rpx;
    padding: 0 30rpx;
}

.list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 100rpx;
    border-bottom: 1px solid #F5F5F5;
}

.list-item.no-border {
    border-bottom: none;
}

.item-title {
    font-size: 28rpx;
    color: #333;
}

.item-right {
    display: flex;
    align-items: center;
}

.arrow-icon {
    width: 28rpx;
    height: 28rpx;
    opacity: 0.5;
    margin-left: 10rpx;
}

.badge-yellow {
    width: 36rpx;
    height: 36rpx;
    background-color: #FFC107;
    color: #fff;
    font-size: 24rpx;
    line-height: 36rpx;
    text-align: center;
    border-radius: 6rpx;
}
</style>
