<template>
	<div class="w-[440px] bg-white px-5 py-[30px] rounded-lg text-text">
		<p class="text-xl font-medium">修改密码</p>
		<section class="update_pwd_main">
			<div class="text-xl flex items-center h-16">
				<div class="min-w-[100px] text-right">新密码</div>
				<el-input type="password" placeholder="新密码" v-model="new_pwd" style="width: 200px" class="ml-5" />
			</div>
			<div class="text-xl flex items-center h-16">
				<div class="min-w-[100px] text-right">确认密码</div>
				<el-input type="password" placeholder="确认新密码" v-model="confirm_pwd" style="width: 200px" class="ml-5" />
			</div>
		</section>
		<footer class="mt-4 flex justify-center items-center text-sm font-medium gap-x-8">
			<button class="btn-dark px-10 py-2 text-xl" @click="onSubmit">确认</button>
			<button class="btn-light px-10 py-2 text-xl" @click="onCancel">取消</button>
		</footer>
	</div>
</template>
<script lang="ts" setup>
import { ElMessage } from "element-plus";
import { ref } from "vue";
const new_pwd = ref("");
const confirm_pwd = ref("");
const emits = defineEmits(["confirm", "cancel"]);
const onSubmit = () => {
	if (new_pwd.value !== confirm_pwd.value) {
		ElMessage.warning("两次密码不一致");
		return;
	} else {
		emits("confirm", new_pwd.value);
	}
};

const onCancel = () => {
	emits("cancel");
};
</script>
