Merge branch 'master' of http://git.luyuan.tk/luyuan/beelink into xbx
This commit is contained in:
@@ -103,13 +103,14 @@
|
||||
</div>
|
||||
</template>
|
||||
<script lang="ts">
|
||||
import { defineComponent, reactive, Ref, ref, toRaw } from "vue";
|
||||
import { defineComponent, onMounted, reactive, Ref, ref, toRaw } from "vue";
|
||||
import { PlaySquareOutlined, PlusOutlined } from "@ant-design/icons-vue";
|
||||
import NavBottom from "@/components/NavBottom.vue";
|
||||
import { previewCover } from "@/utils/common";
|
||||
import { FromSend, ImgInfo, VideoInfo } from "@/types";
|
||||
import { uploadflie } from "@/utils/vod";
|
||||
import { videoadd } from "@/api";
|
||||
import { videoadd, videodetail } from "@/api";
|
||||
import { useRoute } from 'vue-router';
|
||||
|
||||
export default defineComponent({
|
||||
name: "ReleaseWebcast",
|
||||
@@ -125,7 +126,7 @@ export default defineComponent({
|
||||
const fileList: Array<FileItem> = [];
|
||||
|
||||
// 表单数据
|
||||
const form = reactive({
|
||||
const form = ref<any>({
|
||||
title: "",
|
||||
img: "",
|
||||
fileid: "",
|
||||
@@ -134,6 +135,14 @@ export default defineComponent({
|
||||
desc: "",
|
||||
video:[""],
|
||||
});
|
||||
onMounted(async () => {
|
||||
if(useRoute().query.id){
|
||||
console.log(useRoute().query.id)
|
||||
form.value = await videodetail(useRoute().query.id,1)
|
||||
console.log(form.value,"fornm")
|
||||
}
|
||||
})
|
||||
|
||||
// 是否显示封面预览 封面的路径
|
||||
const viewCover: Ref<boolean> = ref(false),
|
||||
previewImage: Ref<string> = ref("");
|
||||
@@ -169,9 +178,9 @@ export default defineComponent({
|
||||
* @param index 删除文件的索引
|
||||
*/
|
||||
function removeFile(index: number): void {
|
||||
const newFileList = form.video.slice();
|
||||
const newFileList = form.value.video.slice();
|
||||
newFileList.splice(index, 1);
|
||||
form.video = newFileList;
|
||||
form.value.video = newFileList;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -191,7 +200,7 @@ export default defineComponent({
|
||||
uploadpicprogress.value = info.percent.toFixed(2) * 100;
|
||||
});
|
||||
console.log(res);
|
||||
form.img = res.video.url;
|
||||
form.value.img = res.video.url;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -200,12 +209,12 @@ export default defineComponent({
|
||||
const uploadprogress: Ref<number> = ref(0);
|
||||
async function uploads(file: AntUpload) {
|
||||
uploadprogress.value=0
|
||||
form.video=[""]
|
||||
form.value.video=[""]
|
||||
console.log(file);
|
||||
videofile.value = file.file;
|
||||
videos.value[0].addEventListener("durationchange", () => {
|
||||
console.log(videos.value[0].duration);
|
||||
form.fileduration = videos.value[0].duration;
|
||||
form.value.fileduration = videos.value[0].duration;
|
||||
});
|
||||
let res = await uploadflie(file.file, (info: any) => {
|
||||
console.log(info);
|
||||
@@ -213,9 +222,9 @@ export default defineComponent({
|
||||
});
|
||||
console.log(res);
|
||||
|
||||
form.fileid = res.fileId;
|
||||
form.fileurl = res.video.url;
|
||||
form.video[0]=res.video.url
|
||||
form.value.fileid = res.fileId;
|
||||
form.value.fileurl = res.video.url;
|
||||
form.value.video[0]=res.video.url
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -223,8 +232,8 @@ export default defineComponent({
|
||||
*/
|
||||
const onSubmit = async (e: FromSend) => {
|
||||
e.preventDefault();
|
||||
console.log(toRaw(form), 111);
|
||||
videoadd(toRaw(form));
|
||||
console.log(toRaw(form.value), 111);
|
||||
// videoadd(toRaw(form));
|
||||
};
|
||||
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user