未上传完成文件不让提交

This commit is contained in:
luyuan 2020-11-16 11:20:17 +08:00
parent 1bf49e37b4
commit edcee2f592
Signed by: theluyuan
GPG Key ID: A7972FD973317FF3
5 changed files with 23 additions and 1 deletions

View File

@ -301,6 +301,7 @@ export default {
shijishichang: "Actual live broadcast duration", shijishichang: "Actual live broadcast duration",
cshipinyaoqiu1: "The video should be no longer than 10 minutes", cshipinyaoqiu1: "The video should be no longer than 10 minutes",
cshipinyaoqiu2: "Video size cannot exceed 500M", cshipinyaoqiu2: "Video size cannot exceed 500M",
shangchuanwancheng: "Please wait for the file to be uploaded",
shichangtishi:"", shichangtishi:"",
renshutishi: '', renshutishi: '',
tixianzhu: "", tixianzhu: "",

View File

@ -301,6 +301,7 @@ export default {
shijishichang: "实际直播时长", shijishichang: "实际直播时长",
cshipinyaoqiu1: "视频长度不能超过10分钟", cshipinyaoqiu1: "视频长度不能超过10分钟",
cshipinyaoqiu2: "视频大小不能超过500m", cshipinyaoqiu2: "视频大小不能超过500m",
shangchuanwancheng: "请等待文件上传完成",
shichangtishi:"", shichangtishi:"",
renshutishi: '', renshutishi: '',
tixianzhu:"", tixianzhu:"",

View File

@ -542,6 +542,7 @@ export default defineComponent({
NavBottom, NavBottom,
}, },
setup() { setup() {
let issum = true;
const lan: any = useI18n(); const lan: any = useI18n();
interface SpeakItem { interface SpeakItem {
lang: string; lang: string;
@ -812,6 +813,10 @@ export default defineComponent({
// for(let i in toRaw(formData.value).willsay){ // for(let i in toRaw(formData.value).willsay){
// console.log(toRaw(formData.value).willsay[i]) // console.log(toRaw(formData.value).willsay[i])
// } // }
if(!issum){
message.error(lan.$t("shangchuanwancheng"))
return;
}
const uesrinfo = toRaw(formData.value); const uesrinfo = toRaw(formData.value);
// for (let m = 0; m < toRaw(chiveslist.value).length; m++) { // for (let m = 0; m < toRaw(chiveslist.value).length; m++) {
// for (const i in uesrinfo.willsayValue) { // for (const i in uesrinfo.willsayValue) {
@ -926,13 +931,14 @@ export default defineComponent({
async function uploads(file: AntUpload) { async function uploads(file: AntUpload) {
uploadprogress.value = 0; uploadprogress.value = 0;
issum = false;
const res = await uploadflie(file.file, (info: any) => { const res = await uploadflie(file.file, (info: any) => {
console.log(info); console.log(info);
uploadprogress.value = info.percent.toFixed(2) * 100; uploadprogress.value = info.percent.toFixed(2) * 100;
}); });
userinfo.value.video = res.video.url; userinfo.value.video = res.video.url;
userinfo.value.videoid = res.fileId; userinfo.value.videoid = res.fileId;
issum = true;
} }
if (formData.value.video != "") { if (formData.value.video != "") {

View File

@ -147,6 +147,7 @@ export default defineComponent({
NavBottom, NavBottom,
}, },
setup() { setup() {
let issum= true;
const lan: any = useI18n(); const lan: any = useI18n();
interface FileItem { interface FileItem {
video: Array<string>; video: Array<string>;
@ -254,6 +255,7 @@ export default defineComponent({
const uploadprogress: Ref<number> = ref(0); const uploadprogress: Ref<number> = ref(0);
const ifallowvideo = ref<boolean>(false); const ifallowvideo = ref<boolean>(false);
async function uploads(file: AntUpload) { async function uploads(file: AntUpload) {
issum = false;
console.log(file); console.log(file);
videofile.value = file.file; videofile.value = file.file;
videos.value[0].addEventListener("durationchange", () => { videos.value[0].addEventListener("durationchange", () => {
@ -268,6 +270,7 @@ export default defineComponent({
form.value.fileid = res.fileId; form.value.fileid = res.fileId;
form.value.fileurl = res.video.url; form.value.fileurl = res.video.url;
issum = true;
} }
function beforeVideoUpload(info?: any) { function beforeVideoUpload(info?: any) {
@ -285,6 +288,10 @@ export default defineComponent({
*/ */
const routes = useRoute(); const routes = useRoute();
const onSubmit = async (e: FromSend) => { const onSubmit = async (e: FromSend) => {
if(!issum){
message.error(lan.$t("shangchuanwancheng"))
return;
}
e.preventDefault(); e.preventDefault();
console.log(toRaw(form.value), 111); console.log(toRaw(form.value), 111);
console.log(toRaw(form.value).video[0].length); console.log(toRaw(form.value).video[0].length);

View File

@ -252,6 +252,7 @@ export default defineComponent({
RankList, RankList,
}, },
setup() { setup() {
let issum = true;
const lan: any = useI18n(); const lan: any = useI18n();
// //
const form = ref({ const form = ref({
@ -361,6 +362,10 @@ export default defineComponent({
}); });
} }
const onSubmit = (e: FromSend) => { const onSubmit = (e: FromSend) => {
if(!issum){
message.error(lan.$t("shangchuanwancheng"))
return;
}
e.preventDefault(); e.preventDefault();
validate() validate()
.then(() => { .then(() => {
@ -475,6 +480,7 @@ export default defineComponent({
} }
} }
async function uploads(file: AntUpload) { async function uploads(file: AntUpload) {
issum = false;
console.log(file); console.log(file);
videofile.value = file.file; videofile.value = file.file;
videos.value[0].addEventListener("durationchange", () => { videos.value[0].addEventListener("durationchange", () => {
@ -489,6 +495,7 @@ export default defineComponent({
form.value.fileid = res.fileId; form.value.fileid = res.fileId;
form.value.fileurl = res.video.url; form.value.fileurl = res.video.url;
issum = true;
} }
const ifallowpic = ref<boolean>(false); const ifallowpic = ref<boolean>(false);
async function uploadspic(file: AntUpload) { async function uploadspic(file: AntUpload) {