|
|
@@ -1,369 +0,0 @@
|
|
|
-<template>
|
|
|
- <div id="login-box">
|
|
|
- <div class="header">登录</div>
|
|
|
- <div class="main">
|
|
|
- <el-form ref="form" :model="form" :rules="rules">
|
|
|
- <el-form-item prop="principal">
|
|
|
- <el-input
|
|
|
- v-model="form.principal"
|
|
|
- placeholder="用户名/邮箱/手机号"
|
|
|
- class="cuborder-radius"
|
|
|
- maxlength="64"
|
|
|
- @keyup.enter.native="onSubmit('form')"
|
|
|
- />
|
|
|
- </el-form-item>
|
|
|
- <el-form-item prop="credential">
|
|
|
- <el-input
|
|
|
- v-model="form.credential"
|
|
|
- type="password"
|
|
|
- placeholder="密码"
|
|
|
- class="cuborder-radius"
|
|
|
- @keyup.enter.native="onSubmit('form')"
|
|
|
- />
|
|
|
- </el-form-item>
|
|
|
- <el-form-item prop="captchaCode">
|
|
|
- <el-row>
|
|
|
- <el-col :span="12">
|
|
|
- <el-input
|
|
|
- v-model="form.captchaCode"
|
|
|
- placeholder="图形验证码"
|
|
|
- class="cuborder-radius"
|
|
|
- maxlength="11"
|
|
|
- @keyup.enter.native="onSubmit('form')"
|
|
|
- />
|
|
|
- </el-col>
|
|
|
- <el-col :span="12">
|
|
|
- <img :src="captchaCode" alt="图形验证码" title="点击刷新" style="cursor:pointer;" @click="getCaptcha">
|
|
|
- </el-col>
|
|
|
- </el-row>
|
|
|
- </el-form-item>
|
|
|
- <el-form-item>
|
|
|
- <el-button
|
|
|
- type="primary"
|
|
|
- class="submit-btn"
|
|
|
- :loading="loginLoading"
|
|
|
- @click="onSubmit('form')"
|
|
|
- >
|
|
|
- 登录
|
|
|
- </el-button>
|
|
|
- </el-form-item>
|
|
|
- <el-form-item>
|
|
|
- <div class="links">
|
|
|
- <el-link
|
|
|
- type="primary"
|
|
|
- :underline="false"
|
|
|
- @click="toLink('/sso/forget')"
|
|
|
- >
|
|
|
- 找回密码
|
|
|
- </el-link>
|
|
|
- <el-link
|
|
|
- type="primary"
|
|
|
- :underline="false"
|
|
|
- @click="toLink('/sso/register')"
|
|
|
- >没有账号?
|
|
|
- </el-link>
|
|
|
- </div>
|
|
|
- </el-form-item>
|
|
|
- </el-form>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
-</template>
|
|
|
-
|
|
|
-<script>
|
|
|
-import { ServeCaptcha, ServeLogin, ServePubkey } from '@/api/account'
|
|
|
-import { JSEncrypt } from 'jsencrypt'
|
|
|
-
|
|
|
-export default {
|
|
|
- data() {
|
|
|
- const validatePass = (rule, value, callback) => {
|
|
|
- if (value === '') {
|
|
|
- callback(new Error('请再次输入密码'))
|
|
|
- } else if (value !== this.form.credential) {
|
|
|
- callback(new Error('两次输入密码不一致!'))
|
|
|
- } else {
|
|
|
- callback()
|
|
|
- }
|
|
|
- }
|
|
|
- return {
|
|
|
- captchaCode: '',
|
|
|
- loginLoading: false,
|
|
|
- pubkey: {
|
|
|
- key: '',
|
|
|
- r: ''
|
|
|
- },
|
|
|
- form: {
|
|
|
- principal: '',
|
|
|
- credential: '',
|
|
|
- captchaCode: '',
|
|
|
- plat: 2
|
|
|
- },
|
|
|
- rules: {
|
|
|
- principal: [
|
|
|
- {
|
|
|
- required: true,
|
|
|
- message: '用户名不能为空!',
|
|
|
- trigger: 'blur'
|
|
|
- }
|
|
|
- ],
|
|
|
- credential: [
|
|
|
- {
|
|
|
- validator: validatePass,
|
|
|
- trigger: 'blur'
|
|
|
- },
|
|
|
- {
|
|
|
- min: 1,
|
|
|
- max: 100,
|
|
|
- message: '手机号格式不正确!',
|
|
|
- trigger: 'blur'
|
|
|
- }
|
|
|
- ]
|
|
|
- }
|
|
|
- }
|
|
|
- },
|
|
|
- created() {
|
|
|
- this.getCaptcha()
|
|
|
- },
|
|
|
- methods: {
|
|
|
- getCaptcha() {
|
|
|
- ServeCaptcha().then(res => {
|
|
|
- if (res.code === 0) {
|
|
|
- this.captchaCode = res.data
|
|
|
- } else {
|
|
|
- this.$notify.info({
|
|
|
- title: '提示',
|
|
|
- message: '获取 Captcha 失败, 请重新刷新页面...'
|
|
|
- })
|
|
|
- }
|
|
|
- }).finally(() => {
|
|
|
- })
|
|
|
- },
|
|
|
- getPubkey() {
|
|
|
- ServePubkey().then(res => {
|
|
|
- if (res.code === 0) {
|
|
|
- this.pubkey.key = res.data.pubkey
|
|
|
- this.pubkey.r = res.data.r
|
|
|
-
|
|
|
- this.getCaptcha()
|
|
|
- } else {
|
|
|
- this.$notify.info({
|
|
|
- title: '提示',
|
|
|
- message: '获取公钥失败, 请重新刷新页面...'
|
|
|
- })
|
|
|
- }
|
|
|
- }).finally(() => {
|
|
|
- })
|
|
|
- },
|
|
|
- encryptPassword(password) {
|
|
|
- var encryptor = new JSEncrypt()
|
|
|
- encryptor.setPublicKey(this.pubkey.key)
|
|
|
- return encryptor.encrypt(this.pubkey.r + password)
|
|
|
- },
|
|
|
- resetFields() {
|
|
|
- if (!this.model) {
|
|
|
- console.warn('[Element Warn][Form]model is required for resetFields to work.')
|
|
|
- return
|
|
|
- }
|
|
|
- this.fields.forEach(field => {
|
|
|
- field.resetField()
|
|
|
- })
|
|
|
- },
|
|
|
- toLink(url) {
|
|
|
- this.$router.push({
|
|
|
- path: url
|
|
|
- })
|
|
|
- },
|
|
|
- onSubmit(formName) {
|
|
|
- if (this.loginLoading) return false
|
|
|
-
|
|
|
- this.$refs[formName].validate(valid => {
|
|
|
- if (!valid) return false
|
|
|
- this.loginLoading = true
|
|
|
- this.login()
|
|
|
- })
|
|
|
- },
|
|
|
- async login() {
|
|
|
- ServeLogin({
|
|
|
- loginType: this.form.loginType,
|
|
|
- plat: this.form.plat,
|
|
|
- principal: this.form.principal,
|
|
|
- credential: this.encryptPassword(this.form.credential),
|
|
|
- captchaCode: this.form.captchaCode
|
|
|
- }).then(res => {
|
|
|
- if (res.code === 0) {
|
|
|
- this.$refs.form.resetFields()
|
|
|
- const resData = res.data
|
|
|
- /* const userInfo = resData.userInfo
|
|
|
- const userToken = resData.userToken
|
|
|
- setUserToken(userToken)
|
|
|
- this.$store.commit('UPDATE_USER_INFO', userInfo)*/
|
|
|
- this.$router.push('/')
|
|
|
- } else {
|
|
|
- this.$notify.info({
|
|
|
- title: '提示',
|
|
|
- message: res.msg
|
|
|
- })
|
|
|
- }
|
|
|
- }).finally(() => {
|
|
|
- this.loginLoading = false
|
|
|
- })
|
|
|
- }
|
|
|
- }
|
|
|
-}
|
|
|
-</script>
|
|
|
-
|
|
|
-<style lang="scss">
|
|
|
-#deep.el-input__inner {
|
|
|
- border-radius: 1px !important;
|
|
|
-}
|
|
|
-
|
|
|
-#auth-container {
|
|
|
- position: fixed;
|
|
|
- top: 0;
|
|
|
- left: 0;
|
|
|
- height: 100%;
|
|
|
- width: 100%;
|
|
|
- background-color: #f6f8fb;
|
|
|
- #logo-name {
|
|
|
- width: 200px;
|
|
|
- height: 38px;
|
|
|
- font-size: 34px;
|
|
|
- font-family: Times New Roman, Georgia, serif;
|
|
|
- color: #2196f3;
|
|
|
- margin-left: 20px;
|
|
|
- margin-top: 20px;
|
|
|
- }
|
|
|
- #login-box {
|
|
|
- position: absolute;
|
|
|
- width: 350px;
|
|
|
- min-height: 480px;
|
|
|
- top: 50%;
|
|
|
- left: 50%;
|
|
|
- transform: translate(-50%,-50%);
|
|
|
- background-color: white;
|
|
|
- border-radius: 5px;
|
|
|
- box-shadow: 0 4px 14px 0 rgba(206,207,209,0.5);
|
|
|
- padding: 10px 20px;
|
|
|
- .header {
|
|
|
- width: 100%;
|
|
|
- height: 38px;
|
|
|
- font-size: 22px;
|
|
|
- margin: 25px 0 20px 0;
|
|
|
- }
|
|
|
- .main {
|
|
|
- width: 100%;
|
|
|
- .links {
|
|
|
- display: flex;
|
|
|
- justify-content: space-between;
|
|
|
- align-items: center;
|
|
|
- a {
|
|
|
- font-weight: normal !important;
|
|
|
- }
|
|
|
- }
|
|
|
- .send-code-btn {
|
|
|
- width: 140px;
|
|
|
- height: 40px;
|
|
|
- line-height: 40px;
|
|
|
- display: inline-block;
|
|
|
- background: #f3ecec;
|
|
|
- text-align: center;
|
|
|
- color: #777373;
|
|
|
- cursor: pointer;
|
|
|
- user-select: none;
|
|
|
- margin-left: 5px;
|
|
|
- &:active {
|
|
|
- background: #e4dbdb;
|
|
|
- }
|
|
|
- }
|
|
|
- .send-sms-disable {
|
|
|
- cursor: not-allowed !important;
|
|
|
- background: #f7f7f7 !important;
|
|
|
- color: silver !important;
|
|
|
- }
|
|
|
- .submit-btn {
|
|
|
- width: 100%;
|
|
|
- border-radius: 2px;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-}
|
|
|
-.preview-account {
|
|
|
- text-align: center;
|
|
|
- p {
|
|
|
- height: 25px;
|
|
|
- line-height: 25px;
|
|
|
- color: #2d2c2c;
|
|
|
- font-weight: 100;
|
|
|
- font-size: 12px;
|
|
|
- }
|
|
|
-}
|
|
|
-.copyright {
|
|
|
- position: absolute;
|
|
|
- bottom: 30px;
|
|
|
- left: 0;
|
|
|
- right: 0;
|
|
|
- width: 70%;
|
|
|
- text-align: center;
|
|
|
- margin: 0 auto;
|
|
|
- font-size: 12px;
|
|
|
- color: #b1a0a0;
|
|
|
- a {
|
|
|
- color: #777272;
|
|
|
- font-weight: 400;
|
|
|
- }
|
|
|
-}
|
|
|
-@media screen and (max-height : 500px) {
|
|
|
- .copyright {
|
|
|
- display: none;
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
-.fly-box {
|
|
|
- .bg-fly-circle1 {
|
|
|
- left: 40px;
|
|
|
- top: 100px;
|
|
|
- width: 100px;
|
|
|
- height: 100px;
|
|
|
- border-radius: 50%;
|
|
|
- background: linear-gradient(to right,rgba(100,84,239,0.07) 0%,rgba(48,33,236,0.04) 100%);
|
|
|
- animation: move 2.5s linear infinite;
|
|
|
- }
|
|
|
- .bg-fly-circle2 {
|
|
|
- left: 3%;
|
|
|
- top: 60%;
|
|
|
- width: 150px;
|
|
|
- height: 150px;
|
|
|
- border-radius: 50%;
|
|
|
- background: linear-gradient(to right,rgba(100,84,239,0.08) 0%,rgba(48,33,236,0.04) 100%);
|
|
|
- animation: move 3s linear infinite;
|
|
|
- }
|
|
|
- .bg-fly-circle3 {
|
|
|
- right: 2%;
|
|
|
- top: 140px;
|
|
|
- width: 145px;
|
|
|
- height: 145px;
|
|
|
- border-radius: 50%;
|
|
|
- background: linear-gradient(to right,rgba(100,84,239,0.1) 0%,rgba(48,33,236,0.04) 100%);
|
|
|
- animation: move 2.5s linear infinite;
|
|
|
- }
|
|
|
- .bg-fly-circle4 {
|
|
|
- right: 5%;
|
|
|
- top: 60%;
|
|
|
- width: 160px;
|
|
|
- height: 160px;
|
|
|
- border-radius: 50%;
|
|
|
- background: linear-gradient(to right,rgba(100,84,239,0.02) 0%,rgba(48,33,236,0.04) 100%);
|
|
|
- animation: move 3.5s linear infinite;
|
|
|
- }
|
|
|
-}
|
|
|
-@keyframes move {
|
|
|
- 0% {
|
|
|
- transform: translateY(0px);
|
|
|
- }
|
|
|
- 50% {
|
|
|
- transform: translateY(25px);
|
|
|
- }
|
|
|
- 100% {
|
|
|
- transform: translateY(0px);
|
|
|
- }
|
|
|
-}
|
|
|
-</style>
|