@jx3box/jx3box-common-ui 8.9.30 → 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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jx3box/jx3box-common-ui",
3
- "version": "8.9.30",
3
+ "version": "9.0.1",
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.9.9",
34
- "@jx3box/jx3box-common": "^8.4.2",
34
+ "@jx3box/jx3box-common": "^8.4.7",
35
35
  "@jx3box/jx3box-data": "^3.6.9",
36
36
  "@jx3box/jx3box-editor": "^2.2.16",
37
37
  "@jx3box/reporter": "^0.0.4",
package/src/App.vue CHANGED
@@ -265,7 +265,7 @@ export default {
265
265
  },
266
266
  data: function () {
267
267
  return {
268
- tab: "widget",
268
+ tab: "post",
269
269
 
270
270
  post: {},
271
271
  post_id: "79820",
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>
@@ -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>
@@ -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,8 +52,8 @@
51
52
  :category="category"
52
53
  @updateRecord="updateRecord"
53
54
  />
54
- <Share :postId="postId" :postType="postType" :client="client" />
55
55
  <watch-later :category="postType" :title="postTitle"></watch-later>
56
+ <Share :postId="postId" :postType="postType" :client="client" />
56
57
  </div>
57
58
  <div class="w-thx-records">
58
59
  <boxcoin-records
@@ -81,6 +82,7 @@ import BoxcoinRecords from "../interact/boxcoin_records.vue";
81
82
  import BoxcoinAdmin from "../interact/boxcoin_admin.vue";
82
83
  import BoxcoinUser from "../interact/boxcoin_user.vue";
83
84
  import WatchLater from "../interact/watchLater.vue";
85
+ import Rss from "../interact/Rss.vue";
84
86
 
85
87
  import User from "@jx3box/jx3box-common/js/user";
86
88
  import { getPostBoxcoinConfig, getBoxcoinStatus } from "../../service/thx";
@@ -134,6 +136,10 @@ export default {
134
136
  category: {
135
137
  default: undefined,
136
138
  },
139
+ showRss: {
140
+ type: Boolean,
141
+ default: false,
142
+ },
137
143
  },
138
144
  components: {
139
145
  Like,
@@ -144,6 +150,7 @@ export default {
144
150
  "boxcoin-admin": BoxcoinAdmin,
145
151
  "boxcoin-user": BoxcoinUser,
146
152
  WatchLater,
153
+ Rss,
147
154
  },
148
155
  data: function () {
149
156
  return {
@@ -47,6 +47,7 @@
47
47
  :userBoxcoinEnable="true"
48
48
  :authors="authors"
49
49
  :client="post_client"
50
+ showRss
50
51
  />
51
52
 
52
53
  <!-- 评论 -->