@jx3box/jx3box-vue3-ui 0.3.8 → 0.4.0

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-vue3-ui",
3
- "version": "0.3.8",
3
+ "version": "0.4.0",
4
4
  "description": "JX3BOX Vue3 UI",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -7,7 +7,7 @@
7
7
  <meta name="renderer" content="webkit" />
8
8
  <title><%= htmlWebpackPlugin.options.title %></title>
9
9
  <link rel="icon" href="<%= BASE_URL %>favicon.ico" />
10
- <script src="https://cdn.deepberry.cn/static/tinymce/tinymce.min.js?v=0.1.0"></script>
10
+ <script src="https://cdn.jx3box.com/static/tinymce/tinymce.min.js?v=1.8.8"></script>
11
11
  <!-- TODO: -->
12
12
  <!-- <script src="http://localhost:3000/tinymce.min.js"></script> -->
13
13
  </head>
@@ -1,5 +1,5 @@
1
1
  import axios from "axios";
2
- import { __node, __helperUrl } from "@jx3box/jx3box-common/data/jx3box.json";
2
+ const { __node, __helperUrl } = require("@jx3box/jx3box-common/data/jx3box.json");
3
3
  import { $node } from "@jx3box/jx3box-common/js/https_v2";
4
4
 
5
5
  function loadResource(type, query, params) {
@@ -155,7 +155,7 @@
155
155
  import { loadStat } from "../../service/database";
156
156
  import { loadAuthors, loadEmotions } from "../../service/cms";
157
157
  import { getUserInfo } from "../../service/author";
158
- import { __Root, __OriginRoot, __imgPath } from "@jx3box/jx3box-common/data/jx3box.json";
158
+ const { __Root, __OriginRoot, __imgPath } = require("@jx3box/jx3box-common/data/jx3box.json");
159
159
  import { getLink, showAvatar, resolveImagePath } from "@jx3box/jx3box-common/js/utils";
160
160
  import User from "@jx3box/jx3box-common/js/user";
161
161
 
@@ -282,7 +282,7 @@
282
282
  <script>
283
283
  import { loadResource, loadStat, getIcons } from "../../service/database";
284
284
  import { loadEmotions } from "../../service/cms";
285
- import { __iconPath, __Root, __OriginRoot } from "@jx3box/jx3box-common/data/jx3box.json";
285
+ const { __iconPath, __Root, __OriginRoot } = require("@jx3box/jx3box-common/data/jx3box.json");
286
286
  import detach_types from "../../assets/data/detach_type.json";
287
287
  import { iconLink, getLink, showAvatar } from "@jx3box/jx3box-common/js/utils";
288
288
  import GameText from "./components/GameText.vue";
@@ -33,8 +33,7 @@ import Editor from "@tinymce/tinymce-vue";
33
33
  import Upload from "./Upload";
34
34
  import Resource from "./Resource";
35
35
  import BoxResource from "./BoxResource";
36
- import { __cms } from "@jx3box/jx3box-common/data/jx3box.json";
37
- import { __imgPath } from "@jx3box/jx3box-common/data/jx3box.json";
36
+ const { __cms, __imgPath } = require("@jx3box/jx3box-common/data/jx3box.json");
38
37
  import Emotion from "@jx3box/jx3box-emotion/src/Emotion2.vue"
39
38
  import hljs_languages from "../../assets/js/item/hljs_languages.js"
40
39
  const API_Root = process.env.NODE_ENV === "production" ? __cms : "/";
@@ -2,8 +2,8 @@
2
2
  <div class="c-upload-album">
3
3
  <Upload @insert="updateFileList" text="批量上传图片" />
4
4
  <div class="c-upload-album-list">
5
- <div class="m-album" id="uploadAlbum" v-if="imgList && imgList.length">
6
- <div class="u-album-item" v-for="(item, i) in imgList" :key="timeStamp + i">
5
+ <div class="m-album" id="uploadAlbum" v-if="imgList && imgList.length" :key="timeStamp">
6
+ <div class="u-album-item" v-for="(item, i) in imgList" :key="i">
7
7
  <img class="u-pic" :src="item.url ? item.url : item" />
8
8
  <i class="u-mask"></i>
9
9
  <el-icon class="u-op u-preview" @click="previewHandle(item)"><ZoomIn /></el-icon>
@@ -31,8 +31,9 @@ export default {
31
31
  imgList: this.data || [],
32
32
  dialogImageUrl: "",
33
33
  dialogVisible: false,
34
- timeStamp: new Date().getTime() + Math.random(),
34
+ timeStamp: null,
35
35
  sortable: null,
36
+ hasSort: false,
36
37
  };
37
38
  },
