During the epidemic, the mental health and sleeping quality of college students were affected to varying degrees, which may influence the quality of life and well-being. This cross-sectional aimed to determine the frequency of psychologically negative states and poor sleeping quality among undergraduate students during the Covid-19 pandemic and explore the correlation between mental health and sleeping quality and the moderating effect of the attachment style. Relevant information was collected with an online questionnaire, which was distributed among 72 undergraduate students at prestigious universities in Shanghai and Nanjing. The mental health status of the subjects was assessed using the Depression, Anxiety, and Stress Scale - 21 (DASS-21), the sleep quality of the students using the Pittsburgh Sleep Quality Index (PSQI) questionnaire and the attachment style using the Experiences in Close Relationships Inventory (ECR). The study revealed that 70% of the subjects were suffering stress of different levels, two-thirds of them were undergoing varying degrees of depression, and nearly 85% were bearing anxiety after the outbreak of COVID-19. The prevalence of poor sleeping quality among college students was 36.2%. The study concluded that stress, anxiety and depression index were all in direct proportion to the level of sleeping problems. The attachment style may play a more or less role in moderating the direct proportion. The findings could help choose appropriate interventions to try to solve the mental and sleep problems for people with different attachment styles.