Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
N
national_museum_vod
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
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
qzhxx
national_museum_vod
Commits
9d815ae5
Commit
9d815ae5
authored
Jun 16, 2021
by
Your Name
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
缩略图不显示
parent
8a16c63b
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
962 additions
and
956 deletions
+962
-956
httpServer.js
src/config/httpServer.js
+138
-138
uploadAudio.vue
src/page/content/components/uploadVue/uploadAudio.vue
+128
-128
uploadFile.vue
src/page/content/components/uploadVue/uploadFile.vue
+125
-125
uploadFolder.vue
src/page/content/components/uploadVue/uploadFolder.vue
+121
-121
uploadImg.vue
src/page/content/components/uploadVue/uploadImg.vue
+16
-11
uploadQrcode.vue
src/page/content/components/uploadVue/uploadQrcode.vue
+1
-1
add.vue
src/page/content/video/content/add.vue
+433
-432
No files found.
src/config/httpServer.js
View file @
9d815ae5
/**
/**
* Created by supervisor on 2017/11/3.
* Created by supervisor on 2017/11/3.
*/
*/
import
axios
from
'axios'
import
axios
from
'axios'
import
{
Message
,
MessageBox
,
Loading
}
from
'element-ui'
;
import
{
Message
,
MessageBox
,
Loading
}
from
'element-ui'
;
import
router
from
'../router'
import
router
from
'../router'
import
{
baseUrl
}
from
'./env'
import
{
baseUrl
}
from
'./env'
import
MyLocalStorage
from
'./myLocalStorage'
import
MyLocalStorage
from
'./myLocalStorage'
import
{
loginOut
}
from
'./loginOut'
import
{
loginOut
}
from
'./loginOut'
//axios 拦截器 请求时的拦截
//axios 拦截器 请求时的拦截
axios
.
interceptors
.
request
.
use
(
config
=>
{
axios
.
interceptors
.
request
.
use
(
config
=>
{
// 发送请求之前做一些处理
// 发送请求之前做一些处理
// config.headers = {
// config.headers = {
// 'Content-Type': 'application/json'
// 'Content-Type': 'application/json'
// };
// };
return
config
return
config
},
error
=>
{
},
error
=>
{
// 当请求异常时做一些处理
// 当请求异常时做一些处理
return
new
Promise
.
reject
(
error
)
return
new
Promise
.
reject
(
error
)
})
})
// 响应时拦截
// 响应时拦截
axios
.
interceptors
.
response
.
use
(
response
=>
{
axios
.
interceptors
.
response
.
use
(
response
=>
{
// 返回响应时做一些处理
// 返回响应时做一些处理
return
response
return
response
},
error
=>
{
},
error
=>
{
// 当响应异常时做一些处理
// 当响应异常时做一些处理
return
Promise
.
resolve
(
error
.
response
)
return
Promise
.
resolve
(
error
.
response
)
})
})
function
errorState
(
status
,
data
)
{
function
errorState
(
status
,
data
)
{
if
(
data
.
resultCode
==
'1109'
)
{
if
(
data
.
resultCode
==
'1109'
)
{
loginOut
()
loginOut
()
MessageBox
.
alert
(
'您的登录过期,请重新登录!'
,
'提示'
,
{
MessageBox
.
alert
(
'您的登录过期,请重新登录!'
,
'提示'
,
{
confirmButtonText
:
'确定'
,
confirmButtonText
:
'确定'
,
callback
:
()
=>
{
callback
:
()
=>
{
router
.
push
({
path
:
'/'
,
query
:
{
redirect
:
router
.
history
.
current
.
fullPath
}
})
router
.
push
({
path
:
'/'
,
query
:
{
redirect
:
router
.
history
.
current
.
fullPath
}
})
}
}
});
});
}
else
if
(
status
===
401
)
{
}
else
if
(
status
===
401
)
{
MessageBox
.
alert
(
'您的用户权限已被禁用,请联系管理员!'
,
'提示'
,
{
MessageBox
.
alert
(
'您的用户权限已被禁用,请联系管理员!'
,
'提示'
,
{
confirmButtonText
:
'确定'
,
confirmButtonText
:
'确定'
,
callback
:
()
=>
{
callback
:
()
=>
{
//这个时候点击确定后清除用户信息
//这个时候点击确定后清除用户信息
localStorage
.
removeItem
(
'backToken'
)
localStorage
.
removeItem
(
'backToken'
)
localStorage
.
removeItem
(
'userId'
)
localStorage
.
removeItem
(
'userId'
)
router
.
push
({
path
:
'/'
,
query
:
{
redirect
:
router
.
history
.
current
.
fullPath
}
})
router
.
push
({
path
:
'/'
,
query
:
{
redirect
:
router
.
history
.
current
.
fullPath
}
})
}
}
});
});
}
else
if
(
status
===
500
&&
data
.
message
.
indexOf
(
"not have permission"
)
!==
-
1
)
{
}
else
if
(
status
===
500
&&
data
.
message
.
indexOf
(
"not have permission"
)
!==
-
1
)
{
Message
.
error
(
"抱歉,你无权访问该页面!"
)
Message
.
error
(
"抱歉,你无权访问该页面!"
)
}
else
if
(
!
data
)
{
}
else
if
(
!
data
)
{
Message
.
error
(
"网络出小差咯~"
)
Message
.
error
(
"网络出小差咯~"
)
}
}
}
}
function
successState
(
res
)
{
function
successState
(
res
)
{
}
}
const
httpServer
=
(
opts
,
data
,
file
,
timeout
)
=>
{
const
httpServer
=
(
opts
,
data
,
file
,
timeout
)
=>
{
//如果是不需要登录就可以访问的接口 需要设置opts.open
//如果是不需要登录就可以访问的接口 需要设置opts.open
let
Public
=
{}
//公共参数
let
Public
=
{}
//公共参数
let
httpDefaultOpts
=
{
let
httpDefaultOpts
=
{
method
:
opts
.
method
,
method
:
opts
.
method
,
url
:
baseUrl
+
opts
.
url
,
url
:
baseUrl
+
opts
.
url
,
timeout
:
timeout
?
timeout
:
10800000
,
timeout
:
timeout
?
timeout
:
10800000
,
params
:
Object
.
assign
(
Public
,
data
),
params
:
Object
.
assign
(
Public
,
data
),
data
:
data
,
data
:
data
,
headers
:
opts
.
headers
||
{},
headers
:
opts
.
headers
||
{},
responseType
:
opts
.
responseType
||
''
responseType
:
opts
.
responseType
||
''
};
};
httpDefaultOpts
.
headers
[
"Access-control-Allow-Origin"
]
=
"*"
;
httpDefaultOpts
.
headers
[
"Access-control-Allow-Origin"
]
=
"*"
;
httpDefaultOpts
.
headers
[
"Access-Control-Allow-Headers"
]
=
"content-type,x-requested-with"
;
httpDefaultOpts
.
headers
[
"Access-Control-Allow-Headers"
]
=
"content-type,x-requested-with"
;
let
authToken
=
""
;
let
authToken
=
""
;
if
(
opts
.
authType
&&
opts
.
authType
!=
""
)
{
if
(
opts
.
authType
&&
opts
.
authType
!=
""
)
{
// Authorization
// Authorization
if
(
opts
.
authType
===
"back"
)
{
if
(
opts
.
authType
===
"back"
)
{
authToken
=
localStorage
.
getItem
(
'backToken'
);
authToken
=
localStorage
.
getItem
(
'backToken'
);
}
else
if
(
opts
.
authType
===
"front"
)
{
}
else
if
(
opts
.
authType
===
"front"
)
{
authToken
=
localStorage
.
getItem
(
"token"
)
||
MyLocalStorage
.
Cache
.
get
(
'token'
);
authToken
=
localStorage
.
getItem
(
"token"
)
||
MyLocalStorage
.
Cache
.
get
(
'token'
);
}
}
httpDefaultOpts
.
headers
[
"Authorization"
]
=
authToken
httpDefaultOpts
.
headers
[
"Authorization"
]
=
authToken
}
}
if
(
opts
.
method
===
'get'
)
{
if
(
opts
.
method
===
'get'
)
{
delete
httpDefaultOpts
.
data
delete
httpDefaultOpts
.
data
httpDefaultOpts
.
params
.
timestamp_static
=
new
Date
().
getTime
();
httpDefaultOpts
.
params
.
timestamp_static
=
new
Date
().
getTime
();
}
else
{
}
else
{
delete
httpDefaultOpts
.
params
delete
httpDefaultOpts
.
params
if
(
file
)
{
if
(
file
)
{
httpDefaultOpts
.
data
=
data
;
httpDefaultOpts
.
data
=
data
;
}
}
}
}
let
promise
=
new
Promise
(
function
(
resolve
,
reject
)
{
let
promise
=
new
Promise
(
function
(
resolve
,
reject
)
{
let
loadingInstance
=
Loading
.
service
({
let
loadingInstance
=
Loading
.
service
({
fullscreen
:
true
,
fullscreen
:
true
,
lock
:
true
,
lock
:
true
,
background
:
'rgba(0,0,0,.5)'
,
background
:
'rgba(0,0,0,.5)'
,
text
:
'Loading'
,
text
:
'Loading'
,
spinner
:
'el-icon-loading'
spinner
:
'el-icon-loading'
})
})
// let markIndex = setTimeout(function () {
// let markIndex = setTimeout(function () {
// loadingInstance.close();
// loadingInstance.close();
// }, 10000)
// }, 10000)
axios
(
httpDefaultOpts
).
then
((
res
)
=>
{
axios
(
httpDefaultOpts
).
then
((
res
)
=>
{
// console.log(res)
// console.log(res)
if
(
res
.
data
)
{
if
(
res
.
data
)
{
loadingInstance
.
close
();
loadingInstance
.
close
();
// clearTimeout(markIndex)
// clearTimeout(markIndex)
}
}
if
(
res
.
data
.
resultCode
==
'1109'
&&
localStorage
.
getItem
(
'backToken'
))
{
if
(
res
.
data
.
resultCode
==
'1109'
&&
localStorage
.
getItem
(
'backToken'
))
{
//清除用户信息
//清除用户信息
errorState
(
res
.
status
,
res
.
data
)
errorState
(
res
.
status
,
res
.
data
)
}
else
{
}
else
{
successState
(
res
)
successState
(
res
)
resolve
(
res
)
resolve
(
res
)
}
}
}).
catch
((
response
)
=>
{
}).
catch
((
response
)
=>
{
loadingInstance
.
close
();
loadingInstance
.
close
();
clearTimeout
(
markIndex
)
clearTimeout
(
markIndex
)
console
.
log
(
"catch"
)
console
.
log
(
"catch"
)
if
(
response
&&
response
.
response
&&
response
.
response
.
status
&&
response
.
response
.
data
)
{
if
(
response
&&
response
.
response
&&
response
.
response
.
status
&&
response
.
response
.
data
)
{
errorState
(
response
.
response
.
status
,
response
.
response
.
data
)
errorState
(
response
.
response
.
status
,
response
.
response
.
data
)
}
}
reject
(
response
)
reject
(
response
)
if
(
response
.
response
.
data
)
{
if
(
response
.
response
.
data
)
{
if
(
response
.
response
.
data
.
message
)
{
if
(
response
.
response
.
data
.
message
)
{
Message
.
error
(
response
.
response
.
data
.
message
)
Message
.
error
(
response
.
response
.
data
.
message
)
}
else
{
}
else
{
Message
.
error
(
"操作失败!"
)
Message
.
error
(
"操作失败!"
)
}
}
}
}
})
})
})
})
return
promise
return
promise
}
}
export
default
httpServer
export
default
httpServer
src/page/content/components/uploadVue/uploadAudio.vue
View file @
9d815ae5
<
template
>
<
template
>
<div>
<div>
<!--
{{
fileList
}}
-->
<!--
{{
fileList
}}
-->
<el-upload
<el-upload
ref=
"upload"
ref=
"upload"
accept=
".mp3,.aac,.wma,.rm,.flac,.ogg,"
accept=
".mp3,.aac,.wma,.rm,.flac,.ogg,"
:multiple=
"true"
:multiple=
"true"
:http-request=
"uploadFile"
:http-request=
"uploadFile"
:file-list=
"fileList"
:file-list=
"fileList"
action
action
:auto-upload=
"false"
:auto-upload=
"false"
:before-upload=
"beforeAvatarUpload"
:before-upload=
"beforeAvatarUpload"
:on-remove=
"handleRemove"
:on-remove=
"handleRemove"
>
>
<i
class=
"el-icon-plus fileUpload"
></i>
<i
class=
"el-icon-plus fileUpload"
></i>
</el-upload>
</el-upload>
<el-button
style=
"margin-left: 10px;"
size=
"small"
type=
"success"
v-loading=
"loading"
@
click=
"submitUpload"
>
上传到服务器
</el-button>
<el-button
style=
"margin-left: 10px;"
size=
"small"
type=
"success"
v-loading=
"loading"
@
click=
"submitUpload"
>
上传到服务器
</el-button>
</div>
</div>
</
template
>
</
template
>
<
script
>
<
script
>
export
default
{
export
default
{
props
:{
props
:{
fileList
:{
fileList
:{
type
:
Array
,
type
:
Array
,
default
:[]
default
:[]
},
},
},
},
data
()
{
data
()
{
return
{
return
{
fullscreenLoading
:
false
,
fullscreenLoading
:
false
,
loading
:
false
,
loading
:
false
,
filedata
:
[],
filedata
:
[],
fileArr
:
[],
fileArr
:
[],
};
};
},
},
mounted
(){
mounted
(){
// console.log("uploadAudio",this.fileList)
// console.log("uploadAudio",this.fileList)
},
},
methods
:
{
methods
:
{
handleRemove
(
file
,
fileList
)
{
handleRemove
(
file
,
fileList
)
{
// console.log(fileList,fileList.map(item=>item.id),'1111')
// console.log(fileList,fileList.map(item=>item.id),'1111')
// return this.$confirm(`确定移除 ${ file.name }?`);
// return this.$confirm(`确定移除 ${ file.name }?`);
this
.
$emit
(
'audioList'
,
fileList
.
map
(
item
=>
item
.
id
))
this
.
$emit
(
'audioList'
,
fileList
.
map
(
item
=>
item
.
id
))
},
},
submitUpload
()
{
submitUpload
()
{
const
loading
=
this
.
$loading
({
const
loading
=
this
.
$loading
({
lock
:
true
,
lock
:
true
,
text
:
'上传中,请稍候。。。'
,
text
:
'上传中,请稍候。。。'
,
spinner
:
'el-icon-loading'
,
spinner
:
'el-icon-loading'
,
background
:
'rgba(0, 0, 0, 0.7)'
background
:
'rgba(0, 0, 0, 0.7)'
});
});
// this.loading = true
// this.loading = true
this
.
filedata
=
new
FormData
()
// 用FormData存放上传文件
this
.
filedata
=
new
FormData
()
// 用FormData存放上传文件
this
.
$refs
.
upload
.
submit
()
// 会循环调用uploadFile方法,多个文件调用多次
this
.
$refs
.
upload
.
submit
()
// 会循环调用uploadFile方法,多个文件调用多次
let
_this
=
this
;
let
_this
=
this
;
_this
_this
.
$https
(
.
$https
(
{
{
method
:
"post"
,
method
:
"post"
,
url
:
"file/audio/upload"
,
url
:
"file/audio/upload"
,
authType
:
this
.
backToken
authType
:
this
.
backToken
},
},
this
.
filedata
this
.
filedata
)
)
.
then
(
res
=>
{
.
then
(
res
=>
{
let
resData
=
res
.
data
;
let
resData
=
res
.
data
;
console
.
log
(
res
)
// console.log(res)
loading
.
close
();
loading
.
close
();
// this.loading = false
// this.loading = false
if
(
resData
.
resultCode
==
"200"
)
{
if
(
resData
.
resultCode
==
"200"
)
{
_this
.
$message
.
success
(
'上传成功!'
)
_this
.
$message
.
success
(
'上传成功!'
)
const
data
=
resData
.
data
.
fileList
const
data
=
resData
.
data
.
fileList
let
newArray
=
data
.
map
((
item
)
=>
item
.
id
)
let
newArray
=
data
.
map
((
item
)
=>
item
.
id
)
let
editArray
=
[]
let
editArray
=
[]
if
(
this
.
fileList
.
length
){
if
(
this
.
fileList
.
length
){
editArray
=
this
.
fileList
.
map
(
item
=>
item
.
id
)
editArray
=
this
.
fileList
.
map
(
item
=>
item
.
id
)
}
}
this
.
$emit
(
'audioList'
,
[...
newArray
,...
editArray
])
this
.
$emit
(
'audioList'
,
[...
newArray
,...
editArray
])
}
else
{
}
else
{
_this
.
$message
.
error
(
resData
.
msg
||
resData
.
message
);
_this
.
$message
.
error
(
resData
.
msg
||
resData
.
message
);
}
}
})
})
.
catch
(
err
=>
{
.
catch
(
err
=>
{
console
.
log
(
err
);
console
.
log
(
err
);
_this
.
$message
.
error
(
err
.
msg
||
err
.
message
);
_this
.
$message
.
error
(
err
.
msg
||
err
.
message
);
});
});
},
},
uploadFile
(
file
)
{
uploadFile
(
file
)
{
this
.
filedata
.
append
(
'file'
,
file
.
file
)
this
.
filedata
.
append
(
'file'
,
file
.
file
)
},
},
beforeAvatarUpload
(
file
)
{
beforeAvatarUpload
(
file
)
{
const
isLt5M
=
file
.
size
/
1024
/
1024
/
1024
<
1
;
const
isLt5M
=
file
.
size
/
1024
/
1024
/
1024
<
1
;
if
(
!
isLt5M
)
{
if
(
!
isLt5M
)
{
this
.
$message
.
error
(
"上传文件大小不能超过 1GB!"
);
this
.
$message
.
error
(
"上传文件大小不能超过 1GB!"
);
}
}
return
isLt5M
;
return
isLt5M
;
// var testmsg = file.name.substring(file.name.lastIndexOf('.')+1)
// var testmsg = file.name.substring(file.name.lastIndexOf('.')+1)
// const extension = (testmsg === 'mp3')||(testmsg === 'aac')||(testmsg === 'wma')||(testmsg === 'rm')||(testmsg === 'flac')||(testmsg === 'ogg')
// const extension = (testmsg === 'mp3')||(testmsg === 'aac')||(testmsg === 'wma')||(testmsg === 'rm')||(testmsg === 'flac')||(testmsg === 'ogg')
// if(!extension){
// if(!extension){
// this.$message({
// this.$message({
// message:"上传文件只能是mp3,aac,wma,rm,flac,ogg,格式!",
// message:"上传文件只能是mp3,aac,wma,rm,flac,ogg,格式!",
// type:'error'
// type:'error'
// })
// })
// }
// }
// return extension;
// return extension;
}
}
}
}
};
};
</
script
>
</
script
>
<
style
>
<
style
>
.el-upload
.fileUpload
{
.el-upload
.fileUpload
{
width
:
148px
;
width
:
148px
;
height
:
148px
;
height
:
148px
;
line-height
:
148px
!important
;
line-height
:
148px
!important
;
margin
:
0
auto
;
margin
:
0
auto
;
border
:
1px
dashed
#c0ccda
;
border
:
1px
dashed
#c0ccda
;
font-size
:
24px
;
font-size
:
24px
;
font
:
#ccc
;
font
:
#ccc
;
}
}
</
style
>
</
style
>
src/page/content/components/uploadVue/uploadFile.vue
View file @
9d815ae5
<
template
>
<
template
>
<div>
<div>
<el-upload
<el-upload
ref=
"upload"
ref=
"upload"
accept=
".mp4,.flv,.mpeg,.mpg,.mov"
accept=
".mp4,.flv,.mpeg,.mpg,.mov"
:multiple=
"true"
:multiple=
"true"
:http-request=
"uploadFile"
:http-request=
"uploadFile"
:file-list=
"fileList"
:file-list=
"fileList"
action
action
:auto-upload=
"false"
:auto-upload=
"false"
:before-upload=
"beforeAvatarUpload"
:before-upload=
"beforeAvatarUpload"
>
>
<i
class=
"el-icon-plus fileUpload"
></i>
<i
class=
"el-icon-plus fileUpload"
></i>
</el-upload>
</el-upload>
<el-button
style=
"margin-left: 10px;"
size=
"small"
type=
"success"
v-loading=
"loading"
@
click=
"submitUpload"
>
上传到服务器
</el-button>
<el-button
style=
"margin-left: 10px;"
size=
"small"
type=
"success"
v-loading=
"loading"
@
click=
"submitUpload"
>
上传到服务器
</el-button>
</div>
</div>
</
template
>
</
template
>
<
script
>
<
script
>
export
default
{
export
default
{
props
:{
props
:{
fileList
:{
fileList
:{
type
:
Array
,
type
:
Array
,
default
:[]
default
:[]
},
},
},
},
data
()
{
data
()
{
return
{
return
{
fullscreenLoading
:
false
,
fullscreenLoading
:
false
,
loading
:
false
,
loading
:
false
,
filedata
:[],
filedata
:[],
fileArr
:
[],
fileArr
:
[],
fileList
:[],
fileList
:[],
// fileList: [{name: 'food.jpeg', url: 'https://fuss10.elemecdn.com/3/63/4e7f3a15429bfda99bce42a18cdd1jpeg.jpeg?imageMogr2/thumbnail/360x360/format/webp/quality/100'}, {name: 'food2.jpeg', url: 'https://fuss10.elemecdn.com/3/63/4e7f3a15429bfda99bce42a18cdd1jpeg.jpeg?imageMogr2/thumbnail/360x360/format/webp/quality/100'}]
// fileList: [{name: 'food.jpeg', url: 'https://fuss10.elemecdn.com/3/63/4e7f3a15429bfda99bce42a18cdd1jpeg.jpeg?imageMogr2/thumbnail/360x360/format/webp/quality/100'}, {name: 'food2.jpeg', url: 'https://fuss10.elemecdn.com/3/63/4e7f3a15429bfda99bce42a18cdd1jpeg.jpeg?imageMogr2/thumbnail/360x360/format/webp/quality/100'}]
};
};
},
},
methods
:
{
methods
:
{
openFullScreen2
()
{
openFullScreen2
()
{
const
loading
=
this
.
$loading
({
const
loading
=
this
.
$loading
({
lock
:
true
,
lock
:
true
,
text
:
'上传中,请稍候。。。'
,
text
:
'上传中,请稍候。。。'
,
spinner
:
'el-icon-loading'
,
spinner
:
'el-icon-loading'
,
background
:
'rgba(0, 0, 0, 0.7)'
background
:
'rgba(0, 0, 0, 0.7)'
});
});
},
},
submitUpload
()
{
// 导入
submitUpload
()
{
// 导入
// this.openFullScreen2()
// this.openFullScreen2()
const
loading
=
this
.
$loading
({
const
loading
=
this
.
$loading
({
lock
:
true
,
lock
:
true
,
text
:
'上传中,请稍候。。。'
,
text
:
'上传中,请稍候。。。'
,
spinner
:
'el-icon-loading'
,
spinner
:
'el-icon-loading'
,
background
:
'rgba(0, 0, 0, 0.7)'
background
:
'rgba(0, 0, 0, 0.7)'
});
});
// this.loading = true
// this.loading = true
let
tempData
=
this
.
filedata
let
tempData
=
this
.
filedata
this
.
filedata
=
new
FormData
()
// 用FormData存放上传文件
this
.
filedata
=
new
FormData
()
// 用FormData存放上传文件
this
.
$refs
.
upload
.
submit
()
// 会循环调用uploadFile方法,多个文件调用多次
this
.
$refs
.
upload
.
submit
()
// 会循环调用uploadFile方法,多个文件调用多次
let
_this
=
this
;
let
_this
=
this
;
_this
_this
.
$https
(
.
$https
(
{
{
method
:
"post"
,
method
:
"post"
,
url
:
"file/video/content/upload"
,
url
:
"file/video/content/upload"
,
authType
:
this
.
backToken
authType
:
this
.
backToken
},
},
this
.
filedata
this
.
filedata
)
)
.
then
(
res
=>
{
.
then
(
res
=>
{
let
resData
=
res
.
data
;
let
resData
=
res
.
data
;
console
.
log
(
res
)
// console.log(res)
loading
.
close
();
loading
.
close
();
// this.loading = false
// this.loading = false
if
(
resData
.
resultCode
==
"200"
)
{
if
(
resData
.
resultCode
==
"200"
)
{
_this
.
$message
.
success
(
'上传成功!'
)
_this
.
$message
.
success
(
'上传成功!'
)
const
data
=
resData
.
data
.
fileList
;
const
data
=
resData
.
data
.
fileList
;
let
newArray
=
data
.
map
((
item
)
=>
item
.
id
);
let
newArray
=
data
.
map
((
item
)
=>
item
.
id
);
let
editArray
=
[]
let
editArray
=
[]
if
(
this
.
fileList
.
length
){
if
(
this
.
fileList
.
length
){
editArray
=
this
.
fileList
.
map
(
item
=>
item
.
id
)
editArray
=
this
.
fileList
.
map
(
item
=>
item
.
id
)
}
}
this
.
$emit
(
"videoList"
,
[...
newArray
,...
editArray
]);
this
.
$emit
(
"videoList"
,
[...
newArray
,...
editArray
]);
}
else
{
}
else
{
_this
.
$message
.
error
(
resData
.
msg
||
resData
.
message
);
_this
.
$message
.
error
(
resData
.
msg
||
resData
.
message
);
}
}
})
})
.
catch
(
err
=>
{
.
catch
(
err
=>
{
console
.
log
(
err
);
console
.
log
(
err
);
_this
.
$message
.
error
(
err
.
msg
||
err
.
message
);
_this
.
$message
.
error
(
err
.
msg
||
err
.
message
);
});
});
},
},
uploadFile
(
file
)
{
uploadFile
(
file
)
{
console
.
log
(
file
)
// console.log(file)
this
.
filedata
.
append
(
'file'
,
file
.
file
)
this
.
filedata
.
append
(
'file'
,
file
.
file
)
},
},
beforeAvatarUpload
(
file
)
{
beforeAvatarUpload
(
file
)
{
const
isLt10G
=
file
.
size
/
1024
/
1024
/
1024
<
10
;
const
isLt10G
=
file
.
size
/
1024
/
1024
/
1024
<
10
;
if
(
!
isLt10G
)
{
if
(
!
isLt10G
)
{
this
.
$message
.
error
(
"上传文件大小不能超过 10GB!"
);
this
.
$message
.
error
(
"上传文件大小不能超过 10GB!"
);
}
}
return
isLt10G
;
return
isLt10G
;
}
}
}
}
};
};
</
script
>
</
script
>
<
style
>
<
style
>
.el-upload
.fileUpload
{
.el-upload
.fileUpload
{
width
:
148px
;
width
:
148px
;
height
:
148px
;
height
:
148px
;
line-height
:
148px
!important
;
line-height
:
148px
!important
;
margin
:
0
auto
;
margin
:
0
auto
;
border
:
1px
dashed
#c0ccda
;
border
:
1px
dashed
#c0ccda
;
font-size
:
24px
;
font-size
:
24px
;
font
:
#ccc
;
font
:
#ccc
;
}
}
</
style
>
</
style
>
src/page/content/components/uploadVue/uploadFolder.vue
View file @
9d815ae5
<
template
>
<
template
>
<el-form
enctype=
"multipart/form-data"
>
<el-form
enctype=
"multipart/form-data"
>
选择多文件:
选择多文件:
<input
type=
"file"
name=
"files"
multiple=
"multiple"
@
change=
"getFiles($event)"
/>
<input
type=
"file"
name=
"files"
multiple=
"multiple"
@
change=
"getFiles($event)"
/>
<br
/>
选择文件夹:
<br
/>
选择文件夹:
<input
@
change=
"getFiles($event)"
type=
"file"
name=
"files"
webkitdirectory
mozdirectory
/>
<input
@
change=
"getFiles($event)"
type=
"file"
name=
"files"
webkitdirectory
mozdirectory
/>
<br
/>
<br
/>
<ul
class=
"el-upload-list el-upload-list--text"
>
<ul
class=
"el-upload-list el-upload-list--text"
>
<li
class=
"el-upload-list__item is-ready"
v-for=
"(item, i) in files"
:label=
"item.name"
:value=
"item.name"
:key=
"i"
>
<li
class=
"el-upload-list__item is-ready"
v-for=
"(item, i) in files"
:label=
"item.name"
:value=
"item.name"
:key=
"i"
>
{{
item
.
name
}}
{{
item
.
name
}}
<span>
<span>
<el-button
size=
"mini"
type=
"text"
>
<el-button
size=
"mini"
type=
"text"
>
<i
@
click=
"remove(item)"
class=
"el-icon-close"
></i>
<i
@
click=
"remove(item)"
class=
"el-icon-close"
></i>
</el-button>
</el-button>
</span>
</span>
</li>
</li>
</ul>
</ul>
<el-button
size=
"medium"
type=
"success"
@
click
.
stop=
"upload"
>
上传到服务器
</el-button>
<el-button
size=
"medium"
type=
"success"
@
click
.
stop=
"upload"
>
上传到服务器
</el-button>
</el-form>
</el-form>
</
template
>
</
template
>
<
script
>
<
script
>
import
axios
from
"axios"
;
import
axios
from
"axios"
;
export
default
{
export
default
{
name
:
"UploadFileVue"
,
name
:
"UploadFileVue"
,
props
:{
props
:{
fileList
:{
fileList
:{
type
:
Array
,
type
:
Array
,
default
:
[]
default
:
()
=>
[]
},
},
},
},
data
()
{
data
()
{
return
{
return
{
fullscreenLoading
:
false
,
fullscreenLoading
:
false
,
files
:
[
files
:
[
]
]
};
};
},
},
watch
:
{
watch
:
{
fileList
(
newName
,
oldName
)
{
fileList
(
newName
,
oldName
)
{
console
.
log
(
newName
)
// console.log(newName)
this
.
files
=
newName
this
.
files
=
newName
// ...
// ...
}
}
},
},
computed
:
{
computed
:
{
headers
()
{
headers
()
{
return
{
return
{
Authorization
:
localStorage
.
getItem
(
"backToken"
)
||
""
Authorization
:
localStorage
.
getItem
(
"backToken"
)
||
""
};
};
}
}
},
},
methods
:
{
methods
:
{
remove
(
data
)
{
remove
(
data
)
{
const
children
=
this
.
files
;
const
children
=
this
.
files
;
const
index
=
children
.
findIndex
(
d
=>
d
.
name
===
data
.
name
);
const
index
=
children
.
findIndex
(
d
=>
d
.
name
===
data
.
name
);
children
.
splice
(
index
,
1
);
children
.
splice
(
index
,
1
);
console
.
log
(
this
.
files
,
'111'
)
// console.log(this.files,'111')
this
.
$emit
(
"videoList"
,
this
.
files
.
map
(
item
=>
item
.
id
));
this
.
$emit
(
"videoList"
,
this
.
files
.
map
(
item
=>
item
.
id
));
},
},
getFiles
:
function
(
event
)
{
getFiles
:
function
(
event
)
{
console
.
log
(
event
);
// console.log(event);
var
files
=
event
.
target
.
files
;
var
files
=
event
.
target
.
files
;
for
(
var
i
=
0
;
i
<
files
.
length
;
i
++
)
{
for
(
var
i
=
0
;
i
<
files
.
length
;
i
++
)
{
this
.
files
.
push
(
files
[
i
]);
this
.
files
.
push
(
files
[
i
]);
}
}
console
.
log
(
this
.
files
,
"--"
);
// console.log(this.files, "--");
},
},
upload
:
function
()
{
upload
:
function
()
{
const
loading
=
this
.
$loading
({
const
loading
=
this
.
$loading
({
lock
:
true
,
lock
:
true
,
text
:
'上传中,请稍候。。。'
,
text
:
'上传中,请稍候。。。'
,
spinner
:
'el-icon-loading'
,
spinner
:
'el-icon-loading'
,
background
:
'rgba(0, 0, 0, 0.7)'
background
:
'rgba(0, 0, 0, 0.7)'
});
});
console
.
log
(
this
.
files
);
// console.log(this.files);
var
formData
=
new
FormData
();
var
formData
=
new
FormData
();
for
(
var
i
=
0
;
i
<
this
.
files
.
length
;
i
++
)
{
for
(
var
i
=
0
;
i
<
this
.
files
.
length
;
i
++
)
{
formData
.
append
(
"file"
,
this
.
files
[
i
]);
formData
.
append
(
"file"
,
this
.
files
[
i
]);
}
}
console
.
log
(
formData
);
// console.log(formData);
let
_this
=
this
;
let
_this
=
this
;
_this
_this
.
$https
(
.
$https
(
{
{
method
:
"post"
,
method
:
"post"
,
url
:
"file/video/content/upload"
,
url
:
"file/video/content/upload"
,
authType
:
this
.
backToken
authType
:
this
.
backToken
},
},
formData
formData
)
)
.
then
(
res
=>
{
.
then
(
res
=>
{
loading
.
close
();
loading
.
close
();
let
resData
=
res
.
data
;
let
resData
=
res
.
data
;
console
.
log
(
res
);
// console.log(res);
if
(
resData
.
resultCode
==
"200"
)
{
if
(
resData
.
resultCode
==
"200"
)
{
_this
.
$message
.
success
(
"上传成功!"
);
_this
.
$message
.
success
(
"上传成功!"
);
const
data
=
resData
.
data
.
fileList
;
const
data
=
resData
.
data
.
fileList
;
let
newArray
=
data
.
map
((
item
)
=>
item
.
id
);
let
newArray
=
data
.
map
((
item
)
=>
item
.
id
);
let
editArray
=
[]
let
editArray
=
[]
if
(
this
.
files
.
length
){
if
(
this
.
files
.
length
){
editArray
=
this
.
files
.
map
(
item
=>
item
.
id
)
editArray
=
this
.
files
.
map
(
item
=>
item
.
id
)
}
}
this
.
$emit
(
"videoList"
,
[...
newArray
,...
editArray
]);
this
.
$emit
(
"videoList"
,
[...
newArray
,...
editArray
]);
}
else
{
}
else
{
_this
.
$message
.
error
(
resData
.
msg
||
resData
.
message
);
_this
.
$message
.
error
(
resData
.
msg
||
resData
.
message
);
}
}
})
})
.
catch
(
err
=>
{
.
catch
(
err
=>
{
console
.
log
(
err
);
console
.
log
(
err
);
_this
.
$message
.
error
(
err
.
msg
||
err
.
message
);
_this
.
$message
.
error
(
err
.
msg
||
err
.
message
);
});
});
}
}
}
}
};
};
</
script
>
</
script
>
<
style
>
<
style
>
</
style
>
</
style
>
\ No newline at end of file
src/page/content/components/uploadVue/uploadImg.vue
View file @
9d815ae5
...
@@ -9,7 +9,7 @@
...
@@ -9,7 +9,7 @@
:on-remove="handleRemove"
:on-remove="handleRemove"
:on-success="handleAvatarSuccess"
:on-success="handleAvatarSuccess"
:headers="headers"
:headers="headers"
:file-list="fileList"
:file-list="file
Show
List"
:limit="1"
:limit="1"
:multiple ="false"
:multiple ="false"
>
>
...
@@ -24,19 +24,24 @@
...
@@ -24,19 +24,24 @@
<
script
>
<
script
>
export
default
{
export
default
{
//
props:{
props
:{
//
fileList:{
fileList
:{
//
type: Array,
type
:
Array
,
//
default: () => [],
default
:
()
=>
[],
//
},
},
//
},
},
data
()
{
data
()
{
return
{
return
{
fileList
:
[],
file
Show
List
:
[],
dialogImageUrl
:
""
,
dialogImageUrl
:
""
,
dialogVisible
:
false
,
dialogVisible
:
false
,
imageUrl
:
""
,
imageUrl
:
""
,
};
};
},
watch
:
{
fileList
(
val
)
{
this
.
fileShowList
=
val
;
}
},
},
computed
:
{
computed
:
{
headers
()
{
headers
()
{
...
@@ -45,7 +50,7 @@ export default {
...
@@ -45,7 +50,7 @@ export default {
};
};
},
},
uploadDisabled
:
function
()
{
uploadDisabled
:
function
()
{
return
(
this
.
fileList
.
length
>
0
)
||
this
.
imageUrl
return
(
this
.
file
Show
List
.
length
>
0
)
||
this
.
imageUrl
},
},
},
},
methods
:
{
methods
:
{
...
@@ -61,7 +66,7 @@ export default {
...
@@ -61,7 +66,7 @@ export default {
handleRemove
(
file
,
fileList
)
{
handleRemove
(
file
,
fileList
)
{
this
.
$emit
(
"imgUrl"
,
""
);
this
.
$emit
(
"imgUrl"
,
""
);
this
.
imageUrl
=
""
this
.
imageUrl
=
""
this
.
fileList
=
[]
this
.
file
Show
List
=
[]
},
},
handlePictureCardPreview
(
file
)
{
handlePictureCardPreview
(
file
)
{
this
.
dialogImageUrl
=
file
.
url
;
this
.
dialogImageUrl
=
file
.
url
;
...
@@ -72,7 +77,7 @@ export default {
...
@@ -72,7 +77,7 @@ export default {
name
:
""
,
name
:
""
,
url
:
cover
,
url
:
cover
,
};
};
this
.
fileList
=
[
file
]
this
.
file
Show
List
=
[
file
]
},
},
},
},
};
};
...
...
src/page/content/components/uploadVue/uploadQrcode.vue
View file @
9d815ae5
...
@@ -67,7 +67,7 @@ export default {
...
@@ -67,7 +67,7 @@ export default {
},
},
handleRemove
(
file
,
fileList
)
{
handleRemove
(
file
,
fileList
)
{
console
.
log
(
file
,
fileList
);
//
console.log(file, fileList);
this
.
$emit
(
"qrcodeUrl"
,
""
);
this
.
$emit
(
"qrcodeUrl"
,
""
);
this
.
imageUrl
=
""
this
.
imageUrl
=
""
this
.
fileList
=
[]
this
.
fileList
=
[]
...
...
src/page/content/video/content/add.vue
View file @
9d815ae5
This diff is collapsed.
Click to expand it.
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