@jx3box/jx3box-common-ui 7.8.1 → 7.8.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.
Files changed (2) hide show
  1. package/package.json +3 -3
  2. package/src/bread/Admin.vue +49 -52
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jx3box/jx3box-common-ui",
3
- "version": "7.8.1",
3
+ "version": "7.8.3",
4
4
  "description": "JX3BOX UI",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -31,8 +31,8 @@
31
31
  ],
32
32
  "dependencies": {
33
33
  "@jx3box/jx3box-comment-ui": "^1.7.16",
34
- "@jx3box/jx3box-common": "^7.9.15",
35
- "@jx3box/jx3box-data": "^3.4.2",
34
+ "@jx3box/jx3box-common": "^8.0.2",
35
+ "@jx3box/jx3box-data": "^3.5.2",
36
36
  "@jx3box/jx3box-editor": "^1.9.9",
37
37
  "@jx3box/reporter": "^0.0.4",
38
38
  "axios": "^0.26.1",
@@ -11,32 +11,24 @@
11
11
  >
12
12
  <div class="c-admin-wrapper">
13
13
  <!-- <template v-if="isAdmin"> -->
14
- <el-divider content-position="left">状态变更</el-divider>
15
- <el-radio-group v-model="post_status" size="small" class="c-admin-status">
16
- <el-radio-button
17
- v-for="(option, key) in status_options"
18
- :label="key"
19
- :key="key"
20
- >{{ option }}</el-radio-button>
21
- </el-radio-group>
14
+ <el-divider content-position="left">状态变更</el-divider>
15
+ <el-radio-group v-model="post_status" size="small" class="c-admin-status">
16
+ <el-radio-button v-for="(option, key) in status_options" :label="key" :key="key">{{
17
+ option
18
+ }}</el-radio-button>
19
+ </el-radio-group>
22
20
  <!-- </template> -->
23
21
 
24
22
  <el-divider content-position="left">可见性变更</el-divider>
25
23
  <el-radio-group v-model="visible" size="small" class="c-admin-status">
26
- <el-radio-button
27
- v-for="(option, key) in visible_options"
28
- :label="key"
29
- :key="key"
30
- >{{ option }}</el-radio-button>
24
+ <el-radio-button v-for="(option, key) in visible_options" :label="key" :key="key">{{
25
+ option
26
+ }}</el-radio-button>
31
27
  </el-radio-group>
32
28
 
33
29
  <el-divider content-position="left">推荐角标</el-divider>
34
30
  <el-checkbox-group v-model="mark" class="c-admin-mark">
35
- <el-checkbox
36
- v-for="(option, key) in mark_options"
37
- :label="key"
38
- :key="key"
39
- >{{option}}</el-checkbox>
31
+ <el-checkbox v-for="(option, key) in mark_options" :label="key" :key="key">{{ option }}</el-checkbox>
40
32
  </el-checkbox-group>
41
33
 
42
34
  <el-divider content-position="left">加粗高亮</el-divider>
@@ -52,11 +44,7 @@
52
44
  </template>
53
45
 
54
46
  <el-divider content-position="left">是否置顶</el-divider>
55
- <el-switch
56
- v-model="isSticky"
57
- active-text="置顶"
58
- class="switch-post-pinned drawer-item-content"
59
- ></el-switch>
47
+ <el-switch v-model="isSticky" active-text="置顶" class="switch-post-pinned drawer-item-content"></el-switch>
60
48
 
61
49
  <el-divider content-position="left">封面海报</el-divider>
62
50
  <div class="c-admin-banner">
@@ -74,9 +62,7 @@
74
62
  <el-input class="u-banner" v-model="post_banner" size="small">
75
63
  <span slot="prepend">海报地址</span>
76
64
  <span slot="append">
77
- <span class="u-btn" @click="removeBanner">
78
- <i class="el-icon-circle-close"></i> 移除海报
79
- </span>
65
+ <span class="u-btn" @click="removeBanner"> <i class="el-icon-circle-close"></i> 移除海报 </span>
80
66
  </span>
81
67
  </el-input>
82
68
  </div>
@@ -113,11 +99,7 @@
113
99
  <script>
114
100
  import Bus from "../../service/bus";
115
101
  import { getRewrite } from "@jx3box/jx3box-common/js/utils";
116
- import {
117
- __cms,
118
- __postType,
119
- __visibleMap,
120
- } from "@jx3box/jx3box-common/data/jx3box.json";
102
+ import { __cms, __postType, __visibleMap } from "@jx3box/jx3box-common/data/jx3box.json";
121
103
  import { getSetting, postSetting } from "../../service/admin";
122
104
  import User from "@jx3box/jx3box-common/js/user";
123
105
  import { cms as marks } from "@jx3box/jx3box-common/data/mark.json";
@@ -127,7 +109,20 @@ export default {
127
109
  marksOptions: {
128
110
  type: Object,
129
111
  default: () => {},
130
- }
112
+ },
113
+ // 入口是否是后台管理/list
114
+ fromList: {
115
+ type: Boolean,
116
+ default: false,
117
+ },
118
+ show: {
119
+ type: Boolean,
120
+ default: false,
121
+ },
122
+ postId: {
123
+ type: [Number, String],
124
+ default: 0,
125
+ },
131
126
  },
