@jx3box/jx3box-common-ui 8.5.6 → 8.5.8

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.6",
3
+ "version": "8.5.8",
4
4
  "description": "JX3BOX UI",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -15,3 +15,22 @@ export const updateTopicItem = (id, data) => {
15
15
  export const deleteTopic = (id) => {
16
16
  return $next().delete(`${API_PREFIX}/community/discussion/manage/topic/item/${id}`);
17
17
  };
18
+
19
+ // status = pass:审核通过, reject:审核不通过 wait:待审核
20
+ export const auditTopic = (id, action) => {
21
+ return $next().put(`${API_PREFIX}/community/discussion/manage/topic/item/${id}/audit/${action}`);
22
+ };
23
+
24
+ /**
25
+ *
26
+ * @param {*} id 帖子id
27
+ * @param {*} action 动作 top:置顶,star: 加精, hight: 高亮
28
+ * @param {*} value 1:确认操作, 0:取消操作
29
+ */
30
+ export const manageTopic = (id, action, value) => {
31
+ return $next().put(`${API_PREFIX}/community/discussion/manage/topic/item/${id}/opt/${action}/${value}`);
32
+ };
33
+
34
+ export const getTopicDetails = (id) => {
35
+ return $next().get(`${API_PREFIX}/community/discussion/topic/item/${id}`);
36
+ };
@@ -28,7 +28,7 @@
28
28
  </el-dropdown>
29
29
 
30
30
  <design-task v-model="showDesignTask" :post="post"></design-task>
31
- <CommunityAdmin v-model="communityAdminVisible" :post="post" />
31
+ <CommunityAdmin v-model="communityAdminVisible" :postId="post.id" />
32
32
  <MoveToCommunityDialog v-model="moveVisible" :post="post" />
33
33
  </div>
34
34
  </template>
@@ -81,10 +81,18 @@ export default {
81
81
  return User.isEditor();
82
82
  },
83
83
  sourceId() {
84
- return this.post?.ID;
84
+ if (this.isCommunity) {
85
+ return this.post?.id;
86
+ } else {
87
+ return this.post?.ID;
88
+ }
85
89
  },
86
90
  sourceType() {
87
- return this.post?.post_type;
91
+ if (this.isCommunity) {
92
+ return "community";
93
+ } else {
94
+ return this.post?.post_type;
95
+ }
88
96
  },
89
97
  },
