@jx3box/jx3box-common-ui 8.5.9 → 8.6.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jx3box/jx3box-common-ui",
3
- "version": "8.5.9",
3
+ "version": "8.6.1",
4
4
  "description": "JX3BOX UI",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -1,4 +1,5 @@
1
1
  import { $cms, $next } from "@jx3box/jx3box-common/js/https";
2
+
2
3
  const API_PREFIX = `/api/next2`;
3
4
  // 获取分类
4
5
  export function getTopicBucket(params) {
@@ -34,3 +35,12 @@ export const manageTopic = (id, action, value) => {
34
35
  export const getTopicDetails = (id) => {
35
36
  return $next().get(`${API_PREFIX}/community/discussion/topic/item/${id}`);
36
37
  };
38
+
39
+ // 菜单
40
+ export function getCommunityTags() {
41
+ return $cms()
42
+ .get(`/api/cms/menu-group/community_tags`)
43
+ .then((res) => {
44
+ return res.data.data.menus || [];
45
+ });
46
+ }
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 () {
@@ -10,11 +10,6 @@
10
10
  >
11
11
  <div class="c-admin-wrapper">
12
12
  <el-divider content-position="left">标签</el-divider>
13
- <!-- <el-radio-group v-model="tags" class="c-admin-status" size="small">
14
- <el-radio-button v-for="(option, key) in categoryList" :label="key" :key="key">{{
15
- option
16
- }}</el-radio-button>
17
- </el-radio-group> -->
18
13
 
19
14
  <div class="c-admin-extend">
20
15
  <div class="u-condition u-map">
@@ -28,81 +23,78 @@
28
23
  placeholder="请选择"
29
24
  clearable
30
25
  >
31
- <!-- <el-option v-for="item in categoryList" :value="item.name" :label="item.name" :key="item.id">
32
- </el-option> -->
33
- </el-select>
34
- </div>
35
- <!-- <div class="u-condition u-map">
36
- <span class="u-prepend el-input-group__prepend">分类</span>
37
- <el-select v-model="post.category" filterable placeholder="请选择" clearable>
38
- <el-option v-for="item in categoryList" :value="item.name" :label="item.name" :key="item.id">
26
+ <el-option v-for="item in tags" :value="item.label" :label="item.label" :key="item.uuid">
39
27
  </el-option>
40
28
  </el-select>
41
- </div> -->
29
+ </div>
42
30
  </div>
43
31
 
44
32
  <el-divider content-position="left">高亮置顶</el-divider>
45
- <el-checkbox
46
- class="c-admin-highlight-checkbox"
47
- v-model="form.is_top"
48
- @change="onManageTopic($event, 'top')"
49
- :true-label="1"
50
- :false-label="0"
51
- >
52
- 置顶
53
- </el-checkbox>
54
- <el-checkbox
55
- class="c-admin-highlight-checkbox"
56
- v-model="form.is_category_top"
57
- @change="onManageTopic($event, 'category_top')"
58
- :true-label="1"
59
- :false-label="0"
60
- >
61
- 分类置顶
62
- </el-checkbox>
63
33
 
64
- <el-checkbox
65
- class="c-admin-highlight-checkbox"
66
- v-model="form.is_star"
67
- @change="onManageTopic($event, 'star')"
68
- :true-label="1"
69
- :false-label="0"
70
- >
71
- 精选
72
- </el-checkbox>
73
- <el-checkbox class="c-admin-highlight-checkbox" v-model="form.is_hight">高亮</el-checkbox>
74
- <span v-show="showColors">
75
- <el-color-picker
76
- class="c-admin-highlight-block"
77
- v-model="color"
78
- :predefine="color_options"
79
- size="mini"
80
- ></el-color-picker>
81
- <span class="c-admin-highlight-preview" :style="{ color: color }" style="margin-right: 10px"
82
- >预览高亮效果</span
34
+ <p class="c-admin-space">
35
+ <span class="c-admin-lable">置顶:</span>
36
+ <el-checkbox-group
37
+ v-model="isTopStatus"
38
+ @change="onTopStatusChange"
39
+ class="c-admin-status"
40
+ size="small"
83
41
  >
84
- </span>
42
+ <el-checkbox-button :label="1">全局置顶</el-checkbox-button>
43
+ <el-checkbox-button :label="2">版内置顶</el-checkbox-button>
44
+ </el-checkbox-group>
45
+ </p>
46
+ <p class="c-admin-space">
47
+ <span class="c-admin-lable">精选:</span>
48
+ <el-switch
49
+ v-model="form.is_star"
50
+ @change="onManageTopic($event, 'star')"
51
+ :active-value="1"
52
+ :inactive-value="0"
53
+ />
54
+ </p>
55
+
56
+ <p class="c-admin-space">
57
+ <span class="c-admin-lable">高亮:</span>
58
+ <el-switch
59
+ @change="onManageTopic($event, 'hight')"
60
+ v-model="form.is_hight"
61
+ :active-value="1"
62
+ :inactive-value="0"
63
+ />
64
+ <span v-show="showColors">
65
+ <el-color-picker
66
+ class="c-admin-highlight-block"
67
+ v-model="color"
68
+ :predefine="color_options"
69
+ size="mini"
70
+ ></el-color-picker>
71
+ <span class="c-admin-highlight-preview" :style="{ color: color }" style="margin-right: 10px">
72
+ 预览高亮效果
73
+ </span>
74
+ </span>
75
+ </p>
85
76
 
86
77
  <el-divider content-position="left">状态变更</el-divider>
87
78
  <div>
88
- <el-button type="danger" @click="deleteTopic">删除帖子</el-button>
89
- <el-button type="warning" @click="handleCheck">转为待审核</el-button>
79
+ <el-button type="danger" size="small" icon="el-icon-delete" @click="deleteTopic">删除帖子</el-button>
80
+ <el-button type="warning" size="small" icon="el-icon-refresh-left" @click="handleCheck"
81
+ >转为待审核</el-button
82
+ >
90
83
  </div>
91
84
 
92
- <el-divider content-position="left"></el-divider>
93
- <div>
94
- <!-- <el-button type="primary" @click="submit" :loading="pushing">提交修改</el-button> -->
95
- <el-button type="primary" @click="close">关闭窗口</el-button>
85
+ <div class="c-admin-buttons">
86
+ <el-button type="primary" @click="submit" :loading="pushing">提交修改</el-button>
87
+ <el-button type="plain" @click="close">取消</el-button>
96
88
  </div>
97
89
  </div>
98
90
  </el-drawer>
99
91
  </template>
100
92
 
101
93
  <script>
102
- import { post } from "jquery";
103
94
  import {
104
95
  auditTopic,
105
96
  deleteTopic,
97
+ getCommunityTags,
106
98
  getTopicBucket,
107
99
  getTopicDetails,
108
100
  manageTopic,
@@ -128,6 +120,8 @@ export default {
128
120
  emits: ["update:modelValue"],
129
121
  data() {
130
122
  return {
123
+ tags: [],
124
+ isTopStatus: [],
131
125
  post: null,
132
126
  pushing: false,
133
127
  categoryList: [],
@@ -182,6 +176,16 @@ export default {
182
176
  is_category_top: this.post.is_category_top,
183
177
  };
184
178
  },
179
+ form() {
180
+ const isTopStatus = [];
181
+ if (this.form.is_top == 1) {
182
+ isTopStatus.push(1);
183
+ }
184
+ if (this.form.is_category_top == 1) {
185
+ isTopStatus.push(2);
186
+ }
187
+ this.isTopStatus = isTopStatus;
188
+ },
185
189
  modelValue(val) {
186
190
  if (val) {
187
191
  this.getTopicDetails();
@@ -190,11 +194,32 @@ export default {
190
194
  },
191
195
  created: function () {
192
196
  this.getCategoryList();
197
+ this.getCommunityTags();
193
198
  },
194
199
  methods: {
200
+ onTopStatusChange(vals) {
201
+ if (vals.includes(1) && this.form.is_top == 0) {
202
+ this.onManageTopic(true, "top");
203
+ }
204
+ if (!vals.includes(1) && this.form.is_top == 1) {
205
+ this.onManageTopic(false, "top");
206
+ }
207
+ if (vals.includes(2) && this.form.is_category_top == 0) {
208
+ this.onManageTopic(true, "category_top");
209
+ }
210
+ if (!vals.includes(2) && this.form.is_category_top == 1) {
211
+ this.onManageTopic(false, "category_top");
212
+ }
213
+ },
195
214
  onManageTopic(e, action) {
196
215
  const value = e ? 1 : 0;
197
216
  manageTopic(this.post.id, action, value).then(() => {
217
+ if (action === "top") {
218
+ this.form.is_top = value;
219
+ }
220
+ if (action === "category_top") {
221
+ this.form.is_category_top = value;
222
+ }
198
223
  this.$message({
199
224
  type: "success",
200
225
  message: "操作成功!",
@@ -222,20 +247,30 @@ export default {
222
247
  this.$message.error("ID不存在!");
223
248
  return;
224
249
  }
225
- updateTopicItem(id, this.params).then((res) => {
250
+ updateTopicItem(id, {
251
+ ...this.post,
252
+ tags: this.form.tags,
253
+ is_top: 0,
254
+ }).then((res) => {
226
255
  this.$message.success("修改成功");
227
256
  this.$emit("update:modelValue", false);
228
257
  });
229
258
  },
259
+ getCommunityTags() {
260
+ getCommunityTags().then((tags) => {
261
+ this.tags = tags;
262
+ });
263
+ },
230
264
  // 关闭
231
265
  close() {
232
266
  this.form = {
233
267
  category: "",
234
268
  tags: [],
235
- is_top: false,
236
- is_star: false,
237
- is_hight: false,
269
+ is_top: 0,
270
+ is_star: 0,
271
+ is_hight: 0,
238
272
  };
273
+ this.isTopStatus = [];
239
274
  this.$nextTick(() => {
240
275
  this.$emit("update:modelValue", false);
241
276
  });
@@ -277,4 +312,20 @@ export default {
277
312
 
278
313
  <style lang="less">
279
314
  @import "../../assets/css/admin.less";
315
+ .c-admin-space {
316
+ .flex;
317
+ align-items: center;
318
+ flex-wrap: wrap;
319
+ height: 28px;
320
+ gap: 4px;
321
+ }
322
+ .c-admin-lable {
323
+ font-size: 14px;
324
+ font-weight: 500;
325
+ }
326
+ .c-admin-buttons {
327
+ width: 100%;
328
+ position: absolute;
329
+ bottom: 80px;
330
+ }
280
331
  </style>
@@ -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>