@jx3box/jx3box-common-ui 8.6.6 → 8.6.7

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.6",
3
+ "version": "8.6.7",
4
4
  "description": "JX3BOX UI",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -32,6 +32,10 @@ export const manageTopic = (id, action, value) => {
32
32
  return $next().put(`${API_PREFIX}/community/discussion/manage/topic/item/${id}/opt/${action}/${value}`);
33
33
  };
34
34
 
35
+ export const manageTopicAll = (id, data) => {
36
+ return $next().put(`${API_PREFIX}/community/discussion/manage/topic/item/${id}/opt`, data);
37
+ }
38
+
35
39
  export const getTopicDetails = (id) => {
36
40
  return $next().get(`${API_PREFIX}/community/discussion/topic/item/${id}`);
37
41
  };
package/src/App.vue CHANGED
@@ -14,7 +14,7 @@
14
14
  <img slot="logo" svg-inline src="../assets/img/jx3.svg" />
15
15
  bread info
16
16
  <template #op-prepend>
17
- <AdminDrop :post="post" :user-id="8" :showMove="true"/>
17
+ <AdminDrop :post="community" :isCommunity="true" :user-id="8" :showMove="true"/>
18
18
  </template>
19
19
  </Breadcrumb>
20
20
 
@@ -202,6 +202,7 @@ import { __server } from "@jx3box/jx3box-common/data/jx3box.json";
202
202
  import { wiki } from "@jx3box/jx3box-common/js/wiki";
203
203
  import post_topics from "@jx3box/jx3box-common/data/post_topics.json";
204
204
  import Homework from './interact/Homework.vue';
205
+ import { getTopicDetails } from "../service/community"
205
206
 
206
207
  export default {
207
208
  name: "App",
@@ -281,6 +282,8 @@ export default {
281
282
  tag2: '',
282
283
 
283
284
  homeworkVisible: false,
285
+
286
+ community: {}
284
287
  };
285
288
  },
286
289
  created: function () {
@@ -288,6 +291,8 @@ export default {
288
291
  res = res.data;
289
292
  this.wikiPost = res.data;
290
293
  });
294
+
295
+ this.loadCommunity();
291
296
  },
