7
7
<img src =" /blogv.png" style =" width : 60px ;" />
8
8
</a >
9
9
<div class =" header-container-userinfo" >
10
- <template v-if =" ! user . isAuthenticated " >
10
+ <template v-if =" ! sysUserName " >
11
11
<a
12
12
@click =" login"
13
13
class =" header-container-userinfo-login header-container-user-btn header-container-in header-container-user-size"
27
27
</a >
28
28
</template >
29
29
<template v-else >
30
- <a href =" https://ids.neters.club/" class =" header-container-banner-item-btn" >{{ user.name }}</a >
30
+ <a
31
+ href =" https://ids.neters.club/"
32
+ class =" header-container-banner-item-btn"
33
+ >{{ sysUserName }}</a >
31
34
<a
32
35
href =" /Editor"
33
36
class =" header-container-user-btn header-container-hv header-container-user-size _1YbC5u"
40
43
</template >
41
44
</div >
42
45
<div class =" header-container-banner" >
43
- <div class = " " >
46
+ <div class >
44
47
<div class =" header-container-banner-item" >
45
48
<a class =" header-container-banner-item-btn" href =" /" >首页</a >
46
49
<a
54
57
</div >
55
58
</div >
56
59
</header >
57
- <div id =" nav" >
58
-
59
- </div >
60
+ <div id =" nav" ></div >
60
61
<router-view />
61
62
</div >
62
63
</template >
@@ -69,7 +70,15 @@ export default {
69
70
name: " app" ,
70
71
mixins: [userAuth],
71
72
data : function () {
72
- return {};
73
+ return {
74
+ sysUserName: " "
75
+ };
76
+ },
77
+ updated () {
78
+ this .sysUserName = window .localStorage .getItem (" USER_NAME" ) || " " ;
79
+ },
80
+ created () {
81
+ this .sysUserName = window .localStorage .getItem (" USER_NAME" ) || " " ;
73
82
},
74
83
watch: {
75
84
$route : async function (to , from ) {
@@ -88,6 +97,7 @@ export default {
88
97
},
89
98
async logout () {
90
99
try {
100
+ window .localStorage .removeItem (" USER_NAME" );
91
101
await applicationUserManager .logout ();
92
102
this .$store .commit (" saveToken" , " " );
93
103
} catch (error) {
@@ -262,12 +272,14 @@ a {
262
272
padding : 0 20px ;
263
273
cursor : pointer ;
264
274
}
265
- .header-container-logout {
266
- color : #00 7b ff ;
267
- margin-left : 10px ;
268
- border : 1px solid transparent ;
269
- padding : .375rem .75rem ;
270
- border-radius : .25rem ;
271
- border-color : #00 7b ff ;
275
+
276
+ .header-container-logout {
277
+ cursor : pointer ;
278
+ color : #00 7b ff ;
279
+ margin-left : 10px ;
280
+ border : 1px solid transparent ;
281
+ padding : 0.375rem 0.75rem ;
282
+ border-radius : 0.25rem ;
283
+ border-color : #00 7b ff ;
272
284
}
273
285
</style >
0 commit comments