chatapp-h5/h5/js/ItemDistribution-BkI7ZxQu-1776148658686.js
2026-04-14 17:58:21 +08:00

2 lines
4.9 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import{_ as G,k as B,o as N,c as f,b as o,l as I,q as i,F as L,x as C,D as S,Y as R,n as D,m as U,r as a,S as z,j as g,Q as F,t as v,y as j,E as O}from"./index-CIAVq8iD-1776148658686.js";import{s as W,b as $}from"./toast-aIWCznBB-1776148658686.js";import{c as q,d as H,e as Q}from"./bdCenter-Dx55XoC5-1776148658686.js";import{s as Y}from"./userInfo-gLO2xl8i-1776148658686.js";import{G as J}from"./GeneralHeader-ClI1i1Ud-1776148658686.js";import{m as K}from"./MaskLayer-CMaJd7Gb-1776148658686.js";const X={class:"fullPage"},Z={class:"bg"},ee={style:{display:"flex","justify-content":"space-around","background-color":"transparent",position:"relative"}},te=["onClick"],se={style:{width:"100%",display:"grid","grid-template-columns":"repeat(2, 1fr)",gap:"12px",padding:"15px"}},oe=["onClick"],ae={style:{"background-color":"white","border-radius":"10px","box-shadow":"0px 0px 3px 1px rgba(0, 0, 0, 0.2)",display:"flex","flex-direction":"column","align-items":"center"}},ne=["src"],re={style:{"background-color":"#bb92ff",color:"white","margin-bottom":"10px",border:"0","border-radius":"20px",padding:"5px 10px"}},le=["src"],ie={style:{"font-weight":"600",margin:"10px 0"}},ce={style:{color:"#00000080","margin-right":"10px"}},de={style:{"font-weight":"700",color:"#000"}},ue={style:{width:"90%",display:"flex","justify-content":"center","align-items":"center",gap:"4px"}},pe=["placeholder"],fe={__name:"ItemDistribution",setup(ge){const{t:n,locale:P}=B(),c=a([]),d=a(0),h=a("frames"),m=a([]),r=a(!0),A=e=>{d.value!=e&&(console.log("切换标签"),y.value=[],d.value=e,h.value=c.value[e].name,w())},x=z(()=>{console.log("计算属性");const e=P.value;if(console.log("当前语言:",e),m.value.length===0)return{};const t=m.value[d.value];return console.log("选中元素的左边距",t.offsetLeft),{position:"absolute",left:`${t.offsetLeft+t.offsetWidth/2-15/2}px`,bottom:"0",transition:"left 0.3s ease"}}),u=a(""),M=async()=>{const e=await q();console.log("response:",e);const t=e.body,s=[],l=t.some(b=>b.startsWith("NOBLE_VIP"));return t.includes("AVATAR_FRAME")&&s.push({id:1,name:"frames"}),t.includes("RIDE")&&s.push({id:2,name:"vehicles"}),l&&s.push({id:3,name:"vip"}),c.value=s,s.length>0&&(d.value=0,h.value=s[0].name),s},T=async()=>{if(r.value){r.value=!1,console.log("赠送用户id",u.value),console.log("赠送商品:",p.value);try{const e=await Y(u.value);if(console.log("targetUserInfo:",e),e.status&&e.body){const t={propsId:p.value.id,acceptUserId:e.body.id},s=await Q(t);s.errorCode==0&&s.status?(k(),W(n("gift_delivery_successful"))):r.value=!0}else r.value=!0}catch(e){throw console.log("error:",e),$(e.response.errorMsg),r.value=!0,e}}},E=()=>({frames:"AVATAR_FRAME",vehicles:"RIDE",vip:"NOBLE_VIP"})[h.value],w=async()=>{try{const e={propsType:E(),currencyType:"GOLD"},t=await H(e);console.log("response:",t),y.value=t.body}catch(e){throw e}},y=a([]),p=a({}),_=a(!1),V=e=>{console.log("product:",e),p.value=e,_.value=!0},k=()=>{r.value=!0,p.value={},u.value="",_.value=!1};return N(async()=>{console.log("onMounted"),await M(),m.value.length>0&&x.value,c.value.length>0&&w()}),(e,t)=>(g(),f("div",X,[o("div",Z,[I(J,{showLanguageList:!0,title:i(n)("item_distribution"),color:"black"},null,8,["title"]),o("div",ee,[(g(!0),f(L,null,C(c.value,(s,l)=>(g(),f("div",{key:l,style:{"font-size":"1.3em",padding:"10px 0",flex:"1","text-align":"center"},class:F(["tab-item",d.value==l?"tabName-active":"tabName"]),ref_for:!0,ref_key:"tabItems",ref:m,onClick:b=>A(l)},v(i(n)(s.name)),11,te))),128)),S(o("div",{style:D([{width:"15px",height:"3px","background-color":"#bb92ff"},x.value])},null,4),[[R,c.value.length>0]])]),o("div",se,[(g(!0),f(L,null,C(y.value,(s,l)=>(g(),f("div",{key:l,onClick:b=>V(s)},[o("div",ae,[o("img",{src:s.cover,alt:"",style:{width:"60%",margin:"10px 0"}},null,8,ne),o("button",re,v(i(n)("send")),1)])],8,oe))),128))]),I(K,{maskLayerShow:_.value,onClick:k},{default:U(()=>[o("div",{style:{padding:"20px","background-color":"white",display:"flex","flex-direction":"column","align-items":"center","border-radius":"20px",margin:"20% 5%"},onClick:t[1]||(t[1]=j(()=>{},["stop"]))},[o("img",{src:p.value.cover,alt:"",style:{width:"60%",margin:"5px 0"}},null,8,le),o("div",ie,[o("span",ce,v(i(n)("validity"))+":",1),o("span",de,"3"+v(i(n)("day")),1)]),o("div",ue,[S(o("input",{type:"text",placeholder:i(n)("enter_user_id_placeholder"),style:{flex:"1","min-width":"0","align-self":"stretch","border-radius":"8px",border:"0",outline:"none","background-color":"#f1f1f1b2",padding:"8px","margin-right":"4px","font-size":"1em","font-weight":"590"},"onUpdate:modelValue":t[0]||(t[0]=s=>u.value=s)},null,8,pe),[[O,u.value]]),o("button",{style:D([{width:"auto","min-width":"0","align-self":"stretch","border-radius":"8px",border:"0",padding:"8px",color:"white","font-size":"1em","font-weight":"590"},{backgroundColor:r.value?"#bb92ff":"#00000080"}]),onClick:T},v(i(n)("confirm")),5)])])]),_:1},8,["maskLayerShow"])])]))}},xe=G(fe,[["__scopeId","data-v-91d8e30e"]]);export{xe as default};