|
|
|
@ -1,9 +1,13 @@
|
|
|
|
|
<template>
|
|
|
|
|
<div class="login">
|
|
|
|
|
<div class="loginleft">
|
|
|
|
|
</div>
|
|
|
|
|
<el-form ref="loginForm" :model="loginForm" :rules="loginRules" class="login-form">
|
|
|
|
|
<img src="@/assets/images/logo@2x.png" alt="">
|
|
|
|
|
<div class="loginleft"></div>
|
|
|
|
|
<el-form
|
|
|
|
|
ref="loginForm"
|
|
|
|
|
:model="loginForm"
|
|
|
|
|
:rules="loginRules"
|
|
|
|
|
class="login-form"
|
|
|
|
|
>
|
|
|
|
|
<img src="@/assets/images/logo@2x.png" alt="" />
|
|
|
|
|
<div class="title">苏州工业园区工业上楼管理系统</div>
|
|
|
|
|
<div class="logintabs">
|
|
|
|
|
<el-tabs v-model="activeName" :stretch="true" color="#216CDC">
|
|
|
|
@ -11,44 +15,98 @@
|
|
|
|
|
<el-tab-pane label="政务人员登录" name="second"></el-tab-pane>
|
|
|
|
|
</el-tabs>
|
|
|
|
|
</div>
|
|
|
|
|
<el-form-item prop="username" class="loginitem" style="margin-top: 1rem;">
|
|
|
|
|
<el-input v-model="loginForm.username" type="text" auto-complete="off" placeholder="账号">
|
|
|
|
|
<svg-icon slot="prefix" icon-class="user" class="el-input__icon input-icon" />
|
|
|
|
|
<el-form-item prop="username" class="loginitem" style="margin-top: 1rem">
|
|
|
|
|
<el-input
|
|
|
|
|
v-model="loginForm.username"
|
|
|
|
|
type="text"
|
|
|
|
|
auto-complete="off"
|
|
|
|
|
placeholder="账号"
|
|
|
|
|
>
|
|
|
|
|
<svg-icon
|
|
|
|
|
slot="prefix"
|
|
|
|
|
icon-class="user"
|
|
|
|
|
class="el-input__icon input-icon"
|
|
|
|
|
/>
|
|
|
|
|
</el-input>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item prop="password" class="loginitem">
|
|
|
|
|
<el-input v-model="loginForm.password" type="password" auto-complete="off" placeholder="密码"
|
|
|
|
|
@keyup.enter.native="handleLogin">
|
|
|
|
|
<svg-icon slot="prefix" icon-class="password" class="el-input__icon input-icon" />
|
|
|
|
|
<el-input
|
|
|
|
|
v-model="loginForm.password"
|
|
|
|
|
type="password"
|
|
|
|
|
auto-complete="off"
|
|
|
|
|
placeholder="密码"
|
|
|
|
|
@keyup.enter.native="handleLogin"
|
|
|
|
|
>
|
|
|
|
|
<svg-icon
|
|
|
|
|
slot="prefix"
|
|
|
|
|
icon-class="password"
|
|
|
|
|
class="el-input__icon input-icon"
|
|
|
|
|
/>
|
|
|
|
|
</el-input>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item prop="code" v-if="captchaEnabled" class="loginitem">
|
|
|
|
|
<el-input v-model="loginForm.code" auto-complete="off" placeholder="验证码" style="width: 63%"
|
|
|
|
|
@keyup.enter.native="handleLogin">
|
|
|
|
|
<svg-icon slot="prefix" icon-class="validCode" class="el-input__icon input-icon" />
|
|
|
|
|
<!-- <el-form-item prop="code" v-if="captchaEnabled" class="loginitem">
|
|
|
|
|
<el-input
|
|
|
|
|
v-model="loginForm.code"
|
|
|
|
|
auto-complete="off"
|
|
|
|
|
placeholder="验证码"
|
|
|
|
|
style="width: 63%"
|
|
|
|
|
@keyup.enter.native="handleLogin"
|
|
|
|
|
>
|
|
|
|
|
<svg-icon
|
|
|
|
|
slot="prefix"
|
|
|
|
|
icon-class="validCode"
|
|
|
|
|
class="el-input__icon input-icon"
|
|
|
|
|
/>
|
|
|
|
|
</el-input>
|
|
|
|
|
<div class="login-code">
|
|
|
|
|
<img :src="codeUrl" @click="getCode" class="login-code-img" style="width: 8.56rem;" />
|
|
|
|
|
<img
|
|
|
|
|
:src="codeUrl"
|
|
|
|
|
@click="getCode"
|
|
|
|
|
class="login-code-img"
|
|
|
|
|
style="width: 8.56rem"
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-checkbox v-model="loginForm.rememberMe" style="margin:1rem 18.6rem 25px 0px;">记住密码</el-checkbox>
|
|
|
|
|
<el-form-item style="width:24rem;;margin-top: 1rem;">
|
|
|
|
|
<el-button :loading="loading" size="medium" type="primary" style="width:100%;background: #2B62F1;"
|
|
|
|
|
@click.native.prevent="handleLogin">
|
|
|
|
|
</el-form-item> -->
|
|
|
|
|
<el-checkbox
|
|
|
|
|
v-model="loginForm.rememberMe"
|
|
|
|
|
style="margin: 1rem 18.6rem 25px 0px"
|
|
|
|
|
>记住密码</el-checkbox
|
|
|
|
|
>
|
|
|
|
|
<el-form-item style="width: 24rem; margin-top: 1rem">
|
|
|
|
|
<el-button
|
|
|
|
|
:loading="loading"
|
|
|
|
|
size="medium"
|
|
|
|
|
type="primary"
|
|
|
|
|
style="width: 100%; background: #2b62f1"
|
|
|
|
|
@click.native.prevent="handleLogin"
|
|
|
|
|
>
|
|
|
|
|
<span v-if="!loading">登 录</span>
|
|
|
|
|
<span v-else>登 录 中...</span>
|
|
|
|
|
</el-button>
|
|
|
|
|
<el-button v-if="showGovernmentLoginButton" size="medium" type="primary" class="tongyidenglu"
|
|
|
|
|
style="width:100%;background: #2B62F1;" @click.native.prevent="handleGovernmentLogin">
|
|
|
|
|
<!-- <el-button
|
|
|
|
|
v-if="showGovernmentLoginButton"
|
|
|
|
|
size="medium"
|
|
|
|
|
type="primary"
|
|
|
|
|
class="tongyidenglu"
|
|
|
|
|
style="width: 100%; background: #2b62f1"
|
|
|
|
|
@click.native.prevent="handleGovernmentLogin"
|
|
|
|
|
>
|
|
|
|
|
<span>政务统一身份认证登录</span>
|
|
|
|
|
</el-button>
|
|
|
|
|
<el-button v-if="showEnterpriseLoginButton" size="medium" type="primary" class="tongyidenglu"
|
|
|
|
|
style="width:100%;background: #2B62F1;" @click.native.prevent="handleEnterpriseLogin">
|
|
|
|
|
</el-button> -->
|
|
|
|
|
<el-button
|
|
|
|
|
v-if="showEnterpriseLoginButton"
|
|
|
|
|
size="medium"
|
|
|
|
|
type="primary"
|
|
|
|
|
class="tongyidenglu"
|
|
|
|
|
style="width: 100%; background: #2b62f1"
|
|
|
|
|
@click.native.prevent="handleEnterpriseLogin"
|
|
|
|
|
>
|
|
|
|
|
<span>企业统一身份认证登录</span>
|
|
|
|
|
</el-button>
|
|
|
|
|
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<div style="font-size: 0.88rem;color: #333;">主办单位:苏州工业园区经济发展委员会</div>
|
|
|
|
|
<div style="font-size: 0.88rem; color: #333">
|
|
|
|
|
主办单位:苏州工业园区经济发展委员会
|
|
|
|
|
</div>
|
|
|
|
|
</el-form>
|
|
|
|
|
<!-- 底部 -->
|
|
|
|
|
<div class="el-login-footer">
|
|
|
|
@ -58,72 +116,73 @@
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
import { getCodeImg } from '@/api/login'
|
|
|
|
|
import Cookies from 'js-cookie'
|
|
|
|
|
import { encrypt, decrypt } from '@/utils/jsencrypt'
|
|
|
|
|
import forge from 'node-forge'
|
|
|
|
|
import { getCodeImg } from "@/api/login";
|
|
|
|
|
import Cookies from "js-cookie";
|
|
|
|
|
import { encrypt, decrypt } from "@/utils/jsencrypt";
|
|
|
|
|
import forge from "node-forge";
|
|
|
|
|
|
|
|
|
|
export default {
|
|
|
|
|
name: 'Login',
|
|
|
|
|
name: "Login",
|
|
|
|
|
data() {
|
|
|
|
|
return {
|
|
|
|
|
codeUrl: '',
|
|
|
|
|
activeName: 'second',
|
|
|
|
|
codeUrl: "",
|
|
|
|
|
activeName: "second",
|
|
|
|
|
loginForm: {
|
|
|
|
|
username: '',
|
|
|
|
|
password: '',
|
|
|
|
|
username: "",
|
|
|
|
|
password: "",
|
|
|
|
|
rememberMe: false,
|
|
|
|
|
code: '',
|
|
|
|
|
uuid: '',
|
|
|
|
|
loginRole: 2
|
|
|
|
|
// code: "",
|
|
|
|
|
uuid: "",
|
|
|
|
|
loginRole: 2,
|
|
|
|
|
},
|
|
|
|
|
loginRules: {
|
|
|
|
|
username: [
|
|
|
|
|
{ required: true, trigger: 'blur', message: '请输入您的账号' }
|
|
|
|
|
{ required: true, trigger: "blur", message: "请输入您的账号" },
|
|
|
|
|
],
|
|
|
|
|
password: [
|
|
|
|
|
{ required: true, trigger: 'blur', message: '请输入您的密码' }
|
|
|
|
|
{ required: true, trigger: "blur", message: "请输入您的密码" },
|
|
|
|
|
],
|
|
|
|
|
code: [{ required: true, trigger: 'change', message: '请输入验证码' }]
|
|
|
|
|
// code: [{ required: true, trigger: "change", message: "请输入验证码" }],
|
|
|
|
|
},
|
|
|
|
|
loading: false,
|
|
|
|
|
captchaEnabled: true,
|
|
|
|
|
register: false,
|
|
|
|
|
redirect: undefined,
|
|
|
|
|
a1: `MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAl8bS1kYTiMhIS5MZU253bc0ukaxrA1lfCziABFxQrC2c09tMrQGjuH6V1x2ofNBMGhOD9uWN/qkAQy/HwOe/NKUqCw6N0ov6guSrqMDW/BdZ3Bl0rmM1/95jTC1xffFFvej7xWNffIbaPI+bJ4WLX9NViNi9HmT0BRNzJ4d2R86LPPCa+bxLaPjsh2R2tBkbLkUot9769aJaPPiwPCZHMkuQenjHSmpWL0okleqMH8EGX7j6A5A/4IUXPMNKMMzkiSRpsIJ65GJmDAbnR3ZXRfC8MzVBBJB6zr5N0F4N9xZfF+JS/Yx726tCu+rA6GDCyTxtQ/wnKpPdwFP5nUWCWQIDAQAB`
|
|
|
|
|
}
|
|
|
|
|
a1: `MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAl8bS1kYTiMhIS5MZU253bc0ukaxrA1lfCziABFxQrC2c09tMrQGjuH6V1x2ofNBMGhOD9uWN/qkAQy/HwOe/NKUqCw6N0ov6guSrqMDW/BdZ3Bl0rmM1/95jTC1xffFFvej7xWNffIbaPI+bJ4WLX9NViNi9HmT0BRNzJ4d2R86LPPCa+bxLaPjsh2R2tBkbLkUot9769aJaPPiwPCZHMkuQenjHSmpWL0okleqMH8EGX7j6A5A/4IUXPMNKMMzkiSRpsIJ65GJmDAbnR3ZXRfC8MzVBBJB6zr5N0F4N9xZfF+JS/Yx726tCu+rA6GDCyTxtQ/wnKpPdwFP5nUWCWQIDAQAB`,
|
|
|
|
|
};
|
|
|
|
|
},
|
|
|
|
|
watch: {
|
|
|
|
|
$route: {
|
|
|
|
|
handler: function (route) {
|
|
|
|
|
this.redirect = route.query && route.query.redirect;
|
|
|
|
|
},
|
|
|
|
|
immediate: true
|
|
|
|
|
immediate: true,
|
|
|
|
|
},
|
|
|
|
|
activeName(newVal) {
|
|
|
|
|
if (newVal === 'first') {
|
|
|
|
|
this.loginForm.loginRole = 2
|
|
|
|
|
} else if (newVal === 'second') {
|
|
|
|
|
this.loginForm.loginRole = 1
|
|
|
|
|
if (newVal === "first") {
|
|
|
|
|
this.loginForm.loginRole = 2;
|
|
|
|
|
} else if (newVal === "second") {
|
|
|
|
|
this.loginForm.loginRole = 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
computed: {
|
|
|
|
|
showGovernmentLoginButton() {
|
|
|
|
|
return this.activeName === 'second'
|
|
|
|
|
return this.activeName === "second";
|
|
|
|
|
},
|
|
|
|
|
showEnterpriseLoginButton() {
|
|
|
|
|
return this.activeName === 'first'
|
|
|
|
|
}
|
|
|
|
|
return this.activeName === "first";
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
created() {
|
|
|
|
|
this.getCode()
|
|
|
|
|
this.getCookie()
|
|
|
|
|
this.getCode();
|
|
|
|
|
this.getCookie();
|
|
|
|
|
},
|
|
|
|
|
methods: {
|
|
|
|
|
getCode() {
|
|
|
|
|
getCodeImg().then(res => {
|
|
|
|
|
this.captchaEnabled = res.captchaEnabled === undefined ? true : res.captchaEnabled;
|
|
|
|
|
getCodeImg().then((res) => {
|
|
|
|
|
this.captchaEnabled =
|
|
|
|
|
res.captchaEnabled === undefined ? true : res.captchaEnabled;
|
|
|
|
|
if (this.captchaEnabled) {
|
|
|
|
|
this.codeUrl = "data:image/gif;base64," + res.img;
|
|
|
|
|
this.loginForm.uuid = res.uuid;
|
|
|
|
@ -131,46 +190,50 @@ export default {
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
getCookie() {
|
|
|
|
|
const username = Cookies.get('username')
|
|
|
|
|
const password = Cookies.get('password')
|
|
|
|
|
const rememberMe = Cookies.get('rememberMe')
|
|
|
|
|
const username = Cookies.get("username");
|
|
|
|
|
const password = Cookies.get("password");
|
|
|
|
|
const rememberMe = Cookies.get("rememberMe");
|
|
|
|
|
this.loginForm = {
|
|
|
|
|
username: username === undefined ? this.loginForm.username : username,
|
|
|
|
|
password: password === undefined ? this.loginForm.password : decrypt(password),
|
|
|
|
|
rememberMe: rememberMe === undefined ? false : Boolean(rememberMe)
|
|
|
|
|
}
|
|
|
|
|
password:
|
|
|
|
|
password === undefined ? this.loginForm.password : decrypt(password),
|
|
|
|
|
rememberMe: rememberMe === undefined ? false : Boolean(rememberMe),
|
|
|
|
|
};
|
|
|
|
|
},
|
|
|
|
|
handleLogin() {
|
|
|
|
|
this.$refs.loginForm.validate(valid => {
|
|
|
|
|
|
|
|
|
|
this.$refs.loginForm.validate((valid) => {
|
|
|
|
|
if (valid) {
|
|
|
|
|
this.loading = true;
|
|
|
|
|
if (this.loginForm.rememberMe) {
|
|
|
|
|
Cookies.set("username", this.loginForm.username, { expires: 30 });
|
|
|
|
|
Cookies.set("password", encrypt(this.loginForm.password), { expires: 30 });
|
|
|
|
|
Cookies.set('rememberMe', this.loginForm.rememberMe, { expires: 30 });
|
|
|
|
|
Cookies.set("password", encrypt(this.loginForm.password), {
|
|
|
|
|
expires: 30,
|
|
|
|
|
});
|
|
|
|
|
Cookies.set("rememberMe", this.loginForm.rememberMe, {
|
|
|
|
|
expires: 30,
|
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
Cookies.remove("username");
|
|
|
|
|
Cookies.remove("password");
|
|
|
|
|
Cookies.remove('rememberMe');
|
|
|
|
|
Cookies.remove("rememberMe");
|
|
|
|
|
}
|
|
|
|
|
// 生成一个 2048 位的 RSA 密钥对
|
|
|
|
|
const lines = [];
|
|
|
|
|
lines.push('-----BEGIN PUBLIC KEY-----');
|
|
|
|
|
lines.push("-----BEGIN PUBLIC KEY-----");
|
|
|
|
|
for (let i = 0; i < this.a1.length; i += 64) {
|
|
|
|
|
lines.push(this.a1.slice(i, i + 64));
|
|
|
|
|
}
|
|
|
|
|
lines.push('-----END PUBLIC KEY-----');
|
|
|
|
|
lines.join('\n')
|
|
|
|
|
const publicKey = forge.pki.publicKeyFromPem(lines.join('\n'));
|
|
|
|
|
lines.push("-----END PUBLIC KEY-----");
|
|
|
|
|
lines.join("\n");
|
|
|
|
|
const publicKey = forge.pki.publicKeyFromPem(lines.join("\n"));
|
|
|
|
|
// 将待加密的字符串转换为字节数组
|
|
|
|
|
var dataBytes = forge.util.encodeUtf8(this.loginForm.password);
|
|
|
|
|
// 加密数据
|
|
|
|
|
var encryptedBytes = publicKey.encrypt(dataBytes, 'RSA-OAEP', {
|
|
|
|
|
var encryptedBytes = publicKey.encrypt(dataBytes, "RSA-OAEP", {
|
|
|
|
|
md: forge.md.sha256.create(),
|
|
|
|
|
mgf1: {
|
|
|
|
|
md: forge.md.sha1.create()
|
|
|
|
|
}
|
|
|
|
|
md: forge.md.sha1.create(),
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
// 将加密后的字节数组转换为 Base64 编码的字符串
|
|
|
|
|
var encryptedBase64 = forge.util.encode64(encryptedBytes);
|
|
|
|
@ -181,39 +244,41 @@ export default {
|
|
|
|
|
password: encryptedBase64,
|
|
|
|
|
code: this.loginForm.code,
|
|
|
|
|
uuid: this.loginForm.uuid,
|
|
|
|
|
loginRole: this.activeName === 'first' ? 2 : 1
|
|
|
|
|
loginRole: this.activeName === "first" ? 2 : 1,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
this.$store.dispatch('Login', loginData)
|
|
|
|
|
this.$store
|
|
|
|
|
.dispatch("Login", loginData)
|
|
|
|
|
.then(() => {
|
|
|
|
|
this.$router.push({ path: this.redirect || '/' }).catch(() => { });
|
|
|
|
|
this.$router.push({ path: this.redirect || "/" }).catch(() => {});
|
|
|
|
|
})
|
|
|
|
|
.catch((error) => {
|
|
|
|
|
this.loading = false;
|
|
|
|
|
if (this.captchaEnabled) {
|
|
|
|
|
this.getCode();
|
|
|
|
|
}
|
|
|
|
|
console.error('登录失败:', error);
|
|
|
|
|
console.error("登录失败:", error);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
handleGovernmentLogin() {
|
|
|
|
|
location.href = 'https://qyt.sipac.gov.cn/sipsg-enterprise-mobile-manage/#/login'
|
|
|
|
|
location.href =
|
|
|
|
|
"https://qyt.sipac.gov.cn/sipsg-enterprise-mobile-manage/#/login";
|
|
|
|
|
},
|
|
|
|
|
handleEnterpriseLogin() {
|
|
|
|
|
location.href = process.env.VUE_APP_BASE_API + "/system/singlelogin/login";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
location.href =
|
|
|
|
|
process.env.VUE_APP_BASE_API + "/system/singlelogin/login";
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<style rel="stylesheet/scss" lang="scss" scoped>
|
|
|
|
|
::v-deep .el-tabs__active-bar {
|
|
|
|
|
width: 2rem !important;
|
|
|
|
|
margin-left: 3rem;
|
|
|
|
|
background-color: #216CDC;
|
|
|
|
|
background-color: #216cdc;
|
|
|
|
|
height: 0.21rem;
|
|
|
|
|
border-radius: 0.16rem;
|
|
|
|
|
}
|
|
|
|
@ -225,14 +290,14 @@ export default {
|
|
|
|
|
::v-deep .el-tabs__item {
|
|
|
|
|
font-size: 1rem;
|
|
|
|
|
padding: 0 20px;
|
|
|
|
|
color: #3D424C;
|
|
|
|
|
color: #3d424c;
|
|
|
|
|
font-family: Alibaba PuHuiTi;
|
|
|
|
|
font-weight: 400;
|
|
|
|
|
color: #3D424C;
|
|
|
|
|
color: #3d424c;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
::v-deep .el-tabs__item.is-active {
|
|
|
|
|
color: #216CDC;
|
|
|
|
|
color: #216cdc;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
::v-deep .el-tabs__nav-wrap::after {
|
|
|
|
@ -250,14 +315,14 @@ export default {
|
|
|
|
|
align-items: center;
|
|
|
|
|
border-radius: 6px 0 0 6px;
|
|
|
|
|
height: 100%;
|
|
|
|
|
background-image: url('../assets/images/loginbackground.png');
|
|
|
|
|
background-image: url("../assets/images/loginbackground.png");
|
|
|
|
|
background-size: cover;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.loginleft {
|
|
|
|
|
width: 35rem;
|
|
|
|
|
height: 40rem;
|
|
|
|
|
background-image: url('../assets/images/loginleft.png');
|
|
|
|
|
background-image: url("../assets/images/loginleft.png");
|
|
|
|
|
background-size: 100% 100%;
|
|
|
|
|
background-repeat: no-repeat;
|
|
|
|
|
}
|
|
|
|
@ -268,7 +333,7 @@ export default {
|
|
|
|
|
font-family: Alibaba PuHuiTi;
|
|
|
|
|
font-weight: 500;
|
|
|
|
|
font-size: 2rem;
|
|
|
|
|
color: #292C33;
|
|
|
|
|
color: #292c33;
|
|
|
|
|
line-height: 3.5rem;
|
|
|
|
|
text-align: center;
|
|
|
|
|
margin-top: 1rem;
|
|
|
|
@ -349,8 +414,8 @@ export default {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.el-tabs__item.is-active {
|
|
|
|
|
color: #216CDC;
|
|
|
|
|
color: #216cdc;
|
|
|
|
|
position: relative;
|
|
|
|
|
padding-bottom: 0.5rem;
|
|
|
|
|
}
|
|
|
|
|
</style>
|
|
|
|
|
</style>
|
|
|
|
|