This repository has been archived on 2025-09-14. You can view files and clone it, but cannot push or open issues or pull requests.
Files
cyber-narrator-cn-ui/src/Login.vue

41 lines
763 B
Vue
Raw Normal View History

2021-06-07 18:35:16 +08:00
<template>
2021-06-11 10:00:22 +08:00
<div>
<el-input v-model="username"></el-input>
<el-input v-model="pin"></el-input>
<button type="button" @click="login">Login</button>
</div>
2021-06-07 18:35:16 +08:00
</template>
<script>
2021-06-11 10:00:22 +08:00
import { mapActions } from 'vuex'
import { post } from '@/utils/http'
import bus from '@/utils/bus'
2021-06-07 18:35:16 +08:00
export default {
2021-06-11 10:00:22 +08:00
name: 'Login',
data () {
return {
username: 'admin',
pin: 'Nezha2021'
}
},
methods: {
...mapActions(['loginSuccess']),
login () {
post('sys/login', { username: this.username, pin: this.pin }).then(res => {
if (res.code === 200) {
localStorage.setItem('cn-username', this.username)
2021-06-11 10:00:22 +08:00
this.loginSuccess(res)
}
})
}
},
mounted () {
}
2021-06-07 18:35:16 +08:00
}
</script>
<style>
</style>