| 1 |
- import{_ as t,d as e,r as s,n as a,s as o,g as i,w as c,S as r,o as d,a as n,c as l,l as h,F as u,i as f,x as m,j as p,t as g,m as L}from"./index-DL_qY9Wr.js";const w=t({data:()=>({IP:"",recordList:[],translateX:0,startX:0,delWidth:160}),onLoad(){this.IP=localStorage.getItem("ip")},onShow(){this.getRecordList()},methods:{handleSingleDownload(t){const s="http://"+this.IP+":9002/static/rec/"+t+"/data.csv",a=s.replace(/[\n\t\r]/g,"").trim(),o=s.replace(/[\\\/:*?"<>|\n\r\t]/g,"_"),i=document.createElement("a");i.href=a,i.download=o,document.body.appendChild(i),i.click(),document.body.removeChild(i),e({title:`开始下载${s}`,icon:"none"})},touchStart(t,e){this.recordList.forEach(((t,s)=>{s!==e&&(t.offset=0,t.right=-160)})),this.startX=t.touches[0].pageX,this.currentIndex=e},touchMove(t,e){if(this.currentIndex!==e)return;let s=t.touches[0].pageX-this.startX,a=-this.delWidth;s<0?(this.recordList[e].offset=Math.max(a,s),this.recordList[e].right=Math.max(a,s)):(this.recordList[e].offset=0,this.recordList[e].right=-160)},touchEnd(t,e){this.recordList[e].offset<-this.delWidth/2?(this.recordList[e].offset=-this.delWidth,this.recordList[e].right=0):(this.recordList[e].offset=0,this.recordList[e].right=-160),this.currentIndex=-1},async getRecordList(){const t=await new Promise(((t,e)=>{s({url:"http://"+this.IP+":9002",method:"POST",header:{"Content-Type":"application/json"},data:JSON.stringify({code:"",cmd:1025,msg:"",data:{op:1}}),success:t,fail:e})}));t.data.data&&(this.recordList=t.data.data.map((t=>({name:t,offset:0,right:-160}))))},goDetail(t){a({url:`/pages/navigation/view?item=${t}`})},deleteHandle(t,a){o({title:"提示",content:"删除后文件不可恢复,确认删除吗?",confirmText:"确认",cancelText:"取消",success:async o=>{o.confirm&&s({url:"http://"+this.IP+":9002",method:"POST",header:{"Content-Type":"application/json"},data:JSON.stringify({code:"",cmd:1025,msg:"",data:{op:3,number:a}}),success:s=>{s.data.data&&(this.recordList.splice(t,1),e({title:"删除成功"}))},fail:t=>console.error(t)})}})}}},[["render",function(t,e,s,a,o,w){const y=L,_=f,x=r;return d(),i(x,{class:"list-scroll","scroll-y":"",style:{height:"100vh"}},{default:c((()=>[n(_,{class:"list-wrap"},{default:c((()=>[(d(!0),l(u,null,h(o.recordList,((t,e)=>(d(),i(_,{class:"swipe-item",key:e},{default:c((()=>[n(_,{class:"swipe-main",style:m({transform:`translateX(${t.offset}px)`}),onTouchstart:t=>w.touchStart(t,e),onTouchmove:t=>w.touchMove(t,e),onTouchend:t=>w.touchEnd(t,e)},{default:c((()=>[n(_,{class:"list-item"},{default:c((()=>[n(_,{class:"download-btn",onClick:e=>w.handleSingleDownload(t.name)},{default:c((()=>[n(y,{class:"down-icon"},{default:c((()=>[p("⬇")])),_:1})])),_:2},1032,["onClick"]),n(_,{class:"item-info",onClick:e=>w.goDetail(t.name)},{default:c((()=>[n(y,{class:"item-name"},{default:c((()=>[p(g(t.name),1)])),_:2},1024)])),_:2},1032,["onClick"]),n(_,{class:"arrow"},{default:c((()=>[p("›")])),_:1})])),_:2},1024)])),_:2},1032,["style","onTouchstart","onTouchmove","onTouchend"]),n(_,{class:"swipe-del",style:m({right:`${t.right}px`}),onClick:s=>w.deleteHandle(e,t.name)},{default:c((()=>[p("删除")])),_:2},1032,["style","onClick"])])),_:2},1024)))),128))])),_:1})])),_:1})}],["__scopeId","data-v-c1a9e864"]]);export{w as default};
|