Mercury ions are easily converted into methylmercury, which is easy to accumulate in the body under the action of microorganisms and eventually cause damage to the human body. Therefore, the development of heterogeneous sensors for the enrichment and detection of mercury ion in wastewater is urgently required. In this paper, a fluorescent hydrogel integrating enrichment and detection is prepared by self-assembly combining hydrothermally synthesized nitrogen-sulfur-carbon dots with a hydrogel. The fluorescent hydrogel (AAH) is well characterized by scanning electron microscopy (SEM), Fourier Transform infrared spectroscopy (FTIR), X-ray photoelectron spectroscopy (XPS), and transmission electron microscopy (TEM),