2 lines
4.6 KiB
JavaScript
2 lines
4.6 KiB
JavaScript
import{W as N,L as P,_ as $,k as W,P as E,o as V,c as f,l as p,ac as z,b as o,t as u,m as v,D as a,Y as F,r as l,an as K,j as w,q as U,a7 as O,E as Y,y as q,S as H,U as X}from"./index-CIAVq8iD-1776148658686.js";import{g as J}from"./imagePaths-Bi1Bwe4Z-1776148658686.js";import{c as Q}from"./appConnector-B5Pbaops-1776148658686.js";import{p as R}from"./imagePreloader-C_QM-Nv8-1776148658686.js";import{a as S}from"./toast-aIWCznBB-1776148658686.js";import{i as C}from"./itemCenter-DveKthYv-1776148658686.js";import{m as Z}from"./MaskLayer-CMaJd7Gb-1776148658686.js";const ee=async c=>{try{return await P(`/user-level/client/getByUserId?sysOrigin=ATYOU&userId=${c}`)}catch(s){throw console.error("Failed to fetch get user wealth level:",s),console.error("error:"+s.response.errorMsg),s}},te=async c=>{try{return await N("/user/beautiful-number/apply",c)}catch(s){throw console.error("Failed to fetch apply goodID:",s),console.error("error:"+s.response.errorMsg),s}},oe={class:"fullPage"},se={key:0,class:"loading-container"},re={key:1},ae=["src"],le={style:{height:"46%",display:"flex","justify-content":"center","align-items":"center"}},ne={style:{width:"50%",height:"30%",display:"flex","justify-content":"center","align-items":"center"}},ie={style:{"font-weight":"700","font-size":"0.9em",background:"linear-gradient(0deg, #fff 0%, #ffe656 100%)","background-clip":"text","-webkit-background-clip":"text","-webkit-text-fill-color":"transparent"}},ce={style:{position:"absolute",bottom:"22%",width:"79%",height:"30%",left:"50%",transform:"translateX(-50%)",display:"flex","justify-content":"space-between","align-items":"center",gap:"8px"}},de=["placeholder"],pe=["src"],ue=["src"],ge=["src"],ye=["src"],me={style:{position:"fixed",top:"50vh",display:"flex","justify-content":"center",width:"100vw"}},_e={style:{padding:"12px","border-radius":"8px",background:"rgba(0, 0, 0, 0.4)","font-weight":"600"}},he={__name:"index",setup(c){const{t:s,locale:fe}=W(),M=E(),B=H(()=>M.selectedLang?.type||"en"),b=l(!0),t=e=>J("GoodID/",e),g=e=>B.value==="ar"?`${e}_ar`:e,y=l("-"),n=l(""),m=l(!1),_=l(!1),k=l(""),I={4200:"error_wealth_level_insufficient",4201:"error_invalid_id_format",4202:"application_submitted_success",4203:"error_already_applied",4204:"error_id_already_used"},x=e=>{k.value=s(e),_.value=!0,setTimeout(()=>{_.value=!1},2e3)},D=async()=>{if(!n.value.trim())return;let e={account:n.value.trim(),wealthLevel:y.value};try{(await te(e)).status&&(n.value="",x("application_submitted_success"),L())}catch(r){const d=r.response?.errorCode;d in I?x(I[d]):S(r.errorMsg)}},T=async()=>{try{const e=await ee(X());e.status&&e.body&&(y.value=e.body?.wealthLevel||"-")}catch(e){S(e.errorMsg)}},L=()=>{T()},j=()=>{const e=[t("goodID0New"),t("goodID1"),t("goodID2"),t("help"),t("rule"),t("applyBg"),t(g("applyBt"))];return R(e)},A=async()=>{try{await Promise.all([L(),j()])}catch(e){console.error("预加载过程中发生错误:",e)}finally{b.value=!1}},G=async()=>{await Q(()=>{A()})};return V(()=>{G()}),(e,r)=>{const d=z,i=K("smart-img");return w(),f("div",oe,[b.value?(w(),f("div",se,[p(d),o("p",null,u(e.$t("loading"))+"...",1)])):(w(),f("div",re,[p(C,{imgUrl:t("goodID0New"),contentStyle:"display: block;"},{default:v(()=>[a(o("img",{src:t("help"),alt:"",style:{position:"absolute",top:"57%",right:"4%",display:"block",width:"10vw","aspect-ratio":"1/1","object-fit":"cover"},onClick:r[0]||(r[0]=h=>m.value=!0)},null,8,ae),[[i]]),p(C,{style:{position:"absolute",top:"65%"},imgUrl:t("applyBg"),contentStyle:"display: block;"},{default:v(()=>[o("div",le,[o("div",ne,[o("div",ie,u(U(s)("my_wealth_level"))+" "+u(y.value),1)])]),o("div",ce,[a(o("input",{"onUpdate:modelValue":r[1]||(r[1]=h=>n.value=h),type:"text",placeholder:U(s)("good_id_placeholder"),style:{flex:"1","min-width":"0","align-self":"stretch",color:"white","font-weight":"700","font-size":"1.1em",border:"none",outline:"none","background-color":"transparent"},onKeyup:O(D,["enter"])},null,40,de),[[Y,n.value]]),a(o("img",{src:t(g("applyBt")),alt:"",style:{height:"70%",display:"block"},onClick:D},null,8,pe),[[i]])])]),_:1},8,["imgUrl"])]),_:1},8,["imgUrl"]),a(o("img",{src:t("goodID1"),alt:"",style:{width:"100%",display:"block"}},null,8,ue),[[i]]),a(o("img",{src:t("goodID2"),alt:"",style:{width:"100%",display:"block"}},null,8,ge),[[i]]),p(Z,{maskLayerShow:m.value,onClick:r[3]||(r[3]=h=>m.value=!1)},{default:v(()=>[o("div",{style:{margin:"20% 0"},onClick:r[2]||(r[2]=q(()=>{},["stop"]))},[a(o("img",{src:t(g("rule")),alt:"",style:{display:"block",width:"100%"}},null,8,ye),[[i]])])]),_:1},8,["maskLayerShow"]),a(o("div",me,[o("div",_e,u(k.value),1)],512),[[F,_.value]])]))])}}},Le=$(he,[["__scopeId","data-v-4951c134"]]);export{Le as default};
|