ptSend/view/dist/assets/downloadTest-edbc959e.js

2 lines
3.1 KiB
JavaScript
Raw Normal View History

2023-07-04 21:44:38 +08:00
import{a as x}from"./axios-4a70c6fc.js";import{_ as D,r as u,a as n,o as h,c as E,w as o,b as e,d as r,e as v,f as b,g as L,F as U,E as w,t as N,p as F,h as M}from"./index-0f1208b8.js";const R=d=>(F("data-v-509f07c5"),d=d(),M(),d),j=R(()=>r("div",{class:"card-header"},[r("span",null,"Video Download Test")],-1)),z={style:{display:"flex",width:"100%"}},Q={style:{display:"flex"}},A={style:{display:"flex"}},G={style:{width:"100%",height:"100%","overflow-y":"auto"}},H={__name:"downloadTest",setup(d){const i=u(!1),l=u({name:"https://v.qq.com/x/cover/mzc002007vp35qj.html",start:1,save:localStorage.getItem("save")}),c=u([]),p=u();function V(){x.get("/getQqList",{params:{url:l.value.name}}).then(t=>{c.value=t.data})}function k(){p.value.clearSelection();for(let t=l.value.start-1;t<c.value.length;t++)console.log(t),p.value.toggleRowSelection(c.value[t],void 0)}const m=u([]);async function S(){let t=p.value.getSelectionRows();if(t.length===0){w({showClose:!0,message:"请选择要下载的剧集",type:"error"});return}if(!l.value.save){w({showClose:!0,message:"请填写下载位置",type:"error"});return}i.value=!0,localStorage.setItem("save",l.value.save);for(let a of t)await x.get("/startDown",{params:{...a,save:l.value.save+"/"+a.title.split(" ")[0]}});w({showClose:!0,message:"添加完成",type:"success"})}const C=new EventSource("/msg");C.onmessage=t=>{m.value.length>200&&m.value.splice(200),m.value.unshift(t.data)};function I(){i.value=!0}return(t,a)=>{const f=n("el-input"),_=n("el-button"),g=n("el-form-item"),y=n("el-table-column"),T=n("el-table"),q=n("el-dialog"),B=n("el-card");return h(),E(B,{class:"box-card"},{header:o(()=>[j]),default:o(()=>[e(g,{label:"视频地址"},{default:o(()=>[r("div",z,[e(f,{style:{width:"100%"},modelValue:l.value.name,"onUpdate:modelValue":a[0]||(a[0]=s=>l.value.name=s)},null,8,["modelValue"]),e(_,{style:{"flex-shrink":"0",margin:"0 10px"},onClick:V,type:"primary"},{default:o(()=>[v("获取")]),_:1})])]),_:1}),e(g,{label:"第几集开始"},{default:o(()=>[r("div",Q,[e(f,{modelValue:l.value.start,"onUpdate:modelValue":a[1]||(a[1]=s=>l.value.start=s)},null,8,["modelValue"]),e(_,{style:{"flex-shrink":"0",margin:"0 10px"},onClick:k,type:"primary"},{default:o(()=>[v("设置")]),_:1})])]),_:1}),e(g,{label:"下载保存地址"},{default:o(()=>[r("div",A,[e(f,{modelValue:l.value.save,"onUpdate:modelValue":a[2]||(a[2]=s=>l.value.save=s)},null,8,["modelValue"]),e(_,{style:{"flex-shrink":"0",margin:"0 10px"},onClick:S,type:"primary"},{default:o(()=>[v("下载")]),_:1}),e(_,{style:{"flex-shrink":"0",margin:"0 10px"},onClick:I,type:"primary"},{default:o(()=>[v("查看进度")]),_:1})])]),_:1}),e(T,{ref_key:"table",ref:p,data:c.value,style:{width:"100%"}},{default:o(()=>[e(y,{type:"selection",width:"55"}),e(y,{label:"title",prop:"title"}),e(y,{label:"url",prop:"url"})]),_:1},8,["data"]),e(q,{fullscreen:!0,modelValue:i.value,"onUpdate:modelValue":a[3]||(a[3]=s=>i.value=s),title:"Tips",width:"30%"},{default:o(()=>[r("div",G,[(h(!0),b(U,null,L(m.value,s=>(h(),b("div",null,N(s),1))),256))])]),_:1},8,["modelValue"])]),_:1})}}},O=D(H,[["__scopeId","data-v-509f07c5"]]);export{O as default};