@jx3box/jx3box-common-ui 9.5.4 → 9.5.7

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": "9.5.4",
3
+ "version": "9.5.7",
4
4
  "description": "JX3BOX UI",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -48,3 +48,13 @@ export function getCommunityTags() {
48
48
  return res.data.data.menus || [];
49
49
  });
50
50
  }
51
+
52
+ // 获取原帖子
53
+ export const getOriginalPost = (id) => {
54
+ return $cms().get(`/api/cms/manage/post/by-community/${id}`);
55
+ }
56
+
57
+ // 迁移帖子
58
+ export const migrateCommunityPost = (data) => {
59
+ return $cms().post(`/api/cms/manage/post/migrate`, data);
60
+ };
@@ -31,7 +31,7 @@
31
31
  <slot name="default"></slot>
32
32
  </div>
33
33
  <div class="m-more" v-if="btnConfig.showMore" @click="setMore">
34
- <!-- <img class="u-icon" src="../assets/img/suspend/more.svg" svg-inline /> -->
34
+ <!-- <img class="u-icon" src="../assets/img/suspend/more.svg" svg-inline /> -->
35
35
  更多
36
36
  </div>
37
37
  </div>
@@ -43,14 +43,25 @@
43
43
  <img class="u-icon" src="../assets/img/suspend/search.svg" svg-inline />
44
44
  </div>
45
45
  <!-- 固定按钮-->
46
- <div v-if="btnConfig.showFixed" class="u-icon-d" @click="clickDrawer({ type: 'pin', text: '固定按钮' }, 1)">
47
- <img class="u-icon active" src="../assets/img/suspend/pin_touchbar_24.svg" svg-inline
48
- v-if="!fixIsActive" />
46
+ <div
47
+ v-if="btnConfig.showFixed"
48
+ class="u-icon-d"
49
+ @click="clickDrawer({ type: 'pin', text: '固定按钮' }, 1)"
50
+ >
51
+ <img
52
+ class="u-icon active"
53
+ src="../assets/img/suspend/pin_touchbar_24.svg"
54
+ svg-inline
55
+ v-if="!fixIsActive"
56
+ />
49
57
  <img class="u-icon active" src="../assets/img/suspend/pin_slash_24.svg" svg-inline v-else />
50
58
  </div>
51
59
  <!-- 收藏按钮-->
52
- <div v-if="btnConfig.showCollect" class="u-icon-d"
53
- @click="clickDrawer({ type: 'collect', text: '收藏' }, 1)">
60
+ <div
61
+ v-if="btnConfig.showCollect"
62
+ class="u-icon-d"
63
+ @click="clickDrawer({ type: 'collect', text: '收藏' }, 1)"
64
+ >
54
65
  <img class="u-icon active" src="../assets/img/suspend/collect.svg" svg-inline v-if="!isCollect" />
55
66
  <img class="u-icon active" src="../assets/img/suspend/collect_slash.svg" svg-inline v-else />
56
67
  </div>
@@ -58,10 +69,9 @@
58
69
  <div v-if="btnConfig.showLaterOn" class="u-icon-d" @click="laterOn">
59
70
  <img class="u-icon" src="../assets/img/suspend/later-on.svg" svg-inline />
60
71
  </div>
61
-
62
72
  </div>
63
73
  <div class="m-more" v-if="btnConfig.showMore" @click="setMore">
64
- <!-- <img class="u-icon" src="../assets/img/suspend/more.svg" svg-inline /> -->
74
+ <!-- <img class="u-icon" src="../assets/img/suspend/more.svg" svg-inline /> -->
65
75
  更多
66
76
  </div>
67
77
  </div>
@@ -69,60 +79,80 @@
69
79
  <div class="m-pin-box" v-if="btnConfig.showPin && !btnConfig.showHome && !btnConfig.showIcon">
70
80
  <div class="u-item" v-for="(item, index) in fixList" :key="'fix' + index">
71
81
  <div class="u-text-r" v-if="item.type == 'text'">
72
- {{ item.title.match(/[\u3400-\u9FFF\uF900-\uFAFF]/)?.[0] || '' }}
82
+ {{ item.title.match(/[\u3400-\u9FFF\uF900-\uFAFF]/)?.[0] || "" }}
73
83
  </div>
74
- <img :src="item.imgUrl" class="u-icon" v-else>
84
+ <img :src="item.imgUrl" class="u-icon" v-else />
75
85
  </div>
76
86
  <!-- 不足三个时显示空位,只在编辑界面显示 -->
77
- <div class="u-item" v-for="(item, index) in (3 - fixList.length)" :key="'fix_no' + index">
78
- <img src="../assets/img/suspend/circle.svg" svg-inline class="u-icon">
87
+ <div class="u-item" v-for="(item, index) in 3 - fixList.length" :key="'fix_no' + index">
88
+ <img src="../assets/img/suspend/circle.svg" svg-inline class="u-icon" />
79
89
  </div>
80
90
  </div>
81
91
  <!-- 抽屉弹出层,支持默认样式和自定义插槽样式 -->
82
- <el-drawer :title="drawerConfig.drawerTitle" :visible.sync="drawer" :direction="drawerConfig.direction"
83
- :with-header="false" custom-class="u-drawer" :modal-append-to-body="false" append-to-body class="p-drawer-suspend" @close="areaKey='home'">
84
-
92
+ <el-drawer
93
+ :title="drawerConfig.drawerTitle"
94
+ :visible.sync="drawer"
95
+ :direction="drawerConfig.direction"
96
+ :with-header="false"
97
+ custom-class="u-drawer"
98
+ :modal-append-to-body="false"
99
+ append-to-body
100
+ class="p-drawer-suspend"
101
+ @close="areaKey = 'home'"
102
+ >
85
103
  <div class="p-drawer-suspend_box p-bt-transition" v-show="areaKey === 'home'">
86
104
  <div class="u-drawer-box">
87
- <div class="u-item top" v-for="item in drawerFiltration(drawerType.one)" :key="item.type"
88
- @click="clickDrawer(item)">
105
+ <div
106
+ class="u-item top"
107
+ v-for="item in drawerFiltration(drawerType.one)"
108
+ :key="item.type"
109
+ @click="clickDrawer(item)"
110
+ >
89
111
  <div class="u-icon" v-if="item.icon || item.icon_slash">
90
- <img :src="item.type == 'pin' ? fixIsActive ? item.icon_slash : item.icon : item.icon"
91
- svg-inline />
112
+ <img
113
+ :src="item.type == 'pin' ? (fixIsActive ? item.icon_slash : item.icon) : item.icon"
114
+ svg-inline
115
+ />
92
116
  </div>
93
117
  <div class="u-self" v-if="item.isSlot">
94
118
  <!-- 三个圆堆叠式展示 -->
95
119
  <div class="u-circle-top">
96
120
  <div v-if="fixList?.[0]">
97
121
  <div class="u-text-r" v-if="fixList?.[0]?.type == 'text'">
