\ExplSyntaxOn \makeatletter
\hduthesis_provide_module:n {bc.config}

\geometry { top = 3.25cm, bottom = 2.4cm, left = 4cm, right = 2cm,
            headheight = 15pt, headsep = .72cm }
\fancyhead[C]
  { \raisebox { .12ex } { \small 杭州电子科技大学 \l__docinfo_entitle_tl } }
\hook_gput_code:nnn {cmd/tableofcontents/before} { . }
  {
    \clearpage 
    \pagenumbering{Roman} \cfoot{\small \thepage}
  }
\hook_gput_code:nnn { cmd/tableofcontents/after } { . }
  {
    \thispagestyle{fancy} \clearpage
    \pagenumbering{arabic} \cfoot{}
  }

\RenewDocumentCommand \maketitle {}
  {
    \newgeometry{ margin = 3cm }
    \begin{titlepage}
      \__hduthesis_cover_bc_aux:
    \end{titlepage}
    \restoregeometry
  }

\int_new:N \l__hduthesis_grade_int
\int_set:Nn \l__hduthesis_grade_int
  {
    \int_compare:nNnTF {\c_sys_month_int} < 9
    {\c_sys_year_int} {\int_eval:n {\c_sys_year_int+1}}
  }
\cs_new_protected_nopar:Nn \__hduthesis_cover_bc_aux:
  {
    \begin{center}
      \vspace*{14\p@}
      \includegraphics[ width = .64\linewidth ]{hdutitle}
      \par \vspace*{36\p@}
      \scalebox{2.75}
      {
        \textbf
          {
            \__hduthesis_cover_spread_box:nn
              { .205\paperwidth } { \l__docinfo_entitle_tl }
          }
      }
      \par \vspace*{1.5\baselineskip}
      { \LARGE （\int_use:N \l__hduthesis_grade_int \bfseries 届） }
      \par \vspace*{3.0\baselineskip}
      \begin{tabular}
        {
          >{\large\bfseries}p{5.5\ccwd}@{}
          >{\large\centering\arraybackslash\kaishu}p{.65\linewidth}@{}
        }
        \__hduthesis_cover_spread_box:nn { 4\ccwd } { 题目 } &
        \__hduthesis_cover_center_box:nn { .95\linewidth } { \@title }\\[5.2ex]
        \__hduthesis_cover_spread_box:nn { 4\ccwd } { 学院 } &
        \__hduthesis_cover_center_box:nn { .95\linewidth }
          { \l__docinfo_department_tl }\\[5.2ex]
        \__hduthesis_cover_spread_box:nn { 4\ccwd } { 专业 } &
        \__hduthesis_cover_center_box:nn { .95\linewidth }
          { \l__docinfo_major_tl }\\[5.2ex]
        \__hduthesis_cover_spread_box:nn { 4\ccwd } { 班级 } &
        \__hduthesis_cover_center_box:nn { .95\linewidth }
          { \l__docinfo_class_tl }\\[5.2ex]
        \__hduthesis_cover_spread_box:nn { 4\ccwd } { 学号 } &
        \__hduthesis_cover_center_box:nn { .95\linewidth }
          { \l__docinfo_stdntid_tl }\\[5.2ex]
        \__hduthesis_cover_spread_box:nn { 4\ccwd } { 学生姓名 } &
        \__hduthesis_cover_center_box:nn { .95\linewidth } { \@author }\\[5.2ex]
        \__hduthesis_cover_spread_box:nn { 4\ccwd } { 指导教师 } &
        \__hduthesis_cover_center_box:nn { .95\linewidth }
          { \l__docinfo_cnsupervisor_tl \quad \l__docinfo_cnrole_tl }\\[5.2ex]
        \__hduthesis_cover_spread_box:nn { 4\ccwd } { 完成日期 } &
        \__hduthesis_cover_center_box:nn { .95\linewidth }
          {
            \textsf{\int_use:N \c_sys_year_int} 年
            \textsf{\int_use:N \c_sys_month_int} 月
          }
      \end{tabular}
    \end{center}
  }

