@jx3box/jx3box-common-ui 6.9.4 → 6.9.6
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 +1 -1
- package/src/author/UserPop.vue +94 -26
package/package.json
CHANGED
package/src/author/UserPop.vue
CHANGED
|
@@ -10,18 +10,34 @@
|
|
|
10
10
|
<slot></slot>
|
|
11
11
|
</div>
|
|
12
12
|
<div class="u-input">
|
|
13
|
-
<el-input
|
|
14
|
-
|
|
13
|
+
<el-input
|
|
14
|
+
v-model.trim.lazy="search"
|
|
15
|
+
placeholder="请输入用户 UID 或者昵称进行搜索"
|
|
16
|
+
@keydown.enter.native="onSearch"
|
|
17
|
+
>
|
|
18
|
+
<i slot="prepend" class="el-icon-search"></i>
|
|
15
19
|
</el-input>
|
|
20
|
+
<el-button class="u-search-btn" type="primary" @click="onSearch" :disabled="!search">搜索</el-button>
|
|
16
21
|
</div>
|
|
17
|
-
<div class="u-preview">
|
|
18
|
-
<
|
|
19
|
-
|
|
22
|
+
<div class="u-preview" v-loading="loading">
|
|
23
|
+
<template v-if="searched && status">
|
|
24
|
+
<a class="u-author" :href="'/author/' + userdata.ID" target="_blank">
|
|
25
|
+
<img class="u-avatar" :src="showAvatar(userdata.user_avatar)" />
|
|
26
|
+
<span class="u-name">{{ userdata.display_name || "-" }}</span>
|
|
27
|
+
</a>
|
|
28
|
+
</template>
|
|
29
|
+
<template v-else>
|
|
30
|
+
<img class="u-avatar" :src="showAvatar('')" />
|
|
31
|
+
<span class="u-name">-</span>
|
|
32
|
+
<div class="u-empty">
|
|
33
|
+
<i class="el-icon-warning-outline"></i>{{ searched ? "未找到匹配项" : "请输入搜索条件" }}
|
|
34
|
+
</div>
|
|
35
|
+
</template>
|
|
20
36
|
</div>
|
|
21
|
-
<
|
|
22
|
-
<el-button @click="
|
|
37
|
+
<div slot="footer" class="dialog-footer">
|
|
38
|
+
<el-button @click="cancel">取 消</el-button>
|
|
23
39
|
<el-button type="primary" @click="confirm">确 定</el-button>
|
|
24
|
-
</
|
|
40
|
+
</div>
|
|
25
41
|
</el-dialog>
|
|
26
42
|
</template>
|
|
27
43
|
|
|
@@ -35,11 +51,14 @@ export default {
|
|
|
35
51
|
return {
|
|
36
52
|
visible: false,
|
|
37
53
|
search: "",
|
|
54
|
+
searched: false,
|
|
38
55
|
userdata: {
|
|
56
|
+
ID: "",
|
|
39
57
|
name: "",
|
|
40
58
|
avatar: "",
|
|
41
59
|
},
|
|
42
|
-
status:
|
|
60
|
+
status: true,
|
|
61
|
+
loading: false,
|
|
43
62
|
};
|
|
44
63
|
},
|
|
45
64
|
model: {
|
|
@@ -47,11 +66,11 @@ export default {
|
|
|
47
66
|
event: "switchUserPop",
|
|
48
67
|
},
|
|
49
68
|
watch: {
|
|
50
|
-
show: function (
|
|
51
|
-
this.visible =
|
|
69
|
+
show: function (val) {
|
|
70
|
+
this.visible = val;
|
|
52
71
|
},
|
|
53
|
-
visible: function (
|
|
54
|
-
this.$emit("switchUserPop",
|
|
72
|
+
visible: function (val) {
|
|
73
|
+
this.$emit("switchUserPop", val);
|
|
55
74
|
},
|
|
56
75
|
},
|
|
57
76
|
methods: {
|
|
@@ -69,19 +88,43 @@ export default {
|
|
|
69
88
|
return showAvatar(val, "l");
|
|
70
89
|
},
|
|
71
90
|
onSearch() {
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
91
|
+
if (!this.search) {
|
|
92
|
+
this.userdata = {
|
|
93
|
+
name: "",
|
|
94
|
+
avatar: "",
|
|
95
|
+
};
|
|
96
|
+
this.status = true;
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
this.loading = true;
|
|
100
|
+
this.searched = false;
|
|
101
|
+
getUserInfoByUidOrName({ search: this.search })
|
|
102
|
+
.then((data) => {
|
|
103
|
+
if (data) {
|
|
104
|
+
this.status = true;
|
|
105
|
+
this.userdata = data;
|
|
106
|
+
} else {
|
|
107
|
+
this.status = false;
|
|
108
|
+
this.userdata = {
|
|
109
|
+
name: "",
|
|
110
|
+
avatar: "",
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
})
|
|
114
|
+
.finally(() => {
|
|
115
|
+
this.loading = false;
|
|
116
|
+
this.searched = true;
|
|
117
|
+
});
|
|
118
|
+
},
|
|
119
|
+
cancel() {
|
|
120
|
+
this.visible = false;
|
|
121
|
+
this.search = "";
|
|
122
|
+
this.userdata = {
|
|
123
|
+
name: "",
|
|
124
|
+
avatar: "",
|
|
125
|
+
};
|
|
126
|
+
this.status = true;
|
|
127
|
+
},
|
|
85
128
|
},
|
|
86
129
|
mounted: function () {},
|
|
87
130
|
components: {},
|
|
@@ -110,9 +153,34 @@ export default {
|
|
|
110
153
|
.x;
|
|
111
154
|
.db;
|
|
112
155
|
}
|
|
156
|
+
.u-author {
|
|
157
|
+
.db;
|
|
158
|
+
max-width: 280px;
|
|
159
|
+
.auto(x);
|
|
160
|
+
&:hover {
|
|
161
|
+
.u-avatar {
|
|
162
|
+
border-color: #ff71b8;
|
|
163
|
+
}
|
|
164
|
+
.u-name {
|
|
165
|
+
color: #ff71b8;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
}
|
|
113
169
|
.u-tip {
|
|
114
170
|
.fz(13px);
|
|
115
171
|
}
|
|
172
|
+
.u-input {
|
|
173
|
+
.flex;
|
|
174
|
+
align-items: center;
|
|
175
|
+
gap: 10px;
|
|
176
|
+
}
|
|
177
|
+
.u-empty {
|
|
178
|
+
color: #999;
|
|
179
|
+
.x;
|
|
180
|
+
}
|
|
181
|
+
.dialog-footer {
|
|
182
|
+
text-align: center;
|
|
183
|
+
}
|
|
116
184
|
}
|
|
117
185
|
|
|
118
186
|
@media screen and (max-width: @phone) {
|