|
|
@@ -1,53 +1,62 @@
|
|
|
<template>
|
|
|
<!-- 登录页面 -->
|
|
|
<div class="login-content">
|
|
|
+ <!-- 背景图容器 -->
|
|
|
+ <div
|
|
|
+ class="bg-image-container"
|
|
|
+ :style="{ backgroundImage: `url(${BGImages})`, backgroundSize: 'cover' }"
|
|
|
+ ></div>
|
|
|
<!-- 登录输入框 -->
|
|
|
- <div class="login-input">
|
|
|
- <el-form
|
|
|
- ref="loginFormRef"
|
|
|
- :model="loginData.loginForm"
|
|
|
- :rules="rules"
|
|
|
- label-width="0px"
|
|
|
- class="input-item"
|
|
|
- >
|
|
|
- <el-form-item prop="tenantName">
|
|
|
- <el-input
|
|
|
- v-model="loginData.loginForm.tenantName"
|
|
|
- :prefix-icon="HomeFilled"
|
|
|
- placeholder="租户"
|
|
|
- />
|
|
|
- </el-form-item>
|
|
|
- <el-form-item prop="username">
|
|
|
- <el-input
|
|
|
- v-model="loginData.loginForm.username"
|
|
|
- :prefix-icon="Avatar"
|
|
|
- placeholder="账号"
|
|
|
- />
|
|
|
- </el-form-item>
|
|
|
- <el-form-item prop="password">
|
|
|
- <el-input
|
|
|
- v-model="loginData.loginForm.password"
|
|
|
- type="password"
|
|
|
- :prefix-icon="Lock"
|
|
|
- placeholder="密码"
|
|
|
- show-password
|
|
|
- />
|
|
|
- </el-form-item>
|
|
|
- <!-- 多选框 -->
|
|
|
- <div class="check-box">
|
|
|
- <el-checkbox
|
|
|
- v-model="loginData.loginForm.rememberMe"
|
|
|
- label="记住我"
|
|
|
- size="large"
|
|
|
- />
|
|
|
- <a href="javascript:;" class="forgot-password">忘记密码?</a>
|
|
|
- </div>
|
|
|
+ <div class="login-wrapper">
|
|
|
+ <div class="login-input">
|
|
|
+ <span>AI课程</span>
|
|
|
+ <el-form
|
|
|
+ ref="loginFormRef"
|
|
|
+ :model="loginData.loginForm"
|
|
|
+ :rules="rules"
|
|
|
+ label-width="0px"
|
|
|
+ class="input-item"
|
|
|
+ >
|
|
|
+ <el-form-item prop="tenantName">
|
|
|
+ <el-input
|
|
|
+ v-model="loginData.loginForm.tenantName"
|
|
|
+ :prefix-icon="HomeFilled"
|
|
|
+ placeholder="租户"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item prop="username">
|
|
|
+ <el-input
|
|
|
+ v-model="loginData.loginForm.username"
|
|
|
+ :prefix-icon="Avatar"
|
|
|
+ placeholder="账号"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item prop="password">
|
|
|
+ <el-input
|
|
|
+ v-model="loginData.loginForm.password"
|
|
|
+ type="password"
|
|
|
+ :prefix-icon="Lock"
|
|
|
+ placeholder="密码"
|
|
|
+ show-password
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+
|
|
|
|
|
|
- <!-- 登录按钮 -->
|
|
|
- <el-form-item>
|
|
|
- <el-button type="primary" @click="handleLogin">登录</el-button>
|
|
|
- </el-form-item>
|
|
|
- </el-form>
|
|
|
+ <!-- 登录按钮 -->
|
|
|
+ <el-form-item>
|
|
|
+ <el-button type="primary" @click="handleLogin">登录</el-button>
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+ <!-- 多选框 -->
|
|
|
+ <div class="check-box">
|
|
|
+ <el-checkbox
|
|
|
+ v-model="loginData.loginForm.rememberMe"
|
|
|
+ label="记住我"
|
|
|
+ size="large"
|
|
|
+ />
|
|
|
+ <a href="javascript:;" class="forgot-password">忘记密码?</a>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
</div>
|
|
|
</template>
|
|
|
@@ -58,6 +67,9 @@ import { useRouter } from 'vue-router'
|
|
|
import { HomeFilled, Avatar, Lock } from '@element-plus/icons-vue'
|
|
|
import { getTenantIdByName, login } from '@/api/login/login.js'
|
|
|
import { ElLoading, ElMessage } from 'element-plus'
|
|
|
+
|
|
|
+import BGImages from '@/assets/images/homeBG.png'
|
|
|
+
|
|
|
const router = useRouter()
|
|
|
|
|
|
const loginFormRef = ref(null)
|
|
|
@@ -130,7 +142,7 @@ const handleLogin = async params => {
|
|
|
localStorage.setItem('isLoggedIn', 'true')
|
|
|
localStorage.setItem('token', res.data.accessToken)
|
|
|
localStorage.setItem('userName', loginData.value.loginForm.username)
|
|
|
-
|
|
|
+
|
|
|
// 根据账号类型设置可查看的课程小节数
|
|
|
if (loginData.value.loginForm.username === 'aiTest') {
|
|
|
localStorage.setItem('maxCourseSections', '5')
|
|
|
@@ -138,7 +150,7 @@ const handleLogin = async params => {
|
|
|
localStorage.setItem('maxCourseSections', 'all')
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
loading.value = ElLoading.service({
|
|
|
lock: true,
|
|
|
text: '正在加载系统中...',
|
|
|
@@ -170,8 +182,6 @@ onMounted(() => {
|
|
|
router.push('/home')
|
|
|
}
|
|
|
})
|
|
|
-
|
|
|
-
|
|
|
</script>
|
|
|
|
|
|
<style scoped lang="scss">
|
|
|
@@ -186,75 +196,89 @@ onMounted(() => {
|
|
|
left: 0;
|
|
|
right: 0;
|
|
|
bottom: 0;
|
|
|
- background: linear-gradient(to bottom, #001169, #8a78d0);
|
|
|
display: flex;
|
|
|
- flex-direction: column;
|
|
|
- gap: rpx(0);
|
|
|
+ flex-direction: row; // 修改为水平布局
|
|
|
+}
|
|
|
+.bg-image-container {
|
|
|
+ flex: 3; // 背景图占比为 3
|
|
|
+ background-size: cover;
|
|
|
+ background-position: center;
|
|
|
+}
|
|
|
+
|
|
|
+.login-wrapper {
|
|
|
+ flex: 1; // 登录框占比为 1
|
|
|
+ background: linear-gradient(to bottom, #001169, #8a78d0);
|
|
|
+ padding: 20px;
|
|
|
+ position: static;
|
|
|
+ transform: none;
|
|
|
+ display: flex; // 添加 Flexbox 布局
|
|
|
+ justify-content: center; // 水平居中
|
|
|
+ align-items: center; // 垂直居中
|
|
|
}
|
|
|
.login-input {
|
|
|
- width: rpx(210);
|
|
|
+ width: rpx(190);
|
|
|
height: rpx(240);
|
|
|
- margin: auto;
|
|
|
display: flex;
|
|
|
- border-radius: rpx(10);
|
|
|
- background-color: rgb(255, 255, 255, 0.3);
|
|
|
- border: 1px white solid;
|
|
|
- box-shadow: 0 8px 8px rgb(0, 0, 0, 0.3);
|
|
|
+ justify-content: center; // 水平居中
|
|
|
+ align-items: center; // 垂直居中
|
|
|
+ flex-direction: column; // 子元素垂直排列
|
|
|
+ text-align: center; // 文本居中
|
|
|
+}
|
|
|
+.login-input span{
|
|
|
+ color: white;
|
|
|
+ font-size: rpx(11);
|
|
|
+ padding-bottom: rpx(5);
|
|
|
+ letter-spacing: rpx(1);
|
|
|
}
|
|
|
.input-item {
|
|
|
- margin: auto;
|
|
|
+ display: flex;
|
|
|
+ flex-direction: column; // 子元素垂直排列
|
|
|
+ justify-content: center; // 内容垂直居中
|
|
|
+ align-items: center; // 内容水平居中
|
|
|
+}
|
|
|
+.el-input ::v-deep(.el-input__wrapper){
|
|
|
+ border-radius: rpx(5);
|
|
|
}
|
|
|
.input-item .el-form-item {
|
|
|
margin-bottom: 0;
|
|
|
}
|
|
|
.input-item .el-input {
|
|
|
- width: rpx(180);
|
|
|
- height: rpx(18);
|
|
|
+ width: rpx(150);
|
|
|
+ height: rpx(22);
|
|
|
margin-bottom: rpx(15);
|
|
|
+ font-size: rpx(7);
|
|
|
}
|
|
|
.el-form-item ::v-deep(.el-form-item__error) {
|
|
|
top: 0;
|
|
|
padding-top: rpx(20);
|
|
|
}
|
|
|
.input-item .el-button {
|
|
|
- width: rpx(180);
|
|
|
- height: rpx(18);
|
|
|
- color: black;
|
|
|
- font-size: rpx(8);
|
|
|
- letter-spacing: rpx(10);
|
|
|
- border-radius: rpx(3);
|
|
|
- margin: auto;
|
|
|
- border: none;
|
|
|
- background: linear-gradient(to bottom, #fee78a, #ffce1b);
|
|
|
- box-shadow: 0 8px 8px rgb(0, 0, 0, 0.2);
|
|
|
-}
|
|
|
-.input-item .el-input {
|
|
|
- width: rpx(180);
|
|
|
- height: rpx(18);
|
|
|
- margin-bottom: rpx(15);
|
|
|
-}
|
|
|
-.input-item .el-button {
|
|
|
- width: rpx(180);
|
|
|
- height: rpx(18);
|
|
|
+ width: rpx(150);
|
|
|
+ height: rpx(20);
|
|
|
color: black;
|
|
|
font-size: rpx(8);
|
|
|
letter-spacing: rpx(10);
|
|
|
- border-radius: rpx(3);
|
|
|
- margin: auto;
|
|
|
+ border-radius: rpx(5);
|
|
|
+ margin: rpx(10) 0 auto;
|
|
|
border: none;
|
|
|
background: linear-gradient(to bottom, #fee78a, #ffce1b);
|
|
|
box-shadow: 0 8px 8px rgb(0, 0, 0, 0.2);
|
|
|
}
|
|
|
.check-box {
|
|
|
- width: rpx(180);
|
|
|
+ width: rpx(150);
|
|
|
height: rpx(18);
|
|
|
- margin: auto;
|
|
|
+ margin: rpx(5) auto;
|
|
|
display: flex;
|
|
|
- justify-content: space-between;
|
|
|
+ justify-content: flex-end;
|
|
|
align-items: center;
|
|
|
}
|
|
|
.check-box .el-checkbox {
|
|
|
color: white;
|
|
|
+ padding-right: rpx(10);
|
|
|
+ font-size: rpx(6);
|
|
|
+}
|
|
|
+.el-checkbox ::v-deep(.el-checkbox__label){
|
|
|
+ font-size: rpx(6);
|
|
|
}
|
|
|
.check-box .forgot-password {
|
|
|
color: white;
|