niucloud-admin/niucloud/public/wap/assets/top-tabbar.228a0fdd.js
全栈小学生 e6c822aa8e up niucloud
2025-06-26 15:07:17 +08:00

2 lines
8.0 KiB
JavaScript

import{H as t,J as e,K as l,ai as a,bt as o,d as s,a2 as n,aW as i,m as r,X as c,r as d,s as u,e as p,o as y,c as f,w as m,b as g,n as x,A as _,g as k,y as v,z as h,x as S,a as b,Y as w,ar as C,b2 as B,k as I,N as A,F as T,O as V,b3 as z}from"./index-58df6033.js";import{m as F}from"./manifest.ed582bbb.js";import{_ as j}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="+F.h5.sdkConfigs.maps.qqmap.key+"&referer=myapp"}}}const $=j(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(),F=r((()=>{let t=!0;return t=!X.value&&a.isFill,t})),j=r((()=>a.data)),$=r((()=>{if(a.data&&a.data.topStatusBar)return a.data.topStatusBar})),q=r((()=>{let t="";return a.isBack?(t+="padding-left: 30rpx;","style-1"==$.value.style&&(t+="padding-right:80rpx;")):("style-1"==$.value.style&&(t+="padding-right: 30rpx;"),t+="padding-left: 30rpx;"),t})),G=r((()=>{let t="";return t+="font-size: 28rpx;",t+=`color: ${H.value};`,"style-1"==$.value.style&&(t+=`text-align: ${$.value.textAlign};`),t})),H=r((()=>{let t="";return t=1==a.scrollBool?$.value.rollTextColor:$.value.textColor,t})),L=r((()=>{let t="";return t=1==a.scrollBool?$.value.rollBgColor:$.value.bgColor,t}));let O=uni.getStorageSync("componentsScrollValGroup");if(O)O.TopTabbar=0,uni.setStorageSync("componentsScrollValGroup",O);else{let t={TopTabbar:0};uni.setStorageSync("componentsScrollValGroup",t)}let U=c();const N=()=>{1===U.length?"app/pages/auth/index"===U[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():b({url:"/app/pages/index/index",mode:"switchTab"}):"function"==typeof a.customBack?a.customBack():w()},P=r((()=>`calc(100vw - ${o.menuButtonInfo.right}px + ${o.menuButtonInfo.width}px + 10px)`)),D=d(0),J=z();let K=!1;$.value&&"style-4"==$.value.style&&(K=!0);const W=R(K);W.onLoad(),W.init();let X=d(!1);u((()=>{C((()=>{B().in(J).select(".ns-navbar-wrap .u-navbar .content-wrap").boundingClientRect((t=>{D.value=t?t.height:0,s.$patch((t=>{t.topTabarHeight=D.value}))})).exec()})),W.refresh(),X.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($)?(y(),f(n,{key:0,class:_(["ns-navbar-wrap",p($).style])},{default:m((()=>[g(n,{class:_(["u-navbar",{fixed:-1!=a.scrollBool,absolute:-1==a.scrollBool}]),style:x({backgroundColor:p(L)})},{default:m((()=>[g(n,{class:"navbar-inner",style:x({width:"100%",height:D.value+"px"})},{default:m((()=>["style-1"==p($).style?(y(),f(n,{key:0,class:_(["content-wrap",[p($).textAlign]]),style:x(p(q))},{default:m((()=>[e.isBack?(y(),f(n,{key:0,class:"back-wrap -ml-[16rpx] text-[26px] nc-iconfont nc-icon-zuoV6xx",style:x({color:p(H)}),onClick:N},null,8,["style"])):k("v-if",!0),g(n,{class:"title-wrap",style:x(p(G))},{default:m((()=>[v(h(p(j).title),1)])),_:1},8,["style"])])),_:1},8,["class","style"])):k("v-if",!0),"style-2"==p($).style?(y(),f(n,{key:1,class:"content-wrap",style:x(p(q)),onClick:l[0]||(l[0]=t=>p(s).toRedirect(p($).link))},{default:m((()=>[e.isBack?(y(),f(n,{key:0,class:"back-wrap -ml-[16rpx] text-[26px] nc-iconfont nc-icon-zuoV6xx",style:x({color:p(H)}),onClick:N},null,8,["style"])):k("v-if",!0),g(n,{class:"title-wrap",style:x({color:p($).textColor})},{default:m((()=>[g(n,null,{default:m((()=>[g(i,{src:p(V)(p($).imgUrl),mode:"heightFix"},null,8,["src"])])),_:1}),g(n,{style:x({color:p($).textColor})},{default:m((()=>[v(h(p(j).title),1)])),_:1},8,["style"])])),_:1},8,["style"])])),_:1},8,["style"])):k("v-if",!0),"style-3"==p($).style?(y(),f(n,{key:2,style:x(p(q)),class:"content-wrap"},{default:m((()=>[e.isBack?(y(),f(n,{key:0,class:"back-wrap -ml-[16rpx] text-[26px] nc-iconfont nc-icon-zuoV6xx",style:x({color:p(H)}),onClick:N},null,8,["style"])):k("v-if",!0),g(n,{class:"title-wrap",onClick:l[1]||(l[1]=t=>p(s).toRedirect(p($).link))},{default:m((()=>[g(i,{src:p(V)(p($).imgUrl),mode:"heightFix"},null,8,["src"])])),_:1}),g(n,{class:"search",onClick:l[2]||(l[2]=t=>p(s).toRedirect(p($).link)),style:x({height:p(o).menuButtonInfo.height-2+"px",lineHeight:p(o).menuButtonInfo.height-2+"px"})},{default:m((()=>[g(r,{class:"nc-iconfont nc-icon-sousuo-duanV6xx1 text-[24rpx] absolute left-[20rpx]"}),g(r,{class:"text-[24rpx]"},{default:m((()=>[v(h(p($).inputPlaceholder),1)])),_:1})])),_:1},8,["style"]),g(n,{style:x({width:p(P)})},null,8,["style"])])),_:1},8,["style"])):k("v-if",!0),"style-4"==p($).style?(y(),f(n,{key:3,style:x(p(q)),class:"content-wrap"},{default:m((()=>[e.isBack?(y(),f(n,{key:0,class:"back-wrap -ml-[16rpx] text-[26px] nc-iconfont nc-icon-zuoV6xx",style:x({color:p(H)}),onClick:N},null,8,["style"])):k("v-if",!0),g(r,{class:"nc-iconfont nc-icon-dizhiguanliV6xx text-[28rpx]",style:x({color:p($).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($).textColor})},{default:m((()=>[v(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($).textColor})},{default:m((()=>[v(h(p(o).defaultPositionAddress),1)])),_:1},8,["style"])),g(r,{class:"nc-iconfont nc-icon-youV6xx text-[26rpx]",onClick:l[5]||(l[5]=S((t=>p(W).reposition()),["stop"])),style:x({color:p($).textColor})},null,8,["style"])])),_:1},8,["style"])):k("v-if",!0)])),_:1},8,["style"])])),_:1},8,["class","style"]),k(" 解决fixed定位后导航栏塌陷的问题 "),p(F)?(y(),f(n,{key:0,class:"u-navbar-placeholder",style:x({width:"100%",paddingTop:D.value+"px"})},null,8,["style"])):k("v-if",!0)])),_:1},8,["class"])):k("v-if",!0)}}}),[["__scopeId","data-v-6487c52f"]]);export{$ as _,R as u};