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
14 KiB
1 line
14 KiB
|
3 weeks ago
|
import{n as e,st as t}from"./axios-Cze8nXLL.js";import{At as n,I as r,N as i,V as a,X as o,_ as s,at as c,d as l,dt as u,f as d,i as f,l as p,p as m,rt as h,u as g,v as _,y as v,z as y}from"./runtime-core.esm-bundler-CP0MNZrl.js";import{n as b,o as x}from"./index-CBrDPDlF.js";import{t as ee}from"./RichEditorField-BxghITP4.js";import{t as te}from"./listTable-DKAruyoN.js";import{t as S}from"./mediaUrl-B7aD5nK5.js";var C=[`src`,`onClick`],ne={key:1,style:{color:`#86909c`}},re={style:{"max-width":`90vw`,"max-height":`80vh`}},ie=[`src`],ae=[`src`],oe={class:`admin-modal-form__full`},se={class:`study-tour-tags-field`},ce={class:`study-tour-tags-input-row`},le={class:`study-tour-tags-list`},ue={key:0,style:{color:`#86909c`}},de={style:{width:`100%`,display:`flex`,"flex-direction":`column`,"align-items":`stretch`}},fe={style:{width:`100%`,"margin-bottom":`8px`}},pe={style:{width:`100%`,border:`1px solid #e5e6eb`,"border-radius":`6px`,padding:`8px`,"max-height":`220px`,overflow:`auto`}},w={class:`study-tour-cover-carousel-wrap`},me={class:`study-tour-cover-carousel-row__col`},he={key:0,style:{display:`flex`,"flex-direction":`column`,"align-items":`flex-start`,gap:`8px`}},ge=[`src`],_e={class:`study-tour-cover-carousel-row__col`},ve={class:`study-tour-gallery-grid`},ye=[`src`,`onClick`],be=[`src`,`onClick`],T=x(v({__name:`StudyTourList`,setup(v){let x=c(!1),T=c(!1),E=c(!1),D=c(!0),O=c(null),k=c([]),A=c([]),j={maxHeight:`70vh`,overflow:`auto`},M=c(0),N=c(!1),P=c(`image`),F=c(``),I=h({name:``,tags:[],venue_ids:[],cover_image:``,gallery_media:[],intro_html:``,sort:0,is_active:!0}),L=c(``),R=p(()=>{let e=new Map(A.value.map(e=>[e.id,e]));return I.venue_ids.map(t=>e.get(t)).filter(Boolean)});function z(e,t){let n=String(e||``).trim();if(n)return S(n);let r=String(t||``).trim();return r?S(r):``}async function B(e){let t=new FormData;t.append(`file`,e);let{data:n}=await b.post(`/upload`,t);return z(n?.url,n?.path)}async function V(e){return B(e)}function H(){M.value+=1}function U(e){let t=new Set,n=[e];for(;n.length;){let e=n.shift();if(!(!e||t.has(e))){if(t.add(e),e instanceof File)return e;if(e?.target?.files?.[0]instanceof File)return e.target.files[0];if(Array.isArray(e)){for(let t of e)n.push(t);continue}if(typeof e==`object`){for(let t of[`file`,`raw`,`originFile`,`originFileObj`,`fileItem`,`item`,`data`])e[t]&&n.push(e[t]);for(let t of Object.values(e))t&&(typeof t==`object`||Array.isArray(t))&&n.push(t)}}}return null}function W(){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 V(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??t?.message??`图片上传失败`)}},n.click()}function G(){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 V(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??t?.message??`视频上传失败`)}},n.click()}let xe={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:W,video:G}}},placeholder:`请输入线路简介`};function Se(e){return(e||[]).length?(e||[]).join(`、`):`-`}function K(e,t){t&&(P.value=e,F.value=S(t),N.value=!0)}async function q(t){try{let n=U(t);if(!n)return e.warning(`未识别到上传文件`),!1;I.cover_image=await B(n),e.success(`封面上传成功`)}catch(t){e.error(t?.response?.data?.message??`封面上传失败`)}return!1}async function J(t){try{let n=U(t);if(!n)return e.warning(`未识别到上传文件`),!1;let r=await B(n);if(!r)return e.error(`上传成功但未返回可用地址`),!1;let i=n.type.startsWith(`video/`);I.gallery_media
|