<script setup lang="ts">
    import dayjs from 'dayjs'
    import Navigate from '@/utils/page/navigate'
    import { useRuntime } from '@/hooks/app/useRuntime'
    import { checkUpgrade } from '@/utils/upgrade'

    const { app } = useRuntime()
    const version = computed(() => app.value.version)
    const currentYear = ref(dayjs().year())
    const { privacy, services, copyright, company } = Navigate.links
</script>

<template>
    <view class="wrap">
        <view class="logoBox">
            <image class="logo" src="/static/logo.png" />
            <view class="text-#555 font-bold p-2">{{ $app.name }}</view>
        </view>
        <fui-footer isFixed>
            <template #text>
                <view class="links">
                    <text class="underline" @tap="Navigate.webview(services, '服务协议')">服务协议</text>
                    <text class="underline" @tap="Navigate.webview(privacy, '隐私政策')">隐私政策</text>
                </view>
                <view class="mt-1 hidden" v-if="version" @tap="checkUpgrade(true)">V{{ version }}</view>
                <view class="mt-2">Copyright © {{ currentYear }} {{ copyright.name }}</view>
                <view class="mt-2" v-if="copyright.name !== company.name">
                    技术支持:
                    <fui-link underline color="#b2b2b2" size="24" :href="company.link" :text="company.name" />
                </view>
            </template>
        </fui-footer>
    </view>
</template>

<style lang="less" scoped>
    .wrap {
        padding: 0 46rpx;
        padding-top: 100rpx;
        font-size: 32rpx;
        height: 100vh;
        background-color: white;
        box-sizing: border-box;
    }

    .logoBox {
        text-align: center;
        display: flex;
        flex-direction: column;
        align-items: center;

        .logo {
            width: 160rpx;
            height: 160rpx;
            box-shadow: 0 0 15rpx #d7d7d7;
            border-radius: 20rpx;
        }

        .logo_text {
            width: 126rpx;
            height: 40rpx;
            margin-top: 20rpx;
        }
    }

    .links {
        padding: 10rpx;

        * {
            padding: 10rpx 20rpx;
        }
    }
</style>
