<template>
  <u-navbar
      :title="title"
      :auto-back="true"
      left-icon-size="40rpx"
      bgColor="transparent"
  ></u-navbar>
  <view class="body-background">
    <u-image
        :show-loading="true"
        :src="staticImage.ruleBg"
        width="100%"
        height="420"
        radius="10"
        mode="widthFix"
        class="img"
    ></u-image>
  </view>
  <view class="app-wallpaper">
    <view class="content">
      <u-parse :content="content" lazyLoad :tag-style="{img:'text-align:center'}"></u-parse>
    </view>
  </view>
</template>

<script>
import {
  imghost
} from '@/config/host.js'
import MzSubsection from '@/components/MzSubsection/Index.vue';
import api from '@/utils/functions.js';
import {webConfig} from "@/api/other";

export default {
  components: {
    MzSubsection
  },
  data() {
    return {
      title: '暖新币兑换制度',
      loading: true,
      staticImage: {
        ruleBg: imghost + '/cron-rule-bg.png',
        newIcon: imghost + '/new-icon.png',
      },
      content:'',
    }
  },
  onLoad() {

  },
  computed: {
    api() {
      return api
    },
    sectionStyle() {
      const style = {};
      style.padding = '0 26rpx';
      style.position = 'sticky';
      style.zIndex = '9999';
      style.top = api.navHeight().systemBarHeight + 'px'
      return style;
    },
  },
  methods: {
    getWebConfig(){
      webConfig({type:'exchange'}).then(res => {
        if(res.code === 200){
          this.content = res.data.exchange;
        }else{
          uni.$u.toast(res.msg)
        }
      })
    }
  },
  options:{
	  styleIsolation:'shared'
  },
  onPageScroll(res) {
    if (res.scrollTop <= 20) {
      uni.$emit('isTop', true);
    } else {
      uni.$emit('isTop', false);
    }
  },
  created() {
    this.listHeight();
    // this.pagePadding = (api.navHeight().navPaddingTop +
    // 	api.navHeight().navHeight + (api.navHeight().headerPadding * 2))
  },
  mounted() {
    this.getWebConfig();
  }
}
</script>

<style lang="scss">
@import './components/rule.scss';
</style>