|
@@ -1,63 +1,50 @@
|
|
|
<template>
|
|
|
- <div>
|
|
|
- <div class="fh-login">
|
|
|
- <!-- <div class="fh-login-left">
|
|
|
- <h2 style="padding-bottom: 0px"></h2>
|
|
|
- <h2 style="padding-bottom: 0px">乾元科技</h2>
|
|
|
- <h2 style="font-size:30px">设备管理系统</h2>
|
|
|
- </div> -->
|
|
|
- <div class="fh-login-right">
|
|
|
- <div class="login-title">账号登录</div>
|
|
|
- <a-form
|
|
|
- id="formLogin"
|
|
|
- ref="formLogin"
|
|
|
- :form="form"
|
|
|
- class="login-form"
|
|
|
- @submit="handleSubmit">
|
|
|
- <a-form-item>
|
|
|
- <a-input
|
|
|
- type="text"
|
|
|
- placeholder="用户名"
|
|
|
- class="login-input"
|
|
|
- v-decorator="[
|
|
|
- 'username',
|
|
|
- {rules: [{ required: true, message: '请输入帐户名或邮箱地址' }, { validator: handleUsernameOrEmail }], validateTrigger: 'change'}
|
|
|
- ]"
|
|
|
- >
|
|
|
- <template slot="addonBefore" >
|
|
|
- <a-icon type="user" :style="{ color: '#00DEFF;',fontSize:'16px', }"/>
|
|
|
- 账号:
|
|
|
- </template>
|
|
|
- </a-input>
|
|
|
- </a-form-item>
|
|
|
- <a-form-item>
|
|
|
- <a-input
|
|
|
- type="password"
|
|
|
- autocomplete="false"
|
|
|
- placeholder="请输入密码"
|
|
|
- class="login-input"
|
|
|
- max="6"
|
|
|
- v-decorator="[
|
|
|
- 'password',
|
|
|
- {rules: [{ required: true, message: '请输入密码' }], validateTrigger: 'blur'}
|
|
|
- ]"
|
|
|
- >
|
|
|
- <template slot="addonBefore" >
|
|
|
- <a-icon type="lock" :style="{ color: '#00DEFF;',fontSize:'16px', }"/>
|
|
|
- 密码:
|
|
|
- </template>
|
|
|
- </a-input>
|
|
|
- </a-form-item>
|
|
|
- <a-checkbox :checked="remberMe" v-model="remberMe"><span style="color: #00DEFF;font-size: 14px;">记住密码</span></a-checkbox>
|
|
|
- <a-button class="btn" type="primary" htmlType="submit">
|
|
|
- 登录
|
|
|
- </a-button>
|
|
|
- </a-form>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
+ <div class="login-container">
|
|
|
+ <h1>欢迎登录</h1>
|
|
|
+ <a-form id="formLogin" ref="formLogin" :form="form" class="login-form" @submit="handleSubmit">
|
|
|
+ <a-form-item>
|
|
|
+ <a-input
|
|
|
+ type="text"
|
|
|
+ placeholder="用户名"
|
|
|
+ class="login-input"
|
|
|
+ v-decorator="[
|
|
|
+ 'username',
|
|
|
+ {
|
|
|
+ rules: [{ required: true, message: '请输入帐户名或邮箱地址' }, { validator: handleUsernameOrEmail }],
|
|
|
+ validateTrigger: 'change'
|
|
|
+ }
|
|
|
+ ]"
|
|
|
+ >
|
|
|
+ <template slot="prefix">
|
|
|
+ <div class="icon">
|
|
|
+ <a-icon type="user" />
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </a-input>
|
|
|
+ </a-form-item>
|
|
|
+ <a-form-item>
|
|
|
+ <a-input
|
|
|
+ type="password"
|
|
|
+ autocomplete="false"
|
|
|
+ placeholder="请输入密码"
|
|
|
+ class="login-input"
|
|
|
+ max="6"
|
|
|
+ v-decorator="['password', { rules: [{ required: true, message: '请输入密码' }], validateTrigger: 'blur' }]"
|
|
|
+ >
|
|
|
+ <template slot="prefix">
|
|
|
+ <div class="icon">
|
|
|
+ <a-icon type="lock" />
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </a-input>
|
|
|
+ </a-form-item>
|
|
|
+ <!-- <a-checkbox :checked="remberMe" v-model="remberMe"
|
|
|
+ ><span style="color: #00deff; font-size: 14px">记住密码</span></a-checkbox
|
|
|
+ > -->
|
|
|
+ <a-button class="btn" type="primary" htmlType="submit"> 登录 </a-button>
|
|
|
+ </a-form>
|
|
|
</div>
|
|
|
</template>
|
|
|
-
|
|
|
<script>
|
|
|
import TwoStepCaptcha from '@/components/tools/TwoStepCaptcha'
|
|
|
import { mapActions } from 'vuex'
|
|
@@ -71,7 +58,7 @@ export default {
|
|
|
components: {
|
|
|
TwoStepCaptcha
|
|
|
},
|
|
|
- data () {
|
|
|
+ data() {
|
|
|
return {
|
|
|
customActiveKey: 'tab1',
|
|
|
loginBtn: false,
|
|
@@ -94,7 +81,7 @@ export default {
|
|
|
password: null
|
|
|
}
|
|
|
},
|
|
|
- created () {
|
|
|
+ created() {
|
|
|
// get2step({ })
|
|
|
// .then(res => {
|
|
|
// this.requiredTwoStepCaptcha = res.result.stepCode
|
|
@@ -111,7 +98,9 @@ export default {
|
|
|
const password = cookie.get('password')
|
|
|
console.log(username, password, 33333)
|
|
|
this.remberMe = this.getRemberMe()
|
|
|
- const { form: { setFieldsValue } } = this
|
|
|
+ const {
|
|
|
+ form: { setFieldsValue }
|
|
|
+ } = this
|
|
|
this.$nextTick(() => {
|
|
|
setFieldsValue({
|
|
|
username: username,
|
|
@@ -123,7 +112,7 @@ export default {
|
|
|
methods: {
|
|
|
...mapActions(['Login', 'Logout']),
|
|
|
// handler
|
|
|
- handleUsernameOrEmail (rule, value, callback) {
|
|
|
+ handleUsernameOrEmail(rule, value, callback) {
|
|
|
const { state } = this
|
|
|
const regex = /^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+((\.[a-zA-Z0-9_-]{2,3}){1,2})$/
|
|
|
if (regex.test(value)) {
|
|
@@ -133,11 +122,11 @@ export default {
|
|
|
}
|
|
|
callback()
|
|
|
},
|
|
|
- handleTabClick (key) {
|
|
|
+ handleTabClick(key) {
|
|
|
this.customActiveKey = key
|
|
|
// this.form.resetFields()
|
|
|
},
|
|
|
- handleSubmit (e) {
|
|
|
+ handleSubmit(e) {
|
|
|
e.preventDefault()
|
|
|
const {
|
|
|
form: { validateFields },
|
|
@@ -148,7 +137,8 @@ export default {
|
|
|
|
|
|
state.loginBtn = true
|
|
|
|
|
|
- const validateFieldsKey = customActiveKey === 'tab1' ? ['username', 'password', 'captchaCode'] : ['mobile', 'smsCode', 'captchaCode']
|
|
|
+ const validateFieldsKey =
|
|
|
+ customActiveKey === 'tab1' ? ['username', 'password', 'captchaCode'] : ['mobile', 'smsCode', 'captchaCode']
|
|
|
validateFields(validateFieldsKey, { force: true }, (err, values) => {
|
|
|
if (!err) {
|
|
|
const loginParams = {
|
|
@@ -168,7 +158,7 @@ export default {
|
|
|
loginParams[!state.loginType ? 'email' : 'username'] = values.username
|
|
|
// loginParams.password = md5(values.password)
|
|
|
Login(loginParams)
|
|
|
- .then((res) => this.loginSuccess(res))
|
|
|
+ .then(res => this.loginSuccess(res))
|
|
|
.catch(err => console.log(err))
|
|
|
.finally(() => {
|
|
|
state.loginBtn = false
|
|
@@ -181,9 +171,12 @@ export default {
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
- getCaptcha (e) {
|
|
|
+ getCaptcha(e) {
|
|
|
e.preventDefault()
|
|
|
- const { form: { validateFields }, state } = this
|
|
|
+ const {
|
|
|
+ form: { validateFields },
|
|
|
+ state
|
|
|
+ } = this
|
|
|
|
|
|
validateFields(['mobile', 'captchaCode'], { force: true }, (err, values) => {
|
|
|
if (!err) {
|
|
@@ -201,20 +194,22 @@ export default {
|
|
|
}, 1000)
|
|
|
|
|
|
const hide = this.$message.loading('验证码发送中..', 0)
|
|
|
- getSmsCaptcha({ mobile: values.mobile, captchaCode: values.captchaCode, randomStr: this.randomStr }).then(res => {
|
|
|
- setTimeout(hide, 2500)
|
|
|
- this.$notification['success']({
|
|
|
- message: '提示',
|
|
|
- description: '验证码获取成功,您的验证码为:' + res.data,
|
|
|
- duration: 8
|
|
|
+ getSmsCaptcha({ mobile: values.mobile, captchaCode: values.captchaCode, randomStr: this.randomStr })
|
|
|
+ .then(res => {
|
|
|
+ setTimeout(hide, 2500)
|
|
|
+ this.$notification['success']({
|
|
|
+ message: '提示',
|
|
|
+ description: '验证码获取成功,您的验证码为:' + res.data,
|
|
|
+ duration: 8
|
|
|
+ })
|
|
|
+ })
|
|
|
+ .catch(err => {
|
|
|
+ setTimeout(hide, 1)
|
|
|
+ clearInterval(interval)
|
|
|
+ state.time = 60
|
|
|
+ state.smsSendBtn = false
|
|
|
+ this.requestFailed(err)
|
|
|
})
|
|
|
- }).catch(err => {
|
|
|
- setTimeout(hide, 1)
|
|
|
- clearInterval(interval)
|
|
|
- state.time = 60
|
|
|
- state.smsSendBtn = false
|
|
|
- this.requestFailed(err)
|
|
|
- })
|
|
|
} else {
|
|
|
this.$message.error('图片验证码错误')
|
|
|
this.getCaptchaImage()
|
|
@@ -223,18 +218,18 @@ export default {
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
- stepCaptchaSuccess () {
|
|
|
+ stepCaptchaSuccess() {
|
|
|
this.loginSuccess()
|
|
|
},
|
|
|
- stepCaptchaCancel () {
|
|
|
+ stepCaptchaCancel() {
|
|
|
this.Logout().then(() => {
|
|
|
this.loginBtn = false
|
|
|
this.stepCaptchaVisible = false
|
|
|
})
|
|
|
},
|
|
|
- loginSuccess (res) {
|
|
|
+ loginSuccess(res) {
|
|
|
// 延迟 1 秒显示欢迎信息
|
|
|
- this.$router.push({ path: '/toWorkplaceBacklog' })
|
|
|
+ this.$router.push({ path: '/WorkplaceBacklog' })
|
|
|
setTimeout(() => {
|
|
|
this.$notification.success({
|
|
|
message: '欢迎',
|
|
@@ -252,7 +247,7 @@ export default {
|
|
|
cookie.delete('password')
|
|
|
}
|
|
|
},
|
|
|
- requestFailed (err) {
|
|
|
+ requestFailed(err) {
|
|
|
console.log(err)
|
|
|
this.isLoginError = true
|
|
|
this.$notification['error']({
|
|
@@ -261,19 +256,19 @@ export default {
|
|
|
duration: 4
|
|
|
})
|
|
|
},
|
|
|
- getCaptchaImage () {
|
|
|
+ getCaptchaImage() {
|
|
|
this.randomStr = this.getRandomStr()
|
|
|
// this.captchaImage = location.protocol + '//' + location.host + '/api/verify/captcha/' + this.randomStr
|
|
|
this.captchaImage = process.env.VUE_APP_API_BASE_URL + '/verify/captcha/' + this.randomStr
|
|
|
// getCaptchaImage(this.randomStr).then(res)
|
|
|
},
|
|
|
- getRandomStr () {
|
|
|
+ getRandomStr() {
|
|
|
return new Date().getTime() + Math.random() * 1000
|
|
|
},
|
|
|
- remberPassword (param) {
|
|
|
+ remberPassword(param) {
|
|
|
console.log(param)
|
|
|
},
|
|
|
- getRemberMe () {
|
|
|
+ getRemberMe() {
|
|
|
const remberMe = cookie.get('remberMe')
|
|
|
if (BaseTool.Object.isBlank(remberMe)) {
|
|
|
return true
|
|
@@ -284,120 +279,45 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
</script>
|
|
|
-
|
|
|
-<style scoped>
|
|
|
- .fh-login {
|
|
|
- /* width: 830px;
|
|
|
- height: 435px; */
|
|
|
- position: fixed;
|
|
|
- left: 50%;
|
|
|
- top: 50%;
|
|
|
- /* margin-top: -250px;
|
|
|
- margin-left: -440px; */
|
|
|
- transform: translate(-50%,-43%);
|
|
|
- /* background: url('~@/assets/logn.png') no-repeat; */
|
|
|
- }
|
|
|
- /* .fh-login .fh-login-left {
|
|
|
- float: left;
|
|
|
- width: 50%;
|
|
|
- } */
|
|
|
- /* .fh-login .fh-login-left img {
|
|
|
- margin: 132px auto 0;
|
|
|
- display: block;
|
|
|
- }
|
|
|
- .fh-login .fh-login-left h2 {
|
|
|
- margin-top: 65px;
|
|
|
- padding-bottom: 20px;
|
|
|
- color: #ffffff;
|
|
|
+<style lang="less" scoped>
|
|
|
+.login-container {
|
|
|
+ width: 588px;
|
|
|
+ height: 624px;
|
|
|
+ background: #ffffff;
|
|
|
+ border-radius: 24px;
|
|
|
+ opacity: 0.83;
|
|
|
+ position: absolute;
|
|
|
+ left: 10%;
|
|
|
+ top: 50%;
|
|
|
+ font-family: PingFang SC;
|
|
|
+ transform: translateY(-50%);
|
|
|
+ padding: 100px;
|
|
|
+ text-align: center;
|
|
|
+ h1 {
|
|
|
font-size: 40px;
|
|
|
- font-weight: 600;
|
|
|
- text-align: center;
|
|
|
- } */
|
|
|
- .fh-login .fh-login-right {
|
|
|
- /* float: right; */
|
|
|
- width: 390px;
|
|
|
- height: 335px;
|
|
|
+ color: #2882fe;
|
|
|
+ padding-bottom: 70px;
|
|
|
}
|
|
|
- .fh-login-right .login-title {
|
|
|
- width: 95px;
|
|
|
- letter-spacing: 1px;
|
|
|
- padding-bottom: 2px;
|
|
|
+ /deep/ .ant-input {
|
|
|
+ height: 56px;
|
|
|
+ background: #ffffff;
|
|
|
+ border-radius: 10px;
|
|
|
font-size: 20px;
|
|
|
- color: #fff;
|
|
|
- font-family: PingFang SC;
|
|
|
- border-bottom: 4px solid #00DEFF ;
|
|
|
- margin: 0 auto;
|
|
|
- margin-bottom: 13px;
|
|
|
- text-align: center;
|
|
|
- }
|
|
|
- .btn {
|
|
|
- display: inline-block;
|
|
|
- color: #FFF !important;
|
|
|
- text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25) !important;
|
|
|
- border: 5px solid #FFF;
|
|
|
- border-radius: 0;
|
|
|
- margin-top:10px;
|
|
|
- box-shadow: none !important;
|
|
|
- -webkit-transition: background-color 0.15s, border-color 0.15s, opacity 0.15s;
|
|
|
- -o-transition: background-color 0.15s, border-color 0.15s, opacity 0.15s;
|
|
|
- transition: background-color 0.15s, border-color 0.15s, opacity 0.15s;
|
|
|
- cursor: pointer;
|
|
|
- vertical-align: middle;
|
|
|
- width: 89%;
|
|
|
- height: 40px;
|
|
|
- border: none;
|
|
|
- background: rgb(82, 166, 212) !important;
|
|
|
- color: rgb(255, 255, 255);
|
|
|
- user-select: none;
|
|
|
+ padding-left: 50px;
|
|
|
}
|
|
|
- .fh-login .login-input{
|
|
|
- border: none!important;
|
|
|
- outline: none!important;
|
|
|
- height: 36px!important;
|
|
|
- width: 89%!important;
|
|
|
- background-color: rgba(0,0,0,0)!important;
|
|
|
-
|
|
|
- border: 1px solid #9CE7FF!important;
|
|
|
-border-radius: 6px!important;
|
|
|
-
|
|
|
- }
|
|
|
- /*设置输入图标大小*/
|
|
|
- .ant-input-affix-wrapper{
|
|
|
+ .icon {
|
|
|
+ color: #333;
|
|
|
font-size: 20px;
|
|
|
}
|
|
|
- /deep/ .ant-input{
|
|
|
- height: 36px!important;
|
|
|
- background-color: rgba(0,0,0,0)!important;
|
|
|
- border: none;
|
|
|
-color:#fff;
|
|
|
-
|
|
|
- }
|
|
|
- .login-form{
|
|
|
- margin-left: 38px;
|
|
|
- }
|
|
|
- /*调整图标位置*/
|
|
|
- .login-form .ant-input-affix-wrapper .ant-input-prefix {
|
|
|
- left: 9px !important;
|
|
|
+ /deep/.ant-input-affix-wrapper .ant-input-prefix {
|
|
|
+ left: 18px;
|
|
|
}
|
|
|
- .login-form .ant-input-affix-wrapper .ant-input:not(:first-child){
|
|
|
- padding-left: 38px;
|
|
|
- }
|
|
|
- .ant-form-item {
|
|
|
- margin-bottom: 16px;
|
|
|
+ .btn {
|
|
|
+ width: 383px;
|
|
|
+ height: 56px;
|
|
|
+ background: #2882fe;
|
|
|
+ border-radius: 10px;
|
|
|
+ margin-top: 20px;
|
|
|
}
|
|
|
- /deep/.has-error .ant-input-affix-wrapper .ant-input, .has-error .ant-input-affix-wrapper .ant-input:hover {
|
|
|
- background-color: rgba(0,0,0,0)!important;
|
|
|
- border: none;
|
|
|
-
|
|
|
-}
|
|
|
- /deep/ .ant-input-group-addon {
|
|
|
- border: none;
|
|
|
- color: #00DEFF;
|
|
|
- background-color: rgba(0,0,0,0)!important;
|
|
|
-}
|
|
|
- /deep/.ant-form-item-control-wrapper{
|
|
|
-}
|
|
|
- /deep/.ant-checkbox{
|
|
|
- color:#00DEFF !important;
|
|
|
}
|
|
|
</style>
|