<template>
	<view class="content">
		<view class="login">
			<view class="editem">
				<view class="item">
					<view class="text">{{$t("common.titlePassword")}}</view>
					<view class="input">
						<input class="uni-input" v-model="password" :placeholder="$t('tips.verifyPassword')" />
					</view>
				</view>
				<view class="item">
					<view class="text">{{$t("common.titleConfirmPassword")}}</view>
					<view class="input">
						<input class="uni-input" v-model="password2" :placeholder="$t('tips.verifyPasswordTwo')" />
					</view>
				</view>
			</view>
			<view class="btnlogin" @click="handleTelLogin">{{$t("tips.btnConfirm")}}</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				password: "",
				password2: "",
			}
		},
		onLoad() {},
		onReady() {
			uni.setNavigationBarTitle({
				title: this.$t('common.titlePassword'),
			})
		},
		methods: {
			// 登录、
			handleTelLogin() {
				let that = this
				if (!that.password) {
					that.$tools.msg(that.$t("tips.verifyPassword"))
					return
				}
				if (!that.password2) {
					that.$tools.msg(that.$t("tips.verifyPasswordTwo"))
					return
				}
				if (that.password2 != that.password) {
					that.$tools.msg(that.$t("tips.verifyPasswordCorrect"))
					return
				}
				that.$model.getAccountPassword({
					password: that.password,
					c_password: that.password2,
				}).then(res => {
					console.log("注册", res)
					if (res.code != 0) {
						that.$tools.msg(res.msg)
					} else {
						that.$tools.msg(that.$t("tips.msgSetSuccess"))
						uni.navigateBack()
					}
				}).catch(err => {})
			},
		}
	}
</script>

<style scoped lang="scss">
	.content {
		width: 100%;
		height: 100vh;
	}

	.login {
		width: calc(100% - 30px);
		height: auto;
		background: #fff;
		border-radius: 10px;
		padding: 15px;
		background-color: #fff;
		z-index: 99;

		.editem {
			position: relative;
			display: flex;
			align-items: center;
			font-size: 28rpx;
			justify-content: space-between;
			flex-wrap: wrap;


			.item {
				width: 100%;
				display: flex;
				flex-wrap: wrap;
				align-items: center;
				justify-content: space-between;
				margin-bottom: 15px;

				.text {
					width: 100%;
					height: 40px;
					line-height: 40px;
					font-size: 28rpx;
				}

				.input {
					width: 100%;
					height: 35px;
					line-height: 35px;
					display: flex;
					position: relative;
					border: #dfdfdf 1px solid;
					border-radius: 5px;
					padding: 0 10px;
					background-color: #f7f7f7;
				}

				input {
					height: 40px;
					line-height: 40px;
					position: absolute;
					left: 10px;
					right: 0px;
					z-index: 88;
					font-size: 28rpx;
				}
			}
		}

		.btnlogin {
			width: 100%;
			margin: 15px 0;
			height: 42px;
			line-height: 42px;
			background: $btncolor;
			font-weight: 700;
			border-radius: 15px;
			text-align: center;
			color: #fff !important;
		}
	}
</style>