<!--修改擅长-->
<template>
    <main>
        <p>擅长</p>
        <textarea v-model="Skill" id="test1" name="test1" placeholder="请输入" maxlength="150"></textarea>
        <p>简介</p>
        <textarea v-model="Introduction" id="test2" name="test2" placeholder="请输入" maxlength="150"></textarea>
        <button class="button" @click="submit()">保存</button>
    </main>
</template>

<script>
    export default {
        name: "UpDateIntroduce",
        data(){
            return{
                Skill:'',   //医生擅长,
                Introduction:'',    //医生简介
            }
        },
        created(){
            var query = this.$route.query;
            this.Skill = query.Skill ? query.Skill : '';
            this.Introduction = query.Introduction ? query.Introduction : '';
        },
        methods:{
            submit(){
                var obj = {
                    Skill:this.Skill,   //医生擅长,
                    Introduction:this.Introduction,    //医生简介
                };
                if(!obj.Skill){
                    this.$toast('擅长不能为空');
                    return
                }
                if(!obj.Introduction){
                    this.$toast('简介不能为空');
                    return
                }

                this.$toast({
                    message:'修改中...',
                    type:'loading',
                    duration:30000,
                    forbidClick:true,
                    onClose:()=>{
                        this.$toast({
                            message:'链接超时 修改失败',
                            type:'fail',
                            duration:1500,
                            onClose:()=>{
                                this.$router.go(-1);
                            }
                        });
                    }
                });
                this.$http.UpdateDoctorIntroduction(obj).then(res=>{
                    if(res.data.IsSuccess){
                        this.$toast({
                            message:'修改成功',
                            type:'success',
                            duration:2000,
                            onClose:()=>{
                                this.$router.go(-1);
                            }
                        });
                    }else{
                        this.$toast({
                            message:res.data.ResultMsg,
                            duration:2000,
                            type:'fail'
                        });
                    }
                })
            }
        }
    }
</script>

<style scoped lang="less">
    main{
        width: 100vw;
        height: 100vh;
        background-color: #F1F1F1;
        box-sizing: border-box;
        padding: .25rem;
        p{
            font-size: .3rem;
            color: #000000;
            text-align: left;
            margin: .15rem 0;
        }
        textarea{
            width: 100%;
            height: 3.2rem;
            box-shadow: 0 0 14px 5px #E4E4E4;
            box-sizing: border-box;
            padding: .15rem;
            border-radius: 5px;
            border: none;
            font-size: .28rem;
        }
    }
</style>
