@jx3box/jx3box-common-ui 7.8.0 → 7.8.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.
@@ -0,0 +1 @@
1
+ <?xml version="1.0" encoding="UTF-8"?><svg width="24" height="24" viewBox="0 0 48 48" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M18.2838 43.1713C14.9327 42.1736 11.9498 40.3213 9.58787 37.867C10.469 36.8227 11 35.4734 11 34.0001C11 30.6864 8.31371 28.0001 5 28.0001C4.79955 28.0001 4.60139 28.01 4.40599 28.0292C4.13979 26.7277 4 25.3803 4 24.0001C4 21.9095 4.32077 19.8938 4.91579 17.9995C4.94381 17.9999 4.97188 18.0001 5 18.0001C8.31371 18.0001 11 15.3138 11 12.0001C11 11.0488 10.7786 10.1493 10.3846 9.35011C12.6975 7.1995 15.5205 5.59002 18.6521 4.72314C19.6444 6.66819 21.6667 8.00013 24 8.00013C26.3333 8.00013 28.3556 6.66819 29.3479 4.72314C32.4795 5.59002 35.3025 7.1995 37.6154 9.35011C37.2214 10.1493 37 11.0488 37 12.0001C37 15.3138 39.6863 18.0001 43 18.0001C43.0281 18.0001 43.0562 17.9999 43.0842 17.9995C43.6792 19.8938 44 21.9095 44 24.0001C44 25.3803 43.8602 26.7277 43.594 28.0292C43.3986 28.01 43.2005 28.0001 43 28.0001C39.6863 28.0001 37 30.6864 37 34.0001C37 35.4734 37.531 36.8227 38.4121 37.867C36.0502 40.3213 33.0673 42.1736 29.7162 43.1713C28.9428 40.752 26.676 39.0001 24 39.0001C21.324 39.0001 19.0572 40.752 18.2838 43.1713Z" fill="currentColor" stroke="#fff" stroke-width="4" stroke-linejoin="round"/><path d="M24 31C27.866 31 31 27.866 31 24C31 20.134 27.866 17 24 17C20.134 17 17 20.134 17 24C17 27.866 20.134 31 24 31Z" fill="currentColor" stroke="#fff" stroke-width="4" stroke-linejoin="round"/></svg>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jx3box/jx3box-common-ui",
3
- "version": "7.8.0",
3
+ "version": "7.8.2",
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.0",
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",
package/service/admin.js CHANGED
@@ -2,33 +2,33 @@ import { $cms } from "@jx3box/jx3box-common/js/https.js";
2
2
 
3
3
  function getSetting(id) {
4
4
  return $cms()
5
- .get(`/api/cms/post/${id}/query`)
5
+ .get(`/api/cms/manage/post/${id}`)
6
6
  .then((res) => {
7
7
  return res.data.data;
8
8
  });
9
9
  }
10
10
 
11
11
  function postSetting(data) {
12
- return $cms().put(`/api/cms/post/${data.ID}/setting`, data);
12
+ return $cms().put(`/api/cms/manage/post/${data.ID}`, data);
13
13
  }
14
14
 
15
15
  // 管理员发送私信
