<template>
	<view class="wrap">
		<view class='content1'>
			<view class='row content-item'>
				<view class="left" style="color: #878C9C ;">仓库</view>
				<view class="right">鲅鱼圈库</view>
			</view>
			<view class='row content-item'>
				<textarea placeholder="请输入仓库信息" class="textarea" maxlength="2000" v-model="textareaValue"></textarea>
				<view class="textarea-bottom">{{textareaValue?textareaValue.length:'0'}}/2000字</view>
			</view>
			<view class='row content-item'>
				<u-checkbox activeColor="#19be6b" v-model="value" @change="checkBoxChange">显示在易粮易运收购信息中</u-checkbox>
			</view>
		</view>
		<u-toast ref="uToast" />
		<view style='padding:10px;' class='flex bottom-btn'>
			<!-- getRoles("acquisitionQuality.initial") -->
			<u-button v-if='isSHowBtn' @click='reject' type="error" class="btn1" hover-class='none'>驳回</u-button>
			<u-button v-if='isSHowBtn' @click='pass' type="success" class="btn2">通过</u-button>
		</view>
		<u-modal v-model="isShowAlert" :title-style="{fontSize: '18px',fontWeight:'500'}"
			:content-style="{fontSize: '14px',fontWeight:'400'}" confirm-color='#22C572' confirm-text='确定' title='登录提示'
			showCancelButton='false' :content="content" @confirm="alertBtn" @cancel="cancelClick"></u-modal>
	</view>
</template>
<script>
	import {
		mapState
	} from 'vuex';

	export default {
		components: {

		},
		data() {
			return {
				isSHowBtn: true,
				isShowAlert: false,
				content: '当前登入信息验证失败，是否重新登录？',
				textareaValue: '',
				value: ''
			}
		},

		onLoad() {

		},
		// #ifndef MP
		onNavigationBarButtonTap(e) {
			const index = e.index;
			if (index === 0) {
				this.navTo('/pages/set/set');
			} else if (index === 1) {
				// #ifdef APP-PLUS
				const pages = getCurrentPages();
				const page = pages[pages.length - 1];
				const currentWebview = page.$getAppWebview();
				currentWebview.hideTitleNViewButtonRedDot({
					index
				});
				// #endif
				uni.navigateTo({
					url: '/pages/notice/notice'
				})
			}
		},
		// #endif
		computed: {
			...mapState(['hasLogin', 'userInfo']),
		},
		onShow() {
			this.$api.doRequest('get', '/commonUser/api/checkSession').then(res => {
				console.log("checkSession", res)
				if (res.data.data == "INVALID") {
					this.isShowAlert = true;
					// uni.showModal({
					// 	title: '登录提示',
					// 	content: '当前登入信息验证失败，是否重新登录？',
					// 	showCancel: true,
					// 	confirmText: '登录',
					// 	success: (e) => {
					// 		if (e.confirm) {
					// 			uni.navigateTo({
					// 				url: '/pages/public/login'
					// 			})
					// 		}
					// 	},
					// 	fail: () => {},
					// 	complete: () => {}
					// })
				}
			})
			console.log("hasLogin", this.hasLogin)
		},
		methods: {
			/**
			 * 统一跳转接口,拦截未登录路由
			 * navigator标签现在默认没有转场动画，所以用view
			 */
			navTo(url) {
				if (!this.hasLogin) {
					url = '/pages/public/login';
				}
				uni.navigateTo({
					url
				})
			},
			alertBtn() {
				uni.navigateTo({
					url: '/pages/public/login'
				})
			},
			cancelClick() {
				this.isShowAlert = false
			},
			checkBoxChange(e) {
				console.log(e)
			}
		}
	}
</script>
<style lang='scss' scoped>
	page {
		background: #F5F6FA;
	}

	.wrap {
		background: #fff;
		margin: 10px;
		border-radius: 10px;
		padding: 10px;

	}

	.row {
		display: flex;
		justify-content: space-between;
		position: relative;
		/* border-bottom: 1px solid #EEEEEE; */

		.right,
		input {
			font-size: 28rpx;
			// color: #333333;
		}
	}

	.textarea {
		background: #F9F9FA;
		font-size: 12px;
		text-align: left;
		width: 100%;
		height: 60px;
		padding: 10px;
		border-radius: 5px;
		margin-top: 10px;
		height: 50vh;
		padding-bottom: 20rpx;
	}

	.textarea-bottom {
		position: absolute;
		bottom: 20rpx;
		right: 20rpx;
		color: #606266;
	}
</style>
