test_lgq/niucloud/public/admin/assets/form-f191ae42.js
2024-01-24 17:36:08 +08:00

2 lines
7.9 KiB
JavaScript

import{d as I,q as N,n as R,s as A,ax as H,h as m,c,x as U,u as _,F,a as r,R as S,e,I as K,w as o,G as L,B as O,aa as T,r as B,i as V,t as D,N as j,W,X,az as Y,aA as J,as as M,aF as Q,cK as Z,aH as ee,E as te,Y as le,$ as oe}from"./index-4dcc0234.js";/* empty css *//* empty css *//* empty css *//* empty css *//* empty css */import{_ as ae}from"./index.vue_vue_type_script_setup_true_lang-d9adee77.js";/* empty css *//* empty css *//* empty css *//* empty css *//* empty css *//* empty css */import{_ as ie}from"./index.vue_vue_type_style_index_0_lang-cd8f78e9.js";/* empty css */import{_ as ne}from"./attachment-c69dd9fd.js";import{_ as se}from"./index.vue_vue_type_style_index_0_lang-5c6c00d9.js";import{_ as re}from"./index.vue_vue_type_script_setup_true_lang-9285296e.js";import{_ as de}from"./index-742b412a.js";/* empty css */import"./el-form-item-4ed993c7.js";/* empty css *//* empty css *//* empty css *//* empty css *//* empty css *//* empty css */import"./el-tooltip-4ed993c7.js";/* empty css *//* empty css *//* empty css *//* empty css */import"./sys-8ead7f22.js";/* empty css */const me={class:"flex flex-wrap"},ue={class:"w-full h-full relative flex items-center overflow-hidden rounded"},pe=["src"],ce={class:"absolute z-[1] flex items-center justify-center w-full h-full inset-0 bg-black bg-opacity-60 operation"},_e={class:"w-full h-full flex items-center justify-center flex-col"},fe={class:"w-full h-full relative flex items-center overflow-hidden rounded"},ve=["src"],ge={class:"absolute z-[1] flex items-center justify-center w-full h-full inset-0 bg-black bg-opacity-60 operation"},be={class:"w-full h-full flex items-center justify-center flex-col"},xe=I({__name:"index",props:{modelValue:{type:String,default:""},width:{type:String,default:"200px"},height:{type:String,default:"100px"},limit:{type:Number,default:1}},emits:["update:modelValue"],setup(f,{emit:w}){const v=f,l=N({get(){return v.modelValue},set(s){w("update:modelValue",s)}}),i=R({data:[]});A(()=>l.value,()=>{i.data=[...l.value.split(",").filter(s=>s)],t()});const y=N(()=>({width:v.width,height:v.height})),h=s=>{v.limit==1?(i.data.splice(0,1),s&&i.data.push(s.url)):s.forEach(u=>{i.data.length<v.limit&&i.data.push(u.url)}),t()},g=(s=0)=>{i.data.splice(s,1),t()},t=()=>{l.value=H(i.data).toString()},d=R({visible:!1,src:""}),n=(s=0)=>{d.visible=!0,d.src=S(i.data[s])};return(s,u)=>{const p=re,k=se,E=ne,C=T;return m(),c("div",me,[f.limit==1?(m(),c("div",{key:0,class:"rounded cursor-pointer relative bg-page video-wrap mr-[10px]",style:U(_(y))},[i.data.length?(m(),c(F,{key:0},[r("div",ue,[r("video",{src:_(S)(i.data[0]),class:"w-full"},null,8,pe),r("div",ce,[e(p,{name:"iconfont-icon24gf-playCircle",color:"#fff",size:"25px",onClick:u[0]||(u[0]=b=>n())})])]),e(p,{name:"element-CircleCloseFilled",color:"#bbb",size:"18px",onClick:g,class:"absolute z-[2] top-[-9px] right-[-9px]"})],64)):(m(),K(k,{key:1,limit:f.limit,type:"video",onConfirm:h},{default:o(()=>[r("div",_e,[e(p,{name:"iconfont-icon24gf-playCircle",size:"25px",color:"var(--el-text-color-secondary)"})])]),_:1},8,["limit"]))],4)):(m(),c(F,{key:1},[(m(!0),c(F,null,L(i.data,(b,x)=>(m(),c("div",{class:"rounded cursor-pointer relative bg-page video-wrap mr-[10px]",style:U(_(y)),key:x},[r("div",fe,[r("video",{src:_(S)(b),class:"w-full"},null,8,ve),r("div",ge,[e(p,{name:"iconfont-icon24gf-playCircle",color:"#fff",size:"25px",onClick:z=>n(x)},null,8,["onClick"])])]),e(p,{name:"element-CircleCloseFilled",color:"#bbb",size:"18px",onClick:z=>g(x),class:"absolute z-[2] top-[-9px] right-[-9px]"},null,8,["onClick"])],4))),128)),i.data.length<f.limit?(m(),c("div",{key:0,class:"rounded cursor-pointer relative bg-page video-wrap mr-[10px]",style:U(_(y))},[e(k,{limit:f.limit,type:"video",onConfirm:h},{default:o(()=>[r("div",be,[e(p,{name:"iconfont-icon24gf-playCircle",size:"25px",color:"var(--el-text-color-secondary)"})])]),_:1},8,["limit"])],4)):O("",!0)],64)),e(C,{modelValue:d.visible,"onUpdate:modelValue":u[1]||(u[1]=b=>d.visible=b),width:"50%","align-center":"","destroy-on-close":!0,"custom-class":"video-preview"},{default:o(()=>[e(E,{src:d.src,width:"100%"},null,8,["src"])]),_:1},8,["modelValue"])])}}});const Ve={class:"main-container"},ye=r("div",{class:"form-tip"},"管理员账号登录时使用",-1),we={class:"input-width"},he={class:"input-width"},ke={class:"input-width"},Ce={class:"fixed-footer-wrap"},$e={class:"fixed-footer"},st=I({__name:"form",setup(f){const w=B(!1),l=R({...{text:"",radio:1,textarea:"",img:"",video:"",file:"",select:"",date:"",editor:"",date_range:"",sort:0}}),i=B(),y=N(()=>({})),h=async g=>{w.value||!g||await g.validate(async t=>{t&&console.log(l)})};return(g,t)=>{const d=W,n=X,s=Y,u=J,p=de,k=xe,E=ie,C=M,b=Q,x=Z,z=ae,P=ee,$=te,G=le,q=oe;return m(),c("div",Ve,[e(q,{class:"box-card !border-none",shadow:"never"},{default:o(()=>[e(G,{model:l,"label-width":"90px",ref_key:"formRef",ref:i,rules:_(y),class:"page-form"},{default:o(()=>[e(n,{label:"文本",prop:"text"},{default:o(()=>[e(d,{modelValue:l.text,"onUpdate:modelValue":t[0]||(t[0]=a=>l.text=a),placeholder:"请输入用户名",clearable:"",class:"input-width"},null,8,["modelValue"]),ye]),_:1}),e(n,{label:"单选",prop:"radio"},{default:o(()=>[e(u,{modelValue:l.radio,"onUpdate:modelValue":t[1]||(t[1]=a=>l.radio=a)},{default:o(()=>[e(s,{label:1},{default:o(()=>[V("男")]),_:1}),e(s,{label:0},{default:o(()=>[V("女")]),_:1})]),_:1},8,["modelValue"])]),_:1}),e(n,{label:"图片上传",prop:"img"},{default:o(()=>[e(p,{modelValue:l.img,"onUpdate:modelValue":t[2]||(t[2]=a=>l.img=a),limit:1},null,8,["modelValue"])]),_:1}),e(n,{label:"视频上传",prop:"video"},{default:o(()=>[e(k,{modelValue:l.video,"onUpdate:modelValue":t[3]||(t[3]=a=>l.video=a),limit:1},null,8,["modelValue"])]),_:1}),e(n,{label:"文件上传",prop:"video"},{default:o(()=>[r("div",we,[e(E,{modelValue:l.file,"onUpdate:modelValue":t[4]||(t[4]=a=>l.file=a)},null,8,["modelValue"])])]),_:1}),e(n,{label:"文本域",prop:"textarea"},{default:o(()=>[e(d,{modelValue:l.textarea,"onUpdate:modelValue":t[5]||(t[5]=a=>l.textarea=a),type:"textarea",rows:"5",class:"input-width"},null,8,["modelValue"])]),_:1}),e(n,{label:"下拉选择",prop:"select"},{default:o(()=>[e(b,{modelValue:l.select,"onUpdate:modelValue":t[6]||(t[6]=a=>l.select=a),placeholder:"请选择角色",class:"input-width"},{default:o(()=>[e(C,{label:"管理员",value:"shanghai"}),e(C,{label:"收银员",value:"beijing"})]),_:1},8,["modelValue"])]),_:1}),e(n,{label:"日期选择",prop:"date"},{default:o(()=>[r("div",he,[e(x,{modelValue:l.date,"onUpdate:modelValue":t[7]||(t[7]=a=>l.date=a),type:"date",placeholder:"Pick a date"},null,8,["modelValue"])])]),_:1}),e(n,{label:"日期区间",prop:"date_range"},{default:o(()=>[r("div",ke,[e(x,{modelValue:l.date_range,"onUpdate:modelValue":t[8]||(t[8]=a=>l.date_range=a),type:"daterange",placeholder:"Pick a date"},null,8,["modelValue"])])]),_:1}),e(n,{label:"富文本",prop:"editor"},{default:o(()=>[e(z,{modelValue:l.editor,"onUpdate:modelValue":t[9]||(t[9]=a=>l.editor=a)},null,8,["modelValue"])]),_:1}),e(n,{label:"排序",prop:"editor"},{default:o(()=>[e(P,{modelValue:l.sort,"onUpdate:modelValue":t[10]||(t[10]=a=>l.sort=a),min:0},null,8,["modelValue"])]),_:1}),e(n,{label:""},{default:o(()=>[e($,{type:"primary",loading:w.value,onClick:t[11]||(t[11]=a=>h(i.value))},{default:o(()=>[V("保存")]),_:1},8,["loading"]),e($,null,{default:o(()=>[V("返回")]),_:1})]),_:1})]),_:1},8,["model","rules"])]),_:1}),r("div",Ce,[r("div",$e,[e($,{type:"primary"},{default:o(()=>[V(D(_(j)("save")),1)]),_:1}),e($,null,{default:o(()=>[V(D(_(j)("cancel")),1)]),_:1})])])])}}});export{st as default};