appointment_system/miniprogram/dist/build/h5/assets/pages-index-index.e475d22e.js
2025-12-19 00:37:31 +08:00

2 lines
5.4 KiB
JavaScript

import{_ as e,C as o,r as a,a as t,s,n as r,o as l,c as n,w as i,i as c,b as d,d as g,F as p,e as u,f as m,t as h,g as f,S as b,h as x,j as _}from"./index-a09151d6.js";import{u as y}from"./tabbar-i18n.82cae040.js";import{i as L,r as w}from"./auth.b970b80f.js";import{A as U}from"./AppServer.888fd24d.js";const I=e({data:()=>({bannerList:[],hotList:[],aboutUsImage:"",appLogo:"",appName:""}),onLoad(){this.loadConfig(),this.loadBanners(),this.loadHotServices()},onShow(){y(this),this.checkUnreadNotifications()},methods:{async loadConfig(){try{console.log("开始加载配置...");const e=await o.getPublicConfig();console.log("获取到的配置:",JSON.stringify(e)),console.log("配置类型:",typeof e),console.log("about_us_image值:",e.about_us_image),e.about_us_image?(this.aboutUsImage=o.getImageUrl(e.about_us_image),console.log("关于我们图片URL:",this.aboutUsImage)):console.log("配置中没有about_us_image"),e.app_logo&&(this.appLogo=o.getImageUrl(e.app_logo),console.log("应用Logo URL:",this.appLogo)),e.app_name&&(this.appName=e.app_name)}catch(e){console.error("加载配置失败:",e)}},async loadBanners(){try{console.log("开始加载Banner..."),console.log("API URL:",o.API_BASE_URL+"/api/v1/home/banners"),a({url:o.API_BASE_URL+"/api/v1/home/banners",method:"GET",success:e=>{var a;console.log("Banner请求成功 - res:",e),200===e.statusCode&&0===e.data.code?(this.bannerList=e.data.data.map(e=>({...e,image_url:o.getImageUrl(e.image_url)})),console.log("Banner列表:",this.bannerList),console.log("Banner数量:",this.bannerList.length)):(console.log("Banner加载条件不满足"),console.log("statusCode:",e.statusCode),console.log("code:",null==(a=e.data)?void 0:a.code))},fail:e=>{console.error("Banner请求失败:",e)}})}catch(e){console.error("加载Banner失败:",e)}},async loadHotServices(){try{a({url:o.API_BASE_URL+"/api/v1/home/hot-services",method:"GET",header:{"Accept-Language":this.$i18n.locale||"zh"},success:e=>{200===e.statusCode&&0===e.data.code&&(this.hotList=e.data.data.map(e=>({...e,image_url:e.image_url?o.getImageUrl(e.image_url):null})),console.log("热门服务列表:",this.hotList))},fail:e=>{console.error("加载热门服务失败:",e)}})}catch(e){console.error("加载热门服务失败:",e)}},handleImageLoad(e){console.log("图片加载成功:",e)},handleImageError(e){console.error("图片加载失败:",e),console.error("图片URL:",this.aboutUsImage),this.aboutUsImage=""},async checkUnreadNotifications(){if(L())try{const e=new U,o=await e.GetNotificationUnreadCount();if(0===o.code&&o.data){const e=o.data.all||0;e>0?s({index:2,text:e>99?"99+":String(e)}):t({index:2})}}catch(e){console.error("检查未读通知失败:",e)}else t({index:2})},toDetails(e){w(!0)&&r({url:"/pages/index/reserve-details-page?id="+e.id+"&title="+encodeURIComponent(e.name)+"&serviceType="+encodeURIComponent(e.service_type)})}}},[["render",function(e,o,a,t,s,r){const y=f,L=_,w=b,U=x,I=c;return l(),n(I,{class:"content"},{default:i(()=>[s.bannerList.length>0?(l(),n(w,{key:0,class:"swiper",autoplay:"",interval:"3000",duration:"500",circular:""},{default:i(()=>[(l(!0),d(p,null,g(s.bannerList,(e,o)=>(l(),n(L,{key:e.id},{default:i(()=>[u(y,{class:"swiper-img",src:e.image_url,mode:"aspectFill"},null,8,["src"])]),_:2},1024))),128))]),_:1})):(l(),n(I,{key:1,class:"swiper center",style:{"background-color":"#f5f5f5"}},{default:i(()=>[u(U,{style:{color:"#999"}},{default:i(()=>[m("暂无Banner")]),_:1})]),_:1})),u(I,{class:"column",style:{width:"100%","background-color":"white","border-radius":"27rpx","margin-top":"-32rpx","z-index":"999","box-shadow":"0 15rpx 15rpx -3rpx rgba(0, 0, 0, 0.1)"}},{default:i(()=>[u(I,{class:"hot-services-title",style:{"margin-top":"21rpx","margin-left":"25rpx"}},{default:i(()=>[u(U,{style:{"font-size":"32rpx","font-weight":"bold",color:"#333"}},{default:i(()=>[m(h(e.$t("home.hotServices")),1)]),_:1})]),_:1}),u(I,{class:"",style:{display:"flex","flex-wrap":"wrap","margin-top":"22rpx","margin-left":"11rpx"}},{default:i(()=>[(l(!0),d(p,null,g(s.hotList,(e,o)=>(l(),n(I,{class:"column",key:e.id,style:{"margin-left":"22rpx",width:"331.12rpx","margin-bottom":"25rpx"},onClick:o=>r.toDetails(e)},{default:i(()=>[u(y,{src:e.image_url||"/static/placeholder.png",style:{width:"331.12rpx",height:"159.57rpx","border-radius":"16rpx","background-color":"#f5f5f5","box-shadow":"0 0 10rpx 5rpx rgba(0, 0, 0, 0.1)"},mode:"aspectFill"},null,8,["src"]),u(I,{class:"service-text"},{default:i(()=>[m(h(e.name),1)]),_:2},1024)]),_:2},1032,["onClick"]))),128))]),_:1})]),_:1}),u(I,{class:"about-title",style:{"margin-top":"22rpx","margin-left":"28rpx"}},{default:i(()=>[u(U,{style:{"font-size":"32rpx","font-weight":"bold",color:"#333"}},{default:i(()=>[m(h(e.$t("home.aboutMe")),1)]),_:1})]),_:1}),s.aboutUsImage?(l(),n(y,{key:2,src:s.aboutUsImage,style:{width:"100%",height:"759.97rpx","box-shadow":"0 0 10rpx 5rpx rgba(0, 0, 0, 0.1)","margin-top":"26rpx","margin-bottom":"30rpx","border-radius":"28rpx","background-color":"white"},mode:"aspectFill",onError:r.handleImageError,onLoad:r.handleImageLoad},null,8,["src","onError","onLoad"])):(l(),n(I,{key:3,style:{width:"100%",height:"759.97rpx","box-shadow":"0 0 10rpx 5rpx rgba(0, 0, 0, 0.1)","margin-top":"26rpx","margin-bottom":"30rpx","border-radius":"28rpx","background-color":"white",display:"flex","align-items":"center","justify-content":"center"}},{default:i(()=>[u(U,{style:{color:"#999"}},{default:i(()=>[m(h(e.$t("home.aboutMe")),1)]),_:1})]),_:1}))]),_:1})}],["__scopeId","data-v-d420ee0b"]]);export{I as default};