答案1
这只是一个起点:
\documentclass{book}
\usepackage{titletoc}
\usepackage{tikz}
\titlecontents{chapter}[0em]
{\begin{tikzpicture}[overlay,remember picture]
\draw[fill=teal,draw=none] (-.3,-0.2) rectangle (\textwidth,0.5);
\end{tikzpicture}
\color{white}\large\bfseries}
{\thecontentslabel\quad}
{}
{\normalsize\hfill\thecontentspage}
[\addvspace{1.5ex}]
\titlecontents{section}[0cm]
{\bfseries}
{\thecontentslabel\quad}
{}
{\hfill\thecontentspage}
\begin{document}
\tableofcontents
\chapter{Chapter title}
\section{First section}
\section{Second section}
\end{document}