You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1 line
38 KiB

3 weeks ago
import{n as e,st as t}from"./axios-CiYFffbI.js";import{I as n,N as r,O as i,P as a,V as o,Y as s,_ as c,d as l,f as u,i as d,it as f,kt as p,l as m,nt as h,p as g,u as _,ut as ee,v,y as te,z as y}from"./runtime-core.esm-bundler-CnFWH3R5.js";import{a as b,n as x,o as S}from"./index-u9L2EJ4o.js";import{t as ne}from"./RichEditorField-C3G_ZsLp.js";import{t as re}from"./listTable-Dphyh0Bn.js";function ie(e,t){return function(){return e()?window.confirm(t):!0}}function ae(e,t=`当前有未保存改动,确定要离开吗?`){function n(t){e()&&(t.preventDefault(),t.returnValue=``)}b((n,r,i)=>{if(!e()){i();return}i(window.confirm(t))}),r(()=>{window.addEventListener(`beforeunload`,n)}),a(()=>{window.removeEventListener(`beforeunload`,n)})}var oe=[`src`],se={key:1},ce={key:1,style:{color:`var(--color-text-3)`}},le={class:`activity-address-coord-row`},ue={style:{"margin-top":`8px`,width:`100%`,display:`flex`,"flex-wrap":`wrap`,gap:`8px`}},de={key:0,style:{color:`#86909c`}},fe={class:`activity-cover-carousel-wrap`},pe={class:`activity-cover-carousel-row__col`},me=[`src`],he={class:`activity-cover-carousel-row__col`},ge={style:{display:`flex`,"flex-direction":`column`,"align-items":`flex-start`,width:`100%`}},_e={style:{width:`100%`,"margin-bottom":`8px`}},ve={class:`activity-gallery-grid`},ye=[`src`,`onClick`],be=[`src`,`onClick`],xe=[`src`],Se=[`src`],Ce={style:{display:`flex`,gap:`12px`}},we={style:{width:`280px`,height:`520px`,overflow:`auto`,border:`1px solid #e5e6eb`,padding:`8px`}},Te={key:0,class:`booking-settings`},Ee={style:{"margin-top":`16px`,"text-align":`right`}},C=S(te({__name:`ActivityList`,setup(a){let te=f([]),b=f([]),S=f(null),C=f(!1),De=f(!1),w=f(!1),T=h({current:1,pageSize:10,total:0}),E=h({keyword:``,venue_id:void 0,is_active:`all`,schedule_status:`all`,audit_status:`all`}),D=f(null),O=f(``),k=f(!1),A=f(!0),j=f(null),Oe=f(``),ke={maxHeight:`70vh`,overflow:`auto`},Ae=f(0),je=f(!1),Me=f(`image`),M=f(``),N=f(!1),P=f(!1),F=f(``),Ne=f([]),Pe=f(null),I=null,L=null,R=f(null),Fe={lat:31.299379,lng:120.585315},z=f(!1),Ie=f(!1),Le=f(!1),B=f(null),V=f(`both`),H=f(1),U=f(1),W=f([]);function Re(){return`bk-${Date.now()}-${Math.random().toString(36).slice(2,9)}`}function G(e){if(!e)return``;let t=new Date(String(e));return Number.isNaN(t.getTime())?String(e).slice(0,10):new Intl.DateTimeFormat(`en-CA`,{timeZone:`Asia/Shanghai`,year:`numeric`,month:`2-digit`,day:`2-digit`}).format(t)}function ze(e){let t=e.start_at?G(String(e.start_at)):``,n=e.end_at?G(String(e.end_at)):``;return!t&&!n?`-`:t&&n?t===n?t:`${t}${n}`:t||n||`-`}let Be=m(()=>W.value.reduce((e,t)=>e+(Number(t.day_quota)||0),0)),Ve=m(()=>{let e=B.value;return e?.venue_id?b.value.find(t=>t.id===e.venue_id)?.appointment_type===`team_only`:!1}),K=h({venue_id:void 0,reservation_type:`online`,location:``,lat:void 0,lng:void 0,specific_time:``,offline_reservation_method:``,external_url:``,title:``,start_at:``,end_at:``,detail_html:``,cover_image:``,gallery_media:[],tags:[],sort:0,summary:``,is_active:!0}),He=f(``),Ue=m({get(){if(K.start_at&&K.end_at)return[K.start_at,K.end_at]},set(e){Array.isArray(e)&&e.length>=2&&e[0]&&e[1]?(K.start_at=String(e[0]),K.end_at=String(e[1])):(K.start_at=``,K.end_at=``)}}),We=m(()=>rt(K.start_at||``,K.end_at||``));function q(e,t){let n=String(e||``).trim();if(n)return/^https?:\/\//i.test(n)?n:n.startsWith(`/`)?`${window.location.origin}${n}`:`${window.location.origin}/${n}`;let r=String(t||``).trim();if(!r)return``;let i=r.replace(/^\/+/,``);return`${window.location.origin}/storage/${i}`}async function J(e){let t=new FormData;t.append(`file`,e);let{data:n}=await x.post(`/upload`,t);return q(n?.url,n?.path)}function Y(){Ae.value+=1}function Ge(e,t){t&&(Me.value=e,M.value=t,je.value=!0)}function Ke(){let t=this.quill,n=document.createElement(`input`);n.type=`file`,n.accept=`image/*`,n.onchange=async()=>{let r=n.files?.[0];if(r)try{let e=await J(r),n=t.getSelection(!0)?.index??Math.max(0,t.getLength()-1);t.insertEmbed(n,`image`,e,`user`),t.setSelection(n+1,0)}catch(t){e.error(t?.response?.data?.message??`图片上传失败`)}},n.click()