How yin-hongwei/wangyiyun works
1. Repository type and boundary
- This is a Vue 2 single-page application that implements a NetEase Cloud Music–style web client.
- The repo is primarily the frontend. It does not contain the music backend; instead it consumes the external NeteaseCloudMusicApi service described in the README.
2. High-level runtime
- The app boots from src/main.js, mounts the root App.vue, and then hands off navigation to vue-router.
- At runtime, the browser hosts the entire UI; there is no server-side rendering or separate backend in this repo.
3. Routing and page-level structure
- src/router/index.js defines the app’s page boundaries.
- The main routed views live under src/views, including:
- IndexPage.vue for the home/landing experience
- SongList.vue for playlist/detail pages
- Search.vue for music search
- Player.vue for playback
- TheVideo.vue, Friends.vue, User.vue, TheSetting.vue
- This gives the app a page-oriented architecture, with each view composing shared components and shared state.
4. Shared UI components
- Reusable UI is concentrated in src/components.
- Notable shared pieces include:
- TheHeader.vue and TheFooter.vue for global chrome
- TheSwiper.vue for carousel/banner behavior
- SongListCard.vue for playlist/song list presentation
- SongAudio.vue for audio playback control/integration
- PlayIcon.vue and TheIcon.vue for icon-driven UI
- src/components/songType/ contains song-category subcomponents such as NewSong.vue and RecommendSong.vue, which suggests the home page is split into recommendation-oriented content sections.
5. State management and cross-page data flow
- src/store/index.js provides the shared application state via Vuex.
- This is the main boundary for data that must survive route changes, especially playback-related state, current track selection, and likely search/home data.
- The architecture is typical of a music player SPA: views fetch or request data, store centralizes state, and components render from store-driven props/computed values.
6. Backend/API integration
- The README states that the frontend calls the NeteaseCloudMusicApi backend.
- The technology stack includes axios, so network access is likely handled through HTTP requests from views, store actions, or shared mixins.
- From an architecture standpoint, the external API is the main data source for songs, playlists, search results, and lyrics.
7. Playback subsystem
- The most important functional subsystem is music playback.
- Player.vue is the dedicated playback page, while SongAudio.vue is the component most likely responsible for binding the HTML audio element and syncing playback state.
- Lyrics display is called out in the README, so playback is not just audio control; it also includes track metadata and lyric synchronization as part of the player experience.
8. Home/content presentation
- IndexPage.vue and the songType components indicate a content-discovery flow focused on featured/recommended music.
- TheSwiper.vue and SongListCard.vue support the presentation layer for banners and playlists.
- This area is likely driven by API responses rendered into cards and carousel sections rather than by local static content.
9. Search and discovery
- Search.vue is a separate discovery surface for querying music.
- In the architecture diagram, this should be shown as another consumer of the same remote music API and shared store, rather than as an isolated feature.
10. Styling and static assets
- Global styles are in src/assets/css/static.css.
- Icon assets are handled through src/assets/js/icon.js and the iconfont*.js files, which implies icon font-based rendering is part of the UI system.
- Images and other static media live under src/assets/img and static/img.
11. Application scaffolding and build pipeline
- The repo uses a classic Vue CLI/Webpack setup:
- build/ contains webpack build scripts and helpers
- config/ contains environment-specific config files for dev/prod/test
- index.html is the SPA host page
- This matters architecturally because the app is built as a bundled frontend, with separate development and production configurations.
12. Testing and quality gates
- The repo includes both:
- Unit tests under test/unit using Jest
- End-to-end tests under test/e2e using Nightwatch
- These test layers sit around the UI and route flows rather than around server logic, which matches the client-only architecture.
13. Architecture summary for a diagram
- The clean diagram for this repo is:
- Browser SPA shell → main.js → App.vue
- Router → page views in src/views
- Shared store → Vuex state in src/store
- Reusable UI components → src/components
- External NetEase Cloud Music API backend → data source via HTTP/axios
- The key interaction to emphasize is that route-driven views consume shared Vuex state and remote API data, while audio playback spans both the player view and reusable audio component.
Main entry points: index.js Router · main.js main.js · IndexPage.vue Home · Player.vue Player
Components 27
Runtime UI
Browser-hosted Vue single-page application
- index.html · Entry HTML shell for the bundled client
index.html
App Code
Source modules for routing, state, views, and shared UI
- main.js · Vue app bootstrap and mount point
src/main.js - App · Root application shell and layout container
src/App.vue - Router · Route definitions and page boundaries
src/router/index.js - Store · Shared application state across views
src/store/index.js - Mixins · Reusable behavior shared across components and views
src/mixins/index.js - Home · Landing and recommendation experience
src/views/IndexPage.vue - Song List · Playlist and song-list detail page
src/views/SongList.vue - Search · Music search and discovery surface
src/views/Search.vue - Player · Playback page with track and lyric experience
src/views/Player.vue - Video · Video browsing/playback page
src/views/TheVideo.vue - Friends · Social or friend activity page
src/views/Friends.vue - User · User profile and account page
src/views/User.vue - Settings · Application settings page
src/views/TheSetting.vue - Header · Global top navigation and branding
src/components/TheHeader.vue - Footer · Global bottom footer area
src/components/TheFooter.vue - Swiper · Banner and featured-content carousel
src/components/TheSwiper.vue - Song Card · Playlist and song list presentation
src/components/SongListCard.vue - Audio · Audio element integration and playback control
src/components/SongAudio.vue - Song Sections · Home page recommendation sections
src/components/songType/NewSong.vue - Icons · Icon font and icon helper layer
src/assets/js/icon.js - Global Styles · Shared application CSS
src/assets/css/static.css
Build Tooling
Webpack/Vue CLI build and environment configuration
Tests
Unit and end-to-end test layers
- Unit Tests · Component and logic unit test layer
test/unit/jest.conf.js - E2E Tests · Browser-level route and UI flow tests
test/e2e/nightwatch.conf.js
Other components
- Netease API · Remote music data service consumed over HTTP
Connections 33
- index.html → main.js: loads · SPA host page bootstraps the Vue app
- main.js → App: mounts · Application entry mounts the root component
- main.js → Router: installs · Bootstrap wires in client-side navigation
- main.js → Store: installs · Bootstrap attaches shared Vuex state
- main.js → Global Styles: includes · Global styles are loaded into the app
- Router → Home: routes · Home route resolves to the landing view
- Router → Song List: routes · Playlist/detail routes resolve here
- Router → Search: routes · Search route resolves to discovery UI
- Router → Player: routes · Playback route resolves to the player view
- Router → Video: routes · Video route resolves to the video page
- Router → Friends: routes · Social route resolves to friend activity
- Router → User: routes · User route resolves to profile UI
- Router → Settings: routes · Settings route resolves to preferences UI
- App → Header: composes · Root shell includes global header
- App → Footer: composes · Root shell includes global footer
- Home → Swiper: uses · Home view renders featured banner carousel
- Home → Song Sections: uses · Home view is split into recommendation sections
- Home → Song Card: renders · Home recommendations are shown as cards
- Song List → Song Card: renders · Playlist pages use shared list/card presentation
- Player → Audio: uses · Player page drives audio playback component
- Player → Store: syncs · Playback state is coordinated through shared store
- Audio → Store: syncs · Audio control updates shared playback state
- Search → Store: reads · Search results and state are shared through Vuex
- Song Sections → Netease API: fetches · Recommendation sections load remote music data
- Search → Netease API: queries · Search requests go to the remote music API
- Song List → Netease API: fetches · Playlist and detail data are loaded remotely
- Player → Netease API: fetches · Track metadata and lyrics come from the API
- Audio → Netease API: fetches · Playback metadata and audio source depend on API data
- Header → Icons: uses · Global chrome uses shared icon rendering
- Footer → Icons: uses · Footer uses shared icon assets
- Build → Config: reads · Build scripts consume environment settings
- Unit Tests → App: tests · Unit tests exercise components and app logic
- E2E Tests → Router: tests · End-to-end tests validate routed UI flows