|
|
@@ -1,59 +1,98 @@
|
|
|
<script setup lang="ts">
|
|
|
+ import { ref, computed } from 'vue';
|
|
|
|
|
|
+ const email = ref('')
|
|
|
+ const tel = ref('')
|
|
|
+ const password = ref('')
|
|
|
+ const confirmPassword = ref('')
|
|
|
+
|
|
|
+ const registerDisabled = computed(() => {
|
|
|
+ const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
|
|
+ const chinaMobileRegex = /^1(3[0-9]|4[579]|5[0-35-9]|6[2567]|7[0-8]|8[0-9]|9[189])\d{8}$/;
|
|
|
+
|
|
|
+ return !(emailRegex.test(email.value) && chinaMobileRegex.test(tel.value) && password.value.trim() !== '' && (password.value == confirmPassword.value))
|
|
|
+ });
|
|
|
+
|
|
|
+ function handleRegister() {
|
|
|
+ console.log(email.value)
|
|
|
+ }
|
|
|
</script>
|
|
|
|
|
|
<template>
|
|
|
- <div class="flex flex-col items-center justify-center px-6 py-8 mx-auto md:h-screen">
|
|
|
+ <div class="flex flex-col items-center justify-center px-6 py-6 space-y-10 min-h-screen">
|
|
|
|
|
|
- <a href="#" class="flex items-center mb-16 text-3xl font-semibold text-gray-900">
|
|
|
+ <span class="flex items-center text-2xl font-semibold text-gray-900">
|
|
|
Blue Whale Shopping Online
|
|
|
- </a>
|
|
|
+ </span>
|
|
|
|
|
|
<el-card class="w-full bg-white rounded-lg shadow-md md:mt-0 sm:max-w-md xl:p-0">
|
|
|
|
|
|
+
|
|
|
<div class="p-6 space-y-4 md:space-y-6 sm:p-8">
|
|
|
- <h1 class="text-xl font-bold leading-tight tracking-tight text-gray-900 md:text-2xl dark:text-white">
|
|
|
+
|
|
|
+ <h1 class="text-2xl font-bold leading-tight tracking-tight text-gray-900">
|
|
|
创建一个新的账户
|
|
|
</h1>
|
|
|
- <el-form class="space-y-4 md:space-y-6" action="#">
|
|
|
+
|
|
|
+ <el-form class="space-y-4 md:space-y-6">
|
|
|
|
|
|
<el-form-item>
|
|
|
<label class="block mb-2 text-sm font-medium text-gray-900 dark:text-white">邮箱</label>
|
|
|
- <input type="email" class="bg-gray-50 border border-gray-300 text-gray-900 sm:text-sm rounded-lg focus:ring-primary-600 focus:border-primary-600 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500"
|
|
|
+ <input id="email" type="email"
|
|
|
+ v-model="email"
|
|
|
+ class="bg-gray-50 border border-gray-300 text-gray-900 sm:text-sm rounded-lg focus:ring-primary-600 focus:border-primary-600 block w-full p-2.5"
|
|
|
placeholder="name@company.com">
|
|
|
</el-form-item>
|
|
|
|
|
|
<el-form-item>
|
|
|
- <label for="phone" class="block mb-2 text-sm font-medium text-gray-900 dark:text-white">手机号</label>
|
|
|
- <input type="tel" class="bg-gray-50 border border-gray-300 text-gray-900 sm:text-sm rounded-lg focus:ring-primary-600 focus:border-primary-600 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500"
|
|
|
+ <label for="tel" class="block mb-2 text-sm font-medium text-gray-900">手机号</label>
|
|
|
+ <input type="tel" id="tel"
|
|
|
+ v-model="tel"
|
|
|
+ class="bg-gray-50 border border-gray-300 text-gray-900 sm:text-sm rounded-lg focus:ring-primary-600 focus:border-primary-600 block w-full p-2.5"
|
|
|
placeholder="+86•••••••••••">
|
|
|
</el-form-item>
|
|
|
|
|
|
<el-form-item>
|
|
|
- <label for="password" class="block mb-2 text-sm font-medium text-gray-900 dark:text-white">密码</label>
|
|
|
- <input type="password" name="password" id="password" placeholder="••••••••" class="bg-gray-50 border border-gray-300 text-gray-900 sm:text-sm rounded-lg focus:ring-primary-600 focus:border-primary-600 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500">
|
|
|
+ <label for="password" class="block mb-2 text-sm font-medium text-gray-900">密码</label>
|
|
|
+ <input type="password" id="password"
|
|
|
+ v-model="password"
|
|
|
+ class="bg-gray-50 border border-gray-300 text-gray-900 sm:text-sm rounded-lg focus:ring-primary-600 focus:border-primary-600 block w-full p-2.5"
|
|
|
+ placeholder="••••••••">
|
|
|
</el-form-item>
|
|
|
|
|
|
<el-form-item>
|
|
|
- <label class="block mb-2 text-sm font-medium text-gray-900 dark:text-white">确认密码</label>
|
|
|
- <input type="password" name="confirm-password" id="confirm-password" placeholder="••••••••" class="bg-gray-50 border border-gray-300 text-gray-900 sm:text-sm rounded-lg focus:ring-primary-600 focus:border-primary-600 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500">
|
|
|
+ <label class="block mb-2 text-sm font-medium text-gray-900">确认密码</label>
|
|
|
+ <input type="password" id="confirm-password"
|
|
|
+ v-model="confirmPassword"
|
|
|
+ class="bg-gray-50 border border-gray-300 text-gray-900 sm:text-sm rounded-lg focus:ring-primary-600 focus:border-primary-600 block w-full p-2.5"
|
|
|
+ placeholder="••••••••">
|
|
|
</el-form-item>
|
|
|
|
|
|
- <el-form-item class="flex items-start">
|
|
|
+<!-- <el-form-item class="flex items-start">-->
|
|
|
+
|
|
|
+<!-- <div class="flex items-center h-5">-->
|
|
|
+<!-- <input id="terms" aria-describedby="terms" type="checkbox" class="w-4 h-4 border border-gray-300 rounded bg-gray-50 focus:ring-3 focus:ring-primary-300"-->
|
|
|
+<!-- required>-->
|
|
|
+<!-- </div>-->
|
|
|
|
|
|
- <div class="flex items-center h-5">
|
|
|
- <input id="terms" aria-describedby="terms" type="checkbox" class="w-4 h-4 border border-gray-300 rounded bg-gray-50 focus:ring-3 focus:ring-primary-300 dark:bg-gray-700 dark:border-gray-600 dark:focus:ring-primary-600 dark:ring-offset-gray-800" required="">
|
|
|
- </div>
|
|
|
+<!-- <div class="ml-3 text-sm">-->
|
|
|
+<!-- <label for="terms" class="font-light text-gray-500">-->
|
|
|
+<!-- 我接受-->
|
|
|
+<!-- <a class="font-medium text-primary-600 hover:underline dark:text-primary-500" href="#">恶魔的条款</a>-->
|
|
|
+<!-- </label>-->
|
|
|
+<!-- </div>-->
|
|
|
|
|
|
- <div class="ml-3 text-sm">
|
|
|
- <label for="terms" class="font-light text-gray-500 dark:text-gray-300">我接受 <a class="font-medium text-primary-600 hover:underline dark:text-primary-500" href="#">恶魔的条款</a></label>
|
|
|
- </div>
|
|
|
+<!-- </el-form-item>-->
|
|
|
|
|
|
+
|
|
|
+ <el-form-item>
|
|
|
+ <button @click.prevent="handleRegister"
|
|
|
+ :disabled="registerDisabled"
|
|
|
+ class="my-3 w-full text-white bg-primary-600 hover:bg-primary-700 focus:ring-4 focus:outline-none focus:ring-primary-300 font-medium rounded-lg text-sm px-5 py-2.5 text-center disabled:bg-primary-100">
|
|
|
+ 创建账户
|
|
|
+ </button>
|
|
|
</el-form-item>
|
|
|
|
|
|
- <button type="submit" class="w-full text-white bg-primary-600 hover:bg-primary-700 focus:ring-4 focus:outline-none focus:ring-primary-300 font-medium rounded-lg text-sm px-5 py-2.5 text-center dark:bg-primary-600 dark:hover:bg-primary-700 dark:focus:ring-primary-800">
|
|
|
- 创建账户
|
|
|
- </button>
|
|
|
|
|
|
<p class="text-sm font-light text-gray-500 dark:text-gray-400">
|
|
|
已经有账户了?
|