292
297
  methods: {
293
298
  addUser: function (val) {
@@ -302,6 +307,12 @@ export default {
302
307
  updateExtend: function (val) {
303
308
  // console.log(val);
304
309
  },
310
+ loadCommunity: function () {
311
+ // 72
312
+ getTopicDetails(82).then((res) => {
313
+ this.community = res.data.data;
314
+ });
315
+ },
305
316
  },
306
317
  watch: {
307
318
  post_id: {
@@ -28,7 +28,7 @@
28
28
  </el-select>
29
29
  </div>
30
30
  </div>
31
- <div class="c-admin-extend">
31
+ <div class="c-admin-extend m-community-tag">
32
32
  <div class="u-condition u-map">
33
33
  <span class="u-prepend el-input-group__prepend">标签</span>
34
34
  <el-select
@@ -39,11 +39,22 @@
39
39
  default-first-option
40
40
  placeholder="请选择"
41
41
  clearable
42
+ @change="onTagChange"
42
43
  >
43
- <el-option v-for="item in tags" :value="item.label" :label="item.label" :key="item.uuid">
44
+ <el-option v-for="item in tags" :value="item.label" :label="item.label" :key="item.label">
44
45
  </el-option>
45
46
  </el-select>
46
47
  </div>
48
+ <div class="m-community-tag__content">
49
+ <template v-if="finalTags.length">
50
+ <div class="m-community-tag__list" v-for="item in finalTags" :key="item.uuid">
51
+ <el-input v-model="item.label"></el-input>
52
+ <el-color-picker v-model="item.color"
53
+ :predefine="color_options"></el-color-picker>
54
+ </div>
55
+ </template>
56
+ <el-alert title="暂未设置标签" v-else type="info" show-icon :closable="false"></el-alert>
57
+ </div>
47
58
  </div>
48
59
  <div class="c-admin-extend">
49
60
  <div class="u-condition u-map">
@@ -64,31 +75,28 @@
64
75
  <el-divider content-position="left">高亮置顶</el-divider>
65
76
 
66
77
  <p class="c-admin-space">
67
- <span class="c-admin-lable">置顶:</span>
78
+ <span class="c-admin-label">置顶:</span>
68
79
  <el-checkbox-group
69
- v-model="isTopStatus"
70
- @change="onTopStatusChange"
80
+ v-model="topStatus"
71
81
  class="c-admin-status"
72
82
  size="small"
73
83
  >
74
- <el-checkbox-button :label="1">全局置顶</el-checkbox-button>
75
- <el-checkbox-button :label="2">版内置顶</el-checkbox-button>
84
+ <el-checkbox-button label="is_top">全局置顶</el-checkbox-button>
85
+ <el-checkbox-button label="is_category_top">版内置顶</el-checkbox-button>
76
86
  </el-checkbox-group>
77
87
  </p>
78
88
  <p class="c-admin-space">
79
- <span class="c-admin-lable">精选:</span>
89
+ <span class="c-admin-label">精选:</span>
80
90
  <el-switch
81
91
  v-model="form.is_star"
82
- @change="onManageTopic($event, 'star')"
83
92
  :active-value="1"
84
93
  :inactive-value="0"
85
94
  />
86
95
  </p>
87
96
 
88
97
  <p class="c-admin-space">
89
- <span class="c-admin-lable">高亮:</span>
98
+ <span class="c-admin-label">高亮:</span>
90
99
  <el-switch
91
- @change="onManageTopic($event, 'hight')"
92
100
  v-model="form.is_hight"
93
101
  :active-value="1"
94
102
  :inactive-value="0"
@@ -96,7 +104,7 @@
96
104
  <span v-show="showColors">
97
105
  <el-color-picker
98
106
  class="c-admin-highlight-block"
99
- v-model="color"
107
+ v-model="form.hight_color"
100
108
  :predefine="color_options"
101
109
  size="mini"
102
110
  ></el-color-picker>
@@ -131,7 +139,9 @@ import {
131
139
  getTopicDetails,
132
140
  manageTopic,
133
141
  updateTopicItem,
142
+ manageTopicAll
134
143
  } from "../../service/community";
144
+ import {cloneDeep} from "lodash";
135
145
 
136
146
  export default {
137
147
  name: "CommunityAdmin",
@@ -153,7 +163,7 @@ export default {
153
163
  data() {
154
164
  return {
155
165
  tags: [],
156
- isTopStatus: [],
166
+ topStatus: [],
157
167
  post: null,
158
168
  pushing: false,
159
169
  categoryList: [],
@@ -173,7 +183,10 @@ export default {
173
183
  is_star: 0,
174
184
  is_hight: 0,
175
185
  is_category_top: 0,
186
+ hight_color: "rgb(255,0,1)",
176
187
  },
188
+
189
+ finalTags: []
177
190
  };
178
191
  },
179
192
  computed: {
@@ -185,69 +198,16 @@ export default {
185
198
  },
186
199
  },
187
200
  watch: {
188
- post() {
189
- this.form = {
190
- ...this.form,
191
- is_hight: this.post.is_hight,
192
- category: this.post.category,
193
- is_top: this.post.is_top,
194
- is_star: this.post.is_star,
195
- tags: this.post.tags,
196
- is_category_top: this.post.is_category_top,
197
- user_id: this.post.user_id,
198
- title: this.post.title,
199
- };
200
- },
201
- form() {
202
- const isTopStatus = [];
203
- if (this.form.is_top == 1) {
204
- isTopStatus.push(1);
205
- }
206
- if (this.form.is_category_top == 1) {
207
- isTopStatus.push(2);
208
- }
209
- this.isTopStatus = isTopStatus;
210
- },
211
- modelValue(val) {
201
+ modelValue: async function(val) {
212
202
  if (val) {
213
- this.getTopicDetails();
203
+ await this.getCategoryList();
204
+ await this.getCommunityTags();
205
+ await this.getTopicDetails();
214
206
  }
215
207
  },
216
- },
217
- created: function () {
218
- this.getCategoryList();
219
- this.getCommunityTags();
208
+
220
209
  },
221
210
  methods: {
222
- onTopStatusChange(vals) {
223
- if (vals.includes(1) && this.form.is_top == 0) {
224
- this.onManageTopic(true, "top");
225
- }
226
- if (!vals.includes(1) && this.form.is_top == 1) {
227
- this.onManageTopic(false, "top");
228
- }
229
- if (vals.includes(2) && this.form.is_category_top == 0) {
230
- this.onManageTopic(true, "category_top");
231
- }
232
- if (!vals.includes(2) && this.form.is_category_top == 1) {
233
- this.onManageTopic(false, "category_top");
234
- }
235
- },
236
- onManageTopic(e, action) {
237
- const value = e ? 1 : 0;
238
- manageTopic(this.post.id, action, value).then(() => {
239
- if (action === "top") {
240
- this.form.is_top = value;
241
- }
242
- if (action === "category_top") {
243
- this.form.is_category_top = value;
244
- }
245
- this.$message({
246
- type: "success",
247
- message: "操作成功!",
248
- });
249
- });
250
- },
251
211
  handleCheck() {
252
212
  const id = this.post.id;
253
213
  if (!id) {
@@ -269,22 +229,39 @@ export default {
269
229
  });
270
230
  });
271
231
  },
272
- submit() {
232
+ async submit() {
273
233
  const id = this.post.id;
274
234
  if (!id) {
275
235
  this.$message.error("ID不存在!");
276
236
  return;
277
237
  }
278
- updateTopicItem(id, {
238
+
239
+ const promises = [];
240
+
241
+ promises.push(updateTopicItem(id, {
279
242
  ...this.post,
280
- tags: this.form.tags,
281
243
  user_id: this.form.user_id,
282
244
  title: this.form.title,
283
245
  category: this.form.category,
284
- }).then((res) => {
285
- this.$message.success("修改成功");
246
+ }));
247
+
248
+ promises.push(manageTopicAll(id, {
249
+ is_top: this.topStatus.includes("is_top") ? 1 : 0,
250
+ is_category_top: this.topStatus.includes("is_category_top") ? 1 : 0,
251
+ is_star: this.form.is_star,
252
+ is_hight: this.form.is_hight,
253
+ hight_color: this.form.hight_color,
254
+ color_tag: this.finalTags,
255
+ }));
256
+
257
+
258
+ Promise.all(promises).then(() => {
259
+ this.$message({
260
+ type: "success",
261
+ message: "操作成功!",
262
+ });
286
263
  this.$emit("update:modelValue", false);
287
- window.location.reload();
264
+ window.reload();
288
265
  });
289
266
  },
290
267
  getCommunityTags() {
@@ -335,8 +312,44 @@ export default {
335
312
  getTopicDetails() {
336
313
  getTopicDetails(this.postId).then((res) => {
337
314
  this.post = res.data.data;
315
+ this.form = {
316
+ ...this.form,
317
+ is_hight: this.post.is_hight,
318
+ category: this.post.category,
319
+ is_top: this.post.is_top,
320
+ is_star: this.post.is_star,
321
+ is_category_top: this.post.is_category_top,
322
+ user_id: this.post.user_id,
323
+ title: this.post.title,
324
+ hight_color: this.post.hight_color,
325
+ tags: this.post?.color_tag?.map((item) => item.label) || [],
326
+ }
327
+
328
+ this.finalTags = this.post.color_tag;
329
+ this.topStatus = [];
330
+ if (this.post.is_top) {
331
+ this.topStatus.push("is_top");
332
+ }
333
+ if (this.post.is_category_top) {
334
+ this.topStatus.push("is_category_top");
335
+ }
338
336
  });
339
337
  },
338
+ onTagChange() {
339
+ const tags = this.form.tags.map((item) => {
340
+ const tag = this.tags.find((tag) => tag.label === item);
341
+
342
+ if (tag) {
343
+ return tag;
344
+ }
345
+
346
+ return {
347
+ label: item,
348
+ color: "rgb(255,0,1)",
349
+ }
350
+ });
351
+ this.finalTags = tags;
352
+ }
340
353
  },
341
354
  };
342
355
  </script>
@@ -351,7 +364,7 @@ export default {
351
364
  height: 28px;
352
365
  gap: 4px;
353
366
  }
354
- .c-admin-lable {
367
+ .c-admin-label {
355
368
  font-size: 14px;
356
369
  font-weight: 500;
357
370
  }
@@ -373,5 +386,30 @@ export default {
373
386
  min-width: 62px;
374
387
  box-sizing: border-box;
375
388
  }
389
+
390
+ .m-community-tag {
391
+ .u-prepend {
392
+ border-bottom-left-radius: 0!important;
393
+ }
394
+ .el-input__inner {
395
+ border-bottom-right-radius: 0!important;
396
+ }
397
+ }
398
+
399
+ .m-community-tag__content {
400
+ border: 1px solid #dcdfe6;
401
+ border-top: none;
402
+ padding: 10px;
403
+ }
404
+
405
+ .m-community-tag__list {
406
+ .flex;
407
+ align-items: center;
408
+ gap: 10px;
409
+
410
+ &:not(:last-child) {
411
+ margin-bottom: 10px;
412
+ }
413
+ }
376
414
  }
377
415
  </style>