<template>
	<view>
		<uni-nav-bar statusBar backgroundColor="transparent" fixed title="验证信息" left-icon="left" @clickLeft="utils.navigateBack()"></uni-nav-bar>
		
		<view class="info-view">
			<view class="label">验证信息</view>
			<u--textarea placeholder="请输入验证信息" confirm-type="send" v-model="mono" count ></u--textarea>
		</view>
		
		
		<view class="info-view">
			<view class="label">备注名</view>
			<view class="input">
				<u--input border="none" v-model="remark" placeholder="请输入备注名(可为空)"></u--input>
			</view>
		</view>
		<view style="padding: 10px;">
			<view class="app-btn" @tap="tapSubmit">发送</view>
		</view>
	</view>
</template>
<style lang="scss">
	.info-view{margin: 10px;border-radius: 6px;padding: 10px;background: #fff;}
	.info-view .label{padding: 10px;border-bottom: 1px solid #f1f1f1;font-size: 14px;color: $ic-default-text;}
	.info-view .u-textarea{border: 0;}
	.info-view .input{padding: 10px;}
	.app-btn{background: $ic-appcolor;padding: 10px;border-radius: 20px;color: #fff;text-align: center;}
</style>

<script>
	import {mapState,mapMutations } from 'vuex';
	export default {
	    data() {
	        return {
				mono 	 : "",
				usercode : "",
				remark	 : ""
	        }  
	    },
		
		onLoad(option){
			this.usercode = option.userCode || "";
		},
	    methods: {
			tapSubmit:function(){
				uni.showLoading({	title: '提交中..'});
				this
					.request
					.post("FriendVerification",{
						verification:this.mono,
						usercode:this.usercode,
						remark:this.remark
					})
					.then(res => {
						uni.hideLoading();
						if(res.code == 200) {
							this.utils.Tip("发送成功",2000,()=>{
								uni.navigateBack({ delta:1});
							});
							
						} else {
							uni.showModal({title: '系统提示',content: res.msg,showCancel: false});
						}
					})
					.catch(res=>{
						console.log(res);
						uni.hideLoading();
						uni.showModal({title: '系统提示',content: '加载失败，重新点击尝试！',showCancel: false});
					});
				
			}	
	    }
	}
</script>


