@jx3box/jx3box-vue3-ui 0.0.4 → 0.0.5

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.
@@ -6,6 +6,14 @@
6
6
  .mr(20px);
7
7
  }
8
8
  .x;
9
+
10
+ .u-record-icon {
11
+ .size(26px);
12
+ // .y;
13
+ .pr;
14
+ top: 4px;
15
+ .pointer;
16
+ }
9
17
  }
10
18
  .w-thx-panel {
11
19
  .mb(20px);
@@ -0,0 +1 @@
1
+ <svg t="1681228372666" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="10848" width="200" height="200"><path d="M309.9 140.6h402.9c21.1 0 38.2-17.1 38.2-38.2s-17.1-38.2-38.2-38.2H309.9c-21.1 0-38.2 17.1-38.2 38.2s17.1 38.2 38.2 38.2z" fill="#61D0ED" p-id="10849"></path><path d="M776.3 112.1c-4.7 30.5-30.8 54-62.7 54H309.1c-31.8 0-58-23.5-62.7-54-46.2 19.1-78.7 64.5-78.7 117.6v602.7c0 70.3 57 127.3 127.3 127.3h432.7c70.3 0 127.3-57 127.3-127.3V229.7c0-53.1-32.5-98.6-78.7-117.6z m-47.9 572.1h-434c-21.1 0-38.2-17.1-38.2-38.2s17.1-38.2 38.2-38.2h433.9c21.1 0 38.2 17.1 38.2 38.2s-17.1 38.2-38.1 38.2z m0-173h-434c-21.1 0-38.2-17.1-38.2-38.2s17.1-38.2 38.2-38.2h433.9c21.1 0 38.2 17.1 38.2 38.2s-17.1 38.2-38.1 38.2z m0-173h-434c-21.1 0-38.2-17.1-38.2-38.2s17.1-38.2 38.2-38.2h433.9c21.1 0 38.2 17.1 38.2 38.2s-17.1 38.2-38.1 38.2z" fill="#61D0ED" p-id="10850"></path></svg>
package/index.js CHANGED
@@ -5,7 +5,6 @@ import Breadcrumb from "./src/Breadcrumb.vue";
5
5
  import LeftSidebar from "./src/LeftSidebar.vue";
6
6
  import RightSidebar from "./src/RightSidebar.vue";
7
7
  import LeftSideToggle from "./src/LeftSideToggle.vue";
8
- import Bottom from "./src/Bottom.vue";
9
8
 
10
9
  const components = {
11
10
  Header,
@@ -15,7 +14,6 @@ const components = {
15
14
  LeftSidebar,
16
15
  RightSidebar,
17
16
  LeftSideToggle,
18
- Bottom,
19
17
  };
20
18
 
21
19
  const install = function (app) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jx3box/jx3box-vue3-ui",
3
- "version": "0.0.4",
3
+ "version": "0.0.5",
4
4
  "description": "JX3BOX Vue3 UI",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/service/helper.js CHANGED
@@ -4,4 +4,13 @@ function getCollection(id) {
4
4
  return $helper().get(`/api/post/collection/${id}`);
5
5
  }
6
6
 
7
- export { getCollection };
7
+ // 面包屑
8
+ function getBreadcrumb(key) {
9
+ return $helper()
10
+ .get(`/api/breadcrumb/${key}`)
11
+ .then((res) => {
12
+ return res.data.data.breadcrumb.html || "";
13
+ });
14
+ }
15
+
16
+ export { getCollection, getBreadcrumb };
package/src/App.vue CHANGED
@@ -20,14 +20,24 @@
20
20
  </LeftSidebar>
21
21
 
22
22
  <Main :withoutLeft="false" :withoutRight="false">
23
+ <SimpleThxVue
24
+ postType="bbs"
25
+ postTitle="bbs23865的标题"
26
+ type="batchReward"
27
+ :userId="7"
28
+ :adminBoxcoinEnable="true"
29
+ :userBoxcoinEnable="true"
30
+ :postId="57260"
31
+ />
23
32
  <RightSidebar> </RightSidebar>
24
33
  <Footer></Footer>
25
- <Bottom></Bottom>
34
+ <!-- <Bottom></Bottom> -->
26
35
  </Main>
27
36
  </div>
28
37
  </template>
29
38
 
30
39
  <script>
40
+ import SimpleThxVue from "./single/SimpleThx.vue";
31
41
  export default {
32
42
  name: "App",
33
43
  components: {
@@ -39,6 +49,7 @@ export default {
39
49
  // LeftSideToggle,
40
50
  // RightSidebar,
41
51
  // Bottom,
52
+ SimpleThxVue,
42
53
  },
43
54
  };
44
55
  </script>
@@ -0,0 +1,168 @@
1
+ <template>
2
+ <div class="w-boxcoin-admin" v-if="allowBoxcoin">
3
+ <el-tooltip effect="dark" content="品鉴" placement="top-start">
4
+ <div class="w-boxcoin-block">
5
+ <img @click="openBoxcoinPop" class="u-icon" svg-inline src="../../assets/img/widget/like3.svg" />
6
+ </div>
7
+ </el-tooltip>
8
+ <el-dialog
9
+ title="品鉴评分"
10
+ v-model="visible"
11
+ class="w-boxcoin-pop"
12
+ :close-on-click-modal="false"
13
+ append-to-body
14
+ >
15
+ <div class="w-boxcoin-admin-content">
16
+ <div class="u-left">
17
+ <em class="u-label">本月状态</em>
18
+ 已用<b>{{ this.used }}</b> 剩余<b>{{ this.left }}</b> 总计<b>{{ this.total }}</b>
19
+ <el-progress
20
+ :percentage="100 - (this.used * 100) / this.total"
21
+ :stroke-width="15"
22
+ :text-inside="true"
23
+ ></el-progress>
24
+ </div>
25
+ <div class="u-list">
26
+ <em class="u-label">❤️ 品鉴</em>
27
+ <Contributors v-if="authors && authors.length" :authors="authors" @chosen="handleChosen" />
28
+ <div class="u-points">
29
+ <el-radio-group v-model="count">
30
+ <el-radio :label="item" v-for="item in fitPoints" :key="item" border>
31
+ <b>{{ item }}</b
32
+ >盒币
33
+ </el-radio>
34
+ </el-radio-group>
35
+ </div>
36
+ </div>
37
+ <div class="u-msg">
38
+ <em class="u-label">📝 寄语</em>
39
+ <div class="u-input">
40
+ <el-input
41
+ v-model="remark"
42
+ placeholder="请输入寄语(必填)"
43
+ :minlength="2"
44
+ :maxlength="30"
45
+ show-word-limit
46
+ ></el-input>
47
+ <el-button :disabled="fetchingCurrentRelease" @click="insertCurrentRelease"
48
+ >插入当前版本</el-button
49
+ >
50
+ </div>
51
+ </div>
52
+ </div>
53
+ <template #footer>
54
+ <span class="dialog-footer">
55
+ <el-button @click="visible = false">取 消</el-button>
56
+ <el-button type="primary" @click="submit" :disabled="!ready || submitting">确 定</el-button>
57
+ </span>
58
+ </template>
59
+ </el-dialog>
60
+ </div>
61
+ </template>
62
+
63
+ <script>
64
+ import { grantBoxcoin } from "../../service/thx.js";
65
+ import { getBreadcrumb } from "../../service/helper.js";
66
+ import User from "@jx3box/jx3box-common/js/user";
67
+ import Contributors from "./Contributors.vue";
68
+ export default {
69
+ name: "BoxcoinAdmin",
70
+ props: ["postType", "postId", "userId", "own", "total", "points", "max", "min", "authors", "client"],
71
+ components: {
72
+ Contributors,
73
+ },
74
+ data: function () {
75
+ return {
76
+ visible: false,
77
+ count: 0,
78
+
79
+ remark: "辛苦,感谢!",
80
+ left: this.own,
81
+ chosen: "", // 被选中的人
82
+
83
+ submitting: false,
84
+ fetchingCurrentRelease: false,
85
+ };
86
+ },
87
+ computed: {
88
+ used: function () {
89
+ return this.total - this.left;
90
+ },
91
+ ready: function () {
92
+ return this.isNotSelf && this.isEnough && this.count && this.remark;
93
+ },
94
+ isNotSelf: function () {
95
+ return this.userId != User.getInfo().uid;
96
+ },
97
+ isEnough: function () {
98
+ return this.left && this.left >= this.count;
99
+ },
100
+ allowBoxcoin: function () {
101
+ return this.postType && this.postId && (this.userId || (this.authors && this.authors.length));
102
+ },
103
+ hostClient: function () {
104
+ return location.href.includes("origin") ? "origin" : "std";
105
+ },
106
+ fitPoints: function () {
107
+ return this.points.filter((item) => item <= this.left);
108
+ },
109
+ },
110
+ watch: {
111
+ own: function (val) {
112
+ this.left = val;
113
+ },
114
+ },
115
+ methods: {
116
+ openBoxcoinPop: function () {
117
+ this.visible = true;
118
+ },
119
+ // 选择要打赏的对象
120
+ handleChosen(userId) {
121
+ this.chosen = userId;
122
+ },
123
+ submit: function () {
124
+ this.submitting = true;
125
+ grantBoxcoin(this.postType, this.postId, this.chosen || this.userId, this.count, {
126
+ remark: this.remark,
127
+ client: this.client || this.hostClient,
128
+ })
129
+ .then((res) => {
130
+ this.$message({
131
+ message: "操作成功",
132
+ type: "success",
133
+ });
134
+ return res.data.data;
135
+ })
136
+ .then((data) => {
137
+ // 1.扣除额度
138
+ this.left -= this.count;
139
+ // 2.将修改emit出去
140
+ this.$emit("updateRecord", data);
141
+ })
142
+ .finally(() => {
143
+ this.submitting = false;
144
+ this.visible = false;
145
+ });
146
+ },
147
+ insertCurrentRelease: function () {
148
+ this.fetchingCurrentRelease = true;
149
+ getBreadcrumb(`current-release-${this.hostClient}`)
150
+ .then((res) => {
151
+ this.remark += res;
152
+ })
153
+ .catch(() => {
154
+ this.$message({
155
+ message: "获取失败",
156
+ type: "error",
157
+ });
158
+ })
159
+ .finally(() => {
160
+ this.fetchingCurrentRelease = false;
161
+ });
162
+ },
163
+ init: function () {},
164
+ },
165
+ created: function () {},
166
+ mounted: function () {},
167
+ };
168
+ </script>
@@ -0,0 +1,146 @@
1
+ <template>
2
+ <div class="w-boxcoin-records" v-loading="loading">
3
+ <div class="w-boxcoin-records-list" v-if="list && list.length">
4
+ <ul class="u-list">
5
+ <li class="u-item u-head">
6
+ <span class="u-meta u-action">
7
+ <i class="el-icon-trophy"></i>
8
+ </span>
9
+ <span class="u-meta u-user">参与打赏</span>
10
+ <span class="u-meta u-user">收益作者</span>
11
+ <span class="u-meta u-count">盒币</span>
12
+ <span class="u-meta u-remark">寄语</span>
13
+ <time class="u-meta u-time"></time>
14
+ </li>
15
+ <li v-for="(item, i) in list" :key="i" class="u-item u-body">
16
+ <span class="u-meta u-action">
17
+ <template v-if="item.is_user_gift">
18
+ <i title="打赏"><img class svg-inline src="../../assets/img/widget/gift.svg" /></i>
19
+ </template>
20
+ <template v-else>
21
+ <i title="品鉴"><img class svg-inline src="../../assets/img/widget/admin_gift.svg" /></i>
22
+ </template>
23
+ </span>
24
+ <a class="u-meta u-user" :href="authorLink(item.operate_user_id)" target="_blank">
25
+ <img class="u-user-avatar" :src="showAvatar(item.ext_operate_user_info.avatar)" alt />
26
+ <span>{{ item.ext_operate_user_info.display_name }}</span>
27
+ </a>
28
+ <a class="u-meta u-user" :href="authorLink(item.user_id)" target="_blank">
29
+ <img class="u-user-avatar" :src="showAvatar(item.ext_user_info.avatar)" alt />
30
+ <span>{{ item.ext_user_info.display_name }}</span>
31
+ </a>
32
+ <span class="u-meta u-count">
33
+ +
34
+ <b>{{ item.count + item.ext_take_off_count + ~~item.ext2_take_off_count }}</b>
35
+ </span>
36
+ <span class="u-meta u-remark">{{ item.remark }}</span>
37
+ <time class="u-meta u-time">{{ showTime(item.created_at) }}</time>
38
+ <span class="u-client" v-if="isSuperAdmin">{{ item.client }}</span>
39
+ <span class="u-delete" v-if="isSuperAdmin" @click="recovery(item, i)">
40
+ <i class="el-icon-delete"></i>撤销
41
+ </span>
42
+ </li>
43
+ </ul>
44
+ </div>
45
+ <el-pagination
46
+ class="w-boxcoin-records-pages"
47
+ small
48
+ layout="prev, pager, next"
49
+ :hide-on-single-page="true"
50
+ :page-size="per"
51
+ :total="total"
52
+ v-model="page"
53
+ ></el-pagination>
54
+ </div>
55
+ </template>
56
+
57
+ <script>
58
+ import { getPostBoxcoinRecords, recoveryBoxcoin } from "../../service/thx";
59
+ import User from "@jx3box/jx3box-common/js/user";
60
+ import { showAvatar, authorLink } from "@jx3box/jx3box-common/js/utils";
61
+ import { showTime } from "@jx3box/jx3box-common/js/moment";
62
+ export default {
63
+ name: "BoxcoinRecords",
64
+ props: ["postType", "postId", "cacheRecord", "postClient", "mode"],
65
+ components: {},
66
+ data: function () {
67
+ return {
68
+ list: [],
69
+ per: 12,
70
+ page: 1,
71
+ total: 1,
72
+ loading: false,
73
+ boxcoin: 0,
74
+ isSuperAdmin: User.isSuperAdmin(),
75
+ };
76
+ },
77
+ computed: {
78
+ post_keys: function () {
79
+ return [this.postType, this.postId];
80
+ },
81
+ params: function () {
82
+ return {
83
+ pageSize: this.per,
84
+ pageIndex: this.page,
85
+ //client : this.postClient,
86
+ };
87
+ },
88
+ },
89
+ watch: {
90
+ post_keys: {
91
+ immediate: true,
92
+ deep: true,
93
+ handler: function () {
94
+ this.postType && this.postId && this.loadData();
95
+ },
96
+ },
97
+ params: {
98
+ deep: true,
99
+ handler: function () {
100
+ this.loadData();
101
+ },
102
+ },
103
+ cacheRecord: {
104
+ deep: true,
105
+ handler: function (data) {
106
+ if (data) {
107
+ this.list.push(data);
108
+ // 清空父组件的cache
109
+ this.$parent.cacheRecord = null;
110
+ }
111
+ },
112
+ },
113
+ },
114
+ methods: {
115
+ loadData: function () {
116
+ getPostBoxcoinRecords(this.postType, this.postId, this.params).then((res) => {
117
+ this.list = res.data.data.list;
118
+ this.total = res.data.data.page.total;
119
+ this.boxcoin = res.data.data.fromManager + res.data.data.fromUser;
120
+ this.$parent.boxcoin = this.boxcoin;
121
+ });
122
+ },
123
+ recovery: function (item, i) {
124
+ this.$alert("是否确定撤销该评分?", "确认", {
125
+ confirmButtonText: "确定",
126
+ callback: (action) => {
127
+ if (action == "confirm") {
128
+ recoveryBoxcoin(item.id).then(() => {
129
+ this.$message({
130
+ message: "撤销成功",
131
+ type: "success",
132
+ });
133
+ this.list.splice(i, 1);
134
+ });
135
+ }
136
+ },
137
+ });
138
+ },
139
+ authorLink,
140
+ showTime,
141
+ showAvatar: function (val) {
142
+ return showAvatar(val, 72);
143
+ },
144
+ },
145
+ };
146
+ </script>
@@ -0,0 +1,160 @@
1
+ <template>
2
+ <div class="w-boxcoin-user" v-if="allowBoxcoin">
3
+ <el-tooltip effect="dark" content="投币" placement="top-start">
4
+ <div class="w-boxcoin-block" @click="openBoxcoinPop">
5
+ <img class="u-icon" svg-inline src="../../assets/img/widget/heart1.svg" />
6
+ <span class="u-count" v-if="boxcoin">{{boxcoin}}</span>
7
+ </div>
8
+ </el-tooltip>
9
+ <el-dialog title="投币打赏" v-model="visible" class="w-boxcoin-pop" append-to-body :close-on-click-modal="false">
10
+ <div class="w-boxcoin-user-content">
11
+ <div class="u-left">
12
+ <em class="u-label">当前拥有盒币</em>
13
+ <b>{{left}}</b>
14
+ <a class="u-charge" :href="chargeLink" target="_blank">[充值]</a>
15
+ </div>
16
+ <div class="u-list">
17
+ <em class="u-label">❤️ 打赏</em>
18
+ <Contributors v-if="authors && authors.length" :authors="authors" @chosen="handleChosen" />
19
+ <div class="u-points">
20
+ <el-radio-group v-model="count">
21
+ <el-radio :label="item" v-for="item in fitPoints" :key="item" border>
22
+ <b>{{item}}</b>盒币
23
+ </el-radio>
24
+ </el-radio-group>
25
+ </div>
26
+ </div>
27
+ <div class="u-msg">
28
+ <em class="u-label">📝 寄语</em>
29
+ <div class="u-input">
30
+ <el-input
31
+ v-model="remark"
32
+ placeholder="请输入寄语(必填)"
33
+ :minlength="2"
34
+ :maxlength="30"
35
+ show-word-limit
36
+ ></el-input>
37
+ </div>
38
+ </div>
39
+ </div>
40
+ <template #footer>
41
+ <span class="dialog-footer">
42
+ <el-button @click="visible = false">取 消</el-button>
43
+ <el-button type="primary" @click="submit" :disabled="!ready">确 定</el-button>
44
+ </span>
45
+ </template>
46
+ </el-dialog>
47
+ </div>
48
+ </template>
49
+
50
+ <script>
51
+ import { rewardBoxcoin } from "../../service/thx.js";
52
+ import User from "@jx3box/jx3box-common/js/user";
53
+ import Contributors from './Contributors.vue';
54
+ export default {
55
+ name: "BoxcoinUser",
56
+ props: ["boxcoin", "postType", "postId", "userId", "own", "points", "authors",'client'],
57
+ components: {
58
+ Contributors
59
+ },
60
+ data: function () {
61
+ return {
62
+ visible: false,
63
+
64
+ count: 0,
65
+ remark: "辛苦了,谢谢大大!",
66
+
67
+ left : this.own,
68
+
69
+ chargeLink: "/vip/boxcoin?redirect=" + location.href,
70
+
71
+ chosen: '', // 被选中的人
72
+ };
73
+ },
74
+ computed: {
75
+ ready: function () {
76
+ return this.isNotSelf && this.isEnough && this.count && this.remark;
77
+ },
78
+ isNotSelf: function () {
79
+ return this.userId != User.getInfo().uid;
80
+ },
81
+ isEnough: function () {
82
+ return this.left && this.left >= this.count;
83
+ },
84
+ allowBoxcoin : function (){
85
+ return this.postType && this.postId && (this.userId || (this.authors && this.authors.length))
86
+ },
87
+ hostClient : function (){
88
+ return location.href.includes('origin') ? 'origin' : 'std'
89
+ },
90
+ fitPoints : function (){
91
+ return this.points //.filter(item => item <= this.left)
92
+ }
93
+ },
94
+ watch: {
95
+ own : function (val){
96
+ this.left = val
97
+ }
98
+ },
99
+ methods: {
100
+ openBoxcoinPop: function () {
101
+ if (User.isLogin()) {
102
+ this.visible = true;
103
+ } else {
104
+ User.toLogin();
105
+ }
106
+ },
107
+ // 选择要打赏的对象
108
+ handleChosen(userId) {
109
+ this.chosen = userId
110
+ },
111
+ submit: function () {
112
+ rewardBoxcoin(this.postType, this.postId, this.chosen || this.userId, this.count, {
113
+ remark: this.remark,
114
+ client : this.client || this.hostClient
115
+ })
116
+ .then((res) => {
117
+ this.$message({
118
+ message: "操作成功",
119
+ type: "success",
120
+ });
121
+ return res.data.data
122
+ })
123
+ .then((data) => {
124
+ // 1.扣除额度
125
+ this.left -= this.count;
126
+ // 2. 将新增emit出去
127
+ this.$emit('updateRecord', data);
128
+ })
129
+ .finally(() => {
130
+ this.visible = false;
131
+ });
132
+
133
+ },
134
+ init: function () {},
135
+ },
136
+ created: function () {},
137
+ mounted: function () {},
138
+ };
139
+ </script>
140
+
141
+ <style scoped lang="less">
142
+ .w-boxcoin-user {
143
+ .dbi;
144
+ .x(left);
145
+ .u-icon {
146
+ .size(26px);
147
+ .y;
148
+ .pr;
149
+ top: -2px;
150
+ }
151
+ .u-count {
152
+ color: #888;
153
+ .ml(10px);
154
+ }
155
+ .u-charge {
156
+ .underline(@color-link);
157
+ .ml(10px);
158
+ }
159
+ }
160
+ </style>
@@ -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: "ContributorsComp",
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>
@@ -0,0 +1,84 @@
1
+ <template>
2
+ <div class="w-fav2" :class="{ disabled: favorite }" @click="doFav">
3
+ <el-tooltip effect="dark" :content="favContent" placement="top-start">
4
+ <div>
5
+ <img v-if="favorite" class="u-icon" svg-inline src="../../assets/img/widget/unstar.svg" />
6
+ <img v-else class="u-icon" svg-inline src="../../assets/img/widget/star.svg" />
7
+ <span class="u-count" v-if="!hiddenNum && total">{{ 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 { hasFav, addFav, delFav } from "../../service/fav";
16
+ export default {
17
+ name: "FavoriteComp",
18
+ props: ["postType", "postId", "postTitle", "hiddenNum"],
19
+ data: function () {
20
+ return {
21
+ login: User.isLogin(),
22
+ favorite: false,
23
+ total: 0,
24
+ };
25
+ },
26
+ computed: {
27
+ favContent() {
28
+ return this.favorite ? "已收藏" : "收藏";
29
+ },
30
+ },
31
+ methods: {
32
+ doFav: function () {
33
+ if (this.login) {
34
+ this.favorite ? this.delFav() : this.addFav();
35
+ } else {
36
+ User.toLogin();
37
+ }
38
+ },
39
+ hasFav: function () {
40
+ hasFav(this.postType, this.postId).then((res) => {
41
+ this.favorite = res.id || false;
42
+ this.total = res.totalFavorites || 0;
43
+ });
44
+ },
45
+ addFav: function () {
46
+ addFav(this.postType, this.postId, this.postTitle).then((res) => {
47
+ this.favorite = res.id;
48
+ this.total++;
49
+ });
50
+ },
51
+ delFav: function () {
52
+ delFav(this.favorite).then(() => {
53
+ this.favorite = false;
54
+ this.total && this.total--;
55
+ });
56
+ },
57
+ },
58
+ watch: {
59
+ postId: {
60
+ immediate: true,
61
+ handler() {
62
+ if (this.postType && this.postId) this.hasFav();
63
+ },
64
+ },
65
+ },
66
+ };
67
+ </script>
68
+
69
+ <style lang="less" scoped>
70
+ .w-fav2 {
71
+ .pointer;
72
+ .dbi;
73
+ .u-icon {
74
+ .size(32px);
75
+ .y;
76
+ .pr;
77
+ top: -1px;
78
+ }
79
+ .u-count {
80
+ color: #888;
81
+ .ml(10px);
82
+ }
83
+ }
84
+ </style>
@@ -0,0 +1,57 @@
1
+ <template>
2
+ <div class="w-like2" :class="{ disabled: !status }" @click="addLike" v-if="ready">
3
+ <el-tooltip effect="dark" content="点赞" placement="top-start">
4
+ <div>
5
+ <img class="u-icon" svg-inline src="../../assets/img/widget/like2.svg" />
6
+ <span class="u-count" v-if="count">{{ count }}</span>
7
+ </div>
8
+ </el-tooltip>
9
+ </div>
10
+ </template>
11
+
12
+ <script>
13
+ import { postStat, getStat } from "@jx3box/jx3box-common/js/stat";
14
+ export default {
15
+ name: "LikeComp",
16
+ props: ["postType", "postId"],
17
+ data: function () {
18
+ return {
19
+ status: true,
20
+ count: 0,
21
+ };
22
+ },
23
+ computed: {
24
+ ready() {
25
+ return this.postType && this.postId;
26
+ },
27
+ },
28
+ methods: {
29
+ init: function () {
30
+ this.loadStat();
31
+ },
32
+ loadStat: function () {
33
+ getStat(this.postType, this.postId).then((res) => {
34
+ this.count = res.data.likes || 0;
35
+ });
36
+ },
37
+ // 点赞
38
+ addLike: function () {
39
+ if (!this.ready) return;
40
+ this.count++;
41
+ if (this.status) {
42
+ postStat(this.postType, this.postId, "likes");
43
+ }
44
+ this.status = false;
45
+ },
46
+ },
47
+ watch: {
48
+ postId: function () {
49
+ this.init();
50
+ },
51
+ },
52
+ };
53
+ </script>
54
+
55
+ <style lang="less">
56
+ @import "../../assets/css/like2.less";
57
+ </style>
@@ -0,0 +1,197 @@
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
+ <el-tooltip effect="dark" content="打赏记录" placement="top-start">
33
+ <!-- <div class="w-boxcoin-block"> -->
34
+ <img
35
+ src="../../assets/img/widget/records.svg"
36
+ svg-inline
37
+ class="u-record-icon"
38
+ alt=""
39
+ @click="onRecord"
40
+ />
41
+ <!-- </div> -->
42
+ </el-tooltip>
43
+ </div>
44
+
45
+ <el-drawer v-model="showDrawer" title="打赏记录">
46
+ <BoxcoinRecords
47
+ :postId="postId"
48
+ :postType="postType"
49
+ :postClient="client"
50
+ :cacheRecord="cacheRecord"
51
+ :mode="mode"
52
+ />
53
+ </el-drawer>
54
+ </div>
55
+ </template>
56
+
57
+ <script>
58
+ import Like from "../interact/Like.vue";
59
+ import Fav from "../interact/Fav.vue";
60
+ import BoxcoinAdmin from "../interact/BoxcoinAdmin.vue";
61
+ import BoxcoinUser from "../interact/BoxcoinUser.vue";
62
+ import BoxcoinRecords from "@/interact/BoxcoinRecords.vue";
63
+ import User from "@jx3box/jx3box-common/js/user";
64
+ import { getBoxcoinStatus, getPostBoxcoinConfig } from "../../service/thx";
65
+
66
+ export default {
67
+ name: "SimpleThx",
68
+ components: {
69
+ Like,
70
+ Fav,
71
+ BoxcoinAdmin,
72
+ BoxcoinUser,
73
+ BoxcoinRecords,
74
+ },
75
+ props: {
76
+ type: {
77
+ type: String,
78
+ default: "normal",
79
+ },
80
+ postId: {
81
+ type: Number,
82
+ default: 0,
83
+ },
84
+ postType: {
85
+ type: String,
86
+ default: "",
87
+ },
88
+ postTitle: {
89
+ type: String,
90
+ default: "",
91
+ },
92
+ userId: {
93
+ type: Number,
94
+ default: 0,
95
+ },
96
+ authors: {
97
+ type: Array,
98
+ default: () => [],
99
+ },
100
+ mode: {
101
+ type: String,
102
+ default: "normal",
103
+ },
104
+ client: {
105
+ type: String,
106
+ default: "std",
107
+ },
108
+ allowGift: {
109
+ type: Number,
110
+ default: 1,
111
+ },
112
+ adminBoxcoinEnable: {
113
+ type: Boolean,
114
+ default: false,
115
+ },
116
+ userBoxcoinEnable: {
117
+ type: Boolean,
118
+ default: false,
119
+ },
120
+ },
121
+ data: function () {
122
+ return {
123
+ boxcoin: 0,
124
+ hasRight: User.getInfo().group >= 32,
125
+ user: User.getInfo(),
126
+
127
+ admin_max: 0,
128
+ admin_min: 0,
129
+ admin_left: 0,
130
+ admin_total: 0,
131
+ admin_points: [100],
132
+
133
+ user_left: 0,
134
+ user_points: [100],
135
+
136
+ cacheRecord: null,
137
+ boxcoin_enable: 0,
138
+
139
+ showDrawer: false,
140
+ };
141
+ },
142
+ computed: {
143
+ post_keys: function () {
144
+ return [this.postId, this.postType];
145
+ },
146
+ },
147
+ watch: {
148
+ post_keys: {
149
+ immediate: true,
150
+ deep: true,
151
+ handler: function () {
152
+ this.postType && this.postId && this.loadBoxcoinConfig();
153
+ },
154
+ },
155
+ },
156
+ methods: {
157
+ loadBoxcoinConfig: function () {
158
+ User.isLogin() &&
159
+ getPostBoxcoinConfig(this.postType).then((res) => {
160
+ this.admin_max = res.data.data.limit.admin_max || 0;
161
+ this.admin_min = res.data.data.limit.admin_min || 0;
162
+ this.admin_points = res.data.data.limit.admin_points || [10, 1000];
163
+ this.admin_left = res.data.data.asManagerBoxCoinRemain || 0;
164
+ this.admin_total = res.data.data.asManagerBoxCoinTotal || 0;
165
+
166
+ this.user_points = res.data.data.limit.user_points || [10, 1000];
167
+ // 根据多端展示剩余币
168
+ // 作品是n端,接受n端币+all币
169
+ if (this.client == "origin") {
170
+ this.user_left = res.data.data.asUserBoxCoinRemainOrigin + res.data.data.asUserBoxCoinRemainAll;
171
+ } else if (this.client == "std") {
172
+ this.user_left = res.data.data.asUserBoxCoinRemainStd + res.data.data.asUserBoxCoinRemainAll;
173
+ } else {
174
+ this.user_left =
175
+ res.data.data.asUserBoxCoinRemainAll +
176
+ res.data.data.asUserBoxCoinRemainStd +
177
+ res.data.data.asUserBoxCoinRemainOrigin;
178
+ }
179
+ });
180
+ getBoxcoinStatus().then((res) => {
181
+ this.boxcoin_enable = !!~~res.data.data.val;
182
+ });
183
+ },
184
+ // 用户打赏
185
+ updateRecord: function (data) {
186
+ this.cacheRecord = data;
187
+ },
188
+ onRecord: function () {
189
+ this.showDrawer = true;
190
+ },
191
+ },
192
+ };
193
+ </script>
194
+
195
+ <style lang="less">
196
+ @import "../../assets/css/thx.less";
197
+ </style>