<template>
    <page-meta :page-style="$theme.pageStyle">
        <!-- #ifndef H5 -->
        <navigation-bar :front-color="$theme.navColor" :background-color="$theme.navBgColor" />
        <!-- #endif -->
    </page-meta>
    <view class="p-[20rpx]">
        <mp-html :content="agreementContent"></mp-html>
    </view>

    <!-- #ifdef H5 -->
    <!--    悬浮菜单    -->
    <floating-menu></floating-menu>
    <!-- #endif -->
</template>

<script setup lang="ts">
import { ref } from 'vue'
import { onLoad } from '@dcloudio/uni-app'
import { getPolicy } from '@/api/app'

const agreementType = ref<number | string>('') // 协议类型
const agreementContent = ref('') // 协议内容

const getData = async (type: number | string) => {
    const res = await getPolicy({ type })
    console.log(res, 'res')

    agreementContent.value = res.content

    uni.setNavigationBarTitle({
        title: res.name
    })
}

onLoad((options: any) => {
    if (options.type) {
        agreementType.value = options.type
        getData(agreementType.value)
    }
})
</script>

<style lang="scss" scoped></style>