98
- {{ fixList?.[0]?.title.match(/[\u3400-\u9FFF\uF900-\uFAFF]/)?.[0] || '' }}
122
+ {{ fixList?.[0]?.title.match(/[\u3400-\u9FFF\uF900-\uFAFF]/)?.[0] || "" }}
99
123
  </div>
100
- <img :src="fixList?.[0]?.imgUrl" class="u-icon" v-else>
124
+ <img :src="fixList?.[0]?.imgUrl" class="u-icon" v-else />
101
125
  </div>
102
126
  <img src="../assets/img/suspend/circle.svg" svg-inline v-else />
103
-
104
127
  </div>
105
128
  <div class="u-circle-bottom">
106
129
  <div class="u-circle" v-for="(item, index) in 2" :key="item">
107
130
  <div v-if="fixList?.[index + 1]">
108
131
  <div class="u-text-r" v-if="fixList?.[index + 1]?.type == 'text'">
109
- {{ fixList?.[index + 1].title.match(/[\u3400-\u9FFF\uF900-\uFAFF]/)?.[0] || '固' }}
132
+ {{
133
+ fixList?.[index + 1].title.match(/[\u3400-\u9FFF\uF900-\uFAFF]/)?.[0] ||
134
+ "固"
135
+ }}
110
136
  </div>
111
- <img :src="fixList?.[index + 1].imgUrl" class="u-icon" v-else>
137
+ <img :src="fixList?.[index + 1].imgUrl" class="u-icon" v-else />
112
138
  </div>
113
139
  <img src="../assets/img/suspend/circle.svg" svg-inline v-else />
114
140
  </div>
115
141
  </div>
116
-
117
142
  </div>
118
143
  <div class="u-text" :class="item.type">
119
- {{ item.type == 'pin' ? fixIsActive ? item.text_slash : item.text : item.text }}
144
+ {{ item.type == "pin" ? (fixIsActive ? item.text_slash : item.text) : item.text }}
120
145
  </div>
121
146
  </div>
147
+ <slot name="drawerBox1"></slot>
122
148
  </div>
123
149
  <div class="u-drawer-box">
124
- <div class="u-item" v-for="item in drawerFiltration(drawerType.two)" :key="item.type"
125
- @click="clickDrawer(item)">
150
+ <div
151
+ class="u-item"
152
+ v-for="item in drawerFiltration(drawerType.two)"
153
+ :key="item.type"
154
+ @click="clickDrawer(item)"
155
+ >
126
156
  <div class="u-icon" v-if="item.icon">
127
157
  <img :src="item.icon" svg-inline />
128
158
  </div>
@@ -130,124 +160,171 @@
130
160
  {{ item.text }}
131
161
  </div>
132
162
  </div>
163
+ <slot name="drawerBox2"></slot>
133
164
  </div>
134
165
  <div class="u-drawer-box">
135
- <div class="u-item" :class="item.type" v-for="item in drawerFiltration(drawerType.three)"
136
- :key="item.type" @click="clickDrawer(item)">
166
+ <div
167
+ class="u-item"
168
+ :class="item.type"
169
+ v-for="item in drawerFiltration(drawerType.three)"
170
+ :key="item.type"
171
+ @click="clickDrawer(item)"
172
+ >
137
173
  <div class="u-author" v-if="item.isSlot">
138
174
  <div class="u-avatar">
139
- <img :src="drawerConfig.author.avatar">
175
+ <img :src="drawerConfig.author.avatar" />
140
176
  <!-- <slot name="avatar"></slot> -->
141
177
  </div>
142
178
  <div class="u-author-name">
143
179
  <!-- <slot name="author"></slot> -->
144
180
  {{ drawerConfig.author.name }}
145
181
  </div>
146
-
147
182
  </div>
148
183
  <div class="u-text" v-if="!item.isSlot">
149
184
  {{ item.text }}
150
185
  </div>
151
186
  </div>
187
+ <slot name="drawerBox3"></slot>
152
188
  </div>
153
189
  </div>
154
190
 
155
191
  <transition name="slide-up">
156
- <!-- 收藏区域 、订阅区域 -->
157
- <div class="p-drawer-collect p-bt-transition" v-show="areaKey === 'collect' || areaKey === 'rss'">
158
- <div class="u-collect-icon">
159
- <img src="../assets/img/suspend/collect_touchbar_100.svg" svg-inline
160
- v-if="areaKey === 'collect' && !isCollect" />
161
- <img src="../assets/img/suspend/collect_slash_touchbar_100.svg" svg-inline
162
- v-if="areaKey === 'collect' && isCollect" />
163
- <img src="../assets/img/suspend/rss_touchbar_100.svg" svg-inline
164
- v-if="areaKey === 'rss' && !isSubscribe" />
165
- <img src="../assets/img/suspend/report_100.svg" svg-inline
166
- v-if="areaKey === 'rss' && isSubscribe" />
167
- <div class="u-text"
168
- v-if="(areaKey === 'collect' && !isCollect) || (areaKey === 'rss' && !isSubscribe)">
169
- {{ areaKey === 'collect' ? '收藏' : '订阅' }}作品
192
+ <!-- 收藏区域 、订阅区域 -->
193
+ <div class="p-drawer-collect p-bt-transition" v-show="areaKey === 'collect' || areaKey === 'rss'">
194
+ <div class="u-collect-icon">
195
+ <img
196
+ src="../assets/img/suspend/collect_touchbar_100.svg"
197
+ svg-inline
198
+ v-if="areaKey === 'collect' && !isCollect"
199
+ />
200
+ <img
201
+ src="../assets/img/suspend/collect_slash_touchbar_100.svg"
202
+ svg-inline
203
+ v-if="areaKey === 'collect' && isCollect"
204
+ />
205
+ <img
206
+ src="../assets/img/suspend/rss_touchbar_100.svg"
207
+ svg-inline
208
+ v-if="areaKey === 'rss' && !isSubscribe"
209
+ />
210
+ <img
211
+ src="../assets/img/suspend/report_100.svg"
212
+ svg-inline
213
+ v-if="areaKey === 'rss' && isSubscribe"
214
+ />
215
+ <div
216
+ class="u-text"
217
+ v-if="(areaKey === 'collect' && !isCollect) || (areaKey === 'rss' && !isSubscribe)"
218
+ >
219
+ {{ areaKey === "collect" ? "收藏" : "订阅" }}作品
220
+ </div>
170
221
  </div>
