更新密码找回uniapp

This commit is contained in:
hero920103 committed 2026-11-16 17:22:50 +08:00
1 parent 7f9a66da0f
commit 3fdda89833
1304 files changed
+3503 -26132

No files matched your search

-26
View File
@@ -41,7 +41,6 @@
.brand h1 { font-size: 22px; font-weight: 700; letter-spacing: 1px; }
.brand p { color: var(--muted); font-size: 13px; margin-top: 6px; }
/* 步骤条 */
.steps { display: flex; align-items: center; justify-content: center; gap: 10px; margin-bottom: 28px; }
.step { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 14px; }
.step .dot {
@@ -59,7 +58,6 @@
.panel.active { display: block; animation: fade .25s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
/* 第一步:方式切换 */
.mode-tabs { display: flex; background: #f2f5fb; border-radius: 12px; padding: 5px; margin-bottom: 22px; }
.mode-tab {
flex: 1; text-align: center; padding: 10px 0; border-radius: 9px;
@@ -100,14 +98,12 @@
.code-btn { min-width: 118px; }
.hint { font-size: 12px; color: var(--muted); margin-top: 4px; line-height: 1.6; }
/* 账号注册二维码区 */
.wechat-box { display: none; text-align: center; margin-bottom: 16px; padding: 16px; border: 1px dashed var(--border); border-radius: 12px; background: #fbfcff; }
.wechat-box.show { display: block; }
.wechat-box img { width: 168px; height: 168px; object-fit: contain; }
.wechat-box .scan-tip { font-size: 13px; color: var(--text-sub); margin-top: 8px; }
.wechat-box .scan-tip.ok { color: #34b96f; font-weight: 600; }
/* 第二步:两个卡片 */
.cards { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 760px) { .cards { grid-template-columns: 1fr; } .auth-card { padding: 28px 20px; } }
.choice-card {
@@ -143,7 +139,6 @@
.foot a { color: var(--primary); text-decoration: none; }
.foot a:hover { text-decoration: underline; }
/* 成功浮层 */
.done-mask { display: none; position: fixed; inset: 0; background: rgba(23,32,54,.45); z-index: 50; align-items: center; justify-content: center; }
.done-mask.show { display: flex; }
.done-box { width: 380px; max-width: 92vw; background: #fff; border-radius: 18px; padding: 32px 28px; text-align: center; }
@@ -172,14 +167,12 @@
<div class="msg msg-err" id="globalMsg"></div>
<!-- ================= 第一步:核验身份 ================= -->
<div class="panel active" id="panelStep1">
<div class="mode-tabs">
<div class="mode-tab on" data-mode="phone">手机号注册</div>
<div class="mode-tab" data-mode="account">账号注册</div>
</div>
<!-- 手机号注册 -->
<div class="mode-pane on" id="panePhone">
<div class="field">
<label>手机号<span class="req">*</span></label>
@@ -203,7 +196,6 @@
<button class="btn btn-primary" id="btnVerifyPhone" type="button">验证并下一步</button>
</div>
<!-- 账号注册 -->
<div class="mode-pane" id="paneAccount">
<div class="field">
<label>账号名<span class="req">*</span></label>
@@ -235,10 +227,8 @@
<div class="foot">已有账号?<a href="/auth/login" id="toLogin">直接登录</a> · <a href="/auth/forgot" id="toForgot">忘记密码</a></div>
</div>
<!-- ================= 第二步:企业归属 ================= -->
<div class="panel" id="panelStep2">
<div class="cards">
<!-- 卡片一:绑定企业 -->
<div class="choice-card">
<h3>🏢 绑定企业</h3>
<div class="desc">你的账号已由企业创建/企业管理员已开通企业,搜索并申请加入,由企业管理员审核。</div>
@@ -253,7 +243,6 @@
<button class="btn btn-primary card-submit" id="btnJoin" type="button" disabled>确定加入</button>
</div>
<!-- 卡片二:创建企业 -->
<div class="choice-card">
<h3>🏗️ 创建企业</h3>
<div class="desc">没有现成企业?填写企业资料创建新企业,由平台审核,通过后你将成为企业管理员。</div>
@@ -282,7 +271,6 @@
</div>
</div>
<!-- 成功浮层 -->
<div class="done-mask" id="doneMask">
<div class="done-box">
<div class="icon">✓</div>
@@ -298,10 +286,8 @@
var CLIENT_ID = app.getAttribute('data-client-id') || '';
var REDIRECT = app.getAttribute('data-redirect') || '';
// wxChannel:微信核验通道,mini=小程序码确认(优先)/ mp=公众号验证码(回退)
var state = { mode: 'phone', token: '', scene: '', qrTimer: null, selectedTid: 0, wxChannel: '' };
// ---------- 工具 ----------
function $(id) { return document.getElementById(id); }
function showMsg(text, ok) {
var el = $('globalMsg');
@@ -341,7 +327,6 @@
$('doneMask').classList.add('show');
}
// ---------- 第一步:方式切换 ----------
document.querySelectorAll('.mode-tab').forEach(function (tab) {
tab.addEventListener('click', function () {
document.querySelectorAll('.mode-tab').forEach(function (t) { t.classList.remove('on'); });
@@ -352,7 +337,6 @@
});
});
// ---------- 手机号注册 ----------
var sendBtn = $('sendPhoneCode'), sendTimer = null;
sendBtn.addEventListener('click', function () {
var phone = $('phone').value.trim();
@@ -392,7 +376,6 @@
});
});
// ---------- 账号注册:微信身份核验(小程序优先,不可用时回退公众号) ----------
$('btnQr').addEventListener('click', function () {
var btn = this; btn.disabled = true;
$('wechatBox').classList.add('show');
@@ -412,7 +395,6 @@
$('scanTip').textContent = tip;
}
// 小程序方案:展示小程序码,用户在小程序内确认后无需填验证码
function startMiniVerify(next) {
fetch('/auth/register/mini/start').then(function (r) { return r.json(); }).then(function (res) {
if (res.code !== 200 || !res.data || !res.data.qr_url) { next(false); return; }
@@ -426,8 +408,6 @@
}).catch(function () { next(false); });
}
// 公众号回退:优先带参二维码;生成失败时展示「关注二维码」,
// 用户扫码关注后在公众号内发送「注册」照样能收到验证码
function startMpVerify(btn) {
fetch('/auth/register/wechat/start').then(function (r) { return r.json(); }).then(function (res) {
btn.disabled = false;
@@ -477,7 +457,6 @@
if (pwd !== pwd2) { showMsg('两次输入的密码不一致'); return; }
if (!state.wxChannel) { showMsg('请先点击「获取二维码」完成微信核验'); return; }
var mini = state.wxChannel === 'mini';
// 小程序通道必须持有已确认的会话;公众号通道允许无 scene(用户手填公众号下发的验证码)
if (mini && !state.scene) { showMsg('请重新获取二维码并在小程序内完成确认'); return; }
if (!mini && !code) { showMsg('请输入公众号下发的验证码(在公众号内发送「注册」获取)'); return; }
var btn = this; btn.disabled = true;
@@ -498,7 +477,6 @@
});
});
// ---------- 第二步:绑定企业 ----------
$('btnSearchTenant').addEventListener('click', function () {
var kw = $('tenantKeyword').value.trim();
if (!kw) { showMsg('请输入企业名称或编码'); return; }
@@ -530,7 +508,6 @@
}).catch(function () { list.innerHTML = '<div class="search-empty">搜索失败,请重试</div>'; });
});
// 第二步提交失败:注册会话过期时退回第一步重新核验(此时账号尚未占用,可重新注册)
function failStep2(res, fallback) {
var msg = (res && res.msg) || fallback || '提交失败';
if (/注册会话已过期|注册会话已失效/.test(msg)) {
@@ -552,7 +529,6 @@
});
});
// ---------- 第二步:创建企业 ----------
$('btnPickFile').addEventListener('click', function () { $('licenseFile').click(); });
$('licenseFile').addEventListener('change', function () {
var f = this.files && this.files[0];
@@ -607,7 +583,6 @@
});
});
// ---------- 暂不加入 ----------
$('btnSkip').addEventListener('click', function () {
if (!confirm('暂不加入企业将直接完成注册,之后可在登录后申请加入。确定吗?')) return;
post('/auth/register/finish', { token: state.token }, function (res) {
@@ -616,7 +591,6 @@
});
});
// 回登录页时透传 client_id/redirect
(function keepOAuthParams() {
if (!CLIENT_ID && !REDIRECT) return;
var suffix = (CLIENT_ID ? 'client_id=' + encodeURIComponent(CLIENT_ID) : '') +