@jx3box/jx3box-common-ui 6.0.1 → 6.0.2

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.0.1",
3
+ "version": "6.0.2",
4
4
  "description": "JX3BOX UI",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -31,7 +31,7 @@
31
31
  ],
32
32
  "dependencies": {
33
33
  "@jx3box/jx3box-comment-ui": "^1.7.0",
34
- "@jx3box/jx3box-common": "^7.3.5",
34
+ "@jx3box/jx3box-common": "^7.3.6",
35
35
  "@jx3box/jx3box-data": "^1.10.2",
36
36
  "@jx3box/jx3box-editor": "^1.4.3",
37
37
  "axios": "^0.26.1",
@@ -1,34 +1,37 @@
1
1
  <template>
2
2
  <div class="u-follow">
3
3
  <el-button
4
+ v-if="!isFollow"
4
5
  :class="{ 'is-follow': isFollow }"
5
6
  size="mini"
6
7
  :icon="btnIcon"
7
8
  @click="follow"
9
+ :disabled="isSelf"
8
10
  :type="btnType"
9
- v-if="!isFollow"
10
11
  :loading="loading"
11
12
  >
12
13
  {{ btnText }}<span class="u-follow-count">{{ formatFansNum(fansNum) }}</span>
13
14
  </el-button>
14
- <el-popover
15
- v-else
16
- placement="bottom"
17
- trigger="hover"
18
- popper-class="u-follow-popover"
19
- :visible-arrow="false"
20
- >
21
- <div class="u-action-list">
22
- <div class="u-action-item" v-for="item in actions" :key="item.label" @click.stop="item.action">{{ item.label }}</div>
23
- </div>
24
- <el-button class="u-unfollow-btn" size="mini" :type="btnType" slot="reference">{{ btnText }}<span class="u-follow-count">{{ formatFansNum(fansNum) }}</span></el-button>
25
- </el-popover>
15
+ <template v-else>
16
+ <el-popover
17
+ placement="bottom"
18
+ trigger="hover"
19
+ popper-class="u-follow-popover"
20
+ :visible-arrow="false"
21
+ >
22
+ <div class="u-action-list">
23
+ <div class="u-action-item" v-for="item in actions" :key="item.label" @click.stop="item.action">{{ item.label }}</div>
24
+ </div>
25
+ <el-button class="u-unfollow-btn" size="mini" :type="btnType" slot="reference">{{ btnText }}<span class="u-follow-count">{{ formatFansNum(fansNum) }}</span></el-button>
26
+ </el-popover>
27
+ </template>
26
28
  <el-button size="mini" icon="el-icon-message" disabled title="Lv4+可用">私信</el-button>
27
29
  </div>
28
30
  </template>
29
31
 
30
32
  <script>
31
- import { follow, unfollow, getMyFollowList, getFansCount } from "../../service/follow";
33
+ import { follow, unfollow, getFansCount } from "../../service/follow";
34
+ import User from "@jx3box/jx3box-common/js/user";
32
35
  export default {
33
36
  name: "AuthorFollow",
34
37
  props: {
@@ -49,7 +52,7 @@ export default {
49
52
  return this.isFollow ? "已关注" : "关注";
50
53
  },
51
54
  btnIcon() {
52
- return this.isFollow ? "" : "el-icon-plus";
55
+ return this.isSelf ? "" : (this.isFollow ? "" : "el-icon-plus");
53
56
  },
54
57
  btnType() {
55
58
  return this.isFollow ? "info" : "warning"
@@ -63,16 +66,27 @@ export default {
63
66
  },
64
67
  },
65
68
  ];
66
- }
69
+ },
70
+ isSelf() {
71
+ return this.uid == this.user.uid;
72
+ },
73
+ user() {
74
+ return User.getInfo();
75
+ },
67
76
  },
68
- mounted () {
69
- this.loadFans();
77
+ watch: {
78
+ uid: {
79
+ immediate: true,
80
+ handler(val) {
81
+ val && this.loadFans();
82
+ },
83
+ }
70
84
  },
71
85
  methods: {
72
86
  // 格式化粉丝数
73
87
  formatFansNum(num) {
74
88
  if (num < 10000) {
75
- return num;
89
+ return num === 0 ? "" : num;
76
90
  } else {
77
91
  return (num / 10000).toFixed(1) + "万";
78
92
  }