@jx3box/jx3box-ui 2.1.10 → 2.1.12

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-ui",
3
- "version": "2.1.10",
3
+ "version": "2.1.12",
4
4
  "description": "JX3BOX Vue3 UI",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/service/cms.js CHANGED
@@ -7,7 +7,7 @@ function getPostAuthors(post_id) {
7
7
 
8
8
  // 获取文章内容
9
9
  function getPost(post_id) {
10
- return $cms().get(`/api/cms/post/${post_id}`)
10
+ return $cms().get(`/api/cms/post/${post_id}`);
11
11
  }
12
12
 
13
13
  function uploadImage(formData) {
@@ -50,6 +50,10 @@ function getSliders(source_type, source_ids, client = "std") {
50
50
  });
51
51
  }
52
52
 
53
+ function getSlider(params) {
54
+ return $cms({ mute: true }).get(`/api/cms/news/item`, { params });
55
+ }
56
+
53
57
  function getCollection(id) {
54
58
  return $cms({ mute: true }).get(`/api/cms/post/collection/${id}`);
55
59
  }
@@ -130,7 +134,7 @@ function refreshQQBotImage(data) {
130
134
 
131
135
  // 获取用户permission
132
136
  function getUserPermission() {
133
- return $cms().get(`/api/cms/account/permission/i`)
137
+ return $cms().get(`/api/cms/account/permission/i`);
134
138
  }
135
139
 
136
140
  export {
@@ -142,6 +146,7 @@ export {
142
146
  getDecorationJson,
143
147
  checkTeamMember,
144
148
  getSliders,
149
+ getSlider,
145
150
  getCollection,
146
151
  getTopicBucket,
147
152
  getConfig,
@@ -112,6 +112,7 @@ export default {
112
112
  remark: "",
113
113
  star: 0,
114
114
  subtype: "",
115
+ type: "",
115
116
  version: "std",
116
117
  },
117
118
  colors: ["#99A9BF", "#F7BA2A", "#FF9900"],
@@ -135,6 +136,9 @@ export default {
135
136
  if (val) {
136
137
  if (this.post) {
137
138
  this.form.title = this.post.post_title;
139
+ if (["achievement", "item", "quest", "knowledge"].includes(this.post?.post_type)) {
140
+ this.form.type = "wiki";
141
+ }
138
142
  }
139
143
  this.loadLogs();
140
144
 
@@ -170,7 +174,10 @@ export default {
170
174
 
171
175
  data.source_type = this.post?.post_type;
172
176
  data.source_id = String(this.post?.ID);
173
- data.link = `/${this.post?.post_type}/${this.post?.ID}`;
177
+ data.link =
178
+ this.form.type === "wiki"
179
+ ? `/${this.post.post_type}/view/${this.post.ID}`
180
+ : `/${this.post?.post_type}/${this.post?.ID}`;
174
181
  data.flow = 0;
175
182
 
176
183
  createDesignTask(data).then(() => {
@@ -0,0 +1,222 @@
1
+ <template>
2
+ <div class="w-boxcoin-user">
3
+ <el-button @click="openBoxcoinPop" type="primary" size="small">批量打赏</el-button>
4
+ <el-dialog
5
+ title="品鉴评分"
6
+ v-model="visible"
7
+ class="w-boxcoin-pop"
8
+ :close-on-click-modal="false"
9
+ append-to-body
10
+ >
11
+ <div class="w-boxcoin-admin-content">
12
+ <div class="u-left">
13
+ <em class="u-label">本月状态</em>
14
+ 已用<b>{{ used }}</b> 剩余<b>{{ left }}</b> 总计<b>{{ total }}</b>
15
+ <el-progress
16
+ :percentage="total ? 100 - (used * 100) / total : 0"
17
+ :stroke-width="15"
18
+ :text-inside="true"
19
+ ></el-progress>
20
+ </div>
21
+ <div class="u-list">
22
+ <em class="u-label">❤️ 品鉴</em>
23
+ <Contributors v-if="authors && authors.length" :authors="authors" @chosen="handleChosen" />
24
+ <div class="u-points">
25
+ <el-radio-group v-model="count">
26
+ <el-radio :value="item" v-for="item in fitPoints" :key="item" border>
27
+ <b>{{ item }}</b
28
+ >盒币
29
+ </el-radio>
30
+ </el-radio-group>
31
+ </div>
32
+ </div>
33
+ <div class="u-msg">
34
+ <em class="u-label">📝 寄语</em>
35
+ <div class="u-input">
36
+ <el-input
37
+ v-model="remark"
38
+ placeholder="请输入寄语(必填)"
39
+ :minlength="2"
40
+ :maxlength="30"
41
+ show-word-limit
42
+ ></el-input>
43
+ <el-button :disabled="fetchingCurrentRelease" @click="insertCurrentRelease">插入当前版本</el-button>
44
+ </div>
45
+ </div>
46
+ </div>
47
+ <template #footer>
48
+ <span class="dialog-footer">
49
+ <el-button @click="visible = false">取消</el-button>
50
+ <el-button type="primary" @click="submit" :disabled="!ready || submitting">确定</el-button>
51
+ </span>
52
+ </template>
53
+ </el-dialog>
54
+ </div>
55
+ </template>
56
+
57
+ <script>
58
+ import { batchReward } from "../../service/thx.js";
59
+ import Contributors from "./Contributors.vue";
60
+ import { getBreadcrumb } from "../../service/breadcrumb.js";
61
+
62
+ export default {
63
+ name: "BatchReward",
64
+ emits: ["updateRecord"],
65
+ components: {
66
+ Contributors,
67
+ },
68
+ props: {
69
+ boxcoin: {
70
+ type: Number,
71
+ default: 0,
72
+ },
73
+ postType: {
74
+ type: String,
75
+ default: "",
76
+ },
77
+ items: {
78
+ type: Array,
79
+ default: () => [],
80
+ },
81
+ own: {
82
+ type: Number,
83
+ default: 0,
84
+ },
85
+ points: {
86
+ type: Array,
87
+ default: () => [],
88
+ },
89
+ authors: {
90
+ type: Array,
91
+ default: () => [],
92
+ },
93
+ client: {
94
+ type: String,
95
+ default: "",
96
+ },
97
+ postId: {
98
+ type: [Number, String, Array],
99
+ default: 0,
100
+ },
101
+ total: {
102
+ type: Number,
103
+ default: 0,
104
+ },
105
+ max: {
106
+ type: Number,
107
+ default: 0,
108
+ },
109
+ min: {
110
+ type: Number,
111
+ default: 0,
112
+ },
113
+ category: {
114
+ type: String,
115
+ default: "",
116
+ },
117
+ },
118
+ data: function () {
119
+ return {
120
+ visible: false,
121
+ count: 0,
122
+ remark: "辛苦,感谢!",
123
+ left: this.own,
124
+ chargeLink: "/vip/boxcoin?redirect=" + location.href,
125
+ chosen: "",
126
+ submitting: false,
127
+ fetchingCurrentRelease: false,
128
+ };
129
+ },
130
+ computed: {
131
+ used: function () {
132
+ return this.total - this.left;
133
+ },
134
+ ready: function () {
135
+ return this.isEnough && this.count && this.remark;
136
+ },
137
+ isEnough: function () {
138
+ return this.left && this.left >= this.count;
139
+ },
140
+ hostClient: function () {
141
+ return location.href.includes("origin") ? "origin" : "std";
142
+ },
143
+ fitPoints: function () {
144
+ return this.points.filter((item) => item <= this.left);
145
+ },
146
+ },
147
+ watch: {
148
+ own: function (val) {
149
+ this.left = val;
150
+ },
151
+ },
152
+ methods: {
153
+ openBoxcoinPop: function () {
154
+ if (!(this.items && this.items.length)) {
155
+ this.$message({ message: "请选择需要打赏的作品", type: "warning" });
156
+ return;
157
+ }
158
+ this.visible = true;
159
+ },
160
+ handleChosen(userId) {
161
+ this.chosen = userId;
162
+ },
163
+ submit: function () {
164
+ this.submitting = true;
165
+ let client = this.client || this.hostClient;
166
+ if (!["std", "origin", "all"].includes(client)) {
167
+ client = "std";
168
+ }
169
+
170
+ batchReward(this.postType, this.count, {
171
+ items: this.items,
172
+ remark: this.remark,
173
+ client: client,
174
+ redirect: this.category ? `/${this.category}/${this.postId}` : undefined,
175
+ })
176
+ .then((res) => {
177
+ return res.data.data;
178
+ })
179
+ .then((data) => {
180
+ const success = data?.success || [];
181
+ const fail = data?.fail || [];
182
+ success.forEach((item) => {
183
+ const articleId = this.items?.[item.index]?.article_id ?? item?.article_id ?? "-";
184
+ this.$message({
185
+ message: `作品${articleId}打赏成功`,
186
+ type: "success",
187
+ });
188
+ this.left -= this.count;
189
+ });
190
+ fail.forEach((item) => {
191
+ const articleId = this.items?.[item.index]?.article_id ?? item?.article_id ?? "-";
192
+ this.$message({
193
+ message: `作品${articleId}打赏失败,原因:${item.msg}`,
194
+ type: "error",
195
+ });
196
+ });
197
+ this.$emit("updateRecord", data);
198
+ })
199
+ .finally(() => {
200
+ this.submitting = false;
201
+ this.visible = false;
202
+ });
203
+ },
204
+ insertCurrentRelease: function () {
205
+ this.fetchingCurrentRelease = true;
206
+ getBreadcrumb(`current-release-${this.hostClient}`)
207
+ .then((res) => {
208
+ this.remark += res.data.data.html;
209
+ })
210
+ .catch(() => {
211
+ this.$message({
212
+ message: "获取失败",
213
+ type: "error",
214
+ });
215
+ })
216
+ .finally(() => {
217
+ this.fetchingCurrentRelease = false;
218
+ });
219
+ },
220
+ },
221
+ };
222
+ </script>
@@ -5,18 +5,17 @@
5
5
  <div class="c-topic-text__year">{{ year }}</div>
6
6
  <div class="c-topic-text__text">{{ topicText }}</div>
7
7
  </div>
8
- <img class="c-topic-bg" src="../../assets/img/rightsidebar/topic_bg_bps.svg" alt="">
8
+ <img class="c-topic-bg" src="../../assets/img/rightsidebar/topic_bg_bps.svg" alt="" />
9
9
  </div>
10
10
  <div class="c-post-topic__img">
11
- <img :src="topicImage" alt="">
11
+ <img :src="topicImage" alt="" />
12
12
  </div>
13
13
  </div>
14
14
  </template>
15
15
 
16
16
  <script>
17
- import { getSliders } from "../../service/cms";
18
- import * as utilModule from "@jx3box/jx3box-common/js/utils";
19
- const { getThumbnail } = utilModule;
17
+ import { getSlider } from "../../service/cms";
18
+ import { getThumbnail } from "@jx3box/jx3box-common/js/utils";
20
19
  import dayjs from "dayjs";
21
20
  export default {
22
21
  name: "PostTopic",
@@ -32,26 +31,26 @@ export default {
32
31
  postBanner: {
33
32
  type: String,
34
33
  default: "",
35
- }
34
+ },
36
35
  },
37
36
  data() {
38
37
  return {
39
- topicInfo: null
40
- }
38
+ topicInfo: null,
39
+ };
41
40
  },
42
41
  computed: {
43
42
  topicText() {
44
- return this.topicInfo ? `${dayjs(this.topicInfo?.created_at).format('MM月DD日')}荣登头条榜` : ''
43
+ return this.topicInfo ? `${dayjs(this.topicInfo?.created_at).format("MM月DD日")}荣登头条榜` : "";
45
44
  },
46
45
  year() {
47
- return dayjs(this.topicInfo?.created_at).format('YYYY年')
46
+ return dayjs(this.topicInfo?.created_at).format("YYYY年");
48
47
  },
49
48
  topicImage() {
50
49
  const img = this.postBanner || this.topicInfo?.img;
51
50
  if (img && (img.indexOf(".gif") > -1 || img.indexOf(".webp") > -1)) {
52
51
  return img;
53
52
  }
54
- return getThumbnail(img, [260*2, 78*2])
53
+ return getThumbnail(img, [260 * 2, 78 * 2]);
55
54
  },
56
55
  client() {
57
56
  return location.href.includes("origin") ? "origin" : "std";
@@ -63,21 +62,20 @@ export default {
63
62
  handler(val) {
64
63
  if (!val) return;
65
64
  this.loadData();
66
- }
67
- }
65
+ },
66
+ },
68
67
  },
69
68
  methods: {
70
69
  loadData() {
71
- getSliders(this.type, this.id, this.client).then((res) => {
72
- if (res.data.data?.list) {
73
- // 取创建时间最新的一条
74
- const list = res.data.data.list.sort((a, b) => dayjs(b.created_at).isAfter(dayjs(a.created_at)) ? 1 : -1);
75
- this.topicInfo = list[0];
76
- }
70
+ getSlider({
71
+ source_type: this.type,
72
+ source_id: this.id,
73
+ }).then((res) => {
74
+ this.topicInfo = res.data?.data;
77
75
  });
78
76
  },
79
- }
80
- }
77
+ },
78
+ };
81
79
  </script>
82
80
 
83
81
  <style lang="less">
@@ -98,7 +96,7 @@ export default {
98
96
  // left: 50%;
99
97
  // transform: translate(-50%, -50%);
100
98
  z-index: 1;
101
- color: #FFD28F;
99
+ color: #ffd28f;
102
100
  letter-spacing: 1px;
103
101
  white-space: nowrap;
104
102
  }
@@ -119,7 +117,7 @@ export default {
119
117
  overflow: hidden;
120
118
  .r(4px);
121
119
  min-height: 71px;
122
- img{
120
+ img {
123
121
  .pa;
124
122
  left: 50%;
125
123
  transform: translateX(-50%);
@@ -1,81 +1,103 @@
1
1
  <template>
2
2
  <div class="w-thx">
3
- <div class="w-thx-panel">
4
- <boxcoin-admin
5
- :postId="postId"
3
+ <template v-if="type === 'batchReward'">
4
+ <batch-reward
5
+ v-if="hasRight && adminBoxcoinEnable && boxcoin_enable"
6
6
  :postType="postType"
7
- v-if="hasRight && adminBoxcoinEnable && boxcoin_enable && hasPermission"
7
+ :items="postId"
8
+ :boxcoin="boxcoin"
8
9
  :userId="userId"
9
- :max="admin_max"
10
- :min="admin_min"
11
10
  :own="admin_left"
12
- :total="admin_total"
13
11
  :points="admin_points"
14
12
  :authors="authors"
15
- @updateRecord="updateRecord"
16
13
  :client="finalClient"
17
- :totalLimit="total_limit"
18
- :postTypeUsed="post_type_used"
14
+ :max="admin_max"
15
+ :min="admin_min"
16
+ :total="admin_total"
19
17
  :category="category"
20
- />
21
- <Like :postId="postId" :postType="postType"></Like>
22
- <fav :postId="postId" :postType="postType" :postTitle="postTitle"></fav>
23
- <Rss v-if="showRss" :type="postType" :id="postId" :title="postTitle"></Rss>
24
- <boxcoin-user
25
18
  :postId="postId"
26
- :postType="postType"
27
- :boxcoin="boxcoin"
28
- :userId="userId"
29
- :own="user_left"
30
- :points="user_points"
31
- :authors="authors"
32
- v-if="userBoxcoinEnable && boxcoin_enable && allowGift"
33
19
  @updateRecord="updateRecord"
34
- :client="finalClient"
35
- :category="category"
36
- :can-gift="lvEnough"
37
20
  />
38
- <Share :postId="postId" :postType="postType" :client="client" />
39
- <watch-later
40
- :category="postType"
41
- :title="postTitle"
42
- :author-id="authorId"
43
- :banner="banner"
44
- :content-id="contentMetaId"
45
- ></watch-later>
46
- </div>
47
- <div class="w-thx-records">
48
- <boxcoin-records
49
- :postId="postId"
50
- :postType="postType"
51
- :postClient="finalClient"
52
- :cacheRecord="cacheRecord"
53
- :mode="mode"
54
- @update:boxcoin="updateBoxcoin"
55
- v-if="showRecord"
56
- />
57
- </div>
58
- <div class="w-thx-copyright">
59
- &copy;
60
- {{
61
- $jx3boxT(
62
- "jx3boxUi.thx.copyright1",
63
- "所有原创作品,著作权归作者所有,所有未经授权的非署名转载或抄袭将有权追究法律责任,所有法律事务由专聘律师代理。"
64
- )
65
- }}<br />
66
- {{
67
- $jx3boxT(
68
- "jx3boxUi.thx.copyright2",
69
- "签约作者独家特约稿件,及所有魔盒官方评分作品用户一经兑现则视为有偿付费稿件,所有商业稿件的转载引用需同时征得魔盒平台授权。"
70
- )
71
- }}
72
- </div>
21
+ </template>
22
+ <template v-else>
23
+ <div class="w-thx-panel">
24
+ <boxcoin-admin
25
+ :postId="postId"
26
+ :postType="postType"
27
+ v-if="hasRight && adminBoxcoinEnable && boxcoin_enable && hasPermission"
28
+ :userId="userId"
29
+ :max="admin_max"
30
+ :min="admin_min"
31
+ :own="admin_left"
32
+ :total="admin_total"
33
+ :points="admin_points"
34
+ :authors="authors"
35
+ @updateRecord="updateRecord"
36
+ :client="finalClient"
37
+ :totalLimit="total_limit"
38
+ :postTypeUsed="post_type_used"
39
+ :category="category"
40
+ />
41
+ <Like :postId="postId" :postType="postType"></Like>
42
+ <fav :postId="postId" :postType="postType" :postTitle="postTitle"></fav>
43
+ <Rss v-if="showRss" :type="postType" :id="postId" :title="postTitle"></Rss>
44
+ <boxcoin-user
45
+ :postId="postId"
46
+ :postType="postType"
47
+ :boxcoin="boxcoin"
48
+ :userId="userId"
49
+ :own="user_left"
50
+ :points="user_points"
51
+ :authors="authors"
52
+ v-if="userBoxcoinEnable && boxcoin_enable && allowGift"
53
+ @updateRecord="updateRecord"
54
+ :client="finalClient"
55
+ :category="category"
56
+ :can-gift="lvEnough"
57
+ />
58
+ <watch-later
59
+ :category="postType"
60
+ :title="postTitle"
61
+ :author-id="authorId"
62
+ :banner="banner"
63
+ :content-id="contentMetaId"
64
+ ></watch-later>
65
+ <Share :postId="postId" :postType="postType" :client="client" />
66
+ </div>
67
+ <div class="w-thx-records">
68
+ <boxcoin-records
69
+ :postId="postId"
70
+ :postType="postType"
71
+ :postClient="finalClient"
72
+ :cacheRecord="cacheRecord"
73
+ :mode="mode"
74
+ @update:boxcoin="updateBoxcoin"
75
+ v-if="showRecord"
76
+ />
77
+ </div>
78
+ <div class="w-thx-copyright">
79
+ &copy;
80
+ {{
81
+ $jx3boxT(
82
+ "jx3boxUi.thx.copyright1",
83
+ "所有原创作品,著作权归作者所有,所有未经授权的非署名转载或抄袭将有权追究法律责任,所有法律事务由专聘律师代理。"
84
+ )
85
+ }}<br />
86
+ {{
87
+ $jx3boxT(
88
+ "jx3boxUi.thx.copyright2",
89
+ "签约作者独家特约稿件,及所有魔盒官方评分作品用户一经兑现则视为有偿付费稿件,所有商业稿件的转载引用需同时征得魔盒平台授权。"
90
+ )
91
+ }}
92
+ </div>
93
+ </template>
73
94
  </div>
74
95
  </template>
75
96
 
76
97
  <script>
77
98
  import Like from "../interact/Like.vue";
78
99
  import Fav from "../interact/Fav.vue";
100
+ import BatchReward from "../interact/BatchReward.vue";
79
101
  import BoxcoinAdmin from "../interact/BoxcoinAdmin.vue";
80
102
  import BoxcoinUser from "../interact/BoxcoinUser.vue";
81
103
  import BoxcoinRecords from "../interact/BoxcoinRecords.vue";
@@ -94,6 +116,7 @@ export default {
94
116
  components: {
95
117
  Like,
96
118
  Fav,
119
+ BatchReward,
97
120
  BoxcoinAdmin,
98
121
  BoxcoinUser,
99
122
  BoxcoinRecords,
@@ -107,7 +130,7 @@ export default {
107
130
  default: "normal",
108
131
  },
109
132
  postId: {
110
- type: [Number, String],
133
+ type: [Number, String, Array],
111
134
  default: 0,
112
135
  },
113
136
  postType: {