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.

2 lines
22 KiB

3 days ago
import{n as e,st as t}from"./axios-CiYFffbI.js";import{I as n,N as r,O as i,V as a,Y as o,_ as s,d as c,f as ee,i as l,it as u,kt as d,nt as f,p,u as m,ut as te,v as h,y as g,z as _}from"./runtime-core.esm-bundler-CnFWH3R5.js";import{n as v}from"./index-DscUIWPJ.js";import{t as ne}from"./RichEditorField-MwuZH_1q.js";import{t as re}from"./listTable-Djel28e5.js";var ie=[`src`],ae={style:{display:`flex`,"flex-direction":`column`,"align-items":`flex-start`,width:`100%`}},oe={style:{width:`100%`,"margin-bottom":`8px`}},se={style:{display:`grid`,"grid-template-columns":`repeat(3, 180px)`,gap:`12px`,width:`100%`}},ce=[`src`,`onClick`],le=[`src`,`onClick`],ue=[`src`],de=[`src`],fe={style:{display:`flex`,gap:`12px`}},pe={style:{width:`280px`,height:`520px`,overflow:`auto`,border:`1px solid #e5e6eb`,padding:`8px`}},y=1200,b=800,x=g({__name:`VenueList`,setup(g){let x=u(!1),S=u(!1),C=u(!1),w=u(!1),T=u(!1),E=u(``),D=u([]),O=u(!1),k=u(null),me=u([]),A=u([]),j=u([]),M=u([]),N=u(null),he=u(null),P=u(0),F=u(!1),ge=u(`image`),I=u(``),L=null,R=null,z=u(null),B={lat:31.299379,lng:120.585315},_e={maxHeight:`70vh`,overflow:`auto`},V=f({keyword:``,district:``,venue_type:``,ticket_type:``,is_active:`all`});function H(e){if(e==null||e===``)return;let t=typeof e==`number`?e:parseFloat(String(e).trim());return Number.isFinite(t)?t:void 0}function ve(){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 n=await Y(r),i=t.getSelection(!0)?.index??Math.max(0,t.getLength()-1);t.insertEmbed(i,`image`,n,`user`),t.setSelection(i+1,0),e.success(`图片已上传并插入`)}catch(t){e.error(t?.response?.data?.message??`图片上传失败`)}},n.click()}function U(){let t=this.quill,n=document.createElement(`input`);n.type=`file`,n.accept=`video/*`,n.onchange=async()=>{let r=n.files?.[0];if(r)try{let n=await Y(r),i=t.getSelection(!0)?.index??Math.max(0,t.getLength()-1);t.insertEmbed(i,`video`,n,`user`),t.setSelection(i+1,0),e.success(`视频已上传并插入`)}catch(t){e.error(t?.response?.data?.message??`视频上传失败`)}},n.click()}let W={modules:{toolbar:{container:[[{header:[1,2,3,!1]}],[`bold`,`italic`,`underline`,`strike`],[{color:[]},{background:[]}],[{list:`ordered`},{list:`bullet`}],[{align:[]}],[`link`,`image`,`video`],[`clean`]],handlers:{image:ve,video:U}}},placeholder:`请输入场馆详情内容`},G=f({name:``,venue_type:``,unit_name:``,district:``,ticket_type:``,open_time:``,reservation_notice:``,study_courses:``,address:``,lat:void 0,lng:void 0,cover_image:``,gallery_media:[],detail_html:``,sort:0,is_active:!0});function ye(){return N.value?.role===`super_admin`}function K(e){let t=(e||``).trim();return t?t.replace(/<[^>]+>/g,` `).replace(/\s+/g,` `):`-`}function be(e,t){return t?e.find(e=>e.item_value===t)?.item_label||t:`-`}function xe(e,t,n=`arcoblue`){return t&&e.find(e=>e.item_value===t)?.item_remark||n}function q(){return`CRFBZ-NTART-YU4XX-LCDGK-3J456-VKBK2`}function Se(){return`szkp-map-admin`}function J(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 Y(e){let t=new FormData;t.append(`file`,e);let n=(await v.post(`/upload`,t,{headers:{"Content-Type":`multipart/form-data`}}))?.data||{};return J(n.url,n.path)}function X(){P.value+=1}function Z(e,t){t&&(ge.value=e,I.value=t,F.value=!0)}async function Ce(t,n,r,i){if(!t.type.startsWith(`image/`))return!0;let a=await new Promise((e,n)=>{let r=new FileReader;r.onload=()=>{let t=new Image;t.onload=()=>e({width:t.width,height:t.height}),t.onerror=()=>n(Error(`图片解析失败`)),t.src=String(r.result||``)},r.onerror=()=>n(Error(`图片读取失败`)),r.readAsDataURL(t)});return a.width>n||a.height>r?(e.warning(`${i}尺寸不能超过 ${n}x${r},当前为 ${a.width}x${a.height}`),!1):!0}function we(e){let t=new Set,n=[e];for(;n.length;){let e=n.shift();if(!(!e||t.has(e))){if
3 days ago
周末 09:00-18:00`},null,8,[`modelValue`])]),_:1}),h(R,{label:`场馆地址`,required:``},{default:o(()=>[h(i,{modelValue:G.address,"onUpdate:modelValue":r[13]||=e=>G.address=e},null,8,[`modelValue`])]),_:1}),h(R,{label:`经纬度`,required:``},{default:o(()=>[h(v,null,{default:o(()=>[h(B,{modelValue:G.lng,"onUpdate:modelValue":r[14]||=e=>G.lng=e,precision:7,placeholder:`经度`},null,8,[`modelValue`]),h(B,{modelValue:G.lat,"onUpdate:modelValue":r[15]||=e=>G.lat=e,precision:7,placeholder:`纬度`},null,8,[`modelValue`]),h(g,{onClick:Ke},{default:o(()=>[...r[33]||=[s(`地图选点`,-1)]]),_:1}),h(g,{onClick:Be},{default:o(()=>[...r[34]||=[s(`打开场馆位置`,-1)]]),_:1})]),_:1})]),_:1}),h(R,{label:`封面图单张`},{default:o(()=>[h(v,{direction:`vertical`,fill:``},{default:o(()=>[h(U,{"auto-upload":!1,"show-file-list":!1,accept:`image/*`,"before-upload":je,onChange:Ne},{"upload-button":o(()=>[h(g,null,{default:o(()=>[...r[35]||=[s(`上传封面`,-1)]]),_:1})]),_:1}),h(q,{type:`secondary`},{default:o(()=>[...r[36]||=[s(`建议不超过 1200x800`,-1)]]),_:1}),G.cover_image?(n(),c(v,{key:0,direction:`vertical`,align:`start`},{default:o(()=>[m(`img`,{src:G.cover_image,style:{width:`160px`,border:`1px solid #e5e6eb`,"border-radius":`4px`,cursor:`zoom-in`},onError:$,onClick:r[16]||=e=>Z(`image`,G.cover_image)},null,40,ie),h(g,{size:`mini`,status:`danger`,onClick:Ie},{default:o(()=>[...r[37]||=[s(`删除封面`,-1)]]),_:1})]),_:1})):ee(``,!0)]),_:1})]),_:1}),h(R,{label:`轮播图/视频`},{default:o(()=>[m(`div`,ae,[m(`div`,oe,[h(U,{"auto-upload":!1,"show-file-list":!1,multiple:``,accept:`image/*,video/*`,"before-upload":Me,onChange:Pe},{"upload-button":o(()=>[h(g,{type:`primary`},{default:o(()=>[...r[38]||=[s(`新增轮播资源`,-1)]]),_:1})]),_:1})]),m(`div`,se,[(n(!0),p(l,null,_(G.gallery_media,(e,i)=>(n(),c(L,{key:e.url+i,size:`small`,style:{width:`180px`}},{title:o(()=>[s(d(e.type===`video`?`视频`:`图片`),1)]),extra:o(()=>[h(g,{size:`mini`,status:`danger`,onClick:e=>Fe(i)},{default:o(()=>[...r[39]||=[s(`删除`,-1)]]),_:1},8,[`onClick`])]),default:o(()=>[e.type===`image`?(n(),p(`img`,{key:0,src:e.url,style:{width:`140px`,height:`90px`,"object-fit":`cover`,border:`1px solid #e5e6eb`,"border-radius":`4px`,cursor:`zoom-in`},onError:$,onClick:t=>Z(`image`,e.url)},null,40,ce)):(n(),p(`video`,{key:1,src:e.url,controls:``,style:{width:`140px`,height:`90px`,"object-fit":`cover`,cursor:`zoom-in`},onClick:t(t=>Z(`video`,e.url),[`stop`])},null,8,le))]),_:2},1024))),128))])])]),_:1}),h(R,{label:`预约须知无则删除`},{default:o(()=>[(n(),c(ne,{modelValue:G.reservation_notice,"onUpdate:modelValue":r[17]||=e=>G.reservation_notice=e,"editor-options":W,"field-key":`venue-reservation`,key:`venue-reservation-${P.value}`},null,8,[`modelValue`]))]),_:1}),h(R,{label:`研学课程`},{default:o(()=>[(n(),c(ne,{modelValue:G.study_courses,"onUpdate:modelValue":r[18]||=e=>G.study_courses=e,"editor-options":W,"field-key":`venue-study`,key:`venue-study-${P.value}`},null,8,[`modelValue`]))]),_:1}),h(R,{label:`场馆详情`},{default:o(()=>[(n(),c(ne,{modelValue:G.detail_html,"onUpdate:modelValue":r[19]||=e=>G.detail_html=e,"editor-options":W,"field-key":`venue-detail`,"min-height":260,key:`venue-detail-${P.value}`},null,8,[`modelValue`]))]),_:1})]),_:1},8,[`model`])]),_:1},8,[`visible`,`title`,`confirm-loading`]),h(J,{visible:F.value,"onUpdate:visible":r[21]||=e=>F.value=e,title:`媒体预览`,width:`72%`,footer:!1},{default:o(()=>[ge.value===`image`?(n(),p(`img`,{key:0,src:I.value,style:{display:`block`,"max-width":`100%`,"max-height":`72vh`,margin:`0 auto`},onError:$},null,40,ue)):(n(),p(`video`,{key:1,src:I.value,controls:``,autoplay:``,style:{display:`block`,width:`100%`,"max-height":`72vh`}},null,8,de))]),_:1},8,[`visible`]),h(J,{visible:w.value,"onUpdate:visible":r[23]||=e=>w.value=e,title:`地图选点腾讯地图`,width:`70%`,"body-style":_e,"on-before-ok":Ye},{default:o(()=>[h(v,{style:{"margin-bottom":`12px`,width:`100%`}},{default:o(()=>[h(i,{modelValue:E.value,"onUpdate:modelValue":r[22]||=e=>E.value=e,pla