<template>
    <div class="agreement" style="height:calc(100vh - 190px)">
        <div style="margin-top: 5px;right: 10px;position: absolute;z-index: 9999999;">
      <el-button  type="primary" @click="submit" icon="el-icon-s-claim">保存</el-button>
    </div>
        <WangEditor v-model="value"  style="height:100%"/>
        <!-- <div class="mt10">
            <el-button type="primary" @click="submit">保存</el-button>
        </div> -->
    </div>
</template>
<script>
import {addAppInfo, queryAppInfo} from '@/api/app/setting'

export default {
    name: '',
    components: {},
    computed: {
    vth() {
      return window.sessionStorage.getItem("appheight") - 60;
    },
  },
    data() {
        return {
            value: '',
            id: ''
        }
    },
    created() {
        let dictypeData = localStorage.getItem('dictypeData')
        if (dictypeData) {
            dictypeData = JSON.parse(dictypeData)
            dictypeData.forEach(item => {
                if (item.code === 'appInformationType') {
                    item.children.forEach(item2 => {
                        if (item2.code === 'introduction') {
                            this.id = item2.id
                            queryAppInfo(item2.id).then(res => {
                                this.value = res.data.content
                            })
                        }
                    })
                }
            })
        }

    },
    methods: {
        submit() {
            addAppInfo({
                type: this.id,
                content: this.value,
            }).then((res) => {
                if (res.code === 'A0000') {
                    this.$message.success('保存成功')
                }
            })
        }
    },
}
</script>
<style lang="scss">

</style>
