2020-11-09 12:32:24 +08:00

75 lines
1.8 KiB
Vue

<!-- -->
<template>
<div>
<router-view></router-view>
<div @dblclick="handleClick" class="hide">
</div>
<div v-if="!islzmanagement && isShow" class="login">
<el-input
style="width:400px;"
placeholder="请输入内容"
v-model="input"
clearable>
</el-input>
<el-button @click="handleLogin" type="primary"> </el-button>
<div style="margin:20px 0;">token : {{token}}</div>
</div>
</div>
</template>
<script>
import { apiLogin, apiSendSMS, apiUserInfo } from '@/api/data'
import { mapMutations } from 'vuex'
let hostList = 'lzmanagement.ldxinyong.com'
let thostList = 'tlzmanagement.ldxinyong.com'
const islzmanagement = window.location.host.indexOf('hostList') > -1 && window.location.host.indexOf('hostList') < 0
export default {
data () {
return {
isShow: false,
islzmanagement,
input: localStorage.getItem('input'),
verify: '888888',
token: this.$cookies.get('token')
}
},
computed: {},
beforeMount () {},
mounted () {},
methods: {
...mapMutations(['SET_USER_INFO']),
handleClick () {
this.isShow = !this.isShow
},
async handleLogin () {
localStorage.setItem('input', this.input)
const params = {'userName': this.input, 'password': 'admin', 'uuid': '', 'verify': this.verify, 'verifyCode': this.verify}
let res = await apiLogin(params)
if (res.code === 200) {
this.token = res.token
this.$cookies.set('token', res.token, res.expire)
let ress = await apiUserInfo()
if (ress.code === 200) {
this.SET_USER_INFO(ress.user)
}
location.reload()
}
}
},
watch: {}
}
</script>
<style lang='less' scoped>
.login{
margin: 20px 0;
}
.hide{
width: 100px;
height: 100px;
}
</style>