<template>
	<view class="app">
		<u--textarea :maxlength="-1" v-model="msg" height="600" placeholder="请输入公告内容" confirmType="done" border="bottom"></u--textarea>
		<view class="btn" @tap="tapSubmit">完成</view>
	</view>
</template>
<style lang="scss">
	.btn{font-size: 16px;color:#fff;background: $ic-appcolor;height: 40px;width: calc(100% - 40px);margin: 20px;border-radius: 40px;text-align: center;line-height: 40px;}
</style>
<script>
	import {mapState,mapMutations } from 'vuex';
	export default {
	    data() {
	        return {
				msg : "",
				groupId : "",
				isPop:false
	        }  
	    },
		
		onLoad(option){
			this.groupId = option.groupId || "";
			this.msg = option.msg || "";
		},
	    methods: {
			
			tapSubmit:function(){
				if(this.msg == ''){
					this.utils.Tip("请输入群公告");
					return;
				}
				uni.showLoading({ title:"操作中.." });
				this
					.request
					.post("chatGroupEditMsg",{groupId:this.groupId,msg:this.msg})
					.then(res=>{
						uni.hideLoading();
						if(res.code == 200) {
							this.utils.Tip("操作成功");
							uni.navigateBack();
						} else {
							this.utils.Tip(res.msg);
						}
					})
					.catch(error=>{
						uni.hideLoading();
						this.utils.Tip("提交失败，请重新尝试");
					});
				
				
			}
	    }
	}
</script>