@jx3box/jx3box-editor 1.3.5 → 1.3.8
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/resource.less +14 -2
- package/package.json +1 -1
- package/src/BoxResource.vue +350 -0
- package/src/Markdown.vue +5 -3
- package/src/Resource.vue +3 -102
- package/src/Tinymce.vue +6 -3
package/assets/css/resource.less
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
.c-resource {
|
|
2
|
+
margin-right:5px;
|
|
2
3
|
.u-switch {
|
|
3
4
|
.u-icon {
|
|
4
5
|
.size(14px);
|
|
@@ -217,17 +218,17 @@
|
|
|
217
218
|
.m-database-search {
|
|
218
219
|
position: sticky;
|
|
219
220
|
z-index: 100;
|
|
220
|
-
top:
|
|
221
|
+
top: 0;
|
|
221
222
|
padding:10px 20px 10px 20px;
|
|
222
223
|
background-color:#fff;
|
|
223
224
|
.pr;
|
|
224
225
|
|
|
225
226
|
.u-client{
|
|
226
227
|
// .pa;.lt(20px,10px);
|
|
228
|
+
margin-right:15px;
|
|
227
229
|
}
|
|
228
230
|
.u-input{
|
|
229
231
|
flex:1;
|
|
230
|
-
margin-left:15px;
|
|
231
232
|
}
|
|
232
233
|
display: flex;
|
|
233
234
|
}
|
|
@@ -261,6 +262,17 @@
|
|
|
261
262
|
fill: @primary;
|
|
262
263
|
}
|
|
263
264
|
}
|
|
265
|
+
.u-lv-box {
|
|
266
|
+
font-style: normal;
|
|
267
|
+
font-weight: normal;
|
|
268
|
+
font-size: 12px;
|
|
269
|
+
padding: 2px 8px;
|
|
270
|
+
border: 1px solid #8269df;
|
|
271
|
+
border-radius: 2px;
|
|
272
|
+
margin-left: 5px;
|
|
273
|
+
background: #fff;
|
|
274
|
+
color: #6843f4;
|
|
275
|
+
}
|
|
264
276
|
&.el-tabs--card > .el-tabs__header .el-tabs__item {
|
|
265
277
|
transition: none;
|
|
266
278
|
}
|
package/package.json
CHANGED
|
@@ -0,0 +1,350 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="c-resource c-resource__jx3box">
|
|
3
|
+
<!-- 上传触发按钮 -->
|
|
4
|
+
<el-button class="u-switch" type="primary" @click="openDialog" :disabled="!enable"> <img class="u-icon" svg-inline :src="boxIcon" />魔盒资源 </el-button>
|
|
5
|
+
|
|
6
|
+
<!-- 弹出界面 -->
|
|
7
|
+
<el-dialog class="c-large-dialog" title="魔盒资源库" :visible.sync="dialogVisible">
|
|
8
|
+
<div class="c-resource-content" v-loading="loading">
|
|
9
|
+
<div class="m-database-search">
|
|
10
|
+
<el-input class="u-input" :placeholder="placeholderText" v-model="query" @change="search" @keyup.enter.native="search">
|
|
11
|
+
<template slot="prepend">关键词</template>
|
|
12
|
+
</el-input>
|
|
13
|
+
</div>
|
|
14
|
+
|
|
15
|
+
<el-tabs class="m-database-tabs" v-model="type" type="card" @tab-click="changeType">
|
|
16
|
+
<el-tab-pane label="魔盒用户" name="authors">
|
|
17
|
+
<span slot="label" class="u-tab-label">
|
|
18
|
+
<i class="el-icon-s-custom" style="margin-right:5px;"></i>
|
|
19
|
+
<b>魔盒用户</b>
|
|
20
|
+
<i class="u-lv-box">Lv2+</i>
|
|
21
|
+
</span>
|
|
22
|
+
<p v-if="total && done" class="m-resource-count">
|
|
23
|
+
<i class="el-icon-s-data"></i> 共找到 <b>{{ total }}</b> 条记录
|
|
24
|
+
</p>
|
|
25
|
+
<ul class="m-resource-list">
|
|
26
|
+
<li v-for="(o, i) in authors" class="u-item" :key="i" :class="{ on: !!o.isSelected }" @click="selectAuthor(o, i)" ref="author">
|
|
27
|
+
<span class="u-id">ID:{{ o.ID }}</span>
|
|
28
|
+
<img class="u-pic" :title="'AuthorID:' + o.display_name" :src="userAvatar(o.user_avatar)" />
|
|
29
|
+
<span class="u-primary">
|
|
30
|
+
<span class="u-name">
|
|
31
|
+
{{ o.display_name }}
|
|
32
|
+
</span>
|
|
33
|
+
<div class="u-remark">
|
|
34
|
+
{{o.user_bio}}
|
|
35
|
+
</div>
|
|
36
|
+
</span>
|
|
37
|
+
</li>
|
|
38
|
+
</ul>
|
|
39
|
+
<el-alert v-if="!authors.length && done" title="没有找到相关条目" type="info" show-icon></el-alert>
|
|
40
|
+
</el-tab-pane>
|
|
41
|
+
<!-- <el-tab-pane label="表情" name="emotions">
|
|
42
|
+
<span slot="label" class="u-tab-label">
|
|
43
|
+
<i class="el-icon-sugar"></i>
|
|
44
|
+
<b>表情</b>
|
|
45
|
+
</span>
|
|
46
|
+
<p v-if="total && done" class="m-resource-count">
|
|
47
|
+
<i class="el-icon-s-data"></i> 共找到 <b>{{ total }}</b> 条记录
|
|
48
|
+
</p>
|
|
49
|
+
<ul class="m-resource-iconlist">
|
|
50
|
+
<li v-for="(o, i) in emotions" class="u-item" :key="i" :class="{ on: !!o.isSelected }" @click="selectEmotion(o)" ref="emotion">
|
|
51
|
+
<img class="e-jx3-emotion" :src="userAvatar(o.url)" :alt="query" />
|
|
52
|
+
</li>
|
|
53
|
+
</ul>
|
|
54
|
+
<el-alert v-if="!emotions.length && done" title="没有找到相关条目" type="info" show-icon></el-alert>
|
|
55
|
+
</el-tab-pane> -->
|
|
56
|
+
</el-tabs>
|
|
57
|
+
|
|
58
|
+
<template v-if="multipage">
|
|
59
|
+
<!-- 下一页 -->
|
|
60
|
+
<el-button class="m-archive-more" :class="{ show: hasNextPage }" type="primary" icon="el-icon-arrow-down" @click="appendPage">加载更多</el-button>
|
|
61
|
+
<!-- 分页 -->
|
|
62
|
+
<el-pagination
|
|
63
|
+
class="m-archive-pages"
|
|
64
|
+
background
|
|
65
|
+
layout="total, prev, pager, next,jumper"
|
|
66
|
+
:hide-on-single-page="true"
|
|
67
|
+
:page-size="per"
|
|
68
|
+
:total="total"
|
|
69
|
+
:current-page.sync="page"
|
|
70
|
+
@current-change="changePage"
|
|
71
|
+
></el-pagination>
|
|
72
|
+
</template>
|
|
73
|
+
|
|
74
|
+
<div class="m-database-tip" v-show="isBlank">❤ 请输入搜索条件查询</div>
|
|
75
|
+
</div>
|
|
76
|
+
|
|
77
|
+
<!-- 插入按钮 -->
|
|
78
|
+
<span slot="footer" class="dialog-footer">
|
|
79
|
+
<el-button @click="dialogVisible = false">取 消</el-button>
|
|
80
|
+
<el-button type="primary" @click="insert">
|
|
81
|
+
{{ buttonTXT }}
|
|
82
|
+
</el-button>
|
|
83
|
+
</span>
|
|
84
|
+
</el-dialog>
|
|
85
|
+
</div>
|
|
86
|
+
</template>
|
|
87
|
+
|
|
88
|
+
<script>
|
|
89
|
+
import { loadResource, loadStat, getIcons } from "../service/database";
|
|
90
|
+
import { loadAuthors, loadEmotions } from "../service/cms";
|
|
91
|
+
import { getUserInfo } from "../service/author";
|
|
92
|
+
import { __iconPath, __Root, __OriginRoot, __imgPath } from "@jx3box/jx3box-common/data/jx3box.json";
|
|
93
|
+
import detach_types from "../assets/data/detach_type.json";
|
|
94
|
+
import { iconLink, getLink, showAvatar } from "@jx3box/jx3box-common/js/utils";
|
|
95
|
+
import User from "@jx3box/jx3box-common/js/user";
|
|
96
|
+
export default {
|
|
97
|
+
name: "Resource",
|
|
98
|
+
props: {
|
|
99
|
+
enable: {
|
|
100
|
+
type: Boolean,
|
|
101
|
+
default: true,
|
|
102
|
+
},
|
|
103
|
+
},
|
|
104
|
+
data: function() {
|
|
105
|
+
return {
|
|
106
|
+
dialogVisible: false,
|
|
107
|
+
actived: false,
|
|
108
|
+
userInfo: {},
|
|
109
|
+
|
|
110
|
+
type: "authors",
|
|
111
|
+
query: "",
|
|
112
|
+
strict: false,
|
|
113
|
+
client: location.hostname.includes("origin") ? "origin" : "std",
|
|
114
|
+
|
|
115
|
+
skill: [],
|
|
116
|
+
buff: [],
|
|
117
|
+
item: [],
|
|
118
|
+
icon: [],
|
|
119
|
+
npc: [],
|
|
120
|
+
authors: [],
|
|
121
|
+
selectedAuthor: {},
|
|
122
|
+
emotions: [],
|
|
123
|
+
|
|
124
|
+
done: false,
|
|
125
|
+
loading: false,
|
|
126
|
+
|
|
127
|
+
isSuper: false,
|
|
128
|
+
|
|
129
|
+
html: "",
|
|
130
|
+
|
|
131
|
+
per: 10,
|
|
132
|
+
page: 1,
|
|
133
|
+
total: 1,
|
|
134
|
+
pages: 1,
|
|
135
|
+
|
|
136
|
+
placeholderTexts : {
|
|
137
|
+
'authors' : '请输入 ID 或 名称'
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
};
|
|
141
|
+
},
|
|
142
|
+
computed: {
|
|
143
|
+
placeholderText : function (){
|
|
144
|
+
return this.placeholderTexts[this.type]
|
|
145
|
+
},
|
|
146
|
+
buttonTXT: function() {
|
|
147
|
+
return this.selectedCount ? "插 入" : "确 定";
|
|
148
|
+
},
|
|
149
|
+
isBlank: function() {
|
|
150
|
+
return !this.query && !this[this.type]["length"];
|
|
151
|
+
},
|
|
152
|
+
selectedCount: function() {
|
|
153
|
+
return !!this.html;
|
|
154
|
+
},
|
|
155
|
+
isNumber: function() {
|
|
156
|
+
return !isNaN(this.query);
|
|
157
|
+
},
|
|
158
|
+
hasNextPage: function() {
|
|
159
|
+
return this.total > 1 && this.page < this.pages;
|
|
160
|
+
},
|
|
161
|
+
multipage: function() {
|
|
162
|
+
return this.type !== "icon" && this.done && this.pages > 1;
|
|
163
|
+
},
|
|
164
|
+
iconDir: function() {
|
|
165
|
+
return this.client === "origin" ? "origin_icon" : "icon";
|
|
166
|
+
},
|
|
167
|
+
userStatus: function (){
|
|
168
|
+
return User.getInfo().status
|
|
169
|
+
},
|
|
170
|
+
uid: function (){
|
|
171
|
+
return User.getInfo().uid
|
|
172
|
+
},
|
|
173
|
+
canInsertAuthor: function() {
|
|
174
|
+
return User.getLevel(this.userInfo && this.userInfo.experience) >= 2;
|
|
175
|
+
},
|
|
176
|
+
boxIcon: function() {
|
|
177
|
+
return __imgPath + 'image/common/jx3box_white.svg'
|
|
178
|
+
},
|
|
179
|
+
},
|
|
180
|
+
watch: {
|
|
181
|
+
html: function(newval) {
|
|
182
|
+
this.$emit("update", newval);
|
|
183
|
+
},
|
|
184
|
+
},
|
|
185
|
+
methods: {
|
|
186
|
+
getData: function(page = 1, append = false) {
|
|
187
|
+
if (!this.query) return;
|
|
188
|
+
|
|
189
|
+
this.loading = true;
|
|
190
|
+
this.per = 10;
|
|
191
|
+
this.done = false;
|
|
192
|
+
let query = this.query;
|
|
193
|
+
let params = {
|
|
194
|
+
strict: ~~this.strict,
|
|
195
|
+
per: this.per,
|
|
196
|
+
page: page,
|
|
197
|
+
client: this.client,
|
|
198
|
+
};
|
|
199
|
+
|
|
200
|
+
// 图标
|
|
201
|
+
if (this.type === 'authors') {
|
|
202
|
+
params = {
|
|
203
|
+
...params,
|
|
204
|
+
name: query,
|
|
205
|
+
}
|
|
206
|
+
loadAuthors(params)
|
|
207
|
+
.then((res) => {
|
|
208
|
+
if (!append) this.authors = [];
|
|
209
|
+
let list = this.transformData(res.data.data.list)
|
|
210
|
+
this.authors = this.authors.concat(list);
|
|
211
|
+
this.pages = res.data.data.pages;
|
|
212
|
+
this.total = res.data.data.total;
|
|
213
|
+
})
|
|
214
|
+
.finally(() => {
|
|
215
|
+
this.done = true;
|
|
216
|
+
this.loading = false;
|
|
217
|
+
});
|
|
218
|
+
|
|
219
|
+
} else if (this.type === 'emotions') {
|
|
220
|
+
this.per = 30;
|
|
221
|
+
params = {
|
|
222
|
+
per: this.per,
|
|
223
|
+
page: page,
|
|
224
|
+
search: query,
|
|
225
|
+
}
|
|
226
|
+
loadEmotions(params)
|
|
227
|
+
.then((res) => {
|
|
228
|
+
if (!append) this.emotions = [];
|
|
229
|
+
let list = this.transformData(res.data.data.list)
|
|
230
|
+
this.emotions = this.emotions.concat(list);
|
|
231
|
+
this.pages = res.data.data.pages;
|
|
232
|
+
this.total = res.data.data.total;
|
|
233
|
+
})
|
|
234
|
+
.finally(() => {
|
|
235
|
+
this.done = true;
|
|
236
|
+
this.loading = false;
|
|
237
|
+
});
|
|
238
|
+
}
|
|
239
|
+
},
|
|
240
|
+
search: function() {
|
|
241
|
+
this.page = 1;
|
|
242
|
+
this.getData();
|
|
243
|
+
},
|
|
244
|
+
appendPage: function() {
|
|
245
|
+
this.getData(++this.page, true);
|
|
246
|
+
},
|
|
247
|
+
changePage: function(i) {
|
|
248
|
+
this.getData(i);
|
|
249
|
+
},
|
|
250
|
+
changeType: function() {
|
|
251
|
+
this.page = 1;
|
|
252
|
+
this.getData();
|
|
253
|
+
},
|
|
254
|
+
setAuthors: function() {
|
|
255
|
+
try {
|
|
256
|
+
let author = sessionStorage.getItem("atAuthor");
|
|
257
|
+
if (author) {
|
|
258
|
+
author = JSON.parse(author);
|
|
259
|
+
author = author.split(',') || [];
|
|
260
|
+
if (this.selectedAuthor.ID && !author.includes(String(this.selectedAuthor.ID))) {
|
|
261
|
+
author.push(this.selectedAuthor.ID);
|
|
262
|
+
}
|
|
263
|
+
sessionStorage.setItem("atAuthor", JSON.stringify(author.join(',')));
|
|
264
|
+
} else {
|
|
265
|
+
sessionStorage.setItem("atAuthor", JSON.stringify(String(this.selectedAuthor.ID)));
|
|
266
|
+
}
|
|
267
|
+
} catch (error) {
|
|
268
|
+
console.log(error)
|
|
269
|
+
}
|
|
270
|
+
},
|
|
271
|
+
insert: function() {
|
|
272
|
+
if (this.type === 'authors') {
|
|
273
|
+
if (this.userStatus == 0 && this.canInsertAuthor) {
|
|
274
|
+
this.setAuthors();
|
|
275
|
+
this.$emit("insert", this.html);
|
|
276
|
+
this.dialogVisible = false;
|
|
277
|
+
this.selectedAuthor = {};
|
|
278
|
+
} else {
|
|
279
|
+
this.$alert('您的等级不足或无权限(Lv2以上可用)', '消息');
|
|
280
|
+
}
|
|
281
|
+
} else {
|
|
282
|
+
this.$emit("insert", this.html);
|
|
283
|
+
this.dialogVisible = false;
|
|
284
|
+
}
|
|
285
|
+
},
|
|
286
|
+
transformData: function(data) {
|
|
287
|
+
data.forEach((item) => {
|
|
288
|
+
item.isSelected = false;
|
|
289
|
+
});
|
|
290
|
+
return data;
|
|
291
|
+
},
|
|
292
|
+
selectAuthor: function (o){
|
|
293
|
+
this.resetItems();
|
|
294
|
+
this.selectedAuthor = o;
|
|
295
|
+
o.isSelected = true;
|
|
296
|
+
this.html = `<a data-type="author" class="e-jx3-author w-jx3-element" data-mode="" data-id="${o.ID}" target="_blank" href="/author/${o.ID}">@${o.display_name}</a>`
|
|
297
|
+
},
|
|
298
|
+
selectEmotion: function (o){
|
|
299
|
+
this.resetItems();
|
|
300
|
+
o.isSelected = true;
|
|
301
|
+
this.html = `<img class="e-jx3-emotion" style="width:80px;" src="${o.url}" alt="${o.id}"/>`
|
|
302
|
+
},
|
|
303
|
+
resetItems: function() {
|
|
304
|
+
let data = this[this.type];
|
|
305
|
+
data.forEach((item) => {
|
|
306
|
+
item.isSelected = false;
|
|
307
|
+
});
|
|
308
|
+
this.html = "";
|
|
309
|
+
},
|
|
310
|
+
getLink : function (type,id){
|
|
311
|
+
let domain = this.client == "origin" ? __OriginRoot : __Root;
|
|
312
|
+
return domain + getLink(type,id).slice(1)
|
|
313
|
+
},
|
|
314
|
+
userAvatar: function(url) {
|
|
315
|
+
return showAvatar(url,'m');
|
|
316
|
+
},
|
|
317
|
+
loadUserInfo: function (){
|
|
318
|
+
if (!this.uid) return;
|
|
319
|
+
getUserInfo(this.uid).then(res => {
|
|
320
|
+
this.userInfo = res
|
|
321
|
+
})
|
|
322
|
+
},
|
|
323
|
+
|
|
324
|
+
// 杂项
|
|
325
|
+
// ==============================
|
|
326
|
+
openDialog: function() {
|
|
327
|
+
this.dialogVisible = true;
|
|
328
|
+
if (!this.actived) {
|
|
329
|
+
loadStat().then((data) => {
|
|
330
|
+
this.stat = data;
|
|
331
|
+
this.actived = true;
|
|
332
|
+
});
|
|
333
|
+
}
|
|
334
|
+
},
|
|
335
|
+
},
|
|
336
|
+
created: function() {
|
|
337
|
+
this.loadUserInfo();
|
|
338
|
+
},
|
|
339
|
+
};
|
|
340
|
+
</script>
|
|
341
|
+
|
|
342
|
+
<style lang="less">
|
|
343
|
+
@import "../assets/css/resource.less";
|
|
344
|
+
|
|
345
|
+
.m-item-pop {
|
|
346
|
+
padding: 0 !important;
|
|
347
|
+
background: none !important;
|
|
348
|
+
border: none;
|
|
349
|
+
}
|
|
350
|
+
</style>
|
package/src/Markdown.vue
CHANGED
|
@@ -5,7 +5,8 @@
|
|
|
5
5
|
|
|
6
6
|
<div class="c-editor-header">
|
|
7
7
|
<Upload v-if="attachmentEnable" @insert="insertAttachments" :enable="true" />
|
|
8
|
-
<Resource v-if="resourceEnable" @insert="insertResource" :enable="true" />
|
|
8
|
+
<Resource style="margin-right: 5px;" v-if="resourceEnable" @insert="insertResource" :enable="true" />
|
|
9
|
+
<BoxResource v-if="resourceEnable" @insert="insertResource" :enable="true" />
|
|
9
10
|
</div>
|
|
10
11
|
|
|
11
12
|
<slot></slot>
|
|
@@ -37,6 +38,7 @@ import { uploadFile } from "../service/cms";
|
|
|
37
38
|
|
|
38
39
|
import Upload from "./Upload";
|
|
39
40
|
import Resource from "./Resource";
|
|
41
|
+
import BoxResource from "./BoxResource";
|
|
40
42
|
|
|
41
43
|
// jx3
|
|
42
44
|
import markdownMacro from './components/markdown/macro.vue'
|
|
@@ -69,7 +71,8 @@ export default {
|
|
|
69
71
|
markdownEditor,
|
|
70
72
|
Upload,
|
|
71
73
|
Resource,
|
|
72
|
-
|
|
74
|
+
BoxResource,
|
|
75
|
+
|
|
73
76
|
markdownMacro,
|
|
74
77
|
markdownPz,
|
|
75
78
|
markdownKatex,
|
|
@@ -215,7 +218,6 @@ export default {
|
|
|
215
218
|
}
|
|
216
219
|
},
|
|
217
220
|
insertResource: function(data) {
|
|
218
|
-
console.log(data)
|
|
219
221
|
this.$md.insertText(this.$md.getTextareaDom(), {
|
|
220
222
|
prefix: data,
|
|
221
223
|
subfix: "",
|
package/src/Resource.vue
CHANGED
|
@@ -164,45 +164,6 @@
|
|
|
164
164
|
</ul>
|
|
165
165
|
<el-alert v-if="!icon.length && done" title="没有找到相关条目" type="info" show-icon></el-alert>
|
|
166
166
|
</el-tab-pane>
|
|
167
|
-
<el-tab-pane label="魔盒用户" name="authors">
|
|
168
|
-
<span slot="label" class="u-tab-label">
|
|
169
|
-
<i class="el-icon-s-custom" style="margin-right:5px;"></i>
|
|
170
|
-
<b>魔盒用户</b>
|
|
171
|
-
</span>
|
|
172
|
-
<p v-if="total && done" class="m-resource-count">
|
|
173
|
-
<i class="el-icon-s-data"></i> 共找到 <b>{{ total }}</b> 条记录
|
|
174
|
-
</p>
|
|
175
|
-
<ul class="m-resource-list">
|
|
176
|
-
<li v-for="(o, i) in authors" class="u-item" :key="i" :class="{ on: !!o.isSelected }" @click="selectAuthor(o, i)" ref="author">
|
|
177
|
-
<span class="u-id">ID:{{ o.ID }}</span>
|
|
178
|
-
<img class="u-pic" :title="'AuthorID:' + o.display_name" :src="userAvatar(o.user_avatar)" />
|
|
179
|
-
<span class="u-primary">
|
|
180
|
-
<span class="u-name">
|
|
181
|
-
{{ o.display_name }}
|
|
182
|
-
</span>
|
|
183
|
-
<div class="u-remark">
|
|
184
|
-
{{o.user_bio}}
|
|
185
|
-
</div>
|
|
186
|
-
</span>
|
|
187
|
-
</li>
|
|
188
|
-
</ul>
|
|
189
|
-
<el-alert v-if="!authors.length && done" title="没有找到相关条目" type="info" show-icon></el-alert>
|
|
190
|
-
</el-tab-pane>
|
|
191
|
-
<!-- <el-tab-pane label="表情" name="emotions">
|
|
192
|
-
<span slot="label" class="u-tab-label">
|
|
193
|
-
<i class="el-icon-sugar"></i>
|
|
194
|
-
<b>表情</b>
|
|
195
|
-
</span>
|
|
196
|
-
<p v-if="total && done" class="m-resource-count">
|
|
197
|
-
<i class="el-icon-s-data"></i> 共找到 <b>{{ total }}</b> 条记录
|
|
198
|
-
</p>
|
|
199
|
-
<ul class="m-resource-iconlist">
|
|
200
|
-
<li v-for="(o, i) in emotions" class="u-item" :key="i" :class="{ on: !!o.isSelected }" @click="selectEmotion(o)" ref="emotion">
|
|
201
|
-
<img class="e-jx3-emotion" :src="userAvatar(o.url)" :alt="query" />
|
|
202
|
-
</li>
|
|
203
|
-
</ul>
|
|
204
|
-
<el-alert v-if="!emotions.length && done" title="没有找到相关条目" type="info" show-icon></el-alert>
|
|
205
|
-
</el-tab-pane> -->
|
|
206
167
|
</el-tabs>
|
|
207
168
|
|
|
208
169
|
<template v-if="multipage">
|
|
@@ -237,8 +198,7 @@
|
|
|
237
198
|
|
|
238
199
|
<script>
|
|
239
200
|
import { loadResource, loadStat, getIcons } from "../service/database";
|
|
240
|
-
import {
|
|
241
|
-
import { getUserInfo } from "../service/author";
|
|
201
|
+
import { loadEmotions } from "../service/cms";
|
|
242
202
|
import { __ossRoot, __iconPath, __Root, __OriginRoot } from "@jx3box/jx3box-common/data/jx3box.json";
|
|
243
203
|
import detach_types from "../assets/data/detach_type.json";
|
|
244
204
|
import { iconLink, getLink, showAvatar } from "@jx3box/jx3box-common/js/utils";
|
|
@@ -372,24 +332,6 @@ export default {
|
|
|
372
332
|
this.loading = false;
|
|
373
333
|
}
|
|
374
334
|
|
|
375
|
-
} else if (this.type === 'authors') {
|
|
376
|
-
params = {
|
|
377
|
-
...params,
|
|
378
|
-
name: query,
|
|
379
|
-
}
|
|
380
|
-
loadAuthors(params)
|
|
381
|
-
.then((res) => {
|
|
382
|
-
if (!append) this.authors = [];
|
|
383
|
-
let list = this.transformData(res.data.data.list)
|
|
384
|
-
this.authors = this.authors.concat(list);
|
|
385
|
-
this.pages = res.data.data.pages;
|
|
386
|
-
this.total = res.data.data.total;
|
|
387
|
-
})
|
|
388
|
-
.finally(() => {
|
|
389
|
-
this.done = true;
|
|
390
|
-
this.loading = false;
|
|
391
|
-
});
|
|
392
|
-
|
|
393
335
|
} else if (this.type === 'emotions') {
|
|
394
336
|
this.per = 30;
|
|
395
337
|
params = {
|
|
@@ -445,39 +387,10 @@ export default {
|
|
|
445
387
|
changeType: function() {
|
|
446
388
|
this.page = 1;
|
|
447
389
|
this.getData();
|
|
448
|
-
if (this.type === 'authors') {
|
|
449
|
-
this.loadUserInfo();
|
|
450
|
-
}
|
|
451
|
-
},
|
|
452
|
-
setAuthors: function() {
|
|
453
|
-
try {
|
|
454
|
-
let author = sessionStorage.getItem("atAuthor");
|
|
455
|
-
if (author) {
|
|
456
|
-
author = author.split(',') || [];
|
|
457
|
-
author.push(this.selectedAuthor.ID);
|
|
458
|
-
sessionStorage.setItem("atAuthor", JSON.stringify(author.join(',')));
|
|
459
|
-
} else {
|
|
460
|
-
sessionStorage.setItem("atAuthor", JSON.stringify(this.selectedAuthor.ID));
|
|
461
|
-
}
|
|
462
|
-
} catch (error) {
|
|
463
|
-
console.log(error)
|
|
464
|
-
}
|
|
465
390
|
},
|
|
466
391
|
insert: function() {
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
this.setAuthors();
|
|
470
|
-
this.$emit("insert", this.html);
|
|
471
|
-
this.dialogVisible = false;
|
|
472
|
-
this.selectedAuthor = {};
|
|
473
|
-
} else {
|
|
474
|
-
this.$alert('您的等级不足或无权限(Lv2以上可用)', '消息');
|
|
475
|
-
return;
|
|
476
|
-
}
|
|
477
|
-
} else {
|
|
478
|
-
this.$emit("insert", this.html);
|
|
479
|
-
this.dialogVisible = false;
|
|
480
|
-
}
|
|
392
|
+
this.$emit("insert", this.html);
|
|
393
|
+
this.dialogVisible = false;
|
|
481
394
|
},
|
|
482
395
|
transformData: function(data) {
|
|
483
396
|
data.forEach((item) => {
|
|
@@ -531,12 +444,6 @@ export default {
|
|
|
531
444
|
o.isSelected = true
|
|
532
445
|
this.html = `<a data-type="npc" class="e-jx3-npc w-jx3-element" data-mode="" data-id="${o.ID}" data-client="${this.client}" target="_blank" href="${this.getDbLink("npc", this.client, o.ID, '')}">${o.Name}]</a>`
|
|
533
446
|
},
|
|
534
|
-
selectAuthor: function (o){
|
|
535
|
-
this.resetItems();
|
|
536
|
-
this.selectedAuthor = o;
|
|
537
|
-
o.isSelected = true;
|
|
538
|
-
this.html = `<a data-type="author" class="e-jx3-author w-jx3-element" data-mode="" data-id="${o.ID}" target="_blank" href="/author/${o.ID}">@${o.display_name}</a>`
|
|
539
|
-
},
|
|
540
447
|
selectEmotion: function (o){
|
|
541
448
|
this.resetItems();
|
|
542
449
|
o.isSelected = true;
|
|
@@ -566,12 +473,6 @@ export default {
|
|
|
566
473
|
userAvatar: function(url) {
|
|
567
474
|
return showAvatar(url,'m');
|
|
568
475
|
},
|
|
569
|
-
loadUserInfo: function (){
|
|
570
|
-
if (!this.uid) return;
|
|
571
|
-
getUserInfo(this.uid).then(res => {
|
|
572
|
-
this.userInfo = res
|
|
573
|
-
})
|
|
574
|
-
},
|
|
575
476
|
|
|
576
477
|
// 杂项
|
|
577
478
|
// ==============================
|
package/src/Tinymce.vue
CHANGED
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
<div class="c-editor-header">
|
|
7
7
|
<Upload v-if="attachmentEnable" @insert="insertAttachments" />
|
|
8
8
|
<Resource v-if="resourceEnable" @insert="insertResource" />
|
|
9
|
+
<BoxResource v-if="resourceEnable" @insert="insertResource" />
|
|
9
10
|
</div>
|
|
10
11
|
<Emotion class="c-editor-emotion" @selected="emotionSelected"></Emotion>
|
|
11
12
|
|
|
@@ -36,6 +37,7 @@
|
|
|
36
37
|
import Editor from "@tinymce/tinymce-vue";
|
|
37
38
|
import Upload from "./Upload";
|
|
38
39
|
import Resource from "./Resource";
|
|
40
|
+
import BoxResource from "./BoxResource";
|
|
39
41
|
import { __cms } from "@jx3box/jx3box-common/data/jx3box.json";
|
|
40
42
|
import { __ossRoot } from "@jx3box/jx3box-common/data/jx3box.json";
|
|
41
43
|
import Emotion from "@jx3box/jx3box-emotion/src/Emotion.vue"
|
|
@@ -76,10 +78,10 @@ export default {
|
|
|
76
78
|
"link autolink",
|
|
77
79
|
"hr lists advlist table codeinline codesample checklist foldtext latex",
|
|
78
80
|
"image emoticons media videox macro qixue talent2",
|
|
79
|
-
"code fullscreen wordcount powerpaste pagebreak printpage pz", // template anchor jx3icon autosave
|
|
81
|
+
"code fullscreen wordcount powerpaste pagebreak printpage pz", // template anchor jx3icon autosave
|
|
80
82
|
],
|
|
81
83
|
toolbar: [
|
|
82
|
-
"undo | formatselect | fontsizeselect | forecolor backcolor | bold italic underline strikethrough superscript subscript | link unlink | fullscreen code", //restoredraft
|
|
84
|
+
"undo | formatselect | fontsizeselect | forecolor backcolor | bold italic underline strikethrough superscript subscript | link unlink | fullscreen code", //restoredraft
|
|
83
85
|
"removeformat | hr alignleft aligncenter alignright alignjustify indent outdent | bullist numlist checklist table blockquote foldtext codeinline codesample latex | emoticons image media videox | macro pz qixue talent2 pagebreak printpage", // template anchor jx3icon
|
|
84
86
|
],
|
|
85
87
|
mobile: {
|
|
@@ -208,7 +210,8 @@ export default {
|
|
|
208
210
|
Editor,
|
|
209
211
|
Upload,
|
|
210
212
|
Resource,
|
|
211
|
-
Emotion
|
|
213
|
+
Emotion,
|
|
214
|
+
BoxResource
|
|
212
215
|
},
|
|
213
216
|
};
|
|
214
217
|
</script>
|