|
|
import{C as e,D as t,Et as n,O as r,Q as ee,S as i,W as te,Y as a,Z as o,_t as s,at as c,b as l,ct as u,g as d,in as f,k as p,q as m,st as h,w as g,x as _}from"./vue.runtime.esm-bundler-OsdSFvn7.js";import{_ as v,i as y,l as b}from"./index-BtGUeLzV.js";import{t as x}from"./_plugin-vue_export-helper-CXTkFu_Z.js";import{a as S}from"./competitions-CcktYEcj.js";import{t as ne}from"./adminCompetition-D08GZOZ_.js";import{t as re}from"./competitionAdminLabels-DZb8vKRz.js";async function ie(e){let{data:t}=await y.get(`/competitions/${e}/dashboard`);if(!t||typeof t!=`object`)throw Error(`首页统计响应无效`);return t}var C={class:`dashboard`},w={class:`dashboard-head`},T={class:`meta-line`},ae={class:`time-line`},oe={class:`head-actions`},se={class:`metric-grid`,"aria-label":`核心指标`},ce={class:`metric-label`},le={class:`metric-value`},E={class:`metric-hint`},D={class:`main-grid`},O={class:`panel`},k={class:`setup-list`},A={class:`setup-copy`},j={class:`panel`},M={class:`progress-kpis`},N={class:`main-grid main-grid--wide`},P={class:`panel`},F={class:`panel-head`},I={class:`panel-subtitle`},L={class:`panel`},R={class:`shortcut-list`},z=[`href`],B={key:1,class:`shortcut shortcut-button`,type:`button`,disabled:``},ue={class:`panel`},V=x(p({__name:`AdminDashboardView`,setup(p){let y=ne(),{competitions:x,selectedCompetitionId:V}=v(y),H=s(!1),U=s(null),de=[{key:`published`,label:`赛事发布`,description:`对外报名和评审入口依赖发布状态`,routeName:`admin-competition-workspace`},{key:`signup_form_schema`,label:`报名表单`,description:`选手报名字段由 Schema 渲染`,routeName:`admin-competition-workspace`},{key:`tracks`,label:`赛道配置`,description:`评审范围和报名分组按赛道隔离`,routeName:`admin-competition-workspace`},{key:`pledge`,label:`承诺书`,description:`提交报名时需要签署的赛事文本`,routeName:`admin-competition-workspace`},{key:`review_form_schema`,label:`评审表单`,description:`未配置时评审端将使用系统默认表单`,routeName:`admin-competition-workspace`},{key:`reviewer_scopes`,label:`评审范围`,description:`评审员必须绑定赛事和赛道后才能看到项目`,routeName:`admin-reviewers-list`}],W=l(()=>U.value?.summary??null),G=l(()=>U.value?.competition??null),fe=l(()=>{let e=G.value;if(!e)return`未选择赛事`;let t=Date.now(),n=e.signup_open_at?new Date(e.signup_open_at).getTime():null,r=e.signup_close_at?new Date(e.signup_close_at).getTime():null;return e.published?n&&t<n?`报名未开始`:r&&t>r?e.status===`reviewing`?`评审中`:`报名已截止`:e.status===`reviewing`?`评审中`:e.status===`ended`?`已结束`:`报名中`:`未发布`}),pe=l(()=>{let e=W.value;return[{label:`报名总数`,value:e?.applications_total??0,hint:`含草稿和已提交`},{label:`已提交`,value:e?.applications_submitted??0,hint:`可进入评审范围`},{label:`草稿`,value:e?.applications_draft??0,hint:`选手尚未正式提交`},{label:`待评项目`,value:e?.applications_pending_review??0,hint:`已提交但暂无评分`},{label:`已评项目`,value:e?.applications_reviewed??0,hint:`至少已有一条评分`},{label:`评审记录`,value:e?.review_scores_total??0,hint:`累计提交评分数`}]}),me=l(()=>{let e=W.value;return!e||e.applications_submitted===0?0:Math.round(e.applications_reviewed/e.applications_submitted*100)}),K=l(()=>`/admin/`.endsWith(`/`)?`/admin/`.slice(0,-1):`/admin/`),q=l(()=>{let e=G.value?.slug;return e?`${K.value}/c/${encodeURIComponent(e)}/apply`:``}),J=l(()=>{let e=G.value?.slug;return e?`${K.value}/c/${encodeURIComponent(e)}/review`:``}),Y=l(()=>{let e=G.value?.slug;return e?`${K.value}/c/${encodeURIComponent(e)}/manage`:``});async function he(){if(x.value.length>0)return;let e=await S({page:1,per_page:100});y.setCompetitionList(e.data)}async function X(){H.value=!0;try{await he();let e=V.value;if(!e){U.value=null;return}U.value=await ie(e)}catch(e){U.value=null,b.error(e instanceof Error?e.message:`首页数据加载失败`)}finally{H.value=!1}}function Z(e){if(!e)return`未配置`;let t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleString()}function Q(e){return e===`submitted`||e===`published`||e===`signup_open`?`success`:e===`draft`?`info`:e===`reviewing`?`primary`:e===`signup_closed`||e===`ended`?`warning`:`info`}function ge(e){return e===`submitted`?`已提交`:e===`draft`?`草稿`:e}async function $(e){if(e)try{await navigator.clipboard.writeText(`${window.location.origin}${e}`),b.success(`已复制完整链接`)}catch{b.error(`复制失败,请手动选择文本`)}}return c(V,()=>{X()}),te(()=>{X()}),(te,s)=>{let c=o(`el-tag`),l=o(`el-button`),p=o(`RouterLink`),v=o(`el-progress`),y=o(`el-table-column`),b=o(`el-table`),x=o(`el-empty`),S=ee(`loading`);return u((m(),g(`div`,C,[U.value&&G.value?(m(),g(d,{key:0},[_(`section`,w,[_(`div`,null,[s[3]||=_(`div`,{class:`eyebrow`},`运营工作台`,-1),_(`h1`,null,f(G.value.name),1),_(`div`,T,[r(c,{type:Q(G.value.status),effect:`plain`},{default:h(()=>[t(f(n(re)(G.value.status)),1)]),_:1},8,[`type`]),r(c,{type:G.value.published?`success`:`info`,effect:`plain`},{default:h(()=>[t(f(G.value.published?`已发布`:`未发布`),1)]),_:1},8,[`type`]),_(`span`,null,`当前阶段:`+f(fe.value),1),_(`span`,null,`slug:`+f(G.value.slug),1)]),_(`div`,ae,[_(`span`,null,`报名开始:`+f(Z(G.value.signup_open_at)),1),_(`span`,null,`报名截止:`+f(Z(G.value.signup_close_at)),1)])]),_(`div`,oe,[r(p,{to:{name:`admin-competition-workspace`}},{default:h(()=>[r(l,{type:`danger`},{default:h(()=>[...s[4]||=[t(`赛事配置`,-1)]]),_:1})]),_:1}),r(p,{to:{name:`admin-competitions-list`}},{default:h(()=>[r(l,null,{default:h(()=>[...s[5]||=[t(`赛事列表`,-1)]]),_:1})]),_:1})])]),_(`section`,se,[(m(!0),g(d,null,a(pe.value,e=>(m(),g(`div`,{key:e.label,class:`metric-card`},[_(`div`,ce,f(e.label),1),_(`div`,le,f(e.value),1),_(`div`,E,f(e.hint),1)]))),128))]),_(`section`,D,[_(`div`,O,[s[7]||=_(`div`,{class:`panel-head`},[_(`h2`,null,`配置完整度`),_(`span`,{class:`panel-subtitle`},`影响报名、提交和评审流转`)],-1),_(`div`,k,[(m(),g(d,null,a(de,e=>_(`div`,{key:e.key,class:`setup-row`},[r(c,{type:U.value.setup[e.key]?`success`:e.key===`review_form_schema`?`warning`:`danger`,effect:`plain`,size:`small`},{default:h(()=>[t(f(U.value.setup[e.key]?`已完成`:e.key===`review_form_schema`?`默认`:`待处理`),1)]),_:2},1032,[`type`]),_(`div`,A,[_(`strong`,null,f(e.label),1),_(`span`,null,f(e.description),1)]),r(p,{to:{name:e.routeName}},{default:h(()=>[r(l,{link:``,type:`danger`},{default:h(()=>[...s[6]||=[t(`处理`,-1)]]),_:1})]),_:1},8,[`to`])])),64))])]),_(`div`,j,[s[13]||=_(`div`,{class:`panel-head`},[_(`h2`,null,`评审进度`),_(`span`,{class:`panel-subtitle`},`仅统计已提交报名`)],-1),r(v,{percentage:me.value,"stroke-width":12,"show-text":!1},null,8,[`percentage`]),_(`div`,M,[_(`div`,null,[_(`strong`,null,f(W.value?.applications_reviewed??0),1),s[8]||=_(`span`,null,`已评项目`,-1)]),_(`div`,null,[_(`strong`,null,f(W.value?.applications_pending_review??0),1),s[9]||=_(`span`,null,`待评项目`,-1)]),_(`div`,null,[_(`strong`,null,f(W.value?.reviewers_active??0)+`/`+f(W.value?.reviewers_total??0),1),s[10]||=_(`span`,null,`启用评审员`,-1)]),_(`div`,null,[_(`strong`,null,f(W.value?.reviewer_scopes_total??0),1),s[11]||=_(`span`,null,`评审范围`,-1)])]),r(p,{to:{name:`admin-reviewers-list`}},{default:h(()=>[r(l,{type:`danger`,plain:``},{default:h(()=>[...s[12]||=[t(`管理评审员与范围`,-1)]]),_:1})]),_:1})])]),_(`section`,N,[_(`div`,P,[_(`div`,F,[s[14]||=_(`h2`,null,`赛道分布`,-1),_(`span`,I,` 已启用 `+f(W.value?.tracks_enabled??0)+` / `+f(W.value?.tracks_total??0),1)]),r(b,{data:U.value.track_stats,stripe:``,style:{width:`100%`}},{empty:h(()=>[...s[15]||=[_(`span`,{class:`muted`},`暂无赛道,请进入赛事配置维护。`,-1)]]),default:h(()=>[r(y,{prop:`track_title`,label:`赛道`,"min-width":`150`,"show-overflow-tooltip":``}),r(y,{prop:`track_code`,label:`代码`,"min-width":`100`,"show-overflow-tooltip":``}),r(y,{label:`状态`,width:`90`},{default:h(({row:e})=>[r(c,{type:e.is_enabled?`success`:`info`,size:`small`,effect:`plain`},{default:h(()=>[t(f(e.is_enabled?`启用`:`停用`),1)]),_:2},1032,[`type`])]),_:1}),r(y,{prop:`applications_count`,label:`报名`,width:`90`}),r(y,{prop:`submitted_count`,label:`已提交`,width:`90`}),r(y,{prop:`reviewer_scope_count`,label:`评审范围`,width:`100`})]),_:1},8,[`data`])]),_(`div`,L,[s[23]||=_(`div`,{class:`panel-head`},[_(`h2`,null,`常用入口`),_(`span`,{class:`panel-subtitle`},`按当前赛事生成`)],-1),_(`div`,R,[r(p,{to:{name:`admin-competition-workspace`},class:`shortcut`},{default:h(()=>[...s[16]||=[_(`strong`,null,`报名列表与赛事配置`,-1),_(`span`,null,`查看报名详情、附件、分数和赛事设置`,-1)]]),_:1}),r(p,{to:{name:`admin-public-source-channels`},class:`shortcut`},{default:h(()=>[...s[17]||=[_(`strong`,null,`公开来源渠道`,-1),_(`span`,null,`生成首页入口链接和来源归因`,-1)]]),_:1}),_(`button`,{class:`shortcut shortcut-button`,type:`button`,onClick:s[0]||=e=>$(q.value)},[s[18]||=_(`strong`,null,`复制报名链接`,-1),_(`span`,null,f(q.value||`当前赛事暂无 slug`),1)]),_(`button`,{class:`shortcut shortcut-button`,type:`button`,onClick:s[1]||=e=>$(J.value)},[s[19]||=_(`strong`,null,`复制评审链接`,-1),_(`span`,null,f(J.value||`当前赛事暂无 slug`),1)]),Y.value?(m(),g(`a`,{key:0,class:`shortcut`,href:Y.value,target:`_blank`,rel:`noopener noreferrer`},[s[20]||=_(`strong`,null,`打开项目管理端`,-1),_(`span`,null,f(Y.value),1)],8,z)):(m(),g(`button`,B,[...s[21]||=[_(`strong`,null,`打开项目管理端`,-1),_(`span`,null,`当前赛事暂无 slug`,-1)]])),_(`button`,{class:`shortcut shortcut-button`,type:`button`,onClick:s[2]||=e=>$(Y.value)},[s[22]||=_(`strong`,null,`复制项目管理链接`,-1),_(`span`,null,f(Y.value||`当前赛事暂无 slug`),1)])])])]),_(`section`,ue,[s[26]||=_(`div`,{class:`panel-head`},[_(`h2`,null,`最近报名`),_(`span`,{class:`panel-subtitle`},`最近更新或提交的 8 条记录`)],-1),r(b,{data:U.value.recent_applications,stripe:``,style:{width:`100%`}},{empty:h(()=>[...s[25]||=[_(`span`,{class:`muted`},`暂无报名记录。`,-1)]]),default:h(()=>[r(y,{prop:`project_name`,label:`项目`,"min-width":`180`,"show-overflow-tooltip":``}),r(y,{prop:`player_name`,label:`负责人`,"min-width":`100`,"show-overflow-tooltip":``}),r(y,{prop:`track_title`,label:`赛道`,"min-width":`130`,"show-overflow-tooltip":``}),r(y,{label:`状态`,width:`100`},{default:h(({row:e})=>[r(c,{type:Q(e.status),size:`small`,effect:`plain`},{default:h(()=>[t(f(ge(e.status)),1)]),_:2},1032,[`type`])]),_:1}),r(y,{prop:`submitted_review_count`,label:`评分数`,width:`90`}),r(y,{label:`提交时间`,"min-width":`170`},{default:h(({row:e})=>[t(f(Z(e.submitted_at)),1)]),_:1}),r(y,{label:`操作`,width:`120`,fixed:`right`},{default:h(()=>[r(p,{to:{name:`admin-competition-workspace`}},{default:h(()=>[r(l,{type:`danger`,link:``},{default:h(()=>[...s[24]||=[t(`进入列表`,-1)]]),_:1})]),_:1})]),_:1})]),_:1},8,[`data`])])],64)):H.value?e(``,!0):(m(),i(x,{key:1,description:`暂无可管理的赛事`},{default:h(()=>[r(p,{to:{name:`admin-competition-new`}},{default:h(()=>[r(l,{type:`danger`},{default:h(()=>[...s[27]||=[t(`新建赛事`,-1)]]),_:1})]),_:1})]),_:1}))])),[[S,H.value]])}}}),[[`__scopeId`,`data-v-6ef28451`]]);export{V as default}; |