171
- </div>
172
- <div class="u-collect-tips" v-if="areaKey === 'collect'">
173
- {{ isCollect ? '你已经收藏该作品' : '喜欢程度不够?可以试试添加到稍后再看' }}
174
- </div>
175
- <div class="u-collect-tips" v-if="areaKey === 'rss'">
176
- {{ isSubscribe ? '你已经订阅该作品' : '喜欢程度不够?可以试试添加到稍后再看' }}
177
- </div>
178
- <div class="u-btn-box">
179
- <div class="u-btn collect" @click="collectOrSubscribe">
180
- {{ areaKey === 'collect' ? isCollect ? '取消收藏' : '收藏' : isSubscribe ? '取消订阅' : '订阅' }}作品
222
+ <div class="u-collect-tips" v-if="areaKey === 'collect'">
223
+ {{ isCollect ? "你已经收藏该作品" : "喜欢程度不够?可以试试添加到稍后再看" }}
224
+ </div>
225
+ <div class="u-collect-tips" v-if="areaKey === 'rss'">
226
+ {{ isSubscribe ? "你已经订阅该作品" : "喜欢程度不够?可以试试添加到稍后再看" }}
227
+ </div>
228
+ <div class="u-btn-box">
229
+ <div class="u-btn collect" @click="collectOrSubscribe">
230
+ {{
231
+ areaKey === "collect"
232
+ ? isCollect
233
+ ? "取消收藏"
234
+ : "收藏"
235
+ : isSubscribe
236
+ ? "取消订阅"
237
+ : "订阅"
238
+ }}作品
239
+ </div>
240
+ <div class="u-btn" @click="laterOn">添加到稍后再看</div>
181
241
  </div>
182
- <div class="u-btn" @click="laterOn">添加到稍后再看</div>
183
242
  </div>
184
- </div>
185
243
  </transition>
186
244
  <!-- 固定配置相关页面 -->
187
245
  <transition name="slide-up">
188
- <div class="p-drawer-fix p-bt-transition" v-show="areaKey === 'pin' || areaKey === 'fix'">
189
- <!-- 固定,取消固定,超量 -->
190
- <div class="u-collect-icon" v-if="!fixIsEdit">
191
- <img src="../assets/img/suspend/pin_touchbar_100.svg" svg-inline
192
- v-if="!fixIsActive && !fixIsFull" />
193
- <img src="../assets/img/suspend/pin_slash_touchbar.svg" svg-inline
194
- v-if="fixIsActive && !fixIsFull" />
195
- <img src="../assets/img/suspend/report_100.svg" svg-inline v-if="fixIsFull" />
196
- <div class="u-text">{{ fixIsActive ? '取消固定' : '固定内容' }}</div>
197
- </div>
198
- <div class="u-collect-tips" v-if="!fixIsActive && !fixIsEdit">
199
- 你可以随时在其他页面查看固定的内容
200
- </div>
201
- <div class="u-edit-title" v-if="fixIsEdit">固定内容</div>
202
- <div class="u-pin-box">
203
- <div class="u-item" v-if="!fixIsEdit">
204
- <div class="u-text-r" v-if="fixPageConfig.type == 'text'">
205
- {{ fixPageConfig.title.match(/[\u3400-\u9FFF\uF900-\uFAFF]/)?.[0] || '固' }}
206
- </div>
207
- <img :src="fixPageConfig.imgUrl" class="u-icon" v-else>
208
- <div class="u-text">{{ fixPageConfig.title }}</div>
246
+ <div class="p-drawer-fix p-bt-transition" v-show="areaKey === 'pin' || areaKey === 'fix'">
247
+ <!-- 固定,取消固定,超量 -->
248
+ <div class="u-collect-icon" v-if="!fixIsEdit">
249
+ <img
250
+ src="../assets/img/suspend/pin_touchbar_100.svg"
251
+ svg-inline
252
+ v-if="!fixIsActive && !fixIsFull"
253
+ />
254
+ <img
255
+ src="../assets/img/suspend/pin_slash_touchbar.svg"
256
+ svg-inline
257
+ v-if="fixIsActive && !fixIsFull"
258
+ />
259
+ <img src="../assets/img/suspend/report_100.svg" svg-inline v-if="fixIsFull" />
260
+ <div class="u-text">{{ fixIsActive ? "取消固定" : "固定内容" }}</div>
261
+ </div>
262
+ <div class="u-collect-tips" v-if="!fixIsActive && !fixIsEdit">
263
+ 你可以随时在其他页面查看固定的内容
209
264
  </div>
210
- <!-- 只在编辑界面显示 -->
211
- <div class="u-item" v-for="(item, index) in fixIsEdit ? fixList : []" :key="'fix' + index" @click="fixDataClick(item)">
212
- <div class="u-text-r" v-if="item.type == 'text'">
213
- {{ item.title.match(/[\u3400-\u9FFF\uF900-\uFAFF]/)?.[0] || '' }}
265
+ <div class="u-edit-title" v-if="fixIsEdit">固定内容</div>
266
+ <div class="u-pin-box">
267
+ <div class="u-item" v-if="!fixIsEdit">
268
+ <div class="u-text-r" v-if="fixPageConfig.type == 'text'">
269
+ {{ fixPageConfig.title.match(/[\u3400-\u9FFF\uF900-\uFAFF]/)?.[0] || "固" }}
270
+ </div>
271
+ <img :src="fixPageConfig.imgUrl" class="u-icon" v-else />
272
+ <div class="u-text">{{ fixPageConfig.title }}</div>
214
273
  </div>
215
- <img :src="item.imgUrl" class="u-icon" v-else>
216
- <div class="u-text">{{ item.title }}</div>
217
- <div class="u-slash" v-if="fixIsEdit" @click="cancelFix(item)">
218
- <img src="../assets/img/suspend/pin_slash_touchbar_24.svg" svg-inline />
274
+ <!-- 只在编辑界面显示 -->
275
+ <div
276
+ class="u-item"
277
+ v-for="(item, index) in fixIsEdit ? fixList : []"
278
+ :key="'fix' + index"
279
+ @click="fixDataClick(item)"
280
+ >
281
+ <div class="u-text-r" v-if="item.type == 'text'">
282
+ {{ item.title.match(/[\u3400-\u9FFF\uF900-\uFAFF]/)?.[0] || "固" }}
283
+ </div>
284
+ <img :src="item.imgUrl" class="u-icon" v-else />
285
+ <div class="u-text">{{ item.title }}</div>
286
+ <div class="u-slash" v-if="fixIsEdit" @click="cancelFix(item)">
287
+ <img src="../assets/img/suspend/pin_slash_touchbar_24.svg" svg-inline />
288
+ </div>
289
+ </div>
290
+ <!-- 不足三个时显示空位,只在编辑界面显示 -->
291
+ <div
292
+ class="u-item"
293
+ v-for="(item, index) in fixIsEdit ? 3 - fixList.length : 0"
294
+ :key="'fix_no' + index"
295
+ >
296
+ <img src="../assets/img/suspend/circle.svg" svg-inline class="u-icon" />
219
297
  </div>
220
298
  </div>
221
- <!-- 不足三个时显示空位,只在编辑界面显示 -->
222
- <div class="u-item" v-for="(item, index) in fixIsEdit ? (3 - fixList.length) : 0"
223
- :key="'fix_no' + index">
224
- <img src="../assets/img/suspend/circle.svg" svg-inline class="u-icon">
299
+ <div class="u-btn-box" v-if="!fixIsEdit">
300
+ <div class="u-btn collect" @click="fixClick">确定</div>
301
+ <!-- <div class="u-btn">编辑固定内容</div> -->
302
+ </div>
303
+ <div class="u-collect-tips" v-if="fixIsActive && !fixIsEdit">你可以在原页面再次将其固定</div>
304
+ <div class="u-collect-tips edit" v-if="fixIsEdit">
305
+ 在支持固定的页面可以按
306
+ <img src="../assets/img/suspend/pin_touchbar_24.svg" svg-inline class="u-icon" />
307
+ 将页面固定
225
308
  </div>
