fix:排放系统登陆页面更改样式

This commit is contained in:
shijing 2024-04-12 14:37:16 +08:00
parent 16bf29cd4f
commit 89f05ee8e8
2 changed files with 404 additions and 252 deletions

View File

@ -1,196 +1,261 @@
<template>
<el-form ref="loginForm" :model="form" :rules="rules" label-width="0" size="large">
<el-form-item prop="user">
<el-input v-model="form.user" prefix-icon="el-icon-user" clearable :placeholder="$t('login.userPlaceholder')">
<!-- <template #append>
<el-form
ref="loginForm"
:model="form"
:rules="rules"
label-width="0"
size="large"
>
<el-form-item prop="user">
<el-input
v-model="form.user"
prefix-icon="el-icon-user"
clearable
:placeholder="$t('login.userPlaceholder')"
>
<!-- <template #append>
<el-select v-model="userType" style="width: 130px">
<el-option :label="$t('login.admin')" value="admin"></el-option>
<el-option :label="$t('login.user')" value="user"></el-option>
</el-select>
</template> -->
</el-input>
</el-form-item>
<el-form-item prop="password">
<el-input v-model="form.password" prefix-icon="el-icon-lock" clearable show-password
:placeholder="$t('login.PWPlaceholder')" @keyup.enter="login"></el-input>
</el-form-item>
<el-form-item style="margin-bottom: 10px">
<el-col :span="12" class="login-reg">
<!-- <el-link @click="visitors">{{$t('login.fangke')}}</el-link> -->
</el-col>
<el-col :span="12" class="login-forgot">
<router-link to="/reset_password">{{ $t("login.forgetPassword") }}</router-link>
</el-col>
</el-form-item>
<el-form-item>
<el-button type="primary" style="width: 100%" :loading="islogin" round @click="login">{{ $t("login.signIn")
}}</el-button>
</el-form-item>
</el-input>
</el-form-item>
<el-form-item prop="password">
<el-input
v-model="form.password"
prefix-icon="el-icon-lock"
clearable
show-password
:placeholder="$t('login.PWPlaceholder')"
@keyup.enter="login"
></el-input>
</el-form-item>
<el-form-item style="margin-bottom: 10px">
<el-col :span="12" class="login-reg">
<!-- <el-link @click="visitors">{{$t('login.fangke')}}</el-link> -->
</el-col>
<el-col :span="12" class="login-forgot">
<router-link to="/reset_password"
>{{ $t("login.forgetPassword") }}</router-link
>
</el-col>
</el-form-item>
<el-form-item>
<el-button
v-if="deptCodePf"
type="success"
style="width: 100%"
:loading="islogin"
round
@click="login"
>{{ $t("login.signIn") }}</el-button
>
<el-button
v-else
type="primary"
style="width: 100%"
:loading="islogin"
round
@click="login"
>{{ $t("login.signIn") }}</el-button
>
</el-form-item>
<!-- <div class="login-reg">
<!-- <div class="login-reg">
{{ $t("login.noAccount") }}
<router-link to="/user_register">{{
$t("login.createAccount")
}}</router-link>
</div>-->
</el-form>
<sc-dialog v-model="visitorsdialog" draggable title="创建访客账号">
<el-form ref="dialogForms" :model="visitorform" label-width="120px">
<el-row>
<el-col :md="24" :sm="24">
<el-form-item label="姓名" prop="name">
<el-input v-model="visitorform.name" placeholder="请输入姓名" clearable></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :md="24" :sm="24">
<el-form-item label="用户名" prop="username">
<el-input v-model="visitorform.username" placeholder="请输入用户名" clearable></el-input>
</el-form-item>
</el-col>
</el-row>
</el-form>
<template #footer>
<el-button @click="visitorsdialog = false"> </el-button>
<el-button type="primary" @click="submitvisitor"> </el-button>
</template>
</sc-dialog>
</el-form>
<sc-dialog v-model="visitorsdialog" draggable title="创建访客账号">
<el-form ref="dialogForms" :model="visitorform" label-width="120px">
<el-row>
<el-col :md="24" :sm="24">
<el-form-item label="姓名" prop="name">
<el-input
v-model="visitorform.name"
placeholder="请输入姓名"
clearable
></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :md="24" :sm="24">
<el-form-item label="用户名" prop="username">
<el-input
v-model="visitorform.username"
placeholder="请输入用户名"
clearable
></el-input>
</el-form-item>
</el-col>
</el-row>
</el-form>
<template #footer>
<el-button @click="visitorsdialog = false"> </el-button>
<el-button type="primary" @click="submitvisitor"> </el-button>
</template>
</sc-dialog>
</template>
<script>
export default {
data() {
return {
redirect: undefined,
userType: "admin",
visitorsdialog: false,
visitorform: {},
form: {
user: "admin",
password: "admin",
autologin: false,
},
rules: {
user: [
{
required: true,
message: this.$t("login.userError"),
trigger: "blur",
},
],
password: [
{
required: true,
message: this.$t("login.PWError"),
trigger: "blur",
},
],
},
islogin: false,
};
},
watch: {
userType(val) {
if (val == "admin") {
this.form.user = "admin";
this.form.password = "admin";
} else if (val == "user") {
this.form.user = "user";
this.form.password = "user";
}
},
$route: {
handler: function (route) {
this.redirect = route.query && route.query.redirect;
},
immediate: true,
},
},
mounted() { },
methods: {
async login() {
let that = this;
var validate = await that.$refs.loginForm.validate().catch(() => { });
if (!validate) {
return false;
}
that.islogin = true;
var data = {
username: that.form.user,
// password: that.$TOOL.crypto.MD5(that.form.password)
password: that.form.password,
};
//token
try {
var res = await that.$API.auth.token.post(data);
that.$TOOL.data.set("TOKEN", res.access);
that.$TOOL.data.set("TOKEN_REFRESH", res.refresh);
that.$TOOL.data.set("TOKEN_TIME", new Date().getTime());
try {
var res1 = await that.$API.auth.info.get();
that.$TOOL.data.set("USER_INFO", res1);
that.$TOOL.data.set("PERMISSIONS", Object.keys(res1.perms));
data() {
return {
deptCodePf: false,
redirect: undefined,
userType: "admin",
visitorsdialog: false,
visitorform: {},
form: {
user: "admin",
password: "admin",
autologin: false,
},
rules: {
user: [
{
required: true,
message: this.$t("login.userError"),
trigger: "blur",
},
],
password: [
{
required: true,
message: this.$t("login.PWError"),
trigger: "blur",
},
],
},
islogin: false,
};
},
watch: {
userType(val) {
if (val == "admin") {
this.form.user = "admin";
this.form.password = "admin";
} else if (val == "user") {
this.form.user = "user";
this.form.password = "user";
}
},
$route: {
handler: function (route) {
this.redirect = route.query && route.query.redirect;
},
immediate: true,
},
},
mounted() {
let base_info = this.$TOOL.data.get("BASE_INFO");
if (base_info) {
if (base_info.base.base_name_short.indexOf("智慧环保") != -1) {
this.deptCodePf = true;
}
}
},
methods: {
async login() {
let that = this;
var validate = await that.$refs.loginForm
.validate()
.catch(() => {});
if (!validate) {
return false;
}
that.islogin = true;
var data = {
username: that.form.user,
// password: that.$TOOL.crypto.MD5(that.form.password)
password: that.form.password,
};
//token
try {
var res = await that.$API.auth.token.post(data);
that.$TOOL.data.set("TOKEN", res.access);
that.$TOOL.data.set("TOKEN_REFRESH", res.refresh);
that.$TOOL.data.set("TOKEN_TIME", new Date().getTime());
try {
var res1 = await that.$API.auth.info.get();
that.$TOOL.data.set("USER_INFO", res1);
that.$TOOL.data.set("PERMISSIONS", Object.keys(res1.perms));
let base_dashboard = this.$TOOL.data.get('BASE_INFO').base.base_dashboard;
if (this.redirect) {
base_dashboard = this.redirect;
}
else if (base_dashboard == null || base_dashboard == undefined) {
base_dashboard = '/dashboard'
}
if (this.$TOOL.data.get('BASE_INFO').base.base_name_short.indexOf('曲阳') != -1) {
if (res1.type === 'employee') {
this.$router.replace({
path: base_dashboard,
});
} else {
this.$router.replace({
path: "/rpm/rpj",
});
}
that.$message.success("Login Success 登录成功");
that.islogin = false;
that.$API.am.area.list.req({ page_size: 999 }).then(res => {
if (res.err_msg) {
} else {
debugger;
let areaList = res.results;
that.$TOOL.data.set("qyjyAreaList", areaList);
}
})
} else {
this.$router.replace({
path: base_dashboard,
});
}
} catch (err) {
that.islogin = false;
console.log(err);
}
} catch (err) {
that.islogin = false;
console.log(err);
} finally {
that.islogin = false;
}
},
visitors() {
this.visitorsdialog = true;
},
submitvisitor() {
this.$API.vm.visitor.createz
.req(this.visitorform)
.then((res) => {
this.$message.success("创建成功!");
this.visitorsdialog = false;
return res;
})
.catch((err) => {
return err;
});
}
},
let base_dashboard =
this.$TOOL.data.get("BASE_INFO").base.base_dashboard;
if (this.redirect) {
base_dashboard = this.redirect;
} else if (
base_dashboard == null ||
base_dashboard == undefined
) {
base_dashboard = "/dashboard";
}
if (
this.$TOOL.data
.get("BASE_INFO")
.base.base_name_short.indexOf("曲阳") != -1
) {
if (res1.type === "employee") {
this.$router.replace({
path: base_dashboard,
});
} else {
this.$router.replace({
path: "/rpm/rpj",
});
}
that.$message.success("Login Success 登录成功");
that.islogin = false;
that.$API.am.area.list
.req({ page_size: 999 })
.then((res) => {
if (res.err_msg) {
} else {
debugger;
let areaList = res.results;
that.$TOOL.data.set(
"qyjyAreaList",
areaList
);
}
});
} else {
this.$router.replace({
path: base_dashboard,
});
}
} catch (err) {
that.islogin = false;
console.log(err);
}
} catch (err) {
that.islogin = false;
console.log(err);
} finally {
that.islogin = false;
}
},
visitors() {
this.visitorsdialog = true;
},
submitvisitor() {
this.$API.vm.visitor.createz
.req(this.visitorform)
.then((res) => {
this.$message.success("创建成功!");
this.visitorsdialog = false;
return res;
})
.catch((err) => {
return err;
});
},
},
};
</script>

