add en
BIN
en/docs/assets/download/audacity-win-3.4.2-64bit.exe
Normal file
BIN
en/docs/assets/download/dfu-util-0.11-binaries.tar.xz
Normal file
BIN
en/docs/assets/download/pbax316_90108mv1/XMOS_A316丝印.pdf
Normal file
BIN
en/docs/assets/download/pbax316_90108mv1/元器件规格书/AK4493SEQ.pdf
Normal file
BIN
en/docs/assets/download/pbax316_90108mv1/元器件规格书/DLR2160.pdf
Normal file
BIN
en/docs/assets/download/pbax316_90108mv1/元器件规格书/RCA-108.jpg
Normal file
|
After Width: | Height: | Size: 265 KiB |
BIN
en/docs/assets/download/pbax316_90108mv1/元器件规格书/RCA-210.jpg
Normal file
|
After Width: | Height: | Size: 270 KiB |
BIN
en/docs/assets/download/pbax316_90108mv1/元器件规格书/RT9013-33GB.PDF
Normal file
BIN
en/docs/assets/download/pbax316_90108mv1/元器件规格书/SGM2211.pdf
Normal file
BIN
en/docs/assets/download/pbax316_90108mv1/元器件规格书/WSP6580Q.pdf
Normal file
BIN
en/docs/assets/download/pbax316_90108mv1/元器件规格书/lm27313.pdf
Normal file
BIN
en/docs/assets/download/pbax316_90108mv1/元器件规格书/opa1612.pdf
Normal file
BIN
en/docs/assets/download/pbax316_90108mv1/元器件规格书/sn74lvc1gu04.pdf
Normal file
BIN
en/docs/assets/download/zadig-2.8.exe
Normal file
BIN
en/docs/assets/images/hifi_audio/PBAX316-90108MV1.png
Normal file
|
After Width: | Height: | Size: 6.9 MiB |
BIN
en/docs/assets/images/hifi_audio/PBAX316-90108MV1_mark.png
Normal file
|
After Width: | Height: | Size: 172 KiB |
BIN
en/docs/assets/images/illustrations/Ilustracion-Binbash.png
Normal file
|
After Width: | Height: | Size: 542 KiB |
BIN
en/docs/assets/images/illustrations/home-section-2.png
Normal file
|
After Width: | Height: | Size: 1.1 MiB |
BIN
en/docs/assets/images/illustrations/home-section-3.png
Normal file
|
After Width: | Height: | Size: 1.6 MiB |
BIN
en/docs/assets/images/illustrations/home-section-4.png
Normal file
|
After Width: | Height: | Size: 340 KiB |
BIN
en/docs/assets/images/illustrations/home-section-5.png
Normal file
|
After Width: | Height: | Size: 542 KiB |
BIN
en/docs/assets/images/illustrations/home-section-7.png
Normal file
|
After Width: | Height: | Size: 250 KiB |
BIN
en/docs/assets/images/illustrations/home-why.png
Normal file
|
After Width: | Height: | Size: 832 KiB |
BIN
en/docs/assets/images/illustrations/mock-mac-book-16.png
Normal file
|
After Width: | Height: | Size: 770 KiB |
3091
en/docs/assets/images/illustrations/why-leverage.svg
Normal file
|
After Width: | Height: | Size: 226 KiB |
BIN
en/docs/assets/images/logos/first-gradiant-logo1.png
Normal file
|
After Width: | Height: | Size: 3.0 MiB |
BIN
en/docs/assets/images/logos/first-gradiant-logo2.png
Normal file
|
After Width: | Height: | Size: 1.6 MiB |
BIN
en/docs/assets/images/logos/first-gradiant-logo3.png
Normal file
|
After Width: | Height: | Size: 262 KiB |
BIN
en/docs/assets/images/logos/first-gradiant-logo4.png
Normal file
|
After Width: | Height: | Size: 3.0 MiB |
BIN
en/docs/assets/images/logos/first-gradiant-logo5.png
Normal file
|
After Width: | Height: | Size: 338 KiB |
BIN
en/docs/assets/images/logos/first-gradiant-logo6.png
Normal file
|
After Width: | Height: | Size: 348 KiB |
BIN
en/docs/assets/images/logos/first-gradiant-logo7.png
Normal file
|
After Width: | Height: | Size: 297 KiB |
BIN
en/docs/assets/images/logos/first-gradiant-logo8.png
Normal file
|
After Width: | Height: | Size: 200 KiB |
603
en/docs/common/checklogin_form.md
Normal file
@@ -0,0 +1,603 @@
|
|||||||
|
<style>
|
||||||
|
.login-modal {
|
||||||
|
display: none !important;
|
||||||
|
position: fixed !important;
|
||||||
|
z-index: 100 !important;
|
||||||
|
left: 0 !important;
|
||||||
|
top: 0 !important;
|
||||||
|
width: 100% !important;
|
||||||
|
height: 100% !important;
|
||||||
|
background-color: rgba(0,0,0,0.5) !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.login-modal[style*="block"] {
|
||||||
|
display: block !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.login-content {
|
||||||
|
background-color: #fefefe;
|
||||||
|
margin: 10% auto;
|
||||||
|
padding: 20px;
|
||||||
|
border: 1px solid #888;
|
||||||
|
width: 400px;
|
||||||
|
border-radius: 15px;
|
||||||
|
box-shadow: 0 4px 8px rgba(0,0,0,0.1);
|
||||||
|
}
|
||||||
|
|
||||||
|
.login-content h2 {
|
||||||
|
text-align: center;
|
||||||
|
margin-bottom: 15px;
|
||||||
|
color: #333;
|
||||||
|
font-size: 22px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.login-form .login-type {
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
margin-bottom: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.login-form .login-type label {
|
||||||
|
margin: 0 15px;
|
||||||
|
cursor: pointer;
|
||||||
|
font-size: 15px;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.login-form .login-type input[type="radio"] {
|
||||||
|
margin-right: 5px;
|
||||||
|
width: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.login-form input {
|
||||||
|
width: 100%;
|
||||||
|
padding: 10px;
|
||||||
|
margin: 10px 0;
|
||||||
|
border: 1px solid #ddd;
|
||||||
|
border-radius: 8px;
|
||||||
|
box-sizing: border-box;
|
||||||
|
font-size: 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.login-form .code-container {
|
||||||
|
display: flex;
|
||||||
|
gap: 10px;
|
||||||
|
margin: 10px 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.login-form .hint-text {
|
||||||
|
font-size: 12px;
|
||||||
|
color: #666;
|
||||||
|
margin-top: 3px;
|
||||||
|
margin-bottom: 3px;
|
||||||
|
text-align: left;
|
||||||
|
}
|
||||||
|
|
||||||
|
.login-form .code-input {
|
||||||
|
flex: 3;
|
||||||
|
padding: 10px;
|
||||||
|
border: 1px solid #ddd;
|
||||||
|
border-radius: 8px;
|
||||||
|
box-sizing: border-box;
|
||||||
|
font-size: 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.login-form .send-code-btn {
|
||||||
|
flex: 1;
|
||||||
|
min-width: 95px;
|
||||||
|
padding: 0 8px;
|
||||||
|
background-color: #3498db;
|
||||||
|
color: white;
|
||||||
|
border: none;
|
||||||
|
border-radius: 8px;
|
||||||
|
cursor: pointer;
|
||||||
|
font-size: 14px;
|
||||||
|
transition: background-color 0.3s ease;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.login-form .send-code-btn:hover {
|
||||||
|
background-color: #2980b9;
|
||||||
|
}
|
||||||
|
|
||||||
|
.login-form .send-code-btn:disabled {
|
||||||
|
background-color: #95a5a6;
|
||||||
|
cursor: not-allowed;
|
||||||
|
}
|
||||||
|
|
||||||
|
.login-form button {
|
||||||
|
width: 100%;
|
||||||
|
padding: 10px;
|
||||||
|
background-color: #3498db;
|
||||||
|
color: white;
|
||||||
|
border: none;
|
||||||
|
border-radius: 8px;
|
||||||
|
cursor: pointer;
|
||||||
|
margin-top: 12px;
|
||||||
|
font-size: 16px;
|
||||||
|
transition: background-color 0.3s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.login-form button:hover {
|
||||||
|
background-color: #2980b9;
|
||||||
|
}
|
||||||
|
|
||||||
|
.close {
|
||||||
|
float: right;
|
||||||
|
cursor: pointer;
|
||||||
|
font-size: 24px;
|
||||||
|
color: #666;
|
||||||
|
transition: color 0.3s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.close:hover {
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Message modal styles */
|
||||||
|
.message-modal {
|
||||||
|
display: none;
|
||||||
|
position: fixed;
|
||||||
|
z-index: 1001;
|
||||||
|
left: 0;
|
||||||
|
top: 0;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
background-color: rgba(0,0,0,0.5);
|
||||||
|
}
|
||||||
|
|
||||||
|
.message-content {
|
||||||
|
background-color: #fefefe;
|
||||||
|
margin: 15% auto;
|
||||||
|
padding: 20px;
|
||||||
|
border: 1px solid #888;
|
||||||
|
width: 400px;
|
||||||
|
border-radius: 15px;
|
||||||
|
box-shadow: 0 4px 8px rgba(0,0,0,0.1);
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.message-content h3 {
|
||||||
|
margin: 0 0 15px 0;
|
||||||
|
color: #333;
|
||||||
|
font-size: 18px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.message-content p {
|
||||||
|
margin: 15px 0;
|
||||||
|
color: #666;
|
||||||
|
line-height: 1.5;
|
||||||
|
white-space: pre-line;
|
||||||
|
}
|
||||||
|
|
||||||
|
.message-content .success {
|
||||||
|
color: #27ae60;
|
||||||
|
}
|
||||||
|
|
||||||
|
.message-content .error {
|
||||||
|
color: #e74c3c;
|
||||||
|
}
|
||||||
|
|
||||||
|
.message-btn {
|
||||||
|
background-color: #3498db;
|
||||||
|
color: white;
|
||||||
|
border: none;
|
||||||
|
border-radius: 8px;
|
||||||
|
padding: 10px 20px;
|
||||||
|
cursor: pointer;
|
||||||
|
font-size: 14px;
|
||||||
|
margin-top: 10px;
|
||||||
|
transition: background-color 0.3s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.message-btn:hover {
|
||||||
|
background-color: #2980b9;
|
||||||
|
}
|
||||||
|
|
||||||
|
.close-message {
|
||||||
|
float: right;
|
||||||
|
cursor: pointer;
|
||||||
|
font-size: 24px;
|
||||||
|
color: #666;
|
||||||
|
transition: color 0.3s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.close-message:hover {
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Download button styles */
|
||||||
|
.download-btn {
|
||||||
|
font-size: 12px !important;
|
||||||
|
padding: 6px 12px !important;
|
||||||
|
min-height: auto !important;
|
||||||
|
line-height: 1.2 !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.download-btn.loading {
|
||||||
|
pointer-events: none;
|
||||||
|
opacity: 0.7;
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
.download-btn.loading::after {
|
||||||
|
content: "";
|
||||||
|
position: absolute;
|
||||||
|
width: 12px;
|
||||||
|
height: 12px;
|
||||||
|
top: 50%;
|
||||||
|
left: 50%;
|
||||||
|
margin-left: -6px;
|
||||||
|
margin-top: -6px;
|
||||||
|
border: 2px solid #ffffff;
|
||||||
|
border-radius: 50%;
|
||||||
|
border-top-color: transparent;
|
||||||
|
animation: button-loading-spinner 1s ease infinite;
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes button-loading-spinner {
|
||||||
|
from {
|
||||||
|
transform: rotate(0turn);
|
||||||
|
}
|
||||||
|
to {
|
||||||
|
transform: rotate(1turn);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<!-- Message modal -->
|
||||||
|
<div id="messageModal" class="message-modal">
|
||||||
|
<div class="message-content">
|
||||||
|
<span class="close-message">×</span>
|
||||||
|
<h3 id="messageTitle">Notice</h3>
|
||||||
|
<p id="messageText"></p>
|
||||||
|
<button id="messageBtn" class="message-btn">OK</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="loginModal" class="login-modal">
|
||||||
|
<div class="login-content">
|
||||||
|
<span class="close" onclick="closeLoginModal()">×</span>
|
||||||
|
<h2>Phaten Cloud Login/Register</h2>
|
||||||
|
<form id="loginForm" class="login-form">
|
||||||
|
<input type="email" id="email" placeholder="Enter your email" required>
|
||||||
|
<div class="code-container">
|
||||||
|
<input type="text" id="verificationCode" class="code-input" placeholder="Enter verification code" required>
|
||||||
|
<button type="button" id="sendCodeBtn" class="send-code-btn">Send Code</button>
|
||||||
|
</div>
|
||||||
|
<div class="hint-text">(Auto register on first login)</div>
|
||||||
|
<button type="submit">Submit</button>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
// Avoid duplicate declarations, use immediately invoked function to create scope
|
||||||
|
(function() {
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
// Define API base URL
|
||||||
|
const baseUrl = 'https://api.phaten-audio.com/api';
|
||||||
|
|
||||||
|
// Get modal elements
|
||||||
|
const modal = document.getElementById("loginModal");
|
||||||
|
const loginForm = document.getElementById("loginForm");
|
||||||
|
const sendCodeBtn = document.getElementById("sendCodeBtn");
|
||||||
|
const emailInput = document.getElementById("email");
|
||||||
|
let countdownTimer;
|
||||||
|
|
||||||
|
// Get message modal elements
|
||||||
|
const messageModal = document.getElementById("messageModal");
|
||||||
|
const messageTitle = document.getElementById("messageTitle");
|
||||||
|
const messageText = document.getElementById("messageText");
|
||||||
|
const messageBtn = document.getElementById("messageBtn");
|
||||||
|
const closeMessage = document.getElementsByClassName("close-message")[0];
|
||||||
|
|
||||||
|
// Show custom message modal
|
||||||
|
function showMessage(title, text, type = 'info') {
|
||||||
|
messageTitle.textContent = title;
|
||||||
|
messageText.textContent = text;
|
||||||
|
|
||||||
|
// Set style based on type
|
||||||
|
messageText.className = type === 'success' ? 'success' : (type === 'error' ? 'error' : '');
|
||||||
|
|
||||||
|
messageModal.style.display = "block";
|
||||||
|
}
|
||||||
|
|
||||||
|
// Close message modal
|
||||||
|
function closeMessageModal() {
|
||||||
|
messageModal.style.display = "none";
|
||||||
|
}
|
||||||
|
|
||||||
|
// Bind message modal close events
|
||||||
|
closeMessage.onclick = closeMessageModal;
|
||||||
|
messageBtn.onclick = closeMessageModal;
|
||||||
|
|
||||||
|
// Add login modal close button
|
||||||
|
function closeLoginModal() {
|
||||||
|
console.log("User closed login modal");
|
||||||
|
modal.style.display = "none";
|
||||||
|
|
||||||
|
// Clear pending download URL since user cancelled login
|
||||||
|
const pendingUrl = sessionStorage.getItem('pendingDownloadUrl');
|
||||||
|
if (pendingUrl) {
|
||||||
|
console.log("Clear pending download URL:", pendingUrl);
|
||||||
|
sessionStorage.removeItem('pendingDownloadUrl');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Restore download button state
|
||||||
|
const downloadBtn = document.getElementById('designDownloadBtn');
|
||||||
|
if (downloadBtn) {
|
||||||
|
downloadBtn.classList.remove('loading');
|
||||||
|
downloadBtn.innerHTML = 'Download';
|
||||||
|
console.log("Restore download button state");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Click outside message modal to close (only close message modal, not login modal)
|
||||||
|
window.addEventListener('click', function(event) {
|
||||||
|
if (event.target == messageModal) {
|
||||||
|
closeMessageModal();
|
||||||
|
}
|
||||||
|
// Click outside login modal can also close it
|
||||||
|
if (event.target == modal) {
|
||||||
|
closeLoginModal();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// Check if token exists in local storage
|
||||||
|
function getLocalToken() {
|
||||||
|
return localStorage.getItem('ftyToken');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Save token to local storage
|
||||||
|
function saveToken(token) {
|
||||||
|
localStorage.setItem('ftyToken', token);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Clear token
|
||||||
|
function clearToken() {
|
||||||
|
localStorage.removeItem('ftyToken');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Validate if token is valid
|
||||||
|
async function validateToken() {
|
||||||
|
const token = getLocalToken();
|
||||||
|
console.log("validateToken function called, token:", token);
|
||||||
|
|
||||||
|
if (!token) {
|
||||||
|
console.log("No token, return false");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
console.log("Sending token validation request...");
|
||||||
|
const response = await fetch(`${baseUrl}/fty/validateToken`, {
|
||||||
|
method: 'POST',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
'Authorization': `Bearer ${token}`
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
const data = await response.json();
|
||||||
|
console.log("Token validation server response:", data);
|
||||||
|
|
||||||
|
const isValid = data.data && data.data.valid === true;
|
||||||
|
console.log("Is token valid:", isValid);
|
||||||
|
|
||||||
|
// If token is invalid, clear local storage
|
||||||
|
if (!isValid) {
|
||||||
|
console.log("Token invalid, clear local storage");
|
||||||
|
clearToken();
|
||||||
|
}
|
||||||
|
|
||||||
|
return isValid;
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Token validation error:', error);
|
||||||
|
console.log("Token validation error, clear local storage");
|
||||||
|
clearToken();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check login status
|
||||||
|
async function checkLogin(downloadUrl = null) {
|
||||||
|
// Get trigger button and add loading state
|
||||||
|
const downloadBtn = document.getElementById('designDownloadBtn');
|
||||||
|
if (downloadBtn) {
|
||||||
|
downloadBtn.classList.add('loading');
|
||||||
|
downloadBtn.innerHTML = '...';
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
// Check if token is valid
|
||||||
|
console.log("Start validating token...");
|
||||||
|
const token = getLocalToken();
|
||||||
|
console.log("Local token:", token);
|
||||||
|
|
||||||
|
const isLoggedIn = await validateToken();
|
||||||
|
|
||||||
|
console.log("Validation result isLoggedIn:", isLoggedIn);
|
||||||
|
|
||||||
|
if (!isLoggedIn) {
|
||||||
|
// If not logged in, save download link and show login modal
|
||||||
|
if (downloadUrl) {
|
||||||
|
sessionStorage.setItem('pendingDownloadUrl', downloadUrl);
|
||||||
|
if (modal) {
|
||||||
|
modal.style.display = "block";
|
||||||
|
} else {
|
||||||
|
console.error("Modal element not found!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// If logged in, start download directly
|
||||||
|
if (downloadUrl) {
|
||||||
|
if (downloadBtn) {
|
||||||
|
downloadBtn.innerHTML = 'Downloading...';
|
||||||
|
}
|
||||||
|
window.location.href = downloadUrl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error("Login verification error:", error);
|
||||||
|
} finally {
|
||||||
|
// Restore button state (if not redirected)
|
||||||
|
if (downloadBtn && !downloadBtn.innerHTML.includes('Downloading')) {
|
||||||
|
setTimeout(() => {
|
||||||
|
downloadBtn.classList.remove('loading');
|
||||||
|
downloadBtn.innerHTML = 'Download';
|
||||||
|
}, 500);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Send verification code
|
||||||
|
sendCodeBtn.onclick = function() {
|
||||||
|
const contactValue = emailInput.value;
|
||||||
|
|
||||||
|
if (!validateEmail(contactValue)) {
|
||||||
|
showMessage('Input Error', 'Please enter a valid email address!', 'error');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Disable button and start countdown
|
||||||
|
startCountdown();
|
||||||
|
|
||||||
|
// Send AJAX request to get verification code
|
||||||
|
fetch(`${baseUrl}/fty/sendCode`, {
|
||||||
|
method: 'POST',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
},
|
||||||
|
body: JSON.stringify({
|
||||||
|
type: "1", // Fixed as email type
|
||||||
|
username: contactValue
|
||||||
|
})
|
||||||
|
})
|
||||||
|
.then(response => response.json())
|
||||||
|
.then(data => {
|
||||||
|
if (data.success) {
|
||||||
|
showMessage('Send Success', 'Verification code has been sent to your email!', 'success');
|
||||||
|
} else {
|
||||||
|
showMessage('Send Failed', data.msg || 'Failed to send verification code, please try again later!', 'error');
|
||||||
|
resetCountdown();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch(error => {
|
||||||
|
console.error('Error:', error);
|
||||||
|
showMessage('Network Error', 'Failed to send verification code request, please try again later!', 'error');
|
||||||
|
resetCountdown();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// Validate email format
|
||||||
|
function validateEmail(email) {
|
||||||
|
const re = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
|
||||||
|
return re.test(String(email).toLowerCase());
|
||||||
|
}
|
||||||
|
|
||||||
|
// Start countdown
|
||||||
|
function startCountdown() {
|
||||||
|
let countdown = 60;
|
||||||
|
sendCodeBtn.disabled = true;
|
||||||
|
sendCodeBtn.textContent = `Retry after ${countdown}s`;
|
||||||
|
|
||||||
|
countdownTimer = setInterval(() => {
|
||||||
|
countdown--;
|
||||||
|
sendCodeBtn.textContent = `Retry after ${countdown}s`;
|
||||||
|
|
||||||
|
if (countdown <= 0) {
|
||||||
|
resetCountdown();
|
||||||
|
}
|
||||||
|
}, 1000);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Reset countdown
|
||||||
|
function resetCountdown() {
|
||||||
|
clearInterval(countdownTimer);
|
||||||
|
sendCodeBtn.disabled = false;
|
||||||
|
sendCodeBtn.textContent = 'Send Code';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Handle login form submission
|
||||||
|
loginForm.onsubmit = function(e) {
|
||||||
|
console.log("Form submitted");
|
||||||
|
e.preventDefault();
|
||||||
|
const verificationCode = document.getElementById("verificationCode").value;
|
||||||
|
const contactValue = emailInput.value;
|
||||||
|
|
||||||
|
// Send AJAX request
|
||||||
|
fetch(`${baseUrl}/fty/login`, {
|
||||||
|
method: 'POST',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
},
|
||||||
|
body: JSON.stringify({
|
||||||
|
type: "1", // Fixed as email type
|
||||||
|
username: contactValue,
|
||||||
|
code: verificationCode
|
||||||
|
})
|
||||||
|
})
|
||||||
|
.then(response => response.json())
|
||||||
|
.then(data => {
|
||||||
|
console.log("Login response", data);
|
||||||
|
if (data.code==2000) {
|
||||||
|
// Save token to local storage
|
||||||
|
if (data.data.token) {
|
||||||
|
saveToken(data.data.token);
|
||||||
|
}
|
||||||
|
|
||||||
|
showMessage('Login Success', 'Login successful!', 'success');
|
||||||
|
// Close modal after successful login
|
||||||
|
modal.style.display = "none";
|
||||||
|
resetCountdown();
|
||||||
|
|
||||||
|
// Check if there's a pending download link
|
||||||
|
const pendingDownloadUrl = sessionStorage.getItem('pendingDownloadUrl');
|
||||||
|
if (pendingDownloadUrl) {
|
||||||
|
sessionStorage.removeItem('pendingDownloadUrl');
|
||||||
|
|
||||||
|
// Delay a bit before redirect to let user see success message
|
||||||
|
setTimeout(() => {
|
||||||
|
if (downloadBtn) {
|
||||||
|
downloadBtn.innerHTML = 'Downloading...';
|
||||||
|
}
|
||||||
|
window.location.href = pendingDownloadUrl;
|
||||||
|
}, 1500);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
showMessage('Login Failed', data.msg || 'Login failed, please check email and verification code!', 'error');
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch(error => {
|
||||||
|
console.error('Error:', error);
|
||||||
|
showMessage('Network Error', 'Login request failed, please try again later!', 'error');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// ESC key to close login modal
|
||||||
|
document.addEventListener('keydown', function(event) {
|
||||||
|
if (event.key === 'Escape' && modal.style.display === 'block') {
|
||||||
|
console.log("User pressed ESC to close login modal");
|
||||||
|
closeLoginModal();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// Auto validate token when page loads
|
||||||
|
document.addEventListener('DOMContentLoaded', async function() {
|
||||||
|
// Auto check login status (but don't auto show login modal)
|
||||||
|
await validateToken();
|
||||||
|
|
||||||
|
// Additional check if modal element is correctly obtained
|
||||||
|
console.log("Page loaded, modal element:", modal);
|
||||||
|
});
|
||||||
|
|
||||||
|
// Expose globally accessible functions to window object
|
||||||
|
window.checkLogin = checkLogin;
|
||||||
|
window.closeLoginModal = closeLoginModal;
|
||||||
|
|
||||||
|
})(); // End of immediately invoked function
|
||||||
|
</script>
|
||||||
@@ -1,27 +1,258 @@
|
|||||||
|
<style>
|
||||||
|
.message-modal {
|
||||||
|
display: none;
|
||||||
|
position: fixed;
|
||||||
|
z-index: 1000;
|
||||||
|
left: 0;
|
||||||
|
top: 0;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
background-color: rgba(0,0,0,0.5);
|
||||||
|
}
|
||||||
|
|
||||||
|
.message-content {
|
||||||
|
background-color: #fefefe;
|
||||||
|
margin: 15% auto;
|
||||||
|
padding: 20px;
|
||||||
|
border: 1px solid #888;
|
||||||
|
width: 400px;
|
||||||
|
border-radius: 15px;
|
||||||
|
box-shadow: 0 4px 8px rgba(0,0,0,0.1);
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.message-content h3 {
|
||||||
|
margin: 0 0 15px 0;
|
||||||
|
color: #333;
|
||||||
|
font-size: 18px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.message-content p {
|
||||||
|
margin: 15px 0;
|
||||||
|
color: #666;
|
||||||
|
line-height: 1.5;
|
||||||
|
white-space: pre-line;
|
||||||
|
}
|
||||||
|
|
||||||
|
.message-content .success {
|
||||||
|
color: #27ae60;
|
||||||
|
}
|
||||||
|
|
||||||
|
.message-content .error {
|
||||||
|
color: #e74c3c;
|
||||||
|
}
|
||||||
|
|
||||||
|
.message-btn {
|
||||||
|
background-color: #3498db;
|
||||||
|
color: white;
|
||||||
|
border: none;
|
||||||
|
border-radius: 8px;
|
||||||
|
padding: 10px 20px;
|
||||||
|
cursor: pointer;
|
||||||
|
font-size: 14px;
|
||||||
|
margin-top: 10px;
|
||||||
|
transition: background-color 0.3s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.message-btn:hover {
|
||||||
|
background-color: #2980b9;
|
||||||
|
}
|
||||||
|
|
||||||
|
.close-message {
|
||||||
|
float: right;
|
||||||
|
cursor: pointer;
|
||||||
|
font-size: 24px;
|
||||||
|
color: #666;
|
||||||
|
transition: color 0.3s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.close-message:hover {
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<!-- Message Modal -->
|
||||||
|
<div id="messageModal" class="message-modal">
|
||||||
|
<div class="message-content">
|
||||||
|
<span class="close-message">×</span>
|
||||||
|
<h3 id="messageTitle">Notice</h3>
|
||||||
|
<p id="messageText"></p>
|
||||||
|
<button id="messageBtn" class="message-btn">OK</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="custForm">
|
<div class="custForm">
|
||||||
<form action="http://ftyyyyy.xyz/submit _en.php" method="post">
|
<form id="customerForm">
|
||||||
<div>
|
<div>
|
||||||
<h4>Company:</h4>
|
<h4>Company Name:</h4>
|
||||||
<input type="input" name='company' placeholder="Company" />
|
<input type="input" id="company" name='company' placeholder="Company Name" />
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<h4>Email:</h4>
|
<h4>Email Address:</h4>
|
||||||
<input type="input" name='email' placeholder="email" />
|
<input type="email" id="email" name='email' placeholder="Email Address" />
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<h4>Topic:</h4>
|
<h4>Subject:</h4>
|
||||||
<select name='topic'>
|
<select id="topic" name='topic'>
|
||||||
<option>Product Solution</option>
|
<option value="">Please select a subject</option>
|
||||||
<option>Product Price</option>
|
<option value="Get Product Firmware">Get Product Firmware</option>
|
||||||
|
<option value="Consult Solutions">Consult Solutions</option>
|
||||||
|
<option value="Get Quote">Get Quote</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<h4>Content:</h4>
|
<h4>Message:</h4>
|
||||||
<textarea name="content" rows="8" placeholder="Description detail">
|
<textarea id="content" name="content" rows="8" placeholder="Please describe your question in detail">
|
||||||
</textarea>
|
</textarea>
|
||||||
</div>
|
</div>
|
||||||
<div style="text-align: right;">
|
<div style="text-align: right;">
|
||||||
<input class="button" type="submit" value="Submit" />
|
<input class="button" type="submit" value="Send" id="submitBtn" />
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
// Define API base URL
|
||||||
|
const baseUrl = 'https://api.phaten-audio.com/api';
|
||||||
|
|
||||||
|
// Get form elements
|
||||||
|
const customerForm = document.getElementById("customerForm");
|
||||||
|
const submitBtn = document.getElementById("submitBtn");
|
||||||
|
const companyInput = document.getElementById("company");
|
||||||
|
const emailInput = document.getElementById("email");
|
||||||
|
const topicSelect = document.getElementById("topic");
|
||||||
|
const contentTextarea = document.getElementById("content");
|
||||||
|
|
||||||
|
// Get message modal elements
|
||||||
|
const messageModal = document.getElementById("messageModal");
|
||||||
|
const messageTitle = document.getElementById("messageTitle");
|
||||||
|
const messageText = document.getElementById("messageText");
|
||||||
|
const messageBtn = document.getElementById("messageBtn");
|
||||||
|
const closeMessage = document.getElementsByClassName("close-message")[0];
|
||||||
|
|
||||||
|
// Show custom message modal
|
||||||
|
function showMessage(title, text, type = 'info') {
|
||||||
|
messageTitle.textContent = title;
|
||||||
|
messageText.textContent = text;
|
||||||
|
|
||||||
|
// Set style based on type
|
||||||
|
messageText.className = type === 'success' ? 'success' : (type === 'error' ? 'error' : '');
|
||||||
|
|
||||||
|
messageModal.style.display = "block";
|
||||||
|
}
|
||||||
|
|
||||||
|
// Close message modal
|
||||||
|
function closeMessageModal() {
|
||||||
|
messageModal.style.display = "none";
|
||||||
|
}
|
||||||
|
|
||||||
|
// Bind close events
|
||||||
|
closeMessage.onclick = closeMessageModal;
|
||||||
|
messageBtn.onclick = closeMessageModal;
|
||||||
|
|
||||||
|
// Close modal when clicking outside
|
||||||
|
window.onclick = function(event) {
|
||||||
|
if (event.target == messageModal) {
|
||||||
|
closeMessageModal();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Validate email format
|
||||||
|
function validateEmail(email) {
|
||||||
|
const re = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
|
||||||
|
return re.test(String(email).toLowerCase());
|
||||||
|
}
|
||||||
|
|
||||||
|
// Validate form fields
|
||||||
|
function validateForm() {
|
||||||
|
let isValid = true;
|
||||||
|
let errorMessage = "";
|
||||||
|
|
||||||
|
// Validate company name
|
||||||
|
if (!companyInput.value.trim()) {
|
||||||
|
errorMessage += "Please enter company name\n";
|
||||||
|
isValid = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Validate email
|
||||||
|
if (!emailInput.value.trim()) {
|
||||||
|
errorMessage += "Please enter email address\n";
|
||||||
|
isValid = false;
|
||||||
|
} else if (!validateEmail(emailInput.value.trim())) {
|
||||||
|
errorMessage += "Please enter a valid email address\n";
|
||||||
|
isValid = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Validate subject
|
||||||
|
if (!topicSelect.value) {
|
||||||
|
errorMessage += "Please select a subject\n";
|
||||||
|
isValid = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Validate message content
|
||||||
|
if (!contentTextarea.value.trim()) {
|
||||||
|
errorMessage += "Please fill in the message content\n";
|
||||||
|
isValid = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!isValid) {
|
||||||
|
showMessage('Input Error', errorMessage, 'error');
|
||||||
|
}
|
||||||
|
|
||||||
|
return isValid;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Handle form submission
|
||||||
|
customerForm.onsubmit = function(event) {
|
||||||
|
// Prevent default form submission behavior
|
||||||
|
event.preventDefault();
|
||||||
|
|
||||||
|
// Validate form
|
||||||
|
if (!validateForm()) {
|
||||||
|
console.log('Form validation failed');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Disable submit button
|
||||||
|
submitBtn.disabled = true;
|
||||||
|
submitBtn.value = "Submitting...";
|
||||||
|
|
||||||
|
// Prepare submission data
|
||||||
|
const formData = {
|
||||||
|
company: companyInput.value.trim(),
|
||||||
|
email: emailInput.value.trim(),
|
||||||
|
topic: topicSelect.value,
|
||||||
|
content: contentTextarea.value.trim()
|
||||||
|
};
|
||||||
|
|
||||||
|
// Send AJAX request
|
||||||
|
fetch(`${baseUrl}/fty/addNewConsult`, {
|
||||||
|
method: 'POST',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
},
|
||||||
|
body: JSON.stringify(formData)
|
||||||
|
})
|
||||||
|
.then(response => response.json()) // Parse JSON first
|
||||||
|
.then(data => {
|
||||||
|
if (data.code && data.code === 2000) {
|
||||||
|
showMessage('Submit Success', 'Submitted successfully! We will contact you as soon as possible.', 'success');
|
||||||
|
customerForm.reset(); // Clear form
|
||||||
|
topicSelect.value = ""; // Reset dropdown
|
||||||
|
} else {
|
||||||
|
showMessage('Submit Failed', data.msg || 'Submission failed, please try again later!', 'error');
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch(error => {
|
||||||
|
console.error('Error:', error);
|
||||||
|
showMessage('Network Error', 'Request failed, please try again later!', 'error');
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
|
// Restore submit button
|
||||||
|
submitBtn.disabled = false;
|
||||||
|
submitBtn.value = "Send";
|
||||||
|
});
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
</script>
|
||||||
@@ -9,9 +9,10 @@ login: true
|
|||||||
# A316-HF-DAC-V1 USB HiFi Audio Decoder Evaluation Board Design Files
|
# A316-HF-DAC-V1 USB HiFi Audio Decoder Evaluation Board Design Files
|
||||||
|
|
||||||
--8<-- "common/phaten_xmos_support_img.md"
|
--8<-- "common/phaten_xmos_support_img.md"
|
||||||
|
--8<-- "common/checklogin_form.md"
|
||||||
|
|
||||||
| Type | Title | Download |
|
| Type | Title | Download |
|
||||||
|:--------:|:------------------------|:------------------------|
|
|:--------:|:------------------------|:------------------------|
|
||||||
| Schematic | :material-file-document-outline: A316-HF-DAC-V1 Design Schematic PDF | [:material-download:](/assets/download/a316_hf_dac_v1/a316_hf_dac_v1_sch_v1.0.pdf) |
|
| Schematic | :material-file-document-outline: A316-HF-DAC-V1 Design Schematic PDF | <a href="javascript:void(0);" onclick="checkLogin('/assets/download/a316_hf_dac_v1/a316_hf_dac_v1_sch_v1.0.pdf')">:material-download:</a> |
|
||||||
| BOM | :material-file-document-outline: A316-HF-DAC-V1 BOM | [:material-download:](/assets/download/a316_hf_dac_v1/a316_hf_dac_v1_PCBA.xlsx) |
|
| BOM | :material-file-document-outline: A316-HF-DAC-V1 BOM | <a href="javascript:void(0);" onclick="checkLogin('/assets/download/a316_hf_dac_v1/a316_hf_dac_v1_PCBA.xlsx')">:material-download:</a> |
|
||||||
| Component Specifications | :material-file-document-outline: A316-HF-DAC-V1 Component Specifications | [:material-download:](/assets/download/a316_hf_dac_v1/元器件规格书.zip) |
|
| Component Specifications | :material-file-document-outline: A316-HF-DAC-V1 Component Specifications | <a href="javascript:void(0);" onclick="checkLogin('/assets/download/a316_hf_dac_v1/元器件规格书.zip')">:material-download:</a> |
|
||||||
@@ -41,7 +41,7 @@ __USB HiFi Audio Decoder Evaluation Board Supporting USB/SPDIF Input and I2S Out
|
|||||||
|:--------:|:------------------------|:------------------------|
|
|:--------:|:------------------------|:------------------------|
|
||||||
| User Guide | [:material-file-document-outline: A316-HF-DAC-V1 Datasheet](../../dev_doc/evb/a316_hf_dac_v1/user_guide.md) | |
|
| User Guide | [:material-file-document-outline: A316-HF-DAC-V1 Datasheet](../../dev_doc/evb/a316_hf_dac_v1/user_guide.md) | |
|
||||||
| Test Specifications | [:material-file-document-outline: A316-HF-DAC-V1 Test Specifications](../../dev_doc/evb/a316_hf_dac_v1/test_spec.md) | |
|
| Test Specifications | [:material-file-document-outline: A316-HF-DAC-V1 Test Specifications](../../dev_doc/evb/a316_hf_dac_v1/test_spec.md) | |
|
||||||
| Design Materials | :material-file-document-outline: A316-HF-DAC-V1 Design Materials(../../dev_doc/evb/a316_hf_dac_v1/design_files.md) | |
|
| Design Materials | [:material-file-document-outline: A316-HF-DAC-V1 Design Materials](../../dev_doc/evb/a316_hf_dac_v1/design_files.md) | |
|
||||||
| Product Configuration Protocol | [:material-file-document-outline: XU316 USB HiFi Decoder Standard Product Configuration Protocol](../../dev_doc/protocols/xu316_zerocode_protocol.md) | [:material-download:] |
|
| Product Configuration Protocol | [:material-file-document-outline: XU316 USB HiFi Decoder Standard Product Configuration Protocol](../../dev_doc/protocols/xu316_zerocode_protocol.md) | [:material-download:] |
|
||||||
|
|
||||||
|
|
||||||
|
|||||||