<template>
	<view class="container">
		<!-- 规则名称输入区域 -->
		<view class="input">
			<uni-easyinput :inputBorder="false" focus v-model="name" placeholder="请输入规则名称"></uni-easyinput>
		</view>

		<!-- 确认按钮区域 -->
		<view class="button" @click="handleConfirm">
			确认
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				// 输入框绑定数值
				name: "",
			};
		},
		methods: {
			// 点击确认按钮回调
			handleConfirm() {
				if (!this.name) {
					uni.showToast({
						title: "请输入规则名称",
						icon: 'none'
					})
				} else {
					uni.$emit('updateRuleName', this.name)
					uni.navigateBack({
						delta: 1
					})
				}
			}
		}
	}
</script>

<style lang="scss" scoped>
	.container {
		padding-top: 22rpx;
		background-color: #F2F2F2;

		.input {
			display: flex;
			align-items: center;
			margin: 0 auto;
			width: 690rpx;
			height: 87rpx;
			border-radius: 14rpx;
			background-color: #fff;
		}

		.button {
			margin: 0 auto;
			margin-top: 118rpx;
			width: 690rpx;
			height: 80rpx;
			line-height: 80rpx;
			text-align: center;
			color: #fff;
			font-size: 32rpx;
			font-weight: 500;
			border-radius: 16rpx;
			background-color: #3396FB;
		}
	}
</style>
