@jx3box/jx3box-common-ui 5.5.21 → 5.5.24

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": "5.5.21",
3
+ "version": "5.5.24",
4
4
  "description": "JX3BOX UI",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -31,10 +31,10 @@
31
31
  ],
32
32
  "dependencies": {
33
33
  "@jx3box/jx3box-comment-ui": "^1.6.8",
34
- "@jx3box/jx3box-common": "^7.0.18",
34
+ "@jx3box/jx3box-common": "^7.0.21",
35
35
  "@jx3box/jx3box-data": "^1.8.3",
36
- "@jx3box/jx3box-editor": "^1.2.4",
37
- "axios": "^0.19.2",
36
+ "@jx3box/jx3box-editor": "^1.2.6",
37
+ "axios": "^0.26.1",
38
38
  "element-ui": "^2.13.2",
39
39
  "jquery": "^3.5.1",
40
40
  "lodash": "^4.17.15",
package/readme.md CHANGED
@@ -1,5 +1,4 @@
1
1
  # JX3BOX UI
2
- 手动更新cdn `https://oss.jx3box.com/static/`
3
2
 
4
3
  通用 UI 组件
5
4
 
@@ -12,8 +12,9 @@
12
12
  src="../assets/img/bread/menu.svg"
13
13
  />
14
14
  </div>
15
- <a class="u-channel" :href="root" :class="{on:withoutLeft}">
15
+ <a class="u-channel" :href="rootLink" :class="{on:withoutLeft}">
16
16
  <i class="u-channel-logo">
17
+ <img :src="getAppIcon(slug)" v-if="!$slots.logo"/>
17
18
  <slot name="logo"></slot>
18
19
  </i>
19
20
  <span class="u-title">{{ name }}</span>
@@ -50,7 +51,7 @@
50
51
 
51
52
  <script>
52
53
  import _ from "lodash";
53
- import { publishLink } from "@jx3box/jx3box-common/js/utils";
54
+ import { publishLink,getAppIcon } from "@jx3box/jx3box-common/js/utils";
54
55
  import { __Links, feedback } from "@jx3box/jx3box-common/data/jx3box.json";
55
56
  import User from "@jx3box/jx3box-common/js/user";
56
57
  import Admin from "./bread/Admin";
@@ -87,13 +88,18 @@ export default {
87
88
  isApp: isApp(),
88
89
  };
89
90
  },
90
- computed: {},
91
+ computed: {
92
+ rootLink : function (){
93
+ return this.root || `/${this.slug}`
94
+ }
95
+ },
91
96
  methods: {
92
97
  toggleLeftSide: function () {
93
98
  let status = !this.isOpen;
94
99
  Bus.$emit("toggleLeftSide", status);
95
100
  },
96
101
  publishLink,
102
+ getAppIcon,
97
103
  },
