Covalent organic frameworks (COFs) have been a potential candidate for applications in photocatalysis due to its periodically porous structures and tunable structure. The COF skeletons consisted of different building blocks may result in different performance. Investigating the effects of different building blocks on energy levels and excitons for COF can provide some insight for designing excellent COF catalysts. Based on the first-principles many-body Green’s function theory, the electronic structures and optical properties of the three donor-acceptor COFs by employing the monomer 2,4,6-trimethyl-1,3,5-triazine (TMT) as the key acceptor subunit and the trigonal aldehyde monomers including the tris(4-formylphenyl) amine (TPA), 1,3,5-tris(4-formylphenyl) benzene (TFPB) and 2,4,6-tris(4-formylphenyl)-1,3,5-triazine (TFPT) as the donor subunit are calculated in this work. Regulation of the donor unit and interlayer interactions on the electronic structures and excitonic properties are analyzed. The results show that the valence band maximum (VBM) and conduction band minimum (CBM) energies of the system are varied by the alteration of donor subunit. From TPA to the TFPB or TFPT, the bandgaps of the system increase, the light absorption blue shift, and the exciton binding energies gradually increase. There is little effect on the band gap and excitation energy by replacing the TFPB with the TFPT. Among the three COFs, the positions of both CBM and VBM of the TFPT-TMT COF only match well with the chemical reaction potential of H2/H+ and O2/H2O, which is capable of photocatalytic overall water splitting. But the photocatalytic performance for the TFPT-TMT COF might be inhibited by the higher exciton binding energy. The exciton for the TPA-TMT COF is easier to separate according to the exciton distributions and the exciton binding energy. The effect of different building units on the electronic structure, excitation energy, and excitonic properties of COFs in monolayer COFs are in line with that in multilayer and bulk COFs. The variation of the energy levels and excitation energies of all the three COFs as the number of layers are consistent. With the increasing number of layers, the VBM and CBM shift up and down with respect to the vacuum level, respectively. The band gap gradually decreases. The energy tend to decrease slower with the more layer. The exciton energy for multilayer COFs is close to the bulk state. These results are significant to design and modify COFs.