Files
learning-system-portal/src/views/new-employee/WelcomePage.vue
2025-11-19 16:40:57 +08:00

364 lines
8.6 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<template>
<div class="welcome" v-loading="enrollLoading">
<p class="top-title">欢迎来到京东方大学</p>
<!-- 内容卡片 -->
<div class="main">
<div class="row">
<div class="col-md-6">
<img
class="img-responsive wel_img"
src="@/assets/images/new-employee/wel.png"
alt=""
/>
</div>
<div class="col-md-6">
<!-- 桌面端显示 -->
<div class="right-font visible-lg-block visible-md-block">
<p class="greeting">{{ userInfo.name }}您好!</p>
<p>欢迎加入京东方科技集团股份有限公司</p>
<p>从这一刻起你就是这个大家庭里的一份子</p>
<p>在这里我们干事业交朋友长本领练胸怀!</p>
<p>为了帮你快速融入BOE我们为你准备了丰富的入职培训课程!</p>
<p>快开始学习吧!</p>
</div>
<!-- 移动端显示 -->
<div class="right-font-sm visible-xs-block">
<p>{{ userInfo.name }}您好</p>
<p>欢迎加入京东方</p>
<p>为了帮你快速融入BOE</p>
<P>我们为你准备了丰富的入职培训课程</P>
<p>快开始学习吧</p>
</div>
<div class="col-md-12 send_btn">
<button
v-if="approvalResults == '1' || approvalResults == '4'"
class="btn btn-default btn-lg send center-block start-btn"
:disabled="enrollLoading"
@click="handleEnrollClick"
>
报名社招新员工项目
</button>
<button
v-else
class="btn btn-default btn-lg send center-block start-btn"
:disabled="enrollLoading"
@click="handleEnrollClick"
>
开启学习之旅
</button>
<p
style="
color: #ffe551;
font-size: 14px;
font-family: '黑体';
margin-top: 20px;
"
>
温馨提示仅社招新员工可以报名校招新员工和其他员工请不要点击
</p>
</div>
</div>
</div>
</div>
<!-- 学习引导页面 -->
<!-- <NewEmployeeGuideDialog
:visible.sync="infoConfirmDialogVisible"
:processing="processing"
:onConfirm="handleConfirm"
:onCancel="() => (infoConfirmDialogVisible = false)"
@close="handleDialogClose"
/> -->
<!-- 自定义信息提示 -->
<CustomErrorMessage ref="customMessage" />
</div>
</template>
<script>
import { mapGetters } from "vuex";
import { getWelcomeData, enrollRequest } from "@/api/new-employee/newEmployee";
import NewEmployeeGuideDialog from "@/components/NewEmployeeGuideDialog.vue";
import CustomErrorMessage from "@/components/CustomErrorMessage.vue";
export default {
name: "WelcomePage",
components: { NewEmployeeGuideDialog, CustomErrorMessage },
data() {
return {
userName: "",
projectId: "",
approvalResults: 1,
processing: false,
confirmBtnText: "确认",
infoConfirmDialogVisible: false,
enrollLoading: false,
};
},
computed: {
// 如果需要使用Vuex中的用户信息
...mapGetters(["userInfo"]),
},
mounted() {
this.initPageData();
},
methods: {
// 初始化页面数据
async initPageData() {
try {
// 从后端获取用户信息和报名状态
const res = await getWelcomeData();
if (res.status === 200 && res.data) {
this.userName = res.data.studentName;
// 1报名失败、2审核中、3审核通过、4审核失败
if (res.data.approvalResults) {
this.approvalResults = res.data.approvalResults;
if (res.data.approvalResults != 1) {
this.$router.push("/new-employee/study");
}
}
}
} catch (error) {
console.error("初始化数据失败:", error);
}
},
// 报名按钮点击
async handleEnrollClick() {
if (this.approvalResults == "1" || this.approvalResults == "4") {
this.enrollLoading = true;
try {
const res = await enrollRequest();
if (res.data.data.sendToOaSuccess != 0) {
this.$refs.customMessage.show(
"报名失败请稍后重试如果再次失败请联系XXXX联系方式XXXX。"
);
} else {
this.$router.push("/new-employee/study?fromWelcome=1");
}
} catch (error) {
console.error("报名请求失败:", error);
this.$refs.customMessage.show(
"报名失败请稍后重试如果再次失败请联系XXXX联系方式XXXX。"
);
} finally {
this.enrollLoading = false;
}
} else {
this.$router.push("/new-employee/study?fromWelcome=1");
}
},
// 确认按钮
// async handleConfirm() {
// try {
// this.$router.push("/new-employee/study");
// } catch (error) {
// console.error("提交失败:", error);
// this.processing = false;
// this.confirmBtnText = "确认";
// this.$message.error("提交失败,请重试");
// }
// },
// 关闭对话框
handleDialogClose() {
this.processing = false;
this.confirmBtnText = "确认";
},
},
};
</script>
<style scoped>
/* 欢迎页面样式 */
.welcome {
min-height: 100vh;
background: #2e5aa6;
display: flex;
flex-direction: column;
align-items: center;
}
/* 顶部标题 */
.top-title {
/* 左移整个屏幕的1/4 */
font-size: 48px;
font-weight: bold;
color: white;
text-align: center;
margin: 40px 20px 60px;
font-family: "Microsoft YaHei", sans-serif;
text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
margin-left: -25%;
}
/* 主内容卡片 */
.welcome .main {
background: #2e5aa6;
border-radius: 10px;
padding: 50px 40px;
max-width: 1200px;
width: 100%;
}
/* 自定义栅格系统 */
.welcome .main .row {
display: flex;
flex-wrap: wrap;
margin: 0 -15px;
}
.welcome .main .col-md-6 {
position: relative;
width: 100%;
padding: 0 15px;
flex: 0 0 50%;
max-width: 50%;
}
.welcome .main .col-md-12 {
position: relative;
width: 100%;
padding: 0 15px;
flex: 0 0 100%;
max-width: 100%;
}
.wel_img {
max-width: 100%;
height: auto;
margin: 0 auto;
display: block;
}
/* 右侧文字区域 */
.right-font {
padding: 20px 0;
}
.right-font .greeting {
font-size: 20px;
font-weight: bold;
color: white;
margin-bottom: 15px;
font-family: "Microsoft YaHei", sans-serif;
}
.right-font p {
font-size: 18px;
line-height: 2;
color: white;
margin-bottom: 10px;
font-family: "Microsoft YaHei", sans-serif;
}
.right-font-sm p {
font-size: 16px;
line-height: 1.8;
color: white;
margin-bottom: 8px;
font-family: "Microsoft YaHei", sans-serif;
}
.send_btn {
margin-top: 30px;
text-align: center;
}
.start-btn {
/* background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); */
background: #2e5aa6;
border: 5px solid #6e88b5;
color: white;
padding: 15px 50px;
font-size: 20px;
border-radius: 4px;
cursor: pointer;
transition: all 0.3s ease;
/* box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4); */
}
.start-btn:hover {
transform: translateY(-2px);
/* box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
background: linear-gradient(135deg, #764ba2 0%, #667eea 100%); */
}
.start-btn:active {
transform: translateY(0);
}
.start-btn:disabled {
opacity: 0.6;
cursor: not-allowed;
transform: none;
}
.start-btn:disabled:hover {
transform: none;
}
/* 响应式样式 */
@media (max-width: 768px) {
.top-title {
font-size: 32px;
margin-bottom: 30px;
}
.welcome {
padding: 40px 15px 30px;
}
.welcome .main {
padding: 30px 20px;
}
.welcome .main .col-md-6 {
flex: 0 0 100%;
max-width: 100%;
margin-bottom: 20px;
}
.right-font p {
font-size: 16px;
}
.start-btn {
padding: 12px 30px;
font-size: 18px;
}
}
/* 显示/隐藏控制 */
.visible-lg-block,
.visible-md-block,
.visible-xs-block {
display: block;
}
@media (max-width: 767px) {
.visible-lg-block,
.visible-md-block {
display: none !important;
}
}
@media (min-width: 768px) and (max-width: 991px) {
.visible-xs-block {
display: none !important;
}
}
@media (min-width: 992px) {
.visible-xs-block {
display: none !important;
}
}
/* Loading遮罩层透明度 */
.welcome ::v-deep .el-loading-mask {
background-color: rgba(255, 255, 255, 0.5) !important;
}
</style>