<template>
    <div class="liuyan">
      <back  title="发表留言"></back>
      <textarea cols="45" rows="10" v-model="content"></textarea>
      <mt-button class="tijiao" type="primary" size="large" @click="submit">提交</mt-button>
    </div>
</template>

<script>
  import Back from "../common/Back"
  import { getStore } from '@/utils/storage'
  import { Toast } from "mint-ui"
    export default {
      name: "LiuYan",
      components:{Back},
      data(){
        return{
          content:''
        }
      },
      methods:{
        submit(){
          if(this.content == ''){
            Toast('请输入留言内容');
            return;
          }
          this.getData('/Member/messageAdd',{token:getStore('token'), content: this.content}).then(
            data=>{
              if(data.code==1){
                Toast(data.msg);
                this.$router.push({path: '/LiuYanList'});
              }else{
                Toast(data.msg);
              }
            },
            err=>{  })
        },
      }
    }
</script>

<style lang="scss" scoped>
  .liuyan{
    padding-top: 5rem;
    .tijiao{
      width: 88%;
      margin:4rem auto;
    }
  }
</style>
