@jx3box/jx3box-common-ui 8.5.8 → 8.6.0

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.8",
3
+ "version": "8.6.0",
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
@@ -260,7 +260,7 @@ export default {
260
260
  tab: "widget",
261
261
 
262
262
  post: {},
263
- post_id: "65668",
263
+ post_id: "12839",
264
264
 
265
265
  author: "",
266
266
  wikiPost: null,
@@ -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>