feat: support aff now (close #75)

This commit is contained in:
JustSong
2023-06-17 18:12:58 +08:00
parent eb70b84665
commit c5837c3bb7
11 changed files with 131 additions and 7 deletions

View File

@@ -1,7 +1,7 @@
import React, { useEffect, useState } from 'react';
import { Button, Divider, Form, Header, Image, Message, Modal } from 'semantic-ui-react';
import { Link } from 'react-router-dom';
import { API, copy, showError, showInfo, showSuccess } from '../helpers';
import { API, copy, showError, showInfo, showNotice, showSuccess } from '../helpers';
import Turnstile from 'react-turnstile';
const PersonalSetting = () => {
@@ -45,6 +45,18 @@ const PersonalSetting = () => {
}
};
const getAffLink = async () => {
const res = await API.get('/api/user/aff');
const { success, message, data } = res.data;
if (success) {
let link = `${window.location.origin}/register?aff=${data}`;
await copy(link);
showNotice(`邀请链接已复制到剪切板:${link}`);
} else {
showError(message);
}
};
const bindWeChat = async () => {
if (inputs.wechat_verification_code === '') return;
const res = await API.get(
@@ -110,6 +122,7 @@ const PersonalSetting = () => {
更新个人信息
</Button>
<Button onClick={generateAccessToken}>生成系统访问令牌</Button>
<Button onClick={getAffLink}>复制邀请链接</Button>
<Divider />
<Header as='h3'>账号绑定</Header>
{