waibu-bootstrap 1.0.18 → 1.0.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,9 +1,19 @@
|
|
|
1
1
|
async function navDropdownUser () {
|
|
2
2
|
return class NavDropdownUser extends this.baseFactory {
|
|
3
3
|
async build () {
|
|
4
|
+
const { has } = this.plugin.app.bajo.lib._
|
|
4
5
|
const { routePath } = this.plugin.app.waibu
|
|
6
|
+
const { req } = this.component
|
|
5
7
|
const icon = this.component.req.iconset ? await this.component.buildTag({ tag: 'icon', attr: { name: 'person' } }) : ''
|
|
6
|
-
let text =
|
|
8
|
+
let text = ''
|
|
9
|
+
if (has(this.params.attr, 'showName')) {
|
|
10
|
+
if (req.user) {
|
|
11
|
+
if (this.params.attr.showName === 'username') text = req.user.username
|
|
12
|
+
else if (this.params.attr.showName === 'full') text = `${req.user.firstName} ${req.user.lastName}`
|
|
13
|
+
else if (this.params.attr.showName === 'short') text = `${req.user.firstName} ${req.user.lastName[0]}.`
|
|
14
|
+
else text = req.user[this.params.attr.showName]
|
|
15
|
+
} else text = req.t('guest')
|
|
16
|
+
}
|
|
7
17
|
if (this.params.attr.noText) text = ''
|
|
8
18
|
const html = []
|
|
9
19
|
const attr = {
|