@jx3box/jx3box-editor 1.8.7 → 1.8.9
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/assets/css/article.less +1 -0
- package/assets/css/combo.less +311 -0
- package/assets/css/tinymce/combo.less +81 -0
- package/assets/css/tinymce.less +0 -1
- package/assets/js/combo.js +33 -0
- package/package.json +6 -1
- package/public/css/article.css +2018 -0
- package/public/css/article.less +3 -0
- package/public/tinymce.html +2 -2
- package/service/resource.js +12 -1
- package/src/Article.vue +3 -0
- package/src/BoxResource.vue +217 -89
- package/src/Tinymce.vue +3 -2
- package/src/components/Combo.vue +258 -0
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="m-resource-combo">
|
|
3
|
+
<div class="m-combo-list">
|
|
4
|
+
<div v-if="total && done" class="m-resource-count">
|
|
5
|
+
<i class="el-icon-s-data"></i> 共找到 <b>{{ total }}</b> 条记录
|
|
6
|
+
</div>
|
|
7
|
+
<ul class="m-resource-list">
|
|
8
|
+
<li
|
|
9
|
+
v-for="(o, i) in skill"
|
|
10
|
+
class="u-item"
|
|
11
|
+
:key="i"
|
|
12
|
+
@click="selectSkill(o, i)"
|
|
13
|
+
ref="skill"
|
|
14
|
+
>
|
|
15
|
+
<span class="u-id">ID:{{ o.SkillID }}</span>
|
|
16
|
+
<img
|
|
17
|
+
class="u-pic"
|
|
18
|
+
:title="'IconID:' + o.IconID"
|
|
19
|
+
:src="iconURL(o.IconID)"
|
|
20
|
+
/>
|
|
21
|
+
<span class="u-primary">
|
|
22
|
+
<span class="u-name">
|
|
23
|
+
{{ o.Name }}
|
|
24
|
+
<em v-if="o.SkillName">({{ o.SkillName }})</em>
|
|
25
|
+
</span>
|
|
26
|
+
<span class="u-content">
|
|
27
|
+
{{ filterRaw(o.Desc) }}
|
|
28
|
+
</span>
|
|
29
|
+
</span>
|
|
30
|
+
</li>
|
|
31
|
+
</ul>
|
|
32
|
+
<el-alert
|
|
33
|
+
v-if="!skill.length && done"
|
|
34
|
+
title="没有找到相关条目"
|
|
35
|
+
type="info"
|
|
36
|
+
show-icon
|
|
37
|
+
></el-alert>
|
|
38
|
+
|
|
39
|
+
<template v-if="multipage">
|
|
40
|
+
<!-- 下一页 -->
|
|
41
|
+
<el-button
|
|
42
|
+
class="m-archive-more"
|
|
43
|
+
:class="{ show: hasNextPage }"
|
|
44
|
+
type="primary"
|
|
45
|
+
icon="el-icon-arrow-down"
|
|
46
|
+
@click="appendPage"
|
|
47
|
+
>加载更多</el-button
|
|
48
|
+
>
|
|
49
|
+
<!-- 分页 -->
|
|
50
|
+
<el-pagination
|
|
51
|
+
class="m-archive-pages"
|
|
52
|
+
background
|
|
53
|
+
layout="total, prev, pager, next,jumper"
|
|
54
|
+
:hide-on-single-page="true"
|
|
55
|
+
:page-size="per"
|
|
56
|
+
:total="total"
|
|
57
|
+
:current-page.sync="page"
|
|
58
|
+
@current-change="changePage"
|
|
59
|
+
></el-pagination>
|
|
60
|
+
</template>
|
|
61
|
+
|
|
62
|
+
<div class="m-database-tip" v-show="isBlank">
|
|
63
|
+
❤ 请输入搜索条件查询
|
|
64
|
+
</div>
|
|
65
|
+
</div>
|
|
66
|
+
|
|
67
|
+
<el-divider>已选技能</el-divider>
|
|
68
|
+
<div class="m-selected-skills">
|
|
69
|
+
<ul class="m-skills-list">
|
|
70
|
+
<li
|
|
71
|
+
v-for="(skill, index) in selected"
|
|
72
|
+
:key="index + skill.SkillID"
|
|
73
|
+
class="m-skill"
|
|
74
|
+
@contextmenu.prevent="(event) => onContextmenu(event, skill)"
|
|
75
|
+
>
|
|
76
|
+
<div class="u-skill" v-if="skill && skill.IconID">
|
|
77
|
+
<img
|
|
78
|
+
class="u-skill-icon"
|
|
79
|
+
:src="iconURL(skill.IconID)"
|
|
80
|
+
:alt="skill.IconID"
|
|
81
|
+
/>
|
|
82
|
+
<i class="u-gcd-icon" v-show="skill.WithoutGcd">
|
|
83
|
+
<i class="el-icon-time"></i>
|
|
84
|
+
</i>
|
|
85
|
+
<i
|
|
86
|
+
class="u-remove-icon"
|
|
87
|
+
title="移除"
|
|
88
|
+
@click="removeSelected(index)"
|
|
89
|
+
><i class="el-icon-close"></i
|
|
90
|
+
></i>
|
|
91
|
+
</div>
|
|
92
|
+
</li>
|
|
93
|
+
</ul>
|
|
94
|
+
</div>
|
|
95
|
+
</div>
|
|
96
|
+
</template>
|
|
97
|
+
|
|
98
|
+
<script>
|
|
99
|
+
import Vue from "vue";
|
|
100
|
+
import { iconLink } from "@jx3box/jx3box-common/js/utils";
|
|
101
|
+
import { getSkill } from "../../service/resource";
|
|
102
|
+
import Sortable from "sortablejs";
|
|
103
|
+
import { cloneDeep } from "lodash";
|
|
104
|
+
|
|
105
|
+
import LoadScript from 'vue-plugin-load-script';
|
|
106
|
+
Vue.use(LoadScript);
|
|
107
|
+
|
|
108
|
+
import contextmenu from "vue-contextmenujs"
|
|
109
|
+
Vue.use(contextmenu)
|
|
110
|
+
export default {
|
|
111
|
+
name: "Combo",
|
|
112
|
+
props: {
|
|
113
|
+
query: {
|
|
114
|
+
type: String,
|
|
115
|
+
default: "",
|
|
116
|
+
},
|
|
117
|
+
client: {
|
|
118
|
+
type: String,
|
|
119
|
+
default: "std",
|
|
120
|
+
},
|
|
121
|
+
},
|
|
122
|
+
data() {
|
|
123
|
+
return {
|
|
124
|
+
done: false,
|
|
125
|
+
per: 10,
|
|
126
|
+
page: 1,
|
|
127
|
+
total: 1,
|
|
128
|
+
pages: 1,
|
|
129
|
+
|
|
130
|
+
selected: [],
|
|
131
|
+
skill: [],
|
|
132
|
+
};
|
|
133
|
+
},
|
|
134
|
+
computed: {
|
|
135
|
+
multipage: function () {
|
|
136
|
+
return this.done && this.pages > 1;
|
|
137
|
+
},
|
|
138
|
+
isBlank: function () {
|
|
139
|
+
return !this.query && !this.skill?.["length"];
|
|
140
|
+
},
|
|
141
|
+
hasNextPage: function () {
|
|
142
|
+
return this.total > 1 && this.page < this.pages;
|
|
143
|
+
},
|
|
144
|
+
},
|
|
145
|
+
mounted() {
|
|
146
|
+
this.$nextTick(() => {
|
|
147
|
+
this.initSkillSort();
|
|
148
|
+
|
|
149
|
+
});
|
|
150
|
+
},
|
|
151
|
+
methods: {
|
|
152
|
+
getData(page = 1, append = false) {
|
|
153
|
+
if (!this.query) return;
|
|
154
|
+
|
|
155
|
+
this.loading = true;
|
|
156
|
+
this.per = 10;
|
|
157
|
+
this.done = false;
|
|
158
|
+
let query = this.query;
|
|
159
|
+
let params = {
|
|
160
|
+
strict: ~~this.strict,
|
|
161
|
+
per: this.per,
|
|
162
|
+
page: page,
|
|
163
|
+
client: this.client,
|
|
164
|
+
};
|
|
165
|
+
|
|
166
|
+
getSkill(query, params)
|
|
167
|
+
.then((data) => {
|
|
168
|
+
if (!append) this.skill = [];
|
|
169
|
+
const list = (data.list || [])?.map((item) => {
|
|
170
|
+
item.isSelected = false;
|
|
171
|
+
return item;
|
|
172
|
+
});
|
|
173
|
+
this.pages = data.pages;
|
|
174
|
+
this.total = data.total;
|
|
175
|
+
this.skill = this.skill.concat(list);
|
|
176
|
+
})
|
|
177
|
+
.finally(() => {
|
|
178
|
+
this.done = true;
|
|
179
|
+
this.loading = false;
|
|
180
|
+
});
|
|
181
|
+
},
|
|
182
|
+
submit() {
|
|
183
|
+
this.$emit("submit", this.selected);
|
|
184
|
+
this.close();
|
|
185
|
+
this.selected = [];
|
|
186
|
+
},
|
|
187
|
+
close() {
|
|
188
|
+
this.$emit("update:modelValue", false);
|
|
189
|
+
},
|
|
190
|
+
iconURL: function (id) {
|
|
191
|
+
return iconLink(id, this.client);
|
|
192
|
+
},
|
|
193
|
+
filterRaw: function (str) {
|
|
194
|
+
return str && str.replace(/\\n/g, "\n");
|
|
195
|
+
},
|
|
196
|
+
search: function () {
|
|
197
|
+
this.page = 1;
|
|
198
|
+
this.getData();
|
|
199
|
+
},
|
|
200
|
+
appendPage: function () {
|
|
201
|
+
this.getData(++this.page, true);
|
|
202
|
+
},
|
|
203
|
+
changePage: function (i) {
|
|
204
|
+
this.getData(i);
|
|
205
|
+
},
|
|
206
|
+
selectSkill: function (o) {
|
|
207
|
+
this.selected.push(o);
|
|
208
|
+
},
|
|
209
|
+
removeSelected: function (index) {
|
|
210
|
+
this.selected.splice(index, 1);
|
|
211
|
+
},
|
|
212
|
+
initSkillSort() {
|
|
213
|
+
const el = document.querySelector(`.m-selected-skills .m-skills-list`);
|
|
214
|
+
if (!el) return;
|
|
215
|
+
const _this = this;
|
|
216
|
+
const sortSkills = Sortable.create(el, {
|
|
217
|
+
animation: 200,
|
|
218
|
+
onEnd({ newIndex, oldIndex }) {
|
|
219
|
+
const newSkills = cloneDeep(_this.selected);
|
|
220
|
+
const [removed] = newSkills.splice(oldIndex, 1);
|
|
221
|
+
newSkills.splice(newIndex, 0, removed);
|
|
222
|
+
_this.selected = newSkills;
|
|
223
|
+
},
|
|
224
|
+
});
|
|
225
|
+
},
|
|
226
|
+
onContextmenu(event, skill) {
|
|
227
|
+
// console.log(skill)
|
|
228
|
+
this.$contextmenu({
|
|
229
|
+
items: [
|
|
230
|
+
{
|
|
231
|
+
label: !skill?.WithoutGcd ? "设置为无GCD技能" : "取消无GCD技能",
|
|
232
|
+
onClick: () => {
|
|
233
|
+
this.$set(skill, "WithoutGcd", !skill.WithoutGcd);
|
|
234
|
+
},
|
|
235
|
+
icon: !skill?.WithoutGcd ? "el-icon-check" : "el-icon-close"
|
|
236
|
+
},
|
|
237
|
+
],
|
|
238
|
+
event,
|
|
239
|
+
customClass: "custom-class",
|
|
240
|
+
zIndex: 99999,
|
|
241
|
+
minWidth: 200,
|
|
242
|
+
});
|
|
243
|
+
return false;
|
|
244
|
+
},
|
|
245
|
+
|
|
246
|
+
renderVal() {
|
|
247
|
+
const {selected} = this;
|
|
248
|
+
return `<ul class="e-skill-combo w-skill-combo">${selected.map(item => {
|
|
249
|
+
return `<li class="w-skill-combo-item">${item.SkillID},${item.Name},${item.IconID},{gcd:${item.WithoutGcd ? 1: 0}}</li>`
|
|
250
|
+
})}</ul>`
|
|
251
|
+
},
|
|
252
|
+
},
|
|
253
|
+
};
|
|
254
|
+
</script>
|
|
255
|
+
|
|
256
|
+
<style lang="less">
|
|
257
|
+
@import "../../assets/css/combo.less";
|
|
258
|
+
</style>
|