@jx3box/jx3box-common-ui 5.9.6 → 5.9.7
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/service/follow.js +11 -1
- package/src/author/AuthorFollow.vue +20 -7
package/package.json
CHANGED
package/service/follow.js
CHANGED
|
@@ -44,9 +44,19 @@ function getMyFansList(params) {
|
|
|
44
44
|
})
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
+
/**
|
|
48
|
+
* 获取某个用户的粉丝数量
|
|
49
|
+
* @param {*} userId 用户id
|
|
50
|
+
*/
|
|
51
|
+
function getFansCount(userId) {
|
|
52
|
+
return $next().get(`/api/followers/${userId}/count`)
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
|
|
47
56
|
export {
|
|
48
57
|
follow,
|
|
49
58
|
unfollow,
|
|
50
59
|
getMyFollowList,
|
|
51
|
-
getMyFansList
|
|
60
|
+
getMyFansList,
|
|
61
|
+
getFansCount
|
|
52
62
|
}
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
:type="btnType"
|
|
9
9
|
v-if="!isFollow"
|
|
10
10
|
>
|
|
11
|
-
{{ btnText }} {{ formatFansNum(fansNum) }}
|
|
11
|
+
{{ btnText }}<span class="u-follow-count">{{ formatFansNum(fansNum) }}</span>
|
|
12
12
|
</el-button>
|
|
13
13
|
<el-popover
|
|
14
14
|
v-else
|
|
@@ -20,15 +20,14 @@
|
|
|
20
20
|
<div class="u-action-list">
|
|
21
21
|
<div class="u-action-item" v-for="item in actions" :key="item.label" @click.stop="item.action">{{ item.label }}</div>
|
|
22
22
|
</div>
|
|
23
|
-
<el-button class="u-unfollow-btn" size="mini" :type="btnType" slot="reference">{{ btnText }} {{ formatFansNum(fansNum) }}</el-button>
|
|
23
|
+
<el-button class="u-unfollow-btn" size="mini" :type="btnType" slot="reference">{{ btnText }}<span class="u-follow-count">{{ formatFansNum(fansNum) }}</span></el-button>
|
|
24
24
|
</el-popover>
|
|
25
|
-
<el-button size="mini" icon="el-icon-message" disabled>私信</el-button>
|
|
25
|
+
<el-button size="mini" icon="el-icon-message" disabled title="Lv4+可用">私信</el-button>
|
|
26
26
|
</div>
|
|
27
27
|
</template>
|
|
28
28
|
|
|
29
29
|
<script>
|
|
30
|
-
import
|
|
31
|
-
import { follow, unfollow, getMyFollowList } from "../../service/follow";
|
|
30
|
+
import { follow, unfollow, getMyFollowList, getFansCount } from "../../service/follow";
|
|
32
31
|
export default {
|
|
33
32
|
name: "AuthorFollow",
|
|
34
33
|
props: {
|
|
@@ -66,6 +65,7 @@ export default {
|
|
|
66
65
|
},
|
|
67
66
|
mounted () {
|
|
68
67
|
this.loadMyFollow();
|
|
68
|
+
this.loadFans();
|
|
69
69
|
},
|
|
70
70
|
methods: {
|
|
71
71
|
// 格式化粉丝数
|
|
@@ -82,6 +82,7 @@ export default {
|
|
|
82
82
|
.then((res) => {
|
|
83
83
|
this.$message.success("关注成功");
|
|
84
84
|
this.isFollow = true;
|
|
85
|
+
this.loadFans();
|
|
85
86
|
})
|
|
86
87
|
.catch((err) => {
|
|
87
88
|
console.log(err);
|
|
@@ -98,12 +99,12 @@ export default {
|
|
|
98
99
|
.then((res) => {
|
|
99
100
|
this.$message.success("取关成功");
|
|
100
101
|
this.isFollow = false;
|
|
102
|
+
this.loadFans();
|
|
101
103
|
})
|
|
102
104
|
.catch((err) => {
|
|
103
105
|
console.log(err);
|
|
104
106
|
});
|
|
105
107
|
});
|
|
106
|
-
console.log(1)
|
|
107
108
|
},
|
|
108
109
|
// 获取是否已关注
|
|
109
110
|
loadMyFollow() {
|
|
@@ -124,7 +125,15 @@ export default {
|
|
|
124
125
|
console.log(err);
|
|
125
126
|
});
|
|
126
127
|
},
|
|
127
|
-
|
|
128
|
+
loadFans() {
|
|
129
|
+
getFansCount(this.uid)
|
|
130
|
+
.then((res) => {
|
|
131
|
+
this.fansNum = res.data.data.follower_count || 0;
|
|
132
|
+
})
|
|
133
|
+
.catch((err) => {
|
|
134
|
+
console.log(err);
|
|
135
|
+
});
|
|
136
|
+
}
|
|
128
137
|
},
|
|
129
138
|
};
|
|
130
139
|
</script>
|
|
@@ -150,4 +159,8 @@ export default {
|
|
|
150
159
|
}
|
|
151
160
|
}
|
|
152
161
|
}
|
|
162
|
+
.u-follow-count{
|
|
163
|
+
color:#ffdea8;
|
|
164
|
+
margin-left:5px;
|
|
165
|
+
}
|
|
153
166
|
</style>
|