<template>
	<view class="change-password-page">
		<view class="form-card">
			<view class="form-item"><text class="form-label">原密码</text><input class="form-input"
					v-model="form.oldPassword" type="password" placeholder="请输入原密码" /></view>
			<view class="form-item"><text class="form-label">新密码</text><input class="form-input"
					v-model="form.newPassword" type="password" placeholder="请输入新密码" /></view>
			<view class="form-item"><text class="form-label">确认密码</text><input class="form-input"
					v-model="form.confirmPassword" type="password" placeholder="请再次输入新密码" /></view>
		</view>
		<button class="save-btn" @click="onSave">确认修改</button>
	</view>
</template>

<script setup>
import { reactive } from 'vue'
const form = reactive({ oldPassword: '', newPassword: '', confirmPassword: '' })
const onSave = () => {
	if (!form.oldPassword || !form.newPassword) { uni.showToast({ title: '请填写完整', icon: 'none' }); return }
	if (form.newPassword !== form.confirmPassword) { uni.showToast({ title: '两次密码不一致', icon: 'none' }); return }
	uni.showToast({ title: '修改成功', icon: 'success' })
	setTimeout(() => uni.navigateBack(), 1000)
}
</script>

<style lang="scss" scoped>
.change-password-page {
	min-height: 100vh;
	background: #f7f8fa;
	padding: 24rpx;
	padding-bottom: 160rpx;
}

.form-card {
	background: #fff;
	border-radius: 24rpx;
	padding: 8rpx 32rpx;
}

.form-item {
	display: flex;
	align-items: center;
	padding: 28rpx 0;
	border-bottom: 2rpx solid #EEEEEE;
}

.form-item:last-child {
	border-bottom: none;
}

.form-label {
	width: 180rpx;
	font-size: 28rpx;
	color: #333;
	flex-shrink: 0;
}

.form-input {
	flex: 1;
	font-size: 28rpx;
	color: #333;
	text-align: right;
}

.save-btn {
	margin-top: 48rpx;
	width: 100%;
	height: 96rpx;
	background: linear-gradient(90deg, #ffd53f, #ff9500);
	color: #fff;
	border: none;
	border-radius: 48rpx;
	font-size: 32rpx;
	font-weight: bold;
	line-height: 96rpx;
}
</style>
