<template>
    <cwg-page-wrapper class="permission-page" :isHeaderFixed="true">
        <cwg-header :title="title" :showBack="true" />
        <view class="content">
            <view class="privacy" v-html="privacy"></view>
        </view>
    </cwg-page-wrapper>
</template>

<script setup lang="ts">
import { ref, onMounted, computed } from 'vue'
import { ucardApi } from '@/api/ucard'
import { onLoad } from '@dcloudio/uni-app'
import { useI18n } from "vue-i18n";
const { t } = useI18n();
const type = ref(1);
onLoad((o) => {
    type.value = o?.type || 1;
    getPrivacy();
});
const titleMap: Record<number, string> = {
    1: t('mine.p15'),
    2: t('mine.p16'),
    3: t('mine.p17'),
    4: t('mine.p18'),
};
const title = computed(() => {
    return titleMap[type.value]
});
const privacy = ref('');
const getPrivacy = async () => {
    const res = await ucardApi.getAppPrivacyPolicyPage({ page: { current: 1, row: 10 }, type: type.value });
    if (res.code === 200) {
        privacy.value = res.data[0].content;
    }
};

</script>

<style lang="scss" scoped>
@import "@/uni.scss";

.permission-page {
    min-height: 100vh;
    background-color: #f5f5f5;
    padding: px2rpx(12) !important;

    .content {}
}
</style>
