You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1 line
7.1 KiB

2 months ago
import{$t as e,D as t,G as n,J as r,O as i,W as a,Z as o,_t as s,at as c,b as l,in as u,k as ee,m as d,q as te,st as f,w as ne,x as p}from"./vue.runtime.esm-bundler-OsdSFvn7.js";import{b as m,d as re,l as ie,p as h}from"./api-Cy3G2Clw.js";import{l as ae,o as oe,s as se,y as g}from"./index-BtGUeLzV.js";import{t as _}from"./_plugin-vue_export-helper-CXTkFu_Z.js";/* empty css *//* empty css */import{i as v,o as ce,r as y,t as le}from"./competitionBranding-DKFkcrfF.js";import{n as b,t as x}from"./participantTheme-Dv_K0myG.js";import{t as S}from"./PortalChangePasswordModal-BJUWrIoh.js";async function C(e){let{token:t}=m();if(!t)throw Error(`未登录`);let n=await fetch(`${h()}/api/v1/review/auth/password`,{method:`PUT`,headers:{Authorization:`Bearer ${t}`,Accept:`application/json`,"Content-Type":`application/json`},body:JSON.stringify(e)});if(!n.ok){let e=await n.json().catch(()=>({})),t=e.errors?.current_password?.[0]||e.errors?.password?.[0]||e.message||`修改密码失败`;throw Error(t)}}var w={class:`reviewer-layout-root`},T={class:`navbar navbar-expand-lg layout-header`},E={class:`container-fluid px-4`},D={class:`navbar-brand mb-0 prototype-title`},O={class:`dropdown`},k={class:`header-user dropdown-toggle`,type:`button`,"data-bs-toggle":`dropdown`,"aria-expanded":`false`},A={class:`header-user-name`},j={class:`dropdown-menu dropdown-menu-end header-user-menu`},M={id:`mobileNavSection`,class:`container-fluid px-4 pt-2 pb-1 d-lg-none`},N={class:`mobile-nav-wrap`},P={class:`container-fluid px-4 py-3 layout-main`},F={class:`row g-3 portal-layout-row`},I={class:`col-12 col-md-3 col-lg-2 layout-sider`},L={class:`card h-100 portal-sider-card`},R={class:`card-body`},z={class:`nav flex-column gap-2`},B={class:`col-12 col-md-9 col-lg-10 reviewer-main-column portal-main-column`},V={class:`reviewer-main-surface border rounded-3 bg-white h-100`},H={class:`border-top bg-white text-center py-2 small text-secondary prototype-subtitle`},U={id:`reviewerProfileModal`,class:`modal fade`,tabindex:`-1`,"aria-hidden":`true`},ue={class:`modal-dialog modal-dialog-centered profile-modal-dialog`},de={class:`modal-content profile-modal-content`},fe={class:`modal-body profile-modal-body`},pe={class:`row g-3`},me={class:`col-md-6`},he={class:`profile-field`},ge={class:`profile-field-value`},_e={class:`col-md-6`},ve={class:`profile-field`},ye={class:`profile-field-value`},be={class:`col-12`},xe={class:`profile-field`},Se={class:`profile-field-value`},W=_(ee({__name:`ReviewerLayout`,setup(ee){let _=se(),W=oe(),G=l(()=>String(W.params.slug??``).trim()),K=l(()=>[`reviewer-projects`,`reviewer-application-detail`].includes(String(W.name??``))),q=s(y()),J=s(``),Y=s(`评审员`),Ce=l(()=>ce(q.value,J.value)),we=l(()=>{if(v(q.value.review.footerCopyright))return q.value.review.footerCopyright;if(v(q.value.login.footerCopyright))return q.value.login.footerCopyright;let e=J.value.trim();return e?`版权所有:${e}`:`版权所有`});async function Te(){let e=G.value;if(!e){q.value=y(),J.value=``;return}try{let t=await fetch(`${h()}/api/v1/public/competitions/by-slug/${encodeURIComponent(e)}`,{headers:{Accept:`application/json`}});if(!t.ok){q.value=y(),J.value=``;return}let n=await t.json(),r=n.data!=null&&typeof n.data==`object`&&!Array.isArray(n.data)?n.data:n;J.value=String(r.name??``),q.value=le(r.branding_json??null)}catch{q.value=y(),J.value=``}}c(q,()=>x(q.value.login.themePrimary),{deep:!0,immediate:!0}),c(G,()=>void Te(),{immediate:!0}),r(`reviewerCompetitionName`,J);let X=s({name:`—`,mobile:`—`,username:`—`});async function Z(){let{token:e}=m();if(e)try{let t=await fetch(`${h()}${ie}`,{headers:{Authorization:`Bearer ${e}`,Accept:`application/json`}});if(!t.ok)return;let n=(await t.json()).reviewer;Y.value=n?.name?.trim()||n?.username?.trim()||`评审员`,X.value={name:n?.name??`—`,mobile:n?.mobile??`—`,username:n?.username??`—`}}catch{}}function Ee(){re();let e=G.value;e?_.replace({name:`reviewer-login`,params:{slug:e}}):_.replace(`/c`)}let Q=s(null),$=s(!1);function De(){Q.value?.reset();le