In this work, we propose a one-dimensional layered structure to realize the integration of various applications of solar energy spectrum based on phase-change materials (PCMs). Through the effective combination of PCMs and the designed structure, a tunable solar spectral directional absorption and switchable near-infrared band sensor can be simultaneously obtained on one sample. The research provides creative possibility for the applications of angle and polarization information of solar spectrum and narrowband filtering sensing.