2 lines
3.7 KiB
JavaScript
2 lines
3.7 KiB
JavaScript
|
|
var j=Object.defineProperty,E=Object.defineProperties;var G=Object.getOwnPropertyDescriptors;var M=Object.getOwnPropertySymbols;var H=Object.prototype.hasOwnProperty,J=Object.prototype.propertyIsEnumerable;var q=(i,l,n)=>l in i?j(i,l,{enumerable:!0,configurable:!0,writable:!0,value:n}):i[l]=n,h=(i,l)=>{for(var n in l||(l={}))H.call(l,n)&&q(i,n,l[n]);if(M)for(var n of M(l))J.call(l,n)&&q(i,n,l[n]);return i},y=(i,l)=>E(i,G(l));var o=(i,l,n)=>new Promise((f,t)=>{var c=u=>{try{m(n.next(u))}catch(p){t(p)}},v=u=>{try{m(n.throw(u))}catch(p){t(p)}},m=u=>u.done?f(u.value):Promise.resolve(u.value).then(c,v);m((n=n.apply(i,l)).next())});import{q as Q,_ as T,d as U,a as W,e as X}from"./form.vue_vue_type_script_setup_true_lang-Ch3nypJv.js";import{n as a,b as A,r as F,aK as Y,ag as Z,aA as r}from"./index-CRmU-Qpi.js";import"./index.vue_vue_type_script_setup_true_lang-8Iz1Oohf.js";import"./index-An8nOBwL.js";function ce(){const i=a(),l=a(!0),n=a([]),f=a(!1),t=a({total:0,pageSize:10,pageSizes:[10,20,50,100],currentPage:1,background:!0}),c=a({search_name:"",show_type:"",etime:""});a([]);const v=a([{label:"标题",prop:"search_name",type:"input"},{label:"广告位置",prop:"show_type",type:"select",optionList:[{label:"引导页",value:1},{label:"启动页",value:2},{label:"首页轮播图",value:3},{label:"房间首页",value:4}]},{label:"到期时间",prop:"etime",type:"date"}]),u=a([{type:"index",index:s=>s+1},{label:"广告名称",prop:"name"},{label:"广告位置",prop:"show_type_str"},{label:"广告类型",prop:"type_str"},{label:"广告链接",prop:"aid"},{label:"对应跳转链接",prop:"url"},{label:"开始时间",prop:"stime"},{label:"到期时间",prop:"etime"},{label:"广告图片",prop:"image",cellRenderer:({row:s})=>A(F("el-image"),{fit:"cover","preview-teleported":!0,src:s.image,"preview-src-list":Array.of(s.image),class:"w-[40px] h-[40px] align-middle"},null)},{label:"状态",prop:"show_status",cellRenderer:({row:s})=>A(F("el-tag"),{type:s.show_status===1?"success":"info"},{default:()=>[s.show_status===1?"正常":"隐藏"]})},{label:"操作",fixed:"right",width:210,slot:"operation"}]),p=s=>o(this,null,function*(){l.value=!0,c.value=h({},s);const{data:e,code:g}=yield Q(y(h({},s),{pageNum:t.value.currentPage,pageSize:t.value.pageSize}));g&&(n.value=e.lists,t.value.total=e.totalRow,t.value.currentPage=e.pageNumber),l.value=!1});return{searchForm:c,searchLabel:v,onSearch:p,isShow:f,tableList:n,tableLabel:u,pagination:t,handleSizeChange:s=>{t.value.pageSize=s,p(c.value)},handleCurrentChange:s=>{t.value.currentPage=s,p(c.value)},loading:l,openDialog:(s="新增",e)=>{var g,_,S,x,C,z,R,L,N,k,P;Y({title:`${s}广告`,props:{formInline:{name:(g=e==null?void 0:e.name)!=null?g:"",show_type:(_=e==null?void 0:e.show_type)!=null?_:"",type:(S=e==null?void 0:e.type)!=null?S:"",aid:(x=e==null?void 0:e.aid)!=null?x:"",url:(C=e==null?void 0:e.url)!=null?C:"",stime:(z=e==null?void 0:e.stime)!=null?z:"",etime:(R=e==null?void 0:e.etime)!=null?R:"",image:(L=e==null?void 0:e.image)!=null?L:"",show_status:(N=e==null?void 0:e.show_status)!=null?N:"",remarks:(k=e==null?void 0:e.remarks)!=null?k:"",content:(P=e==null?void 0:e.content)!=null?P:""}},width:"40%",closeOnClickModal:!1,contentRenderer:()=>Z(T,{ref:i,formInline:null}),beforeSure:(B,{options:K})=>{const O=i.value.getRef(),I=K.props.formInline,V=d=>o(this,null,function*(){const{code:b}=yield W(d);b?(r("新增成功",{type:"success"}),p(c.value),B()):r("新增失败",{type:"error"})}),$=d=>o(this,null,function*(){const{code:b}=yield X(y(h({},d),{id:e.id}));b?(r("修改成功",{type:"success"}),p(c.value),B()):r("修改失败",{type:"error"})});O.validate(d=>{d&&(s==="新增"?V(I):$(I))})}})},handleDelete:s=>o(this,null,function*(){const{code:e}=yield U({id:s.id});e&&(r("删除成功",{type:"success"}),p(c.value))})}}export{ce as useData};
|