@jx3box/jx3box-vue3-ui 0.1.0 → 0.1.2

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-vue3-ui",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "JX3BOX Vue3 UI",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -0,0 +1,161 @@
1
+ <template>
2
+ <div class="w-share2">
3
+ <el-popover trigger="hover" placement="right" popper-class="u-share2-pop" width="auto">
4
+ <div class="u-share2-content">
5
+ <div class="u-share2-content-main">
6
+ <div
7
+ v-for="shareItem in shareList"
8
+ class="u-share2-item"
9
+ :key="shareItem.key"
10
+ @click="share(shareItem.key)"
11
+ title="分享"
12
+ >
13
+ <img class="u-share-icon" svg-inline :src="shareItem.img" :alt="shareItem.name">
14
+ <div class="u-share2-name">{{ shareItem.name }}</div>
15
+ </div>
16
+ <!-- <p class="tip">将文章链接贴</p> -->
17
+ </div>
18
+ <div class="u-share2-wechat">
19
+ <qrcode-vue
20
+ class="u-pic"
21
+ :value="url.href"
22
+ :size="75"
23
+ level="H"
24
+ ></qrcode-vue>
25
+ <span>微信扫一扫分享</span>
26
+ </div>
27
+ </div>
28
+
29
+ <template #reference>
30
+ <!-- <el-tooltip class="item" effect="dark" content="分享" placement="top"> -->
31
+ <div v-if="simple">
32
+ <img class="u-icon u-simple-icon" svg-inline src="../../assets/img/widget/share.svg" />
33
+ <!-- <i class="el-icon-position"></i> -->
34
+ <span class="u-text">分享</span>
35
+ </div>
36
+ <img
37
+ v-else
38
+ class="u-icon"
39
+ svg-inline
40
+ src="../../assets/img/widget/share2.svg"
41
+ />
42
+ <!-- </el-tooltip> -->
43
+ </template>
44
+ </el-popover>
45
+ </div>
46
+ </template>
47
+
48
+ <script>
49
+ import { __imgPath } from "@jx3box/jx3box-common/data/jx3box.json";
50
+ import QrcodeVue from "qrcode.vue";
51
+ export default {
52
+ name: "ShareComp",
53
+ props: ["postType", "postId", "meta", "simple"],
54
+ data: function () {
55
+ return {
56
+ apis: {
57
+ qzone: 'https://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey?',
58
+ qq: 'http://connect.qq.com/widget/shareqq/index.html?',
59
+ wechat: '',
60
+ weibo: 'https://service.weibo.com/share/share.php?',
61
+ tieba: 'http://tieba.baidu.com/f/commit/share/openShareApi?'
62
+ },
63
+ shareList: [
64
+ {
65
+ name: '微博',
66
+ key: 'weibo',
67
+ img: require('../../assets/img/widget/weibo.svg'),
68
+ },
69
+ {
70
+ name: 'QQ',
71
+ key: 'qq',
72
+ img: require('../../assets/img/widget/qq.svg'),
73
+ },
74
+ {
75
+ name: 'QQ空间',
76
+ key: 'qzone',
77
+ img: require('../../assets/img/widget/qzone.svg'),
78
+ },
79
+ {
80
+ name: '贴吧',
81
+ key: 'tieba',
82
+ img: require('../../assets/img/widget/tieba.svg'),
83
+ },
84
+ /* {
85
+ name: '微信',
86
+ key: 'wechat',
87
+ img: require('../../assets/img/widget/weixin.svg'),
88
+ }, */
89
+ ]
90
+ };
91
+ },
92
+ computed: {
93
+ ready() {
94
+ return !!(this.postType && this.postId);
95
+ },
96
+ url() {
97
+ return document.location;
98
+ },
99
+ title() {
100
+ return this.meta?.title || document.title;
101
+ },
102
+ pic: function() {
103
+ return this.meta?.banner || __imgPath + `image/common/logo.png`;
104
+ },
105
+ urls: function() {
106
+ return {
107
+ qzone: this.shareToQzone,
108
+ weibo: this.shareToWeibo,
109
+ tieba: this.shareToTieba,
110
+ qq: this.shareToQQ,
111
+ }
112
+ },
113
+ },
114
+ methods: {
115
+ init: function () {
116
+ },
117
+ shareToWeibo: function (){
118
+ return this.apis['weibo']
119
+ + `url=${this.url}`
120
+ + `&title=${this.title}`
121
+ + `&pic=${this.pic}`;
122
+ },
123
+ shareToQzone: function (){
124
+ return this.apis['qzone']
125
+ + `url=${this.url}`
126
+ + `&title=${this.title}`
127
+ + '&sharesource=qzone'
128
+ + `&summary=${this.meta?.summary || ''}`
129
+ + `&desc=${this.meta?.desc || ''}`
130
+ + `&pics=${this.pic}`;
131
+ },
132
+ shareToQQ: function (){
133
+ return this.apis['qq']
134
+ + `url=${this.url}`
135
+ + `&title=${this.title}`
136
+ + `&pics=${this.pic}`;
137
+ },
138
+ shareToTieba: function (){
139
+ return this.apis['tieba']
140
+ + `url=${this.url}`
141
+ + `&title=${this.title}`
142
+ + `&summary=${this.meta?.summary || ''}`
143
+ + `&desc=${this.meta?.desc || ''}`
144
+ + `&pic=${this.pic}`;
145
+ },
146
+ share: function (val){
147
+ window.open(this.urls[val](), "_blank")
148
+ }
149
+ },
150
+ mounted: function () {
151
+ this.init();
152
+ },
153
+ components: {
154
+ QrcodeVue
155
+ }
156
+ };
157
+ </script>
158
+
159
+ <style lang="less">
160
+ @import "../../assets/css/share2.less";
161
+ </style>
@@ -42,7 +42,7 @@
42
42
  </el-tooltip>
