@jx3box/jx3box-common-ui 8.6.0 → 8.6.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-common-ui",
3
- "version": "8.6.0",
3
+ "version": "8.6.2",
4
4
  "description": "JX3BOX UI",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/src/App.vue CHANGED
@@ -32,6 +32,7 @@
32
32
  <!-- <Collection :id="59" :defaultVisible="true" /> -->
33
33
  <UserPop title="添加用户" v-model="visible" @confirm="addUser" />
34
34
  <el-button @click="visible = true">用户POP</el-button>
35
+ <el-button @click="homeworkVisible=true">作业组件</el-button>
35
36
  <!-- :postId="23865" -->
36
37
  <!-- <Thx
37
38
  postType="bps"
@@ -51,6 +52,8 @@
51
52
  <QRcode />
52
53
  <Sharing />
53
54
 
55
+ <homework v-model="homeworkVisible" post-type="comment" :post-id="19382" :userId="8719" client="std"></homework>
56
+
54
57
  <PostGuide :post="post" />
55
58
 
56
59
  <hr />
@@ -198,6 +201,7 @@ import axios from "axios";
198
201
  import { __server } from "@jx3box/jx3box-common/data/jx3box.json";
199
202
  import { wiki } from "@jx3box/jx3box-common/js/wiki";
200
203
  import post_topics from "@jx3box/jx3box-common/data/post_topics.json";
204
+ import Homework from './interact/Homework.vue';
201
205
 
202
206
  export default {
203
207
  name: "App",
@@ -232,6 +236,7 @@ export default {
232
236
  Down,
233
237
  Fav,
234
238
  Feed,
239
+ Homework,
235
240
 
236
241
  Print,
237
242
  Sharing,
@@ -273,7 +278,9 @@ export default {
273
278
  text: `<Text>text="使用:<BUFF 3222 1 desc>,持续<BUFF 3222 1 time>。\\\n" font=105 </text><Text>text="红豆沙做馅儿,精致细腻的广式月饼。" font=100 </text><Text>text="使用:能在唐门套装供应商处换取如下装备。\\\n" font=105 </text><Text>text="[燕云·重泉靴]" name="iteminfolink" eventid=513 script="this.nVersion=0 this.dwTabType=7 this.dwIndex=35244 this.OnItemLButtonDown=function() OnItemLinkDown(this) end" font=100 r=255 g=40 b=255 </text><Text>text="," font=105 </text><Text>text="[燕云·铭松靴]" name="iteminfolink" eventid=513 script="this.nVersion=0 this.dwTabType=7 this.dwIndex=35245 this.OnItemLButtonDown=function() OnItemLinkDown(this) end" font=100 r=255 g=40 b=255 </text><Text>text="。" font=100 </text>`,
274
279
 
275
280
  post_topics: post_topics['pve'],
276
- tag2: ''
281
+ tag2: '',
282
+
283
+ homeworkVisible: false,
277
284
  };
278
285
  },
279
286
  created: function () {
@@ -227,6 +227,11 @@ export default {
227
227
  });
228
228
  },
229
229
  handleCheck() {
230
+ const id = this.post.id;
231
+ if (!id) {
232
+ this.$message.error("ID不存在!");
233
+ return;
234
+ }
230
235
  this.$confirm(`此操作将该数据转为 待审核 状态, 是否继续?`, "提示", {
231
236
  confirmButtonText: "确定",
232
237
  cancelButtonText: "取消",
@@ -237,7 +242,8 @@ export default {
237
242
  type: "success",
238
243
  message: "操作成功!",
239
244
  });
240
- this.load();
245
+ this.$emit("update:modelValue", false);
246
+ window.location.href = "/community";
241
247
  });
242
248
  });
243
249
  },
