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

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