Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
O
online-edu-admin
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Redmine
Redmine
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
online-edu
online-edu-admin
Commits
02c06cbf
Commit
02c06cbf
authored
Jul 26, 2021
by
lixin
Browse files
Options
Browse Files
Download
Plain Diff
合并更改
parents
b97591de
97faaadf
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
158 additions
and
369 deletions
+158
-369
detail.vue
src/views/biz/course/detail.vue
+158
-369
No files found.
src/views/biz/course/detail.vue
View file @
02c06cbf
<
template
>
<div
class=
"detail_content"
>
<div
class=
"detail_content"
>
<div
class=
"steps-content"
>
<a-form-model
:model=
"step1FormModel"
:label-col=
"
{span: 8}"
:wrapper-col="{span: 14}"
:rules="step1FormRules"
ref="step1FormModelRef"
style="padding-top: 10px;padding-bottom: 10px"
>
<a-form-model-item
label=
"课程类型"
prop=
"type"
>
<a-radio-group
name=
"courseType"
default-value=
"SINGLE"
v-model=
"step1FormModel.type"
:disabled=
"isReadOnly"
>
<a-form-model
:model=
"step1FormModel"
:label-col=
"
{span: 8}" :wrapper-col="{span: 14}" :rules="step1FormRules" ref="step1FormModelRef" style="padding-top: 10px;padding-bottom: 10px">
<a-form-model-item
label=
"课程类型"
prop=
"type"
>
<a-radio-group
name=
"courseType"
default-value=
"SINGLE"
v-model=
"step1FormModel.type"
:disabled=
"isReadOnly"
>
<a-radio
value=
"SINGLE"
>
单集
</a-radio>
...
...
@@ -31,63 +16,22 @@
</a-radio-group>
</a-form-model-item>
<a-form-model-item
label=
"系列名称"
prop=
"seriesId"
v-if=
"step1FormModel.type == 'SERIES'"
>
<a-select
:value=
"currentSeries"
label-in-value
show-search
placeholder=
"输入或查询系列"
:default-active-first-option=
"false"
:show-arrow=
"false"
:filter-option=
"false"
:not-found-content=
"null"
@
search=
"handleSeriesSearch"
@
change=
"handleSeriesChange"
:disabled=
"isReadOnly"
>
<a-select-option
v-for=
"d in this.seriesData"
:key=
"d.value"
>
<a-form-model-item
label=
"系列名称"
prop=
"seriesId"
v-if=
"step1FormModel.type == 'SERIES'"
>
<a-select
:value=
"currentSeries"
label-in-value
show-search
placeholder=
"输入或查询系列"
:default-active-first-option=
"false"
:show-arrow=
"false"
:filter-option=
"false"
:not-found-content=
"null"
@
search=
"handleSeriesSearch"
@
change=
"handleSeriesChange"
:disabled=
"isReadOnly"
>
<a-select-option
v-for=
"d in this.seriesData"
:key=
"d.value"
>
{{
d
.
text
}}
</a-select-option>
</a-select>
</a-form-model-item>
<a-form-model-item
label=
"课程名称"
prop=
"name"
>
<a-form-model-item
label=
"课程名称"
prop=
"name"
>
<a-input
v-model=
"step1FormModel.name"
:disabled=
"isReadOnly"
/>
</a-form-model-item>
<a-form-model-item
label=
"上传封面"
prop=
"logoUrl"
>
<a-upload
name=
"file"
list-type=
"picture-card"
class=
"avatar-uploader"
:show-upload-list=
"false"
:customRequest=
"uploadLogo"
:before-upload=
"beforeUpload"
@
change=
"handleChange"
:disabled=
"isReadOnly"
>
<img
v-if=
"step1FormModel.logoUrl"
width=
"200"
height=
"200"
style=
"width:auto!important"
:src=
"step1FormModel.logoUrl"
alt=
"logo"
/>
<a-form-model-item
label=
"上传封面"
prop=
"logoUrl"
>
<a-upload
name=
"file"
list-type=
"picture-card"
class=
"avatar-uploader"
:show-upload-list=
"false"
:customRequest=
"uploadLogo"
:before-upload=
"beforeUpload"
@
change=
"handleChange"
:disabled=
"isReadOnly"
>
<img
v-if=
"step1FormModel.logoUrl"
width=
"200"
height=
"200"
style=
"width:auto!important"
:src=
"step1FormModel.logoUrl"
alt=
"logo"
/>
<div
v-else
>
<a-icon
:type=
"loading ? 'loading' : 'plus'"
/>
<div
class=
"ant-upload-text"
>
...
...
@@ -98,35 +42,14 @@
</a-form-model-item>
<a-form-model-item
label=
"上传视频"
>
<div
v-for=
"(video,index) in videoSeries"
:label=
"video.chaperName"
:key=
"video.videoId"
class=
"video-series"
>
<a-row
type=
"flex"
justify=
"start"
align=
"middle"
>
<a-col
:span=
"6"
class=
"video-image"
>
<div
v-for=
"(video,index) in videoSeries"
:label=
"video.chaperName"
:key=
"video.videoId"
class=
"video-series"
>
<a-row
type=
"flex"
justify=
"start"
align=
"middle"
>
<a-col
:span=
"6"
class=
"video-image"
>
<div
class=
"video-image-background"
>
<img
:src=
"video.coverUrl"
width=
"100%"
/>
<img
:src=
"video.coverUrl"
width=
"100%"
/>
<div
class=
"video-image-toolbar"
>
<a-icon
type=
"delete"
@
click=
"deleteVideo(video)"
/>
<a-icon
type=
"edit"
@
click=
"editVideo(video)"
/>
<a-icon
type=
"delete"
@
click=
"deleteVideo(video)"
/>
<a-icon
type=
"edit"
@
click=
"editVideo(video)"
/>
</div>
<div
class=
"video-image-cover"
></div>
<div
class=
"video-image-play"
>
...
...
@@ -136,7 +59,7 @@
</div>
</a-col>
<a-col
:span=
"12"
>
<div
class=
"video-desc"
>
第
{{
index
+
1
}}
级
</div>
<div
class=
"video-desc"
>
第
{{
index
+
1
}}
集
</div>
<div
class=
"video-desc"
>
{{
video
.
name
}}
</div>
</a-col>
</a-row>
...
...
@@ -144,36 +67,15 @@
<a-button
@
click=
"showVideoUploadModal"
:disabled=
"isReadOnly"
>
上传视频
</a-button>
</a-form-model-item>
<a-form-model-item
label=
"课程简介"
prop=
"introduce"
>
<a-textarea
row=
"2"
v-model=
"step1FormModel.introduce"
:disabled=
"isReadOnly"
/>
<a-form-model-item
label=
"课程简介"
prop=
"introduce"
>
<a-textarea
row=
"2"
v-model=
"step1FormModel.introduce"
:disabled=
"isReadOnly"
/>
</a-form-model-item>
<a-form-model-item
label=
"课程介绍"
prop=
"detail"
>
<a-form-model-item
label=
"课程介绍"
prop=
"detail"
>
<!--
<a-textarea
row=
"4"
v-model=
"step1FormModel.detail"
/>
-->
<a-upload
name=
"detailUpload"
accept=
"image/*"
list-type=
"picture-card"
:file-list=
"detailPicList"
:multiple=
"true"
:customRequest=
"uploadDetailPic"
:before-upload=
"beforUploadDetailPic"
@
change=
"uploadDetailPicChange"
:remove=
"uploadDetailRemove"
:disabled=
"isReadOnly"
>
<a-upload
name=
"detailUpload"
accept=
"image/*"
list-type=
"picture-card"
:file-list=
"detailPicList"
:multiple=
"true"
:customRequest=
"uploadDetailPic"
:before-upload=
"beforUploadDetailPic"
@
change=
"uploadDetailPicChange"
:remove=
"uploadDetailRemove"
:disabled=
"isReadOnly"
>
<div
v-if=
"detailPicList.length
<
8
"
>
<a-icon
type=
"plus"
/>
<div>
...
...
@@ -184,39 +86,19 @@
</a-form-model-item>
<a-form-model-item
label=
"上传附件"
>
<div
v-for=
"(attachment) in attachments"
:label=
"attachment.title"
:key=
"attachment.id"
class=
"video-series"
>
<a-row
type=
"flex"
justify=
"start"
align=
"middle"
>
<div
v-for=
"(attachment) in attachments"
:label=
"attachment.title"
:key=
"attachment.id"
class=
"video-series"
>
<a-row
type=
"flex"
justify=
"start"
align=
"middle"
>
<a-col
:span=
"12"
>
<div
class=
"video-desc"
>
<a-icon
type=
"paper-clip"
class=
"attachment-icon"
/>
{{
attachment
.
title
}}
</div>
<a-icon
type=
"paper-clip"
class=
"attachment-icon"
/>
{{
attachment
.
title
}}
</div>
</a-col>
</a-row>
</div>
<a-button
@
click=
"showAttachmentUploadModal"
:disabled=
"isReadOnly"
>
上传附件
</a-button>
</a-form-model-item>
<a-form-model-item
label=
"收费模式"
prop=
"chargeModel"
>
<a-radio-group
name=
"chargeModel"
default-value=
"FREE"
v-model=
"step1FormModel.chargeModel"
:disabled=
"isReadOnly"
>
<a-form-model-item
label=
"收费模式"
prop=
"chargeModel"
>
<a-radio-group
name=
"chargeModel"
default-value=
"FREE"
v-model=
"step1FormModel.chargeModel"
:disabled=
"isReadOnly"
>
<a-radio
value=
"FREE"
>
免费
</a-radio>
...
...
@@ -229,54 +111,20 @@
</a-radio-group>
</a-form-model-item>
<a-form-model-item
v-if=
"step1FormModel.chargeModel == 'PAY'"
label=
"非会员价格"
prop=
"price"
>
<a-input
prefix=
"¥"
v-model=
"step1FormModel.price"
/>
<a-form-model-item
v-if=
"step1FormModel.chargeModel == 'PAY'"
label=
"非会员价格"
prop=
"price"
>
<a-input
prefix=
"¥"
v-model=
"step1FormModel.price"
/>
</a-form-model-item>
<a-form-model-item
v-if=
"step1FormModel.chargeModel == 'PAY'"
label=
"有效时间"
prop=
"validPeriod"
>
<a-input
suffix=
"小时"
v-model=
"step1FormModel.validPeriod"
/>
<a-form-model-item
v-if=
"step1FormModel.chargeModel == 'PAY'"
label=
"有效时间"
prop=
"validPeriod"
>
<a-input
suffix=
"小时"
v-model=
"step1FormModel.validPeriod"
/>
</a-form-model-item>
<a-form-model-item
v-if=
"step1FormModel.chargeModel == 'PAY'"
label=
"会员价格"
prop=
"vipPrice"
>
<a-input
prefix=
"¥"
v-model=
"step1FormModel.vipPrice"
/>
<a-form-model-item
v-if=
"step1FormModel.chargeModel == 'PAY'"
label=
"会员价格"
prop=
"vipPrice"
>
<a-input
prefix=
"¥"
v-model=
"step1FormModel.vipPrice"
/>
</a-form-model-item>
<a-form-model-item
label=
"所属讲师"
>
<a-select
placeholder=
"选择讲师"
v-model=
"step1FormModel.teacherId"
@
change=
"handleTeacherChange"
:disabled=
"isReadOnly"
>
<a-select-opt-group
v-for=
"(org) in this.teachers"
:key=
"org.id"
:label=
"org.name"
>
<a-select-option
v-for=
"(t) in org.teachers"
:key=
"t.id"
:value=
"t.id"
>
<a-select
placeholder=
"选择讲师"
v-model=
"step1FormModel.teacherId"
@
change=
"handleTeacherChange"
:disabled=
"isReadOnly"
>
<a-select-opt-group
v-for=
"(org) in this.teachers"
:key=
"org.id"
:label=
"org.name"
>
<a-select-option
v-for=
"(t) in org.teachers"
:key=
"t.id"
:value=
"t.id"
>
{{
t
.
name
}}
</a-select-option>
</a-select-opt-group>
...
...
@@ -285,33 +133,14 @@
</a-form-model-item>
<a-form-model-item
label=
"课程标签"
>
<a-select
mode=
"multiple"
label-in-value
placeholder=
"选择课程标签"
v-model=
"selectedTags"
@
change=
"handleTagChange"
:disabled=
"isReadOnly"
>
<a-select-option
v-for=
"(t) in this.tags"
:key=
"t.tagId"
:value=
"t.tagId"
>
<a-select
mode=
"multiple"
label-in-value
placeholder=
"选择课程标签"
v-model=
"selectedTags"
@
change=
"handleTagChange"
:disabled=
"isReadOnly"
>
<a-select-option
v-for=
"(t) in this.tags"
:key=
"t.tagId"
:value=
"t.tagId"
>
{{
t
.
tagName
}}
</a-select-option>
</a-select>
</a-form-model-item>
<a-form-model-item
label=
"可见范围"
prop=
"allow"
>
<a-radio-group
name=
"allow"
default-value=
"ALL"
v-model=
"step1FormModel.allow"
:disabled=
"isReadOnly"
>
<a-form-model-item
label=
"可见范围"
prop=
"allow"
>
<a-radio-group
name=
"allow"
default-value=
"ALL"
v-model=
"step1FormModel.allow"
:disabled=
"isReadOnly"
>
<a-radio
value=
"ALL"
>
全部
</a-radio>
...
...
@@ -321,21 +150,9 @@
</a-radio-group>
</a-form-model-item>
<a-form-model-item
v-if=
"step1FormModel.allow === 'SPECIFY'"
label=
"指定企业"
>
<a-select
mode=
"multiple"
placeholder=
"选择企业"
v-model=
"step1FormModel.allowOrgIds"
@
change=
"handleEnterpriseChange"
>
<a-select-option
v-for=
"(t) in this.enterprise"
:key=
"t.id"
:value=
"t.id"
>
<a-form-model-item
v-if=
"step1FormModel.allow === 'SPECIFY'"
label=
"指定企业"
>
<a-select
mode=
"multiple"
placeholder=
"选择企业"
v-model=
"step1FormModel.allowOrgIds"
@
change=
"handleEnterpriseChange"
>
<a-select-option
v-for=
"(t) in this.enterprise"
:key=
"t.id"
:value=
"t.id"
>
{{
t
.
name
}}
</a-select-option>
</a-select>
...
...
@@ -343,48 +160,23 @@
<a-form-item
:wrapper-col=
"
{ span: 24 }">
<div
class=
"btn-div"
>
<a-button
type=
"primary"
@
click=
"onSave"
:disabled=
"isReadOnly"
>
<a-button
type=
"primary"
@
click=
"onSave"
:disabled=
"isReadOnly"
>
保存
</a-button>
<a-button
class=
"cancel-btn"
@
click=
"onCancel"
>
返回
</a-button>
<a-button
class=
"cancel-btn"
@
click=
"onCancel"
>
返回
</a-button>
</div>
</a-form-item>
</a-form-model>
</div>
<template>
<a-modal
:visible=
"videoUploadModalVisible"
title=
"视频上传"
@
ok=
"videoUpload"
@
cancel=
"closeVideoUploadModal"
:destroyOnClose=
"true"
centered
>
<a-modal
:visible=
"videoUploadModalVisible"
title=
"视频上传"
@
ok=
"videoUpload"
@
cancel=
"closeVideoUploadModal"
:destroyOnClose=
"true"
centered
>
<a-form>
<a-form-item>
<a-input
v-model=
"video.title"
placeholder=
"视频标题"
allowClear
></a-input>
<a-input
v-model=
"video.title"
placeholder=
"视频标题"
allowClear
></a-input>
</a-form-item>
<a-form-item>
<a-upload
ref=
"videoUploaderRef"
name=
"file"
:multiple=
"false"
:show-upload-list=
"true"
:customRequest=
"uploadVideo"
:before-upload=
"beforeVideoUpload"
>
<a-upload
ref=
"videoUploaderRef"
name=
"file"
:multiple=
"false"
:show-upload-list=
"true"
:customRequest=
"uploadVideo"
:before-upload=
"beforeVideoUpload"
>
<a-button>
<a-icon
type=
"upload"
/>
选择视频文件
</a-button>
</a-upload>
...
...
@@ -394,31 +186,13 @@
</
template
>
<
template
>
<a-modal
:visible=
"attachmentUploadModalVisible"
title=
"附件上传"
@
ok=
"saveAttachments"
@
cancel=
"closeAttachmentUploadModal"
:destroyOnClose=
"true"
centered
>
<a-modal
:visible=
"attachmentUploadModalVisible"
title=
"附件上传"
@
ok=
"saveAttachments"
@
cancel=
"closeAttachmentUploadModal"
:destroyOnClose=
"true"
centered
>
<a-form>
<a-form-item>
<a-input
v-model=
"attachment.title"
placeholder=
"附件标题"
allowClear
></a-input>
<a-input
v-model=
"attachment.title"
placeholder=
"附件标题"
allowClear
></a-input>
</a-form-item>
<a-form-item>
<a-upload
ref=
"attachmentUploaderRef"
name=
"file"
:multiple=
"false"
:show-upload-list=
"true"
:customRequest=
"uploadAttachment"
:before-upload=
"beforeAttachmentUpload"
>
<a-upload
ref=
"attachmentUploaderRef"
name=
"file"
:multiple=
"false"
:show-upload-list=
"true"
:customRequest=
"uploadAttachment"
:before-upload=
"beforeAttachmentUpload"
>
<a-button>
<a-icon
type=
"upload"
/>
选择附件文件
</a-button>
</a-upload>
...
...
@@ -428,32 +202,28 @@
</
template
>
<
template
>
<a-modal
:visible=
"showVideoEditor"
title=
"修改视频名称"
@
ok=
"updateVideoTitle"
@
cancel=
"closeVideoEditor"
:destroyOnClose=
"true"
>
<a-modal
:visible=
"showVideoEditor"
title=
"修改视频名称"
@
ok=
"updateVideoTitle"
@
cancel=
"closeVideoEditor"
:destroyOnClose=
"true"
>
<a-form>
<a-form-item>
<a-input
v-model=
"video2update.name"
placeholder=
"输入视频标题"
allowClear
></a-input>
<a-input
v-model=
"video2update.name"
placeholder=
"输入视频标题"
allowClear
></a-input>
</a-form-item>
</a-form>
</a-modal>
</
template
>
</div>
</div>
</template>
<
script
>
import
{
uploadFile
}
from
"@/api/biz/resource"
;
import
{
disposereq
}
from
"@/utils/util"
;
import
{
fetchList
as
teacherFetchList
}
from
"@/api/biz/teacher"
;
import
{
uploadFile
}
from
"@/api/biz/resource"
;
import
{
disposereq
}
from
"@/utils/util"
;
import
{
fetchList
as
teacherFetchList
}
from
"@/api/biz/teacher"
;
import
{
saveStep1
,
saveStep2
,
...
...
@@ -469,8 +239,12 @@ import {
updateChaperTitle
,
}
from
"@/api/biz/course"
;
import
{
fetchList
as
fetchTagList
}
from
"@/api/biz/courseTag"
;
import
{
fetchList
as
fetchEnterprise
}
from
"@/api/biz/enterprise"
;
import
{
fetchList
as
fetchTagList
}
from
"@/api/biz/courseTag"
;
import
{
fetchList
as
fetchEnterprise
}
from
"@/api/biz/enterprise"
;
export
default
{
// 创建完毕
...
...
@@ -613,7 +387,7 @@ export default {
}
};
return
{
isReadOnly
:
this
.
$route
.
query
.
isReadOnly
==
'true'
,
isReadOnly
:
this
.
$route
.
query
.
isReadOnly
==
'true'
,
attachment
:
{
title
:
""
,
},
...
...
@@ -645,37 +419,27 @@ export default {
aliyunUserId
:
""
,
//第一步保存时验证规则定义
step1FormRules
:
{
name
:
[
{
name
:
[{
required
:
true
,
message
:
"不能为空"
,
trigger
:
"blur"
,
},
],
seriesId
:
[
{
},
],
seriesId
:
[{
validator
:
validateSerial
,
trigger
:
"change"
,
},
],
price
:
[
{
},
],
price
:
[{
validator
:
validatePrice
,
trigger
:
"change"
,
},
],
validPeriod
:
[
{
},
],
validPeriod
:
[{
validator
:
validateValidPeriod
,
trigger
:
"change"
,
},
],
vipPrice
:
[
{
},
],
vipPrice
:
[{
validator
:
validateVipPrice
,
trigger
:
"change"
,
},
],
},
],
},
//第一步表单数据对象
step1FormModel
:
{
...
...
@@ -711,7 +475,7 @@ export default {
pageIndex
:
1
,
pageSize
:
10
,
},
detailPicList
:
[],
detailPicList
:
[],
};
},
methods
:
{
...
...
@@ -743,7 +507,7 @@ export default {
title
:
`确认要删除
${
video
.
name
?
video
.
name
:
""
}
吗?`
,
content
:
"删除操作同时会删除已经上传的视频文件"
,
onOk
()
{
if
(
video
.
id
!=
undefined
)
{
if
(
video
.
id
!=
undefined
)
{
deleteChaper
(
video
.
id
).
then
((
resp
)
=>
{
if
(
resp
.
resp_code
===
200
)
{
self
.
videoSeries
.
forEach
((
item
,
index
)
=>
{
...
...
@@ -754,7 +518,7 @@ export default {
});
}
});
}
else
if
(
video
.
videoId
!=
undefined
)
{
}
else
if
(
video
.
videoId
!=
undefined
)
{
self
.
videoSeries
.
forEach
((
item
,
index
)
=>
{
console
.
log
(
item
,
video
);
if
(
item
.
videoId
===
video
.
videoId
)
{
...
...
@@ -818,12 +582,10 @@ export default {
pageSize
:
500
,
}).
then
((
res
)
=>
{
if
(
res
.
count
===
0
)
{
callback
([
{
callback
([{
name
:
value
,
id
:
-
1
,
},
]);
},
]);
}
else
{
const
item
=
res
.
data
.
find
((
d
)
=>
d
.
name
.
trim
()
===
value
);
if
(
!
item
)
{
...
...
@@ -885,19 +647,19 @@ export default {
tagIds
,
}
=
this
.
step1FormModel
;
//验证
if
(
!
name
)
{
if
(
!
name
)
{
this
.
$message
.
info
(
'请输入课程名称'
)
return
}
if
(
!
logoUrl
)
{
if
(
!
logoUrl
)
{
this
.
$message
.
info
(
'请上传封面'
)
return
}
if
(
this
.
videoSeries
.
length
==
0
)
{
if
(
this
.
videoSeries
.
length
==
0
)
{
this
.
$message
.
info
(
'请上传视频'
)
return
}
if
(
chargeModel
==
'PAY'
)
{
if
(
chargeModel
==
'PAY'
)
{
if
(
price
==
""
)
{
this
.
$message
.
info
(
"非会员价格不能为空"
);
return
;
...
...
@@ -965,9 +727,9 @@ export default {
};
if
(
this
.
currentSeries
)
{
course
.
seriesId
=
this
.
currentSeries
.
key
;
course
.
seriesName
=
this
.
currentSeries
.
label
?
this
.
currentSeries
.
label
.
trim
()
:
this
.
currentSeries
.
label
;
course
.
seriesName
=
this
.
currentSeries
.
label
?
this
.
currentSeries
.
label
.
trim
()
:
this
.
currentSeries
.
label
;
}
const
courseId
=
this
.
$route
.
query
.
id
;
...
...
@@ -985,7 +747,7 @@ export default {
course
.
attachmenIds
.
push
(
a
.
id
);
});
//课程介绍上传图片处理
if
(
this
.
detailPicList
.
length
>
0
)
{
if
(
this
.
detailPicList
.
length
>
0
)
{
let
urlList
=
this
.
detailPicList
.
map
(
e
=>
{
return
e
.
url
...
...
@@ -1011,14 +773,14 @@ export default {
};
//构建课程介绍图片list
// console.log(res.datas)
if
(
res
.
datas
.
detail
)
{
if
(
res
.
datas
.
detail
)
{
var
picUrlAry
=
res
.
datas
.
detail
.
split
(
','
)
// console.log(picUrlAry)
var
list
=
[]
var
index
=
-
1
picUrlAry
.
forEach
(
e
=>
{
var
obj
=
{}
obj
.
uid
=
index
+
''
obj
.
uid
=
index
+
''
obj
.
name
=
obj
.
uid
obj
.
status
=
'done'
obj
.
url
=
e
...
...
@@ -1055,7 +817,10 @@ export default {
const
_attachments
=
[];
res
.
datas
.
attachmentList
.
forEach
((
a
)
=>
{
_attachments
.
push
({
id
:
a
.
resourceId
,
title
:
a
.
resourceName
});
_attachments
.
push
({
id
:
a
.
resourceId
,
title
:
a
.
resourceName
});
});
this
.
attachments
=
_attachments
;
...
...
@@ -1117,9 +882,11 @@ export default {
});
},
beforeVideoUpload
(
file
)
{
const
{
type
}
=
file
;
const
{
type
}
=
file
;
const
title
=
file
.
name
.
substring
(
0
,
file
.
name
.
indexOf
(
"."
));
if
(
this
.
video
.
title
==
undefined
||
this
.
video
.
title
==
''
)
{
if
(
this
.
video
.
title
==
undefined
||
this
.
video
.
title
==
''
)
{
this
.
video
.
title
=
title
;
}
if
(
type
.
startsWith
(
"video"
))
{
...
...
@@ -1131,14 +898,19 @@ export default {
},
beforeAttachmentUpload
(
file
)
{
const
{
type
}
=
file
;
const
{
type
}
=
file
;
const
title
=
file
.
name
.
substring
(
0
,
file
.
name
.
indexOf
(
"."
));
this
.
attachment
.
title
=
title
;
},
saveAttachments
()
{
if
(
this
.
attachment
)
{
const
{
title
,
id
}
=
this
.
attachment
;
const
{
title
,
id
}
=
this
.
attachment
;
if
(
!
title
)
{
this
.
$message
.
error
(
"请填写附件标题"
);
return
;
...
...
@@ -1164,8 +936,7 @@ export default {
uploadFile
(
formData
)
.
then
((
res
)
=>
{
if
(
res
.
data
.
resp_code
==
200
)
{
self
.
$refs
.
attachmentUploaderRef
.
onProgress
(
{
self
.
$refs
.
attachmentUploaderRef
.
onProgress
({
percent
:
100
,
},
data
.
file
...
...
@@ -1182,8 +953,10 @@ export default {
});
},
uploadVideo
({
file
})
{
var
Title
=
this
.
video
.
title
;
uploadVideo
({
file
})
{
this
.
video
.
fileName
=
file
.
name
;
this
.
video
.
file
=
file
.
file
;
var
userData
=
'{"Vod":{}}'
;
...
...
@@ -1218,12 +991,12 @@ export default {
region
:
self
.
aliyunRegion
,
userId
:
self
.
aliyunUserId
,
// 添加文件成功
addFileSuccess
:
function
(
uploadInfo
)
{
addFileSuccess
:
function
(
uploadInfo
)
{
self
.
uploadDisabled
=
false
;
self
.
resumeDisabled
=
false
;
},
// 开始上传
onUploadstarted
:
function
(
uploadInfo
)
{
onUploadstarted
:
function
(
uploadInfo
)
{
self
.
uploadVideoStatus
=
"uploading"
;
if
(
!
uploadInfo
.
videoId
)
{
fetchAliyunPolicy
({
...
...
@@ -1269,24 +1042,23 @@ export default {
}
},
// 文件上传成功
onUploadSucceed
:
function
(
uploadInfo
)
{
onUploadSucceed
:
function
(
uploadInfo
)
{
self
.
$message
.
success
(
"文件上传成功"
);
self
.
uploadVideoStatus
=
"success"
;
},
// 文件上传失败
onUploadFailed
:
function
(
uploadInfo
,
code
,
message
)
{
onUploadFailed
:
function
(
uploadInfo
,
code
,
message
)
{
self
.
$message
.
error
(
"文件上传失败"
);
},
// 取消文件上传
onUploadCanceled
:
function
(
uploadInfo
,
code
,
message
)
{
onUploadCanceled
:
function
(
uploadInfo
,
code
,
message
)
{
self
.
$message
.
error
(
"文件已暂停上传"
);
},
// 文件上传进度,单位:字节, 可以在这个函数中拿到上传进度并显示在页面上
onUploadProgress
:
function
(
uploadInfo
,
totalSize
,
progress
)
{
onUploadProgress
:
function
(
uploadInfo
,
totalSize
,
progress
)
{
let
progressPercent
=
Math
.
ceil
(
progress
*
100
);
self
.
authProgress
=
progressPercent
;
self
.
$refs
.
videoUploaderRef
.
onProgress
(
{
self
.
$refs
.
videoUploaderRef
.
onProgress
({
percent
:
progressPercent
,
},
uploadInfo
.
file
...
...
@@ -1296,7 +1068,7 @@ export default {
}
},
// 上传凭证超时
onUploadTokenExpired
:
function
(
uploadInfo
)
{
onUploadTokenExpired
:
function
(
uploadInfo
)
{
refreshAliyunPolicy
(
uploadInfo
.
videoId
).
then
((
res
)
=>
{
if
(
res
.
resp_code
==
200
)
{
const
data
=
res
.
datas
;
...
...
@@ -1310,7 +1082,7 @@ export default {
self
.
$message
.
error
(
"文件上传超时"
);
},
// 全部文件上传结束
onUploadEnd
:
function
(
uploadInfo
)
{
onUploadEnd
:
function
(
uploadInfo
)
{
// self.$message.success("文件上传完毕");
},
});
...
...
@@ -1356,7 +1128,10 @@ export default {
videoUpload
()
{
if
(
this
.
video
)
{
const
{
title
,
id
}
=
this
.
video
;
const
{
title
,
id
}
=
this
.
video
;
if
(
!
title
)
{
this
.
$message
.
error
(
"请填写视频标题"
);
return
;
...
...
@@ -1367,13 +1142,27 @@ export default {
}
fetchVideoInfo
(
id
).
then
((
res
)
=>
{
if
(
res
.
resp_code
==
200
)
{
const
{
coverURL
,
duration
}
=
res
.
datas
;
console
.
log
(
this
.
step1FormModel
.
type
)
const
{
coverURL
,
duration
}
=
res
.
datas
;
if
(
this
.
step1FormModel
.
type
===
'SINGLE'
)
{
this
.
videoSeries
=
[{
name
:
title
,
videoId
:
id
,
coverUrl
:
coverURL
,
duration
,
}];
}
else
{
this
.
videoSeries
.
push
({
name
:
title
,
videoId
:
id
,
coverUrl
:
coverURL
,
duration
,
});
}
this
.
video
=
{};
this
.
videoUploadModalVisible
=
false
;
}
...
...
@@ -1408,33 +1197,33 @@ export default {
this
.
videoModalVisible
=
true
;
},
//上传课程简介图片
uploadDetailPic
(
data
)
{
uploadDetailPic
(
data
)
{
const
formData
=
new
FormData
();
let
uid
=
data
.
file
.
uid
formData
.
append
(
"file"
,
data
.
file
);
uploadFile
(
formData
)
.
then
(
res
=>
{
if
(
res
.
data
.
resp_code
==
200
)
{
if
(
res
.
data
.
resp_code
==
200
)
{
this
.
detailPicList
=
this
.
detailPicList
.
map
(
e
=>
{
if
(
e
.
uid
==
uid
)
{
if
(
e
.
uid
==
uid
)
{
e
.
status
=
'done'
e
.
url
=
res
.
data
.
datas
.
url
}
return
e
})
}
else
{
}
else
{
this
.
detailPicList
.
forEach
(
e
=>
{
if
(
e
.
uid
==
uid
)
{
if
(
e
.
uid
==
uid
)
{
e
.
status
=
'error'
}
})
}
}).
catch
(
err
=>
{
disposereq
(
this
,
err
)
disposereq
(
this
,
err
)
})
},
beforUploadDetailPic
(
file
)
{
beforUploadDetailPic
(
file
)
{
const
isLt2M
=
file
.
size
/
1024
/
1024
<
2
;
if
(
!
isLt2M
)
{
...
...
@@ -1442,16 +1231,16 @@ export default {
}
return
isLt2M
;
},
uploadDetailPicChange
(
info
)
{
if
(
info
.
file
.
status
==
'uploading'
)
{
uploadDetailPicChange
(
info
)
{
if
(
info
.
file
.
status
==
'uploading'
)
{
this
.
detailPicList
.
push
(
info
.
file
)
}
},
uploadDetailRemove
(
file
)
{
uploadDetailRemove
(
file
)
{
let
newList
=
[]
this
.
detailPicList
.
forEach
(
e
=>
{
if
(
e
.
uid
!=
file
.
uid
)
{
if
(
e
.
uid
!=
file
.
uid
)
{
newList
.
push
(
e
)
}
})
...
...
@@ -1466,6 +1255,7 @@ export default {
.attachment-icon
{
margin-right
:
5px
;
}
.detail_content
{
background-color
:
#f0f2f5
;
width
:
100%
;
...
...
@@ -1529,8 +1319,7 @@ export default {
.video-image
{
width
:
120px
;
height
:
68px
;
background
:
#d5d5d5
url("../../../assets/img/course/video-bg.png")
no-repeat
50%
;
background
:
#d5d5d5
url("../../../assets/img/course/video-bg.png")
no-repeat
50%
;
display
:
inline-block
;
position
:
relative
;
cursor
:
pointer
;
...
...
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