<template>
    <!-- pages/contract/contract.wxml -->
    <view class="container">
        <rich-text class="rich_text" :nodes="htmlContent"></rich-text>
    </view>
</template>

<script>
// pages/contract/contract.js
var config = require('../../common/config.js');
var http = require('../../common/http.js');
var app = getApp();
export default {
    data() {
        return {
            htmlContent: ''
        };
    }
    /**
     * 生命周期函数--监听页面加载
     */,
    onLoad: function (options) {
        const contract_id = options.contract_id;
        this.loadHtmlContent(contract_id);
    },
    onShow: function () {},
    /**
     * 生命周期函数--监听页面初次渲染完成
     */
    onReady: function () {},
    /**
     * 生命周期函数--监听页面显示
     */

    /**
     * 生命周期函数--监听页面隐藏
     */
    onHide: function () {},
    /**
     * 生命周期函数--监听页面卸载
     */
    onUnload: function () {},
    /**
     * 页面相关事件处理函数--监听用户下拉动作
     */
    onPullDownRefresh: function () {},
    /**
     * 页面上拉触底事件的处理函数
     */
    onReachBottom: function () {},
    /**
     * 用户点击右上角分享
     */
    onShareAppMessage: function () {},
    methods: {
        loadHtmlContent(contract_id) {
            const me = this;
            http.getApi(config.API_CONTRACT_CONTENT + '&contract_id=' + contract_id, {}, function (resp) {
                if (resp.data.code === 200) {
                    console.log(resp);
                    me.setData({
                        htmlContent: resp.data.data.data
                    });
                } else {
                }
            });
        }
    }
};
</script>
<style>
@import './contract.css';
</style>
