@jx3box/jx3box-vue3-ui 0.2.0 → 0.2.1
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.
|
Binary file
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -2,15 +2,21 @@
|
|
|
2
2
|
<div class="w-boxcoin-user" v-if="allowBoxcoin">
|
|
3
3
|
<el-tooltip effect="dark" content="投币" placement="top-start">
|
|
4
4
|
<div class="w-boxcoin-block" @click="openBoxcoinPop">
|
|
5
|
-
<img class="u-icon" svg-inline src="
|
|
6
|
-
<span class="u-count" v-if="boxcoin">{{boxcoin}}</span>
|
|
5
|
+
<img class="u-icon" svg-inline :src="likeImg" />
|
|
6
|
+
<span class="u-count" v-if="boxcoin">{{ boxcoin }}</span>
|
|
7
7
|
</div>
|
|
8
8
|
</el-tooltip>
|
|
9
|
-
<el-dialog
|
|
9
|
+
<el-dialog
|
|
10
|
+
title="投币打赏"
|
|
11
|
+
v-model="visible"
|
|
12
|
+
class="w-boxcoin-pop"
|
|
13
|
+
append-to-body
|
|
14
|
+
:close-on-click-modal="false"
|
|
15
|
+
>
|
|
10
16
|
<div class="w-boxcoin-user-content">
|
|
11
17
|
<div class="u-left">
|
|
12
18
|
<em class="u-label">当前拥有盒币</em>
|
|
13
|
-
<b>{{left}}</b>
|
|
19
|
+
<b>{{ left }}</b>
|
|
14
20
|
<a class="u-charge" :href="chargeLink" target="_blank">[充值]</a>
|
|
15
21
|
</div>
|
|
16
22
|
<div class="u-list">
|
|
@@ -19,10 +25,15 @@
|
|
|
19
25
|
<div class="u-points">
|
|
20
26
|
<el-radio-group v-model="count">
|
|
21
27
|
<el-radio :label="item" v-for="item in fitPoints" :key="item" border>
|
|
22
|
-
<b>{{item}}</b
|
|
28
|
+
<b>{{ item }}</b
|
|
29
|
+
>盒币
|
|
23
30
|
</el-radio>
|
|
24
31
|
<el-radio label="custom" border>自定义</el-radio>
|
|
25
|
-
<el-input
|
|
32
|
+
<el-input
|
|
33
|
+
v-model="amount"
|
|
34
|
+
v-show="count === 'custom'"
|
|
35
|
+
placeholder="输入自定义数量"
|
|
36
|
+
></el-input>
|
|
26
37
|
</el-radio-group>
|
|
27
38
|
</div>
|
|
28
39
|
</div>
|
|
@@ -52,12 +63,13 @@
|
|
|
52
63
|
<script>
|
|
53
64
|
import { rewardBoxcoin } from "../../service/thx.js";
|
|
54
65
|
import User from "@jx3box/jx3box-common/js/user";
|
|
55
|
-
import Contributors from
|
|
66
|
+
import Contributors from "./Contributors.vue";
|
|
67
|
+
import { debounce } from "lodash";
|
|
56
68
|
export default {
|
|
57
69
|
name: "BoxcoinUser",
|
|
58
|
-
props: ["boxcoin", "postType", "postId", "userId", "own", "points", "authors",
|
|
70
|
+
props: ["boxcoin", "postType", "postId", "userId", "own", "points", "authors", "client"],
|
|
59
71
|
components: {
|
|
60
|
-
Contributors
|
|
72
|
+
Contributors,
|
|
61
73
|
},
|
|
62
74
|
data: function () {
|
|
63
75
|
return {
|
|
@@ -67,75 +79,81 @@ export default {
|
|
|
67
79
|
remark: "辛苦了,谢谢大大!",
|
|
68
80
|
amount: "",
|
|
69
81
|
|
|
70
|
-
left
|
|
82
|
+
left: this.own,
|
|
71
83
|
|
|
72
84
|
chargeLink: "/vip/boxcoin?redirect=" + location.href,
|
|
73
85
|
|
|
74
|
-
chosen:
|
|
86
|
+
chosen: "", // 被选中的人
|
|
87
|
+
|
|
88
|
+
likeImg: require("../../assets/img/widget/like4.png"),
|
|
75
89
|
};
|
|
76
90
|
},
|
|
77
91
|
computed: {
|
|
78
92
|
ready: function () {
|
|
79
|
-
const count = this.count ===
|
|
93
|
+
const count = this.count === "custom" ? this.amount : this.count;
|
|
80
94
|
return this.isNotSelf && this.isEnough && count && this.remark;
|
|
81
95
|
},
|
|
82
96
|
isNotSelf: function () {
|
|
83
97
|
return this.userId != User.getInfo().uid;
|
|
84
98
|
},
|
|
85
99
|
isEnough: function () {
|
|
86
|
-
const count = this.count ===
|
|
100
|
+
const count = this.count === "custom" ? this.amount : this.count;
|
|
87
101
|
return this.left && this.left >= count;
|
|
88
102
|
},
|
|
89
|
-
allowBoxcoin
|
|
90
|
-
return this.postType && this.postId && (this.userId || (this.authors && this.authors.length))
|
|
103
|
+
allowBoxcoin: function () {
|
|
104
|
+
return this.postType && this.postId && (this.userId || (this.authors && this.authors.length));
|
|
105
|
+
},
|
|
106
|
+
hostClient: function () {
|
|
107
|
+
return location.href.includes("origin") ? "origin" : "std";
|
|
91
108
|
},
|
|
92
|
-
|
|
93
|
-
return
|
|
109
|
+
fitPoints: function () {
|
|
110
|
+
return this.points; //.filter(item => item <= this.left)
|
|
94
111
|
},
|
|
95
|
-
fitPoints : function (){
|
|
96
|
-
return this.points //.filter(item => item <= this.left)
|
|
97
|
-
}
|
|
98
112
|
},
|
|
99
113
|
watch: {
|
|
100
|
-
own
|
|
101
|
-
this.left = val
|
|
102
|
-
}
|
|
114
|
+
own: function (val) {
|
|
115
|
+
this.left = val;
|
|
116
|
+
},
|
|
103
117
|
},
|
|
104
118
|
methods: {
|
|
105
119
|
openBoxcoinPop: function () {
|
|
106
120
|
if (User.isLogin()) {
|
|
121
|
+
this.likeImg = require("../../assets/img/widget/like4ing.gif");
|
|
107
122
|
this.visible = true;
|
|
123
|
+
|
|
124
|
+
debounce(() => {
|
|
125
|
+
this.likeImg = require("../../assets/img/widget/like4.png");
|
|
126
|
+
}, 2800)();
|
|
108
127
|
} else {
|
|
109
128
|
User.toLogin();
|
|
110
129
|
}
|
|
111
130
|
},
|
|
112
131
|
// 选择要打赏的对象
|
|
113
132
|
handleChosen(userId) {
|
|
114
|
-
this.chosen = userId
|
|
133
|
+
this.chosen = userId;
|
|
115
134
|
},
|
|
116
135
|
submit: function () {
|
|
117
|
-
const count = this.count ===
|
|
136
|
+
const count = this.count === "custom" ? this.amount : this.count;
|
|
118
137
|
rewardBoxcoin(this.postType, this.postId, this.chosen || this.userId, count, {
|
|
119
138
|
remark: this.remark,
|
|
120
|
-
client
|
|
139
|
+
client: this.client || this.hostClient,
|
|
121
140
|
})
|
|
122
141
|
.then((res) => {
|
|
123
142
|
this.$message({
|
|
124
143
|
message: "操作成功",
|
|
125
144
|
type: "success",
|
|
126
145
|
});
|
|
127
|
-
return res.data.data
|
|
146
|
+
return res.data.data;
|
|
128
147
|
})
|
|
129
148
|
.then((data) => {
|
|
130
149
|
// 1.扣除额度
|
|
131
150
|
this.left -= this.count;
|
|
132
151
|
// 2. 将新增emit出去
|
|
133
|
-
this.$emit(
|
|
152
|
+
this.$emit("updateRecord", data);
|
|
134
153
|
})
|
|
135
154
|
.finally(() => {
|
|
136
155
|
this.visible = false;
|
|
137
156
|
});
|
|
138
|
-
|
|
139
157
|
},
|
|
140
158
|
init: function () {},
|
|
141
159
|
},
|