With the expansion of Chinese university campuses, electric bikes (E-bikes) have become the most sustainable and effective commuting option because they are a flexible and energy-saving travel mode. Consequently, campus E-bike charging piles have become one of the most essential public service facilities on campuses. However, since most Chinese campuses are closed and independent, the principles of urban public service facilities cannot be simply applied to the layout and use of campus charging facilities. Thus, this study focuses on Zijingang Campus at Zhejiang University, and proposes an optimization strategy for the spatial and temporal layout of E-bike charging piles on the campus. First, trip chain demand models are constructed to examine the travel patterns of E-bike users on campus and the demands for charging areas and time. Second, a space location model is constructed to locate the charging piles in areas with high demand. Finally, according to the charging times of different users, user charging time is integrated into the strategy. This study enhances the layout and utilization system of campus E-bike charging facilities by considering both temporal and spatial dimensions. Overall, this study contributes to the advancement of sustainable transportation infrastructure planning on a campus-wide scale, offering theoretical insights for the design and utilization of functional facilities in large-scale, semi-enclosed environments (e.g., university campuses).