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() {
 | 
			
		||||
  return request({
 | 
			
		||||
    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>
 | 
			
		||||
  <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">
 | 
			
		||||
      <h3 class="title">
 | 
			
		||||
        WMS 仓储管理系统
 | 
			
		||||
      <h3 class="title" @click="bingLicense">
 | 
			
		||||
        WMS 管理系统
 | 
			
		||||
      </h3>
 | 
			
		||||
      <el-form-item prop="username">
 | 
			
		||||
        <el-input v-model="loginForm.username" type="text" auto-complete="off" placeholder="账号">
 | 
			
		||||
| 
						 | 
				
			
			@ -44,20 +45,25 @@
 | 
			
		|||
<script>
 | 
			
		||||
import { encrypt } from '@/utils/rsaEncrypt'
 | 
			
		||||
import Config from '@/settings'
 | 
			
		||||
import { getCodeImg } from '@/api/login'
 | 
			
		||||
import { getCodeImg, getDeviceInfo } from '@/api/login'
 | 
			
		||||
import Cookies from 'js-cookie'
 | 
			
		||||
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 {
 | 
			
		||||
  name: 'Login',
 | 
			
		||||
  components: { BindOrderNumber, BindLicense },
 | 
			
		||||
  data() {
 | 
			
		||||
    return {
 | 
			
		||||
      click_count: 0,
 | 
			
		||||
      dialogFormVisible: true,
 | 
			
		||||
      Background: Background,
 | 
			
		||||
      codeUrl: '',
 | 
			
		||||
      cookiePass: '',
 | 
			
		||||
      loginForm: {
 | 
			
		||||
        username: 'admin',
 | 
			
		||||
        password: '123456',
 | 
			
		||||
        username: '',
 | 
			
		||||
        password: '',
 | 
			
		||||
        rememberMe: false,
 | 
			
		||||
        code: '',
 | 
			
		||||
        uuid: ''
 | 
			
		||||
| 
						 | 
				
			
			@ -93,6 +99,7 @@ export default {
 | 
			
		|||
    this.getCookie()
 | 
			
		||||
    // token 过期提示
 | 
			
		||||
    this.point()
 | 
			
		||||
    this.getDevice()
 | 
			
		||||
  },
 | 
			
		||||
  methods: {
 | 
			
		||||
    getCode() {
 | 
			
		||||
| 
						 | 
				
			
			@ -101,6 +108,11 @@ export default {
 | 
			
		|||
        this.loginForm.uuid = res.uuid
 | 
			
		||||
      })
 | 
			
		||||
    },
 | 
			
		||||
    getDevice() {
 | 
			
		||||
      getDeviceInfo().then(res => {
 | 
			
		||||
        this.$refs.BindLicense.form.deviceCode = res
 | 
			
		||||
      })
 | 
			
		||||
    },
 | 
			
		||||
    getCookie() {
 | 
			
		||||
      const username = Cookies.get('username')
 | 
			
		||||
      let password = Cookies.get('password')
 | 
			
		||||
| 
						 | 
				
			
			@ -139,11 +151,13 @@ export default {
 | 
			
		|||
          this.$store.dispatch('Login', user).then(() => {
 | 
			
		||||
            this.loading = false
 | 
			
		||||
            this.$router.push({ path: this.redirect || '/' })
 | 
			
		||||
          }).catch(() => {
 | 
			
		||||
            // eslint-disable-next-line handle-callback-err
 | 
			
		||||
          }).catch(err => {
 | 
			
		||||
            this.loading = false
 | 
			
		||||
            this.getCode()
 | 
			
		||||
          })
 | 
			
		||||
        } else {
 | 
			
		||||
          console.log('error submit!!')
 | 
			
		||||
          return false
 | 
			
		||||
        }
 | 
			
		||||
      })
 | 
			
		||||
| 
						 | 
				
			
			@ -159,6 +173,13 @@ export default {
 | 
			
		|||
        })
 | 
			
		||||
        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