90
98
  methods: {
@@ -10,7 +10,7 @@
10
10
  >
11
11
  <div class="c-admin-wrapper">
12
12
  <el-divider content-position="left">标签</el-divider>
13
- <!-- <el-radio-group v-model="tages" class="c-admin-status" size="small">
13
+ <!-- <el-radio-group v-model="tags" class="c-admin-status" size="small">
14
14
  <el-radio-button v-for="(option, key) in categoryList" :label="key" :key="key">{{
15
15
  option
16
16
  }}</el-radio-button>
@@ -20,7 +20,7 @@
20
20
  <div class="u-condition u-map">
21
21
  <span class="u-prepend el-input-group__prepend">标签</span>
22
22
  <el-select
23
- v-model="post.tages"
23
+ v-model="form.tags"
24
24
  multiple
25
25
  filterable
26
26
  allow-create
@@ -42,10 +42,34 @@
42
42
  </div>
43
43
 
44
44
  <el-divider content-position="left">高亮置顶</el-divider>
45
- <el-checkbox class="c-admin-highlight-checkbox" v-model="form.is_top">置顶</el-checkbox>
46
- <el-checkbox class="c-admin-highlight-checkbox" v-model="form.is_star" :true-label="1" :false-label="0"
47
- >精选</el-checkbox
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"
48
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
+
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>
49
73
  <el-checkbox class="c-admin-highlight-checkbox" v-model="form.is_hight">高亮</el-checkbox>
50
74
  <span v-show="showColors">
51
75
  <el-color-picker
@@ -62,20 +86,28 @@
62
86
  <el-divider content-position="left">状态变更</el-divider>
63
87
  <div>
64
88
  <el-button type="danger" @click="deleteTopic">删除帖子</el-button>
65
- <el-button type="warning">转为待审核</el-button>
89
+ <el-button type="warning" @click="handleCheck">转为待审核</el-button>
66
90
  </div>
67
91
 
68
- <el-divider content-position="left">确认操作</el-divider>
92
+ <el-divider content-position="left"></el-divider>
69
93
  <div>
70
- <el-button type="primary" @click="submit" :loading="pushing">提交修改</el-button>
71
- <el-button type="plain" @click="close">取消</el-button>
94
+ <!-- <el-button type="primary" @click="submit" :loading="pushing">提交修改</el-button> -->
95
+ <el-button type="primary" @click="close">关闭窗口</el-button>
72
96
  </div>
73
97
  </div>
74
98
  </el-drawer>
75
99
  </template>
76
100
 
77
101
  <script>
78
- import { deleteTopic, getTopicBucket, updateTopicItem } from "../../service/community";
102
+ import { post } from "jquery";
103
+ import {
104
+ auditTopic,
105
+ deleteTopic,
106
+ getTopicBucket,
107
+ getTopicDetails,
108
+ manageTopic,
109
+ updateTopicItem,
110
+ } from "../../service/community";
79
111
 
80
112
  export default {
81
113
  name: "CommunityAdmin",
@@ -84,11 +116,9 @@ export default {
84
116
  type: Boolean,
85
117
  default: false,
86
118
  },
87
- post: {
88
- type: Object,
89
- default: () => {
90
- return {};
91
- },
119
+ postId: {
120
+ type: Number,
121
+ default: 0,
92
122
  },
93
123
  },
94
124
  model: {
@@ -98,7 +128,7 @@ export default {
98
128
  emits: ["update:modelValue"],
99
129
  data() {
100
130
  return {
101
- isHighlight: true,
131
+ post: null,
102
132
  pushing: false,
103
133
  categoryList: [],
104
134
  color: "rgb(255,0,1)",
@@ -112,10 +142,11 @@ export default {
112
142
  ],
113
143
  form: {
114
144
  category: "",
115
- tages: [],
116
- is_top: false,
117
- is_star: false,
118
- is_hight: false,
145
+ tags: [],
146
+ is_top: 0,
147
+ is_star: 0,
148
+ is_hight: 0,
149
+ is_category_top: 0,
119
150
  },
120
151
  };
121
152
  },
@@ -130,30 +161,30 @@ export default {
130
161
  return {
131
162
  ...this.post,
132
163
  category: this.form.category,
133
- tages: this.form.tages,
134
- is_top: this.form.is_top ? 1 : 0,
135
- is_star: this.form.is_star ? 1 : 0,
136
- is_hight: this.form.is_hight ? 1 : 0,
164
+ tags: this.form.tags,
165
+ is_top: this.form.is_top,
166
+ is_star: this.form.is_star,
167
+ is_hight: this.form.is_hight,
168
+ is_category_top: this.form.is_category_top,
137
169
  // color: this.color,
138
170
  };
139
171
  },
140
172
  },
141
173
  watch: {
174
+ post() {
175
+ this.form = {
176
+ ...this.form,
177
+ is_hight: this.post.is_hight,
178
+ category: this.post.category,
179
+ is_top: this.post.is_top,
180
+ is_star: this.post.is_star,
181
+ tags: this.post.tags,
182
+ is_category_top: this.post.is_category_top,
183
+ };
184
+ },
142
185
  modelValue(val) {
143
186
  if (val) {
144
- if (this.post.is_hight === 1) {
145
- this.form.is_hight = true;
146
- }
147
- if (this.post.is_star === 1) {
148
- this.form.is_star = true;
149
- }
150
- if (this.post.is_top === 1) {
151
- this.form.is_top = true;
152
- }
153
- if (this.post.tages) {
154
- this.form.tages = this.post.tages;
155
- }
156
- this.form.category = this.post.category;
187
+ this.getTopicDetails();
157
188
  }
158
189
  },
159
190
  },
@@ -161,27 +192,53 @@ export default {
161
192
  this.getCategoryList();
162
193
  },
163
194
  methods: {
195
+ onManageTopic(e, action) {
196
+ const value = e ? 1 : 0;
197
+ manageTopic(this.post.id, action, value).then(() => {
198
+ this.$message({
199
+ type: "success",
200
+ message: "操作成功!",
201
+ });
202
+ });
203
+ },
204
+ handleCheck() {
205
+ this.$confirm(`此操作将该数据转为 待审核 状态, 是否继续?`, "提示", {
206
+ confirmButtonText: "确定",
207
+ cancelButtonText: "取消",
208
+ type: "warning",
209
+ }).then(() => {
210
+ auditTopic(id, "wait").then(() => {
211
+ this.$message({
212
+ type: "success",
213
+ message: "操作成功!",
214
+ });
215
+ this.load();
216
+ });
217
+ });
218
+ },
164
219
  submit() {
165
220
  const id = this.post.id;
166
221
  if (!id) {
167
222
  this.$message.error("ID不存在!");
168
223
  return;
169
224
  }
170
- // updateTopicItem(id, this.params).then((res) => {
171
- this.$message.success("修改成功");
172
- this.$emit("update:modelValue", false);
173
- // });
225
+ updateTopicItem(id, this.params).then((res) => {
226
+ this.$message.success("修改成功");
227
+ this.$emit("update:modelValue", false);
228
+ });
174
229
  },
175
230
  // 关闭
176
231
  close() {
177
232
  this.form = {
178
233
  category: "",
179
- tages: [],
234
+ tags: [],
180
235
  is_top: false,
181
236
  is_star: false,
182
237
  is_hight: false,
183
238
  };
184
- this.$emit("update:modelValue", false);
239
+ this.$nextTick(() => {
240
+ this.$emit("update:modelValue", false);
241
+ });
185
242
  },
186
243
  getCategoryList() {
187
244
  getTopicBucket({ type: "community" }).then((res) => {
@@ -209,6 +266,11 @@ export default {
209
266
  });
210
267
  });
211
268
  },
269
+ getTopicDetails() {
270
+ getTopicDetails(this.postId).then((res) => {
271
+ this.post = res.data.data;
272
+ });
273
+ },
212
274
  },
213
275
  };
214
276
  </script>