@jx3box/jx3box-common-ui 6.9.3 → 6.9.5

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,6 +1,6 @@
1
1
  {
2
2
  "name": "@jx3box/jx3box-common-ui",
3
- "version": "6.9.3",
3
+ "version": "6.9.5",
4
4
  "description": "JX3BOX UI",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -10,23 +10,29 @@
10
10
  <slot></slot>
11
11
  </div>
12
12
  <div class="u-input">
13
- <el-input v-model.trim.lazy="search" placeholder="请输入用户 UID 或者昵称进行搜索"></el-input>
13
+ <el-input v-model.trim.lazy="search" placeholder="请输入用户 UID 或者昵称进行搜索" @keydown.enter.native="onSearch">
14
+ <i slot="prepend" class="el-icon-search"></i>
15
+ </el-input>
16
+ <el-button class="u-search-btn" type="primary" @click="onSearch">搜索</el-button>
14
17
  </div>
15
- <div class="u-preview">
18
+ <div class="u-preview" v-loading="loading">
16
19
  <img class="u-avatar" :src="showAvatar(userdata.user_avatar)" />
17
20
  <span class="u-name">{{ userdata.display_name || "-" }}</span>
21
+
22
+ <div class="u-empty" v-if="!status">
23
+ <i class="el-icon-warning-outline"></i>未找到匹配项
24
+ </div>
18
25
  </div>
19
- <span slot="footer" class="dialog-footer">
20
- <el-button @click="visible = false">取 消</el-button>
26
+ <div slot="footer" class="dialog-footer">
27
+ <el-button @click="cancel">取 消</el-button>
21
28
  <el-button type="primary" @click="confirm">确 定</el-button>
22
- </span>
29
+ </div>
23
30
  </el-dialog>
24
31
  </template>
25
32
 
26
33
  <script>
27
34
  import { showAvatar } from "@jx3box/jx3box-common/js/utils";
28
35
  import { getUserInfoByUidOrName } from "../../service/author";
29
- import { debounce } from "lodash";
30
36
  export default {
31
37
  name: "userpop",
32
38
  props: ["title", "show"],
@@ -38,7 +44,8 @@ export default {
38
44
  name: "",
39
45
  avatar: "",
40
46
  },
41
- status: false,
47
+ status: true,
48
+ loading: false,
42
49
  };
43
50
  },
44
51
  model: {
@@ -46,25 +53,11 @@ export default {
46
53
  event: "switchUserPop",
47
54
  },
48
55
  watch: {
49
- search: debounce(function (newval) {
50
- getUserInfoByUidOrName({ search: newval }).then((data) => {
51
- if (data) {
52
- this.status = true;
53
- this.userdata = data;
54
- } else {
55
- this.status = false;
56
- this.userdata = {
57
- name: "",
58
- avatar: "",
59
- };
60
- }
61
- });
62
- }, 300),
63
- show: function (newval) {
64
- this.visible = newval;
56
+ show: function (val) {
57
+ this.visible = val;
65
58
  },
66
- visible: function (newval) {
67
- this.$emit("switchUserPop", newval);
59
+ visible: function (val) {
60
+ this.$emit("switchUserPop", val);
68
61
  },
69
62
  },
70
63
  methods: {
@@ -81,6 +74,40 @@ export default {
81
74
  showAvatar: function (val) {
82
75
  return showAvatar(val, "l");
83
76
  },
77
+ onSearch() {
78
+ if (!this.search) {
79
+ this.userdata = {
80
+ name: "",
81
+ avatar: "",
82
+ }
83
+ this.status = true;
84
+ return
85
+ }
86
+ this.loading = true;
87
+ getUserInfoByUidOrName({ search: this.search }).then((data) => {
88
+ if (data) {
89
+ this.status = true;
90
+ this.userdata = data;
91
+ } else {
92
+ this.status = false;
93
+ this.userdata = {
94
+ name: "",
95
+ avatar: "",
96
+ };
97
+ }
98
+ }).finally(() => {
99
+ this.loading = false;
100
+ });
101
+ },
102
+ cancel() {
103
+ this.visible = false;
104
+ this.search = "";
105
+ this.userdata = {
106
+ name: "",
107
+ avatar: "",
108
+ };
109
+ this.status = true;
110
+ }
84
111
  },
85
112
  mounted: function () {},
86
113
  components: {},
@@ -112,6 +139,18 @@ export default {
112
139
  .u-tip {
113
140
  .fz(13px);
114
141
  }
142
+ .u-input {
143
+ .flex;
144
+ align-items: center;
145
+ gap: 10px;
146
+ }
147
+ .u-empty {
148
+ color: #999;
149
+ .x;
150
+ }
151
+ .dialog-footer {
152
+ text-align: center;
153
+ }
115
154
  }
116
155
 
117
156
  @media screen and (max-width: @phone) {