Skip to content

Commit 7179bb1

Browse files
author
coderwhy
committed
网易云音乐react项目
0 parents  commit 7179bb1

File tree

137 files changed

+15851
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

137 files changed

+15851
-0
lines changed

.gitignore

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2+
3+
# dependencies
4+
/node_modules
5+
/.pnp
6+
.pnp.js
7+
8+
# testing
9+
/coverage
10+
11+
# production
12+
/build
13+
14+
# misc
15+
.DS_Store
16+
.env.local
17+
.env.development.local
18+
.env.test.local
19+
.env.production.local
20+
21+
npm-debug.log*
22+
yarn-debug.log*
23+
yarn-error.log*

README.md

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
2+
3+
## Available Scripts
4+
5+
In the project directory, you can run:
6+
7+
### `yarn start`
8+
9+
Runs the app in the development mode.<br />
10+
Open [http://localhost:3000](http://localhost:3000) to view it in the browser.
11+
12+
The page will reload if you make edits.<br />
13+
You will also see any lint errors in the console.
14+
15+
### `yarn test`
16+
17+
Launches the test runner in the interactive watch mode.<br />
18+
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.
19+
20+
### `yarn build`
21+
22+
Builds the app for production to the `build` folder.<br />
23+
It correctly bundles React in production mode and optimizes the build for the best performance.
24+
25+
The build is minified and the filenames include the hashes.<br />
26+
Your app is ready to be deployed!
27+
28+
See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.
29+
30+
### `yarn eject`
31+
32+
**Note: this is a one-way operation. Once you `eject`, you can’t go back!**
33+
34+
If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.
35+
36+
Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own.
37+
38+
You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it.
39+
40+
## Learn More
41+
42+
You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).
43+
44+
To learn React, check out the [React documentation](https://reactjs.org/).
45+
46+
### Code Splitting
47+
48+
This section has moved here: https://facebook.github.io/create-react-app/docs/code-splitting
49+
50+
### Analyzing the Bundle Size
51+
52+
This section has moved here: https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size
53+
54+
### Making a Progressive Web App
55+
56+
This section has moved here: https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app
57+
58+
### Advanced Configuration
59+
60+
This section has moved here: https://facebook.github.io/create-react-app/docs/advanced-configuration
61+
62+
### Deployment
63+
64+
This section has moved here: https://facebook.github.io/create-react-app/docs/deployment
65+
66+
### `yarn build` fails to minify
67+
68+
This section has moved here: https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify

craco.config.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
const path = require('path');
2+
3+
const resolve = dir => path.resolve(__dirname, dir);
4+
5+
module.exports = {
6+
webpack: {
7+
alias: {
8+
'@': resolve("src"),
9+
'components': resolve("src/components")
10+
}
11+
}
12+
}

package.json

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
{
2+
"name": "hy-react-music",
3+
"version": "0.1.0",
4+
"private": true,
5+
"dependencies": {
6+
"@craco/craco": "^5.6.4",
7+
"@testing-library/jest-dom": "^4.2.4",
8+
"@testing-library/react": "^9.3.2",
9+
"@testing-library/user-event": "^7.1.2",
10+
"antd": "^4.2.4",
11+
"axios": "^0.19.2",
12+
"classnames": "^2.2.6",
13+
"immutable": "^4.0.0-rc.12",
14+
"normalize.css": "^8.0.1",
15+
"react": "^16.13.1",
16+
"react-dom": "^16.13.1",
17+
"react-redux": "^7.2.0",
18+
"react-router-config": "^5.1.1",
19+
"react-router-dom": "^5.2.0",
20+
"react-scripts": "3.4.1",
21+
"redux": "^4.0.5",
22+
"redux-immutable": "^4.0.0",
23+
"redux-thunk": "^2.3.0",
24+
"styled-components": "^5.1.0"
25+
},
26+
"scripts": {
27+
"start": "craco start",
28+
"build": "craco build",
29+
"test": "craco test",
30+
"eject": "react-scripts eject"
31+
},
32+
"eslintConfig": {
33+
"extends": "react-app"
34+
},
35+
"browserslist": {
36+
"production": [
37+
">0.2%",
38+
"not dead",
39+
"not op_mini all"
40+
],
41+
"development": [
42+
"last 1 chrome version",
43+
"last 1 firefox version",
44+
"last 1 safari version"
45+
]
46+
}
47+
}

public/favicon.ico

4.19 KB
Binary file not shown.

public/index.html

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="utf-8" />
5+
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
6+
<meta name="viewport" content="width=device-width, initial-scale=1" />
7+
<meta name="theme-color" content="#000000" />
8+
<meta
9+
name="description"
10+
content="Web site created using create-react-app"
11+
/>
12+
<title>coderwhy music</title>
13+
</head>
14+
<body>
15+
<noscript>You need to enable JavaScript to run this app.</noscript>
16+
<div id="root"></div>
17+
</body>
18+
</html>

src/App.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import React from 'react';
2+
3+
import { Provider } from "react-redux";
4+
import store from "./store";
5+
6+
import HYMain from './pages/main';
7+
8+
function App() {
9+
return (
10+
<Provider store={store}>
11+
<HYMain/>
12+
</Provider>
13+
);
14+
}
15+
16+
export default App;

src/assets/css/base.css

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
@import '~antd/dist/antd.css';
2+
@import "~normalize.css";
3+
4+
/* 样式的重置 */
5+
body, html, h1, h2, h3, h4, h5, h6, ul, ol, li, dl, dt, dd, header, menu, section, p, input, td, th, ins {
6+
padding: 0;
7+
margin: 0;
8+
}
9+
10+
ul, ol, li {
11+
list-style: none;
12+
}
13+
14+
a {
15+
text-decoration: none;
16+
color: #666;
17+
}
18+
19+
a:hover {
20+
color: #666;
21+
text-decoration: underline;
22+
}
23+
24+
i, em {
25+
font-style: normal;
26+
}
27+
28+
input, textarea, button, select, a {
29+
outline: none;
30+
border: none;
31+
}
32+
33+
table {
34+
border-collapse: collapse;
35+
border-spacing: 0;
36+
}
37+
38+
img {
39+
border: none;
40+
vertical-align: middle;
41+
}
42+
43+
/* 全局样式 */
44+
body, textarea, select, input, button {
45+
font-size: 12px;
46+
color: #333;
47+
font-family: Arial, Helvetica, sans-serif;
48+
background-color: #f5f5f5;
49+
}
50+
51+
.text-nowrap {
52+
white-space: nowrap;
53+
text-overflow: ellipsis;
54+
overflow: hidden;
55+
}
56+
57+
.wrap-v1 {
58+
width: 1100px;
59+
margin: 0 auto;
60+
}
61+
62+
.wrap-v2 {
63+
width: 980px;
64+
margin: 0 auto;
65+
}
66+
67+
.sprite_01 {
68+
background: url(http://github.com/..%3Cspan%20class=pl-c1%3E/%3C/span%3Eimg/sprite_01.png) no-repeat 0 9999px;
69+
}
70+
71+
.sprite_02 {
72+
background: url(http://github.com/..%3Cspan%20class=pl-c1%3E/%3C/span%3Eimg/sprite_02.png) no-repeat 0 9999px;
73+
}
74+
75+
.sprite_covor {
76+
background: url(http://github.com/..%3Cspan%20class=pl-c1%3E/%3C/span%3Eimg/sprite_cover.png) no-repeat 0 9999px;
77+
}
78+
79+
.sprite_icon {
80+
background: url(http://github.com/..%3Cspan%20class=pl-c1%3E/%3C/span%3Eimg/sprite_icon.png) no-repeat 0 9999px;
81+
}
82+
83+
.sprite_icon2 {
84+
background: url(http://github.com/..%3Cspan%20class=pl-c1%3E/%3C/span%3Eimg/sprite_icon2.png) no-repeat 0 9999px;
85+
}
86+
87+
.sprite_button {
88+
background: url(http://github.com/..%3Cspan%20class=pl-c1%3E/%3C/span%3Eimg/sprite_button.png) no-repeat 0 9999px;
89+
}
90+
91+
.sprite_button2 {
92+
background: url(http://github.com/..%3Cspan%20class=pl-c1%3E/%3C/span%3Eimg/sprite_button2.png) no-repeat 0 9999px;
93+
}
94+
95+
.sprite_table {
96+
background: url(http://github.com/..%3Cspan%20class=pl-c1%3E/%3C/span%3Eimg/sprite_table.png) no-repeat 0 9999px;
97+
}
98+
99+
.image_cover {
100+
position: absolute;
101+
left: 0;
102+
right: 0;
103+
top: 0;
104+
bottom: 0;
105+
text-indent: -9999px;
106+
background: url(http://github.com/..%3Cspan%20class=pl-c1%3E/%3C/span%3Eimg/sprite_cover.png) no-repeat -145px -57px;
107+
}
303 Bytes
Loading
304 Bytes
Loading

src/assets/img/banner_sprite.png

4.35 KB
Loading

src/assets/img/download.png

17.7 KB
Loading

src/assets/img/friend_sprite.jpg

23.9 KB
Loading

src/assets/img/mine_sprite.png

22.7 KB
Loading

src/assets/img/radio_slide.png

1.38 KB
Loading

src/assets/img/recommend-top-bg.png

3.04 KB
Loading

src/assets/img/sprite_01.png

2.97 KB
Loading

src/assets/img/sprite_02.png

13.5 KB
Loading

src/assets/img/sprite_button.png

45.2 KB
Loading

src/assets/img/sprite_button2.png

13.7 KB
Loading

src/assets/img/sprite_cover.png

77 KB
Loading

src/assets/img/sprite_footer_01.png

22.7 KB
Loading

src/assets/img/sprite_footer_02.png

47.2 KB
Loading

src/assets/img/sprite_icon.png

14.1 KB
Loading

src/assets/img/sprite_icon2.png

14.6 KB
Loading

src/assets/img/sprite_table.png

2.7 KB
Loading

src/common/global-style.js

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
// 扩大可点击区域
2+
const extendClick = () => {
3+
return `
4+
position: relative;
5+
&:before {
6+
content: '';
7+
position: absolute;
8+
top: -10px; bottom: -10px; left: -10px; right: -10px;
9+
};
10+
`
11+
}
12+
// 一行文字溢出部分用... 代替
13+
const noWrap = () => {
14+
return `
15+
text-overflow: ellipsis;
16+
overflow: hidden;
17+
white-space: nowrap;
18+
`
19+
}
20+
21+
export default {
22+
'theme-color': '#C20C0C',
23+
'theme-color-shadow': 'rgba(212, 68, 57, .5)',
24+
'font-color-light': '#f1f1f1',
25+
'font-color-desc': '#2E3030',
26+
'font-color-desc-v2': '#bba8a8',// 略淡
27+
'font-size-s': '12px',
28+
'font-size-n': '14px',
29+
'font-size-l': '16px',
30+
'font-size-ll': '20px',
31+
"border-color": '#e4e4e4',
32+
'background-color': '#f2f3f4',
33+
'background-color-shadow': 'rgba(0, 0, 0, 0.3)',
34+
'highlight-background-color': '#fff',
35+
extendClick,
36+
noWrap
37+
}

src/components/album-cover/index.js

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import React, { memo } from 'react';
2+
3+
import {
4+
getSizeImage
5+
} from "@/utils/format-utils";
6+
7+
import {
8+
AlbumWrapper
9+
} from "./style";
10+
11+
12+
export default memo(function HYAlbumCover(props) {
13+
const { info, size = "100px", width = "118px", bgp = "-570px" } = props;
14+
15+
return (
16+
<AlbumWrapper size={size} width={width} bgp={bgp}>
17+
<div className="album-image">
18+
<img src={getSizeImage(info.picUrl, 150)} alt="" />
19+
<a href="/abc" className="cover sprite_covor">{info.name}</a>
20+
</div>
21+
<div className="album-info">
22+
<div className="name">{info.name}</div>
23+
<div className="artist">{info.artist.name}</div>
24+
</div>
25+
</AlbumWrapper>
26+
)
27+
})

0 commit comments

Comments
 (0)