The COVID-19 pandemic has drastically affected the socioeconomic activities and peoples' daily life, resulting in a change in locational preferences in the real estate markets. Although enormous efforts have been devoted to examining the housing price impacts of the COVID-19 pandemic, little is known about the responses of the real estate markets to the evolving pandemic control measures. This study investigates the price gradient effects of various pandemic-related policy shocks using a hedonic price model on the district-level property transaction data in Shanghai, China over a 48-month period from 2018 to 2021. We found that these shocks have significantly altered the bid-rent curves. The price gradient for residential property units decreased in absolute value to - 0.433 after Wuhan's lockdown, demonstrating peoples' preferences to avoid the high infection risks in districts closer to the city center. However, in the post-reopening and post-vaccine periods, the price gradient increased to - 0.463 and - 0.486, respectively, implying rational expectations of a recovering real estate market for the low infection and mortality rates. In addition, we discovered that Wuhan's lockdown has steepened the price gradient for commercial property units, suggesting a decline in business volumes and an increase in operating costs in the low-density districts imposed by the strict pandemic control measures. This study contributes to the empirical literature on the price gradient effects of the COVID-19 pandemic by extending the study period to the post-vaccine era.