@@ -16,9 +16,11 @@ export class AccountViewDataProvider implements TreeDataProvider<TreeItem> {
16
16
async getChildren ( el ?: TreeItem ) {
17
17
if ( ! ( await AuthManager . isAuthed ( ) ) || el !== undefined ) return [ ]
18
18
19
- const userName = ( await UserService . getUserInfo ( ) ) ?. displayName
20
- return [
21
- { label : userName , tooltip : '用户名' , iconPath : new ThemeIcon ( 'account' ) } ,
19
+ const user = await UserService . getUserInfo ( )
20
+ if ( user == null ) return [ ]
21
+
22
+ const items = [
23
+ { label : user . displayName , tooltip : '用户名' , iconPath : new ThemeIcon ( 'account' ) } ,
22
24
{
23
25
label : '账号设置' ,
24
26
command : {
@@ -27,22 +29,41 @@ export class AccountViewDataProvider implements TreeDataProvider<TreeItem> {
27
29
} ,
28
30
iconPath : new ThemeIcon ( 'gear' ) ,
29
31
} ,
30
- {
31
- label : '博客后台' ,
32
+ ]
33
+
34
+ if ( user . isVip !== true ) {
35
+ items . push ( {
36
+ label : '购买会员' ,
32
37
command : {
33
- title : '打开博客后台 ' ,
34
- command : 'vscode-cnb.open.blog-console ' ,
38
+ title : '购买博客园会员 ' ,
39
+ command : 'vscode-cnb.open.buy-vip ' ,
35
40
} ,
36
- iconPath : new ThemeIcon ( 'console' ) ,
37
- } ,
38
- {
39
- label : '我的博客' ,
40
- command : {
41
- title : '打开我的博客' ,
42
- command : 'vscode-cnb.open.my-blog' ,
41
+ iconPath : new ThemeIcon ( 'heart' ) ,
42
+ } )
43
+ }
44
+
45
+ if ( user . blogApp != null ) {
46
+ items . push (
47
+ {
48
+ label : '博客后台' ,
49
+ command : {
50
+ title : '打开博客后台' ,
51
+ command : 'vscode-cnb.open.blog-console' ,
52
+ } ,
53
+ iconPath : new ThemeIcon ( 'console' ) ,
43
54
} ,
44
- iconPath : new ThemeIcon ( 'window' ) ,
45
- } ,
55
+ {
56
+ label : '我的博客' ,
57
+ command : {
58
+ title : '打开我的博客' ,
59
+ command : 'vscode-cnb.open.my-blog' ,
60
+ } ,
61
+ iconPath : new ThemeIcon ( 'window' ) ,
62
+ }
63
+ )
64
+ }
65
+
66
+ items . push (
46
67
{
47
68
label : '我的主页' ,
48
69
command : {
@@ -58,8 +79,10 @@ export class AccountViewDataProvider implements TreeDataProvider<TreeItem> {
58
79
command : 'vscode-cnb.logout' ,
59
80
} ,
60
81
iconPath : new ThemeIcon ( 'log-out' ) ,
61
- } ,
62
- ]
82
+ }
83
+ )
84
+
85
+ return items
63
86
}
64
87
65
88
fireTreeDataChangedEvent ( ) {
0 commit comments