Provided in the present invention are a compound as shown in formula (I), a pharmaceutical composition comprising same, and a preparation method and use thereof as a NS5B polymerase inhibitor, a DNA polymerase inhibitor or a reverse transcriptase inhibitor for preventing or treating viral diseases or cancers.