@@ -0,0 +1,254 @@
1
+ <template>
2
+ <div class="w-boxcoin-admin">
3
+ <el-dialog title="批改作业" :visible="modelValue" custom-class="w-boxcoin-pop" :close-on-click-modal="false" append-to-body @close="onClose">
4
+ <div class="w-boxcoin-admin-content">
5
+ <div class="u-left" v-if="type=='grant'">
6
+ <em class="u-label">本月状态</em>
7
+ 已用<b>{{this.used}}</b> 剩余<b>{{this.left}}</b> 总计<b>{{this.total}}</b>
8
+ <el-progress :percentage="this.total ? 100 - (this.used * 100 / this.total) : 0" :stroke-width="15" :text-inside="true"></el-progress>
9
+ </div>
10
+ <div class="u-left" v-else>
11
+ <em class="u-label">当前拥有盒币</em>
12
+ <b>{{left}}</b>
13
+ <!-- <a class="u-charge" :href="chargeLink" target="_blank">[充值]</a> -->
14
+ </div>
15
+ <el-radio-group class="u-homework-type" v-model="type" size="small" v-if="isSuperAdmin">
16
+ <el-radio-button label="reward">打赏</el-radio-button>
17
+ <el-radio-button label="grant">品鉴</el-radio-button>
18
+ </el-radio-group>
19
+ <div class="u-list">
20
+ <em class="u-label">❤️ {{ type == 'reward' ? '打赏' : '品鉴' }}</em>
21
+ <div class="u-points">
22
+ <el-radio-group v-model="count">
23
+ <el-radio :label="item" v-for="item in fitPoints" :key="item" border>
24
+ <b>{{item}}</b>盒币
25
+ </el-radio>
26
+ <el-radio label="custom" border>自定义</el-radio>
27
+ <el-input v-model="amount" v-show="count === 'custom'" placeholder="输入自定义数量"></el-input>
28
+ </el-radio-group>
29
+ </div>
30
+ </div>
31
+ <div class="u-msg">
32
+ <em class="u-label">📝 寄语</em>
33
+ <div class="u-input">
34
+ <el-input
35
+ v-model="remark"
36
+ placeholder="请输入寄语(必填)"
37
+ :minlength="2"
38
+ :maxlength="30"
39
+ show-word-limit
40
+ ></el-input>
41
+ <el-button :disabled="fetchingCurrentRelease" @click="insertCurrentRelease">插入当前版本</el-button>
42
+ </div>
43
+ </div>
44
+ </div>
45
+ <span slot="footer" class="dialog-footer">
46
+ <el-button @click="visible = false">取 消</el-button>
47
+ <el-button type="primary" @click="submit" :disabled="!ready || submitting">确 定</el-button>
48
+ </span>
49
+ </el-dialog>
50
+ </div>
51
+ </template>
52
+
53
+ <script>
54
+ import { grantBoxcoin, getPostBoxcoinConfig,getBoxcoinStatus,rewardBoxcoin } from "../../service/thx.js";
55
+ import User from "@jx3box/jx3box-common/js/user";
56
+ import { getBreadcrumb } from "@jx3box/jx3box-common/js/api_misc";
57
+ export default {
58
+ name: "Homework",
59
+ props: ["postType", "postId", "userId", "client", "modelValue"],
60
+ model: {
61
+ prop: "modelValue",
62
+ event: "update:modelValue"
63
+ },
64
+ data: function () {
65
+ return {
66
+ count: 0,
67
+
68
+ remark: "不错,加油!",
69
+ chosen: '', // 被选中的人
70
+ amount: "",
71
+
72
+ submitting: false,
73
+ fetchingCurrentRelease: false,
74
+
75
+ // 打赏or品鉴
76
+ type: "reward",
77
+
78
+ // config
79
+ admin_max: 0,
80
+ admin_min: 0,
81
+ admin_left: 0,
82
+ admin_total: 0,
83
+ admin_points: [100],
84
+
85
+ user_left: 0,
86
+ user_points: [100],
87
+ boxcoin_enable: false,
88
+ };
89
+ },
90
+ computed: {
91
+ left() {
92
+ return this.type === "reward" ? this.user_left : this.admin_left;
93
+ },
94
+ isSuperAdmin() {
95
+ return User.isSuperAdmin();
96
+ },
97
+ total: function () {
98
+ return this.admin_total;
99
+ },
100
+ used: function () {
101
+ return this.total - this.left;
102
+ },
103
+ ready: function () {
104
+ const count = this.count === "custom" ? this.amount : this.count;
105
+ // 不能给自己打赏,打赏目标不能是自己
106
+ // 打赏数量不能超过剩余数量
107
+ // 打赏数量不能为0
108
+ // 打赏寄语不能为空
109
+ return !!(
110
+ !this.isSelf &&
111
+ !this.targetIsSelf &&
112
+ this.isEnough &&
113
+ count &&
114
+ this.remark
115
+ );
116
+ },
117
+ isNotSelf: function () {
118
+ return this.userId != User.getInfo().uid;
119
+ },
120
+ targetIsSelf: function () {
121
+ return this.chosen == User.getInfo().uid;
122
+ },
123
+ isEnough: function () {
124
+ const count = this.count === "custom" ? this.amount : this.count;
125
+ return this.left && this.left >= count;
126
+ },
127
+ allowBoxcoin : function (){
128
+ return this.postType && this.postId && (this.userId || (this.authors && this.authors.length))
129
+ },
130
+ hostClient : function (){
131
+ return location.href.includes('origin') ? 'origin' : 'std'
132
+ },
133
+ points : function (){
134
+ return this.type === 'reward' ? this.user_points : this.admin_points
135
+ },
136
+ fitPoints : function (){
137
+ const points = this.points.filter(item => item <= this.left)
138
+ if (this.isSignAuthor) {
139
+ // 最大值为1000
140
+ return points.filter(item => item <= 1000)
141
+ }
142
+ return points
143
+ },
144
+ isSignAuthor : function (){
145
+ return User.getInfo().group == 32;
146
+ },
147
+ finalClient: function() {
148
+ if (this.client == 'wujie') {
149
+ return "std"
150
+ }
151
+ return this.client
152
+ }
153
+ },
154
+ watch: {
155
+ own : function (val){
156
+ this.left = val
157
+ },
158
+ modelValue: function (val) {
159
+ if (val) {
160
+ this.loadBoxcoinConfig();
161
+ }
162
+ }
163
+ },
164
+ methods: {
165
+ openBoxcoinPop: function () {
166
+ this.visible = true;
167
+ },
168
+ // 选择要打赏的对象
169
+ handleChosen(userId) {
170
+ this.chosen = userId
171
+ },
172
+ submit: function () {
173
+ this.submitting = true;
174
+ const count = this.count === "custom" ? this.amount : this.count;
175
+ let client = this.client || this.hostClient;
176
+ if (!['std', 'origin', 'all'].includes(client)) {
177
+ client = 'std'
178
+ }
179
+ const fn = this.type === 'reward' ? rewardBoxcoin : grantBoxcoin;
180
+ fn(this.postType, this.postId, this.userId, count, {
181
+ remark: this.remark,
182
+ client : client
183
+ })
184
+ .then((res) => {
185
+ this.$message({
186
+ message: "操作成功",
187
+ type: "success",
188
+ });
189
+ return res.data.data
190
+ })
191
+ .then((data) => {
192
+ // 1.扣除额度
193
+ this.left -= this.count;
194
+ // 2.将修改emit出去
195
+ this.$emit('updateRecord', data);
196
+ })
197
+ .finally(() => {
198
+ this.submitting = false;
199
+ this.visible = false;
200
+ });
201
+ },
202
+ insertCurrentRelease: function() {
203
+ this.fetchingCurrentRelease = true;
204
+ getBreadcrumb(`current-release-${this.hostClient}`).then(res => {
205
+ this.remark += res;
206
+ }).catch(err => {
207
+ this.$message({
208
+ message: "获取失败",
209
+ type: "error",
210
+ });
211
+ }).finally(() => {
212
+ this.fetchingCurrentRelease = false;
213
+ });
214
+ },
215
+ loadBoxcoinConfig: function () {
216
+ User.isLogin() &&
217
+ getPostBoxcoinConfig(this.postType).then((res) => {
218
+ this.admin_max = res.data.data.limit.admin_max || 0;
219
+ this.admin_min = res.data.data.limit.admin_min || 0;
220
+ this.admin_points = res.data.data.limit.admin_points || [10, 1000];
221
+ this.admin_left = res.data.data.asManagerBoxCoinRemain || 0;
222
+ this.admin_total = res.data.data.asManagerBoxCoinTotal || 0;
223
+
224
+ this.user_points = res.data.data.limit.user_points || [10, 1000];
225
+ // 根据多端展示剩余币
226
+ // 作品是n端,接受n端币+all币
227
+ if (this.finalClient == "origin") {
228
+ this.user_left = res.data.data.asUserBoxCoinRemainOrigin + res.data.data.asUserBoxCoinRemainAll;
229
+ } else if (this.finalClient == "std") {
230
+ this.user_left = res.data.data.asUserBoxCoinRemainStd + res.data.data.asUserBoxCoinRemainAll;
231
+ } else {
232
+ this.user_left =
233
+ res.data.data.asUserBoxCoinRemainAll +
234
+ res.data.data.asUserBoxCoinRemainStd +
235
+ res.data.data.asUserBoxCoinRemainOrigin;
236
+ }
237
+ });
238
+ getBoxcoinStatus().then((res) => {
239
+ this.boxcoin_enable = !!~~res.data?.data?.val;
240
+ });
241
+ },
242
+ onClose() {
243
+ this.$emit("update:modelValue", false);
244
+ },
245
+ },
246
+ };
247
+ </script>
248
+
249
+ <style lang="less">
250
+ @import "../../assets/css/thx.less";
251
+ .u-homework-type {
252
+ margin-top: 10px;
253
+ }
254
+ </style>
@@ -11,7 +11,7 @@
11
11
  <div class="u-left">
12
12
  <em class="u-label">当前拥有盒币</em>
13
13
  <b>{{left}}</b>
14
- <a class="u-charge" :href="chargeLink" target="_blank">[充值]</a>
14
+ <!-- <a class="u-charge" :href="chargeLink" target="_blank">[充值]</a> -->
15
15
  </div>
16
16
  <div class="u-list">
17
17
  <em class="u-label">❤️ 打赏</em>