mirror of
https://github.com/songquanpeng/one-api.git
synced 2025-11-17 13:43:42 +08:00
增加微信邀请码功能 升级到one-api最新版代码 0.5.4版本
This commit is contained in:
@@ -18,7 +18,10 @@ const LoginForm = () => {
|
||||
let navigate = useNavigate();
|
||||
const [status, setStatus] = useState({});
|
||||
const logo = getLogo();
|
||||
|
||||
let affCode = new URLSearchParams(window.location.search).get('aff');
|
||||
if (affCode) {
|
||||
localStorage.setItem('aff', affCode);
|
||||
}
|
||||
useEffect(() => {
|
||||
if (searchParams.get('expired')) {
|
||||
showError('未登录或登录已过期,请重新登录!');
|
||||
@@ -37,8 +40,20 @@ const LoginForm = () => {
|
||||
};
|
||||
|
||||
const onSubmitWeChatVerificationCode = async () => {
|
||||
// WeChat 渠道注册也能带上邀请码链接,这里检查是否之前打开过邀请码链接,通过localStorage存储来寻找
|
||||
if (!affCode) {
|
||||
affCode = localStorage.getItem('aff');
|
||||
}
|
||||
// 检查 affCode 是否有值
|
||||
if (affCode) {
|
||||
// 如果有值,拼接到 URL 中
|
||||
var url = `/api/oauth/wechat?code=${inputs.wechat_verification_code}&affCode=${affCode}`;
|
||||
} else {
|
||||
// 如果没有值,不拼接affCode
|
||||
var url = `/api/oauth/wechat?code=${inputs.wechat_verification_code}`;
|
||||
}
|
||||
const res = await API.get(
|
||||
`/api/oauth/wechat?code=${inputs.wechat_verification_code}`
|
||||
url
|
||||
);
|
||||
const { success, message, data } = res.data;
|
||||
if (success) {
|
||||
|
||||
Reference in New Issue
Block a user