猎羽广告

index.CzQ5Jy5v.js 8.6KB

12
  1. import{E as e,J as a,n as t,k as l,r as s,C as o,A as i,v as r,m as n,K as c,B as p,p as u}from"../element-plus/element-plus.DqqeXZzT.js";import{d,r as m,Y as g,E as h,L as _,c as v,a as f,T as y,K as w,ah as j,u as b,Q as k,o as C,U as S,a9 as z,J as W,a2 as x,S as E,ba as U,b8 as P,R as q,n as L}from"../@vue/@vue.lccsL1Mu.js";import{h as V,_ as A}from"../../assets/index-DYMYfyXS.js";import{A as D}from"../api/api.BtQEnbVN.js";import{t as M}from"../await-to-js/await-to-js.BuwTFY8y.js";import{a as R}from"../staticTools/staticTools.BUMUrNJJ.js";import{_ as T}from"../_popconfirm/_popconfirm.C2WlUwAw.js";import{b as N}from"../qrcode/qrcode.BKSz2tcB.js";import{_ as K}from"../lodash/lodash.S3QqMfIB.js";import"../lodash-es/lodash-es.LxYfApIs.js";import"../async-validator/async-validator.DSgsWN2H.js";import"../@vueuse/@vueuse.D2YafqsA.js";import"../dayjs/dayjs.D4rZQhfm.js";import"../axios/axios.CUN3se9v.js";import"../@ctrl/@ctrl.D2oWfImC.js";import"../@popperjs/@popperjs.D3lHDW-0.js";import"../escape-html/escape-html.J6B7JOz4.js";import"../normalize-wheel-es/normalize-wheel-es.Erkn7R64.js";import"../vue-router/vue-router.D86bYXwF.js";import"../pinia/pinia.DodrAXQg.js";import"../vue-demi/vue-demi.Dq6ymT-8.js";import"../pinia-plugin-persist/pinia-plugin-persist.Cjrd7Wf_.js";import"../@element-plus/@element-plus.BWbqilIf.js";import"../echarts/echarts.C_nC9ACL.js";import"../tslib/tslib.DduEQve-.js";import"../zrender/zrender.XYf_pgl8.js";import"../encode-utf8/encode-utf8.BpfgcHrw.js";import"../dijkstrajs/dijkstrajs.GSylJV2k.js";const I=e=>(U("data-v-ac7b5df2"),e=e(),P(),e),B={class:"page-wrap"},F={class:"flex_between select-wrap"},J={class:"filter-wrap"},Q={class:"filter-item"},G=I((()=>f("span",{class:"label"},"媒体账户:",-1))),Y={class:"filter-item"},H=I((()=>f("span",{class:"label"},"搜索:",-1))),O={class:"btns-wrap"},X=q("同步微信原生页"),Z={key:0},$={key:1},ee={key:0},ae=I((()=>f("span",{class:"pointer c-theme f12"},"删除",-1))),te=["src"],le={class:"qrCode-warp"},se=["src"],oe=I((()=>f("p",null,"请使用微信扫码",-1))),ie={key:2},re={key:0,class:"pagination-wrap"},ne=A(d({__name:"index",props:{isSelection:{type:Boolean,default:!1}},emits:["selectChange"],setup(d,{expose:U,emit:P}){const q=m(!1),A=m(!1),I=g({accValue:"",accountList:[],list:[],total:0,multipleSelection:[],descol:[{name:"原生页预览",column:"preview_url",minWidth:"80"},{name:"原生页名称",column:"page_name",minWidth:"150"},{name:"操作",column:"operate",minWidth:"60"},{name:"原生页id",column:"page_id",minWidth:"100"},{name:"顶部素材形式",column:"canvas_type_name",minWidth:"110"},{name:"所属媒体账户",column:"owner_uid",minWidth:"100"},{name:"媒体应用",column:"app_element_type",minWidth:"100"},{name:"应用平台",column:"app_element_id",minWidth:"100"},{name:"推广目标",column:"promoted_object_name",minWidth:"100"},{name:"更新时间",column:"last_modified_time",minWidth:"150"}]}),ne=g({account_id:"",keyword:"",page:1,page_size:20}),ce=m(-1),pe=m(),ue=a=>{var t;q.value=!0,(t={account_id:ne.account_id,keyword:ne.keyword,page:ne.page,page_size:ne.page_size},new Promise((async(a,l)=>{const s=await V.get("/api/adcreatives/wechatPagesList",t);0==s.errNo?a(s.rst):(e.error(s.errMsg),l())}))).then((e=>{q.value=!1,I.list=e.data,I.list.forEach((async e=>{try{const a=await N.toDataURL(e.preview_url);e.qrCodeDataUrl=a}catch(a){console.error("Error generating QR code:",a)}})),I.total=e.pageInfo.total,a&&a()})).catch((()=>{q.value=!1}))},de=a=>{var t;q.value=!0,(t={page_id:a.page_id},new Promise((async(a,l)=>{const s=await V.post("/api/adcreatives/wechatPagesDel",t);0==s.errNo?a(s.rst):(e.error(s.errMsg),l())}))).then((a=>{q.value=!1,ue(),e.success("删除成功!")})).catch((()=>{q.value=!1}))},me=()=>{ne.page=1,ne.account_id&&""!=ne.account_id?ue():(I.list=[],I.multipleSelection=[],I.total=0)},ge=()=>{ne.page=1,ue()},he=()=>{ne.account_id&&""!=ne.account_id?ue():e.warning("请选选择媒体账户!")},_e=()=>{var t;ne.account_id&&""!=ne.account_id?A.value||(A.value=!0,(t={account_id:ne.account_id},new Promise((async(a,l)=>{const s=await V.post("/api/adcreatives/flushWechatPages",t);0==s.errNo?a(s.rst):(e.error(s.errMsg),l())}))).then((t=>{t&&(ne.page=1,t.sync_record_id?(a({message:"同步中,请稍后...",duration:0}),ve(t.sync_record_id)):(A.value=!1,e.warning("同步结果获取失败,请稍后再试!")))})).catch((()=>{A.value=!1}))):e.warning("请选选择媒体账户!")},ve=t=>{var l;(l={sync_record_id:t},new Promise((async(a,t)=>{const s=await V.get("/api/adcreatives/getFlushWechatPagesRes",l);0==s.errNo?a(s.rst):(e.error(s.errMsg),t())}))).then((l=>{1==l.status?(A.value=!1,a.closeAll(),ue((()=>{e.success("同步成功")}))):2==l.status?(A.value=!1,a.closeAll(),e.error("同步失败!")):0==l.status&&setTimeout((()=>{ve(t)}),2e3)})).catch((()=>{A.value=!1,a.closeAll()}))},fe=e=>{ne.page=e,ue()},ye=e=>{I.multipleSelection=e,P("selectChange",I.multipleSelection)},we=e=>!!I.multipleSelection.map((e=>e.page_id)).includes(e.page_id)||!(I.multipleSelection?.length>=ce.value&&-1!=ce.value),je=e=>{e.length>ce.value&&-1!=ce.value&&(e.length=ce.value),I.multipleSelection=e,P("selectChange",I.multipleSelection)};h((()=>{(async()=>{const[a,t]=await M(V.get(D.account_listToSelect));if(t&&"0"==t.errNo){let e=[],a=[];t.rst.forEach((t=>{e.includes(t.account_name)||(e.push(t.account_name),a.push({label:t.account_name,childs:[]}))})),t.rst.forEach((e=>{a.forEach((a=>{a.label==e.account_name&&a.childs.push(e)}))})),I.accountList=a}else e.error(t.errMsg)})()}));const be=(e,a,t)=>{L((()=>{e&&e.length>0&&I.list&&I.list.length>0?e.forEach((e=>{pe.value?.toggleRowSelection(I.list.find((a=>a.page_id==e.page_id)),a)})):pe.value?.clearSelection(),t&&t()}))};return U({exposeGetList:async(e,a,t)=>{ce.value=t||0,e&&(ne.account_id=e,ne.page=1,ue((()=>{let e=K.cloneDeep(a);-1!=t&&a.length>t&&e.splice(0,t),be(I.multipleSelection,!1,(()=>{be(e,!0)}))})))}}),(e,a)=>{const m=n,g=c,h=t,U=l,P=s,L=p,V=u,D=o,M=i,N=r;return _((C(),v("div",B,[f("div",F,[f("div",J,[f("div",Q,[G,y(h,{modelValue:ne.account_id,"onUpdate:modelValue":a[0]||(a[0]=e=>ne.account_id=e),filterable:!0,"collapse-tags":"","collapse-tags-tooltip":"",style:{width:"220px"},placeholder:"请选择媒体账户",onChange:me},{default:w((()=>[(C(!0),v(S,null,z(I.accountList,(e=>(C(),W(g,{key:e.label,label:e.label},{default:w((()=>[(C(!0),v(S,null,z(e.childs,(e=>(C(),W(m,{key:e.account_id,label:e.account_id,value:e.account_id},null,8,["label","value"])))),128))])),_:2},1032,["label"])))),128))])),_:1},8,["modelValue"])]),f("div",Y,[H,y(P,{class:"w-200",modelValue:ne.keyword,"onUpdate:modelValue":a[1]||(a[1]=e=>ne.keyword=e),modelModifiers:{trim:!0},placeholder:"请输入",clearable:"",onKeyup:j(x(ge,["prevent","stop"]),["enter","native"]),onClear:ge},{append:w((()=>[y(U,{icon:"Search",onClick:ge})])),_:1},8,["modelValue","onKeyup"])]),f("span",{class:"pointer c-theme",onClick:he},"刷新")]),f("div",O,[y(U,{type:"primary",size:"default",loading:A.value,onClick:a[2]||(a[2]=e=>_e())},{default:w((()=>[X])),_:1},8,["loading"])])]),y(D,{ref_key:"multipleTableRef",ref:pe,size:"default","row-key":"page_id",data:I.list,border:"",height:"calc(100vh - 210px)","header-row-style":{color:"#161E46","font-weight":400},"header-cell-style":b(R),"cell-style":{color:"#333"},onSelectionChange:ye,onSelectAll:je},{empty:w((()=>[ne.account_id&&""!=ne.account_id?(C(),v("span",Z,"暂无数据")):(C(),v("span",$,"请先选择媒体账户,再进行查询微信原生页"))])),default:w((()=>[d.isSelection?(C(),W(L,{key:0,align:"center",type:"selection","reserve-selection":"",selectable:we,width:"55",fixed:"left"})):k("",!0),(C(!0),v(S,null,z(I.descol,(e=>(C(),W(L,{align:"center",prop:e.column,label:e.name,"min-width":e.minWidth},{default:w((({row:a})=>["operate"==e.column?(C(),v("span",ee,[y(T,{key:"dele",onConfirm:e=>de(a),slotFlag:!0},{con:w((()=>[ae])),_:2},1032,["onConfirm"])])):"preview_url"==e.column?(C(),W(V,{key:1,placement:"right",width:300,trigger:"hover"},{reference:w((()=>[f("img",{src:a.qrCodeDataUrl,class:"qrCodeImg",alt:""},null,8,te)])),default:w((()=>[f("div",le,[f("img",{src:a.qrCodeDataUrl,alt:""},null,8,se),oe])])),_:2},1024)):(C(),v("span",ie,E(a[e.column]),1))])),_:2},1032,["prop","label","min-width"])))),256))])),_:1},8,["data","header-cell-style"]),ne.account_id&&""!=ne.account_id?(C(),v("div",re,[y(M,{"current-page":ne.page,"onUpdate:current-page":a[3]||(a[3]=e=>ne.page=e),"page-size":ne.page_size,"onUpdate:page-size":a[4]||(a[4]=e=>ne.page_size=e),small:!1,total:I.total,background:"",layout:"total, prev, pager, next",onCurrentChange:fe},null,8,["current-page","page-size","total"])])):k("",!0)])),[[N,q.value]])}}}),[["__scopeId","data-v-ac7b5df2"]]);export{ne as default};