mirror of
https://github.com/certd/certd.git
synced 2026-07-08 21:57:36 +08:00
perf: 优化邀请注册流程
This commit is contained in:
@@ -107,6 +107,9 @@ function install(app: App, options: any = {}) {
|
||||
scroll: {
|
||||
x: 960,
|
||||
},
|
||||
rowSelection: {
|
||||
fixed: "left",
|
||||
},
|
||||
size: "small",
|
||||
pagination: false,
|
||||
onResizeColumn: (w: number, col: any) => {
|
||||
|
||||
@@ -389,7 +389,7 @@ export const certdResources = [
|
||||
meta: {
|
||||
show: () => {
|
||||
const settingStore = useSettingStore();
|
||||
return settingStore.isComm;
|
||||
return settingStore.isInviteCommissionEnabled;
|
||||
},
|
||||
icon: "ion:gift-outline",
|
||||
auth: true,
|
||||
|
||||
@@ -136,12 +136,12 @@ export const useUserStore = defineStore({
|
||||
} catch (e) {
|
||||
console.error("注销登录请求失败:", e);
|
||||
}
|
||||
// 第三方登录注销
|
||||
this.oauthLogout();
|
||||
}
|
||||
|
||||
this.resetState();
|
||||
resetAllStores();
|
||||
// 第三方登录注销
|
||||
await this.oauthLogout();
|
||||
goLogin && router.push("/login");
|
||||
mitter.emit("app.logout");
|
||||
},
|
||||
|
||||
@@ -300,7 +300,7 @@ async function handleTabChange() {
|
||||
}
|
||||
|
||||
async function refreshInvitePage(autoOpenAgreement = true) {
|
||||
await settingStore.initOnce();
|
||||
await settingStore.init();
|
||||
enabled.value = settingStore.isInviteCommissionEnabled;
|
||||
loaded.value = true;
|
||||
if (!enabled.value) {
|
||||
|
||||
@@ -26,13 +26,14 @@ export async function OauthToken(type: string, validationCode: string) {
|
||||
});
|
||||
}
|
||||
|
||||
export async function AutoRegister(type: string, code: string) {
|
||||
export async function AutoRegister(type: string, code: string, inviteCode?: string) {
|
||||
return await request({
|
||||
url: apiPrefix + `/autoRegister`,
|
||||
method: "post",
|
||||
data: {
|
||||
validationCode: code,
|
||||
type,
|
||||
inviteCode,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
@@ -29,6 +29,7 @@ import { useRoute, useRouter } from "vue-router";
|
||||
import { useUserStore } from "/@/store/user";
|
||||
import { notification } from "ant-design-vue";
|
||||
import { useSettingStore } from "/@/store/settings";
|
||||
import { inviteUtils } from "/@/utils/util.invite";
|
||||
|
||||
const route = useRoute();
|
||||
const router = useRouter();
|
||||
@@ -99,7 +100,7 @@ async function goBindUser() {
|
||||
|
||||
async function autoRegister() {
|
||||
//自动注册账号
|
||||
const res = await api.AutoRegister(oauthType, bindCode.value);
|
||||
const res = await api.AutoRegister(oauthType, bindCode.value, inviteUtils.get());
|
||||
//登录成功
|
||||
userStore.onLoginSuccess(res);
|
||||
//跳转到首页
|
||||
|
||||
@@ -215,6 +215,8 @@ export default defineComponent({
|
||||
|
||||
const handleFinish = async (values: any) => {
|
||||
try {
|
||||
//先注销登录
|
||||
userStore.resetState();
|
||||
await userStore.register(
|
||||
toRaw({
|
||||
type: registerType.value,
|
||||
|
||||
Reference in New Issue
Block a user