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
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.
*/
import
axios
from
'axios'
import
{
Message
,
MessageBox
,
Loading
}
from
'element-ui'
;
import
router
from
'../router'
import
{
baseUrl
}
from
'./env'
import
MyLocalStorage
from
'./myLocalStorage'
import
{
loginOut
}
from
'./loginOut'
//axios 拦截器 请求时的拦截
axios
.
interceptors
.
request
.
use
(
config
=>
{
// 发送请求之前做一些处理
// config.headers = {
// 'Content-Type': 'application/json'
// };
return
config
},
error
=>
{
// 当请求异常时做一些处理
return
new
Promise
.
reject
(
error
)
})
// 响应时拦截
axios
.
interceptors
.
response
.
use
(
response
=>
{
// 返回响应时做一些处理
return
response
},
error
=>
{
// 当响应异常时做一些处理
return
Promise
.
resolve
(
error
.
response
)
})
function
errorState
(
status
,
data
)
{
if
(
data
.
resultCode
==
'1109'
)
{
loginOut
()
MessageBox
.
alert
(
'您的登录过期,请重新登录!'
,
'提示'
,
{
confirmButtonText
:
'确定'
,
callback
:
()
=>
{
router
.
push
({
path
:
'/'
,
query
:
{
redirect
:
router
.
history
.
current
.
fullPath
}
})
}
});
}
else
if
(
status
===
401
)
{
MessageBox
.
alert
(
'您的用户权限已被禁用,请联系管理员!'
,
'提示'
,
{
confirmButtonText
:
'确定'
,
callback
:
()
=>
{
//这个时候点击确定后清除用户信息
localStorage
.
removeItem
(
'backToken'
)
localStorage
.
removeItem
(
'userId'
)
router
.
push
({
path
:
'/'
,
query
:
{
redirect
:
router
.
history
.
current
.
fullPath
}
})
}
});
}
else
if
(
status
===
500
&&
data
.
message
.
indexOf
(
"not have permission"
)
!==
-
1
)
{
Message
.
error
(
"抱歉,你无权访问该页面!"
)
}
else
if
(
!
data
)
{
Message
.
error
(
"网络出小差咯~"
)
}
}
function
successState
(
res
)
{
}
const
httpServer
=
(
opts
,
data
,
file
,
timeout
)
=>
{
//如果是不需要登录就可以访问的接口 需要设置opts.open
let
Public
=
{}
//公共参数
let
httpDefaultOpts
=
{
method
:
opts
.
method
,
url
:
baseUrl
+
opts
.
url
,
timeout
:
timeout
?
timeout
:
10800000
,
params
:
Object
.
assign
(
Public
,
data
),
data
:
data
,
headers
:
opts
.
headers
||
{},
responseType
:
opts
.
responseType
||
''
};
httpDefaultOpts
.
headers
[
"Access-control-Allow-Origin"
]
=
"*"
;
httpDefaultOpts
.
headers
[
"Access-Control-Allow-Headers"
]
=
"content-type,x-requested-with"
;
let
authToken
=
""
;
if
(
opts
.
authType
&&
opts
.
authType
!=
""
)
{
// Authorization
if
(
opts
.
authType
===
"back"
)
{
authToken
=
localStorage
.
getItem
(
'backToken'
);
}
else
if
(
opts
.
authType
===
"front"
)
{
authToken
=
localStorage
.
getItem
(
"token"
)
||
MyLocalStorage
.
Cache
.
get
(
'token'
);
}
httpDefaultOpts
.
headers
[
"Authorization"
]
=
authToken
}
if
(
opts
.
method
===
'get'
)
{
delete
httpDefaultOpts
.
data
httpDefaultOpts
.
params
.
timestamp_static
=
new
Date
().
getTime
();
}
else
{
delete
httpDefaultOpts
.
params
if
(
file
)
{
httpDefaultOpts
.
data
=
data
;
}
}
let
promise
=
new
Promise
(
function
(
resolve
,
reject
)
{
let
loadingInstance
=
Loading
.
service
({
fullscreen
:
true
,
lock
:
true
,
background
:
'rgba(0,0,0,.5)'
,
text
:
'Loading'
,
spinner
:
'el-icon-loading'
})
// let markIndex = setTimeout(function () {
// loadingInstance.close();
// }, 10000)
axios
(
httpDefaultOpts
).
then
((
res
)
=>
{
// console.log(res)
if
(
res
.
data
)
{
loadingInstance
.
close
();
// clearTimeout(markIndex)
}
if
(
res
.
data
.
resultCode
==
'1109'
&&
localStorage
.
getItem
(
'backToken'
))
{
//清除用户信息
errorState
(
res
.
status
,
res
.
data
)
}
else
{
successState
(
res
)
resolve
(
res
)
}
}).
catch
((
response
)
=>
{
loadingInstance
.
close
();
clearTimeout
(
markIndex
)
console
.
log
(
"catch"
)
if
(
response
&&
response
.
response
&&
response
.
response
.
status
&&
response
.
response
.
data
)
{
errorState
(
response
.
response
.
status
,
response
.
response
.
data
)
}
reject
(
response
)
if
(
response
.
response
.
data
)
{
if
(
response
.
response
.
data
.
message
)
{
Message
.
error
(
response
.
response
.
data
.
message
)
}
else
{
Message
.
error
(
"操作失败!"
)
}
}
})
})
return
promise
}
export
default
httpServer
/**
* Created by supervisor on 2017/11/3.
*/
import
axios
from
'axios'
import
{
Message
,
MessageBox
,
Loading
}
from
'element-ui'
;
import
router
from
'../router'
import
{
baseUrl
}
from
'./env'
import
MyLocalStorage
from
'./myLocalStorage'
import
{
loginOut
}
from
'./loginOut'
//axios 拦截器 请求时的拦截
axios
.
interceptors
.
request
.
use
(
config
=>
{
// 发送请求之前做一些处理
// config.headers = {
// 'Content-Type': 'application/json'
// };
return
config
},
error
=>
{
// 当请求异常时做一些处理
return
new
Promise
.
reject
(
error
)
})
// 响应时拦截
axios
.
interceptors
.
response
.
use
(
response
=>
{
// 返回响应时做一些处理
return
response
},
error
=>
{
// 当响应异常时做一些处理
return
Promise
.
resolve
(
error
.
response
)
})
function
errorState
(
status
,
data
)
{
if
(
data
.
resultCode
==
'1109'
)
{
loginOut
()
MessageBox
.
alert
(
'您的登录过期,请重新登录!'
,
'提示'
,
{
confirmButtonText
:
'确定'
,
callback
:
()
=>
{
router
.
push
({
path
:
'/'
,
query
:
{
redirect
:
router
.
history
.
current
.
fullPath
}
})
}
});
}
else
if
(
status
===
401
)
{
MessageBox
.
alert
(
'您的用户权限已被禁用,请联系管理员!'
,
'提示'
,
{
confirmButtonText
:
'确定'
,
callback
:
()
=>
{
//这个时候点击确定后清除用户信息
localStorage
.
removeItem
(
'backToken'
)
localStorage
.
removeItem
(
'userId'
)
router
.
push
({
path
:
'/'
,
query
:
{
redirect
:
router
.
history
.
current
.
fullPath
}
})
}
});
}
else
if
(
status
===
500
&&
data
.
message
.
indexOf
(
"not have permission"
)
!==
-
1
)
{
Message
.
error
(
"抱歉,你无权访问该页面!"
)
}
else
if
(
!
data
)
{
Message
.
error
(
"网络出小差咯~"
)
}
}
function
successState
(
res
)
{
}
const
httpServer
=
(
opts
,
data
,
file
,
timeout
)
=>
{
//如果是不需要登录就可以访问的接口 需要设置opts.open
let
Public
=
{}
//公共参数
let
httpDefaultOpts
=
{
method
:
opts
.
method
,
url
:
baseUrl
+
opts
.
url
,
timeout
:
timeout
?
timeout
:
10800000
,
params
:
Object
.
assign
(
Public
,
data
),
data
:
data
,
headers
:
opts
.
headers
||
{},
responseType
:
opts
.
responseType
||
''
};
httpDefaultOpts
.
headers
[
"Access-control-Allow-Origin"
]
=
"*"
;
httpDefaultOpts
.
headers
[
"Access-Control-Allow-Headers"
]
=
"content-type,x-requested-with"
;
let
authToken
=
""
;
if
(
opts
.
authType
&&
opts
.
authType
!=
""
)
{
// Authorization
if
(
opts
.
authType
===
"back"
)
{
authToken
=
localStorage
.
getItem
(
'backToken'
);
}
else
if
(
opts
.
authType
===
"front"
)
{
authToken
=
localStorage
.
getItem
(
"token"
)
||
MyLocalStorage
.
Cache
.
get
(
'token'
);
}
httpDefaultOpts
.
headers
[
"Authorization"
]
=
authToken
}
if
(
opts
.
method
===
'get'
)
{
delete
httpDefaultOpts
.
data
httpDefaultOpts
.
params
.
timestamp_static
=
new
Date
().
getTime
();
}
else
{
delete
httpDefaultOpts
.
params
if
(
file
)
{
httpDefaultOpts
.
data
=
data
;
}
}
let
promise
=
new
Promise
(
function
(
resolve
,
reject
)
{
let
loadingInstance
=
Loading
.
service
({
fullscreen
:
true
,
lock
:
true
,
background
:
'rgba(0,0,0,.5)'
,
text
:
'Loading'
,
spinner
:
'el-icon-loading'
})
// let markIndex = setTimeout(function () {
// loadingInstance.close();
// }, 10000)
axios
(
httpDefaultOpts
).
then
((
res
)
=>
{
// console.log(res)
if
(
res
.
data
)
{
loadingInstance
.
close
();
// clearTimeout(markIndex)
}
if
(
res
.
data
.
resultCode
==
'1109'
&&
localStorage
.
getItem
(
'backToken'
))
{
//清除用户信息
errorState
(
res
.
status
,
res
.
data
)
}
else
{
successState
(
res
)
resolve
(
res
)
}
}).
catch
((
response
)
=>
{
loadingInstance
.
close
();
clearTimeout
(
markIndex
)
console
.
log
(
"catch"
)
if
(
response
&&
response
.
response
&&
response
.
response
.
status
&&
response
.
response
.
data
)
{
errorState
(
response
.
response
.
status
,
response
.
response
.
data
)
}
reject
(
response
)
if
(
response
.
response
.
data
)
{
if
(
response
.
response
.
data
.
message
)
{
Message
.
error
(
response
.
response
.
data
.
message
)
}
else
{
Message
.
error
(
"操作失败!"
)
}
}
})
})
return
promise
}
export
default
httpServer
src/page/content/components/uploadVue/uploadAudio.vue
View file @
9d815ae5
<
template
>
<div>
<!--
{{
fileList
}}
-->
<el-upload
ref=
"upload"
accept=
".mp3,.aac,.wma,.rm,.flac,.ogg,"
:multiple=
"true"
:http-request=
"uploadFile"
:file-list=
"fileList"
action
:auto-upload=
"false"
:before-upload=
"beforeAvatarUpload"
:on-remove=
"handleRemove"
>
<i
class=
"el-icon-plus fileUpload"
></i>
</el-upload>
<el-button
style=
"margin-left: 10px;"
size=
"small"
type=
"success"
v-loading=
"loading"
@
click=
"submitUpload"
>
上传到服务器
</el-button>
</div>
</
template
>
<
script
>
export
default
{
props
:{
fileList
:{
type
:
Array
,
default
:[]
},
},
data
()
{
return
{
fullscreenLoading
:
false
,
loading
:
false
,
filedata
:
[],
fileArr
:
[],
};
},
mounted
(){
// console.log("uploadAudio",this.fileList)
},
methods
:
{
handleRemove
(
file
,
fileList
)
{
// console.log(fileList,fileList.map(item=>item.id),'1111')
// return this.$confirm(`确定移除 ${ file.name }?`);
this
.
$emit
(
'audioList'
,
fileList
.
map
(
item
=>
item
.
id
))
},
submitUpload
()
{
const
loading
=
this
.
$loading
({
lock
:
true
,
text
:
'上传中,请稍候。。。'
,
spinner
:
'el-icon-loading'
,
background
:
'rgba(0, 0, 0, 0.7)'
});
// this.loading = true
this
.
filedata
=
new
FormData
()
// 用FormData存放上传文件
this
.
$refs
.
upload
.
submit
()
// 会循环调用uploadFile方法,多个文件调用多次
let
_this
=
this
;
_this
.
$https
(
{
method
:
"post"
,
url
:
"file/audio/upload"
,
authType
:
this
.
backToken
},
this
.
filedata
)
.
then
(
res
=>
{
let
resData
=
res
.
data
;
console
.
log
(
res
)
loading
.
close
();
// this.loading = false
if
(
resData
.
resultCode
==
"200"
)
{
_this
.
$message
.
success
(
'上传成功!'
)
const
data
=
resData
.
data
.
fileList
let
newArray
=
data
.
map
((
item
)
=>
item
.
id
)
let
editArray
=
[]
if
(
this
.
fileList
.
length
){
editArray
=
this
.
fileList
.
map
(
item
=>
item
.
id
)
}
this
.
$emit
(
'audioList'
,
[...
newArray
,...
editArray
])
}
else
{
_this
.
$message
.
error
(
resData
.
msg
||
resData
.
message
);
}
})
.
catch
(
err
=>
{
console
.
log
(
err
);
_this
.
$message
.
error
(
err
.
msg
||
err
.
message
);
});
},
uploadFile
(
file
)
{
this
.
filedata
.
append
(
'file'
,
file
.
file
)
},
beforeAvatarUpload
(
file
)
{
const
isLt5M
=
file
.
size
/
1024
/
1024
/
1024
<
1
;
if
(
!
isLt5M
)
{
this
.
$message
.
error
(
"上传文件大小不能超过 1GB!"
);
}
return
isLt5M
;
// var testmsg = file.name.substring(file.name.lastIndexOf('.')+1)
// const extension = (testmsg === 'mp3')||(testmsg === 'aac')||(testmsg === 'wma')||(testmsg === 'rm')||(testmsg === 'flac')||(testmsg === 'ogg')
// if(!extension){
// this.$message({
// message:"上传文件只能是mp3,aac,wma,rm,flac,ogg,格式!",
// type:'error'
// })
// }
// return extension;
}
}
};
</
script
>
<
style
>
.el-upload
.fileUpload
{
width
:
148px
;
height
:
148px
;
line-height
:
148px
!important
;
margin
:
0
auto
;
border
:
1px
dashed
#c0ccda
;
font-size
:
24px
;
font
:
#ccc
;
}
</
style
>
<
template
>
<div>
<!--
{{
fileList
}}
-->
<el-upload
ref=
"upload"
accept=
".mp3,.aac,.wma,.rm,.flac,.ogg,"
:multiple=
"true"
:http-request=
"uploadFile"
:file-list=
"fileList"
action
:auto-upload=
"false"
:before-upload=
"beforeAvatarUpload"
:on-remove=
"handleRemove"
>
<i
class=
"el-icon-plus fileUpload"
></i>
</el-upload>
<el-button
style=
"margin-left: 10px;"
size=
"small"
type=
"success"
v-loading=
"loading"
@
click=
"submitUpload"
>
上传到服务器
</el-button>
</div>
</
template
>
<
script
>
export
default
{
props
:{
fileList
:{
type
:
Array
,
default
:[]
},
},
data
()
{
return
{
fullscreenLoading
:
false
,
loading
:
false
,
filedata
:
[],
fileArr
:
[],
};
},
mounted
(){
// console.log("uploadAudio",this.fileList)
},
methods
:
{
handleRemove
(
file
,
fileList
)
{
// console.log(fileList,fileList.map(item=>item.id),'1111')
// return this.$confirm(`确定移除 ${ file.name }?`);
this
.
$emit
(
'audioList'
,
fileList
.
map
(
item
=>
item
.
id
))
},
submitUpload
()
{
const
loading
=
this
.
$loading
({
lock
:
true
,
text
:
'上传中,请稍候。。。'
,
spinner
:
'el-icon-loading'
,
background
:
'rgba(0, 0, 0, 0.7)'
});
// this.loading = true
this
.
filedata
=
new
FormData
()
// 用FormData存放上传文件
this
.
$refs
.
upload
.
submit
()
// 会循环调用uploadFile方法,多个文件调用多次
let
_this
=
this
;
_this
.
$https
(
{
method
:
"post"
,
url
:
"file/audio/upload"
,
authType
:
this
.
backToken
},
this
.
filedata
)
.
then
(
res
=>
{
let
resData
=
res
.
data
;
// console.log(res)
loading
.
close
();
// this.loading = false
if
(
resData
.
resultCode
==
"200"
)
{
_this
.
$message
.
success
(
'上传成功!'
)
const
data
=
resData
.
data
.
fileList
let
newArray
=
data
.
map
((
item
)
=>
item
.
id
)
let
editArray
=
[]
if
(
this
.
fileList
.
length
){
editArray
=
this
.
fileList
.
map
(
item
=>
item
.
id
)
}
this
.
$emit
(
'audioList'
,
[...
newArray
,...
editArray
])
}
else
{
_this
.
$message
.
error
(
resData
.
msg
||
resData
.
message
);
}
})
.
catch
(
err
=>
{
console
.
log
(
err
);
_this
.
$message
.
error
(
err
.
msg
||
err
.
message
);
});
},
uploadFile
(
file
)
{
this
.
filedata
.
append
(
'file'
,
file
.
file
)
},
beforeAvatarUpload
(
file
)
{
const
isLt5M
=
file
.
size
/
1024
/
1024
/
1024
<
1
;
if
(
!
isLt5M
)
{
this
.
$message
.
error
(
"上传文件大小不能超过 1GB!"
);
}
return
isLt5M
;
// var testmsg = file.name.substring(file.name.lastIndexOf('.')+1)
// const extension = (testmsg === 'mp3')||(testmsg === 'aac')||(testmsg === 'wma')||(testmsg === 'rm')||(testmsg === 'flac')||(testmsg === 'ogg')
// if(!extension){
// this.$message({
// message:"上传文件只能是mp3,aac,wma,rm,flac,ogg,格式!",
// type:'error'
// })
// }
// return extension;
}
}
};
</
script
>
<
style
>
.el-upload
.fileUpload
{
width
:
148px
;
height
:
148px
;
line-height
:
148px
!important
;
margin
:
0
auto
;
border
:
1px
dashed
#c0ccda
;
font-size
:
24px
;
font
:
#ccc
;
}
</
style
>
src/page/content/components/uploadVue/uploadFile.vue
View file @
9d815ae5
<
template
>
<div>
<el-upload
ref=
"upload"
accept=
".mp4,.flv,.mpeg,.mpg,.mov"
:multiple=
"true"
:http-request=
"uploadFile"
:file-list=
"fileList"
action
:auto-upload=
"false"
:before-upload=
"beforeAvatarUpload"
>
<i
class=
"el-icon-plus fileUpload"
></i>
</el-upload>
<el-button
style=
"margin-left: 10px;"
size=
"small"
type=
"success"
v-loading=
"loading"
@
click=
"submitUpload"
>
上传到服务器
</el-button>
</div>
</
template
>
<
script
>
export
default
{
props
:{
fileList
:{
type
:
Array
,
default
:[]
},
},
data
()
{
return
{
fullscreenLoading
:
false
,
loading
:
false
,
filedata
:[],
fileArr
:
[],
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'}]
};
},
methods
:
{
openFullScreen2
()
{
const
loading
=
this
.
$loading
({
lock
:
true
,
text
:
'上传中,请稍候。。。'
,
spinner
:
'el-icon-loading'
,
background
:
'rgba(0, 0, 0, 0.7)'
});
},
submitUpload
()
{
// 导入
// this.openFullScreen2()
const
loading
=
this
.
$loading
({
lock
:
true
,
text
:
'上传中,请稍候。。。'
,
spinner
:
'el-icon-loading'
,
background
:
'rgba(0, 0, 0, 0.7)'
});
// this.loading = true
let
tempData
=
this
.
filedata
this
.
filedata
=
new
FormData
()
// 用FormData存放上传文件
this
.
$refs
.
upload
.
submit
()
// 会循环调用uploadFile方法,多个文件调用多次
let
_this
=
this
;
_this
.
$https
(
{
method
:
"post"
,
url
:
"file/video/content/upload"
,
authType
:
this
.
backToken
},
this
.
filedata
)
.
then
(
res
=>
{
let
resData
=
res
.
data
;
console
.
log
(
res
)
loading
.
close
();
// this.loading = false
if
(
resData
.
resultCode
==
"200"
)
{
_this
.
$message
.
success
(
'上传成功!'
)
const
data
=
resData
.
data
.
fileList
;
let
newArray
=
data
.
map
((
item
)
=>
item
.
id
);
let
editArray
=
[]
if
(
this
.
fileList
.
length
){
editArray
=
this
.
fileList
.
map
(
item
=>
item
.
id
)
}
this
.
$emit
(
"videoList"
,
[...
newArray
,...
editArray
]);
}
else
{
_this
.
$message
.
error
(
resData
.
msg
||
resData
.
message
);
}
})
.
catch
(
err
=>
{
console
.
log
(
err
);
_this
.
$message
.
error
(
err
.
msg
||
err
.
message
);
});
},
uploadFile
(
file
)
{
console
.
log
(
file
)
this
.
filedata
.
append
(
'file'
,
file
.
file
)
},
beforeAvatarUpload
(
file
)
{
const
isLt10G
=
file
.
size
/
1024
/
1024
/
1024
<
10
;
if
(
!
isLt10G
)
{
this
.
$message
.
error
(
"上传文件大小不能超过 10GB!"
);
}
return
isLt10G
;
}
}
};
</
script
>
<
style
>
.el-upload
.fileUpload
{
width
:
148px
;
height
:
148px
;
line-height
:
148px
!important
;
margin
:
0
auto
;
border
:
1px
dashed
#c0ccda
;
font-size
:
24px
;
font
:
#ccc
;
}
</
style
>
<
template
>
<div>
<el-upload
ref=
"upload"
accept=
".mp4,.flv,.mpeg,.mpg,.mov"
:multiple=
"true"
:http-request=
"uploadFile"
:file-list=
"fileList"
action
:auto-upload=
"false"
:before-upload=
"beforeAvatarUpload"
>
<i
class=
"el-icon-plus fileUpload"
></i>
</el-upload>
<el-button
style=
"margin-left: 10px;"
size=
"small"
type=
"success"
v-loading=
"loading"
@
click=
"submitUpload"
>
上传到服务器
</el-button>
</div>
</
template
>
<
script
>
export
default
{
props
:{
fileList
:{
type
:
Array
,
default
:[]
},
},
data
()
{
return
{
fullscreenLoading
:
false
,
loading
:
false
,
filedata
:[],
fileArr
:
[],
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'}]
};
},
methods
:
{
openFullScreen2
()
{
const
loading
=
this
.
$loading
({
lock
:
true
,
text
:
'上传中,请稍候。。。'
,
spinner
:
'el-icon-loading'
,
background
:
'rgba(0, 0, 0, 0.7)'
});
},
submitUpload
()
{
// 导入
// this.openFullScreen2()
const
loading
=
this
.
$loading
({
lock
:
true
,
text
:
'上传中,请稍候。。。'
,
spinner
:
'el-icon-loading'
,
background
:
'rgba(0, 0, 0, 0.7)'
});
// this.loading = true
let
tempData
=
this
.
filedata
this
.
filedata
=
new
FormData
()
// 用FormData存放上传文件
this
.
$refs
.
upload
.
submit
()
// 会循环调用uploadFile方法,多个文件调用多次
let
_this
=
this
;
_this
.
$https
(
{
method
:
"post"
,
url
:
"file/video/content/upload"
,
authType
:
this
.
backToken
},
this
.
filedata
)
.
then
(
res
=>
{
let
resData
=
res
.
data
;
// console.log(res)
loading
.
close
();
// this.loading = false
if
(
resData
.
resultCode
==
"200"
)
{
_this
.
$message
.
success
(
'上传成功!'
)
const
data
=
resData
.
data
.
fileList
;
let
newArray
=
data
.
map
((
item
)
=>
item
.
id
);
let
editArray
=
[]
if
(
this
.
fileList
.
length
){
editArray
=
this
.
fileList
.
map
(
item
=>
item
.
id
)
}
this
.
$emit
(
"videoList"
,
[...
newArray
,...
editArray
]);
}
else
{
_this
.
$message
.
error
(
resData
.
msg
||
resData
.
message
);
}
})
.
catch
(
err
=>
{
console
.
log
(
err
);
_this
.
$message
.
error
(
err
.
msg
||
err
.
message
);
});
},
uploadFile
(
file
)
{
// console.log(file)
this
.
filedata
.
append
(
'file'
,
file
.
file
)
},
beforeAvatarUpload
(
file
)
{
const
isLt10G
=
file
.
size
/
1024
/
1024
/
1024
<
10
;
if
(
!
isLt10G
)
{
this
.
$message
.
error
(
"上传文件大小不能超过 10GB!"
);
}
return
isLt10G
;
}
}
};
</
script
>
<
style
>
.el-upload
.fileUpload
{
width
:
148px
;
height
:
148px
;
line-height
:
148px
!important
;
margin
:
0
auto
;
border
:
1px
dashed
#c0ccda
;
font-size
:
24px
;
font
:
#ccc
;
}
</
style
>
src/page/content/components/uploadVue/uploadFolder.vue
View file @
9d815ae5
<
template
>
<el-form
enctype=
"multipart/form-data"
>
选择多文件:
<input
type=
"file"
name=
"files"
multiple=
"multiple"
@
change=
"getFiles($event)"
/>
<br
/>
选择文件夹:
<input
@
change=
"getFiles($event)"
type=
"file"
name=
"files"
webkitdirectory
mozdirectory
/>
<br
/>
<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"
>
{{
item
.
name
}}
<span>
<el-button
size=
"mini"
type=
"text"
>
<i
@
click=
"remove(item)"
class=
"el-icon-close"
></i>
</el-button>
</span>
</li>
</ul>
<el-button
size=
"medium"
type=
"success"
@
click
.
stop=
"upload"
>
上传到服务器
</el-button>
</el-form>
</
template
>
<
script
>
import
axios
from
"axios"
;
export
default
{
name
:
"UploadFileVue"
,
props
:{
fileList
:{
type
:
Array
,
default
:
[]
},
},
data
()
{
return
{
fullscreenLoading
:
false
,
files
:
[
]
};
},
watch
:
{
fileList
(
newName
,
oldName
)
{
console
.
log
(
newName
)
this
.
files
=
newName
// ...
}
},
computed
:
{
headers
()
{
return
{
Authorization
:
localStorage
.
getItem
(
"backToken"
)
||
""
};
}
},
methods
:
{
remove
(
data
)
{
const
children
=
this
.
files
;
const
index
=
children
.
findIndex
(
d
=>
d
.
name
===
data
.
name
);
children
.
splice
(
index
,
1
);
console
.
log
(
this
.
files
,
'111'
)
this
.
$emit
(
"videoList"
,
this
.
files
.
map
(
item
=>
item
.
id
));
},
getFiles
:
function
(
event
)
{
console
.
log
(
event
);
var
files
=
event
.
target
.
files
;
for
(
var
i
=
0
;
i
<
files
.
length
;
i
++
)
{
this
.
files
.
push
(
files
[
i
]);
}
console
.
log
(
this
.
files
,
"--"
);
},
upload
:
function
()
{
const
loading
=
this
.
$loading
({
lock
:
true
,
text
:
'上传中,请稍候。。。'
,
spinner
:
'el-icon-loading'
,
background
:
'rgba(0, 0, 0, 0.7)'
});
console
.
log
(
this
.
files
);
var
formData
=
new
FormData
();
for
(
var
i
=
0
;
i
<
this
.
files
.
length
;
i
++
)
{
formData
.
append
(
"file"
,
this
.
files
[
i
]);
}
console
.
log
(
formData
);
let
_this
=
this
;
_this
.
$https
(
{
method
:
"post"
,
url
:
"file/video/content/upload"
,
authType
:
this
.
backToken
},
formData
)
.
then
(
res
=>
{
loading
.
close
();
let
resData
=
res
.
data
;
console
.
log
(
res
);
if
(
resData
.
resultCode
==
"200"
)
{
_this
.
$message
.
success
(
"上传成功!"
);
const
data
=
resData
.
data
.
fileList
;
let
newArray
=
data
.
map
((
item
)
=>
item
.
id
);
let
editArray
=
[]
if
(
this
.
files
.
length
){
editArray
=
this
.
files
.
map
(
item
=>
item
.
id
)
}
this
.
$emit
(
"videoList"
,
[...
newArray
,...
editArray
]);
}
else
{
_this
.
$message
.
error
(
resData
.
msg
||
resData
.
message
);
}
})
.
catch
(
err
=>
{
console
.
log
(
err
);
_this
.
$message
.
error
(
err
.
msg
||
err
.
message
);
});
}
}
};
</
script
>
<
style
>
<
template
>
<el-form
enctype=
"multipart/form-data"
>
选择多文件:
<input
type=
"file"
name=
"files"
multiple=
"multiple"
@
change=
"getFiles($event)"
/>
<br
/>
选择文件夹:
<input
@
change=
"getFiles($event)"
type=
"file"
name=
"files"
webkitdirectory
mozdirectory
/>
<br
/>
<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"
>
{{
item
.
name
}}
<span>
<el-button
size=
"mini"
type=
"text"
>
<i
@
click=
"remove(item)"
class=
"el-icon-close"
></i>
</el-button>
</span>
</li>
</ul>
<el-button
size=
"medium"
type=
"success"
@
click
.
stop=
"upload"
>
上传到服务器
</el-button>
</el-form>
</
template
>
<
script
>
import
axios
from
"axios"
;
export
default
{
name
:
"UploadFileVue"
,
props
:{
fileList
:{
type
:
Array
,
default
:
()
=>
[]
},
},
data
()
{
return
{
fullscreenLoading
:
false
,
files
:
[
]
};
},
watch
:
{
fileList
(
newName
,
oldName
)
{
// console.log(newName)
this
.
files
=
newName
// ...
}
},
computed
:
{
headers
()
{
return
{
Authorization
:
localStorage
.
getItem
(
"backToken"
)
||
""
};
}
},
methods
:
{
remove
(
data
)
{
const
children
=
this
.
files
;
const
index
=
children
.
findIndex
(
d
=>
d
.
name
===
data
.
name
);
children
.
splice
(
index
,
1
);
// console.log(this.files,'111')
this
.
$emit
(
"videoList"
,
this
.
files
.
map
(
item
=>
item
.
id
));
},
getFiles
:
function
(
event
)
{
// console.log(event);
var
files
=
event
.
target
.
files
;
for
(
var
i
=
0
;
i
<
files
.
length
;
i
++
)
{
this
.
files
.
push
(
files
[
i
]);
}
// console.log(this.files, "--");
},
upload
:
function
()
{
const
loading
=
this
.
$loading
({
lock
:
true
,
text
:
'上传中,请稍候。。。'
,
spinner
:
'el-icon-loading'
,
background
:
'rgba(0, 0, 0, 0.7)'
});
// console.log(this.files);
var
formData
=
new
FormData
();
for
(
var
i
=
0
;
i
<
this
.
files
.
length
;
i
++
)
{
formData
.
append
(
"file"
,
this
.
files
[
i
]);
}
// console.log(formData);
let
_this
=
this
;
_this
.
$https
(
{
method
:
"post"
,
url
:
"file/video/content/upload"
,
authType
:
this
.
backToken
},
formData
)
.
then
(
res
=>
{
loading
.
close
();
let
resData
=
res
.
data
;
// console.log(res);
if
(
resData
.
resultCode
==
"200"
)
{
_this
.
$message
.
success
(
"上传成功!"
);
const
data
=
resData
.
data
.
fileList
;
let
newArray
=
data
.
map
((
item
)
=>
item
.
id
);
let
editArray
=
[]
if
(
this
.
files
.
length
){
editArray
=
this
.
files
.
map
(
item
=>
item
.
id
)
}
this
.
$emit
(
"videoList"
,
[...
newArray
,...
editArray
]);
}
else
{
_this
.
$message
.
error
(
resData
.
msg
||
resData
.
message
);
}
})
.
catch
(
err
=>
{
console
.
log
(
err
);
_this
.
$message
.
error
(
err
.
msg
||
err
.
message
);
});
}
}
};
</
script
>
<
style
>
</
style
>
\ No newline at end of file
src/page/content/components/uploadVue/uploadImg.vue
View file @
9d815ae5
...
...
@@ -9,7 +9,7 @@
:on-remove="handleRemove"
:on-success="handleAvatarSuccess"
:headers="headers"
:file-list="fileList"
:file-list="file
Show
List"
:limit="1"
:multiple ="false"
>
...
...
@@ -24,19 +24,24 @@
<
script
>
export
default
{
//
props:{
//
fileList:{
//
type: Array,
//
default: () => [],
//
},
//
},
props
:{
fileList
:{
type
:
Array
,
default
:
()
=>
[],
},
},
data
()
{
return
{
fileList
:
[],
file
Show
List
:
[],
dialogImageUrl
:
""
,
dialogVisible
:
false
,
imageUrl
:
""
,
};
},
watch
:
{
fileList
(
val
)
{
this
.
fileShowList
=
val
;
}
},
computed
:
{
headers
()
{
...
...
@@ -45,7 +50,7 @@ export default {
};
},
uploadDisabled
:
function
()
{
return
(
this
.
fileList
.
length
>
0
)
||
this
.
imageUrl
return
(
this
.
file
Show
List
.
length
>
0
)
||
this
.
imageUrl
},
},
methods
:
{
...
...
@@ -61,7 +66,7 @@ export default {
handleRemove
(
file
,
fileList
)
{
this
.
$emit
(
"imgUrl"
,
""
);
this
.
imageUrl
=
""
this
.
fileList
=
[]
this
.
file
Show
List
=
[]
},
handlePictureCardPreview
(
file
)
{
this
.
dialogImageUrl
=
file
.
url
;
...
...
@@ -72,7 +77,7 @@ export default {
name
:
""
,
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 {
},
handleRemove
(
file
,
fileList
)
{
console
.
log
(
file
,
fileList
);
//
console.log(file, fileList);
this
.
$emit
(
"qrcodeUrl"
,
""
);
this
.
imageUrl
=
""
this
.
fileList
=
[]
...
...
src/page/content/video/content/add.vue
View file @
9d815ae5
<
template
>
<div
class=
"info"
>
<div
class=
"info-header"
>
{{
type
===
'Update'
?
'修改'
:
'新建'
}}
视频
</div>
<div
class=
"info-container"
>
<div
class=
"info-wrapper"
>
<div
class=
"pageTips"
>
<strong>
页面说明:
</strong>
可新建视频。“*”为必填项。若没有对应的视频版权方或视频分类可点击图标快速新建。
</div>
<el-form
:model=
"ruleForm"
:rules=
"rules"
ref=
"ruleForm"
label-width=
"140px"
class=
"demo-form-inline party-form"
:inline=
"true"
label-position=
"top"
>
<el-form-item
label=
"视频名称"
prop=
"name"
class=
"w100"
>
<el-input
oninput=
"value = value.trim()"
v-model=
"ruleForm.name"
></el-input>
</el-form-item>
<el-form-item
label=
"请选择视频版权方"
prop=
"videoContentCopyrightOwnerId"
>
<el-select
placeholder=
"请选择视频版权方"
@
focus=
"getVideoContentCopyrightData"
v-model=
"ruleForm.videoContentCopyrightOwnerId"
>
<el-option
v-for=
"item in copyrightOwner"
:label=
"item.name"
:value=
"item.id"
:key=
"item.id"
></el-option>
</el-select>
</el-form-item>
<add-copyright
ref=
"addCopyright"
></add-copyright>
<!--
<el-form-item
class=
"addTip"
>
<add-copyright
ref=
"addCopyright"
></add-copyright>
<span>
若没有相应的视频版权方,请点击
</span>
<el-button
type=
"text"
@
click=
"addVideoCopyright"
>
新建视频版权方
</el-button>
</el-form-item>
-->
<el-form-item
>
<br>
<span
style=
"color:red"
>
若没有相应的视频版权方,请点击
</span>
<el-button
type=
"text"
@
click=
"addVideoCopyright"
>
新建视频版权方
</el-button>
</el-form-item>
<el-form-item
label=
"请选择视频分类"
>
<el-select
placeholder=
"请选择预设视频分类"
@
focus=
"getVideoContentCatData"
v-model=
"ruleForm.videoContentCatId"
>
<el-option
v-for=
"item in videoContentCat"
:label=
"item.name"
:value=
"item.id"
:key=
"item.id"
></el-option>
</el-select>
</el-form-item>
<el-form-item
>
<br>
<span
style=
"color:red"
>
若没有相应的视频分类,请点击
</span>
<el-button
type=
"text"
@
click=
"addVideoClass"
>
新建视频分类
</el-button>
</el-form-item>
<!--
<el-form-item
class=
"addTip"
>
<span>
若没有相应的视频分类,请点击
</span>
<el-button
type=
"text"
@
click=
"addVideoClass"
>
新建视频分类
</el-button>
</el-form-item>
-->
<el-form-item
label=
"视频缩略图"
required
>
<upload-img
:fileList=
"ruleForm.imageList"
@
imgUrl=
"imgUrl"
></upload-img>
</el-form-item>
<!--
<el-form-item
label=
"上传视频"
required
>
<p
style=
"color:red"
>
(支持上传多个视频及视频文件夹,视频语言支持汉语、蒙语、藏语、维吾尔语、英语,视频命名规定:视频名称+语言)
</p>
<upload-file
:fileList=
"ruleForm.videoList"
@
videoList=
"videoList"
></upload-file>
</el-form-item>
-->
<el-form-item
label=
"上传视频"
required
>
<div
style=
"color:red;"
>
(支持上传多个视频及视频文件夹,视频语言支持汉语、蒙语、藏语、维吾尔语、英语,视频命名规定:视频名称+语言)
</div>
<upload-folder
:fileList=
"ruleForm.videoList"
@
videoList=
"videoList"
></upload-folder>
</el-form-item>
</el-form>
<!--新增弹框-->
<el-dialog
custom-class=
"party-dialog"
title=
"新建视频分类"
width=
"468px"
:visible
.
sync=
"dialogVisible"
:before-close=
"close"
>
<div
class=
"dialog-content"
>
<el-form
:model=
"classForm"
ref=
"classForm"
label-width=
"80px"
label-position=
"top"
:rules=
"rule"
id=
"ruleo"
class=
"party-form"
>
<el-form-item
label=
"视频分类名称"
prop=
"name"
>
<el-input
oninput=
"value = value.trim()"
v-model=
"classForm.name"
></el-input>
</el-form-item>
<el-form-item
label=
"备注"
class=
"w100"
prop=
"remarks"
>
<el-input
type=
"textarea"
v-model=
"classForm.remarks"
></el-input>
</el-form-item>
</el-form>
</div>
<div
slot=
"footer"
class=
"dialog-footer btn-group"
>
<el-button
size=
"mini"
type=
"primary"
@
click=
"save('classForm')"
>
确定
</el-button>
<el-button
size=
"mini"
@
click=
"close"
>
取 消
</el-button>
</div>
</el-dialog>
</div>
</div>
<div
class=
"info-footer"
>
<div
class=
"btn-group"
>
<div
class=
"btn-group"
>
<el-button
type=
"primary"
v-show=
"type === 'add'"
class=
"btn_form_search"
@
click=
"submitForm('ruleForm')"
>
提交审核
</el-button>
<el-button
type=
"primary"
v-show=
"type === 'Update'"
class=
"btn_form_search"
@
click=
"updateForm('ruleForm')"
>
提交审核
</el-button>
<el-button
@
click=
"resetForm('ruleForm')"
>
取消
</el-button>
</div>
</div>
</div>
</div>
</
template
>
<
script
>
import
uploadImg
from
'@/page/content/components/uploadVue/uploadImg'
import
uploadFile
from
'@/page/content/components/uploadVue/uploadFile'
import
uploadDatum
from
'@/page/content/components/uploadVue/uploadDatum'
import
mulDisplay
from
'@/page/content/components/mulClassify/mulDisplay'
import
addCopyright
from
'@/page/content/components/dialog/addCopyright'
import
uploadFolder
from
"@/page/content/components/uploadVue/uploadFolder"
;
export
default
{
components
:{
uploadImg
,
uploadFile
,
uploadDatum
,
mulDisplay
,
addCopyright
,
uploadFolder
},
data
()
{
return
{
copyrightOwner
:[],
type
:
this
.
$route
.
query
.
type
,
dialogVisible
:
false
,
formLabelWidth
:
"100px"
,
form
:
{
name
:
""
},
classForm
:
{},
value1
:
[],
ruleForm
:
{
name
:
""
,
videoContentCopyrightOwnerId
:
""
,
videoContentCatIdList
:
""
,
videoContentCatId
:
""
,
thumbnail
:
""
,
videoFileIdList
:[]
},
videoContentCat
:
[],
checkedThing
:
false
,
selfstyle
:
{
textAlign
:
"right"
,
width
:
"100%"
,
paddingRight
:
"10px"
},
rule
:{
name
:
[
// { required: true, message: "请输入视频分类名称", trigger: "blur" },
{
min
:
1
,
max
:
20
,
message
:
"请输入1到20个字"
},
],
remarks
:
[
{
min
:
1
,
max
:
100
,
message
:
"请输入1到100个字"
},
],
},
rules
:
{
name
:
[
{
required
:
true
,
message
:
"请输入视频名称"
,
trigger
:
"blur"
},
{
min
:
1
,
max
:
20
,
message
:
"请输入1到20个字"
},
],
videoContentCopyrightOwnerId
:[
{
required
:
true
,
message
:
"请选择视频版权方"
,
trigger
:
"change"
}
],
videoContentCatIdList
:[
{
required
:
true
,
message
:
"请选择视频分类"
,
trigger
:
"change"
}
],
thumbnail
:[
{
required
:
true
,
message
:
"请上传视频缩略图"
,
trigger
:
"change"
}
],
videoUrlList
:[
{
required
:
true
,
message
:
"请上传视频"
,
trigger
:
"change"
}
],
}
};
},
mounted
()
{
this
.
init
();
this
.
getVideoContentCopyrightData
()
},
methods
:
{
// 视频版权方名称id
videoCopyright
(
idlist
){
this
.
ruleForm
.
videoContentCopyrightOwnerId
=
idlist
},
// 缩略图地址
imgUrl
(
url
){
console
.
log
(
url
,
'图片服务器地址'
)
this
.
ruleForm
.
thumbnail
=
url
},
// 视频列表地址
videoList
(
list
){
this
.
ruleForm
.
videoFileIdList
=
list
},
init
()
{
if
(
this
.
$route
.
query
.
type
===
"Update"
)
{
this
.
getInfo
(
this
.
$route
.
query
.
id
);
}
},
getVideoContentCat
(
data
){
console
.
log
(
data
)
console
.
log
(
this
.
ruleForm
.
videoContentCatId
)
},
// 获取信息
getInfo
(
id
)
{
let
vm
=
this
;
vm
.
$https
(
{
url
:
"videoContent/get/"
+
id
,
method
:
"get"
,
authType
:
this
.
backToken
}
// param
).
then
(
res
=>
{
let
data
=
res
.
data
.
data
;
// this.ruleForm = data;
this
.
ruleForm
.
id
=
data
.
id
this
.
ruleForm
.
name
=
data
.
name
this
.
ruleForm
.
videoContentCopyrightOwnerId
=
data
.
videoContentCopyrightOwnerId
this
.
ruleForm
.
videoContentCatId
=
data
.
videoContentCatId
this
.
ruleForm
.
thumbnail
=
data
.
thumbnail
this
.
ruleForm
.
videoFileIdList
=
data
.
videoFileIdList
this
.
ruleForm
.
imageList
=
[{
url
:
data
.
thumbnail
}]
this
.
ruleForm
.
videoList
=
data
.
videoFileList
.
map
(
item
=>
{
return
{
id
:
item
.
id
,
name
:
item
.
fileName
,
url
:
item
.
fileUrl
}})
this
.
getVideoContentCatData
()
this
.
getVideoContentCopyrightData
()
}).
catch
(
function
(
err
)
{
console
.
log
(
err
);
});
},
// 新建展板分类
addVideoCopyright
(){
this
.
$refs
.
addCopyright
.
dialogVisible
=
true
},
// 新建视频分类
addVideoClass
()
{
this
.
dialogVisible
=
true
;
},
// 新建视频分类弹窗保存
save
(
formName
)
{
this
.
$refs
[
formName
].
validate
(
valid
=>
{
this
.
ruleForm
.
expireDateEnd
=
this
.
value1
[
1
];
this
.
ruleForm
.
expireDateStart
=
this
.
value1
[
0
];
if
(
valid
)
{
this
.
$https
(
{
url
:
"videoContentCat/save"
,
method
:
"post"
,
authType
:
this
.
backToken
},
this
.
$qs
.
stringify
(
this
.
classForm
)
).
then
(
res
=>
{
if
(
res
.
data
.
resultCode
===
"200"
){
this
.
$message
({
type
:
"success"
,
message
:
"新增分类成功!"
});
this
.
dialogVisible
=
false
;
}
else
{
this
.
$message
({
type
:
"error"
,
message
:
res
.
data
.
message
});
}
}).
catch
(
function
(
err
)
{
this
.
$message
({
type
:
"fail"
,
message
:
"新增失败!"
+
err
.
response
.
data
.
msg
});
});
}
else
{
console
.
log
(
"error submit!!"
);
return
false
;
}
});
},
// 新增关闭
close
()
{
this
.
dialogVisible
=
false
;
for
(
let
key
in
this
.
classForm
)
{
this
.
classForm
[
key
]
=
null
;
}
this
.
$refs
[
"classForm"
].
resetFields
();
},
// 新增
submitForm
(
formName
)
{
this
.
$refs
[
formName
].
validate
(
valid
=>
{
if
(
valid
)
{
this
.
$https
(
{
url
:
"videoContent/save"
,
method
:
"post"
,
authType
:
this
.
backToken
},
this
.
$qs
.
stringify
(
this
.
ruleForm
)
).
then
(
res
=>
{
if
(
res
.
data
.
resultCode
===
"200"
){
this
.
$message
({
type
:
"success"
,
message
:
"新增视频申请已提交,待审核!"
});
history
.
go
(
-
1
);
}
else
{
this
.
$message
({
type
:
"error"
,
message
:
res
.
data
.
message
});
}
}).
catch
(
function
(
err
)
{
console
.
log
(
err
);
});
}
else
{
console
.
log
(
"error submit!!"
);
return
false
;
}
});
},
// 修改版权方
updateForm
(
formName
)
{
this
.
$refs
[
formName
].
validate
(
valid
=>
{
if
(
valid
)
{
this
.
$https
(
{
url
:
"videoContent/update"
,
method
:
"put"
,
authType
:
this
.
backToken
},
this
.
$qs
.
stringify
(
this
.
ruleForm
)
).
then
(
res
=>
{
if
(
res
.
data
.
resultCode
===
"200"
){
this
.
$message
({
type
:
"success"
,
message
:
"修改视频申请已提交,待审核!"
});
history
.
go
(
-
1
);
}
else
{
this
.
$message
({
type
:
"error"
,
message
:
res
.
data
.
message
});
}
}).
catch
(
function
(
err
)
{
console
.
log
(
err
);
});
}
else
{
console
.
log
(
"error submit!!"
);
return
false
;
}
});
},
resetForm
(
formName
)
{
this
.
$refs
[
formName
].
resetFields
();
history
.
go
(
-
1
);
},
getVideoContentCopyrightData
()
{
let
vm
=
this
;
vm
.
$https
({
url
:
"copyrightOwner/getList"
,
method
:
"get"
,
authType
:
this
.
backToken
},
{
copyrightOwnerType
:
'VIDEO_CONTENT'
})
.
then
(
res
=>
{
let
data
=
res
.
data
.
data
;
this
.
copyrightOwner
=
data
;
})
.
catch
(
function
(
err
)
{
console
.
log
(
err
);
});
},
// 获取视频分类列表
getVideoContentCatData
()
{
let
vm
=
this
;
if
(
this
.
ruleForm
.
videoContentCopyrightOwnerId
){
vm
.
$https
({
url
:
"videoContentCat/getList"
,
method
:
"get"
,
authType
:
this
.
backToken
},{
copyrightOwnerId
:
this
.
ruleForm
.
videoContentCopyrightOwnerId
}).
then
(
res
=>
{
this
.
videoContentCat
=
res
.
data
.
data
;
}).
catch
(
function
(
err
)
{
console
.
log
(
err
);
});
}
else
{
this
.
$message
.
warning
(
"请先选择视频版权方!"
)
}
},
getSelectDep
(
videoContentCatIdList
)
{
this
.
checkedThing
=
videoContentCatIdList
.
length
===
this
.
videoContentCat
.
length
;
},
selectAllThing
()
{
// debugger
this
.
ruleForm
.
videoContentCatIdList
=
[];
if
(
this
.
checkedThing
)
{
this
.
videoContentCat
.
map
(
item
=>
{
this
.
ruleForm
.
videoContentCatIdList
.
push
(
item
.
id
);
});
}
else
{
this
.
ruleForm
.
videoContentCatIdList
=
[];
}
}
}
};
</
script
>
<
style
lang=
"less"
>
@import "../../../../style/dialog";
</
style
>
<
template
>
<div
class=
"info"
>
<div
class=
"info-header"
>
{{
type
===
'Update'
?
'修改'
:
'新建'
}}
视频
</div>
<div
class=
"info-container"
>
<div
class=
"info-wrapper"
>
<div
class=
"pageTips"
>
<strong>
页面说明:
</strong>
可新建视频。“*”为必填项。若没有对应的视频版权方或视频分类可点击图标快速新建。
</div>
<el-form
:model=
"ruleForm"
:rules=
"rules"
ref=
"ruleForm"
label-width=
"140px"
class=
"demo-form-inline party-form"
:inline=
"true"
label-position=
"top"
>
<el-form-item
label=
"视频名称"
prop=
"name"
class=
"w100"
>
<el-input
oninput=
"value = value.trim()"
v-model=
"ruleForm.name"
></el-input>
</el-form-item>
<el-form-item
label=
"请选择视频版权方"
prop=
"videoContentCopyrightOwnerId"
>
<el-select
placeholder=
"请选择视频版权方"
@
focus=
"getVideoContentCopyrightData"
v-model=
"ruleForm.videoContentCopyrightOwnerId"
>
<el-option
v-for=
"item in copyrightOwner"
:label=
"item.name"
:value=
"item.id"
:key=
"item.id"
></el-option>
</el-select>
</el-form-item>
<add-copyright
ref=
"addCopyright"
></add-copyright>
<!--
<el-form-item
class=
"addTip"
>
<add-copyright
ref=
"addCopyright"
></add-copyright>
<span>
若没有相应的视频版权方,请点击
</span>
<el-button
type=
"text"
@
click=
"addVideoCopyright"
>
新建视频版权方
</el-button>
</el-form-item>
-->
<el-form-item
>
<br>
<span
style=
"color:red"
>
若没有相应的视频版权方,请点击
</span>
<el-button
type=
"text"
@
click=
"addVideoCopyright"
>
新建视频版权方
</el-button>
</el-form-item>
<el-form-item
label=
"请选择视频分类"
>
<el-select
placeholder=
"请选择预设视频分类"
@
focus=
"getVideoContentCatData"
v-model=
"ruleForm.videoContentCatId"
>
<el-option
v-for=
"item in videoContentCat"
:label=
"item.name"
:value=
"item.id"
:key=
"item.id"
></el-option>
</el-select>
</el-form-item>
<el-form-item
>
<br>
<span
style=
"color:red"
>
若没有相应的视频分类,请点击
</span>
<el-button
type=
"text"
@
click=
"addVideoClass"
>
新建视频分类
</el-button>
</el-form-item>
<!--
<el-form-item
class=
"addTip"
>
<span>
若没有相应的视频分类,请点击
</span>
<el-button
type=
"text"
@
click=
"addVideoClass"
>
新建视频分类
</el-button>
</el-form-item>
-->
<el-form-item
label=
"视频缩略图"
required
>
<upload-img
:fileList=
"ruleForm.imageList"
@
imgUrl=
"imgUrl"
></upload-img>
</el-form-item>
<!--
<el-form-item
label=
"上传视频"
required
>
<p
style=
"color:red"
>
(支持上传多个视频及视频文件夹,视频语言支持汉语、蒙语、藏语、维吾尔语、英语,视频命名规定:视频名称+语言)
</p>
<upload-file
:fileList=
"ruleForm.videoList"
@
videoList=
"videoList"
></upload-file>
</el-form-item>
-->
<el-form-item
label=
"上传视频"
required
>
<div
style=
"color:red;"
>
(支持上传多个视频及视频文件夹,视频语言支持汉语、蒙语、藏语、维吾尔语、英语,视频命名规定:视频名称+语言)
</div>
<upload-folder
:fileList=
"ruleForm.videoList"
@
videoList=
"videoList"
></upload-folder>
</el-form-item>
</el-form>
<!--新增弹框-->
<el-dialog
custom-class=
"party-dialog"
title=
"新建视频分类"
width=
"468px"
:visible
.
sync=
"dialogVisible"
:before-close=
"close"
>
<div
class=
"dialog-content"
>
<el-form
:model=
"classForm"
ref=
"classForm"
label-width=
"80px"
label-position=
"top"
:rules=
"rule"
id=
"ruleo"
class=
"party-form"
>
<el-form-item
label=
"视频分类名称"
prop=
"name"
>
<el-input
oninput=
"value = value.trim()"
v-model=
"classForm.name"
></el-input>
</el-form-item>
<el-form-item
label=
"备注"
class=
"w100"
prop=
"remarks"
>
<el-input
type=
"textarea"
v-model=
"classForm.remarks"
></el-input>
</el-form-item>
</el-form>
</div>
<div
slot=
"footer"
class=
"dialog-footer btn-group"
>
<el-button
size=
"mini"
type=
"primary"
@
click=
"save('classForm')"
>
确定
</el-button>
<el-button
size=
"mini"
@
click=
"close"
>
取 消
</el-button>
</div>
</el-dialog>
</div>
</div>
<div
class=
"info-footer"
>
<div
class=
"btn-group"
>
<div
class=
"btn-group"
>
<el-button
type=
"primary"
v-show=
"type === 'add'"
class=
"btn_form_search"
@
click=
"submitForm('ruleForm')"
>
提交审核
</el-button>
<el-button
type=
"primary"
v-show=
"type === 'Update'"
class=
"btn_form_search"
@
click=
"updateForm('ruleForm')"
>
提交审核
</el-button>
<el-button
@
click=
"resetForm('ruleForm')"
>
取消
</el-button>
</div>
</div>
</div>
</div>
</
template
>
<
script
>
import
uploadImg
from
'@/page/content/components/uploadVue/uploadImg'
import
uploadFile
from
'@/page/content/components/uploadVue/uploadFile'
import
uploadDatum
from
'@/page/content/components/uploadVue/uploadDatum'
import
mulDisplay
from
'@/page/content/components/mulClassify/mulDisplay'
import
addCopyright
from
'@/page/content/components/dialog/addCopyright'
import
uploadFolder
from
"@/page/content/components/uploadVue/uploadFolder"
;
export
default
{
components
:{
uploadImg
,
uploadFile
,
uploadDatum
,
mulDisplay
,
addCopyright
,
uploadFolder
},
data
()
{
return
{
copyrightOwner
:[],
type
:
this
.
$route
.
query
.
type
,
dialogVisible
:
false
,
formLabelWidth
:
"100px"
,
form
:
{
name
:
""
},
classForm
:
{},
value1
:
[],
ruleForm
:
{
name
:
""
,
videoContentCopyrightOwnerId
:
""
,
videoContentCatIdList
:
""
,
videoContentCatId
:
""
,
thumbnail
:
""
,
imageList
:
[],
videoFileIdList
:[]
},
videoContentCat
:
[],
checkedThing
:
false
,
selfstyle
:
{
textAlign
:
"right"
,
width
:
"100%"
,
paddingRight
:
"10px"
},
rule
:{
name
:
[
// { required: true, message: "请输入视频分类名称", trigger: "blur" },
{
min
:
1
,
max
:
20
,
message
:
"请输入1到20个字"
},
],
remarks
:
[
{
min
:
1
,
max
:
100
,
message
:
"请输入1到100个字"
},
],
},
rules
:
{
name
:
[
{
required
:
true
,
message
:
"请输入视频名称"
,
trigger
:
"blur"
},
{
min
:
1
,
max
:
20
,
message
:
"请输入1到20个字"
},
],
videoContentCopyrightOwnerId
:[
{
required
:
true
,
message
:
"请选择视频版权方"
,
trigger
:
"change"
}
],
videoContentCatIdList
:[
{
required
:
true
,
message
:
"请选择视频分类"
,
trigger
:
"change"
}
],
thumbnail
:[
{
required
:
true
,
message
:
"请上传视频缩略图"
,
trigger
:
"change"
}
],
videoUrlList
:[
{
required
:
true
,
message
:
"请上传视频"
,
trigger
:
"change"
}
],
}
};
},
mounted
()
{
this
.
init
();
this
.
getVideoContentCopyrightData
()
},
methods
:
{
// 视频版权方名称id
videoCopyright
(
idlist
){
this
.
ruleForm
.
videoContentCopyrightOwnerId
=
idlist
},
// 缩略图地址
imgUrl
(
url
){
// console.log(url,'图片服务器地址')
this
.
ruleForm
.
thumbnail
=
url
},
// 视频列表地址
videoList
(
list
){
this
.
ruleForm
.
videoFileIdList
=
list
},
init
()
{
if
(
this
.
$route
.
query
.
type
===
"Update"
)
{
this
.
getInfo
(
this
.
$route
.
query
.
id
);
}
},
getVideoContentCat
(
data
){
// console.log(data)
// console.log(this.ruleForm.videoContentCatId)
},
// 获取信息
getInfo
(
id
)
{
let
vm
=
this
;
vm
.
$https
(
{
url
:
"videoContent/get/"
+
id
,
method
:
"get"
,
authType
:
this
.
backToken
}
// param
).
then
(
res
=>
{
let
data
=
res
.
data
.
data
;
// this.ruleForm = data;
this
.
ruleForm
.
id
=
data
.
id
this
.
ruleForm
.
name
=
data
.
name
this
.
ruleForm
.
videoContentCopyrightOwnerId
=
data
.
videoContentCopyrightOwnerId
this
.
ruleForm
.
videoContentCatId
=
data
.
videoContentCatId
this
.
ruleForm
.
thumbnail
=
data
.
thumbnail
this
.
ruleForm
.
videoFileIdList
=
data
.
videoFileIdList
this
.
ruleForm
.
imageList
=
[{
url
:
data
.
thumbnail
}]
this
.
ruleForm
.
videoList
=
data
.
videoFileList
.
map
(
item
=>
{
return
{
id
:
item
.
id
,
name
:
item
.
fileName
,
url
:
item
.
fileUrl
}})
this
.
getVideoContentCatData
()
this
.
getVideoContentCopyrightData
()
}).
catch
(
function
(
err
)
{
console
.
log
(
err
);
});
},
// 新建展板分类
addVideoCopyright
(){
this
.
$refs
.
addCopyright
.
dialogVisible
=
true
},
// 新建视频分类
addVideoClass
()
{
this
.
dialogVisible
=
true
;
},
// 新建视频分类弹窗保存
save
(
formName
)
{
this
.
$refs
[
formName
].
validate
(
valid
=>
{
this
.
ruleForm
.
expireDateEnd
=
this
.
value1
[
1
];
this
.
ruleForm
.
expireDateStart
=
this
.
value1
[
0
];
if
(
valid
)
{
this
.
$https
(
{
url
:
"videoContentCat/save"
,
method
:
"post"
,
authType
:
this
.
backToken
},
this
.
$qs
.
stringify
(
this
.
classForm
)
).
then
(
res
=>
{
if
(
res
.
data
.
resultCode
===
"200"
){
this
.
$message
({
type
:
"success"
,
message
:
"新增分类成功!"
});
this
.
dialogVisible
=
false
;
}
else
{
this
.
$message
({
type
:
"error"
,
message
:
res
.
data
.
message
});
}
}).
catch
(
function
(
err
)
{
this
.
$message
({
type
:
"fail"
,
message
:
"新增失败!"
+
err
.
response
.
data
.
msg
});
});
}
else
{
console
.
log
(
"error submit!!"
);
return
false
;
}
});
},
// 新增关闭
close
()
{
this
.
dialogVisible
=
false
;
for
(
let
key
in
this
.
classForm
)
{
this
.
classForm
[
key
]
=
null
;
}
this
.
$refs
[
"classForm"
].
resetFields
();
},
// 新增
submitForm
(
formName
)
{
this
.
$refs
[
formName
].
validate
(
valid
=>
{
if
(
valid
)
{
this
.
$https
(
{
url
:
"videoContent/save"
,
method
:
"post"
,
authType
:
this
.
backToken
},
this
.
$qs
.
stringify
(
this
.
ruleForm
)
).
then
(
res
=>
{
if
(
res
.
data
.
resultCode
===
"200"
){
this
.
$message
({
type
:
"success"
,
message
:
"新增视频申请已提交,待审核!"
});
history
.
go
(
-
1
);
}
else
{
this
.
$message
({
type
:
"error"
,
message
:
res
.
data
.
message
});
}
}).
catch
(
function
(
err
)
{
console
.
log
(
err
);
});
}
else
{
console
.
log
(
"error submit!!"
);
return
false
;
}
});
},
// 修改版权方
updateForm
(
formName
)
{
this
.
$refs
[
formName
].
validate
(
valid
=>
{
if
(
valid
)
{
this
.
$https
(
{
url
:
"videoContent/update"
,
method
:
"put"
,
authType
:
this
.
backToken
},
this
.
$qs
.
stringify
(
this
.
ruleForm
)
).
then
(
res
=>
{
if
(
res
.
data
.
resultCode
===
"200"
){
this
.
$message
({
type
:
"success"
,
message
:
"修改视频申请已提交,待审核!"
});
history
.
go
(
-
1
);
}
else
{
this
.
$message
({
type
:
"error"
,
message
:
res
.
data
.
message
});
}
}).
catch
(
function
(
err
)
{
console
.
log
(
err
);
});
}
else
{
console
.
log
(
"error submit!!"
);
return
false
;
}
});
},
resetForm
(
formName
)
{
this
.
$refs
[
formName
].
resetFields
();
history
.
go
(
-
1
);
},
getVideoContentCopyrightData
()
{
let
vm
=
this
;
vm
.
$https
({
url
:
"copyrightOwner/getList"
,
method
:
"get"
,
authType
:
this
.
backToken
},
{
copyrightOwnerType
:
'VIDEO_CONTENT'
})
.
then
(
res
=>
{
let
data
=
res
.
data
.
data
;
this
.
copyrightOwner
=
data
;
})
.
catch
(
function
(
err
)
{
console
.
log
(
err
);
});
},
// 获取视频分类列表
getVideoContentCatData
()
{
let
vm
=
this
;
if
(
this
.
ruleForm
.
videoContentCopyrightOwnerId
){
vm
.
$https
({
url
:
"videoContentCat/getList"
,
method
:
"get"
,
authType
:
this
.
backToken
},{
copyrightOwnerId
:
this
.
ruleForm
.
videoContentCopyrightOwnerId
}).
then
(
res
=>
{
this
.
videoContentCat
=
res
.
data
.
data
;
}).
catch
(
function
(
err
)
{
console
.
log
(
err
);
});
}
else
{
this
.
$message
.
warning
(
"请先选择视频版权方!"
)
}
},
getSelectDep
(
videoContentCatIdList
)
{
this
.
checkedThing
=
videoContentCatIdList
.
length
===
this
.
videoContentCat
.
length
;
},
selectAllThing
()
{
// debugger
this
.
ruleForm
.
videoContentCatIdList
=
[];
if
(
this
.
checkedThing
)
{
this
.
videoContentCat
.
map
(
item
=>
{
this
.
ruleForm
.
videoContentCatIdList
.
push
(
item
.
id
);
});
}
else
{
this
.
ruleForm
.
videoContentCatIdList
=
[];
}
}
}
};
</
script
>
<
style
lang=
"less"
>
@import "../../../../style/dialog";
</
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