|
@@ -1,6 +1,6 @@
|
|
|
<template>
|
|
<template>
|
|
|
<div class='full-screen flex flex-center bg'>
|
|
<div class='full-screen flex flex-center bg'>
|
|
|
- <div class='login white-bg radius '>
|
|
|
|
|
|
|
+ <div class='login white-bg radius'>
|
|
|
<div class='flex flex-center flex-child-average'>
|
|
<div class='flex flex-center flex-child-average'>
|
|
|
<div class='flex left '>
|
|
<div class='flex left '>
|
|
|
<img
|
|
<img
|
|
@@ -27,7 +27,7 @@
|
|
|
<vue-qr :currentLevel='3' :logoCornerRadius='4' :logoScale='0.25' :logoSrc='logoSrc' :text='qrCodeText'
|
|
<vue-qr :currentLevel='3' :logoCornerRadius='4' :logoScale='0.25' :logoSrc='logoSrc' :text='qrCodeText'
|
|
|
size='340'/>
|
|
size='340'/>
|
|
|
</div>
|
|
</div>
|
|
|
- <span class='mt-10 bold main-color font-16'>打开微信扫描二维码登陆梧桐树云平台</span>
|
|
|
|
|
|
|
+ <span class='mt-10 bold main-color font-16'>打开微信扫描二维码登录梧桐树云平台</span>
|
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
|
<div v-else class='padding-20 flex flex-col flex-center mt-20'>
|
|
<div v-else class='padding-20 flex flex-col flex-center mt-20'>
|
|
@@ -107,17 +107,17 @@ layout: 'empty',
|
|
|
|
|
|
|
|
<script>
|
|
<script>
|
|
|
import md5 from 'js-md5'
|
|
import md5 from 'js-md5'
|
|
|
-import {useStore} from '@/store/user.js'
|
|
|
|
|
-import {removeToken, setToken} from '../utils/auth.js'
|
|
|
|
|
|
|
+import { useStore } from '@/store/user.js'
|
|
|
|
|
+import { removeToken, setToken } from '../utils/auth.js'
|
|
|
import permissionStore from '@/store/permission.js'
|
|
import permissionStore from '@/store/permission.js'
|
|
|
import VueQr from 'vue-qr/src/packages/vue-qr.vue'
|
|
import VueQr from 'vue-qr/src/packages/vue-qr.vue'
|
|
|
|
|
|
|
|
export default {
|
|
export default {
|
|
|
name: 'login',
|
|
name: 'login',
|
|
|
- components: {VueQr},
|
|
|
|
|
|
|
+ components: { VueQr },
|
|
|
watch: {
|
|
watch: {
|
|
|
qrCodeLogin: {
|
|
qrCodeLogin: {
|
|
|
- handler(val) {
|
|
|
|
|
|
|
+ handler (val) {
|
|
|
if (val) {
|
|
if (val) {
|
|
|
this.qrCode()
|
|
this.qrCode()
|
|
|
this.checkLogin()
|
|
this.checkLogin()
|
|
@@ -126,12 +126,12 @@ export default {
|
|
|
immediate: true
|
|
immediate: true
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
- setup() {
|
|
|
|
|
|
|
+ setup () {
|
|
|
const user = useStore()
|
|
const user = useStore()
|
|
|
const permission = permissionStore()
|
|
const permission = permissionStore()
|
|
|
- return {user, permission}
|
|
|
|
|
|
|
+ return { user, permission }
|
|
|
},
|
|
},
|
|
|
- data() {
|
|
|
|
|
|
|
+ data () {
|
|
|
return {
|
|
return {
|
|
|
flag: false,
|
|
flag: false,
|
|
|
form: {
|
|
form: {
|
|
@@ -140,16 +140,16 @@ export default {
|
|
|
},
|
|
},
|
|
|
rules: {
|
|
rules: {
|
|
|
name: [
|
|
name: [
|
|
|
- {required: true, message: '请输入手机号码', trigger: 'blur'},
|
|
|
|
|
- {min: 11, max: 11, message: '请输入11位手机号', trigger: 'blur'}
|
|
|
|
|
|
|
+ { required: true, message: '请输入手机号码', trigger: 'blur' },
|
|
|
|
|
+ { min: 11, max: 11, message: '请输入11位手机号', trigger: 'blur' }
|
|
|
],
|
|
],
|
|
|
pass: [
|
|
pass: [
|
|
|
- {required: true, message: '请输入密码', trigger: 'blur'},
|
|
|
|
|
- {min: 3, max: 12, message: '长度在 3 到 12 个字符', trigger: 'blur'}
|
|
|
|
|
|
|
+ { required: true, message: '请输入密码', trigger: 'blur' },
|
|
|
|
|
+ { min: 3, max: 12, message: '长度在 3 到 12 个字符', trigger: 'blur' }
|
|
|
],
|
|
],
|
|
|
code: [
|
|
code: [
|
|
|
- {required: true, message: '请输入验证码', trigger: 'blur'},
|
|
|
|
|
- {min: 5, max: 5, message: '验证码不正确', trigger: 'blur'}
|
|
|
|
|
|
|
+ { required: true, message: '请输入验证码', trigger: 'blur' },
|
|
|
|
|
+ { min: 5, max: 5, message: '验证码不正确', trigger: 'blur' }
|
|
|
]
|
|
]
|
|
|
},
|
|
},
|
|
|
code: '',
|
|
code: '',
|
|
@@ -161,22 +161,22 @@ export default {
|
|
|
logoSrc: new URL('../assets/img/logo.png', import.meta.url).href
|
|
logoSrc: new URL('../assets/img/logo.png', import.meta.url).href
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
- created() {
|
|
|
|
|
|
|
+ created () {
|
|
|
this.permission.cleanPermission()
|
|
this.permission.cleanPermission()
|
|
|
removeToken()
|
|
removeToken()
|
|
|
this.init()
|
|
this.init()
|
|
|
},
|
|
},
|
|
|
- unmounted() {
|
|
|
|
|
|
|
+ unmounted () {
|
|
|
clearInterval(this.time)
|
|
clearInterval(this.time)
|
|
|
},
|
|
},
|
|
|
methods: {
|
|
methods: {
|
|
|
- init() {
|
|
|
|
|
|
|
+ init () {
|
|
|
this.$api.login.captcha().then(res => {
|
|
this.$api.login.captcha().then(res => {
|
|
|
this.code = res.image
|
|
this.code = res.image
|
|
|
this.header = res.key
|
|
this.header = res.key
|
|
|
})
|
|
})
|
|
|
},
|
|
},
|
|
|
- submint() {
|
|
|
|
|
|
|
+ submint () {
|
|
|
this.$refs.loginForm.validate((res) => {
|
|
this.$refs.loginForm.validate((res) => {
|
|
|
if (res) {
|
|
if (res) {
|
|
|
const params = {
|
|
const params = {
|
|
@@ -187,7 +187,7 @@ export default {
|
|
|
scope: 'all',
|
|
scope: 'all',
|
|
|
type: 'account'
|
|
type: 'account'
|
|
|
}
|
|
}
|
|
|
- const header = {captchaKey: this.header, captchaCode: this.form.code}
|
|
|
|
|
|
|
+ const header = { captchaKey: this.header, captchaCode: this.form.code }
|
|
|
this.$api.login.login(params, header).then(res => {
|
|
this.$api.login.login(params, header).then(res => {
|
|
|
if (res.error_description) {
|
|
if (res.error_description) {
|
|
|
this.$message.error(res.error_description)
|
|
this.$message.error(res.error_description)
|
|
@@ -203,11 +203,11 @@ export default {
|
|
|
}
|
|
}
|
|
|
})
|
|
})
|
|
|
},
|
|
},
|
|
|
- loginAdmin() {
|
|
|
|
|
|
|
+ loginAdmin () {
|
|
|
this.form.name = 'admin'
|
|
this.form.name = 'admin'
|
|
|
this.form.pass = 'admin'
|
|
this.form.pass = 'admin'
|
|
|
},
|
|
},
|
|
|
- getInfo() {
|
|
|
|
|
|
|
+ getInfo () {
|
|
|
this.getPermission()
|
|
this.getPermission()
|
|
|
this.$api.login.getUserInfo().then(res => {
|
|
this.$api.login.getUserInfo().then(res => {
|
|
|
if (res.code === 200) {
|
|
if (res.code === 200) {
|
|
@@ -221,14 +221,14 @@ export default {
|
|
|
}
|
|
}
|
|
|
})
|
|
})
|
|
|
},
|
|
},
|
|
|
- getPermission() {
|
|
|
|
|
|
|
+ getPermission () {
|
|
|
this.$api.login.getPermission().then(res => {
|
|
this.$api.login.getPermission().then(res => {
|
|
|
if (res.code === 200) {
|
|
if (res.code === 200) {
|
|
|
this.permission.addPermission(res.data)
|
|
this.permission.addPermission(res.data)
|
|
|
}
|
|
}
|
|
|
})
|
|
})
|
|
|
},
|
|
},
|
|
|
- checkLogin() {
|
|
|
|
|
|
|
+ checkLogin () {
|
|
|
let count = 0
|
|
let count = 0
|
|
|
this.time = setInterval(() => {
|
|
this.time = setInterval(() => {
|
|
|
count = count + 1
|
|
count = count + 1
|
|
@@ -246,7 +246,7 @@ export default {
|
|
|
}
|
|
}
|
|
|
}, 1000)
|
|
}, 1000)
|
|
|
},
|
|
},
|
|
|
- qrCode() {
|
|
|
|
|
|
|
+ qrCode () {
|
|
|
this.$api.login.qrCode().then(res => {
|
|
this.$api.login.qrCode().then(res => {
|
|
|
if (res.code === 200) {
|
|
if (res.code === 200) {
|
|
|
this.sessionId = res.data
|
|
this.sessionId = res.data
|
|
@@ -254,8 +254,8 @@ export default {
|
|
|
}
|
|
}
|
|
|
})
|
|
})
|
|
|
},
|
|
},
|
|
|
- codeLogin() {
|
|
|
|
|
- this.$api.login.qrCodeLogin({sessionId: this.sessionId}).then(res => {
|
|
|
|
|
|
|
+ codeLogin () {
|
|
|
|
|
+ this.$api.login.qrCodeLogin({ sessionId: this.sessionId }).then(res => {
|
|
|
if (res.code === 200) {
|
|
if (res.code === 200) {
|
|
|
const tmp = res.data
|
|
const tmp = res.data
|
|
|
console.log(Object.prototype.hasOwnProperty.call(tmp, 'phone'))
|
|
console.log(Object.prototype.hasOwnProperty.call(tmp, 'phone'))
|
|
@@ -272,6 +272,7 @@ export default {
|
|
|
if (res.error_description) {
|
|
if (res.error_description) {
|
|
|
this.$message.error(res.error_description)
|
|
this.$message.error(res.error_description)
|
|
|
} else {
|
|
} else {
|
|
|
|
|
+ clearInterval(this.time)
|
|
|
setToken(res.access_token)
|
|
setToken(res.access_token)
|
|
|
this.getInfo()
|
|
this.getInfo()
|
|
|
this.$router.replace('/')
|
|
this.$router.replace('/')
|
|
@@ -291,6 +292,7 @@ export default {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
.login {
|
|
.login {
|
|
|
|
|
+ box-shadow: 5px 10px 10px 5px rgba(0, 0, 0, 0.28);
|
|
|
.left {
|
|
.left {
|
|
|
height: auto;
|
|
height: auto;
|
|
|
width: 560;
|
|
width: 560;
|