226
309
  </div>
227
- <div class="u-btn-box" v-if="!fixIsEdit">
228
- <div class="u-btn collect" @click="fixClick">确定</div>
229
- <!-- <div class="u-btn">编辑固定内容</div> -->
230
- </div>
231
- <div class="u-collect-tips" v-if="fixIsActive && !fixIsEdit">
232
- 你可以在原页面再次将其固定
233
- </div>
234
- <div class="u-collect-tips edit" v-if="fixIsEdit">
235
- 在支持固定的页面可以按
236
- <img src="../assets/img/suspend/pin_touchbar_24.svg" svg-inline class="u-icon" />
237
- 将页面固定
238
- </div>
239
- </div>
240
310
  </transition>
241
- <!-- 固定页面查看数据、或打开其他远程界面-->
311
+ <!-- 固定页面查看数据、或打开其他远程界面-->
242
312
  <transition name="slide-up">
243
- <div class="p-drawer-fixData p-bt-transition" v-show="areaKey === 'fixData'">
244
- <!-- 展开界面图标-->
245
- <div class="u-icon" @click="openUrl">
246
- <img src="../assets/img/suspend/pin_touchbar_24.svg" svg-inline/>
313
+ <div class="p-drawer-fixData p-bt-transition" v-show="areaKey === 'fixData'">
314
+ <!-- 展开界面图标-->
315
+ <div class="u-icon" @click="openUrl">
316
+ <img src="../assets/img/suspend/pin_touchbar_24.svg" svg-inline />
317
+ </div>
318
+ <iframe
319
+ :src="iframeInfo.openurl"
320
+ frameborder="0"
321
+ width="100%"
322
+ height="100%"
323
+ v-if="iframeInfo?.url"
324
+ class="u-iframe"
325
+ />
326
+ <span v-else>查找页面失败</span>
247
327
  </div>
248
- <iframe :src="iframeInfo.openurl" frameborder="0" width="100%" height="100%" v-if="iframeInfo?.url" class="u-iframe"/>
249
- <span v-else>查找页面失败</span>
250
- </div>
251
328
  </transition>
252
329
  </el-drawer>
253
330
  </div>
@@ -271,52 +348,58 @@ import {
271
348
  setCollect,
272
349
  getCollectList,
273
350
  cancelCollect,
274
- } from '../service/suspend'
351
+ } from "../service/suspend";
275
352
  export default {
276
353
  components: {},
277
354
  props: {
278
355
  btnOptions: {
279
356
  type: Object,
280
357
  default: () => {
281
- return {}
282
- }
358
+ return {};
359
+ },
283
360
  },
284
361
  //通用弹出框配置
285
362
  drawerOptions: {
286
363
  type: Object,
287
364
  default: () => {
288
- return {}
365
+ return {};
289
366
  },
290
367
  },
291
368
  //固定页缓存相关配置
292
369
  fixPageOptions: {
293
370
  type: Object,
294
371
  default: () => {
295
- return {}
296
- }
372
+ return {};
373
+ },
297
374
  },
298
375
  },
299
376
  data() {
300
377
  return {
301
378
  isDarkModeStatus: false,
302
379
  drawer: false,
303
- areaKey: 'home',
380
+ areaKey: "home",
304
381
  //弹窗type组合
305
382
  drawerType: {
306
383
  one: [
307
- { type: 'search', text: '搜索内容', icon: require('../assets/img/suspend/search_touchbar.svg') },
308
- { type: 'pin', text: '固定本页', icon: require('../assets/img/suspend/pin_touchbar.svg'), text_slash: '取消固定', icon_slash: require('../assets/img/suspend/pin_slash_touchbar_40.svg') },
309
- { type: 'fix', text: '查看固定', icon: null, isSlot: true },
384
+ { type: "search", text: "搜索内容", icon: require("../assets/img/suspend/search_touchbar.svg") },
385
+ {
386
+ type: "pin",
387
+ text: "固定本页",
388
+ icon: require("../assets/img/suspend/pin_touchbar.svg"),
389
+ text_slash: "取消固定",
390
+ icon_slash: require("../assets/img/suspend/pin_slash_touchbar_40.svg"),
391
+ },
392
+ { type: "fix", text: "查看固定", icon: null, isSlot: true },
310
393
  ],
311
394
  two: [
312
- { type: 'collect', text: '收藏作品', icon: require('../assets/img/suspend/collect_touchbar.svg') },
313
- { type: 'rss', text: '订阅作品', icon: require('../assets/img/suspend/rss_touchbar.svg') },
314
- { type: 'laterOn', text: '稍后再看', icon: require('../assets/img/suspend/lafter_touchbar.svg') },
395
+ { type: "collect", text: "收藏作品", icon: require("../assets/img/suspend/collect_touchbar.svg") },
396
+ { type: "rss", text: "订阅作品", icon: require("../assets/img/suspend/rss_touchbar.svg") },
397
+ { type: "laterOn", text: "稍后再看", icon: require("../assets/img/suspend/lafter_touchbar.svg") },
315
398
  ],
316
399
  three: [
317
- { type: 'user', text: '作者', isSlot: true, },
318
- { type: 'report', text: '举报' },
319
- ]
400
+ { type: "user", text: "作者", isSlot: true },
401
+ { type: "report", text: "举报" },
402
+ ],
320
403
  },
321
404
  fixList: [],
322
405
  fixIsEdit: false, //固定页是否编辑状态
@@ -326,7 +409,7 @@ export default {
326
409
  //是否已订阅
327
410
  isSubscribe: false,
328
411
  subscribeInfo: {},
329
- iframeInfo:{}
412
+ iframeInfo: {},
330
413
  };
331
414
  },
332
415
  computed: {
@@ -340,39 +423,39 @@ export default {
340
423
  showCollect: true, //是否显示收藏图标
341
424
  showLaterOn: true, //是否显示稍后再看图标
342
425
  showMore: true, //是否显示更多
343
- }
426
+ };
344
427
  return Object.assign({}, defaultConfig, this.btnOptions);
345
428
  },
