license验证
parent
aa2a8549e7
commit
75f1982ac9
File diff suppressed because it is too large
Load Diff
|
|
@ -27,6 +27,21 @@ export function getCodeImg() {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function getDeviceInfo() {
|
||||||
|
return request({
|
||||||
|
url: 'auth/deviceinfo',
|
||||||
|
method: 'get'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function putLicenseCode(data) {
|
||||||
|
return request({
|
||||||
|
url: 'auth/createLicense',
|
||||||
|
method: 'post',
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
export function logout() {
|
export function logout() {
|
||||||
return request({
|
return request({
|
||||||
url: 'auth/logout',
|
url: 'auth/logout',
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,73 @@
|
||||||
|
<template>
|
||||||
|
<el-dialog
|
||||||
|
title="上传License"
|
||||||
|
:visible.sync="dialogVisible"
|
||||||
|
width="500px"
|
||||||
|
:before-close="handleClose">
|
||||||
|
|
||||||
|
<el-form ref="form" :model="form" :rules="rules" size="small" label-width="80px">
|
||||||
|
|
||||||
|
<el-form-item label="机器码" prop="deviceCode">
|
||||||
|
<el-input v-model="form.deviceCode" placeholder=""></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item label="License" prop="licenseCode">
|
||||||
|
<el-input v-model="form.licenseCode" type="textarea" :rows="10" placeholder="请输入License" ></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
</el-form>
|
||||||
|
|
||||||
|
<span slot="footer" class="dialog-footer">
|
||||||
|
<el-button @click="cancelForm">取 消</el-button>
|
||||||
|
<el-button type="primary" @click="bindOrderConfirm">确 定</el-button>
|
||||||
|
</span>
|
||||||
|
</el-dialog>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import crud from '@/mixins/crud'
|
||||||
|
import { putLicenseCode } from '@/api/login'
|
||||||
|
import CRUD from '@crud/crud'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
mixins: [crud],
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
dialogVisible: false,
|
||||||
|
rules: {
|
||||||
|
licenseCode: [
|
||||||
|
{ required: true, message: 'License必填', trigger: 'blur' }
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
// 关闭
|
||||||
|
handleClose(done) {
|
||||||
|
done()
|
||||||
|
},
|
||||||
|
bindOrderConfirm() {
|
||||||
|
this.$refs['form'].validate((valid) => {
|
||||||
|
if (valid) {
|
||||||
|
putLicenseCode(this.form.licenseCode).then(res => {
|
||||||
|
this.dialogVisible = false
|
||||||
|
this.$parent.crud.notify('绑定成功!', CRUD.NOTIFICATION_TYPE.SUCCESS)
|
||||||
|
}).catch(() => {
|
||||||
|
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
cancelForm() {
|
||||||
|
this.dialogVisible = false
|
||||||
|
this.$refs['form'].resetFields()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
<style scoped>
|
||||||
|
|
||||||
|
</style>
|
||||||
|
|
@ -1,8 +1,9 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="login" :style="'background-image:url('+ Background +');'">
|
<div class="login" :style="'background-image:url('+ Background +');'">
|
||||||
|
<BindLicense ref="BindLicense"/>
|
||||||
<el-form ref="loginForm" :model="loginForm" :rules="loginRules" label-position="left" label-width="0px" class="login-form">
|
<el-form ref="loginForm" :model="loginForm" :rules="loginRules" label-position="left" label-width="0px" class="login-form">
|
||||||
<h3 class="title">
|
<h3 class="title" @click="bingLicense">
|
||||||
WMS 仓储管理系统
|
WMS 管理系统
|
||||||
</h3>
|
</h3>
|
||||||
<el-form-item prop="username">
|
<el-form-item prop="username">
|
||||||
<el-input v-model="loginForm.username" type="text" auto-complete="off" placeholder="账号">
|
<el-input v-model="loginForm.username" type="text" auto-complete="off" placeholder="账号">
|
||||||
|
|
@ -44,20 +45,25 @@
|
||||||
<script>
|
<script>
|
||||||
import { encrypt } from '@/utils/rsaEncrypt'
|
import { encrypt } from '@/utils/rsaEncrypt'
|
||||||
import Config from '@/settings'
|
import Config from '@/settings'
|
||||||
import { getCodeImg } from '@/api/login'
|
import { getCodeImg, getDeviceInfo } from '@/api/login'
|
||||||
import Cookies from 'js-cookie'
|
import Cookies from 'js-cookie'
|
||||||
import qs from 'qs'
|
import qs from 'qs'
|
||||||
import Background from '@/assets/images/login.png'
|
import Background from '@/assets/images/background.webp'
|
||||||
|
import BindLicense from '@/views/licenseBind.vue'
|
||||||
|
import BindOrderNumber from '@/views/base-data/box/bindOrderNumber.vue'
|
||||||
export default {
|
export default {
|
||||||
name: 'Login',
|
name: 'Login',
|
||||||
|
components: { BindOrderNumber, BindLicense },
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
click_count: 0,
|
||||||
|
dialogFormVisible: true,
|
||||||
Background: Background,
|
Background: Background,
|
||||||
codeUrl: '',
|
codeUrl: '',
|
||||||
cookiePass: '',
|
cookiePass: '',
|
||||||
loginForm: {
|
loginForm: {
|
||||||
username: 'admin',
|
username: '',
|
||||||
password: '123456',
|
password: '',
|
||||||
rememberMe: false,
|
rememberMe: false,
|
||||||
code: '',
|
code: '',
|
||||||
uuid: ''
|
uuid: ''
|
||||||
|
|
@ -93,6 +99,7 @@ export default {
|
||||||
this.getCookie()
|
this.getCookie()
|
||||||
// token 过期提示
|
// token 过期提示
|
||||||
this.point()
|
this.point()
|
||||||
|
this.getDevice()
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
getCode() {
|
getCode() {
|
||||||
|
|
@ -101,6 +108,11 @@ export default {
|
||||||
this.loginForm.uuid = res.uuid
|
this.loginForm.uuid = res.uuid
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
getDevice() {
|
||||||
|
getDeviceInfo().then(res => {
|
||||||
|
this.$refs.BindLicense.form.deviceCode = res
|
||||||
|
})
|
||||||
|
},
|
||||||
getCookie() {
|
getCookie() {
|
||||||
const username = Cookies.get('username')
|
const username = Cookies.get('username')
|
||||||
let password = Cookies.get('password')
|
let password = Cookies.get('password')
|
||||||
|
|
@ -139,11 +151,13 @@ export default {
|
||||||
this.$store.dispatch('Login', user).then(() => {
|
this.$store.dispatch('Login', user).then(() => {
|
||||||
this.loading = false
|
this.loading = false
|
||||||
this.$router.push({ path: this.redirect || '/' })
|
this.$router.push({ path: this.redirect || '/' })
|
||||||
}).catch(() => {
|
// eslint-disable-next-line handle-callback-err
|
||||||
|
}).catch(err => {
|
||||||
this.loading = false
|
this.loading = false
|
||||||
this.getCode()
|
this.getCode()
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
|
console.log('error submit!!')
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
@ -159,6 +173,13 @@ export default {
|
||||||
})
|
})
|
||||||
Cookies.remove('point')
|
Cookies.remove('point')
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
bingLicense() {
|
||||||
|
this.click_count = this.click_count + 1
|
||||||
|
if (this.click_count % 10 === 0) {
|
||||||
|
this.$refs.BindLicense.dialogVisible = true
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue