Skip to content

Commit

Permalink
refresh userHome on edit
Browse files Browse the repository at this point in the history
  • Loading branch information
haojiezhe12345 committed Aug 9, 2024
1 parent 699ac08 commit d4f7097
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 12 deletions.
3 changes: 3 additions & 0 deletions index.css
Original file line number Diff line number Diff line change
Expand Up @@ -1982,6 +1982,9 @@ p.altLoginOption,

.userHome .useraction ul>li {
padding: 0.625rem 1.5rem;
animation-name: enableClickDelayed;
animation-duration: 0.1s;
animation-fill-mode: forwards;
}

.userHome .useraction ul>li:hover {
Expand Down
32 changes: 20 additions & 12 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -888,6 +888,20 @@ const User = {
methods: {
convertAvatarPath: User.convertAvatarPath,

getUser() {
XHR.get(this.id ? 'user/find' : 'user/me', {
id: this.id
}).then(r => {
let user = Array.isArray(r) ? r[0] : r
if (user) {
this.user = user
this.getComments()
} else {
FloatMsgs.show({ type: 'warn', msg: `<span class="ui zh">找不到用户</span><span class="ui en">User not found</span> (ID: ${this.id})` })
}
})
},

getComments() {
this.scrollPaused = true

Expand Down Expand Up @@ -938,18 +952,7 @@ const User = {
name: this.name,
avatar: this.avatar,
}

XHR.get(this.id ? 'user/find' : 'user/me', {
id: this.id
}).then(r => {
let user = Array.isArray(r) ? r[0] : r
if (user) {
this.user = user
this.getComments()
} else {
FloatMsgs.show({ type: 'warn', msg: `<span class="ui zh">找不到用户</span><span class="ui en">User not found</span> (ID: ${this.id})` })
}
})
this.getUser()
},
})
},
Expand Down Expand Up @@ -1031,6 +1034,11 @@ const User = {
document.getElementById('msgPopupAvatar').src = User.convertAvatarPath(r.avatar)
document.getElementById('senderText').textContent = r.name
} catch (error) { }
Popup.VuePopups.$children.forEach(v => {
if (v.$options.name == 'userHome') {
v.getUser()
}
})
})
userInfo.onclick = () => this.showMe()
userInfo.classList.remove('nologin')
Expand Down

0 comments on commit d4f7097

Please sign in to comment.