ptSend/view/dist/assets/downloadTest-8a84ddca.js
2023-07-04 21:38:26 +08:00

2 lines
3.3 KiB
JavaScript

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