@jx3box/jx3box-common-ui 6.9.2 → 6.9.4

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.2",
3
+ "version": "6.9.4",
4
4
  "description": "JX3BOX UI",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/service/author.js CHANGED
@@ -10,6 +10,15 @@ function getUserInfo(uid) {
10
10
  });
11
11
  }
12
12
 
13
+ // 根据用户id或者昵称获取用户信息
14
+ function getUserInfoByUidOrName(params) {
15
+ return $cms({ mute: true }).get(`/api/cms/user/search`, {
16
+ params: params,
17
+ }).then((res) => {
18
+ return res.data.data;
19
+ });
20
+ }
21
+
13
22
  function getMyInfo(){
14
23
  return $cms({ mute: true })
15
24
  .get(`/api/cms/user/my/info`)
@@ -71,6 +80,7 @@ function userSignIn(){
71
80
  function getFansList(userid,limit) {
72
81
  return $pay().get(`/api/cny/consume/user-charge/rank/of/${userid}?limit=0`,);
73
82
  }
83
+
74
84
  export {
75
85
  getUserInfo,
76
86
  getUserPosts,
@@ -81,5 +91,6 @@ export {
81
91
  getSuperAuthor,
82
92
  getMyInfo,
83
93
  userSignIn,
84
- getFansList
94
+ getFansList,
95
+ getUserInfoByUidOrName
85
96
  };
@@ -10,7 +10,9 @@
10
10
  <slot></slot>
11
11
  </div>
12
12
  <div class="u-input">
13
- <el-input v-model.number="uid" placeholder="请输入UID(数字)"></el-input>
13
+ <el-input v-model.trim.lazy="search" placeholder="请输入用户 UID 或者昵称进行搜索" @keydown.enter.native="onSearch">
14
+ <el-button slot="append" icon="el-icon-search" @click="onSearch"></el-button>
15
+ </el-input>
14
16
  </div>
15
17
  <div class="u-preview">
16
18
  <img class="u-avatar" :src="showAvatar(userdata.user_avatar)" />
@@ -25,14 +27,14 @@
25
27
 
26
28
  <script>
27
29
  import { showAvatar } from "@jx3box/jx3box-common/js/utils";
28
- import { getUserInfo } from "../../service/author";
30
+ import { getUserInfoByUidOrName } from "../../service/author";
29
31
  export default {
30
32
  name: "userpop",
31
33
  props: ["title", "show"],
32
34
  data: function () {
33
35
  return {
34
36
  visible: false,
35
- uid: "",
37
+ search: "",
36
38
  userdata: {
37
39
  name: "",
38
40
  avatar: "",
@@ -45,20 +47,6 @@ export default {
45
47
  event: "switchUserPop",
46
48
  },
47
49
  watch: {
48
- uid: function (newval) {
49
- getUserInfo(newval).then((data) => {
50
- if (data) {
51
- this.status = true;
52
- this.userdata = data;
53
- } else {
54
- this.status = false;
55
- this.userdata = {
56
- name: "",
57
- avatar: "",
58
- };
59
- }
60
- });
61
- },
62
50
  show: function (newval) {
63
51
  this.visible = newval;
64
52
  },
@@ -66,7 +54,6 @@ export default {
66
54
  this.$emit("switchUserPop", newval);
67
55
  },
68
56
  },
69
- computed: {},
70
57
  methods: {
71
58
  confirm: function () {
72
59
  if (this.status) {
@@ -81,6 +68,20 @@ export default {
81
68
  showAvatar: function (val) {
82
69
  return showAvatar(val, "l");
83
70
  },
71
+ onSearch() {
72
+ getUserInfoByUidOrName({ search: this.search }).then((data) => {
73
+ if (data) {
74
+ this.status = true;
75
+ this.userdata = data;
76
+ } else {
77
+ this.status = false;
78
+ this.userdata = {
79
+ name: "",
80
+ avatar: "",
81
+ };
82
+ }
83
+ });
84
+ }
84
85
  },
85
86
  mounted: function () {},
86
87
  components: {},