zydx-plus 1.32.319 → 1.33.321
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/components/dragPopup/src/dragPopup.vue +1 -0
- package/src/components/editor/src/editor.vue +1 -1
- package/src/components/tagging/src/tagging.vue +1 -1
- package/src/components/upload/index.js +25 -0
- package/src/components/upload/src/upload.vue +166 -0
- package/src/index.js +4 -1
package/package.json
CHANGED
|
@@ -306,7 +306,7 @@ export default {
|
|
|
306
306
|
let size = parseInt(window.getComputedStyle(className, null).fontSize)
|
|
307
307
|
let textWidth = this.measureText(className.innerText,size)
|
|
308
308
|
let textRows = Math.round((className.offsetLeft + textWidth) - className.offsetWidth * (rows - 1))
|
|
309
|
-
linkWidth = className.offsetWidth -
|
|
309
|
+
linkWidth = className.offsetWidth - taggingLeft
|
|
310
310
|
}
|
|
311
311
|
// 左边坐标
|
|
312
312
|
const y1 = className.offsetTop + className.offsetHeight + 60
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { createVNode, render } from 'vue'
|
|
2
|
+
import XtxConfirm from './src/upload.vue'
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
const divNode = createVNode('div', { class: 'xtx-confirm-upload' })
|
|
6
|
+
render(divNode, document.body)
|
|
7
|
+
// 获取 DOM 节点, 用于挂载组件或卸载组件
|
|
8
|
+
const container = divNode.el
|
|
9
|
+
|
|
10
|
+
const Confirm = ({ server, file, token, meta }) => {
|
|
11
|
+
// 返回 Promise 对象
|
|
12
|
+
return new Promise((resolve, reject) => {
|
|
13
|
+
const submit = (val) => {
|
|
14
|
+
resolve(val)
|
|
15
|
+
}
|
|
16
|
+
const cancel = () => {
|
|
17
|
+
render(null, container)
|
|
18
|
+
reject('点击取消')
|
|
19
|
+
}
|
|
20
|
+
// 1. 创建 XtxConfirm 组件
|
|
21
|
+
const VNode = createVNode(XtxConfirm, { server, file, token, meta, cancel, submit })
|
|
22
|
+
render(VNode, container)
|
|
23
|
+
})
|
|
24
|
+
}
|
|
25
|
+
export default Confirm
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="upload-content">
|
|
3
|
+
<div class="upload-centered">
|
|
4
|
+
<div class="upload-schedule">
|
|
5
|
+
<div class="upload-schedule-cont"></div>
|
|
6
|
+
<div class="upload-schedule-num"></div>
|
|
7
|
+
</div>
|
|
8
|
+
<button class="upload-but" @click="cancel">关闭</button>
|
|
9
|
+
</div>
|
|
10
|
+
</div>
|
|
11
|
+
</template>
|
|
12
|
+
|
|
13
|
+
<script>
|
|
14
|
+
import Mess from '../../tipBox/index'
|
|
15
|
+
|
|
16
|
+
export default {
|
|
17
|
+
name: 'zydx-upload',
|
|
18
|
+
data() {
|
|
19
|
+
return {
|
|
20
|
+
uploadShow: false,
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
props: {
|
|
24
|
+
server: {
|
|
25
|
+
type: String,
|
|
26
|
+
default: ''
|
|
27
|
+
},
|
|
28
|
+
token: {
|
|
29
|
+
type: String,
|
|
30
|
+
default: ''
|
|
31
|
+
},
|
|
32
|
+
file: {
|
|
33
|
+
type: Object,
|
|
34
|
+
default: () => {
|
|
35
|
+
return {}
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
meta: {
|
|
39
|
+
type: Object,
|
|
40
|
+
default: () => {
|
|
41
|
+
return {}
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
cancel: {
|
|
45
|
+
type: Function,
|
|
46
|
+
default: () => {}
|
|
47
|
+
},
|
|
48
|
+
submit: {
|
|
49
|
+
type: Function,
|
|
50
|
+
default: () => {}
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
mounted() {
|
|
54
|
+
this.$nextTick(() => {
|
|
55
|
+
this.uploadFile()
|
|
56
|
+
})
|
|
57
|
+
},
|
|
58
|
+
methods: {
|
|
59
|
+
// 上传文件
|
|
60
|
+
uploadFile() {
|
|
61
|
+
let _this = this
|
|
62
|
+
const meta = _this.meta ? Object.keys(_this.meta) : []
|
|
63
|
+
const param = new FormData()
|
|
64
|
+
param.append('file', _this.file)
|
|
65
|
+
for (let i = 0; i < meta.length; i++) {
|
|
66
|
+
param.append(meta[i], _this.meta[meta[i]])
|
|
67
|
+
}
|
|
68
|
+
const xhr = new XMLHttpRequest()
|
|
69
|
+
xhr.open('POST', _this.server)
|
|
70
|
+
xhr.setRequestHeader('Authorization', _this.token)
|
|
71
|
+
xhr.upload.onprogress = _this.progressFunction
|
|
72
|
+
xhr.onreadystatechange = () => {
|
|
73
|
+
if (xhr.readyState === 4) {
|
|
74
|
+
if (xhr.status === 200) {
|
|
75
|
+
const text = JSON.parse(xhr.responseText)
|
|
76
|
+
if(text.code === '200') {
|
|
77
|
+
_this.submit(text)
|
|
78
|
+
}else {
|
|
79
|
+
Mess({
|
|
80
|
+
type: 'text',
|
|
81
|
+
cancelShow: false,
|
|
82
|
+
promptContent: text.msg
|
|
83
|
+
})
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
xhr.send(param)
|
|
89
|
+
},
|
|
90
|
+
progressFunction(evt) {
|
|
91
|
+
const progressBar = document.querySelector('.upload-schedule-cont')
|
|
92
|
+
const percentageDiv = document.querySelector('.upload-schedule-num')
|
|
93
|
+
if (evt.lengthComputable) {
|
|
94
|
+
progressBar.style.width = evt.loaded / evt.total * 100 + '%'
|
|
95
|
+
percentageDiv.innerHTML = Math.round(evt.loaded / evt.total * 100) + '%'
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
</script>
|
|
101
|
+
|
|
102
|
+
<style scoped>
|
|
103
|
+
.upload-content {
|
|
104
|
+
position: fixed;
|
|
105
|
+
top: 0;
|
|
106
|
+
right: 0;
|
|
107
|
+
bottom: 0;
|
|
108
|
+
left: 0;
|
|
109
|
+
z-index: 9999;
|
|
110
|
+
background-color: rgba(0, 0, 0, 0.1);
|
|
111
|
+
display: flex;
|
|
112
|
+
align-items: center;
|
|
113
|
+
text-align: center;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
.upload-centered {
|
|
117
|
+
margin: 0 auto;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
.upload-schedule {
|
|
121
|
+
width: 300px;
|
|
122
|
+
height: 15px;
|
|
123
|
+
border-radius: 15px;
|
|
124
|
+
position: relative;
|
|
125
|
+
background-color: #fff;
|
|
126
|
+
box-shadow: inset 0 0 5px #ccc;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
.upload-schedule-num {
|
|
130
|
+
font-size: 12px;
|
|
131
|
+
color: #666;
|
|
132
|
+
position: absolute;
|
|
133
|
+
right: 5px;
|
|
134
|
+
top: -1px;
|
|
135
|
+
mix-blend-mode: difference;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
.upload-schedule-cont {
|
|
139
|
+
width: 0;
|
|
140
|
+
height: 100%;
|
|
141
|
+
border-radius: 15px;
|
|
142
|
+
background-color: #409EFF;
|
|
143
|
+
position: absolute;
|
|
144
|
+
left: 0;
|
|
145
|
+
top: 0;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
.upload-but {
|
|
149
|
+
width: 60px;
|
|
150
|
+
height: 20px;
|
|
151
|
+
background-color: #FFFFFF;
|
|
152
|
+
color: #000000;
|
|
153
|
+
border: #000000 1px solid;
|
|
154
|
+
line-height: 18px;
|
|
155
|
+
-webkit-border-radius: 3px;
|
|
156
|
+
border-radius: 3px;
|
|
157
|
+
font-size: 12px !important;
|
|
158
|
+
text-align: center;
|
|
159
|
+
cursor: pointer;
|
|
160
|
+
padding: 0 5px;
|
|
161
|
+
font-weight: normal;
|
|
162
|
+
box-sizing: border-box;
|
|
163
|
+
margin-top: 10px;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
</style>
|
package/src/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import Message from './components/tipBox/index';
|
|
2
|
+
import Upload from './components/upload/index';
|
|
2
3
|
import Calendar from './components/calendar/index';
|
|
3
4
|
import Switch from './components/switch/index';
|
|
4
5
|
import menuTree from './components/menuTree/index';
|
|
@@ -76,14 +77,16 @@ function install(app) {
|
|
|
76
77
|
});
|
|
77
78
|
app.config.globalProperties.$message = Message
|
|
78
79
|
app.config.globalProperties.$spinner = spinner
|
|
80
|
+
app.config.globalProperties.$upload = Upload
|
|
79
81
|
}
|
|
80
82
|
|
|
81
83
|
export default {
|
|
82
|
-
version: '1.
|
|
84
|
+
version: '1.33.321',
|
|
83
85
|
install,
|
|
84
86
|
Calendar,
|
|
85
87
|
Message,
|
|
86
88
|
spinner,
|
|
89
|
+
Upload,
|
|
87
90
|
Switch,
|
|
88
91
|
menuTree,
|
|
89
92
|
coloring,
|