81 lines
1.9 KiB
Vue
81 lines
1.9 KiB
Vue
<!-- -->
|
|
<template>
|
|
<div>
|
|
<router-view></router-view>
|
|
<div @dblclick="handleClick"
|
|
class="hide">
|
|
</div>
|
|
<div v-if="isNodd && 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 * as dd from 'dingtalk-jsapi'
|
|
import { mapMutations } from 'vuex'
|
|
export default {
|
|
data () {
|
|
return {
|
|
isShow: false,
|
|
isNodd: dd.other,
|
|
input: localStorage.getItem('input'),
|
|
verify: '888888',
|
|
token: this.$cookies.get('token')
|
|
}
|
|
},
|
|
computed: {
|
|
},
|
|
beforeMount () { },
|
|
mounted () { },
|
|
methods: {
|
|
...mapMutations(['SET_USER_INFO', 'SET_USER_AUTH']),
|
|
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 xcq = await this.$store.dispatch('GET_USERINFO')
|
|
// let ress = await apiUserInfo()
|
|
// if (ress.code === 200) {
|
|
// this.SET_USER_INFO(ress.user)
|
|
// this.SET_USER_AUTH(ress.data)
|
|
// } else {
|
|
// this.$message.error(ress.msg0)
|
|
// }
|
|
// location.reload()
|
|
} else {
|
|
this.$message.error(res.msg)
|
|
}
|
|
}
|
|
},
|
|
watch: {}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
<style lang='less' scoped>
|
|
.login {
|
|
margin: 20px 0;
|
|
}
|
|
.hide {
|
|
width: 100px;
|
|
height: 100px;
|
|
}
|
|
</style>
|