mirror of
https://gitee.com/niucloud-team/niucloud-admin.git
synced 2026-01-06 13:08:10 +00:00
2 lines
8.0 KiB
JavaScript
2 lines
8.0 KiB
JavaScript
import{p as t,q as e,s as l,bM as a,bz as o,d as s,a0 as n,aJ as i,k as r,r as c,V as d,P as u,u as p,o as y,c as f,w as g,b as m,n as x,S as _,f as v,z as k,A as h,B as S,a as b,W as C,ax as w,aP as B,j as I,C as A,E as T,F as V,aR as z}from"./index-2dd15007.js";import{m as j}from"./manifest.ed582bbb.js";import{_ as F}from"./_plugin-vue_export-helper.1b428a4d.js";function R(s){const n=t();let i=s;1!=n.mapConfig.is_open&&(i=!1);const r=()=>{if(!i)return!1;uni.getStorageSync("manually_select_location_from_map")||l()&&n.mapConfig.is_open&&!uni.getStorageSync("location_address")&&a.init((()=>{a.getLocation((t=>{let e=t.latitude+","+t.longitude;c(e)}))}))},c=(t="")=>{if(!i)return!1;let e={latlng:""};e.latlng=t||n.diyAddressInfo.latitude+","+n.diyAddressInfo.longitude,o(e).then((t=>{if(t.data&&Object.keys(t.data).length){let l={},a=e.latlng.split(",");l.latitude=a[0],l.longitude=a[1],l.full_address=null!=t.data.province?t.data.province:"",l.full_address+=null!=t.data.city?t.data.city:"",l.full_address+=null!=t.data.district?t.data.district:"",l.full_address+=null!=t.data.community?t.data.community:"",l.province_id=t.data.province_id,l.province=t.data.province,l.city_id=t.data.city_id,l.city=t.data.city,l.district_id=t.data.district_id,l.district=t.data.district,l.community=t.data.community,l.formatted_addresses=t.data.formatted_addresses,n.setAddressInfo(l)}else n.setAddressInfo();setTimeout((()=>{uni.removeStorageSync("manually_select_location_from_map")}),500)}))},d=()=>{let t=uni.getStorageSync("location_address");if(t){var e=new Date;n.mapConfig.valid_time>0?t.is_expired=e.getTime()/1e3>t.valid_time:t.is_expired=!1}else t={is_expired:!1};return t};return{init:r,onLoad:(t="")=>{e((e=>{e&&e.latng&&c(e.latng),uni.removeStorageSync("manually_select_location_from_map"),"function"==typeof t&&t(e)}))},refresh:()=>{if(!i)return!1;!uni.getStorageSync("manually_select_location_from_map")&&uni.getStorageSync("location_address")&&(d()&&!d().is_expired?n.setAddressInfo(uni.getStorageSync("location_address")):uni.removeStorageSync("location_address")),!uni.getStorageSync("manually_select_location_from_map")&&d()&&d().is_expired&&r()},reposition:()=>{if(!i)return!1;n.diyAddressInfo&&n.diyAddressInfo.latitude,n.diyAddressInfo&&n.diyAddressInfo.longitude,uni.setStorageSync("manually_select_location_from_map",!0);let t=location.origin+location.pathname;window.location.href="https://apis.map.qq.com/tools/locpicker?search=1&type=0&backurl="+encodeURIComponent(t)+"&key="+j.h5.sdkConfigs.maps.qqmap.key+"&referer=myapp"}}}const q=F(s({__name:"top-tabbar",props:{data:{type:Object,default:{}},titleColor:{type:String,default:"#606266"},customBack:{type:Function,default:null},scrollBool:{type:[String,Number],default:-1},isBack:{type:Boolean,default:!0},isFill:{type:Boolean,default:!0}},setup(e,{expose:l}){const a=e;n().platform;const o=t(),s=i(),j=r((()=>{let t=!0;return t=!K.value&&a.isFill,t})),F=r((()=>a.data)),q=r((()=>{if(a.data&&a.data.topStatusBar)return a.data.topStatusBar})),P=r((()=>{let t="";return a.isBack&&H.value?(t+="padding-left: 30rpx;","style-1"==q.value.style&&(t+="padding-right:80rpx;")):("style-1"==q.value.style&&(t+="padding-right: 30rpx;"),t+="padding-left: 30rpx;"),t})),$=r((()=>{let t="";return t+="font-size: 28rpx;",t+=`color: ${G.value};`,"style-1"==q.value.style&&(t+=`text-align: ${q.value.textAlign};`),t})),G=r((()=>{let t="";return t=1==a.scrollBool?q.value.rollTextColor:q.value.textColor,t})),L=r((()=>{let t="";return t=1==a.scrollBool?q.value.rollBgColor:q.value.bgColor,t}));let U=uni.getStorageSync("componentsScrollValGroup");if(U)U.TopTabbar=0,uni.setStorageSync("componentsScrollValGroup",U);else{let t={TopTabbar:0};uni.setStorageSync("componentsScrollValGroup",t)}const H=c(!1);let O=d();const D=()=>{1==O.length&&"app/pages/auth/index"==O[0].route?uni.getStorage({key:"loginBack",success:t=>{b(t?{...t.data,mode:"redirectTo"}:{url:"/app/pages/index/index",mode:"switchTab"})},fail:t=>{b({url:"/app/pages/index/index",mode:"switchTab"})}}):"function"==typeof a.customBack?a.customBack():C()},E=r((()=>`calc(100vw - ${o.menuButtonInfo.right}px + ${o.menuButtonInfo.width}px + 10px)`)),J=c(0),M=z();let N=!1;q.value&&"style-4"==q.value.style&&(N=!0);const W=R(N);W.onLoad(),W.init();let K=c(!1);u((()=>{w((()=>{B().in(M).select(".ns-navbar-wrap .u-navbar .content-wrap").boundingClientRect((t=>{J.value=t?t.height:0,s.topTabarHeight=J.value})).exec()})),(O.length>1||1==O.length&&"app/pages/auth/index"==O[0].route)&&(H.value=!0),W.refresh(),K.value=uni.getStorageSync("imageAdsSameScreen")||!1}));return l({refresh:()=>{W.refresh()}}),(t,l)=>{const n=I,i=A,r=T;return"decorate"!=p(s).mode&&p(q)?(y(),f(n,{key:0,class:_(["ns-navbar-wrap",p(q).style])},{default:g((()=>[m(n,{class:_(["u-navbar",{fixed:-1!=a.scrollBool,absolute:-1==a.scrollBool}]),style:x({backgroundColor:p(L)})},{default:g((()=>[m(n,{class:"navbar-inner",style:x({width:"100%",height:J.value+"px"})},{default:g((()=>["style-1"==p(q).style?(y(),f(n,{key:0,class:_(["content-wrap",[p(q).textAlign]]),style:x(p(P))},{default:g((()=>[e.isBack&&H.value?(y(),f(n,{key:0,class:"back-wrap -ml-[16rpx] text-[27px] nc-iconfont nc-icon-zuoV6xx",style:x({color:p(G)}),onClick:D},null,8,["style"])):v("v-if",!0),m(n,{class:"title-wrap",style:x(p($))},{default:g((()=>[k(h(p(F).title),1)])),_:1},8,["style"])])),_:1},8,["class","style"])):v("v-if",!0),"style-2"==p(q).style?(y(),f(n,{key:1,class:"content-wrap",style:x(p(P)),onClick:l[0]||(l[0]=t=>p(s).toRedirect(p(q).link))},{default:g((()=>[e.isBack&&H.value?(y(),f(n,{key:0,class:"back-wrap -ml-[16rpx] text-[27px] nc-iconfont nc-icon-zuoV6xx",style:x({color:p(G)}),onClick:D},null,8,["style"])):v("v-if",!0),m(n,{class:"title-wrap",style:x({color:p(q).textColor})},{default:g((()=>[m(n,null,{default:g((()=>[m(i,{src:p(V)(p(q).imgUrl),mode:"heightFix"},null,8,["src"])])),_:1}),m(n,{style:x({color:p(q).textColor})},{default:g((()=>[k(h(p(F).title),1)])),_:1},8,["style"])])),_:1},8,["style"])])),_:1},8,["style"])):v("v-if",!0),"style-3"==p(q).style?(y(),f(n,{key:2,style:x(p(P)),class:"content-wrap"},{default:g((()=>[e.isBack&&H.value?(y(),f(n,{key:0,class:"back-wrap -ml-[16rpx] text-[27px] nc-iconfont nc-icon-zuoV6xx",style:x({color:p(G)}),onClick:D},null,8,["style"])):v("v-if",!0),m(n,{class:"title-wrap",onClick:l[1]||(l[1]=t=>p(s).toRedirect(p(q).link))},{default:g((()=>[m(i,{src:p(V)(p(q).imgUrl),mode:"heightFix"},null,8,["src"])])),_:1}),m(n,{class:"search",onClick:l[2]||(l[2]=t=>p(s).toRedirect(p(q).link)),style:x({height:p(o).menuButtonInfo.height-2+"px",lineHeight:p(o).menuButtonInfo.height-2+"px"})},{default:g((()=>[m(r,{class:"nc-iconfont nc-icon-sousuo-duanV6xx1 text-[24rpx] absolute left-[20rpx]"}),m(r,{class:"text-[24rpx]"},{default:g((()=>[k(h(p(q).inputPlaceholder),1)])),_:1})])),_:1},8,["style"]),m(n,{style:x({width:p(E)})},null,8,["style"])])),_:1},8,["style"])):v("v-if",!0),"style-4"==p(q).style?(y(),f(n,{key:3,style:x(p(P)),class:"content-wrap"},{default:g((()=>[e.isBack&&H.value?(y(),f(n,{key:0,class:"back-wrap -ml-[16rpx] text-[27px] nc-iconfont nc-icon-zuoV6xx",style:x({color:p(G)}),onClick:D},null,8,["style"])):v("v-if",!0),m(r,{class:"nc-iconfont nc-icon-dizhiguanliV6xx text-[28rpx]",style:x({color:p(q).textColor})},null,8,["style"]),p(o).diyAddressInfo?(y(),f(n,{key:1,class:"title-wrap",onClick:l[3]||(l[3]=S((t=>p(W).reposition()),["stop"])),style:x({color:p(q).textColor})},{default:g((()=>[k(h(p(o).diyAddressInfo.community),1)])),_:1},8,["style"])):(y(),f(n,{key:2,class:"title-wrap",onClick:l[4]||(l[4]=S((t=>p(W).reposition()),["stop"])),style:x({color:p(q).textColor})},{default:g((()=>[k(h(p(o).defaultPositionAddress),1)])),_:1},8,["style"])),m(r,{class:"nc-iconfont nc-icon-youV6xx text-[26rpx]",onClick:l[5]||(l[5]=S((t=>p(W).reposition()),["stop"])),style:x({color:p(q).textColor})},null,8,["style"])])),_:1},8,["style"])):v("v-if",!0)])),_:1},8,["style"])])),_:1},8,["class","style"]),v(" 解决fixed定位后导航栏塌陷的问题 "),p(j)?(y(),f(n,{key:0,class:"u-navbar-placeholder",style:x({width:"100%",paddingTop:J.value+"px"})},null,8,["style"])):v("v-if",!0)])),_:1},8,["class"])):v("v-if",!0)}}}),[["__scopeId","data-v-885b5368"]]);export{q as _,R as u};
|