98
104
  mounted: function () {
99
105
  Bus.$on("toggleLeftSide", (data) => {
@@ -0,0 +1,110 @@
1
+ <template>
2
+ <section class="m-contributor">
3
+ <div class="m-author">
4
+ <el-radio
5
+ v-for="(item, i) in authors"
6
+ v-model="value"
7
+ :label="String(item.user_id)"
8
+ :key="i"
9
+ @change="handleAuthorChange"
10
+ >
11
+ <img
12
+ class="u-pic"
13
+ :src="showAvatar(item.user_avatar)"
14
+ :alt="item.display_name"
15
+ />
16
+ <span class="u-txt" :title="item.display_name">
17
+ {{ item.display_name }}
18
+ </span>
19
+ </el-radio>
20
+ </div>
21
+ </section>
22
+ </template>
23
+
24
+ <script>
25
+ import { showAvatar } from "@jx3box/jx3box-common/js/utils";
26
+ export default {
27
+ name: "Contributors",
28
+ props: {
29
+ authors: {
30
+ type: Array,
31
+ default: () => [],
32
+ },
33
+ },
34
+ data() {
35
+ return {
36
+ value: "",
37
+ };
38
+ },
39
+ watch: {
40
+ authors: {
41
+ deep: true,
42
+ immediate: true,
43
+ handler(val) {
44
+ if (val && val.length) this.value = String(val[0]?.user_id)
45
+ }
46
+ },
47
+ value: {
48
+ immediate: true,
49
+ handler(val) {
50
+ val && this.$emit('chosen', this.value)
51
+ }
52
+ }
53
+ },
54
+ methods: {
55
+ handleAuthorChange() {},
56
+ showAvatar,
57
+ },
58
+ };
59
+ </script>
60
+
61
+ <style lang="less">
62
+ .m-contributor {
63
+ padding: 10px 10px 0 10px;
64
+ .m-author {
65
+ .u-pic {
66
+ .db;
67
+ .size(48px);
68
+ background-color: @bg-black;
69
+ .r(4px);
70
+ transition: 0.1s ease-in;
71
+ // .tm(0.4);
72
+ box-sizing: border-box;
73
+
74
+ &:hover {
75
+ .tm(1);
76
+ }
77
+ }
78
+ .u-txt {
79
+ .db;
80
+ .x;
81
+ .fz(12px, 2);
82
+ white-space: nowrap;
83
+ overflow: hidden;
84
+ .w(48px);
85
+ }
86
+
87
+ .el-radio {
88
+ .ml(0);
89
+ .mr(15px);
90
+ }
91
+ .el-radio__input {
92
+ .none;
93
+ }
94
+ .el-radio__label {
95
+ .db;
96
+ padding-left: 0;
97
+ }
98
+
99
+ .is-checked {
100
+ .u-pic {
101
+ border: 3px solid @primary;
102
+ .tm(1);
103
+ }
104
+ .u-txt {
105
+ .bold;
106
+ }
107
+ }
108
+ }
109
+ }
110
+ </style>
@@ -18,6 +18,7 @@
18
18
  </div>
19
19
  <div class="u-list">
20
20
  <em class="u-label">❤️ 品鉴</em>
21
+ <Contributors v-if="authors && authors.length" :authors="authors" @chosen="handleChosen" />
21
22
  <div class="u-points">
22
23
  <el-radio-group v-model="count">
23
24
  <el-radio :label="item" v-for="item in points" :key="item" border>
@@ -50,10 +51,13 @@
50
51
  <script>
51
52
  import { grantBoxcoin } from "../../service/thx.js";
52
53
  import User from "@jx3box/jx3box-common/js/user";
54
+ import Contributors from '@/interact/Contributors.vue';
53
55
  export default {
54
56
  name: "BoxcoinAdmin",
55
- props: ["postType", "postId", "userId", "own", "points"],
56
- components: {},
57
+ props: ["postType", "postId", "userId", "own", "points", 'authors'],
58
+ components: {
59
+ Contributors
60
+ },
57
61
  data: function () {
58
62
  return {
59
63
  visible: false,
@@ -61,7 +65,9 @@ export default {
61
65
  count: 0,
62
66
  remark: "辛苦,感谢!",
63
67
 
64
- left : this.own
68
+ left : this.own,
69
+
70
+ chosen: '', // 被选中的人
65
71
  };
66
72
  },
67
73
  computed: {
@@ -90,8 +96,12 @@ export default {
90
96
  openBoxcoinPop: function () {
91
97
  this.visible = true;
92
98
  },
99
+ // 选择要打赏的对象
100
+ handleChosen(userId) {
101
+ this.chosen = userId
102
+ },
93
103
  submit: function () {
94
- grantBoxcoin(this.postType, this.postId, this.userId, this.count, {
104
+ grantBoxcoin(this.postType, this.postId, this.chosen || this.userId, this.count, {
95
105
  remark: this.remark,
96
106
  client : this.client
97
107
  })
@@ -100,12 +110,13 @@ export default {
100
110
  message: "操作成功",
101
111
  type: "success",
102
112
  });
113
+ return res.data.data
103
114
  })
104
- .then(() => {
115
+ .then((data) => {
105
116
  // 1.扣除额度
106
117
  this.left -= this.count;
107
118
  // 2.将修改emit出去
108
- this.$emit('updateRecord', { count: this.count, remark: this.remark, is_user_gift: 0 });
119
+ this.$emit('updateRecord', data);
109
120
  })
110
121
  .finally(() => {
111
122
  this.visible = false;
@@ -7,7 +7,7 @@
7
7
  <i class="el-icon-trophy"></i>
8
8
  </span>
9
9
  <span class="u-meta u-user">参与打赏</span>
10
- <span class="u-meta u-user" v-if="mode== 'wiki'">收益作者</span>
10
+ <span class="u-meta u-user">收益作者</span>
11
11
  <span class="u-meta u-count">盒币</span>
12
12
  <span class="u-meta u-remark">寄语</span>
13
13
  <time class="u-meta u-time"></time>
@@ -30,7 +30,6 @@
30
30
  <span>{{item.ext_operate_user_info.display_name}}</span>
31
31
  </a>
32
32
  <a
33
- v-if="mode== 'wiki'"
34
33
  class="u-meta u-user"
35
34
  :href="authorLink(item.user_id)"
36
35
  target="_blank"
@@ -109,9 +108,9 @@ export default {
109
108
  },
110
109
  cacheRecord: {
111
110
  deep: true,
112
- handler: function (val) {
113
- if (val) {
114
- this.list.push(val);
111
+ handler: function (data) {
112
+ if (data) {
113
+ this.list.push(data)
115
114
  // 清空父组件的cache
116
115
  this.$parent.cacheRecord = null;
117
116
  }
@@ -15,6 +15,7 @@
15
15
  </div>
16
16
  <div class="u-list">
17
17
  <em class="u-label">❤️ 打赏</em>
18
+ <Contributors v-if="authors && authors.length" :authors="authors" @chosen="handleChosen" />
18
19
  <div class="u-points">
19
20
  <el-radio-group v-model="count">
20
21
  <el-radio :label="item" v-for="item in points" :key="item" border>
@@ -47,10 +48,13 @@
47
48
  <script>
48
49
  import { rewardBoxcoin } from "../../service/thx.js";
49
50
  import User from "@jx3box/jx3box-common/js/user";
51
+ import Contributors from '@/interact/Contributors.vue';
50
52
  export default {
51
53
  name: "BoxcoinUser",
52
- props: ["boxcoin", "postType", "postId", "userId", "own", "points"],
53
- components: {},
54
+ props: ["boxcoin", "postType", "postId", "userId", "own", "points", "authors"],
55
+ components: {
56
+ Contributors
57
+ },
54
58
  data: function () {
55
59
  return {
56
60
  visible: false,
@@ -61,6 +65,8 @@ export default {
61
65
  left : this.own,
62
66
 
63
67
  chargeLink: "/vip/boxcoin?redirect=" + location.href,
68
+
69
+ chosen: '', // 被选中的人
64
70
  };
65
71
  },
66
72
  computed: {
@@ -93,8 +99,12 @@ export default {
93
99
  User.toLogin();
94
100
  }
95
101
  },
102
+ // 选择要打赏的对象
103
+ handleChosen(userId) {
104
+ this.chosen = userId
105
+ },
96
106
  submit: function () {
97
- rewardBoxcoin(this.postType, this.postId, this.userId, this.count, {
107
+ rewardBoxcoin(this.postType, this.postId, this.chosen || this.userId, this.count, {
98
108
  remark: this.remark,
99
109
  client : this.client
100
110
  })
@@ -103,12 +113,13 @@ export default {
103
113
  message: "操作成功",
104
114
  type: "success",
105
115
  });
116
+ return res.data.data
106
117
  })
107
- .then(() => {
118
+ .then((data) => {
108
119
  // 1.扣除额度
109
120
  this.left -= this.count;
110
121
  // 2. 将新增emit出去
111
- this.$emit('updateRecord', { count: this.count, remark: this.remark, is_user_gift: 1 });
122
+ this.$emit('updateRecord', data);
112
123
  })
113
124
  .finally(() => {
114
125
  this.visible = false;
@@ -84,6 +84,23 @@ export default {
84
84
  getPostAuthors(this.id).then((res) => {
85
85
  this.super_author = res.data?.data.super_author;
86
86
  this.other_authors = res.data?.data.other_authors;
87
+
88
+ const super_author = {
89
+ user_id: this.super_author.ID,
90
+ display_name: this.super_author.display_name,
91
+ user_avatar: this.super_author.user_avatar,
92
+ }
93
+
94
+ const other_authors = this.other_authors?.map(item => {
95
+ return {
96
+ user_id: item.post_author_info?.ID,
97
+ display_name: item.post_author_info?.display_name,
98
+ user_avatar: item.post_author_info?.user_avatar,
99
+ }
100
+ })
101
+
102
+ // 将联合创作者传出去
103
+ this.$emit('load-authors', { super_author, other_authors })
87
104
  });
88
105
  },
89
106
  showAvatar: function (val) {
@@ -1,10 +1,10 @@
1
1
  <template>
2
2
  <div class="w-thx">
3
3
  <div class="w-thx-panel">
4
- <boxcoin-admin :postId="postId" :postType="postType" v-if="hasRight && adminBoxcoinEnable && boxcoin_enable" :userId="userId" :own="admin_left" :points="admin_points" @updateRecord="updateRecord" />
4
+ <boxcoin-admin :postId="postId" :postType="postType" v-if="hasRight && adminBoxcoinEnable && boxcoin_enable" :userId="userId" :own="admin_left" :points="admin_points" :authors="authors" @updateRecord="updateRecord" />
5
5
  <Like :postId="postId" :postType="postType"></Like>
6
6
  <fav :postId="postId" :postType="postType"></fav>
7
- <boxcoin-user :postId="postId" :postType="postType" :boxcoin="boxcoin" :userId="userId" :own="user_left" :points="user_points" v-if="userBoxcoinEnable && boxcoin_enable" @updateRecord="updateRecord" />
7
+ <boxcoin-user :postId="postId" :postType="postType" :boxcoin="boxcoin" :userId="userId" :own="user_left" :points="user_points" :authors="authors" v-if="userBoxcoinEnable && boxcoin_enable" @updateRecord="updateRecord" />
8
8
  <Share :postId="postId" :postType="postType" />
9
9
  </div>
10
10
  <div class="w-thx-records">
@@ -28,7 +28,7 @@ import User from '@jx3box/jx3box-common/js/user'
28
28
  import {getPostBoxcoinConfig,getBoxcoinStatus} from '../../service/thx'
29
29
  export default {
30
30
  name: "Thx",
31
- props: ["postId", "postType","userId","adminBoxcoinEnable","userBoxcoinEnable",'mode'],
31
+ props: ["postId", "postType","userId","adminBoxcoinEnable","userBoxcoinEnable",'mode', 'authors'],
32
32
  components: {
33
33
  Like,
34
34
  Share,
@@ -79,18 +79,8 @@ export default {
79
79
  })
80
80
  },
81
81
  // 用户打赏
82
- updateRecord: function ({ count, remark, is_user_gift }){
83
- this.cacheRecord = {
84
- count,
85
- remark,
86
- is_user_gift,
87
- operate_user_id: this.user.uid,
88
- created_at: Date.now(),
89
- ext_operate_user_info: {
90
- avatar: this.user.avatar_origin,
91
- display_name: this.user.name
92
- },
93
- }
82
+ updateRecord: function (data){
83
+ this.cacheRecord = data
94
84
  },
95
85
  },
96
86
  created: function () {},
@@ -8,7 +8,7 @@
8
8
  <!-- 文章前 -->
9
9
  <div class="m-single-prepend">
10
10
  <!-- 联合创作者 -->
11
- <Creators class="m-single-creators" :postId="id" :postType="post_type" />
11
+ <Creators class="m-single-creators" :postId="id" :postType="post_type" @load-authors="loadAuthors" />
12
12
  <!-- 文集小册 -->
13
13
  <Collection class="m-single-collection" :id="collection_id" :defaultVisible="collection_collapse" @collectionUpdate="updateCollection"/>
14
14
  <slot name="single-prepend"></slot>
@@ -33,7 +33,7 @@
33
33
  <slot name="single-append"></slot>
34
34
 
35
35
  <!-- 打赏 -->
36
- <Thx class="m-single-thx" :postId="id" :postType="post_type" :userId="author_id" :adminBoxcoinEnable="true" :userBoxcoinEnable="true"/>
36
+ <Thx class="m-single-thx" :postId="id" :postType="post_type" :userId="author_id" :adminBoxcoinEnable="true" :userBoxcoinEnable="true" :authors="authors" />
37
37
 
38
38
  <!-- 评论 -->
39
39
  <div class="m-single-comment">
@@ -74,7 +74,11 @@ export default {
74
74
  data: function() {
75
75
  return {
76
76
  collection_data : '',
77
- directory : false
77
+ directory : false,
78
+
79
+ // 创作者
80
+ other_authors: [],
81
+ super_author: "",
78
82
  };
79
83
  },
80
84
  computed: {
@@ -119,6 +123,13 @@ export default {
119
123
  collection_data : this.collection_data,
120
124
  directory : this.directory
121
125
  }
126
+ },
127
+ authors: function (){
128
+ if (this.other_authors && this.other_authors.length) {
129
+ return [this.super_author, ...this.other_authors]
130
+ }
131
+
132
+ return []
122
133
  }
123
134
  },
124
135
  methods : {
@@ -127,6 +138,10 @@ export default {
127
138
  },
128
139
  updateDirectory : function (val){
129
140
  this.directory = val
141
+ },
142
+ loadAuthors({super_author, other_authors}) {
143
+ this.super_author = super_author;
144
+ this.other_authors = other_authors
130
145
  }
131
146
  },
132
147
  watch : {