mirror of
https://gitee.com/niucloud-team/niucloud-admin.git
synced 2026-01-06 13:08:10 +00:00
2 lines
7.8 KiB
JavaScript
2 lines
7.8 KiB
JavaScript
import{q as e,t as a,x as t,y as l,k as o,l as r,e as s,f as c,w as i,h as n,n as u,z as d,A as h,B as p,C as m,D as f,E as y,F as g,m as b,I as _,d as x,r as k,o as S,G as w,H as C,j as v,J as I,K as j,L as $,M as A,N as z,O as B,S as T,p as M,P as U}from"./index-e3cbb98d.js";import{_ as V}from"./u-icon.88a425c1.js";import{_ as F}from"./_plugin-vue_export-helper.1b428a4d.js";import{_ as N,a as D}from"./tabbar.9ee65337.js";import{g as H,a as O}from"./article.492d4506.js";import{u as E,M as P}from"./useMescroll.1ed23d21.js";import{M as R}from"./mescroll-empty.6d573ece.js";import{u as q}from"./useShare.96381b1e.js";import"./u-image.e6a1b64e.js";import"./u-transition.c6fa3287.js";import"./u-safe-bottom.a57492fd.js";import"./wechat.864bf64a.js";const G=F({name:"u-search",mixins:[a,t,{props:{shape:{type:String,default:e.search.shape},bgColor:{type:String,default:e.search.bgColor},placeholder:{type:String,default:e.search.placeholder},clearabled:{type:Boolean,default:e.search.clearabled},focus:{type:Boolean,default:e.search.focus},showAction:{type:Boolean,default:e.search.showAction},actionStyle:{type:Object,default:e.search.actionStyle},actionText:{type:String,default:e.search.actionText},inputAlign:{type:String,default:e.search.inputAlign},inputStyle:{type:Object,default:e.search.inputStyle},disabled:{type:Boolean,default:e.search.disabled},borderColor:{type:String,default:e.search.borderColor},searchIconColor:{type:String,default:e.search.searchIconColor},color:{type:String,default:e.search.color},placeholderColor:{type:String,default:e.search.placeholderColor},searchIcon:{type:String,default:e.search.searchIcon},searchIconSize:{type:[Number,String],default:e.search.searchIconSize},margin:{type:String,default:e.search.margin},animation:{type:Boolean,default:e.search.animation},modelValue:{type:String,default:e.search.value},value:{type:String,default:e.search.value},maxlength:{type:[String,Number],default:e.search.maxlength},height:{type:[String,Number],default:e.search.height},label:{type:[String,Number,null],default:e.search.label}}}],data(){return{keyword:"",showClear:!1,show:!1,focused:this.focus}},watch:{keyword(e){this.$emit("update:modelValue",e),this.$emit("change",e)},modelValue:{immediate:!0,handler(e){this.keyword=e}}},computed:{showActionBtn(){return!this.animation&&this.showAction}},emits:["clear","search","custom","focus","blur","click","clickIcon","update:modelValue","change"],methods:{inputChange(e){this.keyword=e.detail.value},clear(){this.keyword="",this.$nextTick((()=>{this.$emit("clear")}))},search(e){this.$emit("search",e.detail.value);try{l()}catch(a){}},custom(){this.$emit("custom",this.keyword);try{l()}catch(e){}},getFocus(){this.focused=!0,this.animation&&this.showAction&&(this.show=!0),this.$emit("focus",this.keyword)},blur(){setTimeout((()=>{this.focused=!1}),100),this.show=!1,this.$emit("blur",this.keyword)},clickHandler(){this.disabled&&this.$emit("click")},clickIcon(){this.$emit("clickIcon")}}},[["render",function(e,a,t,l,x,k){const S=g,w=o(r("u-icon"),V),C=b,v=_;return s(),c(C,{class:"u-search",onClick:k.clickHandler,style:u([{margin:e.margin},e.$u.addStyle(e.customStyle)])},{default:i((()=>[n(C,{class:"u-search__content",style:u({backgroundColor:e.bgColor,borderRadius:"round"==e.shape?"100px":"4px",borderColor:e.borderColor})},{default:i((()=>[e.$slots.label||null!==e.label?d(e.$slots,"label",{key:0},(()=>[n(S,{class:"u-search__content__label"},{default:i((()=>[h(p(e.label),1)])),_:1})]),!0):m("",!0),n(C,{class:"u-search__content__icon"},{default:i((()=>[n(w,{onClick:k.clickIcon,size:e.searchIconSize,name:e.searchIcon,color:e.searchIconColor?e.searchIconColor:e.color},null,8,["onClick","size","name","color"])])),_:1}),n(v,{"confirm-type":"search",onBlur:k.blur,value:x.keyword,onConfirm:k.search,onInput:k.inputChange,disabled:e.disabled,onFocus:k.getFocus,focus:e.focus,maxlength:e.maxlength,"placeholder-class":"u-search__content__input--placeholder",placeholder:e.placeholder,"placeholder-style":`color: ${e.placeholderColor}`,class:"u-search__content__input",type:"text",style:u([{textAlign:e.inputAlign,color:e.color,backgroundColor:e.bgColor,height:e.$u.addUnit(e.height)},e.inputStyle])},null,8,["onBlur","value","onConfirm","onInput","disabled","onFocus","focus","maxlength","placeholder","placeholder-style","style"]),x.keyword&&e.clearabled&&x.focused?(s(),c(C,{key:1,class:"u-search__content__icon u-search__content__close",onClick:k.clear},{default:i((()=>[n(w,{name:"close",size:"11",color:"#ffffff",customStyle:"line-height: 12px"})])),_:1},8,["onClick"])):m("",!0)])),_:3},8,["style"]),n(S,{style:u([e.actionStyle]),class:f(["u-search__action",[(k.showActionBtn||x.show)&&"u-search__action--active"]]),onClick:y(k.custom,["stop","prevent"])},{default:i((()=>[h(p(e.actionText),1)])),_:1},8,["style","class","onClick"])])),_:3},8,["onClick","style"])}],["__scopeId","data-v-7ec77839"]]),J=F(x({__name:"list",setup(e){const{mescrollInit:a,downCallback:t,getMescroll:l}=E(B,z),{setShare:u,onShareAppMessage:d,onShareTimeline:y}=q();u(),d(),y();let _=k([]),x=k([]),F=k(""),J=k(""),K=k(null),L=k(!1);S((async()=>{await H().then((e=>{const a={name:w("all"),category_id:""};_.value.push(a),_.value=_.value.concat(e.data.data)}))}));const W=e=>{L.value=!1;let a={category_id:F.value,title:J.value,page:e.num,limit:e.size};O(a).then((a=>{let t=a.data.data;1==e.num&&(x.value=[]),x.value=x.value.concat(t),e.endSuccess(t.length),L.value=!0})).catch((()=>{L.value=!0,e.endErr()}))},X=()=>{l().resetUpScroll()};return C((()=>{setTimeout((()=>{l().optUp.textNoMore=w("end")}),500)})),(e,u)=>{const d=o(r("u-search"),G),y=b,k=T,S=o(r("u-icon"),V),C=o(r("u--image"),N),z=g,B=o(r("tabbar"),D);return s(),c(y,{class:"bg-gray-100 min-h-[100vh]"},{default:i((()=>[n(y,{class:"fixed top-0 inset-x-0 z-10"},{default:i((()=>[n(y,{class:"p-[10px] bg-white border-solid border-t-0 border-l-0 border-r-0 border-b-[1px] border-gray-200"},{default:i((()=>[n(d,{placeholder:v(w)("searchPlaceholder"),actionText:"",actionStyle:{width:0,margin:0},modelValue:v(J),"onUpdate:modelValue":u[0]||(u[0]=e=>I(J)?J.value=e:J=e),onClickIcon:X},null,8,["placeholder","modelValue"])])),_:1}),n(k,{"scroll-x":!0,"enable-flex":!0,class:"nav-list bg-white align-center px-[10px] box-border"},{default:i((()=>[n(y,{class:"flex scroll-view-wrap"},{default:i((()=>[(s(!0),j(A,null,$(v(_),((e,a)=>(s(),c(y,{class:f(["nav-item text-[14px] mx-[5px] h-[30px] leading-[30px] my-[5px] border-t-0 border-l-0 border-r-0",{"border-solid border-b-[2px] active":v(F)==e.category_id}]),onClick:a=>{return t=e.category_id,F.value=t,void l().resetUpScroll();var t},key:e.category_id},{default:i((()=>[h(p(e.name),1)])),_:2},1032,["class","onClick"])))),128))])),_:1})])),_:1})])),_:1}),n(P,{ref_key:"mescrollRef",ref:K,onInit:v(a),top:"220rpx",onDown:v(t),onUp:W},{default:i((()=>[(s(!0),j(A,null,$(v(x),((e,a)=>(s(),c(y,{key:e.id,class:f(["bg-white flex align-center p-[10px]",{"border-solid border-t-0 border-l-0 border-r-0 border-b-[1px] border-gray-200":v(x).length-1!==a}]),onClick:a=>{return t=e.id,void U({url:"/pages/article/detail",param:{id:t}});var t}},{default:i((()=>[e.image?(s(),c(C,{key:0,width:"260rpx",height:"200rpx",src:v(M)(e.image),model:"aspectFill"},{error:i((()=>[n(S,{name:"photo",color:"#999",size:"50"})])),_:2},1032,["src"])):m("",!0),n(y,{class:"flex-1 flex flex-col justify-between ml-[10px]"},{default:i((()=>[n(y,{class:"text-[16px] leading-[1.3] multi-hidden mt-[2px]"},{default:i((()=>[h(p(e.title),1)])),_:2},1024),n(y,{class:"text-[14px] using-hidden mb-[auto] mt-[10px] text-gray-500"},{default:i((()=>[h(p(e.summary),1)])),_:2},1024),n(y,{class:"text-[12px] text-gray-400 flex justify-between mb-[5px]"},{default:i((()=>[n(z,{class:""},{default:i((()=>[h(p(e.create_time),1)])),_:2},1024)])),_:2},1024)])),_:2},1024)])),_:2},1032,["class","onClick"])))),128)),!v(x).length&&v(L)?(s(),c(R,{key:0})):m("",!0)])),_:1},8,["onInit","onDown"]),n(B)])),_:1})}}}),[["__scopeId","data-v-ace1db76"]]);export{J as default};
|