Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
tea-resources-web
Project
Project
Details
Activity
Releases
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
张伯涛
tea-resources-web
Commits
fbd0e415
Commit
fbd0e415
authored
Apr 08, 2024
by
王飞龙
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
课程管理 课程资料添加
parent
8ee3176e
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
267 additions
and
55 deletions
+267
-55
indexApi.js
src/api/courseManagement/indexApi.js
+39
-9
courseCatalogues.vue
...s/courseInformation/courseManagement/courseCatalogues.vue
+57
-25
index.vue
src/views/courseInformation/courseManagement/index.vue
+171
-21
No files found.
src/api/courseManagement/indexApi.js
View file @
fbd0e415
...
...
@@ -147,6 +147,20 @@ export function uploadVideo(data) {
data
})
}
// 上传压缩包
export
function
uploadZip
(
data
)
{
return
request
({
url
:
'/bfile/uploadData'
,
method
:
'post'
,
headers
:
{
'Content-Type'
:
'multipart/form-data'
},
transformRequest
:
[(
data
)
=>
{
return
data
}],
data
})
}
// 课程管理-章节查询PDF信息
export
function
findPdfInfo
(
data
)
{
data
=
Qs
.
stringify
(
data
)
...
...
@@ -157,16 +171,16 @@ export function findPdfInfo(data) {
headers
:
{}
})
}
export
function
findZIpInfo
(
data
)
{
data
=
Qs
.
stringify
(
data
)
return
request
({
url
:
'/bfile/findDataUrl'
,
method
:
'post'
,
data
,
headers
:
{}
})
}
// 课程管理-根据章id查询节
// export function findSection(data) {
// data = Qs.stringify(data)
// return request({
// url: '/bchapter/querySections',
// method: 'get',
// data,
// headers: {}
// })
// }
export
function
findSection
(
query
)
{
return
request
({
url
:
'/bchapter/querySections'
,
...
...
@@ -192,6 +206,13 @@ export function delData(query) {
params
:
query
})
}
export
function
delZip
(
query
)
{
return
request
({
url
:
'/bfile/deleteDataFile'
,
method
:
'delete'
,
params
:
query
})
}
// 课程管理 岗位分类查询
export
function
queryTeaLessonJobs
(
query
)
{
...
...
@@ -219,3 +240,12 @@ export function updateCourseStatus(data) {
data
})
}
// 下载zip文件
export
function
downloadZip
(
params
)
{
return
request
({
url
:
'/bfile/download/'
,
method
:
'post'
,
responseType
:
'blob'
,
params
})
}
src/views/courseInformation/courseManagement/courseCatalogues.vue
View file @
fbd0e415
...
...
@@ -14,7 +14,7 @@
<div
class=
"btn-group"
>
<el-button
type=
"info"
icon=
"plus"
size=
"small"
@
click=
"viewSwitch.chapterForm = true"
>
添加章
</el-button>
<el-button
type=
"info"
icon=
"plus"
size=
"small"
@
click=
"viewSwitch.sectionForm = true"
>
添加节
</el-button>
<el-button
type=
"info"
icon=
"plus"
size=
"small"
@
click=
"
viewSwitch.subsegmentForm = true
"
>
添加子节
</el-button>
<el-button
type=
"info"
icon=
"plus"
size=
"small"
@
click=
"
openSubsegmentDialog()
"
>
添加子节
</el-button>
</div>
<!--弹出层-->
<el-dialog
title=
"添加章"
:visible
.
sync=
"viewSwitch.chapterForm"
@
open=
"setCurrentForm('chapterForm')"
@
close=
"formClear"
>
...
...
@@ -44,18 +44,18 @@
<el-form-item
label=
"节标题"
:label-width=
"formLabelWidth"
prop=
"text"
>
<el-input
v-model=
"sectionForm.text"
auto-complete=
"off"
placeholder=
"最多输入50个字符"
:maxlength=
"50"
/>
</el-form-item>
<!--
<el-form-item
label=
"学时"
:label-width=
"formLabelWidth"
prop=
"classHours"
>
-->
<!--
<el-radio-group
v-model=
"sectionForm.classHours"
fill=
"#F7BA2A"
>
-->
<!--
<el-radio
:label=
"1"
>
1学时
</el-radio>
-->
<!--
<el-radio
:label=
"0"
>
0学时
</el-radio>
-->
<!--
</el-radio-group>
-->
<!--
</el-form-item>
-->
<!--
<el-form-item
label=
"教学手段"
:label-width=
"formLabelWidth"
prop=
"stuMeans"
>
-->
<!--
<el-checkbox-group
v-model=
"sectionForm.stuMeans"
>
-->
<!--
<el-checkbox
label=
"视频"
name=
"stuMeans"
/>
-->
<!-- <!–
<el-checkbox
label=
"PDF"
name=
"stuMeans"
/>
–>
-->
<!--
</el-checkbox-group>
-->
<!--
</el-form-item>
-->
<!--
<el-form-item
label=
"学时"
:label-width=
"formLabelWidth"
prop=
"classHours"
>
-->
<!--
<el-radio-group
v-model=
"sectionForm.classHours"
fill=
"#F7BA2A"
>
-->
<!--
<el-radio
:label=
"1"
>
1学时
</el-radio>
-->
<!--
<el-radio
:label=
"0"
>
0学时
</el-radio>
-->
<!--
</el-radio-group>
-->
<!--
</el-form-item>
-->
<!--
<el-form-item
label=
"教学手段"
:label-width=
"formLabelWidth"
prop=
"stuMeans"
>
-->
<!--
<el-checkbox-group
v-model=
"sectionForm.stuMeans"
>
-->
<!--
<el-checkbox
label=
"视频"
name=
"stuMeans"
/>
-->
<!-- <!–
<el-checkbox
label=
"PDF"
name=
"stuMeans"
/>
–>
-->
<!--
</el-checkbox-group>
-->
<!--
</el-form-item>
-->
</el-form>
<div
slot=
"footer"
class=
"dialog-footer"
>
<el-button
type=
"warning"
:plain=
"true"
@
click=
"viewSwitch.sectionForm = false"
>
取 消
</el-button>
...
...
@@ -262,16 +262,16 @@
<i
class=
"close"
title=
"删除该节"
@
click=
"delSec(itemChild.businessId)"
/>
<!-- 资源按钮组 -->
<
div
style=
"display:inline-block;float:right"
>
<span
v-show=
"processRes(2,itemChild.isTest)"
>
<i
v-show=
"itemChild.videoUrl!==''"
class=
"chapter-icon videoBtn"
title=
"视频"
@
click=
"openUploadDialog('视频维护',itemChild,0,'只能上传以.mp4格式/.rmvb格式/.avi结尾的文件')"
/>
<!-- 视频
-->
<i
v-show=
"itemChild.videoUrl===''"
class=
"chapter-icon videoBtnNo"
title=
"视频未上传"
@
click=
"openUploadDialog('视频上传',itemChild,0,'只能上传以.mp4格式/.rmvb格式/.avi结尾的文件')"
/>
<!-- 视频未添加
-->
</span
>
<span
v-show=
"processRes(4,itemChild.isTest)"
>
<i
v-show=
"itemChild.pdfUrl!==''"
class=
"chapter-icon pdfBtn"
title=
"PDF"
@
click=
"openUploadDialog('PDF维护',itemChild,1,'只能上传以.pdf结尾的文件')"
/>
<!-- PDF
-->
<i
v-show=
"itemChild.pdfUrl===''"
class=
"chapter-icon pdfBtnNo"
title=
"PDF未上传"
@
click=
"openUploadDialog('PDF上传',itemChild,3,'只能上传以.pdf结尾的文件')"
/>
<!-- PDF未添加
-->
</span
>
<
/div
>
<
!--
<div
style=
"display:inline-block;float:right"
>
--
>
<!--
<span
v-show=
"processRes(2,itemChild.isTest)"
>
--
>
<!--
<i
v-show=
"itemChild.videoUrl!==''"
class=
"chapter-icon videoBtn"
title=
"视频"
@
click=
"openUploadDialog('视频维护',itemChild,0,'只能上传以.mp4格式/.rmvb格式/.avi结尾的文件')"
/>
<
!
–
视频
–>
-->
<!--
<i
v-show=
"itemChild.videoUrl===''"
class=
"chapter-icon videoBtnNo"
title=
"视频未上传"
@
click=
"openUploadDialog('视频上传',itemChild,0,'只能上传以.mp4格式/.rmvb格式/.avi结尾的文件')"
/>
<
!
–
视频未添加
–>
-->
<!--
</span>
--
>
<!--
<span
v-show=
"processRes(4,itemChild.isTest)"
>
--
>
<!--
<i
v-show=
"itemChild.pdfUrl!==''"
class=
"chapter-icon pdfBtn"
title=
"PDF"
@
click=
"openUploadDialog('PDF维护',itemChild,1,'只能上传以.pdf结尾的文件')"
/>
<
!
–
PDF
–>
-->
<!--
<i
v-show=
"itemChild.pdfUrl===''"
class=
"chapter-icon pdfBtnNo"
title=
"PDF未上传"
@
click=
"openUploadDialog('PDF上传',itemChild,3,'只能上传以.pdf结尾的文件')"
/>
<
!
–
PDF未添加
–>
-->
<!--
</span>
--
>
<
!--
</div>
--
>
<dl>
<dt
v-for=
"(subItem, subIndex) in itemChild.childList"
class=
"sub-section"
>
<span>
第
{{
index
+
1
}}
.
{{
indexChild
+
1
}}
.
{{
subIndex
+
1
}}
小节
</span>
...
...
@@ -338,7 +338,15 @@ import {
blessonAdd
,
bchapterAdd
,
bchapterRemove
,
updateTopChapter
,
updateDownChapter
,
uploadVideo
,
findVideoUrl
,
findPdfInfo
,
findPdfUrl
,
delData
,
findSection
updateTopChapter
,
updateDownChapter
,
uploadVideo
,
findVideoUrl
,
findPdfInfo
,
findPdfUrl
,
delData
,
findSection
,
uploadZip
}
from
'@/api/courseManagement/indexApi'
export
default
{
name
:
'CourseCatalogues'
,
...
...
@@ -872,7 +880,6 @@ export default {
// 添加子节
addSubsegment
(
formName
)
{
const
_this
=
this
console
.
log
(
'111'
,
formName
)
this
.
$refs
[
formName
].
validate
((
valid
)
=>
{
if
(
valid
)
{
// 把旧值清空
...
...
@@ -976,6 +983,7 @@ export default {
message
:
'网络错误5'
,
type
:
'error'
})
_this
.
subsegmentClear
()
_this
.
viewSwitch
.
subsegmentForm
=
false
})
}
...
...
@@ -1000,6 +1008,28 @@ export default {
setCurrentForm
(
formName
)
{
this
.
currentForm
=
formName
},
// 打开子节对话框
openSubsegmentDialog
(
item
)
{
this
.
viewSwitch
.
subsegmentForm
=
true
this
.
subsegmentClear
()
},
// 子节列表清空
subsegmentClear
()
{
this
.
$refs
.
subsegmentForm
.
resetFields
()
// 数据清空
this
.
subsegmentForm
=
{
stuHourRadio
:
''
,
// 学时单选按钮
text
:
''
,
chapterId
:
''
,
chapterName
:
''
,
stuMeans
:
[],
stuMeansValue
:
''
,
stuMeansFile
:
''
,
classHours
:
1
,
stuMeansOpt
:
false
,
sectionId
:
''
}
},
// 表单对话框关闭
formClear
()
{
this
.
$refs
[
this
.
currentForm
].
resetFields
()
...
...
@@ -1496,6 +1526,7 @@ export default {
background
:
'rgba(0, 0, 0, 0.5)'
,
customClass
:
'myLoading'
})
console
.
log
(
'this.resForm.filelist11111111111111'
,
this
.
resForm
.
filelist
)
const
fileList
=
this
.
resForm
.
filelist
.
map
(
item
=>
item
.
raw
)
var
formData
=
new
FormData
()
// 当前为空
formData
.
append
(
'type'
,
type
)
...
...
@@ -1506,6 +1537,7 @@ export default {
})
formData
.
append
(
'lessonId'
,
_this
.
lessonId
)
formData
.
append
(
'temp'
,
'pdf'
)
console
.
log
(
'formData1111'
,
formData
)
uploadVideo
(
formData
).
then
(
res
=>
{
loading
.
close
()
if
(
res
.
code
===
200
)
{
...
...
src/views/courseInformation/courseManagement/index.vue
View file @
fbd0e415
...
...
@@ -5,7 +5,7 @@
<div
class=
"search"
style=
"border-bottom: 14px solid #f4f4f4"
>
<el-form
ref=
"queryForm"
style=
"padding: 0 0 0 10px"
:model=
"queryParams"
:inline=
"true"
>
<el-form-item
label=
"课程名称"
prop=
"lessonName"
>
<el-input
v-model=
"queryParams.lessonName"
placeholder=
"课程名称"
:maxlength=
"15"
style=
"width: 2
1
0px"
/>
<el-input
v-model=
"queryParams.lessonName"
placeholder=
"课程名称"
:maxlength=
"15"
style=
"width: 2
0
0px"
/>
</el-form-item>
<!-- 课程方案-->
<el-form-item
label=
"课程方案"
prop=
"classPlan"
>
...
...
@@ -386,7 +386,7 @@
:class=
"commonField.updateClass"
:type=
"commonField.typeParent"
:size=
"commonField.size"
@
click=
"handleProfile(scope.
$index
)"
@
click=
"handleProfile(scope.
row
)"
>
课程资料
</el-button>
<el-button
:class=
"commonField.updateClass"
...
...
@@ -439,7 +439,7 @@
</el-upload>
<span
slot=
"footer"
class=
"dialog-footer"
>
<el-button
@
click=
"resForm.resView=false"
>
取 消
</el-button>
<el-button
type=
"primary"
@
click=
"upload
Zip
"
>
保 存
</el-button>
<el-button
type=
"primary"
@
click=
"upload
File
"
>
保 存
</el-button>
</span>
</el-dialog>
<el-dialog
...
...
@@ -477,14 +477,45 @@
@
close=
"clearCoverFileList"
>
<el-button
@
click=
"resForm.resView = true"
type=
"primary"
@
click=
"openUploadZip"
>
上 传
</el-button>
<!-- <el-table-->
<!-- v-loading="fullscreenLoading"-->
<!-- :data="profileData"-->
<!-- border-->
<!-- sortable="true"-->
<!-- >-->
<el-table
v-loading=
"fullscreenLoading"
style=
"margin-top: 20px"
:data=
"zipList"
border
sortable=
"true"
>
<el-table-column
align=
"center"
prop=
"id"
label=
"序号"
width=
"65px"
>
<
template
slot-scope=
"scope"
>
<span>
{{
scope
.
$index
+
1
}}
</span>
</
template
>
</el-table-column>
<el-table-column
align=
"center"
label=
"文件名"
prop=
"fileName"
:show-overflow-tooltip=
"true"
>
<
template
slot-scope=
"scope"
>
<span>
{{
scope
.
row
.
originalName
}}
</span>
</
template
>
</el-table-column>
<!-- 操作-->
<el-table-column
align=
"center"
label=
"操作"
width=
"150"
>
<
template
slot-scope=
"scope"
>
<el-button
:class=
"commonField.updateClass"
:type=
"commonField.typeParent"
:size=
"commonField.size"
@
click=
"removeFile(scope.row)"
>
删除
</el-button>
<!-- 下载-->
<el-button
:class=
"commonField.updateClass"
:type=
"commonField.typeParent"
:size=
"commonField.size"
@
click=
"downloadFile(scope.row)"
>
下载
</el-button>
</
template
>
</el-table-column>
</el-table>
<span
slot=
"footer"
class=
"dialog-footer"
>
<el-button
@
click=
"dialogProfile=false"
>
取 消
</el-button>
...
...
@@ -510,7 +541,7 @@ import {
blessonAdd
,
blessonRemove
,
excelImport
,
defaultUrl
,
picImport
,
updateCourseStatus
defaultUrl
,
picImport
,
updateCourseStatus
,
uploadVideo
,
uploadZip
,
findZIpInfo
,
delZip
,
downloadZip
}
from
'@/api/courseManagement/indexApi'
import
commonField
from
'@/utils/commonField'
import
{
getDict
}
from
'@/api/system/dict/data'
...
...
@@ -585,6 +616,7 @@ export default {
// {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'}
],
lessonId
:
''
,
// 上传用的节id
businessId
:
''
,
// 章id
...
...
@@ -636,7 +668,7 @@ export default {
formLabelWidth
:
'90px'
,
// 表格
tableData
:
[],
zipList
:
[],
lineindex
:
0
,
teacode
:
''
,
...
...
@@ -853,8 +885,11 @@ export default {
})
},
// 打开课程资料对话框
handleProfile
()
{
handleProfile
(
data
)
{
console
.
log
(
'data'
,
data
)
this
.
dialogProfile
=
true
this
.
lessonId
=
data
.
businessId
this
.
getZipList
(
this
.
lessonId
)
},
// 修改是否企业精品课
handleEntQualityChange
(
row
)
{
...
...
@@ -1405,7 +1440,7 @@ export default {
// $("#pic").remove();
},
// 司马上传压缩包文件
upload
Zip
()
{
upload
File
()
{
const
file
=
this
.
resForm
.
filelist
const
_this
=
this
if
(
file
.
length
<=
0
)
{
...
...
@@ -1416,23 +1451,138 @@ export default {
})
}
else
{
const
typeName
=
file
.
map
(
item
=>
item
.
name
.
split
(
'.'
).
splice
(
-
1
)[
0
])
if
(
typeName
.
filter
(
item
=>
item
!==
'
pdf
'
).
length
>
0
)
{
if
(
typeName
.
filter
(
item
=>
item
!==
'
zip
'
).
length
>
0
)
{
_this
.
$notify
({
title
:
'提示'
,
message
:
'
PDF只能上传以.pdf结尾
的文件'
,
message
:
'
只能上传.zip格式
的文件'
,
type
:
'warning'
})
_this
.
viewSwitch
.
isLoading
=
false
}
else
{
this
.
uploadIngPDF
(
1
)
if
(
this
.
firstUpload
===
false
)
{
setTimeout
(()
=>
{
this
.
openUploadDialog
(
'PDF维护'
,
this
.
saveItem
,
1
,
'只能上传以.pdf结尾的文件'
,
this
.
getUploadVideoPdfUrl
)
},
1500
)
}
//
if (this.firstUpload === false) {
//
setTimeout(() => {
//
this.openUploadDialog('PDF维护', this.saveItem, 1, '只能上传以.pdf结尾的文件', this.getUploadVideoPdfUrl)
//
}, 1500)
//
}
}
}
},
uploadIngPDF
(
type
)
{
const
_this
=
this
const
loading
=
_this
.
$loading
({
lock
:
true
,
text
:
'正在上传...'
,
spinner
:
'el-icon-loading'
,
background
:
'rgba(0, 0, 0, 0.5)'
,
customClass
:
'myLoading'
})
const
fileList
=
this
.
resForm
.
filelist
.
map
(
item
=>
item
.
raw
)
var
formData
=
new
FormData
()
// 当前为空
formData
.
append
(
'type'
,
type
)
formData
.
append
(
'chapterId'
,
_this
.
resForm
.
businessId
)
formData
.
append
(
'file'
,
fileList
)
fileList
.
forEach
((
file
,
index
)
=>
{
formData
.
append
(
`file`
,
file
)
})
formData
.
append
(
'lessonId'
,
_this
.
lessonId
)
formData
.
append
(
'temp'
,
'zip'
)
uploadZip
(
formData
).
then
(
res
=>
{
loading
.
close
()
if
(
res
.
code
===
200
)
{
_this
.
$message
({
message
:
'上传成功'
,
type
:
'success'
})
_this
.
resForm
.
resView
=
false
_this
.
resForm
.
filelist
=
[]
_this
.
getUploadVideoPdfUrl
=
res
.
data
this
.
dialogProfile
=
true
this
.
getZipList
()
_this
.
loadCatalog
(
_this
.
lessonId
)
}
else
{
_this
.
warning
(
res
)
}
}).
catch
((
err
)
=>
{
loading
.
close
()
_this
.
error
(
err
)
})
},
// 打开上传对话框
openUploadZip
()
{
// 判断已经上传过zip文件数量 如果大于5个则不能上传
if
(
this
.
zipList
.
length
>=
5
)
{
this
.
$message
({
message
:
'最多上传5个zip文件'
,
type
:
'warning'
})
return
}
this
.
resForm
.
resView
=
true
},
// 查询zip文件
getZipList
()
{
const
_this
=
this
const
params
=
{
lessonId
:
_this
.
lessonId
}
findZIpInfo
(
params
).
then
(
res
=>
{
console
.
log
(
'res'
,
res
)
if
(
res
.
code
===
200
)
{
_this
.
zipList
=
res
.
data
.
ossInfoList
}
}).
catch
((
err
)
=>
{
_this
.
error
(
err
)
})
},
// 删除zip文件
removeFile
(
data
)
{
// 二次确认
this
.
$confirm
(
'是否确认删除?'
,
'提示'
,
{
confirmButtonText
:
'确定'
,
cancelButtonText
:
'取消'
,
type
:
'warning'
}).
then
(()
=>
{
const
_this
=
this
const
params
=
{
lessonId
:
_this
.
lessonId
,
ossId
:
data
.
businessId
}
console
.
log
(
'params'
,
params
)
delZip
(
params
).
then
(
res
=>
{
if
(
res
.
code
===
200
)
{
// _this.success(res)
this
.
$message
({
message
:
'删除成功'
,
type
:
'success'
})
_this
.
getZipList
()
}
else
{
_this
.
warning
(
res
)
}
}).
catch
((
err
)
=>
{
_this
.
error
(
err
)
})
}).
catch
(()
=>
{
})
},
downloadFile
(
data
)
{
console
.
log
(
'data'
,
data
)
const
_this
=
this
const
params
=
{
businessId
:
data
.
businessId
}
downloadZip
(
params
).
then
(
res
=>
{
if
(
res
.
code
===
200
)
{
// _this.success(res)
window
.
open
(
res
.
data
)
}
else
{
_this
.
warning
(
res
)
}
}).
catch
((
err
)
=>
{
_this
.
error
(
err
)
})
},
// 上传资源
handleChange
(
file
,
fileList
)
{
this
.
resForm
.
filelist
=
fileList
...
...
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