视频发布

This commit is contained in:
asd
2020-10-27 12:01:25 +08:00
parent 380601ea9c
commit 0a512f38f1
4 changed files with 198 additions and 72 deletions

View File

@@ -75,7 +75,12 @@
v-model:value="form.startTime"
placeholder="请设置您的开始时间"
/> -->
<a-date-picker show-time :value="form.dateline" @change="startchange" placeholder="请设置您的开始时间" />
<a-date-picker
show-time
:value="form.dateline"
@change="startchange"
placeholder="请设置您的开始时间"
/>
</a-form-item>
<a-form-item
label="直播时长"
@@ -86,6 +91,7 @@
size="small"
v-model:value="form.livetime"
placeholder="请输入直播时间"
type="number"
/>
<span class="unit">分钟</span>
</a-form-item>
@@ -94,6 +100,7 @@
size="small"
v-model:value="form.livenumber"
placeholder="请输入直播人数"
type="number"
/>
</a-form-item>
<a-form-item label="直播简介" class="brief">
@@ -125,7 +132,7 @@
<div class="notice-container report" v-if="lives.status == 1">
<div class="title">您尚未获得直播资格</div>
<div class="title sub-title">
{{lives.data.msg}}
{{ lives.data.msg }}
</div>
<div class="confirm-btn">意见反馈</div>
</div>
@@ -135,7 +142,7 @@
<!-- 上一周/月您在平台视频点击量为
<span class="red">第24名</span>要在前
<span class="bule">20</span> 才能获得直播资格 -->
{{lives.msg}}
{{ lives.msg }}
</div>
<rank-list :list="lives.data"></rank-list>
</div>
@@ -162,8 +169,9 @@ import { previewCover } from "@/utils/common";
import { FromSend, ImgInfo } from "@/types/index";
import { uploadflie } from "@/utils/vod";
import { getlivest, liveadd, liveinfo, setlive } from "@/api";
import { useRoute } from 'vue-router';
import dayjs from 'dayjs';
import { useRoute } from "vue-router";
import dayjs from "dayjs";
import { message } from "ant-design-vue";
export default defineComponent({
name: "ReleaseWebcast",
@@ -272,30 +280,52 @@ export default defineComponent({
/**
* todo 需要后台返回年份
*/
const id = useRoute().query.id
if(id != null && typeof id == 'string'){
liveinfo(parseInt(id)).then((res)=>{
const id = useRoute().query.id;
if (id != null && typeof id == "string") {
liveinfo(parseInt(id)).then((res) => {
form.value = res;
})
});
}
const onSubmit = (e: FromSend) => {
e.preventDefault();
validate()
.then(() => {
// console.log(toRaw(form),111);
console.log(toRaw(form), 111);
const subdata: any = toRaw(form.value);
// subdata.fileid=picinfo.
if(id != undefined && id){
/**
* todo 提交会报错
*/
subdata.id = id;
setlive(subdata)
}else{
console.log(subdata);
liveadd(subdata);
if (subdata.title == "") {
message.error("直播标题不能为空");
return;
} else if (subdata.img == "") {
message.error("直播封面不能为空");
return;
} else if (subdata.fileurl == "") {
message.error("视频介绍不能为空");
return;
} else if (subdata.dateline == "") {
message.error("开始时间不能为空");
return;
} else if (subdata.livetime == "") {
message.error("直播时长不能为空");
return;
} else if (subdata.livenumber == "") {
message.error("直播人数不能为空");
return;
} else if (subdata.desc == "") {
message.error("直播简介不能为空");
return;
} else {
// subdata.fileid=picinfo.
if (id != undefined && id) {
/**
* todo 提交会报错 编辑直播
*/
subdata.id = id;
// setlive(subdata)
} else {
console.log(subdata);
// liveadd(subdata);
}
}
})
.catch((err: unknown) => {
console.log("error", err);
@@ -317,9 +347,20 @@ export default defineComponent({
// const month = new Date(e).getMonth()+1
// console.log(new Date(e).getFullYear()+"-"+month+'-'+new Date(e).getDate())
// console.log(e.toString())
const time = dayjs(new Date(e))
const timestr = time.year() + "-" + (time.month() + 1) + "-" + time.date() + " " + time.hour() + ":" + time.minute() + ":" + time.second()
console.log(timestr)
const time = dayjs(new Date(e));
const timestr =
time.year() +
"-" +
(time.month() + 1) +
"-" +
time.date() +
" " +
time.hour() +
":" +
time.minute() +
":" +
time.second();
console.log(timestr);
form.value.dateline = timestr;
}
/**
@@ -368,11 +409,11 @@ export default defineComponent({
}
getlivest().then((res) => {
if(res){
if (res) {
isEntitled.value = true;
lives.value = res;
}
})
});
return {
labelCol: { span: 4 },
@@ -396,7 +437,7 @@ export default defineComponent({
startchange,
videofile,
videos,
lives
lives,
};
},
});