test_lgq/niucloud/public/admin/assets/edit-graphic-nav-a00e292e.js

2 lines
9.5 KiB
JavaScript
Raw Normal View History

2024-01-24 17:36:08 +08:00
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:"gr