@jx3box/jx3box-common-ui 6.0.1 → 6.0.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 +2 -2
- package/src/Author.vue +1 -4
- package/src/author/AuthorFollow.vue +57 -12
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jx3box/jx3box-common-ui",
|
|
3
|
-
"version": "6.0.
|
|
3
|
+
"version": "6.0.4",
|
|
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.
|
|
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",
|
package/src/Author.vue
CHANGED
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
</div>
|
|
28
28
|
</div>
|
|
29
29
|
<div class="u-bio">{{ data.user_bio }}</div>
|
|
30
|
-
<AuthorFollow
|
|
30
|
+
<AuthorFollow class="u-follow-box" :uid="uid" />
|
|
31
31
|
<div class="u-link" v-if="hasLink">
|
|
32
32
|
<a v-if="data.weibo_name" class="u-weibo" :href="weiboLink(data.weibo_id)" target="_blank">
|
|
33
33
|
<img svg-inline src="../assets/img/author/weibo.svg" />
|
|
@@ -152,9 +152,6 @@ export default {
|
|
|
152
152
|
level: function() {
|
|
153
153
|
return User.getLevel(this.data?.experience);
|
|
154
154
|
},
|
|
155
|
-
isLogin: function() {
|
|
156
|
-
return User.isLogin();
|
|
157
|
-
},
|
|
158
155
|
},
|
|
159
156
|
methods: {
|
|
160
157
|
loadData: function() {
|
|
@@ -1,13 +1,29 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="u-follow">
|
|
3
|
+
<!-- <template v-if="isLogin">
|
|
4
|
+
<template v-if="isSelf">
|
|
5
|
+
<div class="u-fans-box">
|
|
6
|
+
<span class="u-fans-label">关注</span>
|
|
7
|
+
<span class="u-fans">{{ formatFansNum(fansNum) }}</span>
|
|
8
|
+
</div>
|
|
9
|
+
</template>
|
|
10
|
+
<template v-else>
|
|
11
|
+
|
|
12
|
+
</template>
|
|
13
|
+
</template>
|
|
14
|
+
<el-button class="u-fans-box" @click="follow" size="mini" v-else>
|
|
15
|
+
<span class="u-fans-label">关注</span>
|
|
16
|
+
<span class="u-fans">{{ formatFansNum(fansNum) }}</span>
|
|
17
|
+
</el-button> -->
|
|
3
18
|
<el-button
|
|
4
|
-
|
|
19
|
+
v-if="!isFollow"
|
|
20
|
+
:class="{ 'is-follow': isFollow, 'u-fans-box': isSelf }"
|
|
5
21
|
size="mini"
|
|
6
|
-
:icon="btnIcon"
|
|
22
|
+
:icon="!isSelf && btnIcon"
|
|
7
23
|
@click="follow"
|
|
8
|
-
:type="btnType"
|
|
9
|
-
v-if="!isFollow"
|
|
24
|
+
:type="isSelf ? '' : btnType"
|
|
10
25
|
:loading="loading"
|
|
26
|
+
:disabled="isSelf"
|
|
11
27
|
>
|
|
12
28
|
{{ btnText }}<span class="u-follow-count">{{ formatFansNum(fansNum) }}</span>
|
|
13
29
|
</el-button>
|
|
@@ -28,7 +44,8 @@
|
|
|
28
44
|
</template>
|
|
29
45
|
|
|
30
46
|
<script>
|
|
31
|
-
import { follow, unfollow,
|
|
47
|
+
import { follow, unfollow, getFansCount } from "../../service/follow";
|
|
48
|
+
import User from "@jx3box/jx3box-common/js/user";
|
|
32
49
|
export default {
|
|
33
50
|
name: "AuthorFollow",
|
|
34
51
|
props: {
|
|
@@ -49,7 +66,7 @@ export default {
|
|
|
49
66
|
return this.isFollow ? "已关注" : "关注";
|
|
50
67
|
},
|
|
51
68
|
btnIcon() {
|
|
52
|
-
return this.isFollow ? "" : "el-icon-plus";
|
|
69
|
+
return this.isSelf ? "" : (this.isFollow ? "" : "el-icon-plus");
|
|
53
70
|
},
|
|
54
71
|
btnType() {
|
|
55
72
|
return this.isFollow ? "info" : "warning"
|
|
@@ -63,22 +80,40 @@ export default {
|
|
|
63
80
|
},
|
|
64
81
|
},
|
|
65
82
|
];
|
|
66
|
-
}
|
|
83
|
+
},
|
|
84
|
+
isSelf() {
|
|
85
|
+
return this.uid == this.user.uid;
|
|
86
|
+
},
|
|
87
|
+
user() {
|
|
88
|
+
return User.getInfo();
|
|
89
|
+
},
|
|
90
|
+
isLogin: function() {
|
|
91
|
+
return User.isLogin();
|
|
92
|
+
},
|
|
67
93
|
},
|
|
68
|
-
|
|
69
|
-
|
|
94
|
+
watch: {
|
|
95
|
+
uid: {
|
|
96
|
+
immediate: true,
|
|
97
|
+
handler(val) {
|
|
98
|
+
val && this.loadFans();
|
|
99
|
+
},
|
|
100
|
+
}
|
|
70
101
|
},
|
|
71
102
|
methods: {
|
|
72
103
|
// 格式化粉丝数
|
|
73
104
|
formatFansNum(num) {
|
|
74
105
|
if (num < 10000) {
|
|
75
|
-
return num;
|
|
106
|
+
return num === 0 ? "" : num;
|
|
76
107
|
} else {
|
|
77
108
|
return (num / 10000).toFixed(1) + "万";
|
|
78
109
|
}
|
|
79
110
|
},
|
|
80
111
|
// 关注
|
|
81
112
|
follow() {
|
|
113
|
+
if (!this.isLogin) {
|
|
114
|
+
User.toLogin();
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
82
117
|
follow(this.uid)
|
|
83
118
|
.then((res) => {
|
|
84
119
|
this.$message.success("关注成功");
|
|
@@ -139,7 +174,7 @@ export default {
|
|
|
139
174
|
.u-action-item {
|
|
140
175
|
text-align: center;
|
|
141
176
|
cursor: pointer;
|
|
142
|
-
padding:
|
|
177
|
+
padding: 8px 10px;
|
|
143
178
|
&:hover {
|
|
144
179
|
background: rgb(248,248,251);
|
|
145
180
|
}
|
|
@@ -148,7 +183,17 @@ export default {
|
|
|
148
183
|
}
|
|
149
184
|
}
|
|
150
185
|
.u-follow-count{
|
|
151
|
-
color:#fff;
|
|
152
186
|
margin-left:5px;
|
|
153
187
|
}
|
|
188
|
+
|
|
189
|
+
.u-fans-box {
|
|
190
|
+
cursor: default !important;
|
|
191
|
+
.u-fans-label {
|
|
192
|
+
color: #999;
|
|
193
|
+
margin-right: 5px;
|
|
194
|
+
}
|
|
195
|
+
.u-fans {
|
|
196
|
+
color: #333;
|
|
197
|
+
}
|
|
198
|
+
}
|
|
154
199
|
</style>
|