<template>
	<view class="zd_container">
		<nav-bar title="设置" :inner2="true" @goIn="goIn" :show1="false"></nav-bar>
		<view class="zd_content">
			<view class="zd_wrapper">
				<view class="input-wrap">
					<view class="input-label">服务器地址</view>
					<input type="text" class="setup-input" v-model="addrip">
				</view>
			</view>
		</view>
		<view class="zd-row submit-bar">
		  <button class="zd-col-22 button-primary" @click="_submit">确定</button>
		</view>
	</view>
</template>

<script>
	import NavBar from '@/components/NavBar.vue'
	export default {
		components: {
			NavBar
		},
		data() {
			return {
				addrip: this.$store.getters.baseUrl
			};
		},
		methods: {
			goIn () {
				uni.redirectTo({
					url: '/pages/login/login'
				})
			},
			_submit () {
				if (this.addrip === '') {
					uni.showToast({
						title: '服务器地址',
						icon: 'none'
					})
					return
				}
				// 存值
				this.$store.dispatch('setConfig',{baseUrl: this.addrip})
				uni.redirectTo({
					url: '/pages/login/login'
				})
			}
		}
	}
</script>

<style lang="stylus">
@import '../../common/style/mixin.styl';
.input-wrap
	_wh(100%, 80rpx)
	margin 20rpx 0
	_fj()
.input-label
	_wh(190rpx, 80rpx)
	_font(28rpx,80rpx,#464646)
	text-align:justify;
	text-align-last: justify;
	text-justify: inter-ideograph;/*兼容ie*/
.setup-input
	_wh(calc(100% - 240rpx), 80rpx)
	background #fff
	border: 1px solid #dcdfe6;
	border-radius: 10rpx;
	_font(28rpx,80rpx,#323232)
	padding 0 10rpx
.select_wrap
	_wh(calc(100% - 220rpx), 80rpx)
	background #fff
</style>
