@jx3box/jx3box-ui 2.2.10 → 2.2.11

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.2.10",
3
+ "version": "2.2.11",
4
4
  "description": "JX3BOX Vue3 UI",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -50,9 +50,10 @@ function later(data) {
50
50
  return $next().post(`/api/next2/userdata/watch-later/item`, data);
51
51
  }
52
52
  // 收藏相关
53
- function setCollect(id, type, post_title) {
53
+ function setCollect(id, type, post_title, author_id) {
54
54
  return $next().post(`/api/article/favorites/add/${id}/${type}`, {
55
55
  post_title: post_title,
56
+ author_id,
56
57
  });
57
58
  }
58
59
  function getCollectList(id, type) {
@@ -466,6 +466,7 @@ export default {
466
466
  avatar: "", //作者头像
467
467
  author_id: "", //作者id
468
468
  },
469
+ author_id: "",
469
470
  subscribeType: "", //订阅类型,用于区分调用百科、文章、作者、帖子等订阅接口,
470
471
  postType: "", //订阅、收藏接口的type,如'face','bps','article'等
471
472
  id: "", //页面数据ID,用于收藏订阅操作
@@ -500,6 +501,15 @@ export default {
500
501
  fixIsActive() {
501
502
  return this.fixList.some((item) => item.url === this.fixPageConfig.url);
502
503
  },
504
+ authorId() {
505
+ return this.drawerConfig.author_id || this.drawerConfig.author?.author_id || "";
506
+ },
507
+ subscribeData() {
508
+ return {
509
+ title: this.drawerConfig.title,
510
+ author_id: this.authorId,
511
+ };
512
+ },
503
513
  },
504
514
  mounted() {
505
515
  this.fixList = JSON.parse(localStorage.getItem(this.fixPageConfig.key)) || [];
@@ -590,7 +600,7 @@ export default {
590
600
  this.collectInfo = {};
591
601
  });
592
602
  } else {
593
- setCollect(conf.id, conf.postType, conf.title).then((res) => {
603
+ setCollect(conf.id, conf.postType, conf.title, this.authorId).then((res) => {
594
604
  this.isCollect = true;
595
605
  this.collectInfo = res.data?.data;
596
606
  });
@@ -629,7 +639,7 @@ export default {
629
639
  this.$emit("subscribe", { isSubscribe: false });
630
640
  });
631
641
  } else {
632
- subscribePost(conf.id, { title: conf.title }).then((res) => {
642
+ subscribePost(conf.id, this.subscribeData).then((res) => {
633
643
  this.isSubscribe = true;
634
644
  this.subscribeInfo = res.data?.data;
635
645
  this.$emit("subscribe", { isSubscribe: true });
@@ -644,7 +654,7 @@ export default {
644
654
  this.$emit("subscribe", { isSubscribe: false });
645
655
  });
646
656
  } else {
647
- subscribeArticle(conf.postType, conf.id, { title: conf.title }).then((res) => {
657
+ subscribeArticle(conf.postType, conf.id, this.subscribeData).then((res) => {
648
658
  this.isSubscribe = true;
649
659
  this.subscribeInfo = res.data?.data;
650
660
  this.$emit("subscribe", { isSubscribe: true });
@@ -659,7 +669,7 @@ export default {
659
669
  this.$emit("subscribe", { isSubscribe: false });
660
670
  });
661
671
  } else {
662
- subscribeWiki(conf.postType, conf.id, { title: conf.title }).then((res) => {
672
+ subscribeWiki(conf.postType, conf.id, this.subscribeData).then((res) => {
663
673
  this.isSubscribe = true;
664
674
  this.subscribeInfo = res.data?.data;
665
675
  this.$emit("subscribe", { isSubscribe: true });
@@ -16,7 +16,7 @@
16
16
  :client="client"
17
17
  />
18
18
  <Like :postId="postId" :postType="postType"></Like>
19
- <fav :postId="postId" :postType="postType" :postTitle="postTitle" :author_id="userId"></fav>
19
+ <fav :postId="postId" :postType="postType" :postTitle="postTitle" :author_id="postAuthorId"></fav>
20
20
  <boxcoin-user
21
21
  :postId="postId"
22
22
  :postType="postType"
@@ -96,6 +96,10 @@ export default {
96
96
  type: [Number, String],
97
97
  default: 0,
98
98
  },
99
+ authorId: {
100
+ type: [Number, String],
101
+ default: 0,
102
+ },
99
103
  authors: {
100
104
  type: Array,
101
105
  default: () => [],
@@ -150,6 +154,9 @@ export default {
150
154
  post_keys: function () {
151
155
  return [this.postId, this.postType];
152
156
  },
157
+ postAuthorId: function () {
158
+ return this.authorId || this.userId;
159
+ },
153
160
  },
154
161
  watch: {
155
162
  post_keys: {
@@ -30,6 +30,7 @@ export const Default = {
30
30
  avatar: 'https://cdn.jx3box.com/upload/avatar/2022/3/2/8_9860765.png',
31
31
  author_id: 8,
32
32
  },
33
+ author_id: 8,
33
34
  subscribeType: '',
34
35
  postType: '',
35
36
  id: '',
@@ -13,6 +13,7 @@ const meta = {
13
13
  postId: { control: 'number' },
14
14
  postType: { control: 'text' },
15
15
  postTitle: { control: 'text' },
16
+ authorId: { control: 'number' },
16
17
  showComment: { control: 'boolean' },
17
18
  },
18
19
  };
@@ -24,6 +25,7 @@ export const Default = {
24
25
  postId: 80449,
25
26
  postType: 'bbs',
26
27
  postTitle: '轻剑驭风版本攻略示例',
28
+ authorId: 8,
27
29
  showComment: true,
28
30
  },
29
31
  render: (args) => ({
@@ -58,6 +60,7 @@ export const Default = {
58
60
  { name: 'postId', type: 'String | Number', default: '""', description: '当前文章 ID,用于收藏查询。' },
59
61
  { name: 'postType', type: 'String', default: '""', description: '文章类型,例如 bbs / pvx。' },
60
62
  { name: 'postTitle', type: 'String', default: '""', description: '文章标题,用于收藏请求。' },
63
+ { name: 'authorId', type: 'String | Number', default: '""', description: '收藏请求携带的作者 UID。' },
61
64
  { name: 'showComment', type: 'Boolean | Number', default: 'false', description: '是否展示评论入口按钮。' },
62
65
  ],
63
66
  };
@@ -22,6 +22,7 @@ export const Default = {
22
22
  { name: 'postType', type: 'String', default: '""', required: true, description: '文章类型。' },
23
23
  { name: 'postTitle', type: 'String', default: '""', description: '文章标题。' },
24
24
  { name: 'userId', type: 'Number | String', default: '0', description: '作者 UID。' },
25
+ { name: 'authorId', type: 'Number | String', default: '0', description: '收藏请求携带的作者 UID,未传时回退到 userId。' },
25
26
  { name: 'adminBoxcoinEnable / userBoxcoinEnable', type: 'Boolean', default: 'false', description: '控制打赏区显示。' },
26
27
  { name: 'presetConfig', type: 'Object', default: '{}', description: 'Storybook 下可直接注入打赏配置,避免空态。' },
27
28
  ],
@@ -30,7 +31,7 @@ export const Default = {
30
31
  template: `
31
32
  <div style="display:grid;gap:24px;">
32
33
  <section style="border-radius:20px;background:rgba(255,255,255,0.92);padding:24px;box-shadow:0 24px 60px rgba(15,23,42,0.08);">
33
- <SimpleThx post-type="bbs" post-title="轻剑驭风版本攻略示例" :post-id="80449" :user-id="8" :admin-boxcoin-enable="true" :user-boxcoin-enable="true" :allow-gift="true" :preset-config="presetConfig" />
34
+ <SimpleThx post-type="bbs" post-title="轻剑驭风版本攻略示例" :post-id="80449" :user-id="8" :author-id="8" :admin-boxcoin-enable="true" :user-boxcoin-enable="true" :allow-gift="true" :preset-config="presetConfig" />
34
35
  </section>
35
36
  <StoryPropsTable title="SimpleThx" description="简化互动条组件。" :items="propsInfo" />
36
37
  </div>