346
429
  drawerConfig() {
347
430
  const defaultConfig = {
348
- hideType: ['report'], //需要隐藏的type,如['search','pin']
349
- direction: 'btt', //弹出框方向,btt、ttb、rtl、ltr
350
- drawerTitle: '',//弹出框标题
431
+ hideType: ["report"], //需要隐藏的type,如['search','pin']
432
+ direction: "btt", //弹出框方向,btt、ttb、rtl、ltr
433
+ drawerTitle: "", //弹出框标题
351
434
  author: {
352
- name: '', //作者名称
353
- avatar: '', //作者头像
354
- author_id: '', //作者id
435
+ name: "", //作者名称
436
+ avatar: "", //作者头像
437
+ author_id: "", //作者id
355
438
  },
356
- subscribeType: '', //订阅类型,用于区分调用百科、文章、作者、帖子等订阅接口,
357
- postType: '',//订阅、收藏接口的type,如'face','bps','article'等
358
- id: '', //页面数据ID,用于收藏订阅操作
359
- title: document.title || '', //默认固定标题,默认取页面标题
439
+ subscribeType: "", //订阅类型,用于区分调用百科、文章、作者、帖子等订阅接口,
440
+ postType: "", //订阅、收藏接口的type,如'face','bps','article'等
441
+ id: "", //页面数据ID,用于收藏订阅操作
442
+ title: document.title || "", //默认固定标题,默认取页面标题
360
443
  url: window.location.href, //默认取浏览器地址
361
444
  laterOn: {
362
445
  author_id: 0,
363
- content_meta_id: 0
364
- }
365
- }
446
+ content_meta_id: 0,
447
+ },
448
+ };
366
449
  return Object.assign({}, defaultConfig, this.drawerOptions);
367
450
  },
368
451
  fixPageConfig() {
369
452
  const defaultConfig = {
370
- key: 'jx3box-common-fixed', //默认本地缓存Key
371
- type: 'text', //默认固定类型,text、img
372
- imgUrl: '', //type是img时需传入图片url用作显示
373
- title: document.title || '', //默认固定标题,默认取页面标题
453
+ key: "jx3box-common-fixed", //默认本地缓存Key
454
+ type: "text", //默认固定类型,text、img
455
+ imgUrl: "", //type是img时需传入图片url用作显示
456
+ title: document.title || "", //默认固定标题,默认取页面标题
374
457
  url: window.location.href, //默认取浏览器地址
375
- }
458
+ };
376
459
  return Object.assign({}, defaultConfig, this.fixPageOptions);
377
460
  },
378
461
  //通过drawerConfig判断是否显示弹窗
@@ -389,7 +472,7 @@ export default {
389
472
  },
390
473
  // 通过fixList判断当前界面是否已经存在固定列表内
391
474
  fixIsActive() {
392
- return this.fixList.some(item => item.url === this.fixPageConfig.url);
475
+ return this.fixList.some((item) => item.url === this.fixPageConfig.url);
393
476
  },
394
477
  },
