<template>
    <div class="detail_box">
        <p class="now_page_title">
        技术支持 / 问答中心 /
            <span>发帖提问</span>
        </p>
        <div class="detail_content">
            <div class="detail_title">
                <el-input v-model="title" placeholder="请输入问题标题"></el-input>
            </div>
            <div class="detail_edit">
                <wang-e-bd class="editbox" v-model="editstr" :menu="menu" :full="false"></wang-e-bd>
                <div class="pubilc" @click="add_question"><img src="../../../assets/imgs/jszc_ic_fabu.png" alt="">发表</div>
            </div>
        </div>
    </div>
</template>

<script>
import wangEBd from '@/components/wangEBd'
export default {
    props: [],
    components: {
        wangEBd
    },
    data() {
        return {
            title:'',
            menu:[
                'bold',
                'foreColor',
                'code',
                'link',
                'image',
                'video'
            ],
            editstr:'',
            click_flag:true,
        };
    },
    watch: {

    },
    computed: {

    },
    created() {
        
    },
    mounted() {

    },
    methods: {
        add_question(){
            if(!this.click_flag){
                return
            }
            setTimeout(()=>{
                if(this.title){
    
                }else{
                    this.$message.error('请填写标题')
                    return
                }
                if(this.editstr){
    
                }else{
                    this.$message.error('请填写内容')
                    return
                }
                this.click_flag = false
                this.$http
                .post(
                `/apaas/support/qa/question/create`,{
                    title:this.title,
                    content:this.editstr
                }
                ).then((res)=>{
                    this.click_flag = true
                    this.title = ''
                    this.editstr = ''
                    if(res.data.success){
                        this.$message.success('添加成功')
                        this.$router.push('/technical_support/answer_center/list')
                    }else{
                        this.$message.error('添加失败')
                    }
                })
            },100)
        }
    },
};
</script>

<style scoped>
.detail_box {
  
}
.now_page_title {
  margin: 13px 0;
  color: #898d9e;
}
.now_page_title span {
  color: #242c43;
}
.detail_content {
  width: 100%;
  
}
.detail_title{
	height: 96px;
	background-color: #ffffff;
	box-shadow: 0px 3px 6px 0px 
		rgba(15, 19, 65, 0.04);
	border-radius: 12px;
    padding: 24px;
    margin-bottom: 15px;
}
.editbox{
    height: calc(100% - 32px);
}
.detail_edit{
    height: 672px;
	background-color: #ffffff;
	box-shadow: 0px 3px 6px 0px 
		rgba(15, 19, 65, 0.04);
	border-radius: 12px;
    padding: 24px;
}
.pubilc{
    float: right;
    width: 88px;
	height: 40px;
	background-color: #515fe7;
	border-radius: 8px;
    text-align: center;
    line-height: 40px;
    font-size: 16px;
	color: #e6ebfe;
    margin-top: -6px;
    cursor: pointer;
}
.pubilc img{
    margin-right: 8px;
}
</style>
<style>
.detail_title .el-input__inner{
    height: 48px;
    line-height: 48px;
    background-color: #fbfbfc;
}
</style>
