In this study, we developed a novel covalent organic framework (COF) material, termed RuCOFs, specifically designed and synthesized for electrochemiluminescence (ECL) sensor applications. RuCOFs are based on the classic ECL emitter Ru(dcbpy)32+, ingeniously integrating 4,4′,4''-(1,3,5-triazine-2,4,6-triyl) triphenylamine (TAPT) with [2,2′-bipyridine]-5,5′-diamine (BPYDA), forming a structure with a high specific surface area. This configuration not only significantly enhances the stability of the ECL signal but also provides ideal N,N′-bipyridine chelating sites for efficient metal ion recognition. Utilizing Ru(dcbpy)32+-functionalized COF (RuCOFs), a novel dual-function ECL sensor was developed, achieving high sensitivity and selectivity in detecting mercury (Hg2⁺) and zinc (Zn2⁺) ions. Experimental results indicate that Hg2⁺ significantly quenches the ECL signal, while Zn2⁺ markedly enhances it, with detection limits of 4.71 nM for Hg2⁺ and 6.57 nM for Zn2⁺ across a wide linear response range from 1 μM to 1 nM. This research not only demonstrates the significant advantages of COF-based ECL sensing platforms in tracking environmental metal ions but also opens new possibilities for environmental monitoring.