-
- {{ $t("login.signUp") }}
-
{{
$t("login.pwsLogin")
@@ -786,8 +600,7 @@
import LangSelect from "@/components/LangSelect/index.vue";
import SvgIcon from "@/components/SvgIcon/index.vue";
import {
- register,
- login,
+ loginApi,
sendRegisterEmail,
getCodeImgUrl,
sendUpdPwdEmailApi,
@@ -848,9 +661,9 @@ const isLogining = ref(false);
const isRegistering = ref(false);
const loginData = ref({
- email: "",
+ username: "",
password: "",
- verifyCode: "",
+ captcha: "",
});
const loginData2 = ref({
@@ -882,6 +695,13 @@ const loginData8 = ref({
invitatioCode: "",
});
const loginRules = ref({
+ username: [
+ {
+ required: true,
+ trigger: "blur",
+ validator: passwordValidator,
+ },
+ ],
email: [
{
required: true,
@@ -894,13 +714,13 @@ const loginRules = ref({
confirmPassword: [
{ required: true, trigger: "blur", validator: confirmPasswordValidator },
],
- verifyCode: [
+ captcha: [
{
required: true,
trigger: "blur",
message:
currentLan.value == "zh-cn"
- ? "请输入验证码"
+ ? "请输入验证码2"
: "Please input verifyCode",
},
],
@@ -928,8 +748,8 @@ const loginRules = ref({
watch(currentLan, (newValue, oldValue) => {
const loginRule = loginRules.value;
- loginRule.verifyCode[0].message =
- newValue == "zh-cn" ? "请输入验证码" : "Please input verifyCode";
+ loginRule.captcha[0].message =
+ newValue == "zh-cn" ? "请输入验证码1" : "Please input verifyCode";
setTimeout(() => {
loginFormRef.value.resetFields();
getInfo();
@@ -973,7 +793,7 @@ function getInfo() {
const deCodeUserInfo = decodeURI(data as any);
const userInfo = JSON.parse(deCodeUserInfo);
if (userInfo) {
- loginData.value.email = userInfo.email ? userInfo.email : "";
+ loginData.value.username = userInfo.email ? userInfo.email : "";
loginData.value.password = userInfo.password ? userInfo.password : "";
}
}
@@ -1096,9 +916,9 @@ function handleLogin() {
loginFormRef.value.validate((val: any) => {
if (val) {
const data = {
- phone: loginData.value.email,
+ username: loginData.value.username,
password: loginData.value.password,
- code: loginData.value.verifyCode,
+ captcha: loginData.value.captcha,
};
isLogining.value = true;
doLogin(data);
@@ -1114,25 +934,6 @@ function handleLogin() {
}
// 注册行为
-function handleRegister() {
- loginFormRef.value.validate((val: any) => {
- if (val) {
- const data = {
- phone: loginData2.value.email,
- password: loginData2.value.password,
- };
- isRegistering.value = true;
- doRegister(data);
- } else {
- const msg =
- currentLan.value == "zh-cn"
- ? "请检查信息格式!"
- : "Please check the format !";
- ElMessage.error(msg);
- return;
- }
- });
-}
//#region 忘记密码 表单3
function sendEmailforgetPwd() {
@@ -1376,33 +1177,6 @@ function getCode() {
});
}
-/**
- * @description:注册
- * @param {Object} data
- * @return: data
- */
-async function doRegister(data: object) {
- const msg =
- currentLan.value == "zh-cn" ? "注册成功!" : "Registered successfully";
- await register(data)
- .then((res) => {
- console.log(res, "res");
- isRegistering.value = false;
- ElMessage.success(msg);
- isLogin.value = 1;
- // 注册成功将账号密码保存到本地
- saveInfo(data);
- router.go(0);
- })
- .catch((err) => {
- // 注册失败刷新验证码
- getCode();
- isRegistering.value = false;
- console.log(err, "err");
- ElMessage.error(err.message);
- });
-}
-
/**
* @description:登录
* @param {Object} data
@@ -1411,7 +1185,7 @@ async function doRegister(data: object) {
async function doLogin(data: any) {
const msg =
currentLan.value == "zh-cn" ? "登录成功!" : "Welcome to Metavatar!";
- await login(data)
+ await loginApi(data)
.then(async (res) => {
console.log(res, "res");
localStorage.setItem("AccessToken", res.data.token);
diff --git a/vite.config.ts b/vite.config.ts
index e0e9a13..db5fba2 100644
--- a/vite.config.ts
+++ b/vite.config.ts
@@ -49,12 +49,17 @@ export default defineConfig(({ mode }: ConfigEnv): UserConfig => {
host: "0.0.0.0",
port: Number(env.VITE_APP_PORT),
open: true, // 运行是否自动打开浏览器
+ // "/api": {
+ // target: env.VITE_APP_BASE_API, // 线上接口地址
+ // changeOrigin: true,
+ // rewrite: (path) => path.replace(/^\/api/, ""),
+ // },
proxy: {
// 反向代理解决跨域
- "/api": {
+ "/A": {
target: env.VITE_APP_BASE_API, // 线上接口地址
changeOrigin: true,
- rewrite: (path) => path.replace(/^\/api/, ""),
+ rewrite: (path) => path.replace(/^\/A/, ""),
},
},
},