commit
This commit is contained in:
77
figma_html_page/js/bind-account.js
Normal file
77
figma_html_page/js/bind-account.js
Normal file
@@ -0,0 +1,77 @@
|
||||
let countdown = 0;
|
||||
let timer = null;
|
||||
|
||||
function checkInputs() {
|
||||
const phone = document.getElementById('phoneInput').value;
|
||||
const code = document.getElementById('codeInput').value;
|
||||
const btn = document.getElementById('bindBtn');
|
||||
|
||||
if (phone.length === 11 && code.length >= 4) {
|
||||
btn.style.opacity = '1';
|
||||
} else {
|
||||
btn.style.opacity = '0.6';
|
||||
}
|
||||
}
|
||||
|
||||
function getCode() {
|
||||
const phone = document.getElementById('phoneInput').value;
|
||||
if (phone.length !== 11) {
|
||||
alert('请输入正确的手机号');
|
||||
return;
|
||||
}
|
||||
|
||||
if (countdown > 0) return;
|
||||
|
||||
const loadingOverlay = document.getElementById('loadingOverlay');
|
||||
loadingOverlay.style.display = 'flex';
|
||||
|
||||
setTimeout(() => {
|
||||
loadingOverlay.style.display = 'none';
|
||||
startCountdown();
|
||||
}, 1500);
|
||||
}
|
||||
|
||||
function startCountdown() {
|
||||
countdown = 60;
|
||||
const btn = document.getElementById('getCodeBtn');
|
||||
|
||||
timer = setInterval(() => {
|
||||
countdown--;
|
||||
if (countdown <= 0) {
|
||||
clearInterval(timer);
|
||||
btn.textContent = '获取验证码';
|
||||
btn.style.color = '#333';
|
||||
} else {
|
||||
btn.textContent = `${countdown}s`;
|
||||
btn.style.color = '#999';
|
||||
}
|
||||
}, 1000);
|
||||
}
|
||||
|
||||
function doBind() {
|
||||
const phone = document.getElementById('phoneInput').value;
|
||||
const code = document.getElementById('codeInput').value;
|
||||
|
||||
if (phone.length !== 11) {
|
||||
alert('请输入正确的手机号');
|
||||
return;
|
||||
}
|
||||
|
||||
if (code.length < 4) {
|
||||
alert('请输入验证码');
|
||||
return;
|
||||
}
|
||||
|
||||
const toastOverlay = document.getElementById('toastOverlay');
|
||||
toastOverlay.style.display = 'flex';
|
||||
|
||||
setTimeout(() => {
|
||||
toastOverlay.style.display = 'none';
|
||||
localStorage.setItem('isBound', 'true');
|
||||
window.location.href = 'profile.html';
|
||||
}, 1500);
|
||||
}
|
||||
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
document.getElementById('bindBtn').style.opacity = '0.6';
|
||||
});
|
||||
12
figma_html_page/js/generate-content.js
Normal file
12
figma_html_page/js/generate-content.js
Normal file
@@ -0,0 +1,12 @@
|
||||
function regenerate() {
|
||||
alert('正在重新生成内容...');
|
||||
}
|
||||
|
||||
function publish() {
|
||||
const isLoggedIn = localStorage.getItem('isLoggedIn');
|
||||
if (!isLoggedIn) {
|
||||
window.location.href = 'login.html';
|
||||
} else {
|
||||
alert('发布成功!');
|
||||
}
|
||||
}
|
||||
10
figma_html_page/js/login.js
Normal file
10
figma_html_page/js/login.js
Normal file
@@ -0,0 +1,10 @@
|
||||
function wechatLogin() {
|
||||
localStorage.setItem('isLoggedIn', 'true');
|
||||
localStorage.setItem('userName', '星阿星');
|
||||
localStorage.setItem('userCompany', '北京乐航时代科技有限公司');
|
||||
window.location.href = 'select-product.html';
|
||||
}
|
||||
|
||||
function goPhoneLogin() {
|
||||
window.location.href = 'phone-login.html';
|
||||
}
|
||||
79
figma_html_page/js/phone-login.js
Normal file
79
figma_html_page/js/phone-login.js
Normal file
@@ -0,0 +1,79 @@
|
||||
let countdown = 0;
|
||||
let timer = null;
|
||||
|
||||
function checkInputs() {
|
||||
const phone = document.getElementById('phoneInput').value;
|
||||
const code = document.getElementById('codeInput').value;
|
||||
const btn = document.getElementById('loginBtn');
|
||||
|
||||
if (phone.length === 11 && code.length >= 4) {
|
||||
btn.style.opacity = '1';
|
||||
} else {
|
||||
btn.style.opacity = '0.6';
|
||||
}
|
||||
}
|
||||
|
||||
function getCode() {
|
||||
const phone = document.getElementById('phoneInput').value;
|
||||
if (phone.length !== 11) {
|
||||
alert('请输入正确的手机号');
|
||||
return;
|
||||
}
|
||||
|
||||
if (countdown > 0) return;
|
||||
|
||||
const loadingOverlay = document.getElementById('loadingOverlay');
|
||||
loadingOverlay.style.display = 'flex';
|
||||
|
||||
setTimeout(() => {
|
||||
loadingOverlay.style.display = 'none';
|
||||
startCountdown();
|
||||
}, 1500);
|
||||
}
|
||||
|
||||
function startCountdown() {
|
||||
countdown = 60;
|
||||
const btn = document.getElementById('getCodeBtn');
|
||||
|
||||
timer = setInterval(() => {
|
||||
countdown--;
|
||||
if (countdown <= 0) {
|
||||
clearInterval(timer);
|
||||
btn.textContent = '获取验证码';
|
||||
btn.style.color = '#333';
|
||||
} else {
|
||||
btn.textContent = `${countdown}s`;
|
||||
btn.style.color = '#999';
|
||||
}
|
||||
}, 1000);
|
||||
}
|
||||
|
||||
function doLogin() {
|
||||
const phone = document.getElementById('phoneInput').value;
|
||||
const code = document.getElementById('codeInput').value;
|
||||
|
||||
if (phone.length !== 11) {
|
||||
alert('请输入正确的手机号');
|
||||
return;
|
||||
}
|
||||
|
||||
if (code.length < 4) {
|
||||
alert('请输入验证码');
|
||||
return;
|
||||
}
|
||||
|
||||
const toastOverlay = document.getElementById('toastOverlay');
|
||||
toastOverlay.style.display = 'flex';
|
||||
|
||||
setTimeout(() => {
|
||||
toastOverlay.style.display = 'none';
|
||||
localStorage.setItem('isLoggedIn', 'true');
|
||||
localStorage.setItem('userName', '星阿星');
|
||||
localStorage.setItem('userCompany', '北京乐航时代科技有限公司');
|
||||
window.location.href = 'select-product.html';
|
||||
}, 1500);
|
||||
}
|
||||
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
document.getElementById('loginBtn').style.opacity = '0.6';
|
||||
});
|
||||
62
figma_html_page/js/profile.js
Normal file
62
figma_html_page/js/profile.js
Normal file
@@ -0,0 +1,62 @@
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
loadUserInfo();
|
||||
});
|
||||
|
||||
function loadUserInfo() {
|
||||
const isLoggedIn = localStorage.getItem('isLoggedIn');
|
||||
const userName = localStorage.getItem('userName');
|
||||
const userCompany = localStorage.getItem('userCompany');
|
||||
const isBound = localStorage.getItem('isBound');
|
||||
|
||||
const userAvatar = document.getElementById('userAvatar');
|
||||
const userNameEl = document.getElementById('userName');
|
||||
const accountStatus = document.getElementById('accountStatus');
|
||||
const emptyRecords = document.getElementById('emptyRecords');
|
||||
const recordsGrid = document.getElementById('recordsGrid');
|
||||
|
||||
if (isLoggedIn && userName) {
|
||||
userAvatar.innerHTML = '<img src="https://img.alicdn.com/imgextra/i4/O1CN01Z5paLz1O0zuCC7osS_!!6000000001644-55-tps-83-82.svg" alt="">';
|
||||
|
||||
const userInfo = document.getElementById('userInfo');
|
||||
userInfo.innerHTML = `
|
||||
<div class="avatar" id="userAvatar">
|
||||
<img src="https://img.alicdn.com/imgextra/i4/O1CN01Z5paLz1O0zuCC7osS_!!6000000001644-55-tps-83-82.svg" alt="">
|
||||
</div>
|
||||
<div>
|
||||
<div class="user-name">${userName}</div>
|
||||
<div class="user-company">${userCompany || ''}</div>
|
||||
</div>
|
||||
`;
|
||||
|
||||
if (isBound) {
|
||||
accountStatus.textContent = userName;
|
||||
accountStatus.style.color = '#333';
|
||||
emptyRecords.style.display = 'none';
|
||||
recordsGrid.style.display = 'grid';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function handleAccountClick() {
|
||||
const isBound = localStorage.getItem('isBound');
|
||||
|
||||
if (isBound) {
|
||||
document.getElementById('unbindModal').classList.add('active');
|
||||
} else {
|
||||
window.location.href = 'bind-account.html';
|
||||
}
|
||||
}
|
||||
|
||||
function closeUnbindModal() {
|
||||
document.getElementById('unbindModal').classList.remove('active');
|
||||
}
|
||||
|
||||
function confirmUnbind() {
|
||||
localStorage.removeItem('isBound');
|
||||
closeUnbindModal();
|
||||
|
||||
document.getElementById('accountStatus').textContent = '未绑定';
|
||||
document.getElementById('accountStatus').style.color = '#999';
|
||||
document.getElementById('emptyRecords').style.display = 'flex';
|
||||
document.getElementById('recordsGrid').style.display = 'none';
|
||||
}
|
||||
35
figma_html_page/js/select-product.js
Normal file
35
figma_html_page/js/select-product.js
Normal file
@@ -0,0 +1,35 @@
|
||||
let selectedProducts = [];
|
||||
|
||||
function toggleSelect(card) {
|
||||
const productId = card.dataset.id;
|
||||
|
||||
if (card.classList.contains('selected')) {
|
||||
card.classList.remove('selected');
|
||||
selectedProducts = selectedProducts.filter(id => id !== productId);
|
||||
} else {
|
||||
card.classList.add('selected');
|
||||
selectedProducts.push(productId);
|
||||
}
|
||||
}
|
||||
|
||||
function goGenerate() {
|
||||
if (selectedProducts.length === 0) {
|
||||
showToast();
|
||||
return;
|
||||
}
|
||||
localStorage.setItem('selectedProducts', JSON.stringify(selectedProducts));
|
||||
window.location.href = 'generate-content.html';
|
||||
}
|
||||
|
||||
function goToProfile() {
|
||||
window.location.href = 'profile.html';
|
||||
}
|
||||
|
||||
function showToast() {
|
||||
const overlay = document.getElementById('toastOverlay');
|
||||
overlay.style.display = 'flex';
|
||||
|
||||
setTimeout(() => {
|
||||
overlay.style.display = 'none';
|
||||
}, 2000);
|
||||
}
|
||||
Reference in New Issue
Block a user