View File

@ -1,8 +1,22 @@
<template>
<div class="login_bg">
<div :class="{ 'login-container': deptCodePf }">
<!-- <div class="right-con" :style="{backgroundImage: 'url(' + baseConfig.base_logo + ')'}"></div> -->
<div class="login_adv"
:style="{ 'background-image': baseConfig.base_logo_side == '' ? 'url(img/logo_side.png)' : 'url(' + baseConfig.base_logo_side + ')' }">
<div class="login_adv" v-if="deptCodePf">
<div class="login_adv__title">
<h2 v-if="baseConfig.base_name">{{ baseConfig.base_name }}</h2>
</div>
<div class="login_adv__mask"></div>
</div>
<div
class="login_adv"
v-else
:style="{
'background-image':
baseConfig.base_logo_side == ''
? 'url(img/logo_side.png)'
: 'url(' + baseConfig.base_logo_side + ')',
}"
>
<div class="login_adv__title">
<h2 v-if="baseConfig.base_name">{{ baseConfig.base_name }}</h2>
</div>
@ -11,19 +25,32 @@
© {{$CONFIG.APP_NAMES}} {{$CONFIG.APP_VER}}
</div> -->
</div>
<div class="login_main">
<div class="login_config">
<el-button :icon="config.dark ? 'el-icon-sunny' : 'el-icon-moon'" circle type="info"
@click="configDark"></el-button>
<div class="login_main" style="height: 100%; z-index: 10">
<div class="login_config">
<el-button
:icon="config.dark ? 'el-icon-sunny' : 'el-icon-moon'"
circle
type="info"
@click="configDark"
></el-button>
</div>
<div class="login-form">
<div
:class="[deptCodePf ? 'login-form_huanbao' : '', 'login-form']"
>
<div class="login-header">
<div class="logo" v-if="baseConfig.name == 'photon'">
<img id="photonImg" :alt="baseConfig.base_login" :src="baseConfig.base_login">
<img
id="photonImg"
:alt="baseConfig.base_login"
:src="baseConfig.base_login"
/>
</div>
<div class="logo" v-else>
<img :alt="baseConfig.base_name_short" :src="baseConfig.base_logo">
<img
:alt="baseConfig.base_name_short"
:src="baseConfig.base_logo"
/>
<label>{{ baseConfig.base_name }}</label>
</div>
</div>
@ -35,7 +62,6 @@
<el-tab-pane :label="$t('login.mobileLogin')" lazy>
<phone-form></phone-form>
</el-tab-pane>
</el-tabs>
<!-- 微信登陆
<el-divider>{{ $t('login.signInOther') }}</el-divider>
@ -43,11 +69,20 @@
<el-button type="success" icon="sc-icon-wechat" circle @click="wechatLogin"></el-button>
</div>
-->
<div class="login-oauth" v-if="baseConfig.base_name == '曲阳金隅安全智能管控平台'">
<el-button type="default" @click="appDown">安卓APP</el-button>
<div
class="login-oauth"
v-if="baseConfig.base_name == '曲阳金隅安全智能管控平台'"
>
<el-button type="default" @click="appDown"
>安卓APP</el-button
>
<el-button type="default" @click="h5Show">H5访问</el-button>
<el-button type="primary" @click="MonitorOpen"
style="background-color:orange;border-color:orange">监控视频</el-button>
<el-button
type="primary"
@click="MonitorOpen"
style="background-color: orange; border-color: orange"
>监控视频</el-button
>
</div>
<!-- <div class="login-oauth" v-else>
<el-button type="default" @click="faceLogin">刷脸登录</el-button>
@ -55,17 +90,38 @@
</div>
</div>
</div>
<el-dialog v-model="showWechatLogin" :title="$t('login.wechatLoginTitle')" :width="400" destroy-on-close>
<el-dialog
v-model="showWechatLogin"
:title="$t('login.wechatLoginTitle')"
:width="400"
destroy-on-close
>
<div class="qrCodeLogin">
<sc-qr-code class="qrCode" :text="WechatLoginCode" :size="200"></sc-qr-code>
<p class="msg">{{ $tc('login.wechatLoginMsg', 1) }}<br />{{ $tc('login.wechatLoginMsg', 2) }}</p>
<sc-qr-code
class="qrCode"
:text="WechatLoginCode"
:size="200"
></sc-qr-code>
<p class="msg">
{{ $tc("login.wechatLoginMsg", 1) }}<br />{{
$tc("login.wechatLoginMsg", 2)
}}
</p>
<div class="qrCodeLogin-result" v-if="isWechatLoginResult">
<el-result icon="success" :title="$tc('login.wechatLoginResult', 1)"
:sub-title="$tc('login.wechatLoginResult', 2)"></el-result>
<el-result
icon="success"
:title="$tc('login.wechatLoginResult', 1)"
:sub-title="$tc('login.wechatLoginResult', 2)"
></el-result>
</div>
</div>
</el-dialog>
<el-dialog v-model="showApp" title="安卓APP下载" :width="400" destroy-on-close>
<el-dialog
v-model="showApp"
title="安卓APP下载"
:width="400"
destroy-on-close
>
<div class="qrCodeLogin">
<sc-qr-code class="qrCode" :size="200" :text="appUrl"></sc-qr-code>
</div>
@ -75,94 +131,105 @@
<sc-qr-code class="qrCode" :size="200" :text="h5Url"></sc-qr-code>
</div>
</el-dialog>
<el-dialog v-model="limitedPhoto" @close="closeCamera" id="loginFaceWrap" style="width: 664px;">
<h1 style="text-align: center;">人脸登录</h1>
<el-dialog
v-model="limitedPhoto"
@close="closeCamera"
id="loginFaceWrap"
style="width: 664px"
>
<h1 style="text-align: center">人脸登录</h1>
<div class="testTracking">
<faceLogin ref="faceTracking" @close="closeCamera" name="faceLogin" @func="getMsgFormSon"></faceLogin>
<faceLogin
ref="faceTracking"
@close="closeCamera"
name="faceLogin"
@func="getMsgFormSon"
></faceLogin>
</div>
</el-dialog>
</template>
<script>
import { Monitor } from '@element-plus/icons-vue'
import passwordForm from './components/passwordForm'
import phoneForm from './components/phoneForm'
import faceLogin from '@/components/faceLogin'
import { Monitor } from "@element-plus/icons-vue";
import passwordForm from "./components/passwordForm";
import phoneForm from "./components/phoneForm";
import faceLogin from "@/components/faceLogin";
export default {
components: {
passwordForm,
phoneForm,
faceLogin
faceLogin,
},
data() {
return {
config: {
lang: this.$TOOL.data.get('APP_LANG') || this.$CONFIG.LANG,
dark: this.$TOOL.data.get('APP_DARK') || false
lang: this.$TOOL.data.get("APP_LANG") || this.$CONFIG.LANG,
dark: this.$TOOL.data.get("APP_DARK") || false,
},
lang: [
{
name: '简体中文',
value: 'zh-cn',
name: "简体中文",
value: "zh-cn",
},
{
name: 'English',
value: 'en',
}
name: "English",
value: "en",
},
],
deptCodePf: false,
baseConfig: {},
limitedPhoto: false,
WechatLoginCode: "",
showWechatLogin: false,
isWechatLoginResult: false,
showApp: false,
appUrl: 'http://222.222.144.147:6013/media/zc_ehs.apk',
appUrl: "http://222.222.144.147:6013/media/zc_ehs.apk",
showH5: false,
h5Url: 'http://222.222.144.147:6013/h5/'
}
h5Url: "http://222.222.144.147:6013/h5/",
};
},
watch: {
'config.dark'(val) {
"config.dark"(val) {
if (val) {
document.documentElement.classList.add("dark")
this.$TOOL.data.set("APP_DARK", val)
document.documentElement.classList.add("dark");
this.$TOOL.data.set("APP_DARK", val);
} else {
document.documentElement.classList.remove("dark")
this.$TOOL.data.remove("APP_DARK")
document.documentElement.classList.remove("dark");
this.$TOOL.data.remove("APP_DARK");
}
},
'config.lang'(val) {
this.$i18n.locale = val
this.$TOOL.data.set("APP_LANG", val)
}
"config.lang"(val) {
this.$i18n.locale = val;
this.$TOOL.data.set("APP_LANG", val);
},
},
created: function () {
this.$TOOL.data.remove("TOKEN")
this.$TOOL.data.remove("TOKEN_TIME")
this.$TOOL.data.remove("TOKEN_REFRESH")
this.$TOOL.data.remove("USER_INFO")
this.$TOOL.data.remove("MENU")
this.$TOOL.data.remove("PERMISSIONS")
this.$TOOL.data.remove("DASHBOARDGRID")
this.$TOOL.data.remove("grid")
this.$store.commit("clearViewTags")
this.$store.commit("clearKeepLive")
this.$store.commit("clearIframeList")
this.$TOOL.data.remove("TOKEN");
this.$TOOL.data.remove("TOKEN_TIME");
this.$TOOL.data.remove("TOKEN_REFRESH");
this.$TOOL.data.remove("USER_INFO");
this.$TOOL.data.remove("MENU");
this.$TOOL.data.remove("PERMISSIONS");
this.$TOOL.data.remove("DASHBOARDGRID");
this.$TOOL.data.remove("grid");
this.$store.commit("clearViewTags");
this.$store.commit("clearKeepLive");
this.$store.commit("clearIframeList");
//console.log('%c SCUI %c Gitee: https://gitee.com/lolicode/scui', 'background:#666;color:#fff;border-radius:3px;', '')
},
mounted() {
let url1 = window.location.href;
this.project_code = url1.split('/')[3];
this.project_code = url1.split("/")[3];
this.getDept();
},
methods: {
getDept() {
let that = this;
let req = {};
if (that.project_code == undefined || that.project_code == '#') {
if (process.env.NODE_ENV == 'development') {
if (that.project_code == undefined || that.project_code == "#") {
if (process.env.NODE_ENV == "development") {
req.project_code = process.env.VUE_APP_PJ;
}
} else {
@ -172,8 +239,12 @@ export default {
that.baseConfig = res.base;
that.$store.commit("SET_baseName", res.base.base_name);
that.$store.commit("SET_baseLogo", res.base.base_logo);
that.$TOOL.data.set("BASE_INFO", res)
})
that.$TOOL.data.set("BASE_INFO", res);
console.log("BASE_INFO", res);
if (res.base.base_name_short.indexOf("智慧环保") != -1) {
this.deptCodePf = true;
}
});
},
appDown() {
this.showApp = true;
@ -182,7 +253,7 @@ export default {
this.showH5 = true;
},
MonitorOpen() {
window.open('http://10.99.5.79:5515/')
window.open("http://10.99.5.79:5515/");
},
//
faceLogin() {
@ -195,24 +266,33 @@ export default {
// this.thisVideo.srcObject.getTracks()[0].stop();
},
configDark() {
this.config.dark = this.config.dark ? false : true
this.config.dark = this.config.dark ? false : true;
},
configLang(command) {
this.config.lang = command.value
this.config.lang = command.value;
},
wechatLogin() {
this.showWechatLogin = true
this.WechatLoginCode = "SCUI-823677237287236-" + new Date().getTime()
this.showWechatLogin = true;
this.WechatLoginCode =
"SCUI-823677237287236-" + new Date().getTime();
this.isWechatLoginResult = false;
setTimeout(() => {
this.isWechatLoginResult = true
}, 3000)
}
}
}
this.isWechatLoginResult = true;
}, 3000);
},
},
};
</script>
<style scoped>
.login-container {
background-image: url("/public/img/pfBackgroundImg.jpg");
width: 100%;
height: 100%;
background-size: cover;
background-position: center;
position: relative;
}
.login_bg {
width: 100%;
height: 100%;
@ -306,7 +386,13 @@ export default {
margin: auto;
padding: 20px 0;
}
.login-form_huanbao {
width: 450px;
margin: auto;
padding: 20px;
background: rgba(255, 255, 255, 0.6);
border-radius: 20px;
}
.login-header {
margin-bottom: 40px;
width: 460px;
@ -339,7 +425,8 @@ export default {
margin-top: 40px;
}
.login-form {}
.login-form {
}
.login-form:deep(.el-tabs) .el-tabs__header {
margin-bottom: 25px;