2 lines
9.3 KiB
Java
2 lines
9.3 KiB
Java
var z=(C,m,l)=>new Promise((i,o)=>{var g=c=>{try{r(l.next(c))}catch(v){o(v)}},k=c=>{try{r(l.throw(c))}catch(v){o(v)}},r=c=>c.done?i(c.value):Promise.resolve(c.value).then(g,k);r((l=l.apply(C,m)).next())});import{e as G,r as h,h as H,o as N,d as $,C as y,z as u,Q as s,O,y as j,H as I,f as a,A as w,P as M,F as L,D as Y,u as d,K as J,J as Q,G as W,E as b}from"./vue-vendor-DNhG1Cve.js";import{B as X}from"./BasicForm-ClUSoD_-.js";import"./helper-DcLcf4v6.js";import{u as q}from"./useForm-D61zovon.js";import{f as Z,A as ee}from"./AiPainting-DUcOdYda.js";import te from"./ImageViewer-DC0qDdlD.js";import{a1 as se,aU as oe,aH as ae,d as P,s as ie,aX as ne,x as A,au as le}from"./index-X7Y8jykP.js";import"./index-BzChaRPg.js";import"./useAppInject-DPZGPcR3.js";import"./emoji-mart-vue-fast-R0uJEDq-.js";import"./BasicForm.vue_vue_type_style_index_0_lang-B29PWQy0.js";import"./index-DO7ZhK45.js";import"./index-ByCwbQDV.js";import"./index-Upeu4GGa.js";import"./index-C4wWpZeQ.js";import"./useTimeout-D5AmIBZw.js";import"./index-M9QP6cvf.js";import"./Skeleton-CimgOdM7.js";import"./useScrollTo-0FPEw5-K.js";import"./useIntersectionObserver-BGOgyKyu.js";import"./index-saD4h7VJ.js";import"./useBreakpoint-DXhPW7nV.js";import"./useEventListener-BRXjwk7A.js";import"./breakpointEnum-BhAg6bcX.js";import"./uniqBy--vsL0WVB.js";import"./index-BDvqZ5j4.js";import"./BasicModal-xH56XuRZ.js";import"./ModalHeader-Sr8KwhJJ.js";import"./useWindowSizeFn-C-0M9_Ul.js";import"./index-CuWaQdlK.js";const re={class:"ai-poster-page"},ce={class:"page-header"},pe={class:"content-wrapper"},me={class:"template-panel"},ue={class:"template-list"},de=["onClick"],ge={class:"template-cover"},ve=["src"],_e={class:"template-name"},fe={class:"config-panel"},he={class:"form-container"},ye={class:"action-container"},Ie={class:"preview-panel"},ke={class:"preview-content"},we={key:0,class:"empty-state"},Ae={key:1,class:"loading-state"},Te={key:2,class:"result-image-wrapper group"},be=["src"],Ce={class:"image-actions"},T="ai_poster_task_id",U="ai_poster_active_tab",Se=G({__name:"AiPoster",setup(C){const m=h(localStorage.getItem(U)||"poster");H(m,t=>localStorage.setItem(U,t));const{createMessage:l}=ie(),i=h(!1),o=h(""),g=h(!1),k=h(null);let r=null;const c=[{id:1,name:"淡雅政务风",prompt:"淡雅政务风横版海报,主色调浅蓝 + 米白 + 淡灰,扁平化矢量风格,叠加细腻宣纸纹理;画面核心元素:简约政务办公楼轮廓(线条简洁)、金色钢笔、展开的公文册、淡蓝色祥云纹样、橄榄枝装饰;背景是米白渐变 + 浅蓝竖条肌理,点缀细金色边框;文字设计:居中用黑体写‘政务为民・高效规范’,下方配‘用心服务・务实笃行’浅蓝小字;整体氛围淡雅庄重、专业简洁,层次分明,光影柔和,高清细节,竖版 9:16 构图",size:"720*1280",url:"https://upload.jeecg.com/jeecg/AI/simple.png"},{id:2,name:"节日海报",prompt:"国潮中国风春节竖版海报,主色调红金 + 暖橙渐变,国潮插画风格,矢量扁平 + 柔和渐变质感,叠加细腻宣纸纹理;画面层次:前景是红色剪纸风梅花、金色福字贴纸、饱满水饺、红色灯笼串,中景是红墙金瓦的传统民居屋檐、飘带式祥云,远景是淡金色烟花绽放 + 暖红色光晕背景;点缀金色铜钱纹、折纸兔子、如意纹样;画面中央偏上用金色书法字体写‘新春大吉’,下方配'万事如意'四字楷书;整体氛围喜庆祥和、团圆温馨,层次分明主次清晰,光影柔和不刺眼,高清细节,竖版 9:16 构图",url:"https://upload.jeecg.com/jeecg/AI/image89444392111.png",size:"720*1280"},{id:3,name:"科技宣传",prompt:"未来科技感宣传海报,主色调蓝紫渐变 + 银白金属色,冷光霓虹光效,赛博朋克线条质感;画面核心元素:全息投影的地球数据模型、流动的蓝色数据流、发光的电路板纹理、悬浮的芯片与机械齿轮、未来感建筑轮廓;点缀粒子光效、透明全息界面、霓虹光带;文字设计:居中用未来感无衬线字体写‘科技赋能・智启新程’,下方配‘创新驱动・引领未来’小字,字体带轻微发光描边;整体氛围简洁高级、充满未来感,层次分明,光影锐利,高清细节,横版 16:9 构图",size:"720*1280",url:"https://upload.jeecg.com/jeecg/AI/technology.png"},{id:4,name:"优雅复古",prompt:"民国风优雅复古竖版海报,主色调米黄 + 豆沙红 + 墨黑,低饱和度胶片质感,叠加老报纸纹理与轻微颗粒感;画面核心元素:穿月白旗袍的女性侧影(盘发配珍珠发簪)、油纸伞、复古留声机、雕花木质窗棂、缠绕珍珠的藤蔓花纹;背景是模糊的老上海石库门建筑轮廓,点缀淡粉色玉兰花、复古字体排版的诗句(‘岁月静好,温婉如初’);文字设计:上方用民国手写体写‘雅致时光’,下方配衬线字体‘复刻民国风雅’,字体带轻微做旧效果;整体氛围温婉知性、静谧典雅,光影柔和(侧光勾勒人物轮廓),层次分明,高清细节,竖版 9:16 构图",size:"720*1280",url:"https://upload.jeecg.com/jeecg/AI/retro.png"},{id:5,name:"赛博朋克",prompt:"国潮赛博朋克横版海报,主色调中国红 + 深空黑 + 鎏金霓虹,传统纹样与科技元素碰撞,叠加红金渐变光效 + 竹简纹理;画面核心元素:龙形霓虹光带(龙身缠绕电路板)、红墙金瓦的赛博风古建筑(屋檐挂霓虹灯笼)、穿汉服改良款的赛博人物(配发光发簪 / 机械袖)、全息投影的汉字霓虹灯牌(‘江湖’‘未来’);点缀祥云数据流、金属质感的传统回纹、悬浮的鎏金元宝状机械装置;文字设计:上方用金色书法字体写‘赛博江湖’,下方配‘TECH & TRADITION’英文,字体带红金霓虹发光效果;整体氛围大气炫酷、传统与未来交融,光影强烈且富有冲击力,层次分明,高清细节,横版 16:9 构图",size:"720*1280",url:"https://upload.jeecg.com/jeecg/AI/cyberpunk.png"}],{domainUrl:v}=se(),[B,{validate:K,setFieldsValue:V}]=q({schemas:Z,labelWidth:100,actionColOptions:{span:24},showActionButtonGroup:!1});function D(t){k.value=t.id,V({content:t.prompt,imageUrl:t.url,imageSize:t.size}),l.success(`已应用模板:${t.name}`)}function S(t){const e=()=>{P.get({url:`/airag/chat/getAiPosterResult/${t}`},{isTransformResponse:!1}).then(n=>{if(n.success)if(n.result==="pending"||n.result===null)r=setTimeout(e,3e3);else{let _=n.result;const f=/#\s*{\s*domainURL\s*}/g;_=_.replace(f,v+"/sys/common/static"),o.value=_,i.value=!1,localStorage.removeItem(T),l.success("海报生成成功!")}else i.value=!1,localStorage.removeItem(T),l.warning(n.message||"海报生成失败!")}).catch(()=>{r=setTimeout(e,3e3)})};e()}function E(){return z(this,null,function*(){try{const t=yield K();i.value=!0,o.value="",t.type="poster";const e=yield P.post({url:"/airag/chat/genAiPosterAsync",params:t},{isTransformResponse:!1});if(e.success&&e.result){const n=e.result;localStorage.setItem(T,n),S(n)}else i.value=!1,l.warning("提交任务失败!")}catch(t){i.value=!1}})}N(()=>{const t=localStorage.getItem(T);t&&(i.value=!0,o.value="",S(t))}),$(()=>{r&&(clearTimeout(r),r=null)});function R(){g.value=!0}function x(){if(!o.value)return;const t=document.createElement("a");t.href=o.value,t.download=`ai-poster-${Date.now()}.jpg`,t.target="_blank",t.click()}return(t,e)=>{const n=ne,_=oe,f=J("a-button"),F=ae;return u(),y("div",re,[s("div",ce,[a(_,{activeKey:m.value,"onUpdate:activeKey":e[0]||(e[0]=p=>m.value=p)},{default:w(()=>[a(n,{key:"poster",tab:"AI 海报"}),a(n,{key:"painting",tab:"AI 绘画"})]),_:1},8,["activeKey"])]),O(s("div",pe,[s("div",me,[e[2]||(e[2]=s("div",{class:"panel-title"},"模板选择",-1)),s("div",ue,[(u(),y(L,null,Y(c,p=>s("div",{key:p.id,class:Q(["template-item",{active:k.value===p.id}]),onClick:ze=>D(p)},[s("div",ge,[s("img",{src:p.url,style:{width:"100%"}},null,8,ve)]),s("div",_e,W(p.name),1)],10,de)),64))])]),s("div",fe,[e[4]||(e[4]=s("div",{class:"panel-title"},"参数配置",-1)),s("div",he,[a(d(X),{onRegister:d(B)},null,8,["onRegister"])]),s("div",ye,[a(f,{type:"primary",size:"large",block:"",onClick:E,loading:i.value},{default:w(()=>[a(d(A),{icon:"ant-design:thunderbolt-outlined"}),e[3]||(e[3]=b(" 立即生成 ",-1))]),_:1},8,["loading"])])]),s("div",Ie,[e[8]||(e[8]=s("div",{class:"panel-title"},"生成结果",-1)),s("div",ke,[!o.value&&!i.value?(u(),y("div",we,[a(d(A),{icon:"ant-design:picture-outlined",size:"64",color:"#ccc"}),e[5]||(e[5]=s("p",null,"在左侧配置参数并点击生成",-1))])):I("",!0),i.value&&!o.value?(u(),y("div",Ae,[a(F,{size:"large",tip:"正在绘制海报,请稍候..."})])):I("",!0),o.value?(u(),y("div",Te,[s("img",{src:o.value,class:"result-image",alt:"Generated Poster"},null,8,be),s("div",Ce,[a(f,{type:"primary",ghost:"",onClick:R},{default:w(()=>[a(d(A),{icon:"ant-design:eye-outlined"}),e[6]||(e[6]=b(" 预览 ",-1))]),_:1}),a(f,{type:"primary",ghost:"",onClick:x},{default:w(()=>[a(d(A),{icon:"ant-design:download-outlined"}),e[7]||(e[7]=b(" 下载 ",-1))]),_:1})])])):I("",!0)])])],512),[[M,m.value==="poster"]]),m.value==="painting"?(u(),j(ee,{key:0})):I("",!0),g.value?(u(),j(te,{key:1,imageUrl:o.value,onHide:e[1]||(e[1]=p=>g.value=!1)},null,8,["imageUrl"])):I("",!0)])}}}),nt=le(Se,[["__scopeId","data-v-41659509"]]);export{nt as default};
|