16
- function sendMessage(data){
16
+ function sendMessage(data) {
17
17
  return $cms().post(`/api/cms/admin/direct-message`, data);
18
18
  }
19
19
 
20
20
  // 管理员新增自定义主题
21
- function addTopicBucket(data){
21
+ function addTopicBucket(data) {
22
22
  return $cms().post(`/api/cms/post/topic/bucket`, data);
23
23
  }
24
24
 
25
25
  // 管理员删除自定义主题
26
- function deleteTopicBucket(id){
26
+ function deleteTopicBucket(id) {
27
27
  return $cms().delete(`/api/cms/post/topic/bucket/${id}`);
28
28
  }
29
29
 
30
30
  // 管理员修改自定义主题
31
- function updateTopicBucket(id, data){
31
+ function updateTopicBucket(id, data) {
32
32
  return $cms().put(`/api/cms/post/topic/bucket/${id}`, data);
33
33
  }
34
34
 
@@ -5,16 +5,18 @@
5
5
  </span>
6
6
  <ul class="u-menu u-pop-content">
7
7
  <li v-for="item in userPanel" :key="item.label">
8
- <a :href="item.link" :target="item.target || '_self'"
9
- ><i :class="item.icon || 'el-icon-present'"></i> {{ item.label }}</a
10
- >
8
+ <a :href="item.link" :target="item.target || '_self'" class="u-menu-item">
9
+ <img :src="resolveImg(item.icon)" svg-inline class="u-menu-icon" :alt="item.icon">
10
+ {{ item.label }}
11
+ </a>
11
12
  </li>
12
13
  <hr v-if="userPanel.length" />
13
14
  <template v-if="isEditor">
14
15
  <li v-for="item in adminPanel" :key="item.label">
15
- <a :href="item.link" :target="item.target || '_self'"
16
- ><i :class="item.icon || 'el-icon-present'"></i> {{ item.label }}</a
17
- >
16
+ <a :href="item.link" :target="item.target || '_self'" class="u-menu-item">
17
+ <img :src="resolveImg(item.icon)" svg-inline class="u-menu-icon" :alt="item.icon">
18
+ {{ item.label }}
19
+ </a>
18
20
  </li>
19
21
  </template>
20
22
  </ul>
@@ -25,6 +27,7 @@
25
27
  import User from "@jx3box/jx3box-common/js/user";
26
28
  import panel from "../../assets/data/panel.json";
27
29
  import { getMenu } from "../../service/header";
30
+ import { __imgPath } from "@jx3box/jx3box-common/data/jx3box.json";
28
31
  export default {
29
32
  name: "Manage",
30
33
  data() {
@@ -67,6 +70,10 @@ export default {
67
70
  console.log("loadPanel error", e);
68
71
  }
69
72
  },
73
+ resolveImg: function (img) {
74
+ // return __imgPath + "image/header/panel/" + img;
75
+ return 'https://img.jx3box.com/image/box/pvp.svg'
76
+ },
70
77
  },
71
78
  };
72
79
  </script>
@@ -75,14 +82,28 @@ export default {
75
82
  // 管理菜单
76
83
  .c-header-manage {
77
84
  height: 100%;
85
+
78
86
  .u-manage {
79
87
  padding: 0 10px 0 8px;
80
88
  height: 100%;
81
89
  .flex;
82
90
  align-items: center;
91
+
83
92
  svg {
84
93
  .size(19px);
85
94
  }
95
+
96
+ }
97
+ .u-menu {
98
+ .u-menu-item {
99
+ .flex;
100
+ align-items: center;
101
+ gap: 4px;
102
+ }
103
+ .u-menu-icon {
104
+ width: 16px;
105
+ height: 16px;
106
+ }
86
107
  }
87
108
  }
88
109
  </style>
@@ -13,13 +13,21 @@
13
13
  <li>
14
14
  <a :href="url.publish">发布中心</a>
15
15
  </li>
16
- <hr />
17
- <li v-if="isAdmin">
18
- <a href="/admin">站点配置</a>
19
- </li>
20
- <li v-if="isEditor">
21
- <a href="https://os.jx3box.com/admin">管理平台</a>
16
+ <hr>
17
+ <li v-for="item in userPanel" :key="item.label">
18
+ <a :href="item.link" :target="item.target || '_self'">
19
+ <!-- <i :class="item.icon || 'el-icon-present'"></i> -->
20
+ {{ item.label }}
21
+ </a>
22
22
  </li>
23
+ <template v-if="isEditor">
24
+ <li v-for="item in adminPanel" :key="item.label">
25
+ <a :href="item.link" :target="item.target || '_self'">
26
+ <!-- <i :class="item.icon || 'el-icon-present'"></i> -->
27
+ {{ item.label }}
28
+ </a>
29
+ </li>
30
+ </template>
23
31
  <li>
24
32
  <a @click="logout">退出登录</a>
25
33
  </li>
@@ -33,26 +41,13 @@
33
41
  showUserName(user.display_name)
34
42
  }}</a>
35
43
  <a class="u-sign" href="/dashboard/cooperation">
36
- <img
37
- :src="super_author_icon"
38
- class="u-superauthor-profile"
39
- alt="superauthor"
40
- title="签约作者"
41
- :class="{ off: !isSuperAuthor }"
42
- /></a>
43
- <a
44
- class="u-vip"
45
- href="/vip/premium?from=header_usermenu"
46
- target="_blank"
47
- title="专业版账号"
48
- >
44
+ <img :src="super_author_icon" class="u-superauthor-profile" alt="superauthor" title="签约作者" :class="{ off: !isSuperAuthor }" /></a>
45
+ <a class="u-vip" href="/vip/premium?from=header_usermenu" target="_blank" title="专业版账号">
49
46
  <i class="i-icon-vip" :class="{ on: isPRO }">{{ vipType }}</i>
50
47
  </a>
51
48
  </div>
52
49
  <div class="u-id">
53
- <span
54
- >魔盒UID:<b>{{ user.ID }}</b></span
55
- >
50
+ <span>魔盒UID:<b>{{ user.ID }}</b></span>
56
51
  <i class="el-icon-document-copy u-copy" @click.stop="copyText(user.ID)"></i>
57
52
  </div>
58
53
  </div>
@@ -66,8 +61,7 @@
66
61
  <div class="u-other">
67
62
  <a href="/dashboard/fav" class="u-item"><i class="el-icon-star-off"></i>收藏订阅 </a>
68
63
  <a href="/team/role/manage" class="u-item"><i class="el-icon-user"></i>角色管理 </a>
69
- <a href="/dashboard/purchases" class="u-item"
70
- ><i class="el-icon-shopping-cart-2"></i>已购资源
64
+ <a href="/dashboard/purchases" class="u-item"><i class="el-icon-shopping-cart-2"></i>已购资源
71
65
  </a>
72
66
  <a href="/dashboard/mall" class="u-item"><i class="el-icon-shopping-bag-1"></i>订单中心 </a>
73
67
  <hr />
@@ -89,6 +83,7 @@ import { showAvatar } from "@jx3box/jx3box-common/js/utils";
89
83
  import { getMyInfo } from "../../service/author";
90
84
  import { __Links, __Root, __imgPath, __OriginRoot } from "@jx3box/jx3box-common/data/jx3box.json";
91
85
  import { copyText } from "../../assets/js/utils";
86
+ import { getMenu } from "../../service/header";
92
87
  export default {
93
88
  name: "info",
94
89
  props: ["asset"],
@@ -107,6 +102,8 @@ export default {
107
102
  },
108
103
 
109
104
  isSuperAuthor: false,
105
+
106
+ panel: [],
110
107
  };
111
108
  },
112
109
  computed: {
@@ -125,17 +122,28 @@ export default {
125
122
  isAdmin() {
126
123
  return User.isAdmin();
127
124
  },
125
+ userPanel: function () {
126
+ return this.panel.filter((item) => {
127
+ return !item.onlyAdmin;
128
+ });
129
+ },
130
+ adminPanel: function () {
131
+ return this.panel.filter((item) => {
132
+ return item.onlyAdmin;
133
+ });
134
+ },
128
135
  isEditor() {
129
136
  return User.isEditor();
130
137
  },
131
138
  },
132
139
  mounted() {
133
140
  this.loadMyInfo();
141
+ this.loadPanel();
134
142
  },
135
143
  methods: {
136
144
  copyText,
137
145
  showAvatar,
138
- logout: function (mute=false) {
146
+ logout: function (mute = false) {
139
147
  User.destroy()
140
148
  .then((res) => {
141
149
  this.$emit("logout");
@@ -157,14 +165,32 @@ export default {
157
165
  return val || "匿名";
158
166
  },
159
167
  loadMyInfo: function () {
160
- getMyInfo().then((data) => {
161
- this.user = data;
162
- this.isSuperAuthor = !!data.sign;
163
- }).catch((err) => {
164
- if (err?.data.code < -1) {
165
- this.logout(true);
168
+ getMyInfo()
169
+ .then((data) => {
170
+ this.user = data;
171
+ this.isSuperAuthor = !!data.sign;
172
+ })
173
+ .catch((err) => {
174
+ if (err?.data.code < -1) {
175
+ this.logout(true);
176
+ }
177
+ });
178
+ },
179
+ loadPanel: function () {
180
+ try {
181
+ const panel = JSON.parse(sessionStorage.getItem("panel"));
182
+ if (panel) {
183
+ this.panel = panel;
184
+ } else {
185
+ getMenu("panel").then((res) => {
186
+ this.panel = res.data?.data?.val;
187
+ sessionStorage.setItem("panel", JSON.stringify(this.panel));
188
+ });
166
189
  }
167
- });
190
+ } catch (e) {
191
+ this.panel = panel;
192
+ console.log("loadPanel error", e);
193
+ }
168
194
  },
169
195
  },
170
196
  };