2 lines
9.5 KiB
JavaScript
2 lines
9.5 KiB
JavaScript
import{q as e,b as t,o as a,c as n,w as i,d as s,e as r,t as l,j as o,f as c,k as u,F as g,l as p,p as d,s as h,u as x,i as f,n as m,r as _,a as y,g as k,h as v,m as I,I as S}from"./index-CICgbd-2.js";import{_ as P,r as C,b as z,H as b,F as w,a as T}from"./footer.GjOAft6T.js";const N={en:{"uni-pagination.prevText":"prev","uni-pagination.nextText":"next","uni-pagination.piecePerPage":"piece/page"},es:{"uni-pagination.prevText":"anterior","uni-pagination.nextText":"prxima","uni-pagination.piecePerPage":"Art��culo/P��gina"},fr:{"uni-pagination.prevText":"précédente","uni-pagination.nextText":"suivante","uni-pagination.piecePerPage":"Articles/Pages"},"zh-Hans":{"uni-pagination.prevText":"上一页","uni-pagination.nextText":"下一页","uni-pagination.piecePerPage":"条/页"},"zh-Hant":{"uni-pagination.prevText":"上一頁","uni-pagination.nextText":"下一頁","uni-pagination.piecePerPage":"條/頁"}},{t:V}=e(N);const B=P({name:"UniPagination",emits:["update:modelValue","input","change","pageSizeChange"],props:{value:{type:[Number,String],default:1},modelValue:{type:[Number,String],default:1},prevText:{type:String},nextText:{type:String},piecePerPageText:{type:String},current:{type:[Number,String],default:1},total:{type:[Number,String],default:0},pageSize:{type:[Number,String],default:10},showIcon:{type:[Boolean,String],default:!1},showPageSize:{type:[Boolean,String],default:!1},pagerCount:{type:Number,default:7},pageSizeRange:{type:Array,default:()=>[20,50,100,500]}},data:()=>({pageSizeIndex:0,currentIndex:1,paperData:[],pickerShow:!1}),computed:{piecePerPage(){return this.piecePerPageText||V("uni-pagination.piecePerPage")},prevPageText(){return this.prevText||V("uni-pagination.prevText")},nextPageText(){return this.nextText||V("uni-pagination.nextText")},maxPage(){let e=1,t=Number(this.total),a=Number(this.pageSize);return t&&a&&(e=Math.ceil(t/a)),e},paper(){const e=this.currentIndex,t=this.pagerCount,a=this.total,n=this.pageSize;let i=[],s=[],r=Math.ceil(a/n);for(let o=0;o<r;o++)i.push(o+1);s.push(1);const l=i[i.length-(t+1)/2];return i.forEach(((a,n)=>{(t+1)/2>=e?a<t+1&&a>1&&s.push(a):e+2<=l?a>e-(t+1)/2&&a<e+(t+1)/2&&s.push(a):(a>e-(t+1)/2||r-t<a)&&a<i[i.length-1]&&s.push(a)})),r>t?((t+1)/2>=e?s[s.length-1]="...":e+2<=l?(s[1]="...",s[s.length-1]="..."):s[1]="...",s.push(i[i.length-1])):(t+1)/2>=e||e+2<=l||(s.shift(),s.push(i[i.length-1])),s}},watch:{current:{immediate:!0,handler(e,t){this.currentIndex=e<1?1:e}},value:{immediate:!0,handler(e){1===Number(this.current)&&(this.currentIndex=e<1?1:e)}},pageSizeIndex(e){this.$emit("pageSizeChange",this.pageSizeRange[e])}},methods:{pickerChange(e){this.pageSizeIndex=e.detail.value,this.pickerClick()},pickerClick(){const e=document.querySelector("body");if(!e)return;const t="uni-pagination-picker-show";this.pickerShow=!this.pickerShow,this.pickerShow?e.classList.add(t):setTimeout((()=>e.classList.remove(t)),300)},selectPage(e,t){if(parseInt(e))this.currentIndex=e,this.change("current");else{let e=Math.ceil(this.total/this.pageSize);if(t<=1)return void(this.currentIndex-5>1?this.currentIndex-=5:this.currentIndex=1);if(t>=6)return void(this.currentIndex+5>e?this.currentIndex=e:this.currentIndex+=5)}},clickLeft(){1!==Number(this.currentIndex)&&(this.currentIndex-=1,this.change("prev"))},clickRight(){Number(this.currentIndex)>=this.maxPage||(this.currentIndex+=1,this.change("next"))},change(e){this.$emit("input",this.currentIndex),this.$emit("update:modelValue",this.currentIndex),this.$emit("change",{type:e,current:this.currentIndex})}}},[["render",function(e,m,_,y,k,v){const I=d,S=C(t("uni-icons"),z),P=h,b=x,w=f;return a(),n(w,{class:"uni-pagination"},{default:i((()=>[!0===_.showPageSize||"true"===_.showPageSize?(a(),n(b,{key:0,class:"select-picker",mode:"selector",value:k.pageSizeIndex,range:_.pageSizeRange,onChange:v.pickerChange,onCancel:v.pickerClick,onClick:v.pickerClick},{default:i((()=>[s(P,{type:"default",size:"mini",plain:!0},{default:i((()=>[s(I,null,{default:i((()=>[r(l(_.pageSizeRange[k.pageSizeIndex])+" "+l(v.piecePerPage),1)])),_:1}),s(S,{class:"select-picker-icon",type:"arrowdown",size:"12",color:"#999"})])),_:1})])),_:1},8,["value","range","onChange","onCancel","onClick"])):o("",!0),s(w,{class:"uni-pagination__total is-phone-hide"},{default:i((()=>[r("共 "+l(_.total)+" 条",1)])),_:1}),s(w,{class:c(["uni-pagination__btn",1===k.currentIndex?"uni-pagination--disabled":"uni-pagination--enabled"]),"hover-class":1===k.currentIndex?"":"uni-pagination--hover","hover-start-time":20,"hover-stay-time":70,onClick:v.clickLeft},{default:i((()=>[!0===_.showIcon||"true"===_.showIcon?(a(),n(S,{key:0,color:"#666",size:"16",type:"left"})):(a(),n(I,{key:1,class:"uni-pagination__child-btn"},{default:i((()=>[r(l(v.prevPageText),1)])),_:1}))])),_:1},8,["class","hover-class","onClick"]),s(w,{class:"uni-pagination__num uni-pagination__num-flex-none"},{default:i((()=>[s(w,{class:"uni-pagination__num-current"},{default:i((()=>[s(I,{class:"uni-pagination__num-current-text is-pc-hide current-index-text"},{default:i((()=>[r(l(k.currentIndex),1)])),_:1}),s(I,{class:"uni-pagination__num-current-text is-pc-hide"},{default:i((()=>[r("/"+l(v.maxPage||0),1)])),_:1}),(a(!0),u(g,null,p(v.paper,((e,t)=>(a(),n(w,{key:t,class:c([{"page--active":e===k.currentIndex},"uni-pagination__num-tag tag--active is-phone-hide"]),onClick:a=>v.selectPage(e,t)},{default:i((()=>[s(I,null,{default:i((()=>[r(l(e),1)])),_:2},1024)])),_:2},1032,["class","onClick"])))),128))])),_:1})])),_:1}),s(w,{class:c(["uni-pagination__btn",k.currentIndex>=v.maxPage?"uni-pagination--disabled":"uni-pagination--enabled"]),"hover-class":k.currentIndex===v.maxPage?"":"uni-pagination--hover","hover-start-time":20,"hover-stay-time":70,onClick:v.clickRight},{default:i((()=>[!0===_.showIcon||"true"===_.showIcon?(a(),n(S,{key:0,color:"#666",size:"16",type:"right"})):(a(),n(I,{key:1,class:"uni-pagination__child-btn"},{default:i((()=>[r(l(v.nextPageText),1)])),_:1}))])),_:1},8,["class","hover-class","onClick"])])),_:1})}],["__scopeId","data-v-bd0b20fd"]]);const L=P({components:{Header:b,Footer:w},data:()=>({keyword:"",title:"",list:[],page:1,page_size:20,total:0,loading:!1,category_id:"",category:[{value:"",text:"全部"}]}),onLoad(e){this.keyword=decodeURIComponent(e.keyword),this.title=JSON.parse(JSON.stringify(this.keyword)),this.category_id=parseInt(e.category_id)||"",this.getClass(),this.getList()},computed:{config(){return this.$store.state.config}},methods:{searchBtn(){this.page=1,this.getList()},gpDetail(e){m({url:"/pages/index/detail?id="+e})},getList(){this.loading=!0,_({url:baseURL+"api/search",data:{page_no:this.page,page_size:this.page_size,title:this.keyword,category_id:this.category_id},success:e=>{this.total=e.data.data.total_result||0,this.list=e.data.data.items||[],this.title=JSON.parse(JSON.stringify(this.keyword))},complete:()=>{this.loading=!1}})},change(e){window.scrollTo({top:0,left:0,behavior:"smooth"}),this.page=e.current,this.getList()},getClass(){let e=[{value:"",text:"全部"}];_({url:baseURL+"api/search/getCategory",success:t=>{let a=t.data.data||[];for(let n of a)e.push({value:n.source_category_id,text:n.name});this.category=e}})}}},[["render",function(e,h,x,m,_,P){const z=y("Header"),b=I,w=d,N=f,V=C(t("uni-data-select"),T),L=S,R=C(t("uni-pagination"),B),U=y("Footer");return a(),n(N,{class:"view"},{default:i((()=>[s(z),s(N,{class:"homeBox"},{default:i((()=>[s(N,{class:"logoBox"},{default:i((()=>[s(b,{class:"logo",src:P.config?P.config.logo:""},null,8,["src"]),s(w,{class:"title"},{default:i((()=>[r(l(P.config?P.config.app_name:""),1)])),_:1})])),_:1}),s(N,{class:"subTitle"},{default:i((()=>[r(l(P.config?P.config.app_description:""),1)])),_:1}),s(N,{class:c(["search",_.category.length>2?"":"noSelect"])},{default:i((()=>[s(V,{class:"selectBox",modelValue:_.category_id,"onUpdate:modelValue":h[0]||(h[0]=e=>_.category_id=e),localdata:_.category,clear:!1,onChange:P.searchBtn},null,8,["modelValue","localdata","onChange"]),k("i",{class:"iconfont icon-sousuo",onClick:h[1]||(h[1]=(...e)=>P.searchBtn&&P.searchBtn(...e))}),s(L,{type:"text",modelValue:_.keyword,"onUpdate:modelValue":h[2]||(h[2]=e=>_.keyword=e),placeholder:"输入关键字进行搜索",onKeyup:v(P.searchBtn,["enter"]),"confirm-type":"search",onConfirm:P.searchBtn},null,8,["modelValue","onKeyup","onConfirm"])])),_:1},8,["class"]),s(N,{class:"content"},{default:i((()=>[s(N,{class:"p"},{default:i((()=>[r("为您提供"),k("span",null,l(_.title),1),r("搜索结果"),k("span",null,l(_.total),1),r("条")])),_:1}),s(N,{class:"list"},{default:i((()=>[_.loading?(a(),n(N,{key:0,class:"loading"},{default:i((()=>[r("正在努力加载中...")])),_:1})):o("",!0),(a(!0),u(g,null,p(_.list,((e,t)=>(a(),n(N,{class:"item",key:t,onClick:t=>P.gpDetail(e.id)},{default:i((()=>[s(N,{class:"name"},{default:i((()=>[r(l(e.title),1)])),_:2},1024),s(N,{class:"numbox"},{default:i((()=>[s(N,{class:"ke"},{default:i((()=>[r("夸克网盘")])),_:1}),s(N,{class:"num"},{default:i((()=>[r(l(e.times),1)])),_:2},1024),e.category&&e.category.name?(a(),n(N,{key:0,class:"cate"},{default:i((()=>[r(l(e.category.name),1)])),_:2},1024)):o("",!0)])),_:2},1024)])),_:2},1032,["onClick"])))),128)),_.loading||0!=_.list.length?o("",!0):(a(),n(N,{key:1,class:"nodata"},{default:i((()=>[s(N,null,{default:i((()=>[r("未找到或不是短剧?请加入微信群获得更多资源")])),_:1}),s(b,{src:P.config.qcode,mode:"aspectFit"},null,8,["src"])])),_:1}))])),_:1}),s(R,{onChange:P.change,modelValue:_.page,"onUpdate:modelValue":h[3]||(h[3]=e=>_.page=e),total:_.total,pageSize:_.page_size},null,8,["onChange","modelValue","total","pageSize"])])),_:1})])),_:1}),s(U)])),_:1})}],["__scopeId","data-v-c464fa9a"]]);export{L as default};
|