<template>
    <div class="detail_box">
        <div class="apass_breadcrumb">
            <el-breadcrumb separator="/">
                <el-breadcrumb-item to="/technical_support">
                技术支持
                </el-breadcrumb-item>
                <el-breadcrumb-item to="/technical_support/answer_center">
                问答中心
                </el-breadcrumb-item>
                <el-breadcrumb-item> 发帖提问 </el-breadcrumb-item>
            </el-breadcrumb>
        </div>
        <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({name: 'answerCenterList'})
                        this.$emit("update2");
                    }else{
                        this.$message.error('添加失败')
                    }
                })
            },100)
        }
    },
};
</script>

<style scoped>
.apass_breadcrumb > .el-breadcrumb {
  padding: 12px 0 11px;
}
.detail_content {
  width: 1200px;
  
}
.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>
