|
|
@@ -612,6 +612,7 @@ import { |
|
|
|
doFindInviteCode, |
|
|
|
doUpdateInviteCode, |
|
|
|
} from "@/apis/login"; |
|
|
|
import { getMenuNavApi } from "@/apis/Permission.js"; |
|
|
|
import axios from "axios"; |
|
|
|
// 状态管理依赖 |
|
|
|
|
|
|
@@ -911,28 +912,6 @@ function confirmPasswordValidator5(rule: any, value: any, callback: any) { |
|
|
|
} |
|
|
|
//#endregion ---------------------------- |
|
|
|
|
|
|
|
// 登录行为 |
|
|
|
function handleLogin() { |
|
|
|
loginFormRef.value.validate((val: any) => { |
|
|
|
if (val) { |
|
|
|
const data = { |
|
|
|
username: loginData.value.username, |
|
|
|
password: loginData.value.password, |
|
|
|
captcha: loginData.value.captcha, |
|
|
|
}; |
|
|
|
isLogining.value = true; |
|
|
|
doLogin(data); |
|
|
|
} else { |
|
|
|
const msg = |
|
|
|
currentLan.value == "zh-cn" |
|
|
|
? "请检查信息格式!" |
|
|
|
: "Please check the format !"; |
|
|
|
ElMessage.error(msg); |
|
|
|
return; |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
// 注册行为 |
|
|
|
|
|
|
|
//#region 忘记密码 表单3 |
|
|
@@ -1130,7 +1109,7 @@ async function checkInviteCode() { |
|
|
|
isLogin.value = 8; |
|
|
|
// 有邀请码直接前往我的页面 |
|
|
|
} else if (status == 1) { |
|
|
|
userInfoPinia.getUserInfo(); //保存邮箱到pinia |
|
|
|
// userInfoPinia.getUserInfo(); //保存邮箱到pinia |
|
|
|
ElMessage.success( |
|
|
|
'currentLan.value == "zh-cn" ? "登录成功!" : "Welcome to Metavatar!"' |
|
|
|
); |
|
|
@@ -1152,7 +1131,7 @@ async function handleInvitatioCode() { |
|
|
|
}; |
|
|
|
try { |
|
|
|
const res = await doUpdateInviteCode(data); |
|
|
|
userInfoPinia.getUserInfo(); //保存邮箱到pinia |
|
|
|
// userInfoPinia.getUserInfo(); //保存邮箱到pinia |
|
|
|
ElMessage.success( |
|
|
|
'currentLan.value == "zh-cn" ? "登录成功!" : "Welcome to Metavatar!"' |
|
|
|
); |
|
|
@@ -1182,6 +1161,49 @@ function getCode() { |
|
|
|
* @param {Object} data |
|
|
|
* @return: data |
|
|
|
*/ |
|
|
|
|
|
|
|
/** |
|
|
|
* @description:重新发送邮件 |
|
|
|
* @param {string} email |
|
|
|
* @return: data |
|
|
|
*/ |
|
|
|
async function reSendEmail(email: string) { |
|
|
|
const msg = |
|
|
|
currentLan.value == "zh-cn" |
|
|
|
? "确认信息已发送至您的邮箱,请注意查收!" |
|
|
|
: "An email has been send to you, Please pay attention to confirm !"; |
|
|
|
await sendRegisterEmail(email) |
|
|
|
.then((res) => { |
|
|
|
console.log(res, "res"); |
|
|
|
ElMessage.success(msg); |
|
|
|
}) |
|
|
|
.catch((err) => { |
|
|
|
console.log(err, "err"); |
|
|
|
ElMessage.error(err.message); |
|
|
|
}); |
|
|
|
} |
|
|
|
//#region 新登录 |
|
|
|
// 登录行为 |
|
|
|
function handleLogin() { |
|
|
|
loginFormRef.value.validate((val: any) => { |
|
|
|
if (val) { |
|
|
|
const data = { |
|
|
|
username: loginData.value.username, |
|
|
|
password: loginData.value.password, |
|
|
|
captcha: loginData.value.captcha, |
|
|
|
}; |
|
|
|
isLogining.value = true; |
|
|
|
doLogin(data); |
|
|
|
} else { |
|
|
|
const msg = |
|
|
|
currentLan.value == "zh-cn" |
|
|
|
? "请检查信息格式!" |
|
|
|
: "Please check the format !"; |
|
|
|
ElMessage.error(msg); |
|
|
|
return; |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
async function doLogin(data: any) { |
|
|
|
const msg = |
|
|
|
currentLan.value == "zh-cn" ? "登录成功!" : "Welcome to Metavatar!"; |
|
|
@@ -1191,11 +1213,12 @@ async function doLogin(data: any) { |
|
|
|
// localStorage.setItem("AccessToken", res.data.token); |
|
|
|
// 注册成功将账号密码保存到本地 |
|
|
|
saveInfo(data); |
|
|
|
await getMenuNavFunc(); |
|
|
|
isLogining.value = false; |
|
|
|
// await checkInviteCode(); |
|
|
|
userInfoPinia.getUserInfo(); //保存邮箱到pinia |
|
|
|
// userInfoPinia.getUserInfo(); //保存邮箱到pinia |
|
|
|
ElMessage.success(msg); |
|
|
|
router.push("/createVideo"); |
|
|
|
router.push("/model"); |
|
|
|
}) |
|
|
|
.catch((err) => { |
|
|
|
console.log(err, "err"); |
|
|
@@ -1208,28 +1231,17 @@ async function doLogin(data: any) { |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
//#endregion |
|
|
|
|
|
|
|
/** |
|
|
|
* @description:重新发送邮件 |
|
|
|
* @param {string} email |
|
|
|
* @return: data |
|
|
|
*/ |
|
|
|
async function reSendEmail(email: string) { |
|
|
|
const msg = |
|
|
|
currentLan.value == "zh-cn" |
|
|
|
? "确认信息已发送至您的邮箱,请注意查收!" |
|
|
|
: "An email has been send to you, Please pay attention to confirm !"; |
|
|
|
await sendRegisterEmail(email) |
|
|
|
.then((res) => { |
|
|
|
console.log(res, "res"); |
|
|
|
ElMessage.success(msg); |
|
|
|
}) |
|
|
|
.catch((err) => { |
|
|
|
console.log(err, "err"); |
|
|
|
ElMessage.error(err.message); |
|
|
|
}); |
|
|
|
//#region 获取菜单导航路由 |
|
|
|
async function getMenuNavFunc() { |
|
|
|
try { |
|
|
|
const res = await getMenuNavApi(); |
|
|
|
} catch (error) { |
|
|
|
console.log(error); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
//#endregion -------------------------------- |
|
|
|
onMounted(() => { |
|
|
|
getCode(); |
|
|
|
getInfo(); |
|
|
|