fiee-official-website/src/views/email-alerts/size1920/index.vue
2025-09-30 14:53:03 +08:00

289 lines
6.4 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<script setup>
import { ref } from "vue";
import axios from "axios";
const form = ref({
firstName: "",
lastName: "",
email: "",
company: "",
phone: "",
});
const submitted = ref(false);
async function handleSubmit(e) {
e.preventDefault();
const res = await axios.post(
"https://erpapi-out.szjixun.cn/api/stock/submit/data",
form.value
);
if (res.data.status === 0) {
submitted.value = true;
} else {
}
}
</script>
<template>
<div class="alerts-container">
<!-- Title Section -->
<!-- 未提交 -->
<div v-if="!submitted" class="title-section">
<div class="title-decoration"></div>
<div class="title">E-Mail Alerts</div>
<div class="subtitle">* Required Fields</div>
</div>
<!-- 已提交 -->
<div v-else class="title-section">
<div class="title-decoration"></div>
<div class="title">Submitted successfully!</div>
<div class="subtitle">The information you submitted is as follows:</div>
</div>
<!-- Form Card -->
<div class="form-card relative">
<template v-if="!submitted">
<form class="form-content" @submit="handleSubmit">
<div class="form-group">
<label for="firstName">* First Name</label>
<input
id="firstName"
v-model="form.firstName"
type="text"
required
/>
</div>
<div class="form-group">
<label for="lastName">* Last Name</label>
<input id="lastName" v-model="form.lastName" type="text" required />
</div>
<div class="form-group">
<label for="email">* Email</label>
<input id="email" v-model="form.email" type="email" required />
</div>
<div class="form-group">
<label for="company">* Company</label>
<input id="company" v-model="form.company" type="text" required />
</div>
<div class="form-group">
<label for="phone">Phone</label>
<input id="phone" v-model="form.phone" type="tel" />
</div>
<button type="submit" class="submit-btn">Submit</button>
</form>
</template>
<template v-else>
<div class="submitted-data">
<div class="submitted-data-content">
<div class="submitted-row">
<span class="label">First Name</span>
<span class="value">{{ form.firstName || "Not filled in" }}</span>
</div>
<div class="submitted-row">
<span class="label">Last Name</span>
<span class="value">{{ form.lastName || "Not filled in" }}</span>
</div>
<div class="submitted-row">
<span class="label">Email</span>
<span class="value">{{ form.email || "Not filled in" }}</span>
</div>
<div class="submitted-row">
<span class="label">Company</span>
<span class="value">{{ form.company || "Not filled in" }}</span>
</div>
<div class="submitted-row">
<span class="label">Phone</span>
<span class="value">{{ form.phone || "Not filled in" }}</span>
</div>
</div>
</div>
<div class="submitted-bg"></div>
</template>
</div>
</div>
</template>
<style scoped lang="scss">
.alerts-container {
max-width: 932px;
margin: 0 auto;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
.title-section {
display: flex;
flex-direction: column;
gap: 16px;
padding: 0 16px;
margin-bottom: 32px;
align-self: center;
}
.title-decoration {
width: 58px;
height: 7px;
background: #ff7bac;
margin: auto 0;
margin-top: 43px;
align-self: center;
}
.title {
font-family: "PingFang SC", sans-serif;
font-weight: 500;
font-size: 40px;
line-height: 56px;
color: #000000;
letter-spacing: 1.2px;
}
.subtitle {
font-family: "PingFang SC", sans-serif;
font-size: 16px;
line-height: 22px;
color: #455363;
letter-spacing: 0.48px;
align-self: center;
}
.form-card {
width: 100%;
background-color: white;
border-radius: 16px;
padding: 24px;
box-shadow: 0px 3px 14px 0px rgba(0, 0, 0, 0.16);
animation: fade-in 0.8s cubic-bezier(0.23, 1, 0.32, 1) both;
display: flex;
align-items: center;
justify-content: center;
}
.form-content {
width: 100%;
display: flex;
flex-direction: column;
gap: 16px;
}
.form-group {
display: flex;
flex-direction: column;
gap: 8px;
label {
font-family: "PingFang SC", sans-serif;
font-weight: 500;
font-size: 16px;
line-height: 22px;
color: #000000;
letter-spacing: 0.48px;
}
input {
height: 38px;
border: 1px solid #e0e0e6;
border-radius: 8px;
padding: 0 12px;
font-size: 16px;
outline: none;
transition: border-color 0.3s;
&:focus {
border-color: #ff7bac;
}
}
}
.submit-btn {
height: 60px;
background: #ff7bac;
border-radius: 8px;
border: none;
font-family: "PingFang SC", sans-serif;
font-weight: 500;
font-size: 24px;
line-height: 32px;
color: white;
letter-spacing: 1.2px;
cursor: pointer;
transition: opacity 0.3s;
margin-top: 8px; // 16px (from figma form-group gap) + 8px = 24px
&:hover {
opacity: 0.9;
}
}
.success-title {
font-size: 24px;
font-weight: bold;
color: #ff7bac;
margin-bottom: 16px;
}
.success-info {
margin-bottom: 24px;
color: #455363;
}
.submitted-data {
padding: 36px 24px 24px;
border-radius: 16px;
width: 678px;
height: 428px;
flex-shrink: 0;
}
.submitted-bg {
position: absolute;
bottom: 0;
left: 0;
width: 100%;
height: 100%;
background-image: url("@/assets/image/1920/email-alerts-submit.png");
background-repeat: no-repeat;
background-position: bottom;
background-size: 100%;
}
.submitted-data-content {
display: flex;
flex-direction: column;
align-items: center;
gap: 16px;
padding: 16px 0;
}
.submitted-row {
display: flex;
font-family: "PingFang SC", sans-serif;
font-size: 16px;
line-height: 22px;
letter-spacing: 0.48px;
width: 280px;
}
.label {
font-weight: 500;
color: #000000;
width: 110px;
flex-shrink: 0;
}
.value {
font-weight: 400;
color: #455363;
}
@keyframes fade-in {
0% {
opacity: 0;
transform: translateY(20px);
}
100% {
opacity: 1;
transform: translateY(0);
}
}
</style>