@jx3box/jx3box-editor 1.4.0 → 1.4.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.
- package/package.json +1 -1
- package/src/Author.vue +26 -8
- package/src/BoxResource.vue +1 -1
- package/src/Upload.vue +167 -167
package/package.json
CHANGED
package/src/Author.vue
CHANGED
|
@@ -6,15 +6,24 @@
|
|
|
6
6
|
<div class="u-info">
|
|
7
7
|
<a class="u-name" :href="authorLink(uid)" target="_blank">
|
|
8
8
|
<span>{{ data.display_name.slice(0, 8) }}</span>
|
|
9
|
-
<
|
|
10
|
-
<
|
|
11
|
-
|
|
9
|
+
<el-tooltip class="item" effect="dark" content="签约作者" placement="top" v-if="isSuperAuthor">
|
|
10
|
+
<a class="u-superauthor" href="/dashboard/cooperation" target="_blank">
|
|
11
|
+
<img :src="super_author_icon" alt="superauthor" />
|
|
12
|
+
</a>
|
|
13
|
+
</el-tooltip>
|
|
12
14
|
</a>
|
|
13
|
-
<div class="u-extend">
|
|
14
|
-
<
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
<div class="u-extend" v-if="isVip">
|
|
16
|
+
<el-tooltip class="item" effect="dark" placement="top">
|
|
17
|
+
<div slot="content">
|
|
18
|
+
<span class="u-tips">经验值:{{ data.experience }}</span>
|
|
19
|
+
</div>
|
|
20
|
+
<span class="u-level" :class="'lv-' + level" :style={backgroundColor:showLevelColor(level)}>Lv.{{ level }}</span>
|
|
21
|
+
</el-tooltip>
|
|
22
|
+
<el-tooltip class="item" effect="dark" :content="vipTypeTitle" placement="top" v-if="isVip">
|
|
23
|
+
<a class="u-vip" href="/vip/premium?from=sidebar_author" target="_blank">
|
|
24
|
+
<i class="i-icon-vip on">{{ vipType }}</i>
|
|
25
|
+
</a>
|
|
26
|
+
</el-tooltip>
|
|
18
27
|
</div>
|
|
19
28
|
</div>
|
|
20
29
|
</div>
|
|
@@ -58,6 +67,12 @@ export default {
|
|
|
58
67
|
super_author_icon: function() {
|
|
59
68
|
return __imgPath + "image/user/" + "superauthor.svg";
|
|
60
69
|
},
|
|
70
|
+
isVip: function (){
|
|
71
|
+
return this.data?.is_pro || this.data?.is_pre
|
|
72
|
+
},
|
|
73
|
+
vipTypeTitle: function() {
|
|
74
|
+
return this.data?.is_pro ? "专业版会员" : "高级版会员";
|
|
75
|
+
},
|
|
61
76
|
vipType: function() {
|
|
62
77
|
return this.data?.is_pro ? "PRO" : "PRE";
|
|
63
78
|
},
|
|
@@ -67,6 +82,9 @@ export default {
|
|
|
67
82
|
hasTrophy: function() {
|
|
68
83
|
return this.medals.length;
|
|
69
84
|
},
|
|
85
|
+
isSuperAuthor: function() {
|
|
86
|
+
return !!this.data?.sign;
|
|
87
|
+
},
|
|
70
88
|
},
|
|
71
89
|
watch: {
|
|
72
90
|
uid: {
|
package/src/BoxResource.vue
CHANGED
|
@@ -296,7 +296,7 @@ export default {
|
|
|
296
296
|
this.resetItems();
|
|
297
297
|
this.selectedAuthor = o;
|
|
298
298
|
o.isSelected = true;
|
|
299
|
-
this.html = `<a data-type="author" class="e-jx3-author
|
|
299
|
+
this.html = `<a data-type="author" class="e-jx3-author" data-mode="" data-id="${o.ID}" target="_blank" href="/author/${o.ID}">@${o.display_name}</a>`
|
|
300
300
|
},
|
|
301
301
|
selectEmotion: function (o){
|
|
302
302
|
this.resetItems();
|
package/src/Upload.vue
CHANGED
|
@@ -53,187 +53,187 @@
|
|
|
53
53
|
</template>
|
|
54
54
|
|
|
55
55
|
<script>
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
},
|
|
70
|
-
onlyImage: {
|
|
71
|
-
type: Boolean,
|
|
72
|
-
},
|
|
73
|
-
desc: {
|
|
74
|
-
type: String,
|
|
75
|
-
},
|
|
76
|
-
accept: {
|
|
77
|
-
type: String,
|
|
78
|
-
},
|
|
79
|
-
enable: {
|
|
80
|
-
type: Boolean,
|
|
81
|
-
default: true,
|
|
82
|
-
},
|
|
56
|
+
import axios from "axios";
|
|
57
|
+
import { __cms } from "@jx3box/jx3box-common/data/jx3box.json";
|
|
58
|
+
const API_Root = process.env.NODE_ENV === "production" ? __cms : "/";
|
|
59
|
+
const API = API_Root + "api/cms/upload";
|
|
60
|
+
|
|
61
|
+
import allow_types from "@jx3box/jx3box-common/data/conf";
|
|
62
|
+
const imgtypes = ["jpg", "png", "gif", "bmp", "webp", "jpeg"];
|
|
63
|
+
|
|
64
|
+
export default {
|
|
65
|
+
name: "Upload",
|
|
66
|
+
props: {
|
|
67
|
+
text: {
|
|
68
|
+
type: String,
|
|
83
69
|
},
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
API: API,
|
|
87
|
-
dialogVisible: false,
|
|
88
|
-
tip: this.desc || "一次最多同时上传10个文件(不超过5M),格式限常见的图片、文档、数据表及压缩包",
|
|
89
|
-
btn_txt: this.text || "上传附件",
|
|
90
|
-
|
|
91
|
-
fileList: [],
|
|
92
|
-
selectedCount: 0,
|
|
93
|
-
insertList: "",
|
|
94
|
-
|
|
95
|
-
// accept: allow_types.accept,
|
|
96
|
-
// sizeLimit: allow_types.sizeLimit,
|
|
97
|
-
};
|
|
70
|
+
onlyImage: {
|
|
71
|
+
type: Boolean,
|
|
98
72
|
},
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
deep: true,
|
|
102
|
-
handler: function(newval) {
|
|
103
|
-
this.$emit("update", newval);
|
|
104
|
-
},
|
|
105
|
-
},
|
|
106
|
-
insertList: function(newval) {
|
|
107
|
-
this.$emit("htmlUpdate", newval);
|
|
108
|
-
},
|
|
73
|
+
desc: {
|
|
74
|
+
type: String,
|
|
109
75
|
},
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
76
|
+
accept: {
|
|
77
|
+
type: String,
|
|
78
|
+
},
|
|
79
|
+
enable: {
|
|
80
|
+
type: Boolean,
|
|
81
|
+
default: true,
|
|
82
|
+
},
|
|
83
|
+
},
|
|
84
|
+
data: function () {
|
|
85
|
+
return {
|
|
86
|
+
API: API,
|
|
87
|
+
dialogVisible: false,
|
|
88
|
+
tip: this.desc || "一次最多同时上传10个文件(不超过5M),格式限常见的图片、文档、数据表及压缩包",
|
|
89
|
+
btn_txt: this.text || "上传附件",
|
|
90
|
+
|
|
91
|
+
fileList: [],
|
|
92
|
+
selectedCount: 0,
|
|
93
|
+
insertList: "",
|
|
94
|
+
|
|
95
|
+
// accept: allow_types.accept,
|
|
96
|
+
// sizeLimit: allow_types.sizeLimit,
|
|
97
|
+
};
|
|
98
|
+
},
|
|
99
|
+
watch: {
|
|
100
|
+
fileList: {
|
|
101
|
+
deep: true,
|
|
102
|
+
handler: function (newval) {
|
|
103
|
+
this.$emit("update", newval);
|
|
113
104
|
},
|
|
114
105
|
},
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
106
|
+
insertList: function (newval) {
|
|
107
|
+
this.$emit("htmlUpdate", newval);
|
|
108
|
+
},
|
|
109
|
+
},
|
|
110
|
+
computed: {
|
|
111
|
+
buttonTXT: function () {
|
|
112
|
+
return this.selectedCount ? "插 入" : "确 定";
|
|
113
|
+
},
|
|
114
|
+
},
|
|
115
|
+
methods: {
|
|
116
|
+
change: function (file, fileList) {
|
|
117
|
+
if (file.status != "success") {
|
|
118
|
+
// 判断大小
|
|
119
|
+
// if (file.size > this.sizeLimit) {
|
|
120
|
+
// this.$message.error("文件超出大小限制");
|
|
121
|
+
// this.removeFile(fileList, file.uid);
|
|
122
|
+
// return;
|
|
123
|
+
// }
|
|
124
|
+
|
|
125
|
+
// 分析文件类型
|
|
126
|
+
let ext = file.name.split(".").pop();
|
|
127
|
+
let is_img = imgtypes.includes(ext);
|
|
128
|
+
|
|
129
|
+
if (this.onlyImage && !is_img) return;
|
|
130
|
+
|
|
131
|
+
// 构建数据
|
|
132
|
+
let fdata = new FormData();
|
|
133
|
+
fdata.append("file", file.raw);
|
|
134
|
+
|
|
135
|
+
// 异步上传
|
|
136
|
+
axios
|
|
137
|
+
.post(API, fdata, {
|
|
138
|
+
headers: {
|
|
139
|
+
"Content-Type": "multipart/form-data",
|
|
140
|
+
},
|
|
141
|
+
withCredentials: true,
|
|
142
|
+
auth: {
|
|
143
|
+
username: (localStorage && localStorage.getItem("token")) || "",
|
|
144
|
+
password: "cms common request",
|
|
145
|
+
},
|
|
146
|
+
})
|
|
147
|
+
.then((res) => {
|
|
148
|
+
if (res.data.code) {
|
|
156
149
|
this.$message({
|
|
157
|
-
message:
|
|
158
|
-
type: "
|
|
150
|
+
message: res.data.msg,
|
|
151
|
+
type: "error",
|
|
159
152
|
});
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
file.selected = true;
|
|
167
|
-
|
|
168
|
-
// 修改状态加入仓库
|
|
169
|
-
file.status = "success";
|
|
170
|
-
this.fileList.push(file);
|
|
171
|
-
this.selectedCount++;
|
|
172
|
-
})
|
|
173
|
-
.catch((err) => {
|
|
174
|
-
if (err.response.data.code) {
|
|
175
|
-
this.$message.error(`[${err.response.data.code}] ${err.response.data.message}`);
|
|
176
|
-
} else {
|
|
177
|
-
this.$message.error("请求异常");
|
|
178
|
-
}
|
|
153
|
+
return;
|
|
154
|
+
}
|
|
155
|
+
// 提醒
|
|
156
|
+
this.$message({
|
|
157
|
+
message: "上传成功",
|
|
158
|
+
type: "success",
|
|
179
159
|
});
|
|
160
|
+
|
|
161
|
+
// 修改path
|
|
162
|
+
file.url = res.data.data && res.data.data[0];
|
|
163
|
+
|
|
164
|
+
// 额外赋值
|
|
165
|
+
file.is_img = is_img;
|
|
166
|
+
file.selected = true;
|
|
167
|
+
|
|
168
|
+
// 修改状态加入仓库
|
|
169
|
+
file.status = "success";
|
|
170
|
+
this.fileList.push(file);
|
|
171
|
+
this.selectedCount++;
|
|
172
|
+
})
|
|
173
|
+
.catch((err) => {
|
|
174
|
+
if (err.response.data.code) {
|
|
175
|
+
this.$message.error(`[${err.response.data.code}] ${err.response.data.message}`);
|
|
176
|
+
} else {
|
|
177
|
+
this.$message.error("请求异常");
|
|
178
|
+
}
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
},
|
|
182
|
+
select: function (file) {
|
|
183
|
+
if (file.status == "success") {
|
|
184
|
+
this.$set(file, "selected", !file.selected);
|
|
185
|
+
file.selected ? this.selectedCount++ : this.selectedCount--;
|
|
186
|
+
}
|
|
187
|
+
},
|
|
188
|
+
buildHTML: function () {
|
|
189
|
+
let list = [];
|
|
190
|
+
this.fileList.forEach((file) => {
|
|
191
|
+
if (file.selected) {
|
|
192
|
+
file.is_img ? list.push(`<img src="${file.url}" />`) : list.push(`<a target="_blank" href="${file.url}">${file.name}</a>`);
|
|
180
193
|
}
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
buildHTML: function() {
|
|
189
|
-
let list = [];
|
|
190
|
-
this.fileList.forEach((file) => {
|
|
191
|
-
if (file.selected) {
|
|
192
|
-
file.is_img ? list.push(`<img src="${file.url}" />`) : list.push(`<a target="_blank" href="${file.url}">${file.name}</a>`);
|
|
193
|
-
}
|
|
194
|
-
});
|
|
195
|
-
this.insertList = list.join(" \n");
|
|
196
|
-
return this.insertList;
|
|
197
|
-
},
|
|
198
|
-
insert: function() {
|
|
199
|
-
// 关闭窗口
|
|
200
|
-
this.dialogVisible = false;
|
|
194
|
+
});
|
|
195
|
+
this.insertList = list.join(" \n");
|
|
196
|
+
return this.insertList;
|
|
197
|
+
},
|
|
198
|
+
insert: function () {
|
|
199
|
+
// 关闭窗口
|
|
200
|
+
this.dialogVisible = false;
|
|
201
201
|
|
|
202
|
-
|
|
203
|
-
|
|
202
|
+
//为空不执行插入
|
|
203
|
+
if (!this.selectedCount) return;
|
|
204
204
|
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
205
|
+
// 传递值
|
|
206
|
+
this.$emit("insert", {
|
|
207
|
+
list: this.fileList,
|
|
208
|
+
html: this.buildHTML(),
|
|
209
|
+
});
|
|
210
210
|
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
},
|
|
211
|
+
//移除所有选择状态
|
|
212
|
+
this.resetSelectStatus();
|
|
213
|
+
},
|
|
214
|
+
resetSelectStatus: function () {
|
|
215
|
+
this.fileList.forEach((file, i) => {
|
|
216
|
+
this.$set(this.fileList[i], "selected", false);
|
|
217
|
+
});
|
|
218
|
+
this.selectedCount = 0;
|
|
219
|
+
},
|
|
220
|
+
clear: function () {
|
|
221
|
+
this.$refs.uploadbox.clearFiles();
|
|
222
|
+
this.fileList = [];
|
|
223
|
+
},
|
|
224
|
+
removeFile: function (fileList, uid) {
|
|
225
|
+
fileList.forEach((file, i) => {
|
|
226
|
+
if (file.uid == uid) {
|
|
227
|
+
fileList.splice(i, 1);
|
|
228
|
+
}
|
|
229
|
+
});
|
|
231
230
|
},
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
}
|
|
231
|
+
},
|
|
232
|
+
mounted: function () {},
|
|
233
|
+
components: {},
|
|
234
|
+
};
|
|
235
235
|
</script>
|
|
236
236
|
|
|
237
237
|
<style lang="less">
|
|
238
|
-
|
|
238
|
+
@import "../assets/css/upload.less";
|
|
239
239
|
</style>
|