Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
X
xxx_phase2_web
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
夏敏伟
xxx_phase2_web
Commits
a92ebafb
Commit
a92ebafb
authored
Dec 21, 2023
by
以墨为白
🎧
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
文件上传采用直连oss方式
parent
d301e904
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
64 additions
and
17 deletions
+64
-17
src/util/http_util.js
src/util/http_util.js
+46
-3
src/view/sjgl/wxk_public.vue
src/view/sjgl/wxk_public.vue
+18
-14
No files found.
src/util/http_util.js
View file @
a92ebafb
...
...
@@ -753,9 +753,11 @@ let httpSSERequest = (url, success, error) => {
* @param {*} url
* @param {*} file
*/
let
uploadOSS
=
(
url
,
file
)
=>
{
let
uploadOSS
=
(
filename
,
bucket
,
file
)
=>
{
new
Promise
((
resolve
,
reject
)
=>
{
fetch
(
url
).
then
(
res
=>
{
fetch
(
`api/rest/file/presign?filename=
${
filename
}
&bucket=
${
bucket
}
`
,
{
headers
:
new
Headers
(
addHeaders
({}))
}).
then
(
res
=>
{
if
(
res
.
status
==
200
)
{
return
res
.
json
();
}
else
{
...
...
@@ -783,7 +785,47 @@ let uploadOSS = (url, file) => {
})
})
}
let
uploadOSSProgress
=
(
filename
,
bucket
,
file
,
progressFunction
)
=>
{
return
new
Promise
((
resolve
,
reject
)
=>
{
fetch
(
`api/rest/file/presign?filename=
${
filename
}
&bucket=
${
bucket
}
`
,
{
headers
:
new
Headers
(
addHeaders
({}))
}).
then
(
res
=>
{
if
(
res
.
status
==
200
)
{
return
res
.
json
();
}
else
{
console
.
log
(
res
.
statusText
);
reject
(
HTTP_STATUS
);
}
}).
then
(
res
=>
{
if
(
res
.
code
==
9000
)
{
let
xhr
=
new
XMLHttpRequest
();
// XMLHttpRequest 对象
xhr
.
open
(
"
put
"
,
res
.
data
,
true
);
//
xhr
.
onload
=
(
e
)
=>
{
var
info
=
xhr
.
responseText
;
resolve
();
};
//请求完成
xhr
.
onerror
=
(
evt
)
=>
{
reject
({
message
:
"
错误
"
});
}
//请求失败
xhr
.
upload
.
onprogress
=
(
evt
)
=>
{
if
(
evt
.
lengthComputable
)
{
//
progressFunction
(
Math
.
round
(
evt
.
loaded
/
evt
.
total
*
100
)
+
"
%
"
);
}
}
//【上传进度调用方法实现】
xhr
.
upload
.
onloadstart
=
function
()
{
//上传开始执行方法
console
.
log
(
"
started
"
);
};
// xhr.setRequestHeader(ACCESS_TOKEN, token);
xhr
.
send
(
file
);
//开始上传,发送form数据
}
else
{
return
Promise
.
reject
({
err
:
res
.
message
});
}
}).
catch
(
err
=>
{
reject
({
err
:
err
});
});
});
};
export
{
get
,
...
...
@@ -825,5 +867,6 @@ export {
fileUploadProgress
,
post_machineWriting
,
httpSSERequest
,
uploadOSS
uploadOSS
,
uploadOSSProgress
}
\ No newline at end of file
src/view/sjgl/wxk_public.vue
View file @
a92ebafb
...
...
@@ -63,7 +63,8 @@
title=
"编辑"
></i>
<!--
<i
class=
"el-icon-delete-solid"
@
click=
"handleOpen(scope.$index, scope.row)"
title=
"打开软件"
v-if=
"fl_type===2"
></i>
-->
<div
class=
"ht-div"
@
click=
"handleOpen(scope.$index, scope.row)"
v-if=
"fl_type===2"
title=
"打开软件"
></div>
<div
class=
"ht-div"
@
click=
"handleOpen(scope.$index, scope.row)"
v-if=
"fl_type === 2"
title=
"打开软件"
></div>
<i
class=
"el-icon-delete-solid"
@
click=
"handleDelete(scope.$index, scope.row)"
title=
"删除"
></i>
</
template
>
...
...
@@ -183,8 +184,9 @@
title=
"编辑"
></i>
<!--
<i
class=
"el-icon-delete-solid"
@
click=
"handleOpen(scope.$index, scope.row)"
title=
"打开软件"
v-if=
"fl_type===2"
></i>
-->
<div
class=
"ht-div"
@
click=
"handleOpen(scope.$index, scope.row)"
v-if=
"fl_type===2"
title=
"打开软件"
></div>
<div
class=
"ht-div"
@
click=
"handleOpen(scope.$index, scope.row)"
v-if=
"fl_type === 2"
title=
"打开软件"
></div>
<i
class=
"el-icon-delete-solid"
@
click=
"handleDelete(scope.$index, scope.row)"
title=
"删除"
></i>
</
template
>
...
...
@@ -298,6 +300,7 @@ import {
post
,
fileUpload_PUT
,
fileUploadProgress
,
uploadOSSProgress
,
delete_util
,
startLoading
,
startLoadingProgress
,
...
...
@@ -598,7 +601,7 @@ export default {
download
(
path_srt
,
item
.
fileInfo
.
file
.
name
);
},
//打开软件
handleOpen
(
index
,
row
)
{
handleOpen
(
index
,
row
)
{
let
_this
=
this
;
//用户判断此格式是否是视频格式
let
video_type
=
false
;
...
...
@@ -614,19 +617,19 @@ export default {
img_type
=
true
;
}
});
if
(
video_type
||
img_type
)
{
window
.
protocolCheck
(
'
UHD://
'
,
(
fail
)
=>
{
if
(
video_type
||
img_type
)
{
window
.
protocolCheck
(
'
UHD://
'
,
(
fail
)
=>
{
// 安装则直接打开
_this
.
$message
({
type
:
"
warning
"
,
message
:
"
未找到注册表,请安装相应注册表
"
,
});
},(
succ
)
=>
{
},
(
succ
)
=>
{
// 安装则直接打开
console
.
log
(
'
succ
'
,
succ
)
}
}
)
}
else
{
}
else
{
_this
.
$message
({
type
:
"
warning
"
,
message
:
"
当前文件格式不支持本地软件操作
"
,
...
...
@@ -846,7 +849,7 @@ export default {
fd
.
append
(
"
file
"
,
file
);
fd
.
append
(
"
filename
"
,
md5
);
fd
.
append
(
"
bucket
"
,
"
MERGE
"
);
return
fileUploadProgress
(
"
api/rest/file/upload
"
,
fd
,
res
=>
{
//文件上传
return
uploadOSSProgress
(
md5
,
"
MERGE
"
,
file
,
res
=>
{
//文件上传
load
.
text
=
"
上传中:
"
+
res
;
});
}
else
{
...
...
@@ -856,7 +859,7 @@ export default {
.
then
(
res
=>
{
let
fd1
=
new
FormData
();
fd1
.
append
(
"
info
"
,
JSON
.
stringify
(
fileInfo
));
fd1
.
append
(
"
md5
"
,
res
);
fd1
.
append
(
"
md5
"
,
md5
);
fd1
.
append
(
"
destFilename
"
,
fileInfo
.
file
.
uuid
);
load
.
text
=
"
完成中
"
;
return
fileUpload_PUT
(
"
api/rest/3z/document/upload
"
,
fd1
);
//文件信息上传
...
...
@@ -1187,7 +1190,8 @@ export default {
.table-div
{
width
:
100%
;
height
:
calc
(
100%
-
50px
);
.ht-div
{
.ht-div
{
width
:
26px
;
height
:
21px
;
background-image
:
url(../../assets/img/setting/ht1.png)
;
...
...
@@ -1197,6 +1201,7 @@ export default {
float
:
left
;
cursor
:
pointer
;
}
.el-table
tr
{
background-color
:
transparent
!
important
;
color
:
#ffffff
c7
;
...
...
@@ -1489,5 +1494,4 @@ export default {
padding
:
25px
25px
0px
;
}
}
}
</
style
>
}
</
style
>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment