<template>
  <j-nav-bar navBarBackground="#fff" color="#000" :title="tittleMap[route.query.key]"/>
  <div :style="{padding: px2vw(20)}">
    <div v-html="agreement">
    </div>
  </div>
</template>

<script lang="ts" setup>
import {getAgreement} from "@/api";
import {onMounted, ref} from "vue";
import {useRoute} from "vue-router";
import {px2vw} from "@/utils";

const route = useRoute()
const agreement = ref('')

const _getSystemConfigOne = (key) => {
  getAgreement().then(res => {
      agreement.value = res[key]
    })
}
const tittleMap = {
  loansAgreement: '借款协议',
  serviceAgreement: '平台服务协议',
  authAgreement: '委托授权协议',
  lawAgreement: '法律协议',
}

onMounted(() => {
  tittleMap[route.query.key] ? document.title = tittleMap[route.query.key] : ''

    _getSystemConfigOne(route.query.key)
})

</script>

<style lang="scss" scoped>

</style>