@jx3box/jx3box-common-ui 8.7.2 → 8.7.3

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.3",
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("上传失败");
@@ -72,6 +72,27 @@
72
72
  </div>
73
73
  </div>
74
74
 
75
+ <el-divider content-position="left">封面海报</el-divider>
76
+ <div class="c-admin-banner">
77
+ <el-upload
78
+ class="c-admin-upload el-upload--picture-card"
79
+ :action="uploadurl"
80
+ :with-credentials="true"
81
+ :show-file-list="false"
82
+ :on-success="uploadSuccess"
83
+ :on-error="uploadFail"
84
+ >
85
+ <img v-if="post_banner" :src="post_banner" />
86
+ <i class="el-icon-plus"></i>
87
+ </el-upload>
88
+ <el-input class="u-banner" v-model="post_banner">
89
+ <span slot="prepend">海报地址</span>
90
+ <span slot="append">
91
+ <span class="u-btn" @click="removeBanner"> <i class="el-icon-circle-close"></i> 移除海报 </span>
92
+ </span>
93
+ </el-input>
94
+ </div>
95
+
75
96
  <el-divider content-position="left">高亮置顶</el-divider>
76
97
 
77
98
  <p class="c-admin-space">
@@ -141,7 +162,7 @@ import {
141
162
  updateTopicItem,
142
163
  manageTopicAll
143
164
  } from "../../service/community";
144
- import {cloneDeep} from "lodash";
165
+ import { __cms } from "@jx3box/jx3box-common/data/jx3box.json";
145
166
 
146
167
  export default {
147
168
  name: "CommunityAdmin",
@@ -186,7 +207,12 @@ export default {
186
207
  hight_color: "rgb(255,0,1)",
187
208
  },
188
209
 
189
- finalTags: []
210
+ finalTags: [],
211
+
212
+ // 海报
213
+ uploadurl: __cms + "api/cms/upload",
214
+ banner_preview: "",
215
+ post_banner: "",
190
216
  };
191
217
  },
192
218
  computed: {
@@ -243,6 +269,7 @@ export default {
243
269
  user_id: this.form.user_id,
244
270
  title: this.form.title,
245
271
  category: this.form.category,
272
+ banner_img: this.post_banner,
246
273
  }));
247
274
 
248
275
  promises.push(manageTopicAll(id, {
@@ -327,6 +354,7 @@ export default {
327
354
 
328
355
  this.finalTags = this.post.color_tag;
329
356
  this.topStatus = [];
357
+ this.post_banner = this.post.banner_img;
330
358
  if (this.post.is_top) {
331
359
  this.topStatus.push("is_top");
332
360
  }
@@ -349,7 +377,19 @@ export default {
349
377
  }
350
378
  });
351
379
  this.finalTags = tags;
352
- }
380
+ },
381
+ // 上传
382
+ uploadSuccess: function (res, file, list) {
383
+ this.banner_preview = URL.createObjectURL(file.raw);
384
+ this.post_banner = res.data[0];
385
+ },
386
+ uploadFail: function (err, file, fileList) {
387
+ this.$message.error("上传失败");
388
+ console.log(err);
389
+ },
390
+ removeBanner: function () {
391
+ this.post_banner = "";
392
+ },
353
393
  },
354
394
  };
355
395
  </script>
@@ -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]);