Creativity.c0c4f945.js 10 KB

1
  1. import{z as X,g as Z,p as ee,y as Ie,E as m}from"./elementPlus.4833989a.js";import{d as Ve,B as Ce,ay as Le,r as n,j as ke,A as Ue,ai as r,aq as Ee,o as g,c as V,U as l,O as i,P as F,a as t,M as te,u as _,R as oe,S as le,aF as Ae,aG as De}from"./vue.adf17aba.js";import{u as se,d as ae,e as Ge}from"./index.0545ebb5.js";import{u as Se}from"./index.b098562c.js";import{e as p}from"./emitter.c27b7986.js";import Te from"./CropperLogo.646f85a1.js";import Pe from"./CropperImg.fff1aa5b.js";import je from"./CropperImg-628.8f888c8a.js";import{_ as Ne}from"./_plugin-vue_export-helper.c27b6911.js";import"./echarts.72dc8373.js";import"./vue-cropper.es.c79321c5.js";import"./lodash.d9f7faa7.js";const c=b=>(Ae("data-v-22711c91"),b=b(),De(),b),Fe={class:"customize-container"},ze=c(()=>t("div",{class:"custom-card-title"},[t("span",{class:"custom-card-icon"},"|"),t("span",{class:"custom-card-Text"},"创意")],-1)),Me={class:"main-container"},Oe={class:"left-container"},Be=c(()=>t("div",{style:{display:"flex","justify-content":"space-between"}},[t("p",{class:"left-part-title"},"请选择您想要自定义商品广告的方式")],-1)),Re={class:"demo-collapse"},Je={style:{display:"flex","margin-bottom":"5px"}},$e=c(()=>t("p",{style:{"font-weight":"700",color:"#1d2129","margin-right":"8px"}},"品牌标识",-1)),qe=["src"],He={class:"el-upload-list__item-actions"},Ye=["onClick"],Ke={style:{"margin-top":"10px"}},Qe=c(()=>t("div",{style:{display:"flex","align-items":"center","justify-content":"space-between"}},[t("span",{style:{"line-height":"17px","font-weight":"600",color:"#1e2128"}},"徽标要求")],-1)),We=c(()=>t("div",{class:"introduce-item"},"1、图片大小: 至少600x100 像素",-1)),Xe=c(()=>t("div",{class:"introduce-item"},"2、文件大小: 小于1MB",-1)),Ze={style:{display:"flex","justify-content":"space-between"}},et=c(()=>t("span",{class:"introduce-item"},"3、文件格式: PNG 或 JPG",-1)),tt={style:{"margin-left":"25px",position:"relative"}},ot=["src"],lt={style:{display:"flex"}},st={style:{display:"flex","align-items":"center","flex-direction":"row-reverse"}},at={style:{display:"flex","margin-bottom":"5px"}},it=c(()=>t("p",{style:{"font-weight":"700",color:"#1d2129","margin-right":"8px"}},"添加图片",-1)),nt=["src"],dt={class:"el-upload-list__item-actions"},rt=["onClick"],ct=c(()=>t("div",{style:{"margin-top":"10px"}},[t("div",{style:{display:"flex","align-items":"center","justify-content":"space-between"}},[t("span",{style:{"line-height":"17px","font-weight":"600",color:"#1e2128"}},"徽标要求")]),t("div",{class:"introduce-item"},"1、图片大小: 至少1200x628 像素"),t("div",{class:"introduce-item"},"2、文件大小: 小于5MB"),t("div",{class:"introduce-item"},"3、文件格式: PNG, JPEG 或GIF"),t("div",{class:"introduce-item"},"4、没有在图片上添加文字, 图形或徽标")],-1)),pt=["src"],ut=c(()=>t("div",{style:{display:"flex","margin-bottom":"5px"}},[t("p",{style:{"font-weight":"700",color:"#1d2129","margin-right":"8px"}},"628x628")],-1)),mt={class:"right-container"},_t={class:"preview-title-line"},ft=c(()=>t("p",{class:"right-part-title"},"广告预览",-1)),gt=Ve({__name:"Creativity",setup(b){const ie=Ce("respAdGroupId"),ne=Se(),{profile:v}=Le(ne),z=n([""]),h=n([]),C=n(!1),M=n(!1),L=n(!1),O=n("");n(!1);const de=n("");let y={left:0,top:0,width:0,height:0};p.on("send-logo-leftTop",o=>{y.left=o.left,y.top=o.top,y.width=o.width,y.height=o.height});function re(o){p.emit("logo-src",o.url),de.value=o.url;const e=new FileReader;e.readAsDataURL(o.raw),e.onload=d=>{const a=new Image;a.src=d.target.result,a.onload=()=>{p.emit("logo-data",a),a.width>=600&&a.height>=100?pe(o):(h.value=[],m.error("不符合尺寸要求"))}}}function B(){h.value=[]}function ce(o){O.value=o.url,L.value=!0}const k=n("");let R="",J="";const U=n(!1);async function pe(o){const e=new FormData;e.append("file",o.raw),e.append("profile_id",v.value.profile_id),e.append("brandEntityId",k.value),e.append("assetType","IMAGE"),e.append("assetSubTypeList",JSON.stringify(["LOGO"])),C.value=!0;try{const d=await se(e);J=d.data.third.versionId;const a=d.data.file_name,f={profile_id:v.value.profile_id,file_name:a},u=await ae(f);R=u.data.assetId,u.data.checkresult=="success"?m({message:"上传成功",type:"success"}):(h.value=[],m.error("上传失败"))}catch(d){console.error("上传失败:",d)}finally{C.value=!1}}const E=n(""),A=n(!1),I=n([]),D=n(!1),G=n(!1),S=n(!1),$=n("");let q="",H="",w={left:0,top:0,width:0,height:0},x={left:0,top:0,width:0,height:0};p.on("send-img-leftTop",o=>{w.left=o.left,w.top=o.top,w.width=o.width,w.height=o.height}),p.on("send-img628-leftTop",o=>{x.left=o.left,x.top=o.top,x.width=o.width,x.height=o.height});function ue(o){p.emit("img-src",o.url);const e=new FileReader;e.readAsDataURL(o.raw),e.onload=d=>{const a=new Image;a.src=d.target.result,a.onload=()=>{p.emit("img-data",a),a.width>=1200&&a.height>=628?_e(o):(I.value=[],m.error("不符合尺寸要求"))}}}function Y(){I.value=[]}function me(o){$.value=o.url,S.value=!0}async function _e(o){const e=new FormData;e.append("file",o.raw),e.append("profile_id",v.value.profile_id),e.append("brandEntityId",k.value),e.append("assetType","IMAGE"),e.append("assetSubTypeList",JSON.stringify(["LIFESTYLE_IMAGE","OTHER_IMAGE"])),D.value=!0;try{const d=await se(e);q=d.data.third.versionId;const a=d.data.file_name,f={profile_id:v.value.profile_id,file_name:a},u=await ae(f);H=u.data.assetId,u.data.checkresult=="success"?m({message:"上传成功",type:"success"}):m.error("上传失败")}catch(d){console.error("上传失败:",d)}finally{D.value=!1}}const T=n(!1);async function fe(){T.value=!0;const o={profile_id:v.value.profile_id,adGroupId:ie.value,properties_logo:U.value,properties_head:A.value,properties_custom:G.value,headline:E.value,brandLogo_assetId:R,brandLogo_assetVersion:J,brandLogo_croppingCoordinates:y,custom_assetId:H,custom_assetVersion:q,rectCustomImage_croppingCoordinates:w,squareCustomImage_croppingCoordinates:x};try{(await Ge(o)).data.result[0].code=="SUCCESS"?m({message:"创建成功",type:"success"}):m.error("上传失败")}catch(e){console.error("error:",e)}finally{T.value=!1}}const K=n("");return ke(()=>{p.on("send-brandEntityId",o=>{k.value=o.brandEntityId[0].brandEntityId})}),Ue(()=>{p.all.clear()}),(o,e)=>{const d=r("el-switch"),a=r("el-icon"),f=r("Link"),u=r("el-link"),Q=r("el-upload"),W=r("el-dialog"),P=r("el-collapse-item"),ge=r("el-input"),ve=r("el-divider"),he=r("el-collapse"),ye=r("el-scrollbar"),we=r("el-select"),xe=r("el-button"),be=r("el-card"),j=Ee("loading");return g(),V("div",Fe,[l(be,{"body-style":"padding: 20px 80px 0 80px;"},{default:i(()=>[ze,F((g(),V("div",Me,[t("div",Oe,[Be,l(ye,{height:"755px"},{default:i(()=>[t("div",Re,[l(he,{modelValue:z.value,"onUpdate:modelValue":e[10]||(e[10]=s=>z.value=s),style:{border:"none"}},{default:i(()=>[F((g(),te(P,{title:"徽标",name:"logo"},{default:i(()=>[t("div",Je,[$e,l(d,{modelValue:U.value,"onUpdate:modelValue":e[0]||(e[0]=s=>U.value=s),size:"small"},null,8,["modelValue"])]),l(Q,{"file-list":h.value,"onUpdate:fileList":e[2]||(e[2]=s=>h.value=s),"on-change":re,"on-remove":B,action:"#",accept:".png, .jpg",limit:1,"list-type":"picture-card","auto-upload":!1},{file:i(({file:s})=>[t("div",null,[t("img",{class:"el-upload-list__item-thumbnail",src:s.url,alt:""},null,8,qe),t("span",He,[t("span",{class:"el-upload-list__item-preview",onClick:N=>ce(s)},[l(a,null,{default:i(()=>[l(_(X))]),_:1})],8,Ye),M.value?oe("",!0):(g(),V("span",{key:0,class:"el-upload-list__item-delete",onClick:e[1]||(e[1]=N=>B())},[l(a,null,{default:i(()=>[l(_(Z))]),_:1})]))])])]),tip:i(()=>[t("div",Ke,[Qe,We,Xe,t("div",Ze,[et,t("span",tt,[l(a,{size:"14",style:{position:"absolute",left:"-15px",top:"6px"}},{default:i(()=>[l(f)]),_:1}),l(u,{type:"primary",underline:!1,href:"https://advertising.amazon.com/resources/ad-policy/sponsored-ads-policies#brandlogo",target:"_blank"},{default:i(()=>[le("查看要求 ")]),_:1})])])])]),default:i(()=>[l(a,null,{default:i(()=>[l(_(ee))]),_:1})]),_:1},8,["file-list"]),l(W,{modelValue:L.value,"onUpdate:modelValue":e[3]||(e[3]=s=>L.value=s)},{default:i(()=>[t("img",{"w-full":"",src:O.value,alt:"Preview Image"},null,8,ot)]),_:1},8,["modelValue"]),l(Te)]),_:1})),[[j,C.value]]),l(P,{title:"标题",name:"title"},{default:i(()=>[t("div",lt,[l(d,{modelValue:A.value,"onUpdate:modelValue":e[4]||(e[4]=s=>A.value=s),style:{"margin-right":"10px"}},null,8,["modelValue"]),l(ge,{modelValue:E.value,"onUpdate:modelValue":e[5]||(e[5]=s=>E.value=s),maxlength:"50","show-word-limit":"",placeholder:"Please input",type:"text"},null,8,["modelValue"])]),t("div",st,[l(u,{type:"primary",href:"https://advertising.amazon.com/resources/ad-policy/creative-acceptance#editorialguidelines",target:"_blank",underline:!1},{default:i(()=>[le(" 查看政策 ")]),_:1}),l(a,{size:"14",style:{"margin-right":"1px"}},{default:i(()=>[l(f)]),_:1})])]),_:1}),F((g(),te(P,{title:"图片",name:"image"},{default:i(()=>[t("div",null,[t("div",at,[it,l(d,{modelValue:G.value,"onUpdate:modelValue":e[6]||(e[6]=s=>G.value=s),size:"small"},null,8,["modelValue"])]),l(Q,{"file-list":I.value,"onUpdate:fileList":e[8]||(e[8]=s=>I.value=s),"on-change":ue,"on-remove":Y,action:"#",accept:".png, .jpeg, .gif",limit:1,"list-type":"picture-card","auto-upload":!1,style:{"margin-bottom":"8px"}},{file:i(({file:s})=>[t("div",null,[t("img",{class:"el-upload-list__item-thumbnail",src:s.url,alt:""},null,8,nt),t("span",dt,[t("span",{class:"el-upload-list__item-preview",onClick:N=>me(s)},[l(a,null,{default:i(()=>[l(_(X))]),_:1})],8,rt),M.value?oe("",!0):(g(),V("span",{key:0,class:"el-upload-list__item-delete",onClick:e[7]||(e[7]=N=>Y())},[l(a,null,{default:i(()=>[l(_(Z))]),_:1})]))])])]),tip:i(()=>[ct]),default:i(()=>[l(a,null,{default:i(()=>[l(_(ee))]),_:1})]),_:1},8,["file-list"]),l(W,{modelValue:S.value,"onUpdate:modelValue":e[9]||(e[9]=s=>S.value=s)},{default:i(()=>[t("img",{"w-full":"",src:$.value,alt:"Preview Image"},null,8,pt)]),_:1},8,["modelValue"]),l(Pe)]),l(ve,{"border-style":"dashed"}),ut,l(je)]),_:1})),[[j,D.value]])]),_:1},8,["modelValue"])])]),_:1})]),t("div",mt,[t("div",_t,[ft,l(we,{modelValue:K.value,"onUpdate:modelValue":e[11]||(e[11]=s=>K.value=s)},null,8,["modelValue"])]),l(xe,{style:{position:"absolute",bottom:"5px",right:"50%"},type:"primary",icon:_(Ie),circle:"",onClick:fe},null,8,["icon"])])])),[[j,T.value]])]),_:1})])}}});const Et=Ne(gt,[["__scopeId","data-v-22711c91"]]);export{Et as default};