diff --git a/YI_LIUYANG b/YI_LIUYANG index 60f67ed..339c6d3 100644 --- a/YI_LIUYANG +++ b/YI_LIUYANG @@ -1,7 +1,7 @@ -----BEGIN OPENSSH PRIVATE KEY----- b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAAAMwAAAAtzc2gtZW -QyNTUxOQAAACA20GNyqm4LjDk1gVVnW1B8LnWw8pbZdDCwI+5wU4ishgAAAJAhuzaBIbs2 -gQAAAAtzc2gtZWQyNTUxOQAAACA20GNyqm4LjDk1gVVnW1B8LnWw8pbZdDCwI+5wU4ishg +QyNTUxOQAAACA20GNyqm4LjDk1gVVnW1B8LnWw8pbZdDCwI+5wU4ishgAAAJDh6vD44erw ++AAAAAtzc2gtZWQyNTUxOQAAACA20GNyqm4LjDk1gVVnW1B8LnWw8pbZdDCwI+5wU4ishg AAAECr8W4FkpVwEtReeKxc7PoSe3q089fPxreRPvGDI3+o9TbQY3KqbguMOTWBVWdbUHwu dbDyltl0MLAj7nBTiKyGAAAACllJX0xJVVlBTkcBAgM= -----END OPENSSH PRIVATE KEY----- diff --git a/src/components/Login.vue b/src/components/Login.vue index 8d5349a..682dade 100644 --- a/src/components/Login.vue +++ b/src/components/Login.vue @@ -26,7 +26,8 @@ {{ countdown !== null ? `${countdown} 秒后重新发送` : '获取验证码' }} - +
@@ -80,29 +81,29 @@ export default { }; // 获取来源页面的域名 - const getReferer = () => { - let ref = document.referrer; - console.log('refref:', ref); - // 处理开发和生产环境 - if (!ref) { - if (process.env.NODE_ENV === 'development') { - ref = 'https://www.ycymedu.com'; // 开发环境默认值 - } else { - console.log('当前是生产环境'); - window.location.href = "https://www.ycymedu.com"; // 生产环境重定向 - } - } else { - try { - const url = new URL(ref); - console.log('url:', url); - referer.value = url.origin; // 存储来源网址的域名部分 + const getReferer = () => { + let ref = document.referrer; + console.log('refref:', ref); + // 处理开发和生产环境 + if (!ref) { + if (process.env.NODE_ENV === 'development') { + ref = 'https://www.ycymedu.com'; // 开发环境默认值 + } else { + console.log('当前是生产环境'); + window.location.href = "https://www.ycymedu.com"; // 生产环境重定向 + } + } else { + try { + const url = new URL(ref); + console.log('url:', url); + referer.value = url.origin; // 存储来源网址的域名部分 - - } catch (error) { - console.error('解析来源网址时出错:', error); - } - } -}; + + } catch (error) { + console.error('解析来源网址时出错:', error); + } + } + }; // 微信扫码登录初始化 @@ -143,50 +144,32 @@ export default { // 模拟发送验证码 const sendVerificationCode = () => { - if (isPhoneValid.value) { - // 发送验证码请求 - axios.post('https://api.sso.ycymedu.com/api/syssms/sendsms', { - phoneNumber: phone.value - }) - .then(response => { - if(response.data.code === '200'){ - console.log('验证码发送成功:', response.data); - startCountdown(); // 开始倒计时 - }else{ - console.log('验证码发送失败:', response.data); - phoneError.value = response.data.message; - } + if (isPhoneValid.value) { + // 发送验证码请求 + axios.post('https://api.sso.ycymedu.com/api/syssms/sendsms', { + phoneNumber: phone.value }) - .catch(error => { - console.error('发送验证码失败:', error); - phoneError.value = '发送验证码失败,请稍后再试'; - }); - } - }; + .then(response => { + if (response.data.code === '200') { + console.log('验证码发送成功:', response.data); + startCountdown(); // 开始倒计时 + } else { + console.log('验证码发送失败:', response.data); + phoneError.value = response.data.message; + } + }) + .catch(error => { + console.error('发送验证码失败:', error); + phoneError.value = '发送验证码失败,请稍后再试'; + }); + } + }; // 校验验证码 const isVerificationCodeValid = computed(() => { if (!verificationCode.value) { verificationCodeError.value = '请输入验证码'; return false; } - axios.post('https://api.sso.ycymedu.com/api/syswechat/smslogin', { - phoneNumber: phone.value, - code:verificationCode.value, - redirect_uri:referer.value - }) - .then(response => { - if(response.data.code === '200'){ - console.log('验证码发送成功:', response.data); - startCountdown(); // 开始倒计时 - }else{ - console.log('验证码发送失败:', response.data); - phoneError.value = response.data.message; - } - }) - .catch(error => { - console.error('发送验证码失败:', error); - phoneError.value = '发送验证码失败,请稍后再试'; - }); verificationCodeError.value = ''; // 清除错误信息 return true; }); @@ -250,17 +233,47 @@ export default { // 登录函数 const login = () => { - if (selectedTab.value === 'password') { - if (!isUsernameValid.value) { - alert('请检查手机号'); - return; - } - if (!isPasswordValid.value) { - alert('请检查密码'); - return; - } - alert('账号密码登录功能尚未实现'); + + switch (selectedTab.value) { + case 'wechat': + // 微信扫码登录 + break; + case 'password': + if (!isUsernameValid.value) { + alert('请检查手机号'); + return; + } + if (!isPasswordValid.value) { + alert('请检查密码'); + return; + } + alert('账号密码登录功能尚未实现'); + // 账号密码登录 + break; + case 'phone': + axios.post('https://api.sso.ycymedu.com/api/syswechat/smslogin', { + phoneNumber: phone.value, + code: verificationCode.value, + redirect_uri: referer.value + }) + .then(response => { + if (response.data.code === '200') { + console.log('验证码发送成功:', response.data); + startCountdown(); // 开始倒计时 + } else { + console.log('验证码发送失败:', response.data); + phoneError.value = response.data.message; + } + }) + .catch(error => { + console.error('发送验证码失败:', error); + phoneError.value = '发送验证码失败,请稍后再试'; + }); + break; } + + + }; return { @@ -411,11 +424,11 @@ button:disabled { /* 水平居中 */ } -.error-message { - color: red; - font-size: 12px; - margin-top: -10px; - margin-bottom: 10px; -} + .error-message { + color: red; + font-size: 12px; + margin-top: -10px; + margin-bottom: 10px; + } }