A novel dual-mode microfluidic analytical device integrating self-powered photoelectrochemical (PEC) sensing with electrochromic visualization analysis was developed for ultrasensitive ofloxacin (OFL) detection. First, an advanced dual direct Z-scheme BiVO4@Ni-ZnIn2S4/Bi2S3 (BVZIS) heterojunction was designed as a photoanode matrix to steadily provide electrons. The dual Z-scheme structure formed in photoactive BVZIS composites greatly accelerated the migration of electrons. In addition, the doping of Ni in ZnIn2S4 markedly enhanced the optical absorption and promoted the separation of the photocarrier. Second, electrochromic material polyaniline-modified Au (Au/PANI) was first electrodeposited on the photocathode for immobilizing aptamers and realizing visualized readout. On the one hand, Au/PANI with excellent conductivity could receive electrons from the photoanode without external energy supply. On the other hand, PANI would be rapidly reduced by the received electrons and change its color from blue to green obviously. With the increase in OFL, the increased steric hindrance resulted in the significant decline in the PEC signal and RGBgreen value. Third, wide linear ranges of PEC (0.05 pg/mL to 150 ng/mL) and electrochromic technique (0.1 pg/mL to 100 ng/mL) as well as low detection limits of PEC (18 fg/mL) and electrochromic (30 fg/mL) sensors could achieve the ultrasensitive detection of OFL in milk and river water.