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
80671de2
Commit
80671de2
authored
Jun 22, 2021
by
liuyang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加课程介绍上传图片
parent
25f3f947
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
113 additions
and
3 deletions
+113
-3
detail.vue
src/views/biz/course/detail.vue
+113
-3
No files found.
src/views/biz/course/detail.vue
View file @
80671de2
...
@@ -153,10 +153,28 @@
...
@@ -153,10 +153,28 @@
label=
"课程介绍"
label=
"课程介绍"
prop=
"detail"
prop=
"detail"
>
>
<a-textarea
<
!--
<
a-textarea
row=
"4"
row=
"4"
v-model=
"step1FormModel.detail"
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"
>
<div
v-if=
"detailPicList.length
<
8
"
>
<a-icon
type=
"plus"
/>
<div>
上传图片
</div>
</div>
</a-upload>
</a-form-model-item>
</a-form-model-item>
<a-form-model-item
label=
"上传附件"
>
<a-form-model-item
label=
"上传附件"
>
...
@@ -681,6 +699,7 @@ export default {
...
@@ -681,6 +699,7 @@ export default {
pageIndex
:
1
,
pageIndex
:
1
,
pageSize
:
10
,
pageSize
:
10
,
},
},
detailPicList
:[],
};
};
},
},
methods
:
{
methods
:
{
...
@@ -827,6 +846,7 @@ export default {
...
@@ -827,6 +846,7 @@ export default {
});
});
},
},
onSave
()
{
onSave
()
{
const
{
const
{
allow
,
allow
,
allowOrgIds
,
allowOrgIds
,
...
@@ -843,6 +863,19 @@ export default {
...
@@ -843,6 +863,19 @@ export default {
vipPrice
,
vipPrice
,
tagIds
,
tagIds
,
}
=
this
.
step1FormModel
;
}
=
this
.
step1FormModel
;
//验证
if
(
!
name
){
this
.
$message
.
info
(
'请输入课程名称'
)
return
}
if
(
!
logoUrl
){
this
.
$message
.
info
(
'请上传封面'
)
return
}
if
(
this
.
videoSeries
.
length
==
0
){
this
.
$message
.
info
(
'请上传视频'
)
return
}
const
chaperList
=
[];
const
chaperList
=
[];
this
.
videoSeries
.
forEach
((
chapter
,
index
)
=>
{
this
.
videoSeries
.
forEach
((
chapter
,
index
)
=>
{
...
@@ -888,7 +921,14 @@ export default {
...
@@ -888,7 +921,14 @@ export default {
this
.
attachments
.
forEach
((
a
)
=>
{
this
.
attachments
.
forEach
((
a
)
=>
{
course
.
attachmenIds
.
push
(
a
.
id
);
course
.
attachmenIds
.
push
(
a
.
id
);
});
});
//课程介绍上传图片处理
if
(
this
.
detailPicList
.
length
>
0
){
let
urlList
=
this
.
detailPicList
.
map
(
e
=>
{
return
e
.
url
})
course
.
detail
=
urlList
.
join
(
','
)
}
saveCourse
(
course
).
then
((
res
)
=>
{
saveCourse
(
course
).
then
((
res
)
=>
{
if
(
res
.
resp_code
===
200
)
{
if
(
res
.
resp_code
===
200
)
{
this
.
$message
.
success
(
"课程保存成功"
);
this
.
$message
.
success
(
"课程保存成功"
);
...
@@ -905,7 +945,26 @@ export default {
...
@@ -905,7 +945,26 @@ export default {
this
.
step1FormModel
=
{
this
.
step1FormModel
=
{
...
res
.
datas
,
...
res
.
datas
,
};
};
//构建课程介绍图片list
// console.log(res.datas)
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
.
name
=
obj
.
uid
obj
.
status
=
'done'
obj
.
url
=
e
// console.log(obj)
index
--
list
.
push
(
obj
)
})
this
.
detailPicList
=
list
}
if
(
this
.
step1FormModel
.
allowOrgList
)
{
if
(
this
.
step1FormModel
.
allowOrgList
)
{
const
_enterprise
=
[];
const
_enterprise
=
[];
this
.
step1FormModel
.
allowOrgList
.
forEach
((
t
)
=>
{
this
.
step1FormModel
.
allowOrgList
.
forEach
((
t
)
=>
{
...
@@ -928,7 +987,7 @@ export default {
...
@@ -928,7 +987,7 @@ export default {
label
:
this
.
step1FormModel
.
seriesName
,
label
:
this
.
step1FormModel
.
seriesName
,
};
};
console
.
log
(
res
.
datas
);
//
console.log(res.datas);
const
_attachments
=
[];
const
_attachments
=
[];
res
.
datas
.
attachmentList
.
forEach
((
a
)
=>
{
res
.
datas
.
attachmentList
.
forEach
((
a
)
=>
{
...
@@ -1282,6 +1341,57 @@ export default {
...
@@ -1282,6 +1341,57 @@ export default {
showVideoModal
()
{
showVideoModal
()
{
this
.
videoModalVisible
=
true
;
this
.
videoModalVisible
=
true
;
},
},
//上传课程简介图片
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
){
this
.
detailPicList
=
this
.
detailPicList
.
map
(
e
=>
{
if
(
e
.
uid
==
uid
){
e
.
status
=
'done'
e
.
url
=
res
.
data
.
datas
.
url
}
return
e
})
}
else
{
this
.
detailPicList
.
forEach
(
e
=>
{
if
(
e
.
uid
==
uid
){
e
.
status
=
'error'
}
})
}
}).
catch
(
err
=>
{
disposereq
(
this
,
err
)
})
},
beforUploadDetailPic
(
file
){
const
isLt2M
=
file
.
size
/
1024
/
1024
<
2
;
if
(
!
isLt2M
)
{
this
.
$message
.
error
(
'图片大小须小于2MB!'
);
}
return
isLt2M
;
},
uploadDetailPicChange
(
info
){
if
(
info
.
file
.
status
==
'uploading'
){
this
.
detailPicList
.
push
(
info
.
file
)
}
},
uploadDetailRemove
(
file
){
let
newList
=
[]
this
.
detailPicList
.
forEach
(
e
=>
{
if
(
e
.
uid
!=
file
.
uid
){
newList
.
push
(
e
)
}
})
this
.
detailPicList
=
newList
return
true
;
}
},
},
};
};
</
script
>
</
script
>
...
...
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