395
478
  created() {
@@ -401,23 +484,23 @@ export default {
401
484
  methods: {
402
485
  isDarkModeFun() {
403
486
  // 使用 window.matchMedia 检查系统是否启用了暗色模式
404
- const mediaQueryList = window.matchMedia('(prefers-color-scheme: dark)');
487
+ const mediaQueryList = window.matchMedia("(prefers-color-scheme: dark)");
405
488
  this.isDarkModeStatus = mediaQueryList.matches;
406
489
  },
407
490
  //搜索按钮点击事件
408
491
  search() {
409
- this.$emit('search');
492
+ this.$emit("search");
410
493
  },
411
494
  //打开更多弹窗,父级界面如需在界面其他操作后打开,可通过ref调用此方法
412
495
  // 例如:this.$refs.suspendCommon.setMore()
413
496
  setMore() {
414
497
  this.drawer = true;
415
- this.areaKey = 'home'
498
+ this.areaKey = "home";
416
499
  },
417
500
  // 筛选弹窗type,过滤掉需隐藏的type
418
501
  drawerFiltration(arr) {
419
502
  if (this.drawerConfig.hideType.length > 0) {
420
- return arr.filter(item => !this.drawerConfig.hideType.includes(item.type));
503
+ return arr.filter((item) => !this.drawerConfig.hideType.includes(item.type));
421
504
  }
422
505
  return arr;
423
506
  },
@@ -431,31 +514,30 @@ export default {
431
514
  clickDrawer(item, type) {
432
515
  if (type == 1) this.drawer = true;
433
516
  // 支持切换界面的 type
434
- let switchType = ['collect', 'rss', 'pin', 'fix'];
517
+ let switchType = ["collect", "rss", "pin", "fix"];
435
518
  if (switchType.includes(item.type)) {
436
519
  this.areaKey = item.type;
437
520
  }
438
521
  // 如果点击的是search
439
- if (item.type === 'search') {
522
+ if (item.type === "search") {
440
523
  this.search();
441
524
  }
442
525
  //查看固定页转到编辑状态
443
- if (item.type === 'fix') {
526
+ if (item.type === "fix") {
444
527
  this.fixIsEdit = true;
445
528
  } else {
446
529
  this.fixIsEdit = false;
447
530
  }
448
531
  //稍后在看处理
449
- if (item.type === 'laterOn') this.laterOn()
532
+ if (item.type === "laterOn") this.laterOn();
450
533
  //点击作者
451
- console.log(item)
452
- if (item.type === 'user') {
453
- let url = '/author/' + this.drawerConfig.author.author_id;
454
- this.iframeInfo={url:url,openurl:url};
455
- this.areaKey='fixData'
456
-
534
+ console.log(item);
535
+ if (item.type === "user") {
536
+ let url = "/author/" + this.drawerConfig.author.author_id;
537
+ this.iframeInfo = { url: url, openurl: url };
538
+ this.areaKey = "fixData";
457
539
  }
458
- this.$emit('clickBtn', { type: item.type, text: item.text });
540
+ this.$emit("clickBtn", { type: item.type, text: item.text });
459
541
  },
460
542
  /**
461
543
  * @description: 固定页的确认点击事件,操作结束后areaKey转到home界面
@@ -466,7 +548,7 @@ export default {
466
548
  if (this.fixIsFull) return;
467
549
  // 判断是否已经存在,存在则执行删除操作
468
550
  if (this.fixIsActive) {
469
- this.fixList = this.fixList.filter(item => item.url !== this.fixPageConfig.url);
551
+ this.fixList = this.fixList.filter((item) => item.url !== this.fixPageConfig.url);
470
552
  localStorage.setItem(this.fixPageConfig.key, JSON.stringify(this.fixList));
471
553
  } else {
472
554
  let json = {
@@ -474,12 +556,12 @@ export default {
474
556
  title: this.fixPageConfig.title,
475
557
  url: this.fixPageConfig.url,
476
558
  imgUrl: this.fixPageConfig.imgUrl,
477
- }
559
+ };
478
560
  this.fixList.push(json);
479
561
  localStorage.setItem(this.fixPageConfig.key, JSON.stringify(this.fixList));
480
562
  }
481
- this.areaKey = 'home';
482
- this.$emit('fixPage');
563
+ this.areaKey = "home";
564
+ this.$emit("fixPage");
483
565
  },
484
566
 
485
567
  /**
@@ -488,191 +570,190 @@ export default {
488
570
  * @return {*}
489
571
  * */
490
572
  cancelFix(value) {
491
- this.fixList = this.fixList.filter(item => item.url !== value.url);
573
+ this.fixList = this.fixList.filter((item) => item.url !== value.url);
492
574
  localStorage.setItem(this.fixPageConfig.key, JSON.stringify(this.fixList));
493
- this.areaKey = 'home';
494
- this.$emit('fixCancelIndividually');
575
+ this.areaKey = "home";
576
+ this.$emit("fixCancelIndividually");
495
577
  },
496
578
  /**
497
579
  * @description: 固定数据点击查看,默认追加disabled标识,弹出层需隐藏掉按钮处理,点击展开按钮后跳转进页面
498
580
  * @param {*} value
499
581
  */
500
582
  fixDataClick(value) {
501
- if(value.url.indexOf('?') !=-1){
502
- value.openurl= value.url+'&disabled=true'
503
- }else{
504
- value.openurl= value.url+'?disabled=true'
583
+ if (value.url.indexOf("?") != -1) {
584
+ value.openurl = value.url + "&disabled=true";
585
+ } else {
586
+ value.openurl = value.url + "?disabled=true";
505
587
  }
506
- this.iframeInfo=value;
507
- this.areaKey='fixData'
508
- this.$emit('fixDataSwitch')
588
+ this.iframeInfo = value;
589
+ this.areaKey = "fixData";
590
+ this.$emit("fixDataSwitch");
509
591
  },
510
592
  //打开界面
511
- openUrl(){
512
- location.href=this.iframeInfo.url;
593
+ openUrl() {
594
+ location.href = this.iframeInfo.url;
513
595
  },
514
596
  /**
515
597
  * @description: 收藏或订阅,操作完成后areaKey转到home界面
516
598
  * @return {*}
517
599
  */
518
600
  collectOrSubscribe() {
519
- this.areaKey == 'collect' ? this.collect() : this.subscribe()
601
+ this.areaKey == "collect" ? this.collect() : this.subscribe();
520
602
  },
521
603
 
522
604
  /**
523
605
  * @description: 收藏或取消操作,操作完成后更新界面,无需跳转
524
606
  */
525
607
  collect() {
526
- let drawerConfig = this.drawerConfig
608
+ let drawerConfig = this.drawerConfig;
527
609
  if (this.isCollect) {
528
610
  //取消,需传入收藏id
529
- cancelCollect(this.collectInfo.id,).then(res => {
611
+ cancelCollect(this.collectInfo.id).then((res) => {
530
612
  this.isCollect = false;
531
- this.collectInfo = {}
532
- })
613
+ this.collectInfo = {};
614
+ });
533
615
  } else {
534
- setCollect(drawerConfig.id, drawerConfig.postType, drawerConfig.title).then(res => {
616
+ setCollect(drawerConfig.id, drawerConfig.postType, drawerConfig.title).then((res) => {
535
617
  this.isCollect = true;
536
- this.collectInfo = res.data?.data
537
- })
618
+ this.collectInfo = res.data?.data;
619
+ });
538
620
  }
539
- this.$emit('collect', { isCollect: this.isCollect });
621
+ this.$emit("collect", { isCollect: this.isCollect });
540
622
  },
541
623
  //获取收藏信息
542
624
  getCollectInfo() {
543
- if(!this.drawerConfig.id && !this.drawerConfig.postType) return;
544
- getCollectList(this.drawerConfig.id, this.drawerConfig.postType).then(res => {
545
- this.collectInfo = res.data.data
546
- this.isCollect = this.collectInfo?.id > 0
547
- })
625
+ if (!this.drawerConfig.id && !this.drawerConfig.postType) return;
626
+ getCollectList(this.drawerConfig.id, this.drawerConfig.postType).then((res) => {
627
+ this.collectInfo = res.data.data;
628
+ this.isCollect = this.collectInfo?.id > 0;
629
+ });
548
630
  },
549
631
  /**
550
632
  * @description: 订阅或取消操作,操作完成后更新界面,无需跳转,需根据subscribeType判断接口调用
551
633
  */
552
634
  subscribe() {
553
- let drawerConfig = this.drawerConfig
635
+ let drawerConfig = this.drawerConfig;
554
636
  // 作者相关接口
555
- if (drawerConfig.subscribeType === 'author') {
637
+ if (drawerConfig.subscribeType === "author") {
556
638
  if (this.isSubscribe) {
557
- unsubscribeAuthor(drawerConfig.author.author_id).then(res => {
639
+ unsubscribeAuthor(drawerConfig.author.author_id).then((res) => {
558
640
  this.isSubscribe = false;
559
- this.subscribeInfo = {}
560
- this.$emit('subscribe', { isSubscribe: this.isSubscribe });
561
- })
641
+ this.subscribeInfo = {};
642
+ this.$emit("subscribe", { isSubscribe: this.isSubscribe });
643
+ });
562
644
  } else {
563
- subscribeAuthor(drawerConfig.author.author_id, { title: drawerConfig.title }).then(res => {
645
+ subscribeAuthor(drawerConfig.author.author_id, { title: drawerConfig.title }).then((res) => {
564
646
  this.isSubscribe = true;
565
- this.subscribeInfo = res.data?.data
566
- this.$emit('subscribe', { isSubscribe: this.isSubscribe });
567
- })
647
+ this.subscribeInfo = res.data?.data;
648
+ this.$emit("subscribe", { isSubscribe: this.isSubscribe });
649
+ });
568
650
  }
569
651
  }
570
652
  //帖子
571
- if (drawerConfig.subscribeType === 'community') {
653
+ if (drawerConfig.subscribeType === "community") {
572
654
  if (this.isSubscribe) {
573
- unsubscribePost(drawerConfig.id).then(res => {
655
+ unsubscribePost(drawerConfig.id).then((res) => {
574
656
  this.isSubscribe = false;
575
- this.subscribeInfo = {}
576
- this.$emit('subscribe', { isSubscribe: this.isSubscribe });
577
- })
657
+ this.subscribeInfo = {};
658
+ this.$emit("subscribe", { isSubscribe: this.isSubscribe });
659
+ });
578
660
  } else {
579
- subscribePost(drawerConfig.id, { title: drawerConfig.title }).then(res => {
661
+ subscribePost(drawerConfig.id, { title: drawerConfig.title }).then((res) => {
580
662
  this.isSubscribe = true;
581
- this.subscribeInfo = res.data?.data
582
- this.$emit('subscribe', { isSubscribe: this.isSubscribe });
583
- })
663
+ this.subscribeInfo = res.data?.data;
664
+ this.$emit("subscribe", { isSubscribe: this.isSubscribe });
665
+ });
584
666
  }
585
667
  }
586
668
  //文章
587
- if (drawerConfig.subscribeType === 'posts') {
669
+ if (drawerConfig.subscribeType === "posts") {
588
670
  if (this.isSubscribe) {
589
- unsubscribeArticle(drawerConfig.postType, drawerConfig.id).then(res => {
671
+ unsubscribeArticle(drawerConfig.postType, drawerConfig.id).then((res) => {
590
672
  this.isSubscribe = false;
591
- this.subscribeInfo = {}
592
- this.$emit('subscribe', { isSubscribe: this.isSubscribe });
593
- })
673
+ this.subscribeInfo = {};
674
+ this.$emit("subscribe", { isSubscribe: this.isSubscribe });
675
+ });
594
676
  } else {
595
- subscribeArticle(drawerConfig.postType, drawerConfig.id, { title: drawerConfig.title }).then(res => {
596
- this.isSubscribe = true;
597
- this.subscribeInfo = res.data?.data
598
- this.$emit('subscribe', { isSubscribe: this.isSubscribe });
599
- })
677
+ subscribeArticle(drawerConfig.postType, drawerConfig.id, { title: drawerConfig.title }).then(
678
+ (res) => {
679
+ this.isSubscribe = true;
680
+ this.subscribeInfo = res.data?.data;
681
+ this.$emit("subscribe", { isSubscribe: this.isSubscribe });
682
+ }
683
+ );
600
684
  }
601
685
  }
602
686
  //百科
603
- if (drawerConfig.subscribeType === 'wiki') {
687
+ if (drawerConfig.subscribeType === "wiki") {
604
688
  if (this.isSubscribe) {
605
- unsubscribeWiki(drawerConfig.postType, drawerConfig.id).then(res => {
689
+ unsubscribeWiki(drawerConfig.postType, drawerConfig.id).then((res) => {
606
690
  this.isSubscribe = false;
607
- this.subscribeInfo = {}
608
- this.$emit('subscribe', { isSubscribe: this.isSubscribe });
609
- })
691
+ this.subscribeInfo = {};
692
+ this.$emit("subscribe", { isSubscribe: this.isSubscribe });
693
+ });
610
694
  } else {
611
- subscribeWiki(drawerConfig.postType, drawerConfig.id, { title: drawerConfig.title }).then(res => {
695
+ subscribeWiki(drawerConfig.postType, drawerConfig.id, { title: drawerConfig.title }).then((res) => {
612
696
  this.isSubscribe = true;
613
- this.subscribeInfo = res.data?.data
614
- this.$emit('subscribe', { isSubscribe: this.isSubscribe });
615
- })
697
+ this.subscribeInfo = res.data?.data;
698
+ this.$emit("subscribe", { isSubscribe: this.isSubscribe });
699
+ });
616
700
  }
617
701
  }
618
-
619
702
  },
620
703
  /**
621
704
  * 订阅状态查询
622
705
  */
623
706
  getSubscribeInfo() {
624
- let drawerConfig = this.drawerConfig
707
+ let drawerConfig = this.drawerConfig;
625
708
  // 作者相关接口
626
- if (drawerConfig.subscribeType === 'author' && drawerConfig.author.author_id) {
627
- getSubscribeStatus(drawerConfig.author.author_id).then(res => {
628
- this.isSubscribe = res.data.data?.subscribed
629
- this.subscribeInfo = res.data.data
630
- })
709
+ if (drawerConfig.subscribeType === "author" && drawerConfig.author.author_id) {
710
+ getSubscribeStatus(drawerConfig.author.author_id).then((res) => {
711
+ this.isSubscribe = res.data.data?.subscribed;
712
+ this.subscribeInfo = res.data.data;
713
+ });
631
714
  }
632
715
  //帖子
633
- if (drawerConfig.subscribeType === 'community' && drawerConfig.id) {
634
- getSubscribePostStatus(drawerConfig.id).then(res => {
635
- this.isSubscribe = res.data.data?.subscribed
636
- this.subscribeInfo = res.data.data
637
- })
716
+ if (drawerConfig.subscribeType === "community" && drawerConfig.id) {
717
+ getSubscribePostStatus(drawerConfig.id).then((res) => {
718
+ this.isSubscribe = res.data.data?.subscribed;
719
+ this.subscribeInfo = res.data.data;
720
+ });
638
721
  }
639
722
  //文章
640
- if (drawerConfig.subscribeType === 'posts' && drawerConfig.id && drawerConfig.postType) {
641
- getSubscribeArticleStatus(drawerConfig.postType, drawerConfig.id).then(res => {
642
- this.isSubscribe = res.data.data?.subscribed
643
- this.subscribeInfo = res.data.data
644
- })
723
+ if (drawerConfig.subscribeType === "posts" && drawerConfig.id && drawerConfig.postType) {
724
+ getSubscribeArticleStatus(drawerConfig.postType, drawerConfig.id).then((res) => {
725
+ this.isSubscribe = res.data.data?.subscribed;
726
+ this.subscribeInfo = res.data.data;
727
+ });
645
728
  }
646
729
  //百科
647
- if (drawerConfig.subscribeType === 'wiki' && drawerConfig.id && drawerConfig.postType) {
648
- getSubscribeWikiStatus(drawerConfig.postType, drawerConfig.id).then(res => {
649
- this.isSubscribe = res.data.data?.subscribed
650
- this.subscribeInfo = res.data.data
651
-
652
- })
730
+ if (drawerConfig.subscribeType === "wiki" && drawerConfig.id && drawerConfig.postType) {
731
+ getSubscribeWikiStatus(drawerConfig.postType, drawerConfig.id).then((res) => {
732
+ this.isSubscribe = res.data.data?.subscribed;
733
+ this.subscribeInfo = res.data.data;
734
+ });
653
735
  }
654
736
  },
655
737
  /**
656
- * @description: 稍后再看,操作完成后areaKey转到home界面
657
- * @return {*}
658
- */
738
+ * @description: 稍后再看,操作完成后areaKey转到home界面
739
+ * @return {*}
740
+ */
659
741
  laterOn() {
660
- let drawerConfig = this.drawerConfig
742
+ let drawerConfig = this.drawerConfig;
661
743
  let params = {
662
744
  author_id: parseInt(drawerConfig.laterOn.author_id),
663
745
  banner: "",
664
746
  category: drawerConfig.postType,
665
747
  content_meta_id: parseInt(drawerConfig.laterOn.content_meta_id),
666
748
  link: drawerConfig.url,
667
- title: drawerConfig.title
668
- }
669
- later(params).then(res => {
670
- console.log(res)
749
+ title: drawerConfig.title,
750
+ };
751
+ later(params).then((res) => {
752
+ console.log(res);
671
753
  this.$message.success("已添加稍后再看");
672
- this.areaKey = 'home';
673
- this.$emit('laterOn');
674
- })
675
-
754
+ this.areaKey = "home";
755
+ this.$emit("laterOn");
756
+ });
676
757
  },
677
758
  },
678
759
  };
@@ -27,12 +27,16 @@
27
27
  <el-dropdown-item icon="el-icon-upload" command="designTask" v-if="hasPermission('push_banner')">
28
28
  <span>推送</span>
29
29
  </el-dropdown-item>
30
+ <el-dropdown-item command="migrate" v-if="isCommunity" icon="el-icon-refresh">
31
+ <span>迁移</span>
32
+ </el-dropdown-item>
30
33
  </el-dropdown-menu>
31
34
  </el-dropdown>
32
35
 
33
36
  <design-task v-model="showDesignTask" :post="post"></design-task>
34
37
  <CommunityAdmin v-model="communityAdminVisible" :postId="post && post.id" />
35
38
  <MoveToCommunityDialog v-model="moveVisible" :post="post" />
39
+ <MigrateCommunity v-model="showMigrate" :communityId="sourceId" />
36
40
  </div>
37
41
  </template>
38
42
 
@@ -41,6 +45,7 @@ import Bus from "../../service/bus";
41
45
  import User from "@jx3box/jx3box-common/js/user";
42
46
  import DesignTask from "./DesignTask.vue";
43
47
  import MoveToCommunityDialog from "./MoveToCommunityDialog.vue";
48
+ import MigrateCommunity from "./MigrateCommunity.vue";
44
49
  import { sendMessage } from "../../service/admin";
45
50
  import CommunityAdmin from "./CommunityAdmin.vue";
46
51
  import { editLink } from "@jx3box/jx3box-common/js/utils";
@@ -50,6 +55,7 @@ export default {
50
55
  DesignTask,
51
56
  MoveToCommunityDialog,
52
57
  CommunityAdmin,
58
+ MigrateCommunity,
53
59
  },
54
60
  props: {
55
61
  isCommunity: {
@@ -78,6 +84,7 @@ export default {
78
84
  moveVisible: false,
79
85
  communityAdminVisible: false,
80
86
  showDesignTask: false,
87
+ showMigrate: false,
81
88
  };
82
89
  },
83
90
  computed: {
@@ -151,6 +158,9 @@ export default {
151
158
  hasPermission(permission) {
152
159
  return User.hasPermission(permission);
153
160
  },
161
+ migrate() {
162
+ this.showMigrate = true;
163
+ },
154
164
  },
155
165
  };
156
166
  </script>
@@ -0,0 +1,178 @@
1
+ <template>
2
+ <el-dialog
3
+ custom-class="w-dialog m-migrate-dialog"
4
+ :width="isPhone ? '95%' : '600px'"
5
+ :visible="modelValue"
6
+ @close="close"
7
+ title="迁回原板块"
8
+ append-to-body
9
+ draggable
10
+ >
11
+ <div class="m-migrate-box" v-if="post">
12
+ <div class="m-item">
13
+ <div class="u-label">标题</div>
14
+ <div class="u-value">{{ post.post_title }}</div>
15
+ </div>
16
+ <div class="m-item">
17
+ <div class="u-label">作者</div>
18
+ <div class="u-value"><a target="_blank" :href="authorLink(post.post_author)">{{ `${post.author}` }}</a></div>
19
+ </div>
20
+ <div class="m-item">
21
+ <div class="u-label">原板块</div>
22
+ <div class="u-value">{{ showType(post.post_type) }}</div>
23
+ </div>
24
+ <div class="m-item">
25
+ <div class="u-label">原链接</div>
26
+ <div class="u-value"><a target="_blank" :href="postLink(post.post_type, post.ID)">查看</a></div>
27
+ </div>
28
+ </div>
29
+ <template #footer>
30
+ <el-button @click="close" :loading="loading">关闭</el-button>
31
+ <el-button type="primary" @click="submit" :loading="loading">确认</el-button>
32
+ </template>
33
+ </el-dialog>
34
+ </template>
35
+
36
+ <script>
37
+ import { getOriginalPost, migrateCommunityPost } from "../../service/community";
38
+ import { postLink, authorLink } from "@jx3box/jx3box-common/js/utils";
39
+ import {__postType} from "@jx3box/jx3box-common/data/jx3box.json";
40
+ export default {
41
+ name: "MigrateCommunity",
42
+ props: {
43
+ modelValue: {
44
+ type: Boolean,
45
+ default: false,
46
+ },
47
+ communityId: {
48
+ type: Number,
49
+ default: 5967,
50
+ },
51
+ },
52
+ model: {
53
+ prop: "modelValue",
54
+ event: "update:modelValue",
55
+ },
56
+ emits: ["update:modelValue"],
57
+ data() {
58
+ return {
59
+ post: null,
60
+ isPhone: window.innerWidth < 768,
61
+
62
+ loading: false,
63
+ };
64
+ },
65
+ watch: {
66
+ modelValue(val) {
67
+ if (val) {
68
+ if (this.communityId) {
69
+ this.loadPost();
70
+ }
71
+ }
72
+ },
73
+ },
74
+ methods: {
75
+ postLink,
76
+ authorLink,
77
+ close() {
78
+ this.$emit("update:modelValue", false);
79
+ },
80
+ loadPost() {
81
+ getOriginalPost(this.communityId).then((res) => {
82
+ this.post = res.data.data;
83
+ });
84
+ },
85
+ submit() {
86
+ this.$confirm("确认将该帖子迁回原板块?").then(() => {
87
+ this.loading = true;
88
+ migrateCommunityPost({ community_id: this.communityId }).then((res) => {
89
+ this.$message.success("迁移成功");
90
+ this.close();
91
+ }).finally(() => {
92
+ this.loading = false;
93
+ });
94
+ }).catch(() => {
95
+ // 取消操作
96
+ });
97
+ },
98
+ showType(type) {
99
+ return __postType[type] || type;
100
+ },
101
+ },
102
+ };
103
+ </script>
104
+
105
+ <style lang="less">
106
+ .m-migrate-dialog {
107
+ .el-dialog__body {
108
+ padding-top: 20px;
109
+ }
110
+ }
111
+
112
+ // 参考 Element UI Descriptions 样式
113
+ .m-migrate-box {
114
+ border: 1px solid #ebeef5;
115
+ border-radius: 4px;
116
+ background-color: #fff;
117
+
118
+ .m-item {
119
+ display: flex;
120
+ border-bottom: 1px solid #ebeef5;
121
+
122
+ &:last-child {
123
+ border-bottom: none;
124
+ }
125
+
126
+ .u-label {
127
+ width: 60px;
128
+ min-width: 60px;
129
+ padding: 12px 16px;
130
+ font-weight: bold;
131
+ color: #303133;
132
+ background-color: #fafafa;
133
+ border-right: 1px solid #ebeef5;
134
+ display: flex;
135
+ align-items: center;
136
+ font-size: 14px;
137
+ }
138
+
139
+ .u-value {
140
+ flex: 1;
141
+ padding: 12px 16px;
142
+ color: #606266;
143
+ word-break: break-all;
144
+ display: flex;
145
+ align-items: center;
146
+ font-size: 14px;
147
+ line-height: 1.6;
148
+
149
+ a {
150
+ color: #409eff;
151
+ text-decoration: none;
152
+ transition: color 0.3s;
153
+
154
+ &:hover {
155
+ color: #66b1ff;
156
+ }
157
+ }
158
+ }
159
+ }
160
+
161
+ // 响应式处理
162
+ @media screen and (max-width: 768px) {
163
+ .m-item {
164
+ flex-direction: column;
165
+
166
+ .u-label {
167
+ width: 100%;
168
+ border-right: none;
169
+ border-bottom: 1px solid #ebeef5;
170
+ }
171
+
172
+ .u-value {
173
+ width: 100%;
174
+ }
175
+ }
176
+ }
177
+ }
178
+ </style>