Vue组件登录页面,记得修改路径等信息
templatediv classcenterh1登录/注册/h1div classlogondiv :classoverlaylongClassdiv classoverlaylong-Signin v-ifdisplayMode 0h2 classoverlaylongH2登录/h2input typetext placeholder用户名 v-modellogin.usernameinput typepassword placeholder密码 v-modellogin.password autocompletenew-passwordh3 clickresetPassword忘记密码/h3button classinupbutton clicksignUp :disabled!isLoginFormValid登录/button/divdiv classoverlaylong-Signup v-ifdisplayMode 1h2 classoverlaylongH2注册账户/h2input typetext v-modelusername placeholder用户名 inputvalidateUsernamep v-ifusernameError classerror{{ usernameError }}/pinput typepassword v-modelpassword placeholder密码 autocompletenew-password inputvalidatePasswordp v-ifpasswordError classerror{{ passwordError }}/pinput typepassword v-modelconfirmPassword placeholder确认密码 autocompletenew-password inputvalidatePasswordp v-ifconfirmPasswordError classerror{{ confirmPasswordError }}/pbutton classinupbutton clickenroll :disabled!isFormValid注册/button/div/divdiv :classoverlaytitleClassdiv classoverlaytitle-Signin v-ifdisplayMode 0h2 classoverlaytitleH2你好朋友/h2p classoverlaytitleP输入您的个人信息开始与我们同行。/pdiv classbuttongohs clicksignIn注册/div/divdiv classoverlaytitle-Signup v-ifdisplayMode 1h2 classoverlaytitleH2欢迎回来/h2p classoverlaytitleP请使用您的个人信息登录以保持连接。/pdiv classbuttongohs clickfirstLoginpush登录/div/div/div/div/div/templatescriptimport Request from /utils/request;import Cookies from js-cookie;export default {data() {return {overlaylongClass: overlaylong,overlaytitleClass: overlaytitle,displayMode: 0, // 默认显示登录页面username: ,password: ,confirmPassword: ,usernameError: ,passwordError: ,confirmPasswordError: ,login: {username: ,password: },};},computed: {isFormValid() {return !this.usernameError !this.passwordError !this.confirmPasswordError;},isLoginFormValid() {return this.login.username ! this.login.password ! ;}},methods: {signIn() {this.overlaylongClass overlaylongleft;this.overlaytitleClass overlaytitleright;setTimeout(() {this.displayMode 1;}, 200);},firstLoginpush() {this.overlaylongClass overlaylongright;this.overlaytitleClass overlaytitleleft;setTimeout(() {this.displayMode 0;}, 200);},resetPassword() {// 这里可以添加重置密码的逻辑console.log(忘记密码);},signUp() {if (this.login.username || this.login.password ) {this.$message.error(请输入用户名和密码);return;}Request.post(login/loginadmin, {username: this.login.username,password: this.login.password}).then((res) {console.log(res);if (res.data.msg ! 0) {// 登录成功后设置 Cookie 并直接跳转到 /firstpageCookies.set(admin, JSON.stringify(res.data.data));this.$router.push(/firstpage).catch(() {});this.$message.success(登录成功);} else {this.$message.error(用户名或密码错误请重新输入);this.login.username ;this.login.password ;}}).catch((error) {console.error(登录请求失败:, error);this.$message.error(登录请求失败请稍后再试);});},validateUsername() {if (this.username.trim() ) {this.usernameError 用户名不能为空;return;}if (this.username.length 8 || this.username.length 15) {this.usernameError 用户名必须在8到15个字符之间;return;}const regex /^(?.*[a-zA-Z])(?.*\d)[a-zA-Z\d!#$%^*()_\-[\]{};:|,./?]*$/;if (!regex.test(this.username)) {this.usernameError 用户名必须同时包含字母和数字并且可以包含特殊字符;return;}this.usernameError ;},validatePassword() {if (this.password.trim() ) {this.passwordError 密码不能为空;return;}if (this.confirmPassword.trim() ) {this.confirmPasswordError 确认密码不能为空;return;}if (this.password.length 8 || this.password.length 15) {this.passwordError 密码必须在8到15个字符之间;return;}const regex /^(?.*[a-zA-Z])(?.*\d)[a-zA-Z\d!#$%^*()_\-[\]{};:|,./?]*$/;if (!regex.test(this.password)) {this.passwordError 密码必须同时包含字母和数字并且可以包含特殊字符;return;}if (this.password ! this.confirmPassword) {this.confirmPasswordError 密码不一致;return;}this.passwordError ;this.confirmPasswordError ;},enroll() {if (this.isFormValid) {if (this.username this.password ) {this.$notify.error(请输入有效的用户名和密码后再进行注册);} else if (this.username this.password ! ) {this.$notify.error(请输入有效的用户名后再进行注册);} else if (this.username ! this.password ) {this.$notify.error(请输入有效的密码后再进行注册);} else {Request.post(login/enroll, { username: this.username, password: this.password }).then((res) {console.log(res);if (res.data.data 0) {this.$notify.success(注册成功);this.username ;this.password ;this.confirmPassword ;} else if (res.data.data 1) {this.$notify.error(用户已存在);}}).catch((error) {console.error(申请异常, error);this.$message.error(申请异常请稍后再试);});}} else {this.$notify.error(请输入有效的用户名和密码后再次尝试);}}}};/scriptstyle scoped.center {width: 100vw;height: 100vh;display: flex;align-items: center;justify-content: center;flex-direction: column;}h1 {font-size: 30px;color: #333;margin-bottom: 20px;}.error {color: red;font-size: 14px;margin-top: 5px;}.inupbutton:disabled {opacity: 0.5;cursor: not-allowed;}.logon {background-color: #fff;border-radius: 10px;box-shadow: 0 14px 28px rgba(0, 0, 0, 0.25), 0 10px 10px rgba(0, 0, 0, 0.22);width: 768px;max-width: 100%;min-height: 480px;display: flex;overflow: hidden;}.overlaylong {border-radius: 10px 0 0 10px;width: 50%;height: 100%;background-color: #f9f9f9;display: flex;align-items: center;justify-content: center;flex-direction: column;padding: 20px;}.overlaylongleft {border-radius: 0px 10px 10px 0px;width: 50%;height: 100%;background-color: #f9f9f9;transform: translateX(100%);transition: transform 0.6s ease-in-out;display: flex;align-items: center;justify-content: center;flex-direction: column;padding: 20px;}.overlaylongright {border-radius: 10px 0 0 10px;width: 50%;height: 100%;background-color: #f9f9f9;transform: translateX(0%);transition: transform 0.6s ease-in-out;display: flex;align-items: center;justify-content: center;flex-direction: column;padding: 20px;}.overlaytitle {border-radius: 0px 10px 10px 0px;width: 50%;height: 100%;background-color: #29eac4;display: flex;align-items: center;justify-content: center;flex-direction: column;padding: 20px;color: #fff;}.overlaytitleleft {border-radius: 0px 10px 10px 0px;width: 50%;height: 100%;background-color: #29eac4;display: flex;align-items: center;justify-content: center;flex-direction: column;padding: 20px;color: #fff;transform: translateX(0%);transition: transform 0.6s ease-in-out;}.overlaytitleright {border-radius: 0px 10px 10px 0px;width: 50%;height: 100%;background-color: #29eac4;display: flex;align-items: center;justify-content: center;flex-direction: column;padding: 20px;color: #fff;transform: translateX(-100%);transition: transform 0.6s ease-in-out;}.overlaytitleH2 {font-size: 24px;margin-bottom: 10px;}.overlaytitleP {font-size: 16px;margin-bottom: 20px;}.buttongohs {width: 180px;height: 40px;border-radius: 50px;border: 1px solid #fff;color: #fff;font-size: 15px;text-align: center;line-height: 40px;cursor: pointer;}.overlaylongH2 {font-size: 24px;color: #333;margin-bottom: 20px;}input {background-color: #eee;border: none;padding: 12px 15px;margin: 10px 0;width: 240px;border-radius: 5px;font-size: 16px;}h3 {font-size: 14px;margin-top: 10px;cursor: pointer;color: #666;}.inupbutton {background-color: #29eac4;border: none;width: 180px;height: 40px;border-radius: 50px;font-size: 15px;color: #fff;text-align: center;line-height: 40px;margin-top: 30px;cursor: pointer;}/style

相关新闻

优质 Windows 原版镜像资源站点分享,装机运维必备

优质 Windows 原版镜像资源站点分享,装机运维必备

不管是个人电脑重装,还是程序员搭建本地测试环境、运维批量部署虚拟机,干净无修改的系统镜像非常关键。网上大量所谓 “精简版”“优化版” 系统,大多是第三方二次封装。这类系统经常预装各类软件、修改注册表,甚至暗藏后门。虽然…

2026/10/5 6:30:19 阅读更多 →
Maven安装的配置环境正确却在终端命令不显示问题

Maven安装的配置环境正确却在终端命令不显示问题

参考:(2025.1.27)最新版MAVEN的安装和配置教程(超详细)_maven_小梁不秃捏-GitCode 开源社区 再重启电脑试一下

2026/10/5 6:30:19 阅读更多 →
多 JDK 版本安装与自由切换注意事项

多 JDK 版本安装与自由切换注意事项

参考文章一台电脑,如何安装多个JDK版本并保证jdk版本自由切换(多个jdk如何配置环境变量)_可以安装不同版本的jdk吗-CSDN博客这里需要注意的关于 javapath 路径这个路径是甲骨文公司自动加上去的,C:\Program Files (x86)\Common Fi…

2026/10/5 6:30:19 阅读更多 →

最新新闻

DeepSeek房地产获客实战:文本微表情分析与AI话术生成

DeepSeek房地产获客实战:文本微表情分析与AI话术生成

简介:面向房地产营销与自然语言处理技术人员的深度技术方案,基于深度求索(DeepSeek)大模型,系统讲解客户微表情分析与智能话术生成在精准获客中的完整应用。文档全书137页,分为51个大章节,内容从…

2026/10/5 7:12:31 阅读更多 →
VirtualBox与Win11内核隔离冲突:原理、排查与解决方案

VirtualBox与Win11内核隔离冲突:原理、排查与解决方案

最近很多朋友在老版本VirtualBox上栽了跟头:Windows 11明明把VT-x都开了,硬件加速还是灰的;有的直接弹0x80004005,虚拟机一个都起不来;还有人装完VirtualBox,发现“虚拟交换机”和网卡一起消失了。我在帮人…

2026/10/5 7:12:31 阅读更多 →
计算机网络核心考点精讲:从分层模型到TCP/IP与子网划分

计算机网络核心考点精讲:从分层模型到TCP/IP与子网划分

计算机网络这门课,在计算机专业的地位不用我多说了,不管是考研408、期末考,还是大厂面试、日常开发排查问题,它都是“重要且高频”的常客。我这些年带过不少新人,也帮人做过考前突击,发现很多人卡住不是因为…

2026/10/5 7:12:31 阅读更多 →
计算机网络上篇高频考点复习地图:物理层到网络层一次理清

计算机网络上篇高频考点复习地图:物理层到网络层一次理清

如果你正在准备考研、期末或者校招面试,大概都听过这么一句话:计算机网络重要,但容易学“散”。尤其是基本参考书里的“上篇章”,在408、期末卷和面试题里出现的频率都很高,可很多人复习到后面才发现,物理层…

2026/10/5 7:12:31 阅读更多 →
CLion中文乱码排查与解决:源码、编译器、控制台三步统一

CLion中文乱码排查与解决:源码、编译器、控制台三步统一

CLion 跑个printf("你好"),控制台直接吐出一堆火星文,这事估计每个从 Visual Studio 或者老工程迁过来的同学都撞见过。更气人的是网上搜出来的改法五花八门,今天改个编码明天又乱了,尤其 Windows 平台,CLio…

2026/10/5 7:12:31 阅读更多 →
Android Studio乱码详解:从控制台到文件的完整解决方案

Android Studio乱码详解:从控制台到文件的完整解决方案

搞 Android 开发的人,十有八九都遇到过 Android Studio 控制台或文件乱码的问题。不管你是刚装好 IDE 跑第一个 Hello World,还是维护一个老项目到一半,突然发现日志输出全是“锟斤拷”或者“���&#xfff…

2026/10/5 7:11:31 阅读更多 →

日新闻

马斯克杀回智能体战场,Grok 4.5万亿参数撑腰,Cursor接手数字白领项目:用TaoToken统一Key跑通多模型Agent工作流

马斯克杀回智能体战场,Grok 4.5万亿参数撑腰,Cursor接手数字白领项目:用TaoToken统一Key跑通多模型Agent工作流

/* MD / 富文本中的 .toc(含博客园搬家等嵌套结构);.toc-box 在侧栏,不受影响 */#content_views .toc,/* 编辑器常在目录前后插入空 p(:empty 仍占 20px),一并去掉避免顶空隙 */#content_views.markdown_views > p:empty:has(+ .toc),#content_views.markdown_views …

2026/10/5 0:00:22 阅读更多 →
AI编程工具插件机制详解:plugin.json配置与加载失败排查指南

AI编程工具插件机制详解:plugin.json配置与加载失败排查指南

1. 从“plugins”这个词说起:它到底在解决什么问题如果你最近在折腾 AI 编程工具,尤其是 Cursor、Codex CLI、Claude Code 这类带 CLI 的编辑器或命令行助手,那你大概率绕不开一个词——plugins。这个词本身不新鲜,从浏览器到 IDE…

2026/10/5 0:00:23 阅读更多 →
第26课:OpenClaw|日志审计与问题诊断:把日志链路改到 TaoToken 的排查清单

第26课:OpenClaw|日志审计与问题诊断:把日志链路改到 TaoToken 的排查清单

/* MD / 富文本中的 .toc(含博客园搬家等嵌套结构);.toc-box 在侧栏,不受影响 */#content_views .toc,/* 编辑器常在目录前后插入空 p(:empty 仍占 20px),一并去掉避免顶空隙 */#content_views.markdown_views > p:empty:has(+ .toc),#content_views.markdown_views …

2026/10/5 0:00:23 阅读更多 →

周新闻

KT148A语音芯片外挂8002D功放的工程实践指南

KT148A语音芯片外挂8002D功放的工程实践指南

/* MD / 富文本中的 .toc(含博客园搬家等嵌套结构);.toc-box 在侧栏,不受影响 */#content_views .toc,/* 编辑器常在目录前后插入空 p(:empty 仍占 20px),一并去掉避免顶空隙 */#content_views.markdown_views > p:empty:has(+ .toc),#content_views.markdown_views …

2026/10/5 5:06:42 阅读更多 →
LLC谐振变换器增益公式推导:从FHA等效到完整归一化表达式

LLC谐振变换器增益公式推导:从FHA等效到完整归一化表达式

/* MD / 富文本中的 .toc(含博客园搬家等嵌套结构);.toc-box 在侧栏,不受影响 */#content_views .toc,/* 编辑器常在目录前后插入空 p(:empty 仍占 20px),一并去掉避免顶空隙 */#content_views.markdown_views > p:empty:has(+ .toc),#content_views.markdown_views …

2026/10/5 1:10:22 阅读更多 →
ARM架构深度解析:从RISC设计理念到交叉编译实战

ARM架构深度解析:从RISC设计理念到交叉编译实战

/* MD / 富文本中的 .toc(含博客园搬家等嵌套结构);.toc-box 在侧栏,不受影响 */#content_views .toc,/* 编辑器常在目录前后插入空 p(:empty 仍占 20px),一并去掉避免顶空隙 */#content_views.markdown_views > p:empty:has(+ .toc),#content_views.markdown_views …

2026/10/5 3:06:17 阅读更多 →

月新闻

我发现了一个新思路:用 Remotion + Claude Code 像写代码一样自动化生成短视频

我发现了一个新思路:用 Remotion + Claude Code 像写代码一样自动化生成短视频

/* MD / 富文本中的 .toc(含博客园搬家等嵌套结构);.toc-box 在侧栏,不受影响 */#content_views .toc,/* 编辑器常在目录前后插入空 p(:empty 仍占 20px),一并去掉避免顶空隙 */#content_views.markdown_views > p:empty:has(+ .toc),#content_views.markdown_views …

2026/10/4 11:40:45 阅读更多 →
Windows下 Codex 中 Chrome 和 Computer Use 插件不可用问题排查及解决参考方式:TaoToken 统一 Key 配置与验证

Windows下 Codex 中 Chrome 和 Computer Use 插件不可用问题排查及解决参考方式:TaoToken 统一 Key 配置与验证

/* MD / 富文本中的 .toc(含博客园搬家等嵌套结构);.toc-box 在侧栏,不受影响 */#content_views .toc,/* 编辑器常在目录前后插入空 p(:empty 仍占 20px),一并去掉避免顶空隙 */#content_views.markdown_views > p:empty:has(+ .toc),#content_views.markdown_views …

2026/10/4 9:43:54 阅读更多 →
黑夜航拍船只数据集训练YOLOV5模型全流程解析

黑夜航拍船只数据集训练YOLOV5模型全流程解析

/* MD / 富文本中的 .toc(含博客园搬家等嵌套结构);.toc-box 在侧栏,不受影响 */#content_views .toc,/* 编辑器常在目录前后插入空 p(:empty 仍占 20px),一并去掉避免顶空隙 */#content_views.markdown_views > p:empty:has(+ .toc),#content_views.markdown_views …

2026/10/4 20:14:29 阅读更多 →