43
43
  </div>
44
44
 
45
- <el-drawer v-model="showDrawer" title="打赏记录">
45
+ <el-drawer v-model="showDrawer" title="打赏记录" append-to-body>
46
46
  <BoxcoinRecords
47
47
  :postId="postId"
48
48
  :postType="postType"
@@ -0,0 +1,189 @@
1
+ <template>
2
+ <div class="w-thx">
3
+ <div class="w-thx-panel">
4
+ <boxcoin-admin
5
+ :postId="postId"
6
+ :postType="postType"
7
+ v-if="hasRight && adminBoxcoinEnable && boxcoin_enable"
8
+ :userId="userId"
9
+ :max="admin_max"
10
+ :min="admin_min"
11
+ :own="admin_left"
12
+ :total="admin_total"
13
+ :points="admin_points"
14
+ :authors="authors"
15
+ @updateRecord="updateRecord"
16
+ :client="client"
17
+ />
18
+ <Like :postId="postId" :postType="postType"></Like>
19
+ <fav :postId="postId" :postType="postType" :postTitle="postTitle"></fav>
20
+ <boxcoin-user
21
+ :postId="postId"
22
+ :postType="postType"
23
+ :boxcoin="boxcoin"
24
+ :userId="userId"
25
+ :own="user_left"
26
+ :points="user_points"
27
+ :authors="authors"
28
+ v-if="userBoxcoinEnable && boxcoin_enable && allowGift"
29
+ @updateRecord="updateRecord"
30
+ :client="client"
31
+ />
32
+ <Share :postId="postId" :postType="postType" :client="client" />
33
+ </div>
34
+ <div class="w-thx-records">
35
+ <boxcoin-records :postId="postId" :postType="postType" :postClient="client" :cacheRecord="cacheRecord"
36
+ :mode="mode" @update:boxcoin="updateBoxcoin" />
37
+ </div>
38
+ <div class="w-thx-copyright">
39
+ &copy;
40
+ 所有原创作品,著作权归作者所有,所有未经授权的非署名转载或抄袭将有权追究法律责任,所有法律事务由专聘律师代理。<br />
41
+ 签约作者独家特约稿件,及所有魔盒官方评分作品用户一经兑现则视为有偿付费稿件,所有商业稿件的转载引用需同时征得魔盒平台授权。
42
+ </div>
43
+ </div>
44
+ </template>
45
+
46
+ <script>
47
+ import Like from "../interact/Like.vue";
48
+ import Fav from "../interact/Fav.vue";
49
+ import BoxcoinAdmin from "../interact/BoxcoinAdmin.vue";
50
+ import BoxcoinUser from "../interact/BoxcoinUser.vue";
51
+ import BoxcoinRecords from "../interact/BoxcoinRecords.vue";
52
+ import Share from "../interact/Share.vue";
53
+
54
+ import User from "@jx3box/jx3box-common/js/user";
55
+ import { getBoxcoinStatus, getPostBoxcoinConfig } from "../../service/thx";
56
+
57
+ export default {
58
+ name: "ThxComp",
59
+ components: {
60
+ Like,
61
+ Fav,
62
+ BoxcoinAdmin,
63
+ BoxcoinUser,
64
+ BoxcoinRecords,
65
+ Share,
66
+ },
67
+ props: {
68
+ type: {
69
+ type: String,
70
+ default: "normal",
71
+ },
72
+ postId: {
73
+ type: Number,
74
+ default: 0,
75
+ },
76
+ postType: {
77
+ type: String,
78
+ default: "",
79
+ },
80
+ postTitle: {
81
+ type: String,
82
+ default: "",
83
+ },
84
+ userId: {
85
+ type: Number,
86
+ default: 0,
87
+ },
88
+ authors: {
89
+ type: Array,
90
+ default: () => [],
91
+ },
92
+ mode: {
93
+ type: String,
94
+ default: "normal",
95
+ },
96
+ client: {
97
+ type: String,
98
+ default: "std",
99
+ },
100
+ allowGift: {
101
+ type: [Number, Boolean],
102
+ default: 1,
103
+ },
104
+ adminBoxcoinEnable: {
105
+ type: Boolean,
106
+ default: false,
107
+ },
108
+ userBoxcoinEnable: {
109
+ type: Boolean,
110
+ default: false,
111
+ },
112
+ },
113
+ data: function () {
114
+ return {
115
+ boxcoin: 0,
116
+ hasRight: User.getInfo().group >= 32,
117
+ user: User.getInfo(),
118
+
119
+ admin_max: 0,
120
+ admin_min: 0,
121
+ admin_left: 0,
122
+ admin_total: 0,
123
+ admin_points: [100],
124
+
125
+ user_left: 0,
126
+ user_points: [100],
127
+
128
+ cacheRecord: null,
129
+ boxcoin_enable: 0,
130
+
131
+ showDrawer: false,
132
+ };
133
+ },
134
+ computed: {
135
+ post_keys: function () {
136
+ return [this.postId, this.postType];
137
+ },
138
+ },
139
+ watch: {
140
+ post_keys: {
141
+ immediate: true,
142
+ deep: true,
143
+ handler: function () {
144
+ this.postType && this.postId && this.loadBoxcoinConfig();
145
+ },
146
+ },
147
+ },
148
+ methods: {
149
+ loadBoxcoinConfig: function () {
150
+ User.isLogin() &&
151
+ getPostBoxcoinConfig(this.postType).then((res) => {
152
+ this.admin_max = res.data.data.limit.admin_max || 0;
153
+ this.admin_min = res.data.data.limit.admin_min || 0;
154
+ this.admin_points = res.data.data.limit.admin_points || [10, 1000];
155
+ this.admin_left = res.data.data.asManagerBoxCoinRemain || 0;
156
+ this.admin_total = res.data.data.asManagerBoxCoinTotal || 0;
157
+
158
+ this.user_points = res.data.data.limit.user_points || [10, 1000];
159
+ // 根据多端展示剩余币
160
+ // 作品是n端,接受n端币+all币
161
+ if (this.client == "origin") {
162
+ this.user_left = res.data.data.asUserBoxCoinRemainOrigin + res.data.data.asUserBoxCoinRemainAll;
163
+ } else if (this.client == "std") {
164
+ this.user_left = res.data.data.asUserBoxCoinRemainStd + res.data.data.asUserBoxCoinRemainAll;
165
+ } else {
166
+ this.user_left =
167
+ res.data.data.asUserBoxCoinRemainAll +
168
+ res.data.data.asUserBoxCoinRemainStd +
169
+ res.data.data.asUserBoxCoinRemainOrigin;
170
+ }
171
+ });
172
+ getBoxcoinStatus().then((res) => {
173
+ this.boxcoin_enable = !!~~res.data.data.val;
174
+ });
175
+ },
176
+ // 用户打赏
177
+ updateRecord: function (data) {
178
+ this.cacheRecord = data;
179
+ },
180
+ updateBoxcoin: function (data) {
181
+ this.boxcoin = data;
182
+ },
183
+ },
184
+ };
185
+ </script>
186
+
187
+ <style lang="less">
188
+ @import "../../assets/css/thx.less";
189
+ </style>