You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
173 lines
4.0 KiB
173 lines
4.0 KiB
<template>
|
|
<div class="login-container">
|
|
<!-- 顶部标题栏 -->
|
|
<div class="header">
|
|
<div>你好, <br />欢迎使用移风</div>
|
|
</div>
|
|
<!-- 登录表单 -->
|
|
<div class="form-box">
|
|
<!-- 企业名称输入框 -->
|
|
<div class="input-box">
|
|
<img class="input-icon" src="../assets/user.png" />
|
|
<van-field
|
|
class="input-field"
|
|
v-model="placeOrgName"
|
|
required
|
|
placeholder="请输入企业名称"
|
|
/>
|
|
</div>
|
|
|
|
<!-- 密码输入框 -->
|
|
<div class="input-box">
|
|
<img class="input-icon" src="../assets/password.png" />
|
|
<van-field
|
|
type="password"
|
|
v-model="password"
|
|
placeholder="请输入密码"
|
|
required
|
|
class="input-field"
|
|
/>
|
|
</div>
|
|
<!-- 登录按钮 -->
|
|
<button type="submit" @click="handleLogin" class="login-btn">登录</button>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
import Toast from "vant/es/toast";
|
|
import axios from "axios";
|
|
import config from "@/config/index";
|
|
const baseUrl =
|
|
process.env.NODE_ENV === "development" ? "" : config.baseUrl.pro;
|
|
export default {
|
|
data() {
|
|
return {
|
|
placeOrgName: null,
|
|
password: null,
|
|
};
|
|
},
|
|
methods: {
|
|
handleLogin() {
|
|
console.log(this);
|
|
// 在这里添加实际的登录逻辑,比如调用API发送请求
|
|
if (
|
|
(this.placeOrgName == null || this.placeOrgName == "") &&
|
|
(this.password == null || this.password == "")
|
|
) {
|
|
Toast("企业名称和密码不能为空!");
|
|
return;
|
|
}
|
|
if (this.placeOrgName == null || this.placeOrgName == "") {
|
|
Toast("企业名称不能为空!");
|
|
return;
|
|
}
|
|
if (this.password == null || this.password == "") {
|
|
Toast("密码不能为空!");
|
|
return;
|
|
}
|
|
Toast.loading({
|
|
message: "加载中...",
|
|
forbidClick: true,
|
|
});
|
|
// 登录服务
|
|
axios({
|
|
method: "post",
|
|
url:
|
|
baseUrl +
|
|
"/api/resi/partymember/screenreportenterprise/yifengScreen/login",
|
|
data: { placeOrgName: this.placeOrgName, password: this.password }, //GET参数要通过params属性提供
|
|
})
|
|
.then((response) => {
|
|
// 处理登录成功逻辑
|
|
if (response.data.code == 0) {
|
|
// this.$router.push(`/list?placeOrgName=${this.placeOrgName}`); // 跳转到指定路径
|
|
this.$router.replace(`/home`); // 跳转到指定路径
|
|
} else {
|
|
Toast({ message: response.data.msg });
|
|
}
|
|
})
|
|
.catch((error) => {
|
|
// 处理错误逻辑
|
|
console.log("error::", error);
|
|
});
|
|
},
|
|
},
|
|
};
|
|
</script>
|
|
|
|
<style scoped>
|
|
.login-container {
|
|
width: 100%;
|
|
height: 100vh;
|
|
/* 添加适应手机屏幕的样式 */
|
|
}
|
|
|
|
.form-box {
|
|
height: calc(100vh - 380px);
|
|
background: #ffffff;
|
|
position: relative;
|
|
border-radius: 24px 24px 0 0;
|
|
padding: 60px 0 60px 30px;
|
|
top: -120px;
|
|
}
|
|
|
|
.input-icon {
|
|
position: relative;
|
|
top: 12px;
|
|
left: 18px;
|
|
width: 24px;
|
|
height: 24px;
|
|
z-index: 10;
|
|
}
|
|
.input-field {
|
|
/* margin-bottom: 24px; */
|
|
height: 46px;
|
|
width: calc(100% + 46px);
|
|
left: -28px;
|
|
line-height: 46px;
|
|
/* background: #f5f5fa; */
|
|
background: #e8f0fe;
|
|
font-size: 18px;
|
|
border-radius: 23px;
|
|
padding: 0 18px 0 58px;
|
|
border: 0;
|
|
}
|
|
.input-box {
|
|
display: flex;
|
|
width: 100%;
|
|
margin-bottom: 48px;
|
|
}
|
|
.header {
|
|
position: relative;
|
|
top: -28px;
|
|
height: 190px;
|
|
padding: 119px 0 0 30px;
|
|
background: url(../assets/loginBg.png) no-repeat;
|
|
background-size: 100% 100%;
|
|
font-family: PingFang SC;
|
|
font-weight: bold;
|
|
font-size: 22px;
|
|
color: #ffffff;
|
|
line-height: 30px;
|
|
}
|
|
|
|
.login-btn {
|
|
width: calc(100% - 30px);
|
|
padding: 10px;
|
|
height: 42px;
|
|
background: #0089f0;
|
|
border-radius: 21px;
|
|
font-size: 16px;
|
|
background-color: #007bff;
|
|
color: white;
|
|
border: none;
|
|
cursor: pointer;
|
|
}
|
|
|
|
.register-btn {
|
|
background-color: #6c757d;
|
|
text-decoration: none;
|
|
margin-top: 16px;
|
|
}
|
|
</style>
|
|
|