test_lgq/niucloud/public/admin/assets/edit-graphic-nav-a00e292e.js
2024-01-24 17:36:08 +08:00

2 lines
9.5 KiB
JavaScript

import{d as F,N as o,s as G,R,r as I,v as M,D as P,h as v,c as V,y as _,z as g,u as e,a as r,t as p,e as t,w as a,i as s,F as y,G as B,b as W,az as D,aA as L,X as $,W as H,Y as j,E as A,cD as O,cE as X,_ as Y}from"./index-4dcc0234.js";/* empty css *//* empty css *//* empty css *//* empty css *//* empty css */import"./el-tooltip-4ed993c7.js";/* empty css */import{_ as q}from"./index.vue_vue_type_script_setup_true_lang-9285296e.js";import{_ as J}from"./index-742b412a.js";/* empty css */import{_ as K}from"./index.vue_vue_type_script_setup_true_lang-a631d3b2.js";import"./el-form-item-4ed993c7.js";/* empty css */import{S as Q}from"./sortable.esm-be94e56d.js";import{u as Z}from"./diy-06b37a1b.js";import{r as ee}from"./range-72f9cbd3.js";const le={class:"content-wrap"},te={class:"edit-attr-item-wrap"},oe={class:"mb-[10px]"},ae={class:"edit-attr-item-wrap"},ie={class:"mb-[10px]"},ne={class:"text-sm text-gray-400 mb-[10px]"},de=["onClick"],pe={class:"style-wrap"},me={class:"edit-attr-item-wrap"},se={class:"mb-[10px]"},re={class:"edit-attr-item-wrap"},ue={class:"mb-[10px]"},ce=F({__name:"edit-graphic-nav",setup(ge,{expose:S}){const l=Z();l.editComponent.ignore=[],l.editComponent.verify=u=>{const i={code:!0,message:""};return l.value[u].list.forEach(d=>{if((l.value[u].mode==="graphic"||l.value[u].mode==="img")&&d.imageUrl==="")return i.code=!1,i.message=o("imageUrlTip"),i;if((l.value[u].mode==="graphic"||l.value[u].mode==="text")&&d.title==="")return i.code=!1,i.message=o("graphicNavTitlePlaceholder"),i}),i},l.editComponent.list.forEach(u=>{u.id||(u.id=l.generateRandom())}),G(()=>l.editComponent.list,(u,i)=>{l.editComponent.list.forEach(d=>{const c=new Image;c.src=R(d.imageUrl),c.onload=async()=>{d.imgWidth=c.width,d.imgHeight=c.height}})},{deep:!0});const U=()=>{l.editComponent.list.push({id:l.generateRandom(),title:"",imageUrl:"",imgWidth:0,imgHeight:0,link:{name:""},label:{control:!1,text:"热门",textColor:"#FFFFFF",bgColorStart:"#F83287",bgColorEnd:"#FE3423"}})},x=I();return M(()=>{P(()=>{const u=Q.create(x.value,{group:"item-wrap",animation:200,onEnd:i=>{const d=l.editComponent.list[i.oldIndex];l.editComponent.list.splice(i.oldIndex,1),l.editComponent.list.splice(i.newIndex,0,d),u.sort(ee(l.editComponent.list.length).map(c=>c.toString()))}})})}),S({}),(u,i)=>{const d=D,c=L,m=$,h=H,w=K,f=j,T=J,k=q,z=A,C=O,N=X;return v(),V(y,null,[_(r("div",le,[r("div",te,[r("h3",oe,p(e(o)("graphicNavModeTitle")),1),t(f,{"label-width":"90px",class:"px-[10px]"},{default:a(()=>[t(m,{label:e(o)("layoutMode")},{default:a(()=>[t(c,{modelValue:e(l).editComponent.layout,"onUpdate:modelValue":i[0]||(i[0]=n=>e(l).editComponent.layout=n)},{default:a(()=>[t(d,{label:"horizontal"},{default:a(()=>[s(p(e(o)("layoutModeHorizontal")),1)]),_:1}),t(d,{label:"vertical"},{default:a(()=>[s(p(e(o)("layoutModeVertical")),1)]),_:1})]),_:1},8,["modelValue"])]),_:1},8,["label"]),t(m,{label:e(o)("graphicNavTitle")},{default:a(()=>[t(h,{modelValue:e(l).editComponent.navTitle,"onUpdate:modelValue":i[1]||(i[1]=n=>e(l).editComponent.navTitle=n),placeholder:e(o)("graphicNavTitlePlaceholder"),clearable:"",maxlength:"20","show-word-limit":""},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),t(m,{label:e(o)("subGraphicNavTitle")},{default:a(()=>[t(h,{modelValue:e(l).editComponent.subNavTitle,"onUpdate:modelValue":i[2]||(i[2]=n=>e(l).editComponent.subNavTitle=n),placeholder:e(o)("subGraphicNavTitlePlaceholder"),clearable:"",maxlength:"20","show-word-limit":""},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),t(m,{label:e(o)("subGraphicNavTitleLink")},{default:a(()=>[t(w,{modelValue:e(l).editComponent.subNavTitleLink,"onUpdate:modelValue":i[3]||(i[3]=n=>e(l).editComponent.subNavTitleLink=n)},null,8,["modelValue"])]),_:1},8,["label"]),t(m,{label:e(o)("graphicNavSelectMode")},{default:a(()=>[t(c,{modelValue:e(l).editComponent.mode,"onUpdate:modelValue":i[4]||(i[4]=n=>e(l).editComponent.mode=n)},{default:a(()=>[t(d,{label:"graphic"},{default:a(()=>[s(p(e(o)("graphicNavModeGraphic")),1)]),_:1}),t(d,{label:"img"},{default:a(()=>[s(p(e(o)("graphicNavModeImg")),1)]),_:1}),t(d,{label:"text"},{default:a(()=>[s(p(e(o)("graphicNavModeText")),1)]),_:1})]),_:1},8,["modelValue"])]),_:1},8,["label"]),_(r("view",null,[t(m,{label:e(o)("graphicNavShowStyle")},{default:a(()=>[t(c,{modelValue:e(l).editComponent.showStyle,"onUpdate:modelValue":i[5]||(i[5]=n=>e(l).editComponent.showStyle=n)},{default:a(()=>[t(d,{label:"fixed"},{default:a(()=>[s(p(e(o)("graphicNavStyleFixed")),1)]),_:1}),t(d,{label:"singleSlide"},{default:a(()=>[s(p(e(o)("graphicNavStyleSingleSlide")),1)]),_:1}),t(d,{label:"pageSlide"},{default:a(()=>[s(p(e(o)("graphicNavStylePageSlide")),1)]),_:1})]),_:1},8,["modelValue"])]),_:1},8,["label"]),t(m,{label:e(o)("graphicNavRowCount")},{default:a(()=>[t(c,{modelValue:e(l).editComponent.rowCount,"onUpdate:modelValue":i[6]||(i[6]=n=>e(l).editComponent.rowCount=n)},{default:a(()=>[t(d,{label:3},{default:a(()=>[s("3"+p(e(o)("piece")),1)]),_:1}),t(d,{label:4},{default:a(()=>[s("4"+p(e(o)("piece")),1)]),_:1}),t(d,{label:5},{default:a(()=>[s("5"+p(e(o)("piece")),1)]),_:1})]),_:1},8,["modelValue"])]),_:1},8,["label"]),t(m,{label:e(o)("graphicNavPageCount")},{default:a(()=>[t(c,{modelValue:e(l).editComponent.pageCount,"onUpdate:modelValue":i[7]||(i[7]=n=>e(l).editComponent.pageCount=n)},{default:a(()=>[t(d,{label:1},{default:a(()=>[s("1"+p(e(o)("line")),1)]),_:1}),t(d,{label:2},{default:a(()=>[s("2"+p(e(o)("line")),1)]),_:1})]),_:1},8,["modelValue"])]),_:1},8,["label"])],512),[[g,e(l).editComponent.layout=="horizontal"]])]),_:1})]),r("div",ae,[r("h3",ie,p(e(o)("graphicNavSetLabel")),1),t(f,{"label-width":"90px",class:"px-[10px]"},{default:a(()=>[r("p",ne,p(e(o)("graphicNavTips")),1),r("div",{ref_key:"imageBoxRef",ref:x},[(v(!0),V(y,null,B(e(l).editComponent.list,(n,E)=>(v(),V("div",{key:n.id,class:"item-wrap !cursor-move p-[10px] pb-0 relative border border-dashed border-gray-300 mb-[16px]"},[_(t(m,{label:e(o)("image")},{default:a(()=>[t(T,{modelValue:n.imageUrl,"onUpdate:modelValue":b=>n.imageUrl=b,limit:1},null,8,["modelValue","onUpdate:modelValue"])]),_:2},1032,["label"]),[[g,e(l).editComponent.mode==="graphic"||e(l).editComponent.mode==="img"]]),_(t(m,{label:e(o)("graphicNavTitle")},{default:a(()=>[t(h,{modelValue:n.title,"onUpdate:modelValue":b=>n.title=b,placeholder:e(o)("graphicNavTitlePlaceholder"),clearable:"",maxlength:"20","show-word-limit":""},null,8,["modelValue","onUpdate:modelValue","placeholder"])]),_:2},1032,["label"]),[[g,e(l).editComponent.mode==="graphic"||e(l).editComponent.mode==="text"]]),_(r("div",{class:"del absolute cursor-pointer z-[2] top-[-8px] right-[-8px]",onClick:b=>e(l).editComponent.list.splice(E,1)},[t(k,{name:"element-CircleCloseFilled",color:"#bbb",size:"20px"})],8,de),[[g,e(l).editComponent.list.length>1]]),t(m,{label:e(o)("link")},{default:a(()=>[t(w,{modelValue:n.link,"onUpdate:modelValue":b=>n.link=b},null,8,["modelValue","onUpdate:modelValue"])]),_:2},1032,["label"])]))),128))],512),_(t(z,{class:"w-full",onClick:U},{default:a(()=>[s(p(e(o)("addGraphicNav")),1)]),_:1},512),[[g,e(l).editComponent.list.length<10]])]),_:1})])],512),[[g,e(l).editTab=="content"]]),_(r("div",pe,[_(r("div",me,[r("h3",se,p(e(o)("graphicNavImageSet")),1),t(f,{"label-width":"90px",class:"px-[10px]"},{default:a(()=>[t(m,{label:e(o)("graphicNavImageSize")},{default:a(()=>[t(C,{modelValue:e(l).editComponent.imageSize,"onUpdate:modelValue":i[8]||(i[8]=n=>e(l).editComponent.imageSize=n),"show-input":"",size:"small",class:"ml-[10px] graphic-nav-slider",min:20,max:60},null,8,["modelValue"])]),_:1},8,["label"]),t(m,{label:e(o)("graphicNavAroundRadius")},{default:a(()=>[t(C,{modelValue:e(l).editComponent.aroundRadius,"onUpdate:modelValue":i[9]||(i[9]=n=>e(l).editComponent.aroundRadius=n),"show-input":"",size:"small",class:"ml-[10px] graphic-nav-slider",max:50},null,8,["modelValue"])]),_:1},8,["label"])]),_:1})],512),[[g,["graphic","img"].includes(e(l).editComponent.mode)]]),_(r("div",re,[r("h3",ue,p(e(o)("textSet")),1),t(f,{"label-width":"90px",class:"px-[10px]"},{default:a(()=>[t(m,{label:e(o)("textFontSize")},{default:a(()=>[t(C,{modelValue:e(l).editComponent.font.size,"onUpdate:modelValue":i[10]||(i[10]=n=>e(l).editComponent.font.size=n),"show-input":"",size:"small",class:"ml-[10px] graphic-nav-slider",min:12,max:16},null,8,["modelValue"])]),_:1},8,["label"]),t(m,{label:e(o)("textFontWeight")},{default:a(()=>[t(c,{modelValue:e(l).editComponent.font.weight,"onUpdate:modelValue":i[11]||(i[11]=n=>e(l).editComponent.font.weight=n)},{default:a(()=>[t(d,{label:"normal"},{default:a(()=>[s(p(e(o)("fontWeightNormal")),1)]),_:1}),t(d,{label:"bold"},{default:a(()=>[s(p(e(o)("fontWeightBold")),1)]),_:1})]),_:1},8,["modelValue"])]),_:1},8,["label"]),t(m,{label:e(o)("textColor")},{default:a(()=>[t(N,{modelValue:e(l).editComponent.font.color,"onUpdate:modelValue":i[12]||(i[12]=n=>e(l).editComponent.font.color=n),"show-alpha":"",predefine:e(l).predefineColors},null,8,["modelValue","predefine"])]),_:1},8,["label"]),t(m,{label:e(o)("subTextColor")},{default:a(()=>[t(N,{modelValue:e(l).editComponent.subNavColor,"onUpdate:modelValue":i[13]||(i[13]=n=>e(l).editComponent.subNavColor=n),"show-alpha":"",predefine:e(l).predefineColors},null,8,["modelValue","predefine"])]),_:1},8,["label"])]),_:1})],512),[[g,["graphic","text"].includes(e(l).editComponent.mode)]]),W(u.$slots,"style",{},void 0,!0)],512),[[g,e(l).editTab=="style"]])],64)}}});const _e=Y(ce,[["__scopeId","data-v-f89bbb11"]]),Ge=Object.freeze(Object.defineProperty({__proto__:null,default:_e},Symbol.toStringTag,{value:"Module"}));export{Ge as _};