|
1 |
| -This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app). |
| 1 | +# React实战之云音乐项目 |
2 | 2 |
|
3 |
| -## Available Scripts |
| 3 | +> 如果觉得不错,或者对你有帮助,点一个star~ coderwhy |
4 | 4 |
|
5 |
| -In the project directory, you can run: |
| 5 | +### 1.1. 项目简介 |
6 | 6 |
|
7 |
| -### `yarn start` |
| 7 | +使用React编写的云音乐PC Web项目,接口来源于开源的接口,自己已经做了部署。 |
8 | 8 |
|
9 |
| -Runs the app in the development mode.<br /> |
10 |
| -Open [http://localhost:3000](http://localhost:3000) to view it in the browser. |
| 9 | +项目已经完成功能如下:(你可以下载下来自己体验一下) |
11 | 10 |
|
12 |
| -The page will reload if you make edits.<br /> |
13 |
| -You will also see any lint errors in the console. |
| 11 | +推荐页面: |
14 | 12 |
|
15 |
| -### `yarn test` |
| 13 | +* 轮播图 |
| 14 | +* 热门推荐 |
| 15 | +* 新碟上架 |
| 16 | +* 榜单 |
| 17 | +* 等等 |
16 | 18 |
|
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 | + |
19 | 20 |
|
20 |
| -### `yarn build` |
| 21 | + |
21 | 22 |
|
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. |
| 23 | +歌曲播放: |
24 | 24 |
|
25 |
| -The build is minified and the filenames include the hashes.<br /> |
26 |
| -Your app is ready to be deployed! |
| 25 | +* 目前做了榜单中歌曲的点击播放; |
| 26 | +* 事实上其他页面只要将歌曲的id传入到redux中就可以,整个逻辑已经打通; |
| 27 | +* 做了歌曲的各种控制(暂停、播放、上一首、下一首、进度改变); |
| 28 | +* 做了播放循序切换:顺序播放、随机播放、单曲循环; |
| 29 | +* 做了歌词的解析、展示、滚动; |
27 | 30 |
|
28 |
| -See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information. |
| 31 | + |
29 | 32 |
|
30 |
| -### `yarn eject` |
| 33 | +排行榜页面: |
31 | 34 |
|
32 |
| -**Note: this is a one-way operation. Once you `eject`, you can’t go back!** |
| 35 | +* 各种榜单的切换; |
33 | 36 |
|
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. |
| 37 | + |
35 | 38 |
|
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. |
| 39 | +歌单页面: |
37 | 40 |
|
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. |
| 41 | +* 选择分类、选择分类后根据分类切换歌单; |
| 42 | +* 根据分类,歌单列表的展示; |
| 43 | +* 分页功能; |
39 | 44 |
|
40 |
| -## Learn More |
| 45 | + |
41 | 46 |
|
42 |
| -You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started). |
| 47 | +主播电台: |
43 | 48 |
|
44 |
| -To learn React, check out the [React documentation](https://reactjs.org/). |
| 49 | +* 电台分类的展示、滚动; |
| 50 | +* 不同分类展示不同的数据; |
| 51 | +* 电台排行榜展示、分页; |
45 | 52 |
|
46 |
| -### Code Splitting |
| 53 | + |
47 | 54 |
|
48 |
| -This section has moved here: https://facebook.github.io/create-react-app/docs/code-splitting |
| 55 | +歌手页面: |
49 | 56 |
|
50 |
| -### Analyzing the Bundle Size |
| 57 | +* 各种歌手分类(没找到接口,还自定义了一些数据) |
| 58 | +* 歌手字母分类、对应歌手展示; |
51 | 59 |
|
52 |
| -This section has moved here: https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size |
| 60 | + |
53 | 61 |
|
54 |
| -### Making a Progressive Web App |
| 62 | +新碟上架页面: |
55 | 63 |
|
56 |
| -This section has moved here: https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app |
| 64 | +* 热门新碟; |
| 65 | +* 全部新碟、分页展示; |
57 | 66 |
|
58 |
| -### Advanced Configuration |
| 67 | + |
59 | 68 |
|
60 |
| -This section has moved here: https://facebook.github.io/create-react-app/docs/advanced-configuration |
61 | 69 |
|
62 |
| -### Deployment |
63 | 70 |
|
64 |
| -This section has moved here: https://facebook.github.io/create-react-app/docs/deployment |
| 71 | +### 1.2. 项目规范 |
| 72 | + |
| 73 | +**项目规范:项目中有一些开发规范和代码风格** |
| 74 | + |
| 75 | +* 1.文件夹、文件名称统一小写、多个单词以连接符(-)连接; |
| 76 | +* 2.JavaScript变量名称采用小驼峰标识,常量全部使用大写字母,组件采用大驼峰; |
| 77 | +* 3.CSS采用普通CSS和styled-component结合来编写(全局采用普通CSS、局部采用styled-component); |
| 78 | +* 4.整个项目不再使用class组件,统一使用函数式组件,并且全面使用Hooks; |
| 79 | +* 5.所有的函数式组件,为了避免不必要的渲染,全部使用memo进行包裹; |
| 80 | +* 6.组件内部的状态,使用useState、useReducer;业务数据全部放在redux中管理; |
| 81 | +* 7.函数组件内部基本按照如下顺序编写代码: |
| 82 | + * 组件内部state管理; |
| 83 | + * redux的hooks代码; |
| 84 | + * 其他组件hooks代码; |
| 85 | + * 其他逻辑代码; |
| 86 | + * 返回JSX代码; |
| 87 | +* 8.redux代码规范如下: |
| 88 | + * redux结合ImmutableJS |
| 89 | + * 每个模块有自己独立的reducer,通过combineReducer进行合并; |
| 90 | + * 异步请求代码使用redux-thunk,并且写在actionCreators中; |
| 91 | + * redux直接采用redux hooks方式编写,不再使用connect; |
| 92 | +* 9.网络请求采用axios |
| 93 | + * 对axios进行二次封装; |
| 94 | + * 所有的模块请求会放到一个请求文件中单独管理; |
| 95 | +* 10.项目使用AntDesign |
| 96 | + * 项目中某些AntDesign中的组件会被拿过来使用; |
| 97 | + * 但是多部分组件还是自己进行编写; |
| 98 | +* 其他规范在项目中根据实际情况决定和编写; |
| 99 | + |
| 100 | + |
| 101 | + |
| 102 | +### 1.3. 项目运行 |
| 103 | + |
| 104 | +clone项目: |
| 105 | + |
| 106 | +``` |
| 107 | +git clone https://github.com/coderwhy/hy-react-web-music.git |
| 108 | +``` |
| 109 | + |
| 110 | +安装项目依赖: |
| 111 | + |
| 112 | +```shell |
| 113 | +yarn install |
| 114 | +``` |
| 115 | + |
| 116 | +项目运行: |
| 117 | + |
| 118 | +```shell |
| 119 | +yarn start |
| 120 | +``` |
| 121 | + |
65 | 122 |
|
66 |
| -### `yarn build` fails to minify |
67 | 123 |
|
68 |
| -This section has moved here: https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify |
|
0 commit comments