132
127
  data() {
133
128
  return {
@@ -200,12 +195,14 @@ export default {
200
195
  sticky: this.isSticky ? Date.now() : null,
201
196
  };
202
197
  },
203
- isAdmin : function (){
204
- return User.isAdmin()
198
+ isAdmin: function () {
199
+ return User.isAdmin();
200
+ },
201
+ mark_options: function () {
202
+ return this.marksOptions && Object.keys(this.marksOptions)
203
+ ? Object.assign({}, marks, this.marksOptions)
204
+ : marks;
205
205
  },
206
- mark_options: function (){
207
- return this.marksOptions && Object.keys(this.marksOptions) ? Object.assign({}, marks, this.marksOptions) : marks
208
- }
209
206
  },
210
207
  methods: {
211
208
  // 是否有权限
@@ -214,10 +211,7 @@ export default {
214
211
  },
215
212
  // 获取pid
216
213
  checkPostID: function () {
217
- this.pid =
218
- getRewrite("pid") ||
219
- (this.$route && this.$route.params && this.$route.params.id) ||
220
- 0;
214
+ this.pid = getRewrite("pid") || (this.$route && this.$route.params && this.$route.params.id) || 0;
221
215
  },
222
216
  // 获取type
223
217
  checkChannel: function () {
@@ -253,17 +247,7 @@ export default {
253
247
  // 拉
254
248
  pull: function () {
255
249
  getSetting(this.pid).then((data) => {
256
- let {
257
- ID,
258
- color,
259
- mark,
260
- post_status,
261
- post_author,
262
- sticky,
263
- post_banner,
264
- post_type,
265
- visible,
266
- } = data;
250
+ let { ID, color, mark, post_status, post_author, sticky, post_banner, post_type, visible } = data;
267
251
  this.pid = ID;
268
252
  this.post_status = post_status;
269
253
  this.visible = visible;
@@ -289,6 +273,7 @@ export default {
289
273
  push: function () {
290
274
  postSetting(this.data)
291
275
  .then((res) => {
276
+ this.$emit("update", this.data);
292
277
  this.$message({
293
278
  message: "设置成功",
294
279
  type: "success",
@@ -304,6 +289,18 @@ export default {
304
289
  "$route.params.id": function (id) {
305
290
  this.checkPostID();
306
291
  },
292
+ show: {
293
+ immediate: true,
294
+ handler(bol) {
295
+ if (this.fromList) {
296
+ this.dialog_visible = bol;
297
+ if (bol) {
298
+ this.pid = this.postId;
299
+ this.pull();
300
+ }
301
+ }
302
+ },
303
+ },
307
304
  },
308
305
  created: function () {
309
306
  // 是否mount