This commit is contained in:
2026-09-15 10:35:56 +08:00
commit 782f8ea7aa
4086 changed files with 631288 additions and 0 deletions
@@ -0,0 +1,11 @@
<!--@subject {{trans "Welcome to %store_name" store_name=$store.frontend_name}} @-->
<!--@vars {"var store.frontend_name":"Store Name","var this.getUrl($store,'customer/account/',[_nosid:1])":"Customer Account URL","var customer.email":"Customer Email","var customer.name":"Customer Name","var customer.firstname":"Customer First Name"} @-->
{{template config_path="design/email/header_template"}}
<table width="100%" cellpadding="0" cellspacing="0" role="presentation" style="width:100%;border-collapse:collapse">
<tr><td align="center" style="padding:12px 0 0;text-align:center"><h1 style="margin:0 0 16px;color:#171717;font-size:30px;line-height:1.25;font-weight:bold;text-align:center">{{trans "Welcome to %store_name, %firstname!" store_name=$store.frontend_name firstname=$customer.firstname}}</h1><p style="max-width:560px;margin:0 auto;color:#8d8d8d;font-size:16px;line-height:1.65;text-align:center">{{trans "Thanks for creating an account with us. You can now check out faster, track orders, and save your favorite items for next time."}}</p></td></tr>
<tr><td align="center" style="padding:34px 0 44px;text-align:center"><table width="280" cellpadding="0" cellspacing="0" border="0" role="presentation" align="center" style="width:280px;border-collapse:collapse"><tr><td width="280" height="54" bgcolor="#17a957" align="center" valign="middle" style="width:280px;height:54px;padding:0;background-color:#17a957;text-align:center;vertical-align:middle"><a href="{{var this.getUrl($store,'customer/account/',[_nosid:1])}}" style="display:inline-block;padding:15px 30px;border:0;color:#ffffff;font-family:Arial,sans-serif;font-size:16px;line-height:24px;font-weight:bold;text-align:center;text-decoration:none;white-space:nowrap">{{trans "Go to My Account"}}</a></td></tr></table></td></tr>
<tr><td bgcolor="#f7f8f7" style="padding:26px 30px;background:#f7f8f7;border-radius:8px"><h2 style="margin:0 0 20px;color:#17a957;font-size:15px;line-height:1.2;font-weight:bold;text-transform:uppercase">{{trans "Account Details"}}</h2><table width="100%" cellpadding="0" cellspacing="0" role="presentation"><tr><td width="34%" style="padding:5px 0;color:#999;font-size:14px">{{trans "Name"}}</td><td style="padding:5px 0;color:#222;font-size:14px;font-weight:bold">{{var customer.name}}</td></tr><tr><td style="padding:5px 0;color:#999;font-size:14px">{{trans "Email"}}</td><td style="padding:5px 0;color:#222;font-size:14px;font-weight:bold">{{var customer.email}}</td></tr></table></td></tr>
<tr><td style="padding:42px 0 38px;border-bottom:1px solid #eee"><table width="100%" cellpadding="0" cellspacing="0" role="presentation"><tr><td width="33.33%" align="center" style="padding:0 8px;text-align:center;vertical-align:top"><div style="font-size:24px;line-height:1.2">📦</div><p style="margin:12px 0 5px;color:#222;font-size:14px;font-weight:bold">{{trans "Track Orders"}}</p><p style="margin:0;color:#999;font-size:12px;line-height:1.5">{{trans "View order status & history anytime"}}</p></td><td width="33.33%" align="center" style="padding:0 8px;text-align:center;vertical-align:top"><div style="color:#17a957;font-size:31px;line-height:1">♡</div><p style="margin:12px 0 5px;color:#222;font-size:14px;font-weight:bold">{{trans "Save Favorites"}}</p><p style="margin:0;color:#999;font-size:12px;line-height:1.5">{{trans "Create a wishlist of your picks"}}</p></td><td width="33.33%" align="center" style="padding:0 8px;text-align:center;vertical-align:top"><div style="color:#ffad16;font-size:29px;line-height:1">ϟ</div><p style="margin:12px 0 5px;color:#222;font-size:14px;font-weight:bold">{{trans "Faster Checkout"}}</p><p style="margin:0;color:#999;font-size:12px;line-height:1.5">{{trans "Saved address & payment info"}}</p></td></tr></table></td></tr>
<tr><td style="padding:34px 0 4px"><table width="100%" cellpadding="0" cellspacing="0" role="presentation"><tr><td bgcolor="#fff9ee" style="padding:18px 20px;border-left:4px solid #f5b323;border-radius:5px;background:#fff9ee;color:#8a6510;font-size:13px;line-height:1.5">{{trans 'If you did not create this account, please <a href="%contact_url" style="color:#8a6510;font-weight:bold;text-decoration:underline">contact our support team</a> immediately.' contact_url=$this.getUrl($store,'contact/',[_nosid:1]) |raw}}</td></tr></table></td></tr>
</table>
{{template config_path="design/email/footer_template"}}
@@ -0,0 +1,2 @@
<!--@subject {{trans "Please confirm your %store_name account" store_name=$store.frontend_name}} @-->
{{template config_path="design/email/header_template"}}<h1>{{trans "Confirm your account"}}</h1><p class="greeting">{{trans "%name," name=$customer.name}}</p><p>{{trans "You must confirm your %email email before you can sign in." email=$customer.email}}</p><table width="100%" cellpadding="0" cellspacing="0" border="0" role="presentation"><tr><td align="center" style="padding:30px 0"><table width="280" cellpadding="0" cellspacing="0" border="0" role="presentation" align="center" style="width:280px;border-collapse:collapse"><tr><td width="280" height="54" bgcolor="#17a957" align="center" valign="middle" style="width:280px;height:54px;padding:0;background-color:#17a957;text-align:center;vertical-align:middle"><a href="{{var this.getUrl($store,'customer/account/confirm/',[_query:[id:$customer.id,key:$customer.confirmation,back_url:$back_url,email:$customer.email],_nosid:1])}}" style="display:inline-block;padding:15px 30px;border:0;color:#ffffff;font-family:Arial,sans-serif;font-size:16px;line-height:24px;font-weight:bold;text-align:center;text-decoration:none;white-space:nowrap">{{trans "Confirm Your Account"}}</a></td></tr></table></td></tr></table>{{template config_path="design/email/footer_template"}}
@@ -0,0 +1,2 @@
<!--@subject {{trans "Welcome to %store_name" store_name=$store.frontend_name}} @-->
{{template config_path="design/email/header_template"}}<h1>{{trans "Welcome to %store_name" store_name=$store.frontend_name}}</h1><p class="greeting">{{trans "%name," name=$customer.name}}</p><p>{{trans "Your account has been created. Set a password to sign in."}}</p><table width="100%" cellpadding="0" cellspacing="0" border="0" role="presentation"><tr><td align="center" style="padding:30px 0"><table width="280" cellpadding="0" cellspacing="0" border="0" role="presentation" align="center" style="width:280px;border-collapse:collapse"><tr><td width="280" height="54" bgcolor="#17a957" align="center" valign="middle" style="width:280px;height:54px;padding:0;background-color:#17a957;text-align:center;vertical-align:middle"><a href="{{var this.getUrl($store,'customer/account/createPassword/',[_query:[id:$customer.id,token:$customer.rp_token],_nosid:1])}}" style="display:inline-block;padding:15px 30px;border:0;color:#ffffff;font-family:Arial,sans-serif;font-size:16px;line-height:24px;font-weight:bold;text-align:center;text-decoration:none;white-space:nowrap">{{trans "Create Password"}}</a></td></tr></table></td></tr></table><p><strong>{{trans "Email:"}}</strong> {{var customer.email}}</p>{{template config_path="design/email/footer_template"}}
@@ -0,0 +1,2 @@
<!--@subject {{trans "Reset your %store_name password" store_name=$store.frontend_name}} @-->
{{template config_path="design/email/header_template"}}<h1>{{trans "Reset your password"}}</h1><p class="greeting">{{trans "%name," name=$customer.name}}</p><p>{{trans "If you requested this change, set a new password here:"}}</p><table width="100%" cellpadding="0" cellspacing="0" border="0" role="presentation"><tr><td align="center" style="padding:30px 0"><table width="280" cellpadding="0" cellspacing="0" border="0" role="presentation" align="center" style="width:280px;border-collapse:collapse"><tr><td width="280" height="54" bgcolor="#17a957" align="center" valign="middle" style="width:280px;height:54px;padding:0;background-color:#17a957;text-align:center;vertical-align:middle"><a href="{{var this.getUrl($store,'customer/account/createPassword/',[_query:[id:$customer.id,token:$customer.rp_token,email:$customer.email],_nosid:1])}}" style="display:inline-block;padding:15px 30px;border:0;color:#ffffff;font-family:Arial,sans-serif;font-size:16px;line-height:24px;font-weight:bold;text-align:center;text-decoration:none;white-space:nowrap">{{trans "Set a New Password"}}</a></td></tr></table></td></tr></table>{{template config_path="design/email/footer_template"}}
@@ -0,0 +1,7 @@
<!--@subject {{trans "Reset your %store_name password" store_name=$store.frontend_name}} @-->
<!--@vars {"var store.frontend_name":"Store Name","var customer.name":"Customer Name","var this.getUrl($store,'customer/account/createPassword/',[_query:[id:$customer.id,token:$customer.rp_token,email:$customer.email],_nosid:1])":"Reset Password URL"} @-->
{{template config_path="design/email/header_template"}}
<div class="esun-password"><h1>{{trans "Dear Valued Customer:"}}</h1><p>{{trans "This is an automated email from %store_name in response to your request to reset your password. Please do not reply to this email." store_name=$store.frontend_name}}</p><p>{{trans "To reset your password and access your account, click the button below:"}}</p>
<table width="100%" cellpadding="0" cellspacing="0" border="0" role="presentation"><tr><td align="center" style="padding:30px 0"><table width="280" cellpadding="0" cellspacing="0" border="0" role="presentation" align="center" style="width:280px;border-collapse:collapse"><tr><td width="280" height="54" bgcolor="#17a957" align="center" valign="middle" style="width:280px;height:54px;padding:0;background-color:#17a957;text-align:center;vertical-align:middle"><a href="{{var this.getUrl($store,'customer/account/createPassword/',[_query:[id:$customer.id,token:$customer.rp_token,email:$customer.email],_nosid:1])}}" style="display:inline-block;padding:15px 30px;border:0;color:#ffffff;font-family:Arial,sans-serif;font-size:16px;line-height:24px;font-weight:bold;text-align:center;text-decoration:none;white-space:nowrap">{{trans "Set a new password"}}</a></td></tr></table></td></tr></table>
<p>{{trans "The link will take you to our Reset Password page. Choose a new password to access your account."}}</p><p>{{trans "If you did not request this change, you can safely ignore this email. Your password will remain unchanged."}}</p><p>{{trans "Yours sincerely,"}}<br>{{var store.frontend_name}} {{trans "Customer Care Team"}}</p></div>
{{template config_path="design/email/footer_template"}}
@@ -0,0 +1,16 @@
<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd"
layout="1column">
<head>
<css src="Magento_Customer::css/esun-account.css" />
</head>
<body>
<attribute name="class" value="esun-login-page" />
<referenceBlock name="page.main.title" remove="true" />
<referenceBlock name="breadcrumbs" remove="true" />
<referenceBlock name="customer_form_register" template="Magento_Customer::form/register.phtml" />
</body>
</page>
@@ -0,0 +1,24 @@
<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd"
layout="1column">
<head>
<css src="Magento_Customer::css/esun-account.css" />
</head>
<body>
<attribute name="class" value="esun-login-page" />
<referenceBlock name="page.main.title" remove="true" />
<referenceBlock name="breadcrumbs" remove="true" />
<referenceBlock name="forgotPassword" template="Magento_Customer::account/forgotpassword.phtml" />
<referenceBlock name="captcha">
<action method="setImgWidth">
<argument name="width" xsi:type="number">240</argument>
</action>
<action method="setImgHeight">
<argument name="height" xsi:type="number">64</argument>
</action>
</referenceBlock>
</body>
</page>
@@ -0,0 +1,21 @@
<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd"
layout="1column">
<head>
<css src="Magento_Customer::css/esun-account.css" />
</head>
<body>
<attribute name="class" value="esun-login-page" />
<!-- 去掉默认页面标题("客户登录"文字) -->
<referenceBlock name="page.main.title" remove="true" />
<!-- 去掉面包屑 -->
<referenceBlock name="breadcrumbs" remove="true" />
<!-- 去掉右侧/侧栏容器,让主区域全宽 -->
<referenceContainer name="sidebar.additional" remove="true" />
<referenceBlock name="customer_form_login" template="Magento_Customer::form/login.phtml" />
</body>
</page>
@@ -0,0 +1,11 @@
<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceBlock name="page.main.title">
<arguments>
<argument name="css_class" xsi:type="string">esun-address-form-title</argument>
</arguments>
</referenceBlock>
</body>
</page>
@@ -0,0 +1,13 @@
<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceBlock name="page.main.title" remove="true"/>
<referenceBlock name="address_grid" remove="true"/>
<referenceBlock name="address_book">
<arguments>
<argument name="view_model" xsi:type="object">Esun\Customer\ViewModel\AddressBook</argument>
</arguments>
</referenceBlock>
</body>
</page>
@@ -0,0 +1,89 @@
<?php
/**
* @var \Magento\Customer\Block\Account\Forgotpassword $block
* @var \Magento\Framework\Escaper $escaper
*/
?>
<div class="esun-login" id="esun-forgotpassword">
<div class="esun-login__intro">
<div class="esun-login__intro-inner">
<h1 class="esun-login__title"><?= $escaper->escapeHtml(__('Welcome eSUN')) ?></h1>
<p class="esun-login__subtitle">
<?= $escaper->escapeHtml(__('Embark On A 3D Journey')) ?><br>
<?= $escaper->escapeHtml(__('A Provider Of 3D Printing Material Solutions')) ?>
</p>
</div>
</div>
<div class="esun-login__form-wrap">
<div class="esun-login__block" id="forgot-password-wrapper">
<p class="esun-hint">
<?= $escaper->escapeHtml(__('We Will Send You An Email To Reset Your Password')) ?>
</p>
<form class="esun-form"
action="<?= $escaper->escapeUrl($block->getUrl('customer/account/forgotpasswordpost')) ?>"
method="post"
id="form-validate"
data-mage-init='{"validation":{}}'
autocomplete="off">
<?= $block->getBlockHtml('formkey') ?>
<fieldset class="esun-fieldset">
<div class="esun-field esun-field--required field required">
<label class="esun-label" for="email_address"><span><?= $escaper->escapeHtml(__('Email')) ?></span></label>
<div class="esun-control">
<input type="email"
name="email"
id="email_address"
class="esun-input"
placeholder="<?= $escaper->escapeHtmlAttr(__('Your Email')) ?>"
title="<?= $escaper->escapeHtmlAttr(__('Email')) ?>"
value="<?= $escaper->escapeHtmlAttr($block->getEmailValue()) ?>"
data-validate="{required:true, 'validate-email':true}"
autofocus
/>
</div>
</div>
<?= $block->getChildHtml('form_additional_info') ?>
</fieldset>
<div class="esun-actions esun-actions--center">
<button type="submit" class="esun-btn">
<span><?= $escaper->escapeHtml(__('Send')) ?></span>
</button>
<a class="esun-cancel-link" href="<?= $escaper->escapeUrl($block->getUrl('customer/account/login')) ?>">
<?= $escaper->escapeHtml(__('Cancel')) ?>
</a>
</div>
</form>
</div>
</div>
<div class="esun-modal-overlay" id="esun-forgotpassword-modal">
<div class="esun-modal" role="dialog" aria-modal="true" aria-labelledby="esun-fp-modal-message">
<button type="button" class="esun-modal__close" id="esun-forgotpassword-modal-close" aria-label="<?= $escaper->escapeHtmlAttr(__('Close')) ?>">&times;</button>
<p class="esun-modal__message" id="esun-fp-modal-message">
<?= $escaper->escapeHtml(__('We have contacted you email')) ?><br>
<?= $escaper->escapeHtml(__('Please check it.')) ?>
</p>
<div class="esun-modal__actions">
<button type="button" class="esun-btn" id="esun-forgotpassword-modal-confirm">
<span><?= $escaper->escapeHtml(__('Confirm')) ?></span>
</button>
</div>
</div>
</div>
</div>
<script type="text/x-magento-init">
{
"#esun-forgotpassword": {
"Magento_Customer/js/esun-forgotpassword": {
"redirectUrl": "<?= $escaper->escapeUrl($block->getUrl('customer/account/login')) ?>"
}
}
}
</script>
@@ -0,0 +1,163 @@
<?php
/**
* eSUN customer address book.
*
* @var \Magento\Customer\Block\Address\Book $block
* @var \Magento\Framework\Escaper $escaper
* @var \Esun\Customer\ViewModel\AddressBook $viewModel
*/
$viewModel = $block->getData('view_model');
$defaultShippingId = (int) $block->getDefaultShipping();
$defaultBillingId = (int) $block->getDefaultBilling();
$defaultShipping = $defaultShippingId ? $block->getAddressById($defaultShippingId) : null;
$defaultBilling = $defaultBillingId ? $block->getAddressById($defaultBillingId) : null;
$additionalAddresses = $block->getAdditionalAddresses();
$shippingAddresses = [];
if ($defaultShipping instanceof \Magento\Customer\Api\Data\AddressInterface) {
$shippingAddresses[] = $defaultShipping;
}
if (is_array($additionalAddresses)) {
foreach ($additionalAddresses as $address) {
if ($address instanceof \Magento\Customer\Api\Data\AddressInterface) {
$shippingAddresses[] = $address;
}
}
}
?>
<section class="esun-address-book" data-mage-init='{"Esun_Customer/js/address-book":{}}'>
<h1 class="esun-address-book__title"><?= $escaper->escapeHtml(__('Manage Address Book')) ?></h1>
<nav class="esun-address-book__tabs" aria-label="<?= $escaper->escapeHtmlAttr(__('Address type')) ?>">
<button class="esun-address-book__tab is-active"
type="button"
data-address-tab="shipping"
aria-selected="true">
<?= $escaper->escapeHtml(__('Shipping Address')) ?>
</button>
<button class="esun-address-book__tab"
type="button"
data-address-tab="billing"
aria-selected="false">
<?= $escaper->escapeHtml(__('Billing Address')) ?>
</button>
<a class="esun-address-book__add" href="<?= $escaper->escapeUrl($block->getAddAddressUrl()) ?>">
<span class="esun-address-book__add-icon" aria-hidden="true">+</span>
<?= $escaper->escapeHtml(__('Add New Address')) ?>
</a>
</nav>
<div class="esun-address-book__panel is-active" data-address-panel="shipping">
<?php if ($shippingAddresses): ?>
<div class="esun-address-book__grid">
<?php foreach ($shippingAddresses as $address): ?>
<?php $addressId = (int) $address->getId(); ?>
<article class="esun-address-card">
<div class="esun-address-card__content">
<div class="esun-address-card__identity">
<strong><?= $escaper->escapeHtml($viewModel->getName($address)) ?></strong>
<?php if ($address->getTelephone()): ?>
<a href="tel:<?= $escaper->escapeHtmlAttr($address->getTelephone()) ?>">
<?= $escaper->escapeHtml($address->getTelephone()) ?>
</a>
<?php endif; ?>
</div>
<address>
<?php foreach ($viewModel->getStreetLines($address) as $streetLine): ?>
<span><?= $escaper->escapeHtml($streetLine) ?></span>
<?php endforeach; ?>
<?php if ($locality = $viewModel->getLocalityLine($address)): ?>
<span><?= $escaper->escapeHtml($locality) ?></span>
<?php endif; ?>
<?php if ($country = $viewModel->getCountryName($address)): ?>
<span><?= $escaper->escapeHtml($country) ?></span>
<?php endif; ?>
</address>
</div>
<div class="esun-address-card__actions">
<?php if ($addressId === $defaultShippingId): ?>
<span class="esun-address-card__default">
<?= $escaper->escapeHtml(__('Default')) ?>
</span>
<?php endif; ?>
<?php if ($addressId !== $defaultShippingId && $addressId !== $defaultBillingId): ?>
<a class="action delete"
href="#"
role="delete-address"
data-address="<?= $escaper->escapeHtmlAttr((string) $addressId) ?>">
<?= $escaper->escapeHtml(__('Delete')) ?>
</a>
<?php endif; ?>
<a class="action edit"
href="<?= $escaper->escapeUrl($block->getAddressEditUrl($addressId)) ?>">
<?= $escaper->escapeHtml(__('Edit')) ?>
</a>
</div>
</article>
<?php endforeach; ?>
</div>
<?php else: ?>
<div class="esun-address-book__empty">
<?= $escaper->escapeHtml(__('You have no shipping address in your address book.')) ?>
</div>
<?php endif; ?>
</div>
<div class="esun-address-book__panel" data-address-panel="billing" hidden>
<?php if ($defaultBilling): ?>
<div class="esun-address-book__grid">
<article class="esun-address-card">
<div class="esun-address-card__content">
<div class="esun-address-card__identity">
<strong><?= $escaper->escapeHtml($viewModel->getName($defaultBilling)) ?></strong>
<?php if ($defaultBilling->getTelephone()): ?>
<a href="tel:<?= $escaper->escapeHtmlAttr($defaultBilling->getTelephone()) ?>">
<?= $escaper->escapeHtml($defaultBilling->getTelephone()) ?>
</a>
<?php endif; ?>
</div>
<address>
<?php foreach ($viewModel->getStreetLines($defaultBilling) as $streetLine): ?>
<span><?= $escaper->escapeHtml($streetLine) ?></span>
<?php endforeach; ?>
<?php if ($locality = $viewModel->getLocalityLine($defaultBilling)): ?>
<span><?= $escaper->escapeHtml($locality) ?></span>
<?php endif; ?>
<?php if ($country = $viewModel->getCountryName($defaultBilling)): ?>
<span><?= $escaper->escapeHtml($country) ?></span>
<?php endif; ?>
</address>
</div>
<div class="esun-address-card__actions">
<span class="esun-address-card__default">
<?= $escaper->escapeHtml(__('Default')) ?>
</span>
<a class="action edit"
href="<?= $escaper->escapeUrl($block->getAddressEditUrl($defaultBillingId)) ?>">
<?= $escaper->escapeHtml(__('Edit')) ?>
</a>
</div>
</article>
</div>
<?php else: ?>
<div class="esun-address-book__empty">
<p><?= $escaper->escapeHtml(__('You have no default billing address in your address book.')) ?></p>
<a class="action primary" href="<?= $escaper->escapeUrl($block->getAddAddressUrl()) ?>">
<?= $escaper->escapeHtml(__('Add New Address')) ?>
</a>
</div>
<?php endif; ?>
</div>
</section>
<script type="text/x-magento-init">
{
".esun-address-book": {
"address": {
"deleteAddress": "a[role='delete-address']",
"deleteUrlPrefix": "<?= $escaper->escapeJs($escaper->escapeUrl($block->getDeleteUrl())) ?>id/"
}
}
}
</script>
@@ -0,0 +1,101 @@
<?php
/**
*
* @var \Magento\Customer\Block\Form\Login $block
* @var \Magento\Framework\Escaper $escaper
*/
?>
<?php
$postActionUrl = $block->getPostActionUrl();
?>
<div class="esun-login">
<div class="esun-login__intro">
<div class="esun-login__intro-inner">
<h1 class="esun-login__title"><?= $escaper->escapeHtml(__('Welcome eSUN')) ?></h1>
<p class="esun-login__subtitle">
<?= $escaper->escapeHtml(__('Embark On A 3D Journey')) ?><br>
<?= $escaper->escapeHtml(__('A Provider Of 3D Printing Material Solutions')) ?>
</p>
</div>
</div>
<div class="esun-login__form-wrap">
<div class="esun-login__block" id="login-form-wrapper">
<form class="esun-form"
action="<?= $escaper->escapeUrl($postActionUrl) ?>"
method="post"
id="login-form"
data-mage-init='{"validation":{}}'>
<?= $block->getBlockHtml('formkey') ?>
<input name="context" type="hidden" value="checkout" />
<fieldset class="esun-fieldset">
<?= $block->getChildHtml('form_fields_before') ?>
<div class="esun-field field required">
<label class="esun-label" for="email"><span><?= $escaper->escapeHtml(__('Email')) ?></span></label>
<div class="esun-control">
<input name="login[username]"
id="email"
type="email"
class="esun-input"
placeholder="<?= $escaper->escapeHtmlAttr(__('Your Email')) ?>"
title="<?= $escaper->escapeHtmlAttr(__('Email')) ?>"
value="<?= $escaper->escapeHtmlAttr($block->getUsername()) ?>"
autofocus
data-validate="{required:true, 'validate-email':true}" />
</div>
</div>
<div class="esun-field field required">
<label class="esun-label" for="pass"><span><?= $escaper->escapeHtml(__('Password')) ?></span></label>
<div class="esun-control esun-control--password">
<input name="login[password]"
type="password"
class="esun-input"
id="pass"
placeholder="<?= $escaper->escapeHtmlAttr(__('Your Password')) ?>"
title="<?= $escaper->escapeHtmlAttr(__('Password')) ?>"
data-validate="{required:true}"
autocomplete="off" />
<button type="button" class="esun-password-toggle" aria-label="<?= $escaper->escapeHtmlAttr(__('Show/Hide Password')) ?>">
<span class="esun-icon-eye"></span>
</button>
</div>
</div>
<?= $block->getChildHtml('form_additional_info') ?>
</fieldset>
<div class="esun-actions">
<div class="esun-actions__left">
<button type="submit" class="esun-btn">
<span><?= $escaper->escapeHtml(__('Log In')) ?></span>
</button>
</div>
<div class="esun-actions__right">
<a class="esun-btn" href="<?= $escaper->escapeUrl($block->getUrl('customer/account/create')) ?>">
<?= $escaper->escapeHtml(__('Create an Account')) ?>
</a>
</div>
</div>
<div class="forgot-box">
<a class="esun-link" href="<?= $escaper->escapeUrl($block->getForgotPasswordUrl()) ?>">
<?= $escaper->escapeHtml(__('Forgot Your Password?')) ?>
</a>
</div>
</form>
</div>
</div>
</div>
<script type="text/x-magento-init">
{
".esun-login": {
"Magento_Customer/js/esun-login-password-toggle": {}
}
}
</script>
@@ -0,0 +1,192 @@
<?php
/**
* @var \Magento\Customer\Block\Form\Register $block
* @var \Magento\Framework\Escaper $escaper
*/
$subscriptionPromotion = $block->getData('subscription_promotion');
$showSubscriptionReminder = $subscriptionPromotion instanceof
\Esun\CustomerCoupon\ViewModel\RegistrationSubscriptionPromotion
&& $subscriptionPromotion->isReminderEnabled();
$subscriptionReminderMessage = $showSubscriptionReminder
? $subscriptionPromotion->getReminderMessage()
: '';
$subscriptionDiscountLabel = $showSubscriptionReminder
? $subscriptionPromotion->getDiscountLabel()
: '';
$subscriptionModalConfig = $showSubscriptionReminder
? [
'modalTitle' => (string)__('Do you want to give up this offer?'),
'subscribeButtonText' => (string)__('Subscribe and Get %1', $subscriptionDiscountLabel),
'declineButtonText' => (string)__('Give Up Offer and Continue')
]
: [];
?>
<div class="esun-login">
<div class="esun-login__intro">
<div class="esun-login__intro-inner">
<h1 class="esun-login__title"><?= $escaper->escapeHtml(__('Welcome eSUN')) ?></h1>
<p class="esun-login__subtitle">
<?= $escaper->escapeHtml(__('Embark On A 3D Journey')) ?><br>
<?= $escaper->escapeHtml(__('A Provider Of 3D Printing Material Solutions')) ?>
</p>
</div>
</div>
<div class="esun-login__form-wrap">
<div class="esun-login__block esun-login__block--wide" id="register-form-wrapper">
<form class="esun-form"
action="<?= $escaper->escapeUrl($block->getUrl('customer/account/createPost')) ?>"
method="post"
id="form-validate"
data-mage-init='{"validation":{}}'
autocomplete="off">
<?= $block->getBlockHtml('formkey') ?>
<?= $block->getChildHtml('form_fields_before') ?>
<fieldset class="esun-fieldset">
<div class="esun-field-row">
<div class="esun-field field required">
<label class="esun-label" for="lastname"><span><?= $escaper->escapeHtml(__('Last Name')) ?></span></label>
<div class="esun-control">
<input type="text"
id="lastname"
name="lastname"
class="esun-input"
placeholder="<?= $escaper->escapeHtmlAttr(__('Last Name')) ?>"
title="<?= $escaper->escapeHtmlAttr(__('Last Name')) ?>"
value="<?= $escaper->escapeHtmlAttr($block->getFormData()->getLastname()) ?>"
data-validate="{required:true}"
/>
</div>
</div>
<div class="esun-field field required">
<label class="esun-label" for="firstname"><span><?= $escaper->escapeHtml(__('First Name')) ?></span></label>
<div class="esun-control">
<input type="text"
id="firstname"
name="firstname"
class="esun-input"
placeholder="<?= $escaper->escapeHtmlAttr(__('First Name')) ?>"
title="<?= $escaper->escapeHtmlAttr(__('First Name')) ?>"
value="<?= $escaper->escapeHtmlAttr($block->getFormData()->getFirstname()) ?>"
data-validate="{required:true}"
/>
</div>
</div>
</div>
<div class="esun-field field required">
<label class="esun-label" for="email_address"><span><?= $escaper->escapeHtml(__('Email')) ?></span></label>
<div class="esun-control">
<input type="email"
name="email"
id="email_address"
class="esun-input"
placeholder="<?= $escaper->escapeHtmlAttr(__('Your Email')) ?>"
title="<?= $escaper->escapeHtmlAttr(__('Email')) ?>"
value="<?= $escaper->escapeHtmlAttr($block->getFormData()->getEmail()) ?>"
data-validate="{required:true, 'validate-email':true}"
/>
</div>
</div>
<div class="esun-field field required">
<label class="esun-label" for="password"><span><?= $escaper->escapeHtml(__('Password')) ?></span></label>
<div class="esun-control esun-control--password">
<input type="password"
name="password"
id="password"
class="esun-input"
placeholder="<?= $escaper->escapeHtmlAttr(__('Your Password')) ?>"
title="<?= $escaper->escapeHtmlAttr(__('Password')) ?>"
data-validate="{required:true, 'validate-password':true}"
autocomplete="off"
/>
<button type="button" class="esun-password-toggle" aria-label="<?= $escaper->escapeHtmlAttr(__('Show/Hide Password')) ?>">
<span class="esun-icon-eye"></span>
</button>
</div>
<p class="esun-field-note"><?= $escaper->escapeHtml(__('6-16 characters, combination of letters and numbers')) ?></p>
</div>
<div class="esun-field field required">
<label class="esun-label" for="password-confirmation"><span><?= $escaper->escapeHtml(__('Confirm Password')) ?></span></label>
<div class="esun-control esun-control--password">
<input type="password"
name="password_confirmation"
id="password-confirmation"
class="esun-input validate-cpassword"
placeholder="<?= $escaper->escapeHtmlAttr(__('Your Password')) ?>"
title="<?= $escaper->escapeHtmlAttr(__('Confirm Password')) ?>"
data-validate="{required:true}"
autocomplete="off"
/>
<button type="button" class="esun-password-toggle" aria-label="<?= $escaper->escapeHtmlAttr(__('Show/Hide Password')) ?>">
<span class="esun-icon-eye"></span>
</button>
</div>
</div>
<?= $block->getChildHtml('form_additional_info') ?>
<div class="esun-checkbox-field">
<input type="checkbox" id="agreement" name="agreement" value="1" data-validate="{required:true}" />
<label for="agreement">
<?= $escaper->escapeHtml(__('I have read and agree to the User')) ?>
<a href="#"><?= $escaper->escapeHtml(__('Registration Agreement')) ?></a>
<?= $escaper->escapeHtml(__('and the')) ?>
<a href="#"><?= $escaper->escapeHtml(__('Privacy Policy.')) ?></a>
</label>
</div>
<div class="esun-checkbox-field<?= $showSubscriptionReminder
? ' esun-checkbox-field--subscription'
: '' ?>"
<?php if ($showSubscriptionReminder): ?>data-role="subscription-reminder"<?php endif; ?>>
<input type="checkbox"
id="is_subscribed"
name="is_subscribed"
value="1"
<?php if ($showSubscriptionReminder): ?>aria-describedby="subscription-reminder-message"<?php endif; ?> />
<label for="is_subscribed">
<?= $escaper->escapeHtml(__('Subscribe to our weekly newsletters, security advisories, and promotional offers. (You can opt-out at any time).')) ?>
</label>
<?php if ($showSubscriptionReminder): ?>
<div class="esun-subscription-confirmation"
id="subscription-reminder-message"
data-role="subscription-confirmation">
<p><?= $escaper->escapeHtml($subscriptionReminderMessage) ?></p>
<p><?= $escaper->escapeHtml(
__('You can still create your account without subscribing.')
) ?></p>
</div>
<?php endif; ?>
</div>
</fieldset>
<div class="esun-actions">
<button type="submit" class="esun-btn esun-btn--block" title="<?= $escaper->escapeHtmlAttr(__('Create Account')) ?>">
<span><?= $escaper->escapeHtml(__('Create Account')) ?></span>
</button>
</div>
</form>
</div>
</div>
</div>
<script type="text/x-magento-init">
{
".esun-login": {
"Magento_Customer/js/esun-login-password-toggle": {}
<?php if ($showSubscriptionReminder): ?>,
"Magento_Customer/js/esun-register-subscription":
<?= /* @noEscape */ json_encode(
$subscriptionModalConfig,
JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_AMP | JSON_HEX_QUOT
) ?>
<?php endif; ?>
}
}
</script>
@@ -0,0 +1,737 @@
:root {
--esun-green: #1e9e5a;
--esun-green-dark: #178049;
--esun-text-dark: #1a1a1a;
--esun-text-gray: #8a8a8a;
--esun-placeholder: #a3a3a3;
--esun-border: #d9dde1;
--esun-bg-mint: #e9f7f1;
--esun-required: #e02020;
}
.esun-login-page .block-new-customer {
display: none;
}
/* ---------------------------------------------------------------------
0. 兜底重置:以防有第三方模块给裸的 fieldset/legend 加了默认边框
--------------------------------------------------------------------- */
.esun-login-page fieldset.esun-fieldset {
border: 0;
margin: 0;
padding: 0;
min-width: 0;
}
/* ---------------------------------------------------------------------
1. 页面整体:登录 / 找回密码 / 注册 三个入口页公用同一个 body class
--------------------------------------------------------------------- */
.esun-login-page .page-wrapper {
display: flex;
flex-direction: column;
min-height: 100vh;
}
.esun-login-page .page-main {
max-width: none;
padding: 0;
margin: 0;
}
.esun-login-page .columns {
flex: 1 0 auto;
display: flex;
width: 100%;
}
.esun-login-page .columns .column.main {
padding: 0;
flex: 1 0 auto;
display: flex;
flex-direction: column;
}
/* 背景铺满整个视口宽度和高度,内容区域另外限宽居中(见 .esun-login) */
.esun-login-page .column.main,
.esun-login-page .page-main {
background:
radial-gradient(
circle at 15% 20%,
#d7f0e6 0%,
rgba(215, 240, 230, 0) 45%
),
linear-gradient(
120deg,
var(--esun-bg-mint) 0%,
#ffffff 60%,
#ffffff 100%
);
}
/* ---------------------------------------------------------------------
2. 分屏容器(登录 / 找回密码 / 注册 共用)
--------------------------------------------------------------------- */
.esun-login {
display: flex;
flex-wrap: wrap;
width: 100%;
flex: 1 0 auto;
min-height: 720px;
align-items: center;
max-width: 1600px;
margin: 0 auto;
padding: 60px 8%;
box-sizing: border-box;
}
.esun-login__intro {
flex: 1 1 420px;
padding-right: 40px;
}
.esun-login__intro-inner {
max-width: 420px;
}
.esun-login__title {
font-size: 40px;
font-weight: 800;
color: var(--esun-text-dark);
margin: 0 0 24px;
line-height: 1.2;
}
.esun-login__subtitle {
font-size: 18px;
color: var(--esun-text-dark);
line-height: 1.7;
margin: 0;
}
.esun-login__form-wrap {
flex: 1 1 420px;
display: flex;
justify-content: center;
}
.esun-login__block {
width: 100%;
max-width: 460px;
}
/* 注册页表单更宽,占两列,需要更大的最大宽度 */
.esun-login__block--wide {
max-width: 520px;
}
/* ---------------------------------------------------------------------
3. 表单公共部分(输入框 / label / 必填星号)
--------------------------------------------------------------------- */
.esun-form {
width: 100%;
}
.esun-fieldset {
margin: 0;
border: 0;
padding: 0;
}
.esun-hint {
font-size: 13px;
font-weight: 700;
letter-spacing: 0.4px;
color: var(--esun-text-dark);
text-transform: uppercase;
margin: 0 0 26px;
}
.esun-field {
margin: 0 0 22px;
}
.esun-field--required .esun-label span:after {
content: "*";
color: var(--esun-required);
margin-left: 2px;
}
/* 姓/名 两列布局(注册页) */
.esun-field-row {
display: flex;
gap: 24px;
margin-bottom: 22px;
}
.esun-field-row .esun-field {
flex: 1 1 0;
margin-bottom: 0;
}
.esun-label {
display: block;
font-size: 15px;
color: var(--esun-text-dark);
margin: 0 0 8px;
font-weight: 400;
}
.esun-control {
position: relative;
}
.esun-login input[type="text"],
.esun-login input[type="password"],
.esun-login input[type="number"],
.esun-login input[type="email"] {
width: 100%;
height: 48px;
box-sizing: border-box;
border: 1px solid var(--esun-border);
border-radius: 24px;
padding: 0 20px;
margin: 0;
font-size: 15px;
color: var(--esun-text-dark);
background: #fff;
box-shadow: none;
transition: border-color 0.2s ease;
}
.esun-input::placeholder {
color: var(--esun-placeholder);
opacity: 1;
}
.esun-input:focus {
outline: none;
box-shadow: none;
border-color: var(--esun-green);
}
.esun-field-note {
font-size: 12px;
color: var(--esun-text-gray);
margin: 8px 0 0;
}
/* 密码显隐按钮 */
.esun-control--password .esun-input {
padding-right: 46px;
}
.esun-password-toggle {
position: absolute;
right: 16px;
/* Keep the icon centered in the 48px input when validation text is added. */
top: 24px;
transform: translateY(-50%);
border: 0;
background: transparent;
padding: 0;
cursor: pointer;
width: 20px;
height: 20px;
display: flex;
align-items: center;
justify-content: center;
}
.esun-icon-eye {
display: inline-block;
width: 20px;
height: 20px;
}
.esun-icon-eye:before {
content: "";
display: block;
width: 20px;
height: 20px;
background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="%23a3a3a3" stroke-width="1.6"><path d="M2 12s3.5-7 10-7 10 7 10 7-3.5 7-10 7-10-7-10-7z"/><circle cx="12" cy="12" r="3"/><line x1="3" y1="21" x2="21" y2="3"/></svg>');
background-size: contain;
background-repeat: no-repeat;
}
.esun-password-toggle--visible .esun-icon-eye:before {
background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="%231e9e5a" stroke-width="1.6"><path d="M2 12s3.5-7 10-7 10 7 10 7-3.5 7-10 7-10-7-10-7z"/><circle cx="12" cy="12" r="3"/></svg>');
}
input.mage-error,
select.mage-error,
textarea.mage-error {
border-color: #ed8380 !important;
}
/* Forgot-password CAPTCHA: readable, compact, and isolated from other forms. */
#esun-forgotpassword .field.captcha {
margin: 0 0 24px;
}
#esun-forgotpassword .field.captcha > .label {
color: var(--esun-text-dark);
display: block;
font-size: 15px;
font-weight: 400;
line-height: 1.4;
margin: 0 0 8px;
}
#esun-forgotpassword .control.captcha > .input-text {
margin: 0;
}
#esun-forgotpassword .control.captcha > .nested {
margin-top: 14px;
}
#esun-forgotpassword .field.captcha.no-label {
margin: 0;
}
#esun-forgotpassword .control.captcha-image {
align-items: center;
display: flex;
flex-wrap: wrap;
gap: 12px;
margin: 0;
}
#esun-forgotpassword .captcha-img {
background: #fff;
border: 1px solid var(--esun-border) !important;
border-radius: 10px;
box-sizing: border-box;
display: block;
height: 64px;
margin: 0;
max-width: 100%;
object-fit: contain;
width: 240px;
}
#esun-forgotpassword .captcha-reload {
align-items: center;
background: #fff;
border: 1px solid var(--esun-border);
border-radius: 22px;
box-shadow: none;
color: var(--esun-green-dark);
display: inline-flex;
font-size: 14px;
font-weight: 700;
height: 44px;
justify-content: center;
line-height: 1;
margin: 0;
padding: 0 18px;
transition:
background-color 0.2s ease,
border-color 0.2s ease,
color 0.2s ease;
white-space: nowrap;
}
#esun-forgotpassword .captcha-reload:hover,
#esun-forgotpassword .captcha-reload:focus {
background: var(--esun-bg-mint);
border-color: var(--esun-green);
box-shadow: none;
color: var(--esun-green-dark);
}
#esun-forgotpassword .captcha-reload:focus-visible {
outline: 2px solid var(--esun-green);
outline-offset: 2px;
}
#esun-forgotpassword .captcha-note,
#esun-forgotpassword .field.captcha .mage-error {
color: var(--esun-text-gray);
font-size: 12px;
line-height: 1.5;
margin-top: 8px;
}
/* 勾选框(注册协议 / 订阅) */
.esun-checkbox-field {
margin-bottom: 10px;
}
.esun-checkbox-field input[type="checkbox"] {
width: 16px;
height: 16px;
margin: 3px 0 0;
accent-color: var(--esun-green);
flex: 0 0 auto;
}
.esun-checkbox-field label {
font-size: 13px;
color: var(--esun-text-gray);
line-height: 1.6;
font-weight: 400;
}
.esun-checkbox-field a {
color: var(--esun-text-dark);
text-decoration: underline;
}
.esun-subscription-confirmation {
color: #18a957;
display: none;
font-size: 18px;
font-weight: 600;
line-height: 1.6;
text-align: center;
}
.esun-subscription-confirmation p {
margin: 0 0 10px;
}
.esun-subscription-confirmation p:last-child {
color: var(--esun-text-dark);
font-size: 14px;
font-weight: 400;
margin-bottom: 0;
}
.modal-popup.esun-subscription-modal .modal-inner-wrap {
background: #fff;
border-radius: 12px;
box-shadow: 0 20px 60px rgba(0, 0, 0, 0.18);
box-sizing: border-box;
margin: 0 auto;
max-width: 560px;
min-height: 0;
overflow: hidden;
top: 50%;
transform: translateY(-200vh);
width: calc(100% - 40px);
}
.modal-popup.esun-subscription-modal._show .modal-inner-wrap {
transform: translateY(-50%);
}
.modal-popup.esun-subscription-modal .modal-header {
padding: 44px 64px 0;
text-align: center;
}
.modal-popup.esun-subscription-modal .modal-title {
border: 0;
color: var(--esun-text-dark);
font-size: 24px;
font-weight: 700;
line-height: 1.35;
margin: 0;
padding: 0;
}
.modal-popup.esun-subscription-modal .action-close {
background: transparent;
border: 0;
color: var(--esun-text-dark);
height: 32px;
padding: 0;
right: 18px;
top: 18px;
transition:
color 160ms ease,
transform 160ms ease;
width: 32px;
}
.modal-popup.esun-subscription-modal .action-close:hover,
.modal-popup.esun-subscription-modal .action-close:focus {
color: var(--esun-green);
transform: rotate(90deg);
}
.modal-popup.esun-subscription-modal .modal-content {
padding: 22px 40px 4px;
}
.esun-subscription-modal .modal-footer {
display: flex;
flex-wrap: wrap;
gap: 10px;
justify-content: center;
padding: 24px 40px 40px;
}
.esun-subscription-modal .modal-footer .action {
border-radius: 24px;
box-shadow: none;
box-sizing: border-box;
font-size: 15px;
font-weight: 700;
line-height: 20px;
margin: 0;
min-height: 48px;
padding: 13px 24px;
transition:
background-color 160ms ease,
border-color 160ms ease,
color 160ms ease;
}
.esun-subscription-modal .modal-footer .action.secondary {
background: #fff;
border: 1px solid var(--esun-border);
color: var(--esun-text-dark);
}
.esun-subscription-modal .modal-footer .action.secondary:hover,
.esun-subscription-modal .modal-footer .action.secondary:focus {
background: var(--esun-bg-mint);
border-color: var(--esun-green);
color: var(--esun-green-dark);
}
.esun-subscription-modal .modal-footer .action.primary {
background: var(--esun-green);
border: 1px solid var(--esun-green);
color: #fff;
}
.esun-subscription-modal .modal-footer .action.primary:hover,
.esun-subscription-modal .modal-footer .action.primary:focus {
background: var(--esun-green-dark);
border-color: var(--esun-green-dark);
color: #fff;
}
@media (max-width: 767px) {
.esun-login__form-wrap {
flex: 1 1 320px;
}
.modal-popup.esun-subscription-modal.modal-slide {
left: 0;
}
.modal-popup.esun-subscription-modal .modal-inner-wrap {
height: auto;
max-height: calc(100vh - 32px);
position: absolute;
width: calc(100% - 32px);
}
.modal-popup.esun-subscription-modal .modal-header {
padding: 40px 48px 0;
}
.modal-popup.esun-subscription-modal .modal-title {
font-size: 21px;
}
.modal-popup.esun-subscription-modal .modal-content {
padding: 18px 24px 4px;
}
.esun-subscription-confirmation {
font-size: 16px;
}
.esun-subscription-modal .modal-footer {
flex-direction: column-reverse;
padding: 22px 24px 28px;
}
.esun-subscription-modal .modal-footer .action {
width: 100%;
}
}
@media (prefers-reduced-motion: reduce) {
.modal-popup.esun-subscription-modal .action-close,
.esun-subscription-modal .modal-footer .action {
transition: none;
}
}
/* ---------------------------------------------------------------------
4. 按钮 / 底部操作区
--------------------------------------------------------------------- */
.esun-actions {
display: flex;
align-items: center;
justify-content: space-between;
margin-top: 8px;
flex-wrap: wrap;
gap: 16px;
}
.esun-actions--center {
justify-content: flex-start;
gap: 24px;
}
.esun-btn {
display: inline-block;
background: var(--esun-green);
border: 0;
border-radius: 24px;
color: #fff;
font-size: 15px;
font-weight: 700;
letter-spacing: 0.5px;
padding: 14px 40px;
line-height: normal;
cursor: pointer;
box-shadow: none;
transition: background-color 0.2s ease;
}
.esun-btn:hover,
.esun-btn:focus {
background: var(--esun-green-dark);
border: none;
color: #fff;
}
.esun-actions__right a {
color: #fff;
}
.esun-btn--block {
width: 100%;
text-align: center;
}
.esun-link {
font-size: 13px;
font-weight: 700;
letter-spacing: 0.5px;
color: var(--esun-text-gray) !important;
text-decoration: underline;
text-transform: uppercase;
}
.esun-link:hover {
color: var(--esun-green);
}
.esun-cancel-link {
font-size: 15px;
font-weight: 700;
color: var(--esun-text-gray);
text-decoration: underline;
text-transform: none;
}
.esun-cancel-link:hover {
color: var(--esun-green);
}
/* ---------------------------------------------------------------------
5. 找回密码成功弹窗
--------------------------------------------------------------------- */
.esun-modal-overlay {
position: fixed;
inset: 0;
background: rgba(20, 30, 26, 0.35);
display: none;
align-items: center;
justify-content: center;
z-index: 900;
padding: 20px;
}
.esun-modal-overlay.esun-modal-overlay--open {
display: flex;
}
.esun-modal {
background: #fff;
border-radius: 12px;
width: 100%;
max-width: 560px;
padding: 56px 40px 40px;
position: relative;
box-shadow: 0 20px 60px rgba(0, 0, 0, 0.18);
text-align: center;
}
.esun-modal__close {
position: absolute;
top: 20px;
right: 20px;
width: 24px;
height: 24px;
border: 0;
background: transparent;
cursor: pointer;
color: var(--esun-text-dark);
font-size: 20px;
line-height: 1;
}
.esun-modal__message {
font-size: 20px;
color: var(--esun-text-dark);
line-height: 1.6;
margin: 0 0 32px;
}
.esun-modal__actions {
display: flex;
justify-content: center;
}
/* ---------------------------------------------------------------------
6. 响应式
--------------------------------------------------------------------- */
@media (max-width: 768px) {
.esun-login {
flex-direction: column;
padding: 40px 24px;
min-height: auto;
}
.forgot-box {
text-align: center;
}
.esun-login__intro {
padding-right: 0;
margin-bottom: 40px;
text-align: center;
flex: auto;
}
.esun-login__intro-inner {
max-width: none;
}
.esun-login__title {
font-size: 30px;
}
.esun-actions {
justify-content: center;
text-align: center;
}
.esun-field-row {
flex-direction: column;
gap: 22px;
}
.esun-modal {
padding: 40px 24px 28px;
}
#esun-forgotpassword .control.captcha-image {
align-items: flex-start;
flex-direction: column;
}
#esun-forgotpassword .captcha-reload {
height: 42px;
}
}
@@ -0,0 +1,77 @@
define([
'jquery',
'mage/validation'
], function ($) {
'use strict';
$.widget('mage.esunForgotpassword', {
options: {
redirectUrl: ''
},
/** @inheritdoc */
_create: function () {
this.$form = this.element.find('#form-validate');
this.$modal = this.element.find('#esun-forgotpassword-modal');
this.$form.on('submit', $.proxy(this._onSubmit, this));
this.element.on('click', '#esun-forgotpassword-modal-confirm', $.proxy(this._onConfirm, this));
this.element.on('click', '#esun-forgotpassword-modal-close', $.proxy(this._closeModal, this));
},
/**
*
* @param {Event} event
* @private
*/
_onSubmit: function (event) {
var self = this,
$form = this.$form;
if (!$form.validation('isValid')) {
return;
}
event.preventDefault();
$.ajax({
url: $form.attr('action'),
data: $form.serialize(),
type: 'post',
dataType: 'html',
showLoader: true
}).done(function () {
self._openModal();
}).fail(function () {
// 网络/服务器异常时,退回默认行为,直接提交表单
$form.off('submit').trigger('submit');
});
},
/**
* 打开成功提示弹窗
* @private
*/
_openModal: function () {
this.$modal.addClass('esun-modal-overlay--open');
},
/**
* 关闭弹窗(不跳转)
* @private
*/
_closeModal: function () {
this.$modal.removeClass('esun-modal-overlay--open');
},
/**
* 点击 Confirm 后跳转回登录页
* @private
*/
_onConfirm: function () {
window.location.href = this.options.redirectUrl;
}
});
return $.mage.esunForgotpassword;
});
@@ -0,0 +1,34 @@
define([
'jquery'
], function ($) {
'use strict';
$.widget('mage.esunLoginPasswordToggle', {
options: {},
/** @inheritdoc */
_create: function () {
this.element.on('click', '.esun-password-toggle', $.proxy(this._toggle, this));
},
/**
*
* @param {Event} event
* @private
*/
_toggle: function (event) {
var $button = $(event.currentTarget),
$input = $button.siblings('.esun-input');
if ($input.attr('type') === 'password') {
$input.attr('type', 'text');
$button.addClass('esun-password-toggle--visible');
} else {
$input.attr('type', 'password');
$button.removeClass('esun-password-toggle--visible');
}
}
});
return $.mage.esunLoginPasswordToggle;
});
@@ -0,0 +1,66 @@
define([
'jquery',
'Magento_Ui/js/modal/modal',
'mage/validation'
], function ($, modal) {
'use strict';
return function (config, element) {
var $root = $(element),
$form = $root.find('#form-validate'),
$subscription = $root.find('#is_subscribed'),
$reminder = $root.find('[data-role="subscription-reminder"]'),
$dialog = $root.find('[data-role="subscription-confirmation"]'),
bypassConfirmation = false;
if (!$form.length || !$subscription.length || !$reminder.length || !$dialog.length) {
return;
}
function submitWithSubscription(subscribe) {
$subscription.prop('checked', subscribe).trigger('change');
bypassConfirmation = true;
$dialog.modal('closeModal');
$form.trigger('submit');
bypassConfirmation = false;
}
modal({
type: 'popup',
responsive: true,
innerScroll: false,
title: config.modalTitle,
modalClass: 'esun-subscription-modal',
buttons: [
{
text: config.declineButtonText,
class: 'action secondary esun-subscription-modal__decline',
click: function () {
submitWithSubscription(false);
}
},
{
text: config.subscribeButtonText,
class: 'action primary esun-subscription-modal__subscribe',
click: function () {
submitWithSubscription(true);
}
}
]
}, $dialog);
$form.on('submit.esunSubscriptionConfirmation', function (event) {
if (bypassConfirmation || $subscription.is(':checked')) {
return;
}
if (!$form.validation('isValid')) {
return;
}
event.preventDefault();
event.stopImmediatePropagation();
$dialog.modal('openModal');
});
};
});