<template>
	<page-meta>
		<navigation-bar :title="$tt('navBar.manualAdd')" title-align="center" background-color="#F1F3F9"
			front-color="#000000" />
	</page-meta>
	<view class="manual-add">
		<view class="title">
			{{$tt('bleConnect.enterDevNum')}}
		</view>
		<view class="desc">
			{{$tt('bleConnect.enterDevNumDesc')}}
		</view>
		<view class="form">
			<u--form :model="form" :rules="rules" ref="form" labelWidth="31">
				<u-form-item prop="deviceId">
					<u--input v-model="form.deviceId" :placeholder="$tt('bleConnect.pleaseEnter')" border="bottom"
						clearable></u--input>
				</u-form-item>
				<view class="btn-wrap">
					<button class="btn" @click="handleNext">{{$tt('bleConnect.next')}}</button>
				</view>
			</u--form>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				form: {
					deviceId: '',
				},
				rules: {
					deviceId: [{
						required: true,
						message: '设备编号码不能为空',
						trigger: ['blur', 'change']
					}],
				}
			};
		},
		mounted() {

		},
		methods: {
			handleNext() {
				this.$refs.form.validate().then(res => {
					if (res) {
						const { deviceId } = this.form;
						uni.navigateTo({
							url: `/pagesB/home/device/add/bleConnect/setWifi?deviceId=${deviceId}`
						});
					}
				})
			}
		}
	};
</script>

<style lang="scss">
	page {
		height: 100%;
		background: $uni-bg-color-grey;
	}
</style>
<style lang="scss" scoped>
	.manual-add {
		padding: 40rpx;

		.title {
			font-size: 32rpx;
			font-weight: 600;
			line-height: 52rpx;
		}

		.desc {
			font-size: 14px;
			line-height: 24px;
			margin-top: 10px;
		}

		.form {
			margin-top: 40rpx;
		}

		.btn-wrap {
			margin-top: 60rpx;

			.btn {
				display: flex;
				justify-content: center;
				align-items: center;
				height: 98rpx;
				border-radius: 18rpx;
				color: #fff;
				background-color: #486FF2;
				font-weight: 400;
				font-size: 32rpx;
				letter-spacing: 0.6rpx;
			}
		}

		::v-deep .uni-easyinput__content-input {
			font-size: 32rpx;
			height: 88rpx;
		}

		::v-deep .uni-easyinput__content {
			border-radius: 18rpx;
		}
	}
</style>