File tree 4 files changed +34
-19
lines changed
4 files changed +34
-19
lines changed Original file line number Diff line number Diff line change @@ -37,7 +37,7 @@ module.exports = {
37
37
'camelcase' : [ 0 , {
38
38
'properties' : 'always'
39
39
} ] ,
40
- 'comma-dangle' : [ 2 , 'never ' ] ,
40
+ 'comma-dangle' : [ 2 , 'always-multiline ' ] ,
41
41
'comma-spacing' : [ 2 , {
42
42
'before' : false ,
43
43
'after' : true
Original file line number Diff line number Diff line change @@ -14,22 +14,23 @@ export default {
14
14
props: [' username' ],
15
15
computed: {
16
16
... mapGetters ([
17
- ' ojInfo'
17
+ ' ojInfo' ,
18
+ ' profile' ,
18
19
]),
19
20
getSolveCount () {
20
21
return Object .keys (this .ojInfo ).map ((oj , ind ) => {
21
22
return {
22
23
index: ind,
23
- oj
24
+ oj,
24
25
}
25
26
})
26
- }
27
+ },
27
28
},
28
29
async created () {
29
30
if (Object .keys (this .ojInfo ).length === 0 ) {
30
31
await this .$store .dispatch (GetOjInfo)
31
32
}
32
- }
33
+ },
33
34
}
34
35
</script >
35
36
Original file line number Diff line number Diff line change @@ -21,27 +21,33 @@ export default {
21
21
computed: {
22
22
... mapGetters ([
23
23
' user' ,
24
- ' profile'
24
+ ' profile' ,
25
25
]),
26
26
getUserFields () {
27
- return [{
27
+ const ret = [{
28
28
feature: ' Email' ,
29
29
icon: ' envelope' ,
30
- value: this .profile .email
30
+ value: this .user .email ,
31
31
}, {
32
32
feature: ' Username' ,
33
33
icon: ' user' ,
34
- value: this .profile .username
34
+ value: this .profile .username ,
35
+ public: true ,
35
36
}, {
36
37
feature: ' Roles' ,
37
38
icon: ' users' ,
38
- value: this .profile .roles .join (' , ' )
39
+ value: this .profile .roles .join (' , ' ),
40
+ public: true ,
39
41
}, {
40
42
feature: ' Password' ,
41
- icon: ' key'
42
- }]
43
- }
44
- }
43
+ icon: ' key' ,
44
+ } ]
45
+ return this .isOwner ? ret : ret .filter ((x ) => x .public )
46
+ },
47
+ isOwner () {
48
+ return this .user .username === this .profile .username
49
+ },
50
+ },
45
51
}
46
52
</script >
47
53
Original file line number Diff line number Diff line change 13
13
<script >
14
14
import { UserProfile , SolveCount } from ' ./components'
15
15
import { FetchProfile } from ' @/store/actions'
16
+ import { mapGetters } from ' vuex'
16
17
17
18
export default {
18
19
components: { UserProfile, SolveCount },
19
20
props: [' username' ],
20
21
data () {
21
22
return {
22
- loading: true
23
+ loading: true ,
23
24
}
24
25
},
26
+ computed: {
27
+ ... mapGetters ([
28
+ ' user' ,
29
+ ]),
30
+ },
25
31
watch: {
26
- ' $route' : ' initiateUser'
32
+ ' $route' : ' initiateUser' ,
27
33
},
28
34
async created () {
29
35
await this .initiateUser ()
30
36
},
31
37
methods: {
32
38
async initiateUser () {
39
+ if (this .username === ' :username' ) {
40
+ return this .$router .push (` /user/profile/${ this .user .username } ` )
41
+ }
33
42
try {
34
- console .log (' disptach profile' )
35
43
await this .$store .dispatch (FetchProfile, this .username )
36
44
} finally {
37
45
this .loading = false
38
46
}
39
- }
40
- }
47
+ },
48
+ },
41
49
}
42
50
</script >
43
51
You can’t perform that action at this time.
0 commit comments