<template>
  <view class="main">
    <uv-navbar :title="title" placeholder autoBack></uv-navbar>
    <view class="content ql-editor-box" v-html="content"></view>
  </view>
</template>

<script setup>
import { protocolInfo } from "@/api/index.js";

import { ref } from "vue";
import { onLoad } from "@dcloudio/uni-app";

const title = ref("");
const content = ref("");

const getProtocol = (code) => {
  if (code == "privacy_protocol") {
    title.value = "隐私政策";
  }
  if (code == "about_us") {
    title.value = "关于我们";
  }
  if (code == "user_protocol") {
    title.value = "服务协议";
  }
  // if (code == "earnings-explain") {
  //   title.value = "收益说明";
  // }
  // if (code == "income_statement") {
  //   title.value = "收益说明";
  // }
  protocolInfo({ code }).then((res) => {
    console.log(res);
    if (res.code == 200) {
      content.value = res.data.protocolContent;
    }
  });
};

onLoad((option) => {
  getProtocol(option.code);
});
</script>

<style lang="scss" scoped>
.main {
  .content {
    padding: 0 30rpx;
  }
}
</style>
