Commit 02c06cbf authored by lixin's avatar lixin

合并更改

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