@jx3box/jx3box-common-ui 8.7.2 → 8.7.4

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.7.2",
3
+ "version": "8.7.4",
4
4
  "description": "JX3BOX UI",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/src/App.vue CHANGED
@@ -309,7 +309,7 @@ export default {
309
309
  },
310
310
  loadCommunity: function () {
311
311
  // 72
312
- getTopicDetails(82).then((res) => {
312
+ getTopicDetails(120).then((res) => {
313
313
  this.community = res.data.data;
314
314
  });
315
315
  },
@@ -282,7 +282,7 @@ export default {
282
282
  // 上传
283
283
  uploadSuccess: function (res, file, list) {
284
284
  this.banner_preview = URL.createObjectURL(file.raw);
285
- this.post_banner = res.data[0];
285
+ this.post_banner = res.data?.[0] || "";
286
286
  },
287
287
  uploadFail: function (err, file, fileList) {
288
288
  this.$message.error("上传失败");
@@ -8,18 +8,26 @@
8
8
  :modal="false"
9
9
  :withHeader="false"
10
10
  >
11
- <div class="c-admin-wrapper">
11
+ <div class="c-admin-wrapper c-community-wrapper">
12
12
  <el-divider content-position="left">信息设置</el-divider>
13
13
  <div class="c-admin-extend">
14
- <div class="u-condition u-map">
14
+ <div class="u-condition u-map u-title-condition">
15
+ <span class="u-prepend el-input-group__prepend">
16
+ <el-select v-model="form.category" filterable placeholder="请选择">
17
+ <el-option
18
+ v-for="item in categoryList"
19
+ :value="item.name"
20
+ :label="item.name"
21
+ :key="item.name"
22
+ >
23
+ </el-option>
24
+ </el-select>
25
+ </span>
15
26
  <el-input v-model="form.title" placeholder="请输入标题" class="input-author drawer-item-content">
16
- <template #prepend>
17
- <span class="u-keyword">标题</span>
18
- </template>
19
27
  </el-input>
20
28
  </div>
21
29
  </div>
22
- <div class="c-admin-extend">
30
+ <!-- <div class="c-admin-extend">
23
31
  <div class="u-condition u-map">
24
32
  <span class="u-prepend el-input-group__prepend">分类</span>
25
33
  <el-select v-model="form.category" filterable placeholder="请选择">
@@ -27,7 +35,7 @@
27
35
  </el-option>
28
36
  </el-select>
29
37
  </div>
30
- </div>
38
+ </div> -->
31
39
  <div class="c-admin-extend m-community-tag">
32
40
  <div class="u-condition u-map">
33
41
  <span class="u-prepend el-input-group__prepend">标签</span>
@@ -45,12 +53,11 @@
45
53
  </el-option>
46
54
  </el-select>
47
55
  </div>
48
- <div class="m-community-tag__content">
56
+ <div class="m-community-tag__content">
49
57
  <template v-if="finalTags && finalTags.length">
50
58
  <div class="m-community-tag__list" v-for="item in finalTags" :key="item.uuid">
51
59
  <el-input v-model="item.label"></el-input>
52
- <el-color-picker v-model="item.color"
53
- :predefine="color_options"></el-color-picker>
60
+ <el-color-picker v-model="item.color" :predefine="color_options"></el-color-picker>
54
61
  </div>
55
62
  </template>
56
63
  <el-alert title="暂未设置标签" v-else type="info" show-icon :closable="false"></el-alert>
@@ -67,40 +74,55 @@
67
74
  <template #prepend>
68
75
  <span class="u-keyword">作者ID</span>
69
76
  </template>
77
+ <template #append>
78
+ <a class="m-user" :href="authorLink(userInfo.ID)" target="_blank">
79
+ <el-avatar class="u-avatar" :src="userInfo.user_avatar" size="small" />
80
+ {{ userInfo.display_name || "匿名" }}
81
+ </a>
82
+ </template>
70
83
  </el-input>
71
84
  </div>
72
85
  </div>
73
86
  </div>
74
87
 
88
+ <el-divider content-position="left">封面海报</el-divider>
89
+ <div class="c-admin-banner">
90
+ <el-upload
91
+ class="c-admin-upload el-upload--picture-card"
92
+ :action="uploadurl"
93
+ :with-credentials="true"
94
+ :show-file-list="false"
95
+ :on-success="uploadSuccess"
96
+ :on-error="uploadFail"
97
+ >
98
+ <img v-if="post_banner" :src="post_banner" />
99
+ <i class="el-icon-plus"></i>
100
+ </el-upload>
101
+ <el-input class="u-banner" v-model="post_banner">
102
+ <span slot="prepend">海报地址</span>
103
+ <span slot="append">
104
+ <span class="u-btn" @click="removeBanner"> <i class="el-icon-circle-close"></i> 移除海报 </span>
105
+ </span>
106
+ </el-input>
107
+ </div>
108
+
75
109
  <el-divider content-position="left">高亮置顶</el-divider>
76
110
 
77
111
  <p class="c-admin-space">
78
112
  <span class="c-admin-label">置顶:</span>
79
- <el-checkbox-group
80
- v-model="topStatus"
81
- class="c-admin-status"
82
- size="small"
83
- >
84
- <el-checkbox-button label="is_top">全局置顶</el-checkbox-button>
85
- <el-checkbox-button label="is_category_top">版内置顶</el-checkbox-button>
113
+ <el-checkbox-group v-model="topStatus" class="c-admin-status" size="small">
114
+ <el-checkbox label="is_top">全局置顶</el-checkbox>
115
+ <el-checkbox label="is_category_top">版内置顶</el-checkbox>
86
116
  </el-checkbox-group>
87
117
  </p>
88
118
  <p class="c-admin-space">
89
119
  <span class="c-admin-label">精选:</span>
90
- <el-switch
91
- v-model="form.is_star"
92
- :active-value="1"
93
- :inactive-value="0"
94
- />
120
+ <el-switch v-model="form.is_star" :active-value="1" :inactive-value="0" />
95
121
  </p>
96
122
 
97
123
  <p class="c-admin-space">
98
124
  <span class="c-admin-label">高亮:</span>
99
- <el-switch
100
- v-model="form.is_hight"
101
- :active-value="1"
102
- :inactive-value="0"
103
- />
125
+ <el-switch v-model="form.is_hight" :active-value="1" :inactive-value="0" />
104
126
  <span v-show="showColors">
105
127
  <el-color-picker
106
128
  class="c-admin-highlight-block"
@@ -114,17 +136,17 @@
114
136
  </span>
115
137
  </p>
116
138
 
117
- <el-divider content-position="left">状态变更</el-divider>
118
- <div>
119
- <el-button type="danger" size="small" icon="el-icon-delete" @click="deleteTopic">删除帖子</el-button>
120
- <el-button type="warning" size="small" icon="el-icon-refresh-left" @click="handleCheck"
121
- >转为待审核</el-button
122
- >
123
- </div>
124
-
125
- <div class="c-admin-buttons">
126
- <el-button type="primary" @click="submit" :loading="pushing">提交修改</el-button>
127
- <el-button type="plain" @click="close">取消</el-button>
139
+ <div class="c-community-buttons">
140
+ <div class="c-community-buttons_left">
141
+ <el-button type="danger" size="small" icon="el-icon-delete" @click="deleteTopic">删除帖子</el-button>
142
+ <el-button type="warning" size="small" icon="el-icon-refresh-left" @click="handleCheck"
143
+ >转为待审核</el-button
144
+ >
145
+ </div>
146
+ <div class="c-community-buttons_right">
147
+ <el-button type="primary" size="small" @click="submit" :loading="pushing">提交修改</el-button>
148
+ <el-button type="plain" size="small" @click="close">取消</el-button>
149
+ </div>
128
150
  </div>
129
151
  </div>
130
152
  </el-drawer>
@@ -139,9 +161,12 @@ import {
139
161
  getTopicDetails,
140
162
  manageTopic,
141
163
  updateTopicItem,
142
- manageTopicAll
164
+ manageTopicAll,
143
165
  } from "../../service/community";
144
- import {cloneDeep} from "lodash";
166
+ import { __cms } from "@jx3box/jx3box-common/data/jx3box.json";
167
+ import {getUserInfo} from "../../service/author";
168
+ import { debounce } from "lodash";
169
+ import { authorLink } from "@jx3box/jx3box-common/js/utils";
145
170
 
146
171
  export default {
147
172
  name: "CommunityAdmin",
@@ -184,9 +209,17 @@ export default {
184
209
  is_hight: 0,
185
210
  is_category_top: 0,
186
211
  hight_color: "rgb(255,0,1)",
212
+ user_id: "",
187
213
  },
188
214
 
189
- finalTags: []
215
+ finalTags: [],
216
+
217
+ // 海报
218
+ uploadurl: __cms + "api/cms/upload",
219
+ banner_preview: "",
220
+ post_banner: "",
221
+
222
+ userInfo: {},
190
223
  };
191
224
  },
192
225
  computed: {
@@ -198,16 +231,22 @@ export default {
198
231
  },
199
232
  },
200
233
  watch: {
201
- modelValue: async function(val) {
234
+ modelValue: async function (val) {
202
235
  if (val) {
203
236
  await this.getCategoryList();
204
237
  await this.getCommunityTags();
205
238
  await this.getTopicDetails();
206
239
  }
207
240
  },
208
-
241
+ "form.user_id": debounce(function (id) {
242
+ id &&
243
+ getUserInfo(id).then((res) => {
244
+ this.userInfo = res || {};
245
+ });
246
+ }, 500),
209
247
  },
210
248
  methods: {
249
+ authorLink,
211
250
  handleCheck() {
212
251
  const id = this.post.id;
213
252
  if (!id) {
@@ -238,22 +277,26 @@ export default {
238
277
 
239
278
  const promises = [];
240
279
 
241
- promises.push(updateTopicItem(id, {
242
- ...this.post,
243
- user_id: this.form.user_id,
244
- title: this.form.title,
245
- category: this.form.category,
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
- }));
280
+ promises.push(
281
+ updateTopicItem(id, {
282
+ ...this.post,
283
+ user_id: this.form.user_id,
284
+ title: this.form.title,
285
+ category: this.form.category,
286
+ banner_img: this.post_banner,
287
+ })
288
+ );
256
289
 
290
+ promises.push(
291
+ manageTopicAll(id, {
292
+ is_top: this.topStatus.includes("is_top") ? 1 : 0,
293
+ is_category_top: this.topStatus.includes("is_category_top") ? 1 : 0,
294
+ is_star: this.form.is_star,
295
+ is_hight: this.form.is_hight,
296
+ hight_color: this.form.hight_color,
297
+ color_tag: this.finalTags,
298
+ })
299
+ );
257
300
 
258
301
  Promise.all(promises).then(() => {
259
302
  this.$message({
@@ -323,10 +366,11 @@ export default {
323
366
  title: this.post.title,
324
367
  hight_color: this.post.hight_color,
325
368
  tags: this.post?.color_tag?.map((item) => item.label) || [],
326
- }
369
+ };
327
370
 
328
371
  this.finalTags = this.post.color_tag;
329
372
  this.topStatus = [];
373
+ this.post_banner = this.post.banner_img;
330
374
  if (this.post.is_top) {
331
375
  this.topStatus.push("is_top");
332
376
  }
@@ -346,10 +390,22 @@ export default {
346
390
  return {
347
391
  label: item,
348
392
  color: "rgb(255,0,1)",
349
- }
393
+ };
350
394
  });
351
395
  this.finalTags = tags;
352
- }
396
+ },
397
+ // 上传
398
+ uploadSuccess: function (res, file, list) {
399
+ this.banner_preview = URL.createObjectURL(file.raw);
400
+ this.post_banner = res.data[0];
401
+ },
402
+ uploadFail: function (err, file, fileList) {
403
+ this.$message.error("上传失败");
404
+ console.log(err);
405
+ },
406
+ removeBanner: function () {
407
+ this.post_banner = "";
408
+ },
353
409
  },
354
410
  };
355
411
  </script>
@@ -368,11 +424,17 @@ export default {
368
424
  font-size: 14px;
369
425
  font-weight: 500;
370
426
  }
371
- .c-admin-buttons {
372
- width: 100%;
373
- padding-top: 30px;
374
- // position: absolute;
375
- // bottom: 50px;
427
+
428
+ .c-community-wrapper {
429
+ height: 100%;
430
+ }
431
+ .c-community-buttons {
432
+ .flex;
433
+ justify-content: space-between;
434
+ align-items: center;
435
+ .pa;
436
+ width: calc(100% - 40px);
437
+ bottom: 20px;
376
438
  }
377
439
  .c-admin-extend .u-map .u-prepend {
378
440
  font-size: 14px;
@@ -389,10 +451,10 @@ export default {
389
451
 
390
452
  .m-community-tag {
391
453
  .u-prepend {
392
- border-bottom-left-radius: 0!important;
454
+ border-bottom-left-radius: 0 !important;
393
455
  }
394
456
  .el-input__inner {
395
- border-bottom-right-radius: 0!important;
457
+ border-bottom-right-radius: 0 !important;
396
458
  }
397
459
  }
398
460
 
@@ -411,5 +473,19 @@ export default {
411
473
  margin-bottom: 10px;
412
474
  }
413
475
  }
476
+
477
+ .u-title-condition {
478
+ .flex;
479
+ .el-select {
480
+ margin-left: 0 !important;
481
+ top: 10px;
482
+ left: -10px;
483
+ }
484
+ }
485
+ .m-user {
486
+ .flex;
487
+ align-items: center;
488
+ gap: 5px;
489
+ }
414
490
  }
415
491
  </style>
@@ -47,7 +47,7 @@ export default {
47
47
  },
48
48
  topicImage() {
49
49
  const img = this.postBanner || this.topicInfo?.img;
50
- if (img.indexOf(".gif") > -1) {
50
+ if (img?.indexOf(".gif") > -1) {
51
51
  return img;
52
52
  }
53
53
  return getThumbnail(img, [260 * 2, 78 * 2]);