videoDL-2ed26991.js 3.8 KB

1
  1. /* empty css *//* empty css */import{d as e,q as a,z as l,o as t,l as s,w as o,c as r,F as n,p as i,I as u,aC as c,aD as d,X as p,cG as m,a7 as v,cr as b,_ as y,a as _,b as f,e as g,t as h,A as j,cL as k,a1 as w,cM as x}from"./index-1e3c1303.js";/* empty css *//* empty css *//* empty css *//* empty css */import{v as C}from"./index-78744708.js";import"./http-a0194994.js";/* empty css *//* empty css */const $=e({__name:"index",props:{meta:Object},emits:["change"],setup(e,{emit:p}){const m=e,v=a([]);a([]);const b=a({page:1,limit:5});m.meta&&m.meta;const y=e=>{b.value.page=Number(e)+1,p("change",b.value)};return l((()=>{(()=>{const e=m.meta.limit,a=m.meta.total,l=Math.ceil(a/e);for(let t=0;t<l;t++){const s=t*e+1;let o;o=t===l-1?s===a?`${a}`:`${s}-${a}`:`${s}-${t===l-1?a:(t+1)*e}`,v.value[t]={title:o,page:l},v.value}})()})),(e,a)=>{const l=c,p=d;return t(),s(p,{onTabChange:y},{default:o((()=>[(t(!0),r(n,null,i(v.value,((a,r)=>(t(),s(l,{label:a.title,key:r},{default:o((()=>[u(e.$slots,"content")])),_:2},1032,["label"])))),128))])),_:3})}}});const L=y(e({components:{ElButton:p},props:{urls:{type:Array,required:!0},fileName:{type:String,default:""}},setup:e=>({download:()=>{const a=m.service({text:"正在解析视频",background:"rgba(0,0,0,.2)"});if(!e.urls.length)return void v.error("没有可下载的文件");const l=document.createElement("a");l.style.display="none",l.href="#",document.body.appendChild(l),e.urls.forEach((t=>{b.get(t.download_video_url,{responseType:"blob"}).then((s=>{l.download=`《${e.fileName}》${t.series_name}.mp4`;const o=new Blob([s.data]),r=URL.createObjectURL(o);l.href=r,l.click(),URL.revokeObjectURL(r),a.close()})).catch((e=>{console.error(e),v.error("下载失败"),a.close()}))}))}})}),[["render",function(e,a,l,s,n,i){const u=p;return t(),r("div",null,[_(u,{type:"primary",onClick:e.download},{default:o((()=>[f("下载")])),_:1},8,["onClick"])])}]]),N={class:"wrapper"},R=["src"],U={class:"video-wrapper"},V={class:"flex items-center justify-between h-10"},q={class:"w-full text-base font-medium"},D={class:"ml-2 text-lg font-bold text-dark-600"},E={key:0},O=y(e({__name:"videoDL",props:{primary:String|Number},setup(e){const u=e,c=a(),d=a([]),p=a({page:1,limit:5}),m=a([]);u.primary;const v=a({}),b=a({}),y=a([]),O=e=>{C({video_id:u.primary.id,...e}).then((e=>{m.value=e.data,v.value={limit:e.limit,total:e.total}}))},z=e=>{p.value.page=Number(e.page),O(p.value)};return l((()=>{O(p.value)})),(e,a)=>{const l=k,p=L,C=w,O=x,A=$;return t(),r(n,null,[_(l,{title:"注:如需批量下载,则多选目标集数,点击下载按钮即可",type:"warning","show-icon":"",closable:!1}),g("div",N,[(t(),r("video",{id:"my-player",style:{width:"500px"},key:b.value.public_video_url,class:"video-js",controls:"",autoplay:"",ref_key:"myVideo",ref:c},[g("source",{src:b.value.public_video_url,type:"video/mp4"},null,8,R)])),g("div",U,[g("div",V,[g("div",q,[f("剧名: "),g("span",D,h(u.primary.name),1),f(),b.value.series_name?(t(),r("span",E,"(当前播放"+h(b.value.series_name)+")",1)):j("",!0)]),d.value.length>0?(t(),s(p,{key:0,urls:y.value,fileName:u.primary.name},null,8,["urls","fileName"])):j("",!0)]),v.value.total?(t(),s(A,{key:0,meta:v.value,onChange:z},{content:o((()=>[_(O,{modelValue:d.value,"onUpdate:modelValue":a[0]||(a[0]=e=>d.value=e),size:"large",class:"flex items-center"},{default:o((()=>[(t(!0),r(n,null,i(m.value,((e,a)=>(t(),s(C,{border:"",class:"video-item",onChange:a=>(e=>{b.value=d.value.find((a=>a.public_video_url==e.public_video_url))??{},y.value=d.value,y.value})(e),key:a,label:e},{default:o((()=>[f(h(e.series_sequence),1)])),_:2},1032,["onChange","label"])))),128))])),_:1},8,["modelValue"])])),_:1},8,["meta"])):j("",!0)])])],64)}}}),[["__scopeId","data-v-d9e750d6"]]);export{O as default};