no message
Former-commit-id: fde02fa98ee6a9cc6a6a9ed4933b34715910b342 [formerly fde02fa98ee6a9cc6a6a9ed4933b34715910b342 [formerly fde02fa98ee6a9cc6a6a9ed4933b34715910b342 [formerly fde02fa98ee6a9cc6a6a9ed4933b34715910b342 [formerly 343afc4dcaafa419ac669d402a897531de023220 [formerly ee190663eea91b7c43fa0950ca5e599c121f227f]]]]] Former-commit-id: b963a285c043a8f87f235b4a3d79798dc862a62e Former-commit-id: ff681ca1d0bfd0f3487ef6f74b658e031a58db2f Former-commit-id: ac3d0795933f1508b956b2c6a039ead7e6fb3d4a [formerly b3c5b462d69758026cef3cc29eccc1f04d454e2f] Former-commit-id: 8a73105b1e6dee21d61cf13dd661546f13f203f2 Former-commit-id: 976f312c74cf1833ef92dd7a6c7fa36b4da6e925 Former-commit-id: 87a343d87b25969aa8bcc12665cc7e63044c8bf2 Former-commit-id: a34ef0de27cc6992af1e3c12f7ec7df6dc1618aa Former-commit-id: 7edde307d869292feb955b4bfbf90fc03c128bd0
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<el-dropdown class="d2-mr">
|
<el-dropdown class="d2-mr">
|
||||||
<span class="btn-text">你好</span>
|
<span class="btn-text">你好 {{username}}</span>
|
||||||
<el-dropdown-menu slot="dropdown">
|
<el-dropdown-menu slot="dropdown">
|
||||||
<el-dropdown-item @click.native="logOff"><d2-icon name="power-off"/> 注销</el-dropdown-item>
|
<el-dropdown-item @click.native="logOff"><d2-icon name="power-off"/> 注销</el-dropdown-item>
|
||||||
<el-dropdown-item><d2-icon name="user-circle-o"/> 个人中心</el-dropdown-item>
|
<el-dropdown-item><d2-icon name="user-circle-o"/> 个人中心</el-dropdown-item>
|
||||||
@@ -9,8 +9,16 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
// 插件
|
||||||
import Cookies from 'js-cookie'
|
import Cookies from 'js-cookie'
|
||||||
|
import { mapState } from 'vuex'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
computed: {
|
||||||
|
...mapState({
|
||||||
|
username: state => state.d2admin.username
|
||||||
|
})
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
logOff () {
|
logOff () {
|
||||||
this.$confirm('注销此账户吗?', '注销', {
|
this.$confirm('注销此账户吗?', '注销', {
|
||||||
@@ -20,6 +28,7 @@ export default {
|
|||||||
}).then(() => {
|
}).then(() => {
|
||||||
// 删除cookie
|
// 删除cookie
|
||||||
Cookies.remove('token')
|
Cookies.remove('token')
|
||||||
|
Cookies.remove('uuid')
|
||||||
// 跳转路由
|
// 跳转路由
|
||||||
this.$router.push({
|
this.$router.push({
|
||||||
name: 'login'
|
name: 'login'
|
||||||
|
|||||||
@@ -48,6 +48,8 @@ require('particles.js')
|
|||||||
// https://vincentgarreau.com/particles.js/#default
|
// https://vincentgarreau.com/particles.js/#default
|
||||||
import config from './config/default'
|
import config from './config/default'
|
||||||
import Cookies from 'js-cookie'
|
import Cookies from 'js-cookie'
|
||||||
|
import { mapMutations } from 'vuex'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
@@ -74,6 +76,9 @@ export default {
|
|||||||
particlesJS('login', config)
|
particlesJS('login', config)
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
...mapMutations([
|
||||||
|
'd2adminUsernameSet'
|
||||||
|
]),
|
||||||
// 提交登陆信息
|
// 提交登陆信息
|
||||||
submit () {
|
submit () {
|
||||||
this.$refs.loginForm.validate((valid) => {
|
this.$refs.loginForm.validate((valid) => {
|
||||||
@@ -93,8 +98,11 @@ export default {
|
|||||||
const setting = {
|
const setting = {
|
||||||
expires: 1
|
expires: 1
|
||||||
}
|
}
|
||||||
|
// 设置 cookie
|
||||||
Cookies.set('uuid', res.uuid, setting)
|
Cookies.set('uuid', res.uuid, setting)
|
||||||
Cookies.set('token', res.token, setting)
|
Cookies.set('token', res.token, setting)
|
||||||
|
// 设置 vuex
|
||||||
|
this.d2adminUsernameSet(res.name)
|
||||||
// 跳转路由
|
// 跳转路由
|
||||||
this.$router.push({
|
this.$router.push({
|
||||||
name: 'index'
|
name: 'index'
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
9cb5ae65d8c8b6c41644e115280f0d3e8ef38d33
|
d778c730422f7b1f5003b5674b98394d12362a90
|
||||||
Reference in New Issue
Block a user