2 lines
3.7 KiB
JavaScript
2 lines
3.7 KiB
JavaScript
import{_ as x,k as w,I as b,o as k,c as f,l as I,q as i,b as t,F as U,x as A,K as C,r as _,j as d,G as E,m as P,t as l,am as y}from"./index-CIAVq8iD-1776148658686.js";import{s as j,a as c,b as G}from"./toast-aIWCznBB-1776148658686.js";import{h}from"./imageHandler-DstQGL3Z-1776148658686.js";import{c as z}from"./teamBill-BWXvrc1S-1776148658686.js";import{G as B}from"./GeneralHeader-ClI1i1Ud-1776148658686.js";import{G as N}from"./GradientBorder-CfwSeIMB-1776148658686.js";const T={class:"message"},D={style:{padding:"16px",position:"relative","z-index":"2"}},M={style:{display:"flex","flex-direction":"column",gap:"12px"}},R={style:{padding:"12px",display:"flex","align-items":"center","justify-content":"space-between"}},S={class:"user-info",style:{width:"calc(100% - 110px)"}},$={style:{width:"50px",height:"50px","border-radius":"25px","background-color":"#8b5cf6",display:"flex","align-items":"center","justify-content":"center",color:"white","font-size":"20px","font-weight":"600",overflow:"hidden",position:"relative"}},L=["src","alt"],q={style:{width:"70%"}},F={style:{"margin-bottom":"4px","font-weight":"700",overflow:"hidden","text-overflow":"ellipsis","white-space":"nowrap"}},V={style:{display:"flex","align-items":"center"}},W={style:{"font-size":"0.8em","font-weight":"500",color:"rgba(0, 0, 0, 0.4)"}},H={class:"action-buttons",style:{display:"flex",gap:"4px"}},J=["onClick"],K=["onClick"],O={__name:"Message",setup(Q){const{t:a,locale:p}=w();p.value&&b(p.value);const u=_(!1),n=_([]);Array(3).fill().map((s,e)=>({id:`123456789${e}`,name:`User${e+1}`,avatar:"",type:"team_join_request"}));const v=async()=>{u.value=!0;try{const s=await z(C(),"WAIT");s.status&&s.body&&(n.value=s.body.map(e=>({id:e.id,reason:e.reason,teamId:e.teamId,status:e.status,createTime:e.createTime,userId:e.createUserProfile.id,account:e.createUserProfile.account,name:e.createUserProfile.userNickname,avatar:e.createUserProfile.userAvatar,userSex:e.createUserProfile.userSex,age:e.createUserProfile.age,countryName:e.createUserProfile.countryName,countryCode:e.createUserProfile.countryCode})))}catch(s){console.error("获取消息失败:",s)}finally{u.value=!1}},g=async s=>{try{if((await y({id:s.id,status:"AGREE"})).status){j(a("approved_application",{name:s.name}));const o=n.value.findIndex(r=>r.id===s.id);o>-1&&n.value.splice(o,1)}else c(a("operation_failed"))}catch(e){console.error("同意申请失败:",e),c(a("operation_failed"))}},m=async s=>{try{if((await y({id:s.id,status:"REJECT"})).status){G(a("rejected_application",{name:s.name}));const o=n.value.findIndex(r=>r.id===s.id);o>-1&&n.value.splice(o,1)}else c(a("operation_failed"))}catch(e){console.error("拒绝申请失败:",e),c(a("operation_failed"))}};return k(()=>{v()}),(s,e)=>(d(),f("div",T,[I(B,{showLanguageList:!0,title:i(a)("users_message"),color:"black"},null,8,["title"]),t("div",D,[t("div",M,[(d(!0),f(U,null,A(n.value,o=>(d(),E(N,{key:o.id,style:{}},{default:P(()=>[t("div",R,[t("div",S,[t("div",$,[t("img",{src:o.avatar||"",alt:o.name,style:{width:"100%",height:"100%",display:"block","object-fit":"cover"},onError:e[0]||(e[0]=(...r)=>i(h)&&i(h)(...r))},null,40,L)]),t("div",q,[t("h4",F,l(o.name||i(a)("unknown_user")),1),t("div",null,[t("div",V,[e[1]||(e[1]=t("p",{style:{"font-size":"0.8em","font-weight":"500",color:"rgba(0, 0, 0, 0.4)"}},"ID",-1)),e[2]||(e[2]=t("p",{style:{"font-size":"0.8em","font-weight":"500",color:"rgba(0, 0, 0, 0.4)",margin:"0 2px"}}," : ",-1)),t("p",W,l(o.account||o.userId),1)])])])]),t("div",H,[t("button",{class:"agree-btn",onClick:r=>g(o)},l(i(a)("agree")),9,J),t("button",{class:"refuse-btn",onClick:r=>m(o)},l(i(a)("refuse")),9,K)])])]),_:2},1024))),128))])])]))}},oe=x(O,[["__scopeId","data-v-8a2b99fb"]]);export{oe as default};
|