\NewDocumentCommand \commitment { O{} }
  {
    \newgeometry{ margin = 3cm }
    \titlepage
      \__hduthesis_commitment_bc_aux:n {#1}
    \endtitlepage
    \restoregeometry
  }
\cs_new_protected_nopar:Npn \__hduthesis_commitment_bc_aux:n #1
  {
    \vspace*{65\p@}
    \begin{center}
      \@beginparpenalty \@lowpenalty
      \Large \textsf
        { \bfseries \__hduthesis_cover_spread_box:nn { 6\ccwd }{ 诚信承诺 } }
      \@endparpenalty \@M
    \end{center}
    \vspace*{.4\baselineskip} \par
    \linespread{2.1}
      { \semilarge
        我谨在此承诺：本人所写的毕业论文《\@title 》均系本人独立完成，
        没有抄袭行为，凡涉及其他作者的观点和材料，均作了注释，若有不实，后果由本人承担。
        \par\vspace*{\baselineskip} \bfseries\sffamily
        \hskip.48\linewidth 承诺人（签名）：
        \__hduthesis_signature_process_aux:nnn {#1}{1}{0}
        \tl_if_empty:NF \l__hduthesis_signature_figure_tl
          {
            \signature { \l__hduthesis_signature_figure_tl }
            \tl_clear:N \l__hduthesis_signature_figure_tl
          }
        \par \vspace*{.5\baselineskip}
        \hskip \dim_eval:n { .48\linewidth - 1em }
        \makebox [ 3em ]
          { \__hduthesis_signature_process_aux:nnn {#1}{1}{1} } 年
        \makebox [ 2em ]
          { \__hduthesis_signature_process_aux:nnn {#1}{1}{2} } 月
        \makebox [ 2em ]
          { \__hduthesis_signature_process_aux:nnn {#1}{1}{3} } 日
      }
  }

\RenewDocumentEnvironment {abstract} { O{en} }
  {
    \str_if_eq:nnT {#1} {en}
      {
        \tl_set:Nn \l__keywords_name_tl {Keywords:~}
        \tl_set:Nn \l__keywords_sep_tl {;~}
        \@beginparpenalty\@lowpenalty
        \chapter*{\normalfont\bfseries ABSTRACT}
      }
    \str_if_eq:nnT {#1} {cn}
      {
        \tl_set:Nn \l__keywords_name_tl {\textsf{关键词：}}
        \tl_set:Nn \l__keywords_sep_tl {；}
        \@beginparpenalty\@lowpenalty
        \chapter*{摘\qquad 要}
      }
  }
  {
    \tl_clear:N \l__abstract_name_tl
    \cfoot{} \clearpage
  }
\clist_new:N \l__abstract_keywords_clist
\NewDocumentCommand \keywords { m }
  {
    \par \vspace*{\baselineskip}
    \noindent\textbf{\l__keywords_name_tl}
    \clist_set:Nn \l__abstract_keywords_clist {#1}
    \clist_use:Nn \l__abstract_keywords_clist {\l__keywords_sep_tl}
  }

\RequirePackage{tocloft}
\renewcommand \contentsname {\hfill 目 \qquad 录 \hfill}
\renewcommand* \cfttoctitlefont {\sffamily\semiLarge}
\dim_set:Nn \cftbeforetoctitleskip {3pt}
\dim_set:Nn \cftaftertoctitleskip {24pt}
\dim_set:Nn \cftbeforechapskip {1pt}
\dim_set:Nn \cftbeforesecskip {-.2pt}
\patchcmd { \@dottedtocline }
  { \leaders \hbox { $\m@th\mkern \@dotsep mu\hbox{.}\mkern \@dotsep mu$ } }
  { \kern 4pt \leaders \hbox { $\m@th\mkern .4 mu\hbox{-}\mkern .4 mu$ } } {}{}
\renewcommand* \l@chapter {\@dottedtocline{1}{0em}{1.6em}}
\renewcommand* \l@section {\@dottedtocline{1}{2.3em}{2.1em}}
\renewcommand* \@dotsep {1.7}
\renewcommand* \@pnumwidth {2.5ex}
\renewcommand* \cftchapfont {\normalfont}
\setcounter{tocdepth}{1}

\ctexset
  {
    chapter    =
      {
        fixskip = true, name = {}, beforeskip = 21pt, format+ = \sffamily\large,
        pagestyle = fancy,         afterskip = 34pt,  number = \arabic{chapter},
      },
    section    =
      {
        beforeskip = 1.25ex, afterskip = 1.5ex,
        fixskip    = true,   format    = \sffamily\semilarge
      },
    subsection =
      {
        beforeskip = 1.25ex, afterskip = 1.5ex,
        fixskip    = true,   format    = \sffamily
      }
  }

\makeatother \ExplSyntaxOff
\endinput
