v3计划内容上传
This commit is contained in:
+4
-4
@@ -7,8 +7,8 @@
|
||||
| App | 端口 | X-Client-App | 负责人 | 原型 |
|
||||
|-----|------|--------------|--------|------|
|
||||
| `h5-user` | 5173 | `USER_H5` | jacy-dukang | `pages/user/` |
|
||||
| `h5-shop` | 5174 | `SHOP_H5` | 刘京尧 | `pages/shop/` |
|
||||
| `h5-partner` | 5175 | `PARTNER_H5` | 刘京尧 | `pages/partner/` |
|
||||
| `h5-shop` | 5174 | `SHOP_H5` | 刘景尧 | `pages/shop/` |
|
||||
| `h5-partner` | 5175 | `PARTNER_H5` | 刘景尧 | `pages/partner/` |
|
||||
| `admin-web` | — | (Admin JWT) | jacy-dukang | preV1 内部 HQ 替代 |
|
||||
|
||||
V2 目标:`mini-user` / `mini-partner` / `mini-hq` 替换对应 H5(除门店仍 H5)。
|
||||
@@ -36,13 +36,13 @@ V2 目标:`mini-user` / `mini-partner` / `mini-hq` 替换对应 H5(除门店
|
||||
|
||||
**勿改**:门店核销确认 UI(属 h5-shop)、合伙人录店(属 h5-partner)
|
||||
|
||||
### h5-shop(刘京尧)
|
||||
### h5-shop(刘景尧)
|
||||
|
||||
主链路:门店登录 → 首页 → 扫码/输入核销 → 确认 → 记录 → 营业状态
|
||||
|
||||
**勿改**:C 端出码页面(属 h5-user)
|
||||
|
||||
### h5-partner(刘京尧)
|
||||
### h5-partner(刘景尧)
|
||||
|
||||
主链路:登录 → 工作台 → 录店 → 门店列表 → 辖区订单 → Mock 推进配送(preV1)
|
||||
|
||||
|
||||
@@ -22,6 +22,7 @@ function WechatOAuthHandler() {
|
||||
|
||||
useEffect(() => {
|
||||
if (!isWechatEnv() || !location.search.includes('code=')) return;
|
||||
if (location.pathname === '/login') return;
|
||||
void handlePartnerWechatCallback()
|
||||
.then((result) => {
|
||||
if (!result || !savePartnerWechatAuth(result)) return;
|
||||
|
||||
@@ -1,6 +1,12 @@
|
||||
import { useState } from 'react';
|
||||
import { useEffect, useState } from 'react';
|
||||
import { Link, useNavigate, useSearchParams } from 'react-router-dom';
|
||||
import { request, saveAuth } from '../lib/api';
|
||||
import {
|
||||
authorizePartnerWechat,
|
||||
handlePartnerWechatCallback,
|
||||
savePartnerWechatAuth,
|
||||
} from '../lib/wechat-auth';
|
||||
import { isWechatEnv } from '../lib/weixin';
|
||||
|
||||
export default function LoginPage() {
|
||||
const navigate = useNavigate();
|
||||
@@ -9,7 +15,21 @@ export default function LoginPage() {
|
||||
const [phone, setPhone] = useState('13700000001');
|
||||
const [code, setCode] = useState('123456');
|
||||
const [loading, setLoading] = useState(false);
|
||||
const [wechatLoading, setWechatLoading] = useState(false);
|
||||
const [codeCooldown, setCodeCooldown] = useState(0);
|
||||
const [msg, setMsg] = useState('');
|
||||
|
||||
useEffect(() => {
|
||||
if (!isWechatEnv()) return;
|
||||
void handlePartnerWechatCallback()
|
||||
.then((result) => {
|
||||
if (!result) return;
|
||||
if (savePartnerWechatAuth(result)) {
|
||||
navigate('/');
|
||||
}
|
||||
})
|
||||
.catch((e) => setMsg(e instanceof Error ? e.message : '微信登录失败'));
|
||||
}, [navigate]);
|
||||
|
||||
async function login() {
|
||||
setLoading(true);
|
||||
@@ -29,6 +49,21 @@ export default function LoginPage() {
|
||||
}
|
||||
}
|
||||
|
||||
async function wechatLogin() {
|
||||
setMsg('');
|
||||
if (!isWechatEnv()) {
|
||||
setMsg('请在微信内打开以使用微信一键登录');
|
||||
return;
|
||||
}
|
||||
setWechatLoading(true);
|
||||
try {
|
||||
await authorizePartnerWechat();
|
||||
} catch (e) {
|
||||
setMsg(e instanceof Error ? e.message : '微信登录失败');
|
||||
setWechatLoading(false);
|
||||
}
|
||||
}
|
||||
|
||||
function sendCode() {
|
||||
if (codeCooldown > 0) return;
|
||||
request('PARTNER_H5', '/partner/auth/sms/send', {
|
||||
@@ -122,10 +157,17 @@ export default function LoginPage() {
|
||||
{!loading && <span className="material-symbols-outlined">arrow_forward</span>}
|
||||
</button>
|
||||
<div className="partner-auth-divider"><span>其他登录方式</span></div>
|
||||
<button type="button" className="partner-btn-outline" style={{ width: '100%', display: 'flex', alignItems: 'center', justifyContent: 'center', gap: 8 }}>
|
||||
<button
|
||||
type="button"
|
||||
className="partner-btn-outline"
|
||||
style={{ width: '100%', display: 'flex', alignItems: 'center', justifyContent: 'center', gap: 8 }}
|
||||
disabled={wechatLoading || loading}
|
||||
onClick={() => void wechatLogin()}
|
||||
>
|
||||
<svg width="24" height="24" viewBox="0 0 24 24" fill="#07C160"><path d="M8.25 4.5C4.52 4.5 1.5 7.04 1.5 10.17c0 1.78.98 3.37 2.5 4.48l-.63 1.88 2.19-1.09c.84.24 1.74.38 2.69.38.25 0 .5 0 .75-.03-.16-.53-.25-1.09-.25-1.66 0-3.13 3.02-5.67 6.75-5.67.57 0 1.13.06 1.66.17C15.17 6.13 12 4.5 8.25 4.5zm10.5 6.33c-3.11 0-5.62 2.12-5.62 4.73 0 2.61 2.51 4.73 5.62 4.73.79 0 1.54-.14 2.24-.38l1.83.91-.53-1.57c1.27-.92 2.08-2.25 2.08-3.73 0-2.61-2.51-4.73-5.62-4.73z" /></svg>
|
||||
微信一键登录
|
||||
{wechatLoading ? '跳转授权中…' : '微信一键登录'}
|
||||
</button>
|
||||
{msg && <p className="partner-form-error" role="alert">{msg}</p>}
|
||||
<label className="partner-checkbox-row">
|
||||
<input type="checkbox" />
|
||||
<span>
|
||||
|
||||
Reference in New Issue
Block a user