This commit is contained in:
luyuan 2020-10-25 12:24:22 +08:00
parent 7f2d980da6
commit eee433837d
Signed by: theluyuan
GPG Key ID: A7972FD973317FF3
2 changed files with 41 additions and 23 deletions

View File

@ -918,3 +918,9 @@ export async function liveinfo(id: number): Promise<any>{
desc: liveinfo.desc
}
}
export async function setlive(data: any){
const info = await put("live/" + data.id, data)
console.log(info.data)
}

View File

@ -161,8 +161,9 @@ import RankList from "./RankList.vue";
import { previewCover } from "@/utils/common";
import { FromSend, ImgInfo } from "@/types/index";
import { uploadflie } from "@/utils/vod";
import { liveadd, liveinfo } from "@/api";
import { liveadd, liveinfo, setlive } from "@/api";
import { useRoute } from 'vue-router';
import dayjs from 'dayjs';
export default defineComponent({
name: "ReleaseWebcast",
@ -256,17 +257,20 @@ export default defineComponent({
* 表单提交
*/
const subdata = ref({
title: "",
img: "",
fileid: "",
fileurl: "",
fileduration: "",
dateline: "",
livetime: "",
livenumber: "",
desc: "",
});
// const subdata = ref({
// title: "",
// img: "",
// fileid: "",
// fileurl: "",
// fileduration: "",
// dateline: "",
// livetime: "",
// livenumber: "",
// desc: "",
// });
/**
* todo 需要后台返回年份
*/
const id = useRoute().query.id
if(id != null && typeof id == 'string'){
liveinfo(parseInt(id)).then((res)=>{
@ -278,10 +282,19 @@ export default defineComponent({
validate()
.then(() => {
// console.log(toRaw(form),111);
const subdata = toRaw(form);
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);
}
})
.catch((err: unknown) => {
console.log("error", err);
@ -300,14 +313,13 @@ export default defineComponent({
*/
function startchange(e: string): void {
const month = new Date(e).getMonth()+1
console.log(new Date(e).getFullYear()+"-"+month+'-'+new Date(e).getDate())
form.value.dateline =
new Date(e).getFullYear() +
"-" +
month +
"-" +
new Date(e).getDate();
// 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)
form.value.dateline = timestr;
}
/**
* 上传文件