@jx3box/jx3box-common-ui 8.5.0 → 8.5.2

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.0",
3
+ "version": "8.5.2",
4
4
  "description": "JX3BOX UI",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -31,7 +31,7 @@
31
31
  ],
32
32
  "dependencies": {
33
33
  "@jx3box/jx3box-comment-ui": "^1.8.8",
34
- "@jx3box/jx3box-common": "^8.2.17",
34
+ "@jx3box/jx3box-common": "^8.2.18",
35
35
  "@jx3box/jx3box-data": "^3.5.8",
36
36
  "@jx3box/jx3box-editor": "^2.1.9",
37
37
  "@jx3box/reporter": "^0.0.4",
@@ -8,3 +8,10 @@ export function getTopicBucket(params) {
8
8
  export const recoverTopicFromPosts = (data) => {
9
9
  return $next().post(`${API_PREFIX}/community/discussion/manage/topic/recover/from/posts`, data);
10
10
  };
11
+
12
+ export const updateTopicItem = (id, data) => {
13
+ return $next().put(`${API_PREFIX}/community/discussion/manage/topic/item/${id}/update`, data);
14
+ };
15
+ export const deleteTopic = (id) => {
16
+ return $next().delete(`${API_PREFIX}/community/discussion/manage/topic/item/${id}`);
17
+ };
@@ -5,7 +5,14 @@
5
5
  ><i class="el-icon-setting"></i> 管理<i class="el-icon-arrow-down el-icon--right"></i>
6
6
  </el-button>
7
7
  <el-dropdown-menu slot="dropdown">
8
- <el-dropdown-item v-if="isEditor" command="toggleAdminPanel" icon="el-icon-setting">
8
+ <el-dropdown-item v-if="isEditor && !isCommunity" command="toggleAdminPanel" icon="el-icon-setting">
9
+ <span>设置</span>
10
+ </el-dropdown-item>
11
+ <el-dropdown-item
12
+ v-else-if="isEditor && isCommunity"
13
+ command="toggleCommunityAdminPanel"
14
+ icon="el-icon-setting"
15
+ >
9
16
  <span>设置</span>
10
17
  </el-dropdown-item>
11
18
  <el-dropdown-item v-if="isEditor" command="directMessage" icon="el-icon-message">
@@ -21,6 +28,7 @@
21
28
  </el-dropdown>
22
29
 
23
30
  <design-task v-model="showDesignTask" :post="post"></design-task>
31
+ <CommunityAdmin v-model="communityAdminVisible" :post="post" />
24
32
  <MoveToCommunityDialog v-model="moveVisible" :post="post" />
25
33
  </div>
26
34
  </template>
@@ -31,13 +39,19 @@ import User from "@jx3box/jx3box-common/js/user";
31
39
  import DesignTask from "./DesignTask.vue";
32
40
  import MoveToCommunityDialog from "./MoveToCommunityDialog.vue";
33
41
  import { sendMessage } from "../../service/admin";
42
+ import CommunityAdmin from "./CommunityAdmin.vue";
34
43
  export default {
35
44
  name: "AdminDrop",
36
45
  components: {
37
46
  DesignTask,
38
47
  MoveToCommunityDialog,
48
+ CommunityAdmin,
39
49
  },
40
50
  props: {
51
+ isCommunity: {
52
+ type: Boolean,
53
+ default: false,
54
+ },
41
55
  showMove: {
42
56
  type: Boolean,
43
57
  default: false,
@@ -58,6 +72,7 @@ export default {
58
72
  data() {
59
73
  return {
60
74
  moveVisible: false,
75
+ communityAdminVisible: false,
61
76
  showDesignTask: false,
62
77
  };
63
78
  },
@@ -76,6 +91,9 @@ export default {
76
91
  handleCommand(command) {
77
92
  this[command]();
78
93
  },
94
+ toggleCommunityAdminPanel() {
95
+ this.communityAdminVisible = true;
96
+ },
79
97
  toggleAdminPanel() {
80
98
  Bus.$emit("toggleAdminPanel");
81
99
  },
@@ -0,0 +1,218 @@
1
+ <template>
2
+ <el-drawer
3
+ class="c-admin"
4
+ title="管理面板"
5
+ :visible.sync="modelValue"
6
+ :before-close="close"
7
+ :append-to-body="true"
8
+ :modal="false"
9
+ :withHeader="false"
10
+ >
11
+ <div class="c-admin-wrapper">
12
+ <el-divider content-position="left">标签</el-divider>
13
+ <!-- <el-radio-group v-model="tages" 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
+
19
+ <div class="c-admin-extend">
20
+ <div class="u-condition u-map">
21
+ <span class="u-prepend el-input-group__prepend">标签</span>
22
+ <el-select
23
+ v-model="post.tages"
24
+ multiple
25
+ filterable
26
+ allow-create
27
+ default-first-option
28
+ placeholder="请选择"
29
+ clearable
30
+ >
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">
39
+ </el-option>
40
+ </el-select>
41
+ </div> -->
42
+ </div>
43
+
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
48
+ >
49
+ <el-checkbox class="c-admin-highlight-checkbox" v-model="form.is_hight">高亮</el-checkbox>
50
+ <span v-show="showColors">
51
+ <el-color-picker
52
+ class="c-admin-highlight-block"
53
+ v-model="color"
54
+ :predefine="color_options"
55
+ size="mini"
56
+ ></el-color-picker>
57
+ <span class="c-admin-highlight-preview" :style="{ color: color }" style="margin-right: 10px"
58
+ >预览高亮效果</span
59
+ >
60
+ </span>
61
+
62
+ <el-divider content-position="left">状态变更</el-divider>
63
+ <div>
64
+ <el-button type="danger" @click="deleteTopic">删除帖子</el-button>
65
+ <el-button type="warning">转为待审核</el-button>
66
+ </div>
67
+
68
+ <el-divider content-position="left">确认操作</el-divider>
69
+ <div>
70
+ <el-button type="primary" @click="submit" :loading="pushing">提交修改</el-button>
71
+ <el-button type="plain" @click="close">取消</el-button>
72
+ </div>
73
+ </div>
74
+ </el-drawer>
75
+ </template>
76
+
77
+ <script>
78
+ import { deleteTopic, getTopicBucket, updateTopicItem } from "../../service/community";
79
+
80
+ export default {
81
+ name: "CommunityAdmin",
82
+ props: {
83
+ modelValue: {
84
+ type: Boolean,
85
+ default: false,
86
+ },
87
+ post: {
88
+ type: Object,
89
+ default: () => {
90
+ return {};
91
+ },
92
+ },
93
+ },
94
+ model: {
95
+ prop: "modelValue",
96
+ event: "update:modelValue",
97
+ },
98
+ emits: ["update:modelValue"],
99
+ data() {
100
+ return {
101
+ isHighlight: true,
102
+ pushing: false,
103
+ categoryList: [],
104
+ color: "rgb(255,0,1)",
105
+ color_options: [
106
+ "rgb(255,0,1)",
107
+ "rgb(2,209,248)",
108
+ "rgb(147,217,25)",
109
+ "rgb(255,154,2)",
110
+ "rgb(255,44,142)",
111
+ "rgb(142,46,255)",
112
+ ],
113
+ form: {
114
+ category: "",
115
+ tages: [],
116
+ is_top: false,
117
+ is_star: false,
118
+ is_hight: false,
119
+ },
120
+ };
121
+ },
122
+ computed: {
123
+ data: function () {
124
+ return {};
125
+ },
126
+ showColors() {
127
+ return this.form.is_hight;
128
+ },
129
+ params() {
130
+ return {
131
+ ...this.post,
132
+ 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,
137
+ // color: this.color,
138
+ };
139
+ },
140
+ },
141
+ watch: {
142
+ modelValue(val) {
143
+ 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;
157
+ }
158
+ },
159
+ },
160
+ created: function () {
161
+ this.getCategoryList();
162
+ },
163
+ methods: {
164
+ submit() {
165
+ const id = this.post.id;
166
+ if (!id) {
167
+ this.$message.error("ID不存在!");
168
+ return;
169
+ }
170
+ // updateTopicItem(id, this.params).then((res) => {
171
+ this.$message.success("修改成功");
172
+ this.$emit("update:modelValue", false);
173
+ // });
174
+ },
175
+ // 关闭
176
+ close() {
177
+ this.form = {
178
+ category: "",
179
+ tages: [],
180
+ is_top: false,
181
+ is_star: false,
182
+ is_hight: false,
183
+ };
184
+ this.$emit("update:modelValue", false);
185
+ },
186
+ getCategoryList() {
187
+ getTopicBucket({ type: "community" }).then((res) => {
188
+ this.categoryList = res.data.data;
189
+ });
190
+ },
191
+ deleteTopic() {
192
+ const id = this.post.id;
193
+ if (!id) {
194
+ this.$message.error("ID不存在!");
195
+ return;
196
+ }
197
+ this.$confirm("此操作将 删除 该数据, 是否继续?", "提示", {
198
+ confirmButtonText: "确定",
199
+ cancelButtonText: "取消",
200
+ type: "warning",
201
+ }).then(() => {
202
+ deleteTopic(id).then(() => {
203
+ this.$message({
204
+ type: "success",
205
+ message: "删除成功!",
206
+ });
207
+ this.$emit("update:modelValue", false);
208
+ window.location.href = "/community";
209
+ });
210
+ });
211
+ },
212
+ },
213
+ };
214
+ </script>
215
+
216
+ <style lang="less">
217
+ @import "../../assets/css/admin.less";
218
+ </style>
@@ -7,8 +7,8 @@
7
7
  title="迁移至论坛"
8
8
  append-to-body
9
9
  >
10
- <el-form :model="form" ref="form" :label-position="isPhone ? 'top' : 'left'" label-width="80px">
11
- <el-form-item label="分类">
10
+ <el-form :model="form" ref="form" :rules="rules" :label-position="isPhone ? 'top' : 'left'" label-width="80px">
11
+ <el-form-item label="分类" prop="category">
12
12
  <el-select v-model="form.category" placeholder="请选择文章分类" style="width: 100%" filterable>
13
13
  <el-option
14
14
  v-for="item in categoryList"
@@ -45,7 +45,7 @@
45
45
  </div>
46
46
  <template #footer>
47
47
  <el-button @click="close">取 消</el-button>
48
- <el-button type="primary" @click="onConfirm">确 定</el-button>
48
+ <el-button type="primary" @click="onConfirm" :disabled="!checked">确 定</el-button>
49
49
  </template>
50
50
  </el-dialog>
51
51
  </template>
@@ -85,6 +85,9 @@ export default {
85
85
  },
86
86
  categoryList: [],
87
87
  isPhone: window.innerWidth < 768,
88
+ rules: {
89
+ category: [{ required: true, message: "请选择分类", trigger: "blur" }],
90
+ }
88
91
  };
89
92
  },
90
93
  watch: {