38
39
  model: {
@@ -55,10 +56,12 @@ export default {
55
56
  imgList: {
56
57
  deep: true,
57
58
  handler: function (newVal, oldVal) {
58
- if (JSON.stringify(newVal) !== JSON.stringify(oldVal)) {
59
+ if (this.hasSort || JSON.stringify(newVal) !== JSON.stringify(oldVal)) {
60
+ this.timeStamp = new Date().getTime() + Math.random();
59
61
  this.$nextTick(() => {
60
62
  this.sort();
61
63
  });
64
+ this.hasSort = false;
62
65
  this.$emit("update", newVal);
63
66
  }
64
67
  },
@@ -88,7 +91,15 @@ export default {
88
91
  },
89
92
  sort() {
90
93
  let el = document.getElementById("uploadAlbum");
91
- this.sortable = Sortable.create(el);
94
+ this.sortable = Sortable.create(el, {
95
+ animation: 150,
96
+ onEnd: ({ newIndex, oldIndex }) => {
97
+ const targetRow = this.imgList[oldIndex];
98
+ this.imgList.splice(oldIndex, 1);
99
+ this.imgList.splice(newIndex, 0, targetRow);
100
+ this.hasSort = true;
101
+ },
102
+ });
92
103
  },
93
104
  showThumbnail(val) {
94
105
  return getThumbnail(val, 146);
@@ -60,7 +60,7 @@
60
60
  import { authorLink, getLink, getThumbnail } from "@jx3box/jx3box-common/js/utils";
61
61
  import { getUserInfo, getUserMedals, getUserPublicTeams } from "../../../service/author";
62
62
  import { getDecoration, getDecorationJson } from "../../../service/cms";
63
- import { __imgPath, __userLevelColor } from "@jx3box/jx3box-common/data/jx3box.json";
63
+ const { __imgPath, __userLevelColor } = require("@jx3box/jx3box-common/data/jx3box.json");
64
64
  import User from "@jx3box/jx3box-common/js/user";
65
65
  import Avatar from "./Avatar.vue";
66
66
  import medal from "./Medal.vue";
@@ -9,7 +9,7 @@
9
9
  </template>
10
10
 
11
11
  <script>
12
- import { __imgPath } from "@jx3box/jx3box-common/data/jx3box.json";
12
+ const { __imgPath } = require("@jx3box/jx3box-common/data/jx3box.json");
13
13
  import { showAvatar, authorLink } from "@jx3box/jx3box-common/js/utils";
14
14
  export default {
15
15
  name: "AvatarComponent",
@@ -44,7 +44,7 @@ import { authorLink } from "@jx3box/jx3box-common/js/utils";
44
44
  import QRcode from "@jx3box/jx3box-common-ui/src/interact/QRcode.vue";
45
45
  import { showTime } from "@jx3box/jx3box-common/js/moment.js";
46
46
  import { get_plan } from "../../../service/item.js";
47
- import { __Root } from "@jx3box/jx3box-common/data/jx3box.json";
47
+ const { __Root } = require("@jx3box/jx3box-common/data/jx3box.json");
48
48
  export default {
49
49
  name: "EquipComponent",
50
50
  props: ["data", "id"],
@@ -4,31 +4,25 @@
4
4
  <img class="u-add" svg-inline src="../../assets/img/header/manage.svg" />
5
5
  </span>
6
6
  <ul class="u-menu u-pop-content">
7
- <li v-for="item in finalPanel" :key="item.label">
8
- <a :href="item.link" target="_blank"
9
- ><el-icon>
10
- <component :is="item.icon" v-if="item.icon"></component>
11
- <Present v-else />
7
+ <li v-for="item in userPanel" :key="item.label">
8
+ <a :href="item.link" :target="item.target || '_self'">
9
+ <el-icon>
10
+ <Setting></Setting>
12
11
  </el-icon>
13
- {{ item.label }}</a
14
- >
15
- </li>
16
- <hr v-if="finalPanel.length" />
17
- <li v-if="isEditor">
18
- <a href="https://os.jx3box.com/admin" target="_blank"
19
- ><el-icon><MessageBox /></el-icon> 管理平台</a
20
- >
21
- </li>
22
- <li v-if="isAdmin">
23
- <a href="/admin"
24
- ><el-icon><Setting></Setting></el-icon> 站点配置</a
25
- >
26
- </li>
27
- <li v-if="isTeamMember">
28
- <a href="/dashboard/feedback?tab=pending"
29
- ><el-icon><Message /></el-icon> 反馈处理</a
30
- >
12
+ {{ item.label }}
13
+ </a>
31
14
  </li>
15
+ <hr v-if="userPanel.length" />
16
+ <template v-if="isEditor">
17
+ <li v-for="item in adminPanel" :key="item.label">
18
+ <a :href="item.link" :target="item.target || '_self'">
19
+ <el-icon>
20
+ <Setting></Setting>
21
+ </el-icon>
22
+ {{ item.label }}
23
+ </a>
24
+ </li>
25
+ </template>
32
26
  </ul>
33
27
  </div>
34
28
  </template>
@@ -37,7 +31,6 @@
37
31
  import User from "@jx3box/jx3box-common/js/user";
38
32
  import panel from "../../assets/data/panel.json";
39
33
  import { getMenu } from "../../service/header";
40
- import { checkTeamMember } from "../../service/cms";
41
34
  export default {
42
35
  name: "HeaderManage",
43
36
  data() {
@@ -48,20 +41,15 @@ export default {
48
41
  };
49
42
  },
50
43
  computed: {
51
- finalPanel: function () {
52
- // 只返回前两个
53
- return this.panel
54
- .filter((item) => {
55
- // 只返回有权限的
56
- if (item.onlyAdmin) {
57
- return this.isAdmin;
58
- }
59
- return true;
60
- })
61
- .slice(0, 2);
44
+ userPanel: function () {
45
+ return this.panel.filter((item) => {
46
+ return !item.onlyAdmin;
47
+ });
62
48
  },
63
- isAdmin() {
64
- return User.isAdmin();
49
+ adminPanel: function () {
50
+ return this.panel.filter((item) => {
51
+ return item.onlyAdmin;
52
+ });
65
53
  },
66
54
  isEditor() {
67
55
  return User.isEditor();
@@ -69,7 +57,6 @@ export default {
69
57
  },
70
58
  mounted() {
71
59
  this.loadPanel();
72
- this.check();
73
60
  },
74
61
  methods: {
75
62
  loadPanel: function () {
@@ -88,22 +75,6 @@ export default {
88
75
  console.log("loadPanel error", e);
89
76
  }
90
77
  },
91
- check: function () {
92
- try {
93
- const isTeamMember = JSON.parse(localStorage.getItem("BoxTeam3"));
94
-
95
- if (isTeamMember) {
96
- this.isTeamMember = isTeamMember === "true" || isTeamMember;
97
- } else {
98
- checkTeamMember().then((res) => {
99
- this.isTeamMember = res.data.data;
100
- localStorage.setItem("BoxTeam3", this.isTeamMember);
101
- });
102
- }
103
- } catch (e) {
104
- console.log("check error", e);
105
- }
106
- },
107
78
  },
108
79
  };
109
80
  </script>
@@ -112,11 +83,13 @@ export default {
112
83
  // 管理菜单
113
84
  .c-header-manage {
114
85
  height: 100%;
86
+
115
87
  .u-manage {
116
88
  padding: 0 10px 0 8px;
117
89
  height: 100%;
118
90
  .flex;
119
91
  align-items: center;
92
+
120
93
  svg {
121
94
  .size(19px);
122
95
  }