@jx3box/jx3box-common-ui 8.9.29 → 9.0.0
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 +3 -3
- package/service/fav.js +12 -45
- package/src/App.vue +1 -1
- package/src/interact/Rss.vue +157 -0
- package/src/interact/watchLater.vue +93 -0
- package/src/single/Thx.vue +11 -0
- package/src/single/cms-single.vue +1 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jx3box/jx3box-common-ui",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "9.0.0",
|
|
4
4
|
"description": "JX3BOX UI",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -31,9 +31,9 @@
|
|
|
31
31
|
],
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"@jx3box/jx3box-comment-ui": "^1.9.9",
|
|
34
|
-
"@jx3box/jx3box-common": "^8.4.
|
|
34
|
+
"@jx3box/jx3box-common": "^8.4.7",
|
|
35
35
|
"@jx3box/jx3box-data": "^3.6.9",
|
|
36
|
-
"@jx3box/jx3box-editor": "^2.2.
|
|
36
|
+
"@jx3box/jx3box-editor": "^2.2.16",
|
|
37
37
|
"@jx3box/reporter": "^0.0.4",
|
|
38
38
|
"axios": "^0.26.1",
|
|
39
39
|
"dayjs": "^1.11.0",
|
package/service/fav.js
CHANGED
|
@@ -1,47 +1,3 @@
|
|
|
1
|
-
// import qs from "qs";
|
|
2
|
-
// import { $helper } from "@jx3box/jx3box-common/js/https.js";
|
|
3
|
-
|
|
4
|
-
// function hasFav(post_type, post_id) {
|
|
5
|
-
// if (post_type && post_id) {
|
|
6
|
-
// return $helper({ popType: "notify" }).get(
|
|
7
|
-
// `/api/post/favorite/favorited`,
|
|
8
|
-
// {
|
|
9
|
-
// params: {
|
|
10
|
-
// post_type: post_type,
|
|
11
|
-
// post_id: post_id,
|
|
12
|
-
// },
|
|
13
|
-
// }
|
|
14
|
-
// );
|
|
15
|
-
// } else return null;
|
|
16
|
-
// }
|
|
17
|
-
|
|
18
|
-
// function addFav(post_type, post_id) {
|
|
19
|
-
// if (post_type && post_id) {
|
|
20
|
-
// return $helper({ popType: "notify" }).post(
|
|
21
|
-
// `/api/post/favorite`,
|
|
22
|
-
// qs.stringify({
|
|
23
|
-
// post_type: post_type,
|
|
24
|
-
// post_id: post_id,
|
|
25
|
-
// cancel: 0,
|
|
26
|
-
// })
|
|
27
|
-
// );
|
|
28
|
-
// } else return null;
|
|
29
|
-
// }
|
|
30
|
-
|
|
31
|
-
// function delFav(post_type, post_id) {
|
|
32
|
-
// if (post_type && post_id) {
|
|
33
|
-
// return $helper({ popType: "notify" }).post(
|
|
34
|
-
// `/api/post/favorite`,
|
|
35
|
-
// qs.stringify({
|
|
36
|
-
// post_type: post_type,
|
|
37
|
-
// post_id: post_id,
|
|
38
|
-
// cancel: 1,
|
|
39
|
-
// })
|
|
40
|
-
// );
|
|
41
|
-
// } else return null;
|
|
42
|
-
// }
|
|
43
|
-
|
|
44
|
-
// export { hasFav, addFav, delFav };
|
|
45
1
|
import { $next } from "@jx3box/jx3box-common/js/https.js";
|
|
46
2
|
const $n = $next();
|
|
47
3
|
|
|
@@ -58,4 +14,15 @@ function addFav(post_type, post_id, post_title) {
|
|
|
58
14
|
function delFav(id) {
|
|
59
15
|
return $n.delete(`api/article/favorites/my/${id}`);
|
|
60
16
|
}
|
|
61
|
-
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
// 稍后再看
|
|
20
|
+
function addWatchLater(data) {
|
|
21
|
+
return $n.post(`api/next2/userdata/favorite/item`, data)
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function delWatchLater(params) {
|
|
25
|
+
return $n.delete(`api/next2/userdata/favorite/item`, { params })
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export { hasFav, addFav, delFav, addWatchLater, delWatchLater };
|
package/src/App.vue
CHANGED
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="w-rss" @click="onRssClick">
|
|
3
|
+
<el-tooltip effect="dark" :content="tooltipContent" placement="top-start">
|
|
4
|
+
<div>
|
|
5
|
+
<img v-if="subscribed" class="u-icon" svg-inline :src="rmSrc" />
|
|
6
|
+
<img v-else class="u-icon" svg-inline :src="addSrc" />
|
|
7
|
+
<span class="u-count" v-if="!hiddenNum && total > 0">{{ total }}</span>
|
|
8
|
+
</div>
|
|
9
|
+
</el-tooltip>
|
|
10
|
+
</div>
|
|
11
|
+
</template>
|
|
12
|
+
|
|
13
|
+
<script>
|
|
14
|
+
import User from "@jx3box/jx3box-common/js/user";
|
|
15
|
+
import { __cdn } from "@jx3box/jx3box-common/data/jx3box.json";
|
|
16
|
+
import {
|
|
17
|
+
getCommunityRss,
|
|
18
|
+
getWikiRss,
|
|
19
|
+
getPostRss,
|
|
20
|
+
subscribeCommunity,
|
|
21
|
+
subscribePost,
|
|
22
|
+
subscribeWiki,
|
|
23
|
+
unsubscribeWiki,
|
|
24
|
+
unsubscribeCommunity,
|
|
25
|
+
unsubscribePost,
|
|
26
|
+
} from "@jx3box/jx3box-common/js/rss";
|
|
27
|
+
import { omit } from "lodash";
|
|
28
|
+
import { __postType, __wikiType } from "@jx3box/jx3box-common/data/jx3box.json";
|
|
29
|
+
|
|
30
|
+
export default {
|
|
31
|
+
name: "Rss",
|
|
32
|
+
props: {
|
|
33
|
+
type: {
|
|
34
|
+
type: String,
|
|
35
|
+
default: "", // community, cj, bps,
|
|
36
|
+
},
|
|
37
|
+
id: {
|
|
38
|
+
type: [String, Number],
|
|
39
|
+
default: "",
|
|
40
|
+
},
|
|
41
|
+
hiddenNum: {
|
|
42
|
+
type: Boolean,
|
|
43
|
+
default: false,
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
data() {
|
|
47
|
+
return {
|
|
48
|
+
subscribed: false,
|
|
49
|
+
total: 0,
|
|
50
|
+
};
|
|
51
|
+
},
|
|
52
|
+
computed: {
|
|
53
|
+
tooltipContent() {
|
|
54
|
+
return this.subscribed ? "已订阅" : "加入订阅";
|
|
55
|
+
},
|
|
56
|
+
addSrc() {
|
|
57
|
+
return __cdn + "design/vector/icon/rss.svg";
|
|
58
|
+
},
|
|
59
|
+
rmSrc() {
|
|
60
|
+
return __cdn + "design/vector/icon/unrss.svg";
|
|
61
|
+
},
|
|
62
|
+
category({ type }) {
|
|
63
|
+
if (type.includes("community")) return "community";
|
|
64
|
+
if (__postType[type]) return "posts";
|
|
65
|
+
if (__wikiType[type]) return "wiki";
|
|
66
|
+
return "";
|
|
67
|
+
},
|
|
68
|
+
getRssFn({ category }) {
|
|
69
|
+
if (category === "community") return getCommunityRss;
|
|
70
|
+
if (category === "posts") return getPostRss;
|
|
71
|
+
if (category === "wiki") return getWikiRss;
|
|
72
|
+
return null;
|
|
73
|
+
},
|
|
74
|
+
subscribeFn({ category }) {
|
|
75
|
+
if (category === "community") return subscribeCommunity;
|
|
76
|
+
if (category === "posts") return subscribePost;
|
|
77
|
+
if (category === "wiki") return subscribeWiki;
|
|
78
|
+
return null;
|
|
79
|
+
},
|
|
80
|
+
unsubscribeFn({ category }) {
|
|
81
|
+
if (category === "community") return unsubscribeCommunity;
|
|
82
|
+
if (category === "posts") return unsubscribePost;
|
|
83
|
+
if (category === "wiki") return unsubscribeWiki;
|
|
84
|
+
return null;
|
|
85
|
+
},
|
|
86
|
+
params() {
|
|
87
|
+
return {
|
|
88
|
+
type: this.type,
|
|
89
|
+
id: this.id,
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
isLogin() {
|
|
93
|
+
return User.isLogin();
|
|
94
|
+
},
|
|
95
|
+
},
|
|
96
|
+
watch: {
|
|
97
|
+
params: {
|
|
98
|
+
deep: true,
|
|
99
|
+
immediate: true,
|
|
100
|
+
handler(val) {
|
|
101
|
+
if (this.isLogin && val?.id) {
|
|
102
|
+
this.checkSubscribed();
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
},
|
|
107
|
+
methods: {
|
|
108
|
+
onRssClick() {
|
|
109
|
+
if (!this.isLogin) {
|
|
110
|
+
User.toLogin();
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
if (this.subscribed) {
|
|
114
|
+
this.unsubscribe();
|
|
115
|
+
} else {
|
|
116
|
+
this.subscribe();
|
|
117
|
+
}
|
|
118
|
+
},
|
|
119
|
+
checkSubscribed() {
|
|
120
|
+
this.getRssFn && this.getRssFn(this.params).then((res) => {
|
|
121
|
+
this.subscribed = res.data.data.subscribed;
|
|
122
|
+
this.total = res.data.data.total;
|
|
123
|
+
});
|
|
124
|
+
},
|
|
125
|
+
subscribe() {
|
|
126
|
+
this.subscribeFn && this.subscribeFn(this.params).then((res) => {
|
|
127
|
+
this.subscribed = true;
|
|
128
|
+
this.total++;
|
|
129
|
+
});
|
|
130
|
+
},
|
|
131
|
+
unsubscribe() {
|
|
132
|
+
this.unsubscribeFn && this.unsubscribeFn(this.params).then((res) => {
|
|
133
|
+
this.subscribed = false;
|
|
134
|
+
this.total--;
|
|
135
|
+
});
|
|
136
|
+
},
|
|
137
|
+
},
|
|
138
|
+
};
|
|
139
|
+
</script>
|
|
140
|
+
|
|
141
|
+
<style lang="less">
|
|
142
|
+
.w-rss {
|
|
143
|
+
.pointer;
|
|
144
|
+
.dbi;
|
|
145
|
+
.u-icon {
|
|
146
|
+
.size(26px);
|
|
147
|
+
.y;
|
|
148
|
+
.pr;
|
|
149
|
+
}
|
|
150
|
+
.u-count {
|
|
151
|
+
color: #888;
|
|
152
|
+
.ml(10px);
|
|
153
|
+
top: 4px;
|
|
154
|
+
.pr;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
</style>
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="w-watch-later" @click="onWatchLaterClick">
|
|
3
|
+
<el-tooltip effect="dark" :content="favContent" placement="top-start">
|
|
4
|
+
<div>
|
|
5
|
+
<img v-if="favorite" class="u-icon" svg-inline :src="rmSrc" />
|
|
6
|
+
<img v-else class="u-icon" svg-inline :src="addSrc" />
|
|
7
|
+
</div>
|
|
8
|
+
</el-tooltip>
|
|
9
|
+
</div>
|
|
10
|
+
</template>
|
|
11
|
+
|
|
12
|
+
<script>
|
|
13
|
+
import User from "@jx3box/jx3box-common/js/user";
|
|
14
|
+
import { __cdn } from "@jx3box/jx3box-common/data/jx3box.json";
|
|
15
|
+
import { addWatchLater, delWatchLater } from "../../service/fav";
|
|
16
|
+
import { omit } from "lodash";
|
|
17
|
+
export default {
|
|
18
|
+
name: "WatchLater",
|
|
19
|
+
props: {
|
|
20
|
+
category: {
|
|
21
|
+
type: String,
|
|
22
|
+
default: "article",
|
|
23
|
+
},
|
|
24
|
+
title: {
|
|
25
|
+
type: String,
|
|
26
|
+
default: "",
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
data: function () {
|
|
30
|
+
return {
|
|
31
|
+
login: User.isLogin(),
|
|
32
|
+
favorite: false,
|
|
33
|
+
};
|
|
34
|
+
},
|
|
35
|
+
computed: {
|
|
36
|
+
favContent() {
|
|
37
|
+
return this.favorite ? "已添加稍后在看" : "添加至稍后再看";
|
|
38
|
+
},
|
|
39
|
+
addSrc() {
|
|
40
|
+
return __cdn + "design/vector/icon/time.svg"
|
|
41
|
+
},
|
|
42
|
+
rmSrc() {
|
|
43
|
+
return __cdn + "design/vector/icon/time1.svg"
|
|
44
|
+
},
|
|
45
|
+
data() {
|
|
46
|
+
return {
|
|
47
|
+
category: this.category,
|
|
48
|
+
link: location.href,
|
|
49
|
+
title: this.title,
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
methods: {
|
|
54
|
+
onWatchLaterClick: function () {
|
|
55
|
+
if (this.login) {
|
|
56
|
+
this.favorite ? this.rmWatchLater() : this.addWatchLater();
|
|
57
|
+
} else {
|
|
58
|
+
User.toLogin();
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
addWatchLater: function () {
|
|
62
|
+
// add watch later
|
|
63
|
+
addWatchLater(this.data).then((res) => {
|
|
64
|
+
this.favorite = true;
|
|
65
|
+
});
|
|
66
|
+
},
|
|
67
|
+
rmWatchLater: function () {
|
|
68
|
+
// remove watch later
|
|
69
|
+
delWatchLater(omit(this.data, ['title'])).then(() => {
|
|
70
|
+
this.favorite = false;
|
|
71
|
+
});
|
|
72
|
+
},
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
</script>
|
|
76
|
+
|
|
77
|
+
<style lang="less">
|
|
78
|
+
.w-watch-later {
|
|
79
|
+
.pointer;
|
|
80
|
+
.dbi;
|
|
81
|
+
.u-icon {
|
|
82
|
+
.size(26px);
|
|
83
|
+
.y;
|
|
84
|
+
.pr;
|
|
85
|
+
}
|
|
86
|
+
.u-count {
|
|
87
|
+
color: #888;
|
|
88
|
+
.ml(10px);
|
|
89
|
+
top: 4px;
|
|
90
|
+
.pr;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
</style>
|
package/src/single/Thx.vue
CHANGED
|
@@ -38,6 +38,7 @@
|
|
|
38
38
|
/>
|
|
39
39
|
<Like :postId="postId" :postType="postType"></Like>
|
|
40
40
|
<fav :postId="postId" :postType="postType" :postTitle="postTitle"></fav>
|
|
41
|
+
<Rss v-if="showRss" :type="postType" :id="postId"></Rss>
|
|
41
42
|
<boxcoin-user
|
|
42
43
|
v-if="userBoxcoinEnable && boxcoin_enable && allowGift"
|
|
43
44
|
:postId="postId"
|
|
@@ -51,6 +52,7 @@
|
|
|
51
52
|
:category="category"
|
|
52
53
|
@updateRecord="updateRecord"
|
|
53
54
|
/>
|
|
55
|
+
<watch-later :category="postType" :title="postTitle"></watch-later>
|
|
54
56
|
<Share :postId="postId" :postType="postType" :client="client" />
|
|
55
57
|
</div>
|
|
56
58
|
<div class="w-thx-records">
|
|
@@ -79,6 +81,9 @@ import BatchReward from "../interact/batchReward.vue";
|
|
|
79
81
|
import BoxcoinRecords from "../interact/boxcoin_records.vue";
|
|
80
82
|
import BoxcoinAdmin from "../interact/boxcoin_admin.vue";
|
|
81
83
|
import BoxcoinUser from "../interact/boxcoin_user.vue";
|
|
84
|
+
import WatchLater from "../interact/watchLater.vue";
|
|
85
|
+
import Rss from "../interact/Rss.vue";
|
|
86
|
+
|
|
82
87
|
import User from "@jx3box/jx3box-common/js/user";
|
|
83
88
|
import { getPostBoxcoinConfig, getBoxcoinStatus } from "../../service/thx";
|
|
84
89
|
export default {
|
|
@@ -131,6 +136,10 @@ export default {
|
|
|
131
136
|
category: {
|
|
132
137
|
default: undefined,
|
|
133
138
|
},
|
|
139
|
+
showRss: {
|
|
140
|
+
type: Boolean,
|
|
141
|
+
default: false,
|
|
142
|
+
},
|
|
134
143
|
},
|
|
135
144
|
components: {
|
|
136
145
|
Like,
|
|
@@ -140,6 +149,8 @@ export default {
|
|
|
140
149
|
"boxcoin-records": BoxcoinRecords,
|
|
141
150
|
"boxcoin-admin": BoxcoinAdmin,
|
|
142
151
|
"boxcoin-user": BoxcoinUser,
|
|
152
|
+
WatchLater,
|
|
153
|
+
Rss,
|
|
143
154
|
},
|
|
144
155
|
data: function () {
|
|
145
156
|
return {
|