In recent years, heterojunction photocatalytic materials have received more and more attention. Ball milling and microwave-assisted heating were used in this work to prepare the g-C3N4/TiO2 heterojunction photocatalytic nanocomposites with different g-C3N4/TiO2 mass ratios (0.5:1, 1:1, 2.5:1, 5:1, 10:1, 20:1, 30:1, and 40:1, labeled as TCN-1, TCN-2, TCN-3, TCN-4, TCN-5, TCN-6, TCN-7, and TCN-8, respectively). The crystal structure, morphology, and optical properties of the samples were characterized by various analytical techniques. The photocatalytic activity was evaluated by the degradation efficiency of Rhodamine B (RhB) and methylene blue (MB) under visible light and UV irradiation. After 120 min at visible light illumination, TCN-7 had the best degradation efficiency with 99.41% for RhB and 91.75% for MB, whereas after 120 min at UV light illumination, TCN-7 exhibited the best degradation effect, and the efficiency reached at 48.66% for RhB and 71.64% for MB, respectively. The analysis of crystal structure of the as-prepared TCN samples confirmed that TCN-7 has a good crystallinity, which is facilitated for photocatalytic activity. In photocatalytic reactions, superoxide radical (center dot O-2(-)), hydroxyl radical (center dot OH), and hole (h(+)) are recognized as the main active groups, and center dot O-2(-) plays the main role for TCN-7 in the photocatalytic reaction system for the degradation of RhB.