\fancypagestyle 只是定义样式,需要使用 \pagestyle 应用样式,\thispagestyle 只是在当前页面应用样式;你可能根本就没编译成功,这行代码\renewcommand\contentsname{\textbf{目\quad录}}在 xeCJK 或 luatex-ja 下一般是无法编译的,应该写成
\renewcommand\contentsname{\textbf{目\quad 录}}空格是必不可少的。这是因为在 xeCJK 和 luatex-ja 下,中文字符的类别码被设置为了 letter。
另外,使用了 ctexart 文档类就不必再使用 \usepackage{ctex} 了,UTF8 在 2.5 版(2020 年 5 月起)成为默认选项,一般也不必显示指定。
\documentclass[a4paper,12pt]{ctexart}
\usepackage{fancyhdr}
\usepackage{zhlipsum}
%--目录页眉页脚
\fancypagestyle{mulu}
{
\fancyhf{}
\fancyhead[c]{**硕士学位论文\quad 目录}
\fancyfoot[c]{\thepage}
\renewcommand{\headrulewidth}{1.5pt}
\renewcommand{\footrulewidth}{1.5pt}
}
%-目录页眉页脚
\begin{document}
%-----目录部分
\clearpage
\pagestyle{mulu}%--调用上面定义的\fancypagestyle{mulu}
\renewcommand\contentsname{\textbf{目\quad 录}}
\addcontentsline{toc}{section}{目录}
\begin{center}
\tableofcontents%增加章节目录...
\end{center}
\clearpage
\pagestyle{headings}
\section{sec 1}
\zhlipsum[1-3]
\section{sec 2}
\zhlipsum[4-7]
\end{document}