2 lines
23 KiB
JavaScript
2 lines
23 KiB
JavaScript
import{r as y,c as de,o as ve,a as ke,L as we,D as re,b as v,z as r,d as e,i as N,p as I,G as se,F as E,B as L,t as f,q as ue,n as oe,C as V,_ as ge,k as me,s as fe,H as he,e as qe,A as $e,u as Ce}from"./index-DGJ6dnLh.js";import{g as be,c as Y,u as ce,d as _e,e as Re,f as Ie}from"./tournament-DhC9_tfq.js";const xe={class:"tournament-bracket-root"},Ue={class:"container"},Se={class:"control-panel"},Ne={class:"tournament-info"},Ve=["value"],De={key:0},Ee={id:"player-list"},Me={key:0,class:"loading"},Be={key:1,class:"loading"},Pe={key:2},Te={key:0},Fe=["disabled"],ze={key:0,id:"finalRanking"},Le={class:"bracket-container",id:"bracketContainer"},Ae={class:"bracket",id:"bracket"},Qe={class:"round-title"},Ge=["id"],Oe=["onUpdate:modelValue","disabled","placeholder"],He=["onUpdate:modelValue","disabled","placeholder"],Xe=["disabled","onClick"],je={__name:"TournamentBracket",props:{tournamentId:{type:Number,required:!0}},emits:["refreshPlayers"],setup(Z,{emit:A}){const S=Z,M=y([]),R=y(""),c=y(""),p=y([]),k=y(!1),D=y(null),m=y({id:S.tournamentId,name:"",participants:[],rounds:0,matches:[]}),X=de(()=>R.value&&p.value.length>=2),x=de(()=>{const s=[];for(let i=1;i<=m.value.rounds;i++)s.push(m.value.matches.filter(_=>_.round===i));return s});ve(()=>{$()});const $=async()=>{try{const s=await be();M.value=s}catch(s){console.error("获取比赛列表失败:",s)}},Q=async()=>{if(!R.value){c.value="",p.value=[],m.value.id=null,m.value.name="",m.value.participants=[];return}const s=M.value.find(i=>i.id===R.value);if(s){c.value=s.name,m.value.id=R.value,m.value.name=s.name,k.value=!0;try{const _=(await Y()).filter(o=>o.tournament_id==R.value);p.value=_.map(o=>({id:o.id,name:o.sign_name})),m.value.participants=p.value}catch(i){console.error("获取参赛者失败:",i)}finally{k.value=!1}}},j=()=>{X.value&&(D.value=null,J(),re(()=>B()))},J=async()=>{m.value.matches=[],m.value.rounds=Math.ceil(Math.log2(m.value.participants.length));const s=Math.pow(2,m.value.rounds),i=[...m.value.participants].sort(()=>Math.random()-.5),o=(await Y()).filter(d=>d.tournament_id==m.value.id);for(;i.length<s;)i.push(null);const a=s/2;for(let d=0;d<a;d++){const w=i[d*2],h=i[d*2+1];let U=null,C=!1;w&&!h?(U=w,C=!0):!w&&h?(U=h,C=!0):!w&&!h&&(U=null,C=!0);const T=w?o.find(P=>P.id===w.id):null,F=h?o.find(P=>P.id===h.id):null;m.value.matches.push({id:`1-${d+1}`,round:1,matchNumber:d+1,participant1:w,participant2:h,winner:U,score1:C&&U===w?1:(T==null?void 0:T.win)||0,score2:C&&U===h?1:(F==null?void 0:F.win)||0,decided:C})}for(let d=2;d<=m.value.rounds;d++){const w=s/Math.pow(2,d);for(let h=0;h<w;h++)m.value.matches.push({id:`${d}-${h+1}`,round:d,matchNumber:h+1,participant1:null,participant2:null,participant1Resolved:!1,participant2Resolved:!1,winner:null,score1:null,score2:null,decided:!1})}const u=m.value.matches.filter(d=>d.round===1);for(const d of u)d.decided&&O(d)},B=()=>{try{const s=document.getElementById("bracketLines"),i=document.getElementById("bracket");if(!i||!s)return;s.innerHTML="";const _=i.getBoundingClientRect(),o={};document.querySelectorAll(".match").forEach(a=>{const u=a.id.replace("match-","");o[u]=a}),m.value.matches.forEach(a=>{if(a.round===m.value.rounds||!a.decided)return;const u=a.round+1,d=Math.floor((a.matchNumber-1)/2)+1,w=`${u}-${d}`,h=o[w],U=o[a.id];if(!h||!U)return;const C=a.winner.id===(a.participant1&&a.participant1.id)?1:2,T=U.getBoundingClientRect(),F=h.getBoundingClientRect(),P=T.right-_.left,ee=T.top-_.top+(C===1?20:50),te=F.left-_.left,W=F.top-_.top+(a.matchNumber%2===1?20:50),H=document.createElementNS("http://www.w3.org/2000/svg","path");H.setAttribute("stroke","#666"),H.setAttribute("fill","none"),H.setAttribute("stroke-width","2");const ne=(P+te)/2,le=`M${P},${ee} L${ne},${ee} L${ne},${W} L${te},${W}`;H.setAttribute("d",le),s.appendChild(H)})}catch(s){console.warn("drawConnections error:",s)}};ke(()=>{const s=document.getElementById("bracketLines");s&&(s.innerHTML="")});const G=A;async function K(s){const i=Number(s.score1),_=Number(s.score2);if(isNaN(i)||isNaN(_)){alert("请输入有效的比分");return}if(i===_){alert("比分不能平局");return}s.score1=i,s.score2=_,s.winner=i>_?s.participant1:s.participant2,s.decided=!0,O(s),re(()=>B()),s.round===m.value.rounds&&b();const o=s.participant1,a=s.participant2;try{if(o&&a){const u=await Y(),d=u.find(C=>C.id===o.id),w=u.find(C=>C.id===a.id),h={tournament_id:m.value.id,tournament_name:m.value.name,team_name:o.team_name||"",sign_name:o.name||o.sign_name||"",win:String(Number((d==null?void 0:d.win)||0)+i),lose:String(Number((d==null?void 0:d.lose)||0)+_),status:i>_?"win":"lose",qq_code:o.qq_code||o.qq||""},U={tournament_id:m.value.id,tournament_name:m.value.name,team_name:a.team_name||"",sign_name:a.name||a.sign_name||"",win:String(Number((w==null?void 0:w.win)||0)+_),lose:String(Number((w==null?void 0:w.lose)||0)+i),status:_>i?"win":"lose",qq_code:a.qq_code||a.qq||""};await ce(o.id,h),await ce(a.id,U),await Q(),p.value=[...p.value],m.value.participants=[...p.value]}}catch(u){alert("更新数据失败"),console.error(u)}G("refreshPlayers")}const O=s=>{if(!s.decided){console.warn("updateNextRound called on non-decided match",s);return}if(s.round===m.value.rounds)return;const i=s.round+1,_=Math.floor((s.matchNumber-1)/2),o=m.value.matches.find(u=>u.round===i&&u.matchNumber===_+1);if(!o){console.error("Could not find next match for",s);return}if((s.matchNumber-1)%2===0?(o.participant1=s.winner,o.participant1Resolved=!0):(o.participant2=s.winner,o.participant2Resolved=!0),o.participant1Resolved&&o.participant2Resolved){const u=o.participant1,d=o.participant2;u&&!d?(o.winner=u,o.score1=1,o.score2=0,o.decided=!0):!u&&d?(o.winner=d,o.score1=0,o.score2=1,o.decided=!0):!u&&!d?(o.winner=null,o.score1=0,o.score2=0,o.decided=!0):u&&d?(o.winner=null,o.score1=null,o.score2=null,o.decided=!1):(console.warn("Unexpected state in updateNextRound for nextMatch:",o),o.decided=!1),o.decided&&O(o)}},b=()=>{const s=m.value.matches.find(u=>u.round===m.value.rounds);if(!s||!s.winner)return;const i=s.winner,_=s.participant1&&s.participant2?s.winner.id===s.participant1.id?s.participant2:s.participant1:null;let o=m.value.matches.filter(u=>u.round===m.value.rounds-1),a=[];o.forEach(u=>{if(u.decided&&u.winner){const d=u.participant1&&u.participant1.id!==u.winner.id?u.participant1:u.participant2;d&&a.push(d)}}),D.value={champion:i.name,runnerUp:_?_.name:"未知",thirdPlace:a.length>0?a[0].name:"未知"}};return we(x,()=>{re(()=>B())}),(s,i)=>(r(),v("div",xe,[i[8]||(i[8]=e("h1",null,"单败淘汰赛赛程树状图",-1)),e("div",Ue,[e("div",Se,[i[4]||(i[4]=e("h2",null,"选择比赛",-1)),e("div",Ne,[I(e("select",{"onUpdate:modelValue":i[0]||(i[0]=_=>R.value=_),onChange:Q},[i[1]||(i[1]=e("option",{value:""},"-- 请选择比赛 --",-1)),(r(!0),v(E,null,L(M.value,_=>(r(),v("option",{key:_.id,value:_.id},f(_.name),9,Ve))),128))],544),[[se,R.value]]),R.value?(r(),v("div",De,[i[2]||(i[2]=e("strong",null,"已选择:",-1)),ue(" "+f(c.value),1)])):N("",!0)]),i[5]||(i[5]=e("h2",null,"参赛者列表",-1)),e("div",Ee,[R.value?k.value?(r(),v("div",Be,"加载中...")):(r(),v("div",Pe,[p.value.length===0?(r(),v("p",Te,"暂无参赛者")):(r(),v(E,{key:1},[e("p",null,"共 "+f(p.value.length)+" 位参赛者",1),e("ul",null,[(r(!0),v(E,null,L(p.value,_=>(r(),v("li",{key:_.id},f(_.name),1))),128))])],64))])):(r(),v("div",Me,"请先选择比赛"))]),i[6]||(i[6]=e("h2",null,"生成赛程",-1)),e("button",{onClick:j,disabled:!X.value},"生成单败淘汰赛程",8,Fe),D.value?(r(),v("div",ze,[i[3]||(i[3]=e("h3",null,"最终排名",-1)),e("p",null,"冠军: "+f(D.value.champion),1),e("p",null,"亚军: "+f(D.value.runnerUp),1),e("p",null,"季军: "+f(D.value.thirdPlace),1)])):N("",!0)]),e("div",Le,[e("div",Ae,[(r(!0),v(E,null,L(x.value,(_,o)=>(r(),v("div",{key:o,class:"round"},[e("div",Qe,"第 "+f(o+1)+" 轮",1),(r(!0),v(E,null,L(_,a=>(r(),v("div",{key:a.id,class:"match",id:"match-"+a.id},[e("div",{class:oe(["participant",{winner:a.winner&&a.participant1&&a.winner.id===a.participant1.id}])},[ue(f(a.participant1?a.participant1.name:"轮空")+" ",1),I(e("input",{type:"number",min:"0",class:"score-input","onUpdate:modelValue":u=>a.score1=u,disabled:a.decided||!a.participant1||!a.participant2,placeholder:a.participant1&&a.participant1.win||"0"},null,8,Oe),[[V,a.score1,void 0,{number:!0}]])],2),e("div",{class:oe(["participant",{winner:a.winner&&a.participant2&&a.winner.id===a.participant2.id}])},[ue(f(a.participant2?a.participant2.name:"轮空")+" ",1),I(e("input",{type:"number",min:"0",class:"score-input","onUpdate:modelValue":u=>a.score2=u,disabled:a.decided||!a.participant1||!a.participant2,placeholder:a.participant2&&a.participant2.win||"0"},null,8,He),[[V,a.score2,void 0,{number:!0}]])],2),e("button",{class:"score-btn",disabled:a.decided||!a.participant1||!a.participant2,onClick:u=>K(a)}," 确认比分 ",8,Xe)],8,Ge))),128))]))),128))]),i[7]||(i[7]=e("svg",{class:"bracket-lines",id:"bracketLines"},null,-1))])])]))}},Ye={class:"rank-contestant"},Je={class:"rank-content"},Ke={class:"top-three"},We={class:"rank-number"},Ze={class:"player-info"},et={class:"player-name"},tt={class:"player-faction"},nt={class:"player-score"},at={class:"rank-list"},st={class:"rank"},ot={class:"player-info"},lt={class:"player-name"},it={class:"player-faction"},rt={class:"player-score"},ut={__name:"RankContestant",props:{tournamentId:{type:Number,required:!0}},setup(Z){const A=Z,S=y([]),M=async()=>{try{const c=(await Y()).filter(p=>p.tournament_id===A.tournamentId).map((p,k)=>({rank:k+1,username:p.sign_name,faction:p.faction,win:parseInt(p.win)||0,lose:parseInt(p.lose)||0,score:`${p.win}胜${p.lose}负`})).sort((p,k)=>k.win!==p.win?k.win-p.win:p.lose-k.lose).map((p,k)=>({...p,rank:k+1}));S.value=c}catch(R){console.error("获取排名数据失败:",R)}};return ve(()=>{M()}),(R,c)=>(r(),v("div",Ye,[c[0]||(c[0]=e("div",{class:"rank-contestant-header"},[e("h2",null,"选手排名")],-1)),e("div",Je,[e("div",Ke,[(r(!0),v(E,null,L(S.value.slice(0,3),(p,k)=>(r(),v("div",{key:k,class:"rank-card"},[e("div",We,f(p.rank),1),e("div",Ze,[e("div",et,f(p.username),1),e("div",tt,f(p.faction),1),e("div",nt,f(p.score),1)])]))),128))]),e("div",at,[(r(!0),v(E,null,L(S.value.slice(3),(p,k)=>(r(),v("div",{key:k+3,class:"rank-item"},[e("div",st,f(p.rank),1),e("div",ot,[e("div",lt,f(p.username),1),e("div",it,f(p.faction),1),e("div",rt,f(p.score),1)])]))),128))])])]))}},dt=ge(ut,[["__scopeId","data-v-60f15c9c"]]),ct={class:"competition-page"},vt={key:0,class:"loading-overlay"},pt={key:1,class:"detail-card"},mt={class:"nav-back"},ft={key:0,class:"action-buttons"},_t={class:"page-header"},gt={class:"header-subtitle"},bt={key:0,class:"edit-controls"},yt=["disabled"],kt={key:0,class:"registered-players"},wt={class:"players-list"},ht={key:0,class:"no-players"},qt={key:1,class:"players-table"},$t={class:"action-buttons"},Ct=["onClick"],Rt=["onClick"],It={key:2,class:"edit-dialog-overlay"},xt={class:"edit-dialog"},Ut={class:"edit-form"},St={class:"form-group"},Nt={class:"form-group"},Vt={class:"form-group"},Dt={class:"form-group"},Et={class:"form-group"},Mt={class:"form-group"},Bt={class:"dialog-buttons"},Pt=["disabled"],Tt={key:3,class:"edit-dialog-overlay"},Ft={class:"edit-dialog"},zt={class:"dialog-buttons"},Lt=["disabled"],At={key:4,class:"edit-dialog-overlay"},Qt={class:"edit-dialog"},Gt={class:"status-options"},Ot=["onClick"],Ht={class:"dialog-buttons"},Xt=["disabled"],jt={key:5,class:"edit-dialog-overlay"},Yt={class:"edit-dialog"},Jt={class:"edit-form"},Kt={class:"form-group"},Wt={class:"form-group"},Zt={class:"form-group"},en={class:"form-group"},tn={class:"form-group"},nn={class:"form-group"},an={class:"form-group"},sn={class:"dialog-buttons"},on=["disabled"],ln={__name:"CompetitionDetail",setup(Z){const A=Ce(),S=he(),M={single:"单败淘汰",double:"双败淘汰",count:"积分赛"},R={prepare:"筹备中",starting:"进行中",finish:"已结束"},c=y({name:"",format:"",organizer:"",qq_code:"",start_time:"",end_time:"",status:""}),p=y([]),k=y(!1),D=y(!1),m=y(!1),X=y(!1),x=y(!1),$=y({name:"",format:"",organizer:"",qq_code:"",start_time:"",end_time:""}),Q=y(!1),j=y(!1),J=y(!1),B=y(""),G=y([]),K=y(!0),O=y(!1),b=y({id:"",username:"",type:"",tournament_id:""}),s=l=>l?l.replace(/\//g,"-"):"",i=l=>M[l]||l,_=()=>{A.push("/competition")},o=()=>{k.value=!k.value},a=()=>{const l=t=>{const g=Object.entries(M).find(([q,z])=>z===t);return g?g[0]:t};$.value={name:c.value.name,format:l(c.value.format),organizer:c.value.organizer,qq_code:c.value.qq_code,start_time:c.value.start_time.replace(/\//g,"-"),end_time:c.value.end_time.replace(/\//g,"-")},X.value=!0},u=()=>{X.value=!1,$.value={name:"",format:"",organizer:"",qq_code:"",start_time:"",end_time:""}},d=()=>{Q.value=!0},w=async()=>{var l,t;try{x.value=!0;const n=S.query.id,g=z=>{const[ie,ae,pe]=z.split("-");return`${ie}/${ae}/${pe}`},q={...$.value,start_time:g($.value.start_time),end_time:g($.value.end_time),status:c.value.status};await _e(n,q),alert("更新成功!"),u(),U()}catch(n){console.error("更新失败:",n),alert(((t=(l=n.response)==null?void 0:l.data)==null?void 0:t.message)||"更新失败,请重试")}finally{x.value=!1}},h=async()=>{var l,t;try{j.value=!0;const n=S.query.id;await Re(n),alert("删除成功!"),A.push("/competition")}catch(n){console.error("删除失败:",n),alert(((t=(l=n.response)==null?void 0:l.data)==null?void 0:t.message)||"删除失败,请重试")}finally{j.value=!1,Q.value=!1}},U=async()=>{try{K.value=!0;const l=parseInt(S.query.id);console.log("获取到的赛事ID:",l);const t=await be();console.log("获取到的赛事列表:",t);const n=t.find(g=>g.id===l);if(n){console.log("找到赛事:",n),c.value={...n,format:i(n.format)};const g=$e();g&&g.qq_code&&n.qq_code?D.value=String(g.qq_code)===String(n.qq_code):D.value=!1,n.status==="prepare"?await C():n.status==="starting"?await C():n.status==="finish"&&await le()}else console.log("未找到赛事"),alert("未找到赛事信息"),A.push("/competition")}catch(l){console.error("获取赛事详情失败:",l),alert("获取赛事详情失败,请重试")}finally{K.value=!1}},C=async()=>{try{const l=parseInt(S.query.id),t=await Y();console.log("报名玩家原始数据:",t),console.log("当前赛事ID:",l),G.value=t.filter(n=>n.tournament_id===l),console.log("筛选后的玩家数据:",G.value)}catch(l){console.error("获取报名玩家列表失败:",l)}},T=async l=>{var t,n;if(confirm("确定要移除该玩家吗?"))try{await Ie(l),await C(),alert("移除成功!")}catch(g){console.error("移除玩家失败:",g),alert(((n=(t=g.response)==null?void 0:t.data)==null?void 0:n.message)||"移除失败,请重试")}},F=()=>{B.value=c.value.status,J.value=!0},P=()=>{J.value=!1,B.value=""},ee=async()=>{var l,t;try{x.value=!0;const n=S.query.id,g=z=>{const ae=Object.entries(M).find(([pe,ye])=>ye===z);return ae?ae[0]:z},q={name:c.value.name,format:g(c.value.format),organizer:c.value.organizer,qq_code:c.value.qq_code,start_time:c.value.start_time,end_time:c.value.end_time,status:B.value};console.log("更新赛事状态,发送数据:",q),await _e(n,q),alert("状态更新成功!"),P(),U()}catch(n){console.error("状态更新失败:",n),console.error("错误详情:",{message:n.message,response:(l=n.response)==null?void 0:l.data,status:(t=n.response)==null?void 0:t.status}),alert(n.message||"状态更新失败,请重试")}finally{x.value=!1}},te=l=>{b.value={id:l.id,tournament_id:l.tournament_id,tournament_name:c.value.name,team_name:l.team_name||"个人",sign_name:l.sign_name,win:l.win||"0",lose:l.lose||"0",status:l.status||"tie",faction:l.faction||"random",qq:l.qq||""},O.value=!0},W=()=>{O.value=!1},H=async()=>{var l,t,n,g;try{x.value=!0,console.log("更新前的数据:",b.value);const q={tournament_id:parseInt(b.value.tournament_id),tournament_name:b.value.tournament_name,team_name:b.value.team_name==="个人"?null:b.value.team_name,sign_name:b.value.sign_name,win:b.value.win.toString(),lose:b.value.lose.toString(),status:b.value.status,faction:b.value.faction,qq:b.value.qq};console.log("发送到API的数据:",q),await ce(b.value.id,q),await C(),W(),alert("更新成功!")}catch(q){console.error("更新玩家信息失败:",q),console.error("错误详情:",{message:q.message,response:(l=q.response)==null?void 0:l.data,status:(t=q.response)==null?void 0:t.status}),alert(((g=(n=q.response)==null?void 0:n.data)==null?void 0:g.detail)||q.message||"更新失败,请重试")}finally{x.value=!1}},ne=async()=>{try{m.value=!0,alert("保存成功!"),k.value=!1}catch(l){console.error("保存失败:",l),alert("保存失败,请重试")}finally{m.value=!1}},le=async()=>{try{const l=parseInt(S.query.id),n=(await Y()).filter(g=>g.tournament_id===l).map((g,q)=>({rank:q+1,username:g.sign_name,qq:g.qq,faction:g.faction,score:`${g.win}胜${g.lose}负`})).sort((g,q)=>{const z=parseInt(g.score.split("胜")[0]);return parseInt(q.score.split("胜")[0])-z});p.value=n}catch(l){console.error("获取最终结果失败:",l)}};return de(()=>G.value.map(l=>({id:l.id,name:l.sign_name||l.name||"未知选手",team_name:l.team_name||"个人",win:l.win||"0",lose:l.lose||"0",status:l.status||"tie"}))),ve(()=>{U()}),(l,t)=>(r(),v("div",ct,[K.value?(r(),v("div",vt,t[14]||(t[14]=[e("div",{class:"loading-spinner"},null,-1)]))):(r(),v("div",pt,[e("div",mt,[e("button",{class:"back-btn",onClick:_},"← 返回列表"),D.value?(r(),v("div",ft,[e("button",{class:"status-btn",onClick:F},"修改状态"),e("button",{class:"edit-btn",onClick:a},"编辑赛事"),e("button",{class:"delete-btn",onClick:d},"删除赛事")])):N("",!0)]),e("div",_t,[e("h1",null,f(c.value.name),1),e("div",gt,[e("span",null,"赛制:"+f(c.value.format),1),e("span",null,"|组织者:"+f(c.value.organizer),1),e("span",null,"|QQ:"+f(c.value.qq_code),1),e("span",null,"|开始时间:"+f(s(c.value.start_time)),1),e("span",null,"|结束时间:"+f(s(c.value.end_time)),1),e("span",{class:oe(["status-tag",c.value.status])},f(R[c.value.status]),3)]),D.value?(r(),v("div",bt,[e("button",{class:"edit-mode-btn",onClick:o},f(k.value?"退出编辑":"编辑对阵图"),1),k.value?(r(),v("button",{key:0,class:"save-btn",onClick:ne,disabled:m.value},f(m.value?"保存中...":"保存修改"),9,yt)):N("",!0)])):N("",!0)]),c.value.status==="prepare"||c.value.status==="starting"?(r(),v("div",kt,[t[16]||(t[16]=e("div",{class:"section-title"},"报名玩家列表",-1)),e("div",wt,[G.value.length===0?(r(),v("div",ht," 暂无报名玩家 ")):(r(),v("table",qt,[t[15]||(t[15]=e("thead",null,[e("tr",null,[e("th",null,"玩家名称"),e("th",null,"队伍名称"),e("th",null,"胜场"),e("th",null,"负场"),e("th",null,"状态"),e("th",null,"操作")])],-1)),e("tbody",null,[(r(!0),v(E,null,L(G.value,n=>(r(),v("tr",{key:n.id},[e("td",null,f(n.sign_name),1),e("td",null,f(n.team_name||"个人"),1),e("td",null,f(n.win),1),e("td",null,f(n.lose),1),e("td",null,f(n.status),1),e("td",$t,[e("button",{class:"edit-player-btn",onClick:g=>te(n)},"修改",8,Ct),e("button",{class:"remove-btn",onClick:g=>T(n.id)},"移除",8,Rt)])]))),128))])]))])])):N("",!0),c.value.status!=="prepare"?(r(),v(E,{key:1},[c.value.status==="finish"?(r(),me(dt,{key:0,"tournament-id":parseInt(fe(S).query.id)},null,8,["tournament-id"])):N("",!0),c.value.status==="starting"?(r(),me(je,{key:1,"tournament-id":parseInt(fe(S).query.id),onRefreshPlayers:C},null,8,["tournament-id"])):N("",!0)],64)):N("",!0),X.value?(r(),v("div",It,[e("div",xt,[t[24]||(t[24]=e("h3",null,"编辑赛事",-1)),e("div",Ut,[e("div",St,[t[17]||(t[17]=e("label",null,"赛事名称:",-1)),I(e("input",{type:"text","onUpdate:modelValue":t[0]||(t[0]=n=>$.value.name=n)},null,512),[[V,$.value.name]])]),e("div",Nt,[t[19]||(t[19]=e("label",null,"赛制类型:",-1)),I(e("select",{"onUpdate:modelValue":t[1]||(t[1]=n=>$.value.format=n)},t[18]||(t[18]=[e("option",{value:"single"},"单败淘汰",-1),e("option",{value:"double"},"双败淘汰",-1),e("option",{value:"count"},"积分赛",-1)]),512),[[se,$.value.format]])]),e("div",Vt,[t[20]||(t[20]=e("label",null,"组织者:",-1)),I(e("input",{type:"text","onUpdate:modelValue":t[2]||(t[2]=n=>$.value.organizer=n)},null,512),[[V,$.value.organizer]])]),e("div",Dt,[t[21]||(t[21]=e("label",null,"QQ号:",-1)),I(e("input",{type:"text","onUpdate:modelValue":t[3]||(t[3]=n=>$.value.qq_code=n)},null,512),[[V,$.value.qq_code]])]),e("div",Et,[t[22]||(t[22]=e("label",null,"开始时间:",-1)),I(e("input",{type:"date","onUpdate:modelValue":t[4]||(t[4]=n=>$.value.start_time=n)},null,512),[[V,$.value.start_time]])]),e("div",Mt,[t[23]||(t[23]=e("label",null,"结束时间:",-1)),I(e("input",{type:"date","onUpdate:modelValue":t[5]||(t[5]=n=>$.value.end_time=n)},null,512),[[V,$.value.end_time]])]),e("div",Bt,[e("button",{class:"cancel-btn",onClick:u},"取消"),e("button",{class:"confirm-btn",onClick:w,disabled:x.value},f(x.value?"保存中...":"保存"),9,Pt)])])])])):N("",!0),Q.value?(r(),v("div",Tt,[e("div",Ft,[t[25]||(t[25]=e("h3",null,"确认删除",-1)),t[26]||(t[26]=e("p",{class:"confirm-message"},"确定要删除该赛事吗?此操作不可恢复。",-1)),e("div",zt,[e("button",{class:"cancel-btn",onClick:t[6]||(t[6]=n=>Q.value=!1)},"取消"),e("button",{class:"delete-confirm-btn",onClick:h,disabled:j.value},f(j.value?"删除中...":"确认删除"),9,Lt)])])])):N("",!0),J.value?(r(),v("div",At,[e("div",Qt,[t[27]||(t[27]=e("h3",null,"修改赛事状态",-1)),e("div",Gt,[(r(),v(E,null,L(R,(n,g)=>e("button",{key:g,class:oe(["status-option",{active:B.value===g}]),onClick:q=>B.value=g},f(n),11,Ot)),64))]),e("div",Ht,[e("button",{class:"cancel-btn",onClick:P},"取消"),e("button",{class:"confirm-btn",onClick:ee,disabled:x.value},f(x.value?"保存中...":"保存"),9,Xt)])])])):N("",!0),O.value?(r(),v("div",jt,[e("div",Yt,[t[37]||(t[37]=e("h3",null,"编辑参赛信息",-1)),e("div",Jt,[e("div",Kt,[t[28]||(t[28]=e("label",null,"参赛人员名称:",-1)),I(e("input",{type:"text","onUpdate:modelValue":t[7]||(t[7]=n=>b.value.sign_name=n)},null,512),[[V,b.value.sign_name]])]),e("div",Wt,[t[29]||(t[29]=e("label",null,"队伍名称:",-1)),I(e("input",{type:"text","onUpdate:modelValue":t[8]||(t[8]=n=>b.value.team_name=n)},null,512),[[V,b.value.team_name]])]),e("div",Zt,[t[30]||(t[30]=e("label",null,"胜利局数:",-1)),I(e("input",{type:"text","onUpdate:modelValue":t[9]||(t[9]=n=>b.value.win=n)},null,512),[[V,b.value.win]])]),e("div",en,[t[31]||(t[31]=e("label",null,"失败局数:",-1)),I(e("input",{type:"text","onUpdate:modelValue":t[10]||(t[10]=n=>b.value.lose=n)},null,512),[[V,b.value.lose]])]),e("div",tn,[t[33]||(t[33]=e("label",null,"状态:",-1)),I(e("select",{"onUpdate:modelValue":t[11]||(t[11]=n=>b.value.status=n)},t[32]||(t[32]=[e("option",{value:"win"},"胜利",-1),e("option",{value:"lose"},"失败",-1),e("option",{value:"tie"},"平局",-1)]),512),[[se,b.value.status]])]),e("div",nn,[t[35]||(t[35]=e("label",null,"阵营:",-1)),I(e("select",{"onUpdate:modelValue":t[12]||(t[12]=n=>b.value.faction=n)},t[34]||(t[34]=[qe('<option value="allied" data-v-3ae900b4>盟军</option><option value="soviet" data-v-3ae900b4>苏联</option><option value="empire" data-v-3ae900b4>帝国</option><option value="ob" data-v-3ae900b4>OB</option><option value="voice" data-v-3ae900b4>解说</option><option value="random" data-v-3ae900b4>随机</option>',6)]),512),[[se,b.value.faction]])]),e("div",an,[t[36]||(t[36]=e("label",null,"QQ:",-1)),I(e("input",{type:"text","onUpdate:modelValue":t[13]||(t[13]=n=>b.value.qq=n)},null,512),[[V,b.value.qq]])]),e("div",sn,[e("button",{class:"cancel-btn",onClick:W},"取消"),e("button",{class:"confirm-btn",onClick:H,disabled:x.value},f(x.value?"保存中...":"保存"),9,on)])])])])):N("",!0)]))]))}},dn=ge(ln,[["__scopeId","data-v-3ae900b4"]]);export{dn as default};
|