├── .babelrc ├── .editorconfig ├── .gitignore ├── .postcssrc.js ├── README.md ├── build ├── build.js ├── check-versions.js ├── logo.png ├── utils.js ├── vue-loader.conf.js ├── webpack.base.conf.js ├── webpack.dev.conf.js └── webpack.prod.conf.js ├── config ├── dev.env.js ├── index.js └── prod.env.js ├── index.html ├── package-lock.json ├── package.json ├── src ├── App.vue ├── app │ └── wilddog.js ├── assets │ ├── banner │ │ ├── bj.jpg │ │ └── footer-taihe.png │ ├── imgage │ │ ├── error.jpg │ │ ├── load.jpg │ │ └── sq.png │ └── logo.png ├── components │ ├── LRC.vue │ ├── Swiper.vue │ ├── TodayList.vue │ ├── albumList.vue │ ├── footer.vue │ ├── footerMusic.vue │ ├── musicList.vue │ ├── notImgSongList.vue │ ├── popup.vue │ ├── searchList.vue │ ├── search_nav.vue │ ├── singerList.vue │ ├── singerUlList.vue │ ├── songSheet.vue │ └── userLikeSongs.vue ├── init.vue ├── main.js ├── page │ ├── MusicNav.vue │ ├── Singer.vue │ ├── Song.vue │ ├── TodayPush.vue │ ├── album │ │ └── index.vue │ ├── index.vue │ ├── logn.vue │ ├── musiclist │ │ ├── Classic.vue │ │ ├── Hot.vue │ │ └── New.vue │ ├── play │ │ └── MusicPlay.vue │ ├── search │ │ └── search.vue │ ├── singer │ │ ├── singerList.vue │ │ └── singer_info.vue │ ├── songsheet │ │ ├── songSheet.vue │ │ ├── songSheetType.vue │ │ └── songlists.vue │ └── user │ │ ├── register.vue │ │ └── user.vue ├── router │ └── index.js └── utils │ └── request.js └── static ├── .gitkeep └── favicon.ico /.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": [ 3 | ["env", { 4 | "modules": false, 5 | "targets": { 6 | "browsers": ["> 1%", "last 2 versions", "not ie <= 8"] 7 | } 8 | }], 9 | "stage-2" 10 | ], 11 | "plugins": ["transform-vue-jsx", "transform-runtime",[ 12 | "component", 13 | { 14 | "libraryName": "element-ui", 15 | "styleLibraryName": "theme-chalk" 16 | } 17 | ]] 18 | } 19 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | charset = utf-8 5 | indent_style = space 6 | indent_size = 2 7 | end_of_line = lf 8 | insert_final_newline = true 9 | trim_trailing_whitespace = true 10 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | node_modules/ 3 | /dist/ 4 | npm-debug.log* 5 | yarn-debug.log* 6 | yarn-error.log* 7 | 8 | # Editor directories and files 9 | .idea 10 | .vscode 11 | *.suo 12 | *.ntvs* 13 | *.njsproj 14 | *.sln 15 | *.git 16 | -------------------------------------------------------------------------------- /.postcssrc.js: -------------------------------------------------------------------------------- 1 | // https://github.com/michael-ciniawsky/postcss-load-config 2 | 3 | module.exports = { 4 | "plugins": { 5 | "postcss-import": {}, 6 | "postcss-url": {}, 7 | // to edit target browsers: use "browserslist" field in package.json 8 | "autoprefixer": {} 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ### 飞飞音乐网(WebApp) 2 | 3 | > 为了打代码能快地飞起还能听歌。所以利用了工作之余的时间由我个人独立开发。使用H5音频元素开发出了此webApp名为飞飞音乐 4 | --- 5 | ### 效果演示 6 | ####   手机扫一扫 7 | 8 | ![图片](https://img-blog.csdnimg.cn/2019031420572368.png) 9 | 10 |   或者点击 [观看网站](http://feifei.ink) (请用chrome手机模式预览) 11 | 12 | --- 13 | 14 | #### 技术栈 15 | * Vue2.5     **用于构建用户界面的 MVVM 框架、数据驱动视图** 16 | * axios      **用来请求网络请求后端 API 音乐数据** 17 | * vue-router     **为单页面应用提供的路由系统 使用了 Lazy Loading Routes 技术来实现异步加载优化性能** 18 | * vue-aplayer    **音乐播放组件,实现全局共享音乐** 19 | * element-ui     **UI框架布局,使用简单图标,弹框** 20 | * nprogress     **轻量级Web进度条提升用户友好性** 21 | * vue-lazyload    **节省用户流量,优化页面加载速度,减低性能开销** 22 | * 野狗通信云    **提供第三方实时通信引擎服务,记录用户数据** 23 | * 自定义组件     **实现组件化开发,全局享用** 24 | #### 项目功能 25 |   1.**用户登录 --完成** 26 | 27 |   2.**用户注册 --完成** 28 | 29 |   3.**智能搜索 --完成** 30 | 31 |   4.**歌曲播放 --完成** 32 | 33 |   5.**下载收藏 --完成** 34 | 35 |   6.**歌词同步 --完成** 36 | 37 |   7.**下拉刷新 --完成** 38 | 39 |   8.**歌曲分类 --完成** 40 | 41 |   9.**歌曲推荐 --完成** 42 | 43 |   10.**歌手筛选 --完成** 44 | 45 |   11.**歌曲排名 --完成** 46 | 47 | #### **部分页面展示(查看所有页面请[观看网站](http://feifei.ink))** 48 | #### **首页、播放页面** 49 | 50 | ![图片](http://thyrsi.com/t6/675/1551432964x2890174040.png)![图片](http://thyrsi.com/t6/675/1551433035x2890174040.png) 51 | 52 | #### **搜索页面、我的页面** 53 | ![图片](https://img-blog.csdnimg.cn/2019031419164298.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzQxMzg3ODgy,size_16,color_FFFFFF,t_70)![图片](https://img-blog.csdnimg.cn/20190314190949920.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzQxMzg3ODgy,size_16,color_FFFFFF,t_70) 54 | 55 | ### 最后总结 56 | --- 57 | 1、因为不是百度音乐官方(千千音乐),在一些接口数据上并不是很齐全,比如获取歌单,KTV,歌曲MV,歌手演出,不过后期我会收集数据并搭建后端服务完成,目前数据库已经开始设计。 58 | 59 | 2、项目中有些的功能复杂有的简单。特别个个组件直接传到数据,父子组件/兄弟组件/祖孙组件,并且类型居多,众多的数据和逻辑一度让人很头疼,在设计初期花了点时间。不过在慢慢建设中,渐渐熟悉了困难一点点解决。也很高兴在遇到难点时候一直没有放弃。 60 | 61 | 3、在项目数据共享这块采用Vue官网提供的依赖注入(provide/inject)取代Vuex,这点和很多使用Vue做音乐项目的作者有所不同,虽然Vuex帮助我们处理共享状态管理,但它还带来了更多概念和样板的成本。(不过在后期的版本迭代中会新出目前还没有实现的功能木块,到时候会使用上Vuex,大型单页面应用中因为vuex的存在,表现依然出色,在处理复杂交互逻辑的时候,vuex的存在是不可或缺的。所以说利用 vue + vuex 完全可以去做大型的单页面项目) 62 | 63 | 4、网站开始写,从登陆、注册、首页、歌单、专辑、歌手、分类、榜单、智能搜索、收藏下载、个人中心等等...到购买服务器部署上线。所有流程走完后,不但对vue的理解更深一层,而且对以后掌控大型项目的时候也有非常多的帮助,做一个实际的项目才能对自己有很大的提升。 64 | 65 | 5、开发期间,出现了很多问题,曾一度怀疑,花几个月的时间做这样一个项目到底有没有意义。期初打算是上手Vue练习下,结果不知不觉越做越大,到后来也更喜欢上它了,所有坚持下来后我相信一切都是值得的。 66 | 67 | 6、通过学习开发一个 Vue 多功能项目,让自己更熟练的使用 Vue框架、模块化开发、ES6/7 等等知识,提高自己的技术能力。 68 | 69 | ### 最终目标 70 | --- 71 | 1、使用uni-app 开发跨 Android 和 IOS 的原生APP版本 72 | 73 | 2、使用Java搭建后端API服务,并制作后台数据管理 74 | 75 | 3、下一次github仓库会发布别的项目,技术选型采用React框架,请敬请期待吧... 76 | 77 | ### install dependencies 78 | ``` 79 | npm install 80 | ``` 81 | 82 | ### serve with hot reload at localhost:8080 83 | ``` 84 | npm run dev 85 | ``` 86 | 87 | ### build for production with minification 88 | ``` 89 | npm run build 90 | ``` 91 | 92 | -------------------------------------------------------------------------------- /build/build.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | require('./check-versions')() 3 | 4 | process.env.NODE_ENV = 'production' 5 | 6 | const ora = require('ora') 7 | const rm = require('rimraf') 8 | const path = require('path') 9 | const chalk = require('chalk') 10 | const webpack = require('webpack') 11 | const config = require('../config') 12 | const webpackConfig = require('./webpack.prod.conf') 13 | 14 | const spinner = ora('building for production...') 15 | spinner.start() 16 | 17 | rm(path.join(config.build.assetsRoot, config.build.assetsSubDirectory), err => { 18 | if (err) throw err 19 | webpack(webpackConfig, (err, stats) => { 20 | spinner.stop() 21 | if (err) throw err 22 | process.stdout.write(stats.toString({ 23 | colors: true, 24 | modules: false, 25 | children: false, // If you are using ts-loader, setting this to true will make TypeScript errors show up during build. 26 | chunks: false, 27 | chunkModules: false 28 | }) + '\n\n') 29 | 30 | if (stats.hasErrors()) { 31 | console.log(chalk.red(' Build failed with errors.\n')) 32 | process.exit(1) 33 | } 34 | 35 | console.log(chalk.cyan(' Build complete.\n')) 36 | console.log(chalk.yellow( 37 | ' Tip: built files are meant to be served over an HTTP server.\n' + 38 | ' Opening index.html over file:// won\'t work.\n' 39 | )) 40 | }) 41 | }) 42 | -------------------------------------------------------------------------------- /build/check-versions.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | const chalk = require('chalk') 3 | const semver = require('semver') 4 | const packageConfig = require('../package.json') 5 | const shell = require('shelljs') 6 | 7 | function exec (cmd) { 8 | return require('child_process').execSync(cmd).toString().trim() 9 | } 10 | 11 | const versionRequirements = [ 12 | { 13 | name: 'node', 14 | currentVersion: semver.clean(process.version), 15 | versionRequirement: packageConfig.engines.node 16 | } 17 | ] 18 | 19 | if (shell.which('npm')) { 20 | versionRequirements.push({ 21 | name: 'npm', 22 | currentVersion: exec('npm --version'), 23 | versionRequirement: packageConfig.engines.npm 24 | }) 25 | } 26 | 27 | module.exports = function () { 28 | const warnings = [] 29 | 30 | for (let i = 0; i < versionRequirements.length; i++) { 31 | const mod = versionRequirements[i] 32 | 33 | if (!semver.satisfies(mod.currentVersion, mod.versionRequirement)) { 34 | warnings.push(mod.name + ': ' + 35 | chalk.red(mod.currentVersion) + ' should be ' + 36 | chalk.green(mod.versionRequirement) 37 | ) 38 | } 39 | } 40 | 41 | if (warnings.length) { 42 | console.log('') 43 | console.log(chalk.yellow('To use this template, you must update following to modules:')) 44 | console.log() 45 | 46 | for (let i = 0; i < warnings.length; i++) { 47 | const warning = warnings[i] 48 | console.log(' ' + warning) 49 | } 50 | 51 | console.log() 52 | process.exit(1) 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /build/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lookwe/vue-music/e60bdc63055b7c011db75cfbcb83edb77e7281e2/build/logo.png -------------------------------------------------------------------------------- /build/utils.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | const path = require('path') 3 | const config = require('../config') 4 | const ExtractTextPlugin = require('extract-text-webpack-plugin') 5 | const packageConfig = require('../package.json') 6 | 7 | exports.assetsPath = function (_path) { 8 | const assetsSubDirectory = process.env.NODE_ENV === 'production' 9 | ? config.build.assetsSubDirectory 10 | : config.dev.assetsSubDirectory 11 | 12 | return path.posix.join(assetsSubDirectory, _path) 13 | } 14 | 15 | exports.cssLoaders = function (options) { 16 | options = options || {} 17 | 18 | const cssLoader = { 19 | loader: 'css-loader', 20 | options: { 21 | sourceMap: options.sourceMap 22 | } 23 | } 24 | 25 | const postcssLoader = { 26 | loader: 'postcss-loader', 27 | options: { 28 | sourceMap: options.sourceMap 29 | } 30 | } 31 | 32 | // generate loader string to be used with extract text plugin 33 | function generateLoaders (loader, loaderOptions) { 34 | const loaders = options.usePostCSS ? [cssLoader, postcssLoader] : [cssLoader] 35 | 36 | if (loader) { 37 | loaders.push({ 38 | loader: loader + '-loader', 39 | options: Object.assign({}, loaderOptions, { 40 | sourceMap: options.sourceMap 41 | }) 42 | }) 43 | } 44 | 45 | // Extract CSS when that option is specified 46 | // (which is the case during production build) 47 | if (options.extract) { 48 | return ExtractTextPlugin.extract({ 49 | use: loaders, 50 | fallback: 'vue-style-loader', 51 | publicPath: '../../' 52 | }) 53 | } else { 54 | return ['vue-style-loader'].concat(loaders) 55 | } 56 | } 57 | 58 | // https://vue-loader.vuejs.org/en/configurations/extract-css.html 59 | return { 60 | css: generateLoaders(), 61 | postcss: generateLoaders(), 62 | less: generateLoaders('less'), 63 | sass: generateLoaders('sass', { indentedSyntax: true }), 64 | scss: generateLoaders('sass'), 65 | stylus: generateLoaders('stylus'), 66 | styl: generateLoaders('stylus') 67 | } 68 | } 69 | 70 | // Generate loaders for standalone style files (outside of .vue) 71 | exports.styleLoaders = function (options) { 72 | const output = [] 73 | const loaders = exports.cssLoaders(options) 74 | 75 | for (const extension in loaders) { 76 | const loader = loaders[extension] 77 | output.push({ 78 | test: new RegExp('\\.' + extension + '$'), 79 | use: loader 80 | }) 81 | } 82 | 83 | return output 84 | } 85 | 86 | exports.createNotifierCallback = () => { 87 | const notifier = require('node-notifier') 88 | 89 | return (severity, errors) => { 90 | if (severity !== 'error') return 91 | 92 | const error = errors[0] 93 | const filename = error.file && error.file.split('!').pop() 94 | 95 | notifier.notify({ 96 | title: packageConfig.name, 97 | message: severity + ': ' + error.name, 98 | subtitle: filename || '', 99 | icon: path.join(__dirname, 'logo.png') 100 | }) 101 | } 102 | } 103 | -------------------------------------------------------------------------------- /build/vue-loader.conf.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | const utils = require('./utils') 3 | const config = require('../config') 4 | const isProduction = process.env.NODE_ENV === 'production' 5 | const sourceMapEnabled = isProduction 6 | ? config.build.productionSourceMap 7 | : config.dev.cssSourceMap 8 | 9 | module.exports = { 10 | loaders: utils.cssLoaders({ 11 | sourceMap: sourceMapEnabled, 12 | extract: isProduction 13 | }), 14 | cssSourceMap: sourceMapEnabled, 15 | cacheBusting: config.dev.cacheBusting, 16 | transformToRequire: { 17 | video: ['src', 'poster'], 18 | source: 'src', 19 | img: 'src', 20 | image: 'xlink:href' 21 | }, 22 | 23 | } 24 | -------------------------------------------------------------------------------- /build/webpack.base.conf.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | const path = require('path') 3 | const utils = require('./utils') 4 | const config = require('../config') 5 | const vueLoaderConfig = require('./vue-loader.conf') 6 | 7 | function resolve (dir) { 8 | return path.join(__dirname, '..', dir) 9 | } 10 | 11 | 12 | 13 | module.exports = { 14 | context: path.resolve(__dirname, '../'), 15 | entry: { 16 | app: './src/main.js' 17 | }, 18 | output: { 19 | path: config.build.assetsRoot, 20 | filename: '[name].js', 21 | publicPath: process.env.NODE_ENV === 'production' 22 | ? config.build.assetsPublicPath 23 | : config.dev.assetsPublicPath 24 | }, 25 | resolve: { 26 | extensions: ['.js', '.vue', '.json'], 27 | alias: { 28 | 'vue$': 'vue/dist/vue.esm.js', 29 | '@': resolve('src'), 30 | } 31 | }, 32 | module: { 33 | rules: [ 34 | { 35 | test: /\.vue$/, 36 | loader: 'vue-loader', 37 | options: vueLoaderConfig 38 | }, 39 | { 40 | test: /\.js$/, 41 | loader: 'babel-loader', 42 | include: [resolve('src'), resolve('test'), resolve('node_modules/webpack-dev-server/client')] 43 | }, 44 | { 45 | test: /\.(png|jpe?g|gif|svg)(\?.*)?$/, 46 | loader: 'url-loader', 47 | options: { 48 | limit: 10000, 49 | name: utils.assetsPath('img/[name].[hash:7].[ext]') 50 | } 51 | }, 52 | { 53 | test: /\.(mp4|webm|ogg|mp3|wav|flac|aac)(\?.*)?$/, 54 | loader: 'url-loader', 55 | options: { 56 | limit: 10000, 57 | name: utils.assetsPath('media/[name].[hash:7].[ext]') 58 | } 59 | }, 60 | { 61 | test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/, 62 | loader: 'url-loader', 63 | options: { 64 | limit: 10000, 65 | name: utils.assetsPath('fonts/[name].[hash:7].[ext]') 66 | } 67 | } 68 | ] 69 | }, 70 | node: { 71 | // prevent webpack from injecting useless setImmediate polyfill because Vue 72 | // source contains it (although only uses it if it's native). 73 | setImmediate: false, 74 | // prevent webpack from injecting mocks to Node native modules 75 | // that does not make sense for the client 76 | dgram: 'empty', 77 | fs: 'empty', 78 | net: 'empty', 79 | tls: 'empty', 80 | child_process: 'empty' 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /build/webpack.dev.conf.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | const utils = require('./utils') 3 | const webpack = require('webpack') 4 | const config = require('../config') 5 | const merge = require('webpack-merge') 6 | const path = require('path') 7 | const baseWebpackConfig = require('./webpack.base.conf') 8 | const CopyWebpackPlugin = require('copy-webpack-plugin') 9 | const HtmlWebpackPlugin = require('html-webpack-plugin') 10 | const FriendlyErrorsPlugin = require('friendly-errors-webpack-plugin') 11 | const portfinder = require('portfinder') 12 | 13 | const HOST = process.env.HOST 14 | const PORT = process.env.PORT && Number(process.env.PORT) 15 | 16 | const devWebpackConfig = merge(baseWebpackConfig, { 17 | module: { 18 | rules: utils.styleLoaders({ sourceMap: config.dev.cssSourceMap, usePostCSS: true }) 19 | }, 20 | // cheap-module-eval-source-map is faster for development 21 | devtool: config.dev.devtool, 22 | 23 | // these devServer options should be customized in /config/index.js 24 | devServer: { 25 | clientLogLevel: 'warning', 26 | historyApiFallback: { 27 | rewrites: [ 28 | { from: /.*/, to: path.posix.join(config.dev.assetsPublicPath, 'index.html') }, 29 | ], 30 | }, 31 | hot: true, 32 | contentBase: false, // since we use CopyWebpackPlugin. 33 | compress: true, 34 | host: HOST || config.dev.host, 35 | port: PORT || config.dev.port, 36 | open: config.dev.autoOpenBrowser, 37 | overlay: config.dev.errorOverlay 38 | ? { warnings: false, errors: true } 39 | : false, 40 | publicPath: config.dev.assetsPublicPath, 41 | proxy: config.dev.proxyTable, 42 | quiet: true, // necessary for FriendlyErrorsPlugin 43 | watchOptions: { 44 | poll: config.dev.poll, 45 | } 46 | }, 47 | plugins: [ 48 | new webpack.DefinePlugin({ 49 | 'process.env': require('../config/dev.env') 50 | }), 51 | new webpack.HotModuleReplacementPlugin(), 52 | new webpack.NamedModulesPlugin(), // HMR shows correct file names in console on update. 53 | new webpack.NoEmitOnErrorsPlugin(), 54 | // https://github.com/ampedandwired/html-webpack-plugin 55 | new HtmlWebpackPlugin({ 56 | filename: 'index.html', 57 | template: 'index.html', 58 | inject: true 59 | }), 60 | // copy custom static assets 61 | new CopyWebpackPlugin([ 62 | { 63 | from: path.resolve(__dirname, '../static'), 64 | to: config.dev.assetsSubDirectory, 65 | ignore: ['.*'] 66 | } 67 | ]), 68 | 69 | ] 70 | }) 71 | 72 | module.exports = new Promise((resolve, reject) => { 73 | portfinder.basePort = process.env.PORT || config.dev.port 74 | portfinder.getPort((err, port) => { 75 | if (err) { 76 | reject(err) 77 | } else { 78 | // publish the new Port, necessary for e2e tests 79 | process.env.PORT = port 80 | // add port to devServer config 81 | devWebpackConfig.devServer.port = port 82 | 83 | // Add FriendlyErrorsPlugin 84 | devWebpackConfig.plugins.push(new FriendlyErrorsPlugin({ 85 | compilationSuccessInfo: { 86 | messages: [`Your application is running here: http://${devWebpackConfig.devServer.host}:${port}`], 87 | }, 88 | onErrors: config.dev.notifyOnErrors 89 | ? utils.createNotifierCallback() 90 | : undefined 91 | })) 92 | 93 | resolve(devWebpackConfig) 94 | } 95 | }) 96 | }) 97 | -------------------------------------------------------------------------------- /build/webpack.prod.conf.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | const path = require('path') 3 | const utils = require('./utils') 4 | const webpack = require('webpack') 5 | const config = require('../config') 6 | const merge = require('webpack-merge') 7 | const baseWebpackConfig = require('./webpack.base.conf') 8 | const CopyWebpackPlugin = require('copy-webpack-plugin') 9 | const HtmlWebpackPlugin = require('html-webpack-plugin') 10 | const ExtractTextPlugin = require('extract-text-webpack-plugin') 11 | const OptimizeCSSPlugin = require('optimize-css-assets-webpack-plugin') 12 | const UglifyJsPlugin = require('uglifyjs-webpack-plugin') 13 | 14 | const env = require('../config/prod.env') 15 | 16 | const webpackConfig = merge(baseWebpackConfig, { 17 | module: { 18 | rules: utils.styleLoaders({ 19 | sourceMap: config.build.productionSourceMap, 20 | extract: true, 21 | usePostCSS: true 22 | }) 23 | }, 24 | devtool: config.build.productionSourceMap ? config.build.devtool : false, 25 | output: { 26 | path: config.build.assetsRoot, 27 | filename: utils.assetsPath('js/[name].[chunkhash].js'), 28 | chunkFilename: utils.assetsPath('js/[id].[chunkhash].js') 29 | }, 30 | plugins: [ 31 | // http://vuejs.github.io/vue-loader/en/workflow/production.html 32 | new webpack.DefinePlugin({ 33 | 'process.env': env 34 | }), 35 | new UglifyJsPlugin({ 36 | uglifyOptions: { 37 | compress: { 38 | warnings: false 39 | } 40 | }, 41 | sourceMap: config.build.productionSourceMap, 42 | parallel: true 43 | }), 44 | // extract css into its own file 45 | new ExtractTextPlugin({ 46 | filename: utils.assetsPath('css/[name].[contenthash].css'), 47 | // Setting the following option to `false` will not extract CSS from codesplit chunks. 48 | // Their CSS will instead be inserted dynamically with style-loader when the codesplit chunk has been loaded by webpack. 49 | // It's currently set to `true` because we are seeing that sourcemaps are included in the codesplit bundle as well when it's `false`, 50 | // increasing file size: https://github.com/vuejs-templates/webpack/issues/1110 51 | allChunks: true, 52 | }), 53 | // Compress extracted CSS. We are using this plugin so that possible 54 | // duplicated CSS from different components can be deduped. 55 | new OptimizeCSSPlugin({ 56 | cssProcessorOptions: config.build.productionSourceMap 57 | ? { safe: true, map: { inline: false } } 58 | : { safe: true } 59 | }), 60 | // generate dist index.html with correct asset hash for caching. 61 | // you can customize output by editing /index.html 62 | // see https://github.com/ampedandwired/html-webpack-plugin 63 | new HtmlWebpackPlugin({ 64 | filename: config.build.index, 65 | template: 'index.html', 66 | inject: true, 67 | minify: { 68 | removeComments: true, 69 | collapseWhitespace: true, 70 | removeAttributeQuotes: true 71 | // more options: 72 | // https://github.com/kangax/html-minifier#options-quick-reference 73 | }, 74 | // necessary to consistently work with multiple chunks via CommonsChunkPlugin 75 | chunksSortMode: 'dependency' 76 | }), 77 | // keep module.id stable when vendor modules does not change 78 | new webpack.HashedModuleIdsPlugin(), 79 | // enable scope hoisting 80 | new webpack.optimize.ModuleConcatenationPlugin(), 81 | // split vendor js into its own file 82 | new webpack.optimize.CommonsChunkPlugin({ 83 | name: 'vendor', 84 | minChunks (module) { 85 | // any required modules inside node_modules are extracted to vendor 86 | return ( 87 | module.resource && 88 | /\.js$/.test(module.resource) && 89 | module.resource.indexOf( 90 | path.join(__dirname, '../node_modules') 91 | ) === 0 92 | ) 93 | } 94 | }), 95 | // extract webpack runtime and module manifest to its own file in order to 96 | // prevent vendor hash from being updated whenever app bundle is updated 97 | new webpack.optimize.CommonsChunkPlugin({ 98 | name: 'manifest', 99 | minChunks: Infinity 100 | }), 101 | // This instance extracts shared chunks from code splitted chunks and bundles them 102 | // in a separate chunk, similar to the vendor chunk 103 | // see: https://webpack.js.org/plugins/commons-chunk-plugin/#extra-async-commons-chunk 104 | new webpack.optimize.CommonsChunkPlugin({ 105 | name: 'app', 106 | async: 'vendor-async', 107 | children: true, 108 | minChunks: 3 109 | }), 110 | 111 | // copy custom static assets 112 | new CopyWebpackPlugin([ 113 | { 114 | from: path.resolve(__dirname, '../static'), 115 | to: config.build.assetsSubDirectory, 116 | ignore: ['.*'] 117 | } 118 | ]) 119 | ] 120 | }) 121 | 122 | if (config.build.productionGzip) { 123 | const CompressionWebpackPlugin = require('compression-webpack-plugin') 124 | 125 | webpackConfig.plugins.push( 126 | new CompressionWebpackPlugin({ 127 | asset: '[path].gz[query]', 128 | algorithm: 'gzip', 129 | test: new RegExp( 130 | '\\.(' + 131 | config.build.productionGzipExtensions.join('|') + 132 | ')$' 133 | ), 134 | threshold: 10240, 135 | minRatio: 0.8 136 | }) 137 | ) 138 | } 139 | 140 | if (config.build.bundleAnalyzerReport) { 141 | const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin 142 | webpackConfig.plugins.push(new BundleAnalyzerPlugin()) 143 | } 144 | 145 | module.exports = webpackConfig 146 | -------------------------------------------------------------------------------- /config/dev.env.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | const merge = require('webpack-merge') 3 | const prodEnv = require('./prod.env') 4 | 5 | module.exports = merge(prodEnv, { 6 | NODE_ENV: '"development"', 7 | apiMusic: '"/apiMusic"', 8 | OwnApi: '"/OwnApi"', 9 | musicapi: '"/musicapi"' 10 | }) 11 | -------------------------------------------------------------------------------- /config/index.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | // Template version: 1.3.1 3 | // see http://vuejs-templates.github.io/webpack for documentation. 4 | 5 | const path = require('path') 6 | 7 | module.exports = { 8 | dev: { 9 | assetsSubDirectory: 'static', 10 | assetsPublicPath: '/', 11 | proxyTable: { //代理 12 | "/apiMusic": { 13 | target: "http://tingapi.ting.baidu.com", 14 | changeOrigin: true, 15 | pathRewrite: {'^/apiMusic': ''} 16 | }, 17 | "/musicapi":{ 18 | target: "http://musicapi.taihe.com", 19 | changeOrigin: true, 20 | pathRewrite: {'^/musicapi': ''} 21 | } 22 | }, 23 | host: 'localhost', // can be overwritten by process.env.HOST 24 | port: 8080, // can be overwritten by process.env.PORT, if port is in use, a free one will be determined 25 | autoOpenBrowser: false, 26 | errorOverlay: true, 27 | notifyOnErrors: true, 28 | poll: false, // https://webpack.js.org/configuration/dev-server/#devserver-watchoptions- 29 | /** 30 | * Source Maps 31 | */ 32 | 33 | // https://webpack.js.org/configuration/devtool/#development 34 | devtool: 'cheap-module-eval-source-map', 35 | 36 | // If you have problems debugging vue-files in devtools, 37 | // set this to false - it *may* help 38 | // https://vue-loader.vuejs.org/en/options.html#cachebusting 39 | cacheBusting: true, 40 | 41 | cssSourceMap: true 42 | }, 43 | 44 | build: { 45 | // Template for index.html 46 | index: path.resolve(__dirname, '../dist/index.html'), 47 | 48 | // Paths 49 | assetsRoot: path.resolve(__dirname, '../dist'), 50 | assetsSubDirectory: 'static', 51 | assetsPublicPath: './', 52 | 53 | /** 54 | * Source Maps 55 | */ 56 | 57 | productionSourceMap: true, 58 | // https://webpack.js.org/configuration/devtool/#production 59 | devtool: '#source-map', 60 | 61 | // Gzip off by default as many popular static hosts such as 62 | // Surge or Netlify already gzip all static assets for you. 63 | // Before setting to `true`, make sure to; 64 | // npm install --save-dev compression-webpack-plugin 65 | productionGzip: false, 66 | productionGzipExtensions: ['js', 'css'], 67 | 68 | // Run the build command with an extra argument to 69 | // View the bundle analyzer report after build finishes: 70 | // `npm run build --report` 71 | // Set to `true` or `false` to always turn it on or off 72 | bundleAnalyzerReport: process.env.npm_config_report 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /config/prod.env.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | module.exports = { 3 | NODE_ENV: '"production"', 4 | apiMusic: '"http://tingapi.ting.baidu.com"', 5 | OwnApi: '"http://192.168.1.21:8088"', 6 | musicapi: '"/musicapi"' 7 | } 8 | -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 飞飞音乐 13 | 14 | 15 | 16 |
17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "hzf", 3 | "version": "1.0.0", 4 | "description": "muics web", 5 | "author": "hzf", 6 | "private": true, 7 | "scripts": { 8 | "dev": "webpack-dev-server --inline --progress --config build/webpack.dev.conf.js", 9 | "start": "npm run dev", 10 | "build": "node build/build.js" 11 | }, 12 | "dependencies": { 13 | "axios": "^0.18.0", 14 | "element-ui": "^2.4.9", 15 | "hls.js": "^0.11.0", 16 | "nprogress": "^0.2.0", 17 | "vue": "^2.5.2", 18 | "vue-aplayer": "^1.6.1", 19 | "vue-awesome-swiper": "^3.1.3", 20 | "vue-data-loading": "^0.2.4", 21 | "vue-lazyload": "^1.3.1", 22 | "vue-router": "^3.0.1", 23 | "wilddog": "^2.5.17" 24 | }, 25 | "devDependencies": { 26 | "autoprefixer": "^7.1.2", 27 | "babel-core": "^6.22.1", 28 | "babel-helper-vue-jsx-merge-props": "^2.0.3", 29 | "babel-loader": "^7.1.1", 30 | "babel-plugin-component": "^1.1.1", 31 | "babel-plugin-syntax-jsx": "^6.18.0", 32 | "babel-plugin-transform-runtime": "^6.22.0", 33 | "babel-plugin-transform-vue-jsx": "^3.5.0", 34 | "babel-preset-env": "^1.3.2", 35 | "babel-preset-stage-2": "^6.22.0", 36 | "chalk": "^2.0.1", 37 | "copy-webpack-plugin": "^4.0.1", 38 | "css-loader": "^0.28.0", 39 | "extract-text-webpack-plugin": "^3.0.0", 40 | "file-loader": "^1.1.4", 41 | "friendly-errors-webpack-plugin": "^1.6.1", 42 | "html-webpack-plugin": "^2.30.1", 43 | "node-notifier": "^5.1.2", 44 | "optimize-css-assets-webpack-plugin": "^3.2.0", 45 | "ora": "^1.2.0", 46 | "portfinder": "^1.0.13", 47 | "postcss-import": "^11.0.0", 48 | "postcss-loader": "^2.0.8", 49 | "postcss-url": "^7.2.1", 50 | "rimraf": "^2.6.0", 51 | "semver": "^5.3.0", 52 | "shelljs": "^0.7.6", 53 | "uglifyjs-webpack-plugin": "^1.1.1", 54 | "url-loader": "^0.5.8", 55 | "vue-loader": "^13.3.0", 56 | "vue-style-loader": "^3.0.1", 57 | "vue-template-compiler": "^2.5.2", 58 | "webpack": "^3.6.0", 59 | "webpack-bundle-analyzer": "^2.9.0", 60 | "webpack-dev-server": "^2.9.1", 61 | "webpack-merge": "^4.1.0" 62 | }, 63 | "engines": { 64 | "node": ">= 6.0.0", 65 | "npm": ">= 3.0.0" 66 | }, 67 | "browserslist": [ 68 | "> 1%", 69 | "last 2 versions", 70 | "not ie <= 8" 71 | ] 72 | } 73 | -------------------------------------------------------------------------------- /src/App.vue: -------------------------------------------------------------------------------- 1 | 34 | 35 | 261 | 262 | 403 | -------------------------------------------------------------------------------- /src/app/wilddog.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by Administrator on 2019/2/19. 3 | */ 4 | import * as wilddog from 'wilddog' 5 | 6 | const config = { 7 | syncURL: 'https://wd9778448440bwshfi.wilddogio.com/' 8 | } 9 | wilddog.initializeApp(config) 10 | export default wilddog.sync().ref('web') 11 | -------------------------------------------------------------------------------- /src/assets/banner/bj.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lookwe/vue-music/e60bdc63055b7c011db75cfbcb83edb77e7281e2/src/assets/banner/bj.jpg -------------------------------------------------------------------------------- /src/assets/banner/footer-taihe.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lookwe/vue-music/e60bdc63055b7c011db75cfbcb83edb77e7281e2/src/assets/banner/footer-taihe.png -------------------------------------------------------------------------------- /src/assets/imgage/error.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lookwe/vue-music/e60bdc63055b7c011db75cfbcb83edb77e7281e2/src/assets/imgage/error.jpg -------------------------------------------------------------------------------- /src/assets/imgage/load.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lookwe/vue-music/e60bdc63055b7c011db75cfbcb83edb77e7281e2/src/assets/imgage/load.jpg -------------------------------------------------------------------------------- /src/assets/imgage/sq.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lookwe/vue-music/e60bdc63055b7c011db75cfbcb83edb77e7281e2/src/assets/imgage/sq.png -------------------------------------------------------------------------------- /src/assets/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lookwe/vue-music/e60bdc63055b7c011db75cfbcb83edb77e7281e2/src/assets/logo.png -------------------------------------------------------------------------------- /src/components/LRC.vue: -------------------------------------------------------------------------------- 1 | 10 | 11 | 76 | 77 | 106 | -------------------------------------------------------------------------------- /src/components/Swiper.vue: -------------------------------------------------------------------------------- 1 | 26 | 27 | 48 | 49 | 65 | -------------------------------------------------------------------------------- /src/components/TodayList.vue: -------------------------------------------------------------------------------- 1 | 20 | 21 | 37 | 38 | 56 | -------------------------------------------------------------------------------- /src/components/albumList.vue: -------------------------------------------------------------------------------- 1 | 58 | 59 | 160 | 161 | 292 | -------------------------------------------------------------------------------- /src/components/footer.vue: -------------------------------------------------------------------------------- 1 | 17 | 18 | 23 | 24 | 74 | -------------------------------------------------------------------------------- /src/components/footerMusic.vue: -------------------------------------------------------------------------------- 1 | 25 | 26 | 93 | 94 | 145 | -------------------------------------------------------------------------------- /src/components/musicList.vue: -------------------------------------------------------------------------------- 1 | 59 | 60 | 197 | 198 | 331 | -------------------------------------------------------------------------------- /src/components/notImgSongList.vue: -------------------------------------------------------------------------------- 1 | 22 | 23 | 68 | 69 | 124 | -------------------------------------------------------------------------------- /src/components/popup.vue: -------------------------------------------------------------------------------- 1 | 10 | 11 | 30 | 31 | 66 | -------------------------------------------------------------------------------- /src/components/searchList.vue: -------------------------------------------------------------------------------- 1 | 46 | 47 | 86 | 87 | 185 | -------------------------------------------------------------------------------- /src/components/search_nav.vue: -------------------------------------------------------------------------------- 1 | 15 | 16 | 21 | 22 | 28 | -------------------------------------------------------------------------------- /src/components/singerList.vue: -------------------------------------------------------------------------------- 1 | 13 | 14 | 39 | 40 | 45 | -------------------------------------------------------------------------------- /src/components/singerUlList.vue: -------------------------------------------------------------------------------- 1 | 15 | 16 | 77 | 78 | 118 | -------------------------------------------------------------------------------- /src/components/songSheet.vue: -------------------------------------------------------------------------------- 1 | 62 | 63 | 81 | 82 | 95 | -------------------------------------------------------------------------------- /src/components/userLikeSongs.vue: -------------------------------------------------------------------------------- 1 | 39 | 40 | 65 | 66 | 207 | -------------------------------------------------------------------------------- /src/init.vue: -------------------------------------------------------------------------------- 1 | 8 | 29 | 30 | 53 | -------------------------------------------------------------------------------- /src/main.js: -------------------------------------------------------------------------------- 1 | // The Vue build version to load with the `import` command 2 | // (runtime-only or standalone) has been set in webpack.base.conf with an alias. 3 | import Vue from 'vue' 4 | import init from './init' 5 | import router from './router' 6 | import request from './utils/request' 7 | 8 | import VueAwesomeSwiper from 'vue-awesome-swiper' 9 | import VueLazyload from 'vue-lazyload' 10 | 11 | import 'swiper/dist/css/swiper.css' 12 | import { Icon,Popover,Loading, Row, Col, Message, Notification } from 'element-ui'; 13 | 14 | Vue.use(VueLazyload, { 15 | preLoad: 1, 16 | error: require('@/assets/imgage/load.jpg'), 17 | loading: require('@/assets/imgage/load.jpg'), 18 | attempt: 1, 19 | lazyComponent: true 20 | }) 21 | 22 | //轮播图 23 | Vue.use(VueAwesomeSwiper) 24 | 25 | //elementUI icon标签 26 | Vue.use(Icon) 27 | Vue.use(Row) 28 | Vue.use(Col) 29 | Vue.use(Popover) 30 | Vue.use(Loading.directive); 31 | Vue.prototype.$message = Message; 32 | Vue.prototype.$notify = Notification; 33 | 34 | 35 | Vue.prototype.HOST = '/apiMusic' 36 | Vue.prototype.musicapi = '/musicapi' 37 | Vue.prototype.$loading = Loading.service; 38 | 39 | Vue.prototype.$axios = request 40 | 41 | 42 | Vue.config.productionTip = false 43 | 44 | new Vue({ 45 | el: '#app', 46 | router, 47 | components: { init }, 48 | template: '' 49 | }) 50 | -------------------------------------------------------------------------------- /src/page/MusicNav.vue: -------------------------------------------------------------------------------- 1 | 35 | 36 | 66 | 67 | 117 | -------------------------------------------------------------------------------- /src/page/Singer.vue: -------------------------------------------------------------------------------- 1 | 18 | 19 | 28 | 29 | 39 | -------------------------------------------------------------------------------- /src/page/Song.vue: -------------------------------------------------------------------------------- 1 | 15 | 16 | 25 | 26 | 31 | -------------------------------------------------------------------------------- /src/page/TodayPush.vue: -------------------------------------------------------------------------------- 1 | 14 | 15 | 30 | 31 | 37 | -------------------------------------------------------------------------------- /src/page/album/index.vue: -------------------------------------------------------------------------------- 1 | 71 | 72 | 203 | 204 | 390 | -------------------------------------------------------------------------------- /src/page/index.vue: -------------------------------------------------------------------------------- 1 | 28 | 29 | 60 | 61 | 100 | -------------------------------------------------------------------------------- /src/page/logn.vue: -------------------------------------------------------------------------------- 1 | 27 | 28 | 152 | 153 | 154 | 230 | -------------------------------------------------------------------------------- /src/page/musiclist/Classic.vue: -------------------------------------------------------------------------------- 1 | 9 | 10 | 29 | 30 | 33 | -------------------------------------------------------------------------------- /src/page/musiclist/Hot.vue: -------------------------------------------------------------------------------- 1 | 9 | 10 | 29 | 30 | 33 | -------------------------------------------------------------------------------- /src/page/musiclist/New.vue: -------------------------------------------------------------------------------- 1 | 9 | 10 | 29 | 30 | 33 | -------------------------------------------------------------------------------- /src/page/play/MusicPlay.vue: -------------------------------------------------------------------------------- 1 | 73 | 74 | 267 | 268 | 470 | -------------------------------------------------------------------------------- /src/page/search/search.vue: -------------------------------------------------------------------------------- 1 | 86 | 87 | 229 | 230 | 398 | -------------------------------------------------------------------------------- /src/page/singer/singerList.vue: -------------------------------------------------------------------------------- 1 | 52 | 53 | 151 | 152 | 228 | -------------------------------------------------------------------------------- /src/page/singer/singer_info.vue: -------------------------------------------------------------------------------- 1 | 49 | 50 | 168 | 188 | 189 | 284 | -------------------------------------------------------------------------------- /src/page/songsheet/songSheet.vue: -------------------------------------------------------------------------------- 1 | 23 | 24 | 57 | 58 | 128 | -------------------------------------------------------------------------------- /src/page/songsheet/songSheetType.vue: -------------------------------------------------------------------------------- 1 | 20 | 21 | 47 | 48 | 68 | -------------------------------------------------------------------------------- /src/page/songsheet/songlists.vue: -------------------------------------------------------------------------------- 1 | 92 | 93 | 228 | 229 | 389 | -------------------------------------------------------------------------------- /src/page/user/register.vue: -------------------------------------------------------------------------------- 1 | 37 | 38 | 168 | 169 | 257 | -------------------------------------------------------------------------------- /src/page/user/user.vue: -------------------------------------------------------------------------------- 1 | 81 | 82 | 214 | 215 | 353 | -------------------------------------------------------------------------------- /src/router/index.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import Router from 'vue-router' 3 | 4 | import NProgress from 'nprogress' 5 | import 'nprogress/nprogress.css' //这个样式必须引入 6 | 7 | import index from '@/page/index' 8 | import Hot from '../page/musiclist/Hot' 9 | import New from '../page/musiclist/New' 10 | import Classic from '../page/musiclist/Classic' 11 | import play from '@/page/play/MusicPlay' 12 | 13 | NProgress.inc(0.2) 14 | NProgress.configure({ easing: 'ease', speed: 500, showSpinner: false }) 15 | 16 | Vue.use(Router) 17 | 18 | const router = new Router({ 19 | //mode: 'history', 20 | linkActiveClass :'linkActive', 21 | routes: [ 22 | { 23 | path: '/', 24 | name: 'init', 25 | component:()=>import('@/App.vue'), 26 | redirect:'/index', 27 | children:[ 28 | { 29 | path: '/index', 30 | name: 'index', 31 | component: index, 32 | redirect:'/Hot', 33 | children:[ 34 | { 35 | path: '/Hot', 36 | name: 'Hot', 37 | component: Hot 38 | }, { 39 | path: '/New', 40 | name: 'New', 41 | component: New 42 | }, { 43 | path: '/Classic', 44 | name: 'Classic', 45 | component: Classic 46 | }, 47 | ] 48 | }, 49 | //歌手信息 50 | { 51 | path: '/artist/:singer_id', 52 | name: 'artist', 53 | component:()=> import('@/page/singer/singer_info') 54 | }, 55 | //歌曲播放 56 | { 57 | path: '/play/:song_id', 58 | name: 'play', 59 | component:play 60 | }, 61 | //歌曲播放:多参数 62 | { 63 | path: '/play/:song_id/:currentTime', 64 | name: 'playMany', 65 | component:play 66 | }, 67 | //歌曲..歌手...查询 68 | { 69 | path:'/search', 70 | name:'search', 71 | component:()=> import('@/page/search/search'), 72 | children:[ 73 | { 74 | path:'/search/:query', 75 | name:'/query', 76 | component:()=> import('@/components/searchList') 77 | } 78 | ] 79 | }, 80 | //歌单类型类别 比如:新歌 经典 流行 伤感 81 | { 82 | path:'/songs/:billboard_type', 83 | name:'songs', 84 | component:()=> import('@/page/songsheet/songSheetType'), 85 | }, 86 | { 87 | path:'/user', 88 | name:'user', 89 | component:()=> import('@/page/user/user') 90 | }, 91 | { 92 | path:'/top', 93 | name:'songSheet', 94 | component:()=> import('@/page/songsheet/songsheet') 95 | }, 96 | { 97 | path:'/singer', 98 | name:'singerList', 99 | component:()=> import('@/page/singer/singerList') 100 | }, 101 | { 102 | path:'/songlists', 103 | name:'songLists', 104 | component:()=> import('@/page/songsheet/songlists') 105 | }, 106 | { 107 | path:'/album/:album_id', 108 | name:'album', 109 | component:()=> import('@/page/album/index') 110 | } 111 | ] 112 | }, 113 | { 114 | path:'/login', 115 | name:'login', 116 | component:()=> import('@/page/logn') 117 | }, 118 | { 119 | path:'/register', 120 | name:'register', 121 | component:()=> import('@/page/user/register') 122 | }, 123 | { 124 | path:'*', 125 | redirect:'/index' 126 | } 127 | ], 128 | }) 129 | 130 | /* 131 | * to 即将去往的路由 132 | * form 当前离开的路由 133 | * next 进行通过的钩子函数 参数: 1无参数表示通过 2:false 中断当前导游 3:{path:'/'} 指定页面 134 | * */ 135 | router.beforeEach((to,from,next) => { 136 | NProgress.start() 137 | next() 138 | }) 139 | 140 | /* 141 | * 后置钩子 142 | * */ 143 | router.afterEach((to,form) => { 144 | NProgress.done() 145 | }) 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | export default router 164 | -------------------------------------------------------------------------------- /src/utils/request.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by Administrator on 2019/3/2. 3 | */ 4 | import Axios from 'axios' 5 | 6 | Axios.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded'; 7 | 8 | // 添加请求拦截器 9 | Axios.interceptors.request.use(function (config) { 10 | 11 | return config; 12 | }, function (error) { 13 | // 对请求错误做些什么 14 | return Promise.reject(error); 15 | }); 16 | 17 | // 添加响应拦截器 18 | Axios.interceptors.response.use(function (response) { 19 | // 对响应数据做点什么 20 | 21 | return response; 22 | }, function (error) { 23 | // 对响应错误做点什么 24 | return Promise.reject(error); 25 | }); 26 | 27 | export default Axios 28 | -------------------------------------------------------------------------------- /static/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lookwe/vue-music/e60bdc63055b7c011db75cfbcb83edb77e7281e2/static/.gitkeep -------------------------------------------------------------------------------- /static/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lookwe/vue-music/e60bdc63055b7c011db75cfbcb83edb77e7281e2/static/favicon.ico --------------------------------------------------------------------------------