@jx3box/jx3box-common-ui 9.0.0 → 9.0.1
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/src/Author.vue +6 -3
- package/src/author/AuthorFollow.vue +3 -3
- package/src/author/AuthorRss.vue +150 -0
package/package.json
CHANGED
package/src/Author.vue
CHANGED
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
<AuthorInfo :uid="uid" @ready="installModules" />
|
|
4
4
|
<template v-if="data">
|
|
5
5
|
<div class="u-interact">
|
|
6
|
-
<AuthorFollow style="margin-right: 8px" :uid="uid" />
|
|
6
|
+
<!-- <AuthorFollow style="margin-right: 8px" :uid="uid" /> -->
|
|
7
|
+
<AuthorRss style="margin-right: 8px" :uid="uid" />
|
|
7
8
|
<!-- <AuthorGift :uid="uid" /> -->
|
|
8
9
|
<el-button icon="el-icon-message" class="u-btn" size="mini" @click="onMessage">私信</el-button>
|
|
9
10
|
</div>
|
|
@@ -21,13 +22,14 @@
|
|
|
21
22
|
<script>
|
|
22
23
|
import AuthorInfo from "./author/AuthorInfo.vue";
|
|
23
24
|
import AuthorLink from "./author/AuthorLink.vue";
|
|
24
|
-
import AuthorFollow from "./author/AuthorFollow.vue";
|
|
25
|
+
// import AuthorFollow from "./author/AuthorFollow.vue";
|
|
25
26
|
// import AuthorMsg from "./author/AuthorMsg.vue";
|
|
26
27
|
// import AuthorGift from "./author/AuthorGift.vue";
|
|
27
28
|
// import AuthorFans from "./author/AuthorFans.vue";
|
|
28
29
|
import AuthorMedals from "./author/AuthorMedals.vue";
|
|
29
30
|
import AuthorTeams from "./author/AuthorTeams.vue";
|
|
30
31
|
import AuthorPosts from "./author/AuthorPosts.vue";
|
|
32
|
+
import AuthorRss from "./author/AuthorRss.vue";
|
|
31
33
|
export default {
|
|
32
34
|
name: "Author",
|
|
33
35
|
props: ["uid"],
|
|
@@ -47,13 +49,14 @@ export default {
|
|
|
47
49
|
components: {
|
|
48
50
|
AuthorInfo,
|
|
49
51
|
AuthorLink,
|
|
50
|
-
AuthorFollow,
|
|
52
|
+
// AuthorFollow,
|
|
51
53
|
// AuthorMsg,
|
|
52
54
|
// AuthorGift,
|
|
53
55
|
AuthorMedals,
|
|
54
56
|
AuthorTeams,
|
|
55
57
|
AuthorPosts,
|
|
56
58
|
// AuthorFans,
|
|
59
|
+
AuthorRss,
|
|
57
60
|
},
|
|
58
61
|
};
|
|
59
62
|
</script>
|
|
@@ -157,9 +157,9 @@ export default {
|
|
|
157
157
|
cursor: default;
|
|
158
158
|
&:hover {
|
|
159
159
|
cursor: pointer;
|
|
160
|
-
background-color: @light-pink
|
|
161
|
-
color: #fff
|
|
162
|
-
border-color: darken(@light-pink, 2%)
|
|
160
|
+
background-color: @light-pink;
|
|
161
|
+
color: #fff;
|
|
162
|
+
border-color: darken(@light-pink, 2%);
|
|
163
163
|
}
|
|
164
164
|
}
|
|
165
165
|
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="c-author-rss">
|
|
3
|
+
<el-button
|
|
4
|
+
class="u-btn"
|
|
5
|
+
size="mini"
|
|
6
|
+
@click="subscribe"
|
|
7
|
+
:loading="loading"
|
|
8
|
+
:disabled="isSelf"
|
|
9
|
+
>
|
|
10
|
+
<img class="u-icon" svg-inline :src="src" />
|
|
11
|
+
{{ btnText }}</el-button
|
|
12
|
+
>
|
|
13
|
+
</div>
|
|
14
|
+
</template>
|
|
15
|
+
|
|
16
|
+
<script>
|
|
17
|
+
import { getAuthorRss, subscribeAuthor, unsubscribeAuthor } from "@jx3box/jx3box-common/js/rss";
|
|
18
|
+
import User from "@jx3box/jx3box-common/js/user";
|
|
19
|
+
import { __cdn } from "@jx3box/jx3box-common/data/jx3box.json";
|
|
20
|
+
export default {
|
|
21
|
+
name: "AuthorRss",
|
|
22
|
+
props: {
|
|
23
|
+
uid: {
|
|
24
|
+
type: Number,
|
|
25
|
+
default: 0,
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
data() {
|
|
29
|
+
return {
|
|
30
|
+
subscribed: false,
|
|
31
|
+
fansNum: 0,
|
|
32
|
+
loading: false,
|
|
33
|
+
};
|
|
34
|
+
},
|
|
35
|
+
computed: {
|
|
36
|
+
btnText() {
|
|
37
|
+
return this.subscribed ? "已订阅" : "订阅";
|
|
38
|
+
},
|
|
39
|
+
btnType() {
|
|
40
|
+
return !this.subscribed ? "info" : "warning";
|
|
41
|
+
},
|
|
42
|
+
isSelf() {
|
|
43
|
+
return this.uid == this.user.uid;
|
|
44
|
+
},
|
|
45
|
+
user() {
|
|
46
|
+
return User.getInfo();
|
|
47
|
+
},
|
|
48
|
+
isLogin: function () {
|
|
49
|
+
return User.isLogin();
|
|
50
|
+
},
|
|
51
|
+
src() {
|
|
52
|
+
return __cdn + "design/vector/icon/rss_origin.svg";
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
watch: {
|
|
56
|
+
uid: {
|
|
57
|
+
immediate: true,
|
|
58
|
+
handler(val) {
|
|
59
|
+
val && this.loadRss();
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
methods: {
|
|
64
|
+
// 格式化粉丝数
|
|
65
|
+
formatFansNum(num) {
|
|
66
|
+
if (num < 10000) {
|
|
67
|
+
return num === 0 ? "" : num;
|
|
68
|
+
} else {
|
|
69
|
+
return (num / 10000).toFixed(1) + "万";
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
// 关注
|
|
73
|
+
subscribe() {
|
|
74
|
+
if (!this.isLogin) {
|
|
75
|
+
User.toLogin();
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
if (this.subscribed) {
|
|
79
|
+
this.unsubscribe({ id: this.uid });
|
|
80
|
+
} else {
|
|
81
|
+
subscribeAuthor({ id: this.uid })
|
|
82
|
+
.then((res) => {
|
|
83
|
+
this.subscribed = true;
|
|
84
|
+
})
|
|
85
|
+
.catch((err) => {
|
|
86
|
+
console.log(err);
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
// 取消订阅
|
|
91
|
+
unsubscribe() {
|
|
92
|
+
// this.$confirm("是否取消订阅", "提示", {
|
|
93
|
+
// confirmButtonText: "确定",
|
|
94
|
+
// cancelButtonText: "取消",
|
|
95
|
+
// type: "warning",
|
|
96
|
+
// }).then(() => {
|
|
97
|
+
unsubscribeAuthor({ id: this.uid })
|
|
98
|
+
.then((res) => {
|
|
99
|
+
this.$message.success("操作成功");
|
|
100
|
+
this.subscribed = false;
|
|
101
|
+
})
|
|
102
|
+
.catch((err) => {
|
|
103
|
+
console.log(err);
|
|
104
|
+
});
|
|
105
|
+
// });
|
|
106
|
+
},
|
|
107
|
+
loadRss() {
|
|
108
|
+
this.loading = true;
|
|
109
|
+
getAuthorRss({ id: this.uid })
|
|
110
|
+
.then((res) => {
|
|
111
|
+
this.fansNum = res.data.data.total || 0;
|
|
112
|
+
this.subscribed = res.data.data.subscribed;
|
|
113
|
+
})
|
|
114
|
+
.catch((err) => {
|
|
115
|
+
console.log(err);
|
|
116
|
+
})
|
|
117
|
+
.finally(() => {
|
|
118
|
+
this.loading = false;
|
|
119
|
+
});
|
|
120
|
+
},
|
|
121
|
+
},
|
|
122
|
+
};
|
|
123
|
+
</script>
|
|
124
|
+
|
|
125
|
+
<style lang="less">
|
|
126
|
+
.c-author-rss {
|
|
127
|
+
.u-btn.el-button {
|
|
128
|
+
cursor: default;
|
|
129
|
+
&:hover {
|
|
130
|
+
cursor: pointer;
|
|
131
|
+
// background-color: @light-pink;
|
|
132
|
+
// color: #fff;
|
|
133
|
+
// border-color: darken(@light-pink, 2%);
|
|
134
|
+
|
|
135
|
+
.u-icon {
|
|
136
|
+
filter: invert(30%) sepia(87%) saturate(1486%) hue-rotate(194deg) brightness(87%) contrast(107%);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
.u-icon {
|
|
141
|
+
.size(12px);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
@media screen and (max-width: @phone) {
|
|
146
|
+
.el-message-box {
|
|
147
|
+
max-width: 60%;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
</style>
|