As a type of aggregation-induced emission (AIE) fluorescent probe, tetraphenylvinyl (TPE) or its derivatives are widely used in chemical imaging, biosensing and medical diagnosis. However, most studies have focused on molecular modification and functionalization of AIE to enhance the fluorescence emission intensity. There are few studies on the interaction between aggregation-induced emission luminogens (AIEgens) and nucleic acids, which was investigated in this paper. Experimental results showed the formation of a complex of AIE/DNA, leading to the quenching of the fluorescence of AIE molecules. Fluorescent test experiments with different temperatures proved that the quenching type was static quenching. The quenching constants, binding constants and thermodynamic parameters demonstrated that electrostatic and hydrophobic interactions promoted the binding process. Then, a label-free “on-off-on” fluorescent aptamer sensor for the detection of ampicillin (AMP) was constructed based on the interaction between the AIE probe and the aptamer of AMP. Linear range of the sensor is 0.2–10 nM with a limit of detection 0.06 nM. This fluorescent sensor was applied to detect AMP in real samples.