├── .babelrc ├── .editorconfig ├── .eslintrc.json ├── .gitignore ├── .postcssrc.js ├── .vscode ├── launch.json ├── settings.json └── tasks.json ├── Dockerfile ├── LICENSE.md ├── README.md ├── build ├── build.js ├── check-versions.js ├── dev-client.js ├── dev-server.js ├── utils.js ├── vue-loader.conf.js ├── webpack.base.conf.js ├── webpack.dev.conf.js ├── webpack.prod.conf.js └── webpack.test.conf.js ├── config ├── dev.env.js ├── index.js ├── prod.env.js └── test.env.js ├── doc └── zhuishushenqi.md ├── index.html ├── package.json ├── screenshot ├── book.png ├── bookshelf.png ├── catDetail.png ├── catory.png ├── chapter.png ├── errBook.png ├── nReader.png ├── nightMode.png ├── rank.png ├── rankType.png ├── readbook.png └── search.png ├── src ├── App.vue ├── api │ └── api.js ├── assets │ ├── book.svg │ ├── category.svg │ ├── down.svg │ ├── font_bigger.svg │ ├── font_smaller.svg │ ├── line_spacing_big.svg │ ├── line_spacing_normal.svg │ ├── line_spacing_small.svg │ ├── list.svg │ ├── moon.svg │ ├── rank.svg │ ├── rank_other.svg │ ├── search.svg │ ├── setting.svg │ ├── sun.svg │ ├── trash.svg │ └── up.svg ├── components │ ├── Home.vue │ ├── book │ │ ├── ChangeSource.vue │ │ └── ReadBook.vue │ ├── bookshelf │ │ └── Bookshelf.vue │ ├── category │ │ ├── BookcatDetail.vue │ │ └── Bookcategory.vue │ ├── common │ │ ├── Book.vue │ │ └── Booklist.vue │ ├── ranklist │ │ ├── Rank.vue │ │ ├── RankItem.vue │ │ ├── Ranklist.vue │ │ └── RanklistDetail.vue │ └── search │ │ └── Search.vue ├── main.js ├── router │ └── index.js ├── store │ ├── actions.js │ ├── index.js │ ├── mutations.js │ └── mutationsType.js └── utils │ ├── ajax.js │ └── util.js ├── static └── .gitkeep └── test ├── e2e ├── custom-assertions │ └── elementCount.js ├── nightwatch.conf.js ├── runner.js └── specs │ └── test.js └── unit ├── .eslintrc ├── index.js ├── karma.conf.js └── specs └── Hello.spec.js /.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": [ 3 | ["env", { "modules": false }], 4 | "stage-2" 5 | ], 6 | "plugins": ["transform-runtime"], 7 | "comments": false, 8 | "env": { 9 | "test": { 10 | "presets": ["env", "stage-2"], 11 | "plugins": [ "istanbul" ] 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /.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 | -------------------------------------------------------------------------------- /.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "standard", 3 | "plugins": [ 4 | "html" 5 | ] 6 | } -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | node_modules/ 3 | dist/ 4 | npm-debug.log* 5 | yarn-debug.log* 6 | yarn-error.log* 7 | test/unit/coverage 8 | test/e2e/reports 9 | selenium-debug.log 10 | .idea 11 | -------------------------------------------------------------------------------- /.postcssrc.js: -------------------------------------------------------------------------------- 1 | // https://github.com/michael-ciniawsky/postcss-load-config 2 | 3 | module.exports = { 4 | "plugins": { 5 | // to edit target browsers: use "browserlist" field in package.json 6 | "autoprefixer": {} 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /.vscode/launch.json: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zimplexing/vue-nReader/dc1e3fc19b3cbce1133fd90f8ee85229634d5299/.vscode/launch.json -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | // 将设置放入此文件中以覆盖默认值和用户设置。 2 | { 3 | "eslint.enable": true 4 | } -------------------------------------------------------------------------------- /.vscode/tasks.json: -------------------------------------------------------------------------------- 1 | { 2 | // See https://go.microsoft.com/fwlink/?LinkId=733558 3 | // for the documentation about the tasks.json format 4 | "version": "0.1.0", 5 | "command": "npm", 6 | "isShellCommand": true, 7 | "showOutput": "always", 8 | "suppressTaskName": true, 9 | "tasks": [ 10 | { 11 | "taskName": "install", 12 | "args": ["install"] 13 | }, 14 | { 15 | "taskName": "update", 16 | "args": ["update"] 17 | }, 18 | { 19 | "taskName": "test", 20 | "args": ["run", "test"] 21 | } 22 | ] 23 | } -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM node:8.9.1 2 | RUN apt-get update 3 | RUN apt-get install -y nginx 4 | WORKDIR /app 5 | COPY . /app/ 6 | EXPOSE 80 7 | RUN npm install 8 | RUN npm run build 9 | RUN cp -r dist/* /var/www/html 10 | RUN rm -rf /app 11 | CMD ["nginx","-g","daemon off;"] 12 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [![DeepScan Grade](https://deepscan.io/api/projects/479/branches/739/badge/grade.svg)](https://deepscan.io/dashboard/#view=project&pid=479&bid=739) 2 | # vue-nReader 3 | 4 | 使用`mint-ui`对整个项目进行了重构,整理了项目的目录结构与代码,较上个版本新增了`小说换源`、`搜索历史记录`、优化了`滚动下载`和`下拉刷新` 5 | 6 | 整个项目一共14个页面(包括通用组件),主要使用了vue2.0+vue-router+vuex,主要实现了小说排行榜,小说分类,小说详情,小说阅读,搜索页面,小说阅读记录等页面。达到了可用来看小说的基本需求。 7 | 8 | 项目中的API均来自追书神器,纯属共享学习之用,有任何疑问或建议可提[issue](https://github.com/zimplexing/vue-nReader/issues/new),使用代理,本地可以完美运行。 9 | 10 | [API文档](https://github.com/zimplexing/vue-nReader/blob/master/doc/zhuishushenqi.md) 11 | 12 | [本地运行代理](https://gist.github.com/zimplexing/c7c1f15ea3f270de3962fc0ab466d82e) 13 | 14 | ## 本地运行 15 | 16 | 使用vue-cli工具构建,基本命令如下: 17 | ``` bash 18 | # 安装依赖 19 | npm install 20 | 21 | # 开发模式 22 | npm run dev 23 | 24 | # 生产模式 25 | npm run build 26 | 27 | ``` 28 | ## 预览地址 29 | 项目放在国外虚拟主机上,代理也运行在上面,所以加载速度可能会比较慢。其中有一些小说封面会加载不出来,这个是api的问题,并不是网络的原因。 30 | 31 | 32 | 电脑端请开启开发者模式 33 | [在线预览地址](http://65.49.197.99:32768/) 34 | 35 | 手机扫码: 36 | 37 | 38 | ## 实现功能 39 | 40 | - [x] 小说书架 41 | - [x] 分类查询 42 | - [x] 排行榜 43 | - [x] 搜索(搜索历史,自动补全) 44 | - [x] 小说详情 45 | - [x] **小说换源** 46 | - [x] 阅读历史记录(记录阅读章节) 47 | - [x] 阅读夜间模式 48 | - [x] 章节倒叙查看 49 | 50 | ## TODO 51 | - [ ] 记录阅读历史位置 52 | 53 | - [ ] 增加发现页面 54 | 55 | - [ ] 社区评论功能 56 | 57 | - [ ] 组件切换动效 58 | 59 | - [ ] 阅读界面设置功能 60 | 61 | - [ ] 小说下载 62 | 63 | ## 屏幕截图 64 | 65 | 66 | 67 | ## 问题 68 | 记录在项目中遇到的一些问题,和解决方法 69 | - [ ] 滚动条控制 70 | - 在不是 `HTML5 history `模式下,还没找到解决的方法 71 | 72 | - [x] flex布局下横向滚动 73 | - 设置属性`flex-shrink:0`,默认下该属性值为1,空间不够时,后等比例缩小,设置为0之后,不会缩小项目 74 | 75 | - [x] 标签选中后active样式的添加 76 |    - 使用`:class` 判断条件为点击当前标签的索引值 77 | 78 | - [x] 同时绑定按键修饰符(keyup事件但不包括按键enter) 79 | - 监听`input`事件,绑定`keyup.enter`事件 80 | 81 | - [x] 返回路径问题 82 | - 使用`$router.go()`进行模拟返回 83 | 84 | - [x] 图片加载错误处理 85 | - 图片加载错误的onerror方法中的静态地址webpack打包不会将其转化为base64编码,所以现在的解决方法是贴一个在线的图片地址 86 | -------------------------------------------------------------------------------- /build/build.js: -------------------------------------------------------------------------------- 1 | require('./check-versions')() 2 | 3 | process.env.NODE_ENV = 'production' 4 | 5 | var ora = require('ora') 6 | var rm = require('rimraf') 7 | var path = require('path') 8 | var chalk = require('chalk') 9 | var webpack = require('webpack') 10 | var config = require('../config') 11 | var webpackConfig = require('./webpack.prod.conf') 12 | 13 | var spinner = ora('building for production...') 14 | spinner.start() 15 | 16 | rm(path.join(config.build.assetsRoot, config.build.assetsSubDirectory), err => { 17 | if (err) throw err 18 | webpack(webpackConfig, function (err, stats) { 19 | spinner.stop() 20 | if (err) throw err 21 | process.stdout.write(stats.toString({ 22 | colors: true, 23 | modules: false, 24 | children: false, 25 | chunks: false, 26 | chunkModules: false 27 | }) + '\n\n') 28 | 29 | console.log(chalk.cyan(' Build complete.\n')) 30 | console.log(chalk.yellow( 31 | ' Tip: built files are meant to be served over an HTTP server.\n' + 32 | ' Opening index.html over file:// won\'t work.\n' 33 | )) 34 | }) 35 | }) 36 | -------------------------------------------------------------------------------- /build/check-versions.js: -------------------------------------------------------------------------------- 1 | var chalk = require('chalk') 2 | var semver = require('semver') 3 | var packageConfig = require('../package.json') 4 | var shell = require('shelljs') 5 | function exec (cmd) { 6 | return require('child_process').execSync(cmd).toString().trim() 7 | } 8 | 9 | var versionRequirements = [ 10 | { 11 | name: 'node', 12 | currentVersion: semver.clean(process.version), 13 | versionRequirement: packageConfig.engines.node 14 | }, 15 | ] 16 | 17 | if (shell.which('npm')) { 18 | versionRequirements.push({ 19 | name: 'npm', 20 | currentVersion: exec('npm --version'), 21 | versionRequirement: packageConfig.engines.npm 22 | }) 23 | } 24 | 25 | module.exports = function () { 26 | var warnings = [] 27 | for (var i = 0; i < versionRequirements.length; i++) { 28 | var mod = versionRequirements[i] 29 | if (!semver.satisfies(mod.currentVersion, mod.versionRequirement)) { 30 | warnings.push(mod.name + ': ' + 31 | chalk.red(mod.currentVersion) + ' should be ' + 32 | chalk.green(mod.versionRequirement) 33 | ) 34 | } 35 | } 36 | 37 | if (warnings.length) { 38 | console.log('') 39 | console.log(chalk.yellow('To use this template, you must update following to modules:')) 40 | console.log() 41 | for (var i = 0; i < warnings.length; i++) { 42 | var warning = warnings[i] 43 | console.log(' ' + warning) 44 | } 45 | console.log() 46 | process.exit(1) 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /build/dev-client.js: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | require('eventsource-polyfill') 3 | var hotClient = require('webpack-hot-middleware/client?noInfo=true&reload=true') 4 | 5 | hotClient.subscribe(function (event) { 6 | if (event.action === 'reload') { 7 | window.location.reload() 8 | } 9 | }) 10 | -------------------------------------------------------------------------------- /build/dev-server.js: -------------------------------------------------------------------------------- 1 | require('./check-versions')() 2 | 3 | var config = require('../config') 4 | if (!process.env.NODE_ENV) { 5 | process.env.NODE_ENV = JSON.parse(config.dev.env.NODE_ENV) 6 | } 7 | 8 | var opn = require('opn') 9 | var path = require('path') 10 | var express = require('express') 11 | var webpack = require('webpack') 12 | var proxyMiddleware = require('http-proxy-middleware') 13 | var webpackConfig = process.env.NODE_ENV === 'testing' 14 | ? require('./webpack.prod.conf') 15 | : require('./webpack.dev.conf') 16 | 17 | // default port where dev server listens for incoming traffic 18 | var port = process.env.PORT || config.dev.port 19 | // automatically open browser, if not set will be false 20 | var autoOpenBrowser = !!config.dev.autoOpenBrowser 21 | // Define HTTP proxies to your custom API backend 22 | // https://github.com/chimurai/http-proxy-middleware 23 | var proxyTable = config.dev.proxyTable 24 | 25 | var app = express() 26 | var compiler = webpack(webpackConfig) 27 | 28 | var devMiddleware = require('webpack-dev-middleware')(compiler, { 29 | publicPath: webpackConfig.output.publicPath, 30 | quiet: true 31 | }) 32 | 33 | var hotMiddleware = require('webpack-hot-middleware')(compiler, { 34 | log: () => {} 35 | }) 36 | // force page reload when html-webpack-plugin template changes 37 | compiler.plugin('compilation', function (compilation) { 38 | compilation.plugin('html-webpack-plugin-after-emit', function (data, cb) { 39 | hotMiddleware.publish({ action: 'reload' }) 40 | cb() 41 | }) 42 | }) 43 | 44 | // proxy api requests 45 | Object.keys(proxyTable).forEach(function (context) { 46 | var options = proxyTable[context] 47 | if (typeof options === 'string') { 48 | options = { target: options } 49 | } 50 | app.use(proxyMiddleware(options.filter || context, options)) 51 | }) 52 | 53 | // handle fallback for HTML5 history API 54 | app.use(require('connect-history-api-fallback')()) 55 | 56 | // serve webpack bundle output 57 | app.use(devMiddleware) 58 | 59 | // enable hot-reload and state-preserving 60 | // compilation error display 61 | app.use(hotMiddleware) 62 | 63 | // serve pure static assets 64 | var staticPath = path.posix.join(config.dev.assetsPublicPath, config.dev.assetsSubDirectory) 65 | app.use(staticPath, express.static('./static')) 66 | 67 | var uri = 'http://localhost:' + port 68 | 69 | var _resolve 70 | var readyPromise = new Promise(resolve => { 71 | _resolve = resolve 72 | }) 73 | 74 | console.log('> Starting dev server...') 75 | devMiddleware.waitUntilValid(() => { 76 | console.log('> Listening at ' + uri + '\n') 77 | // when env is testing, don't need open it 78 | if (autoOpenBrowser && process.env.NODE_ENV !== 'testing') { 79 | opn(uri) 80 | } 81 | _resolve() 82 | }) 83 | 84 | var server = app.listen(port) 85 | 86 | module.exports = { 87 | ready: readyPromise, 88 | close: () => { 89 | server.close() 90 | } 91 | } 92 | -------------------------------------------------------------------------------- /build/utils.js: -------------------------------------------------------------------------------- 1 | var path = require('path') 2 | var config = require('../config') 3 | var ExtractTextPlugin = require('extract-text-webpack-plugin') 4 | 5 | exports.assetsPath = function (_path) { 6 | var assetsSubDirectory = process.env.NODE_ENV === 'production' 7 | ? config.build.assetsSubDirectory 8 | : config.dev.assetsSubDirectory 9 | return path.posix.join(assetsSubDirectory, _path) 10 | } 11 | 12 | exports.cssLoaders = function (options) { 13 | options = options || {} 14 | 15 | var cssLoader = { 16 | loader: 'css-loader', 17 | options: { 18 | minimize: process.env.NODE_ENV === 'production', 19 | sourceMap: options.sourceMap 20 | } 21 | } 22 | 23 | // generate loader string to be used with extract text plugin 24 | function generateLoaders (loader, loaderOptions) { 25 | var loaders = [cssLoader] 26 | if (loader) { 27 | loaders.push({ 28 | loader: loader + '-loader', 29 | options: Object.assign({}, loaderOptions, { 30 | sourceMap: options.sourceMap 31 | }) 32 | }) 33 | } 34 | 35 | // Extract CSS when that option is specified 36 | // (which is the case during production build) 37 | if (options.extract) { 38 | return ExtractTextPlugin.extract({ 39 | use: loaders, 40 | fallback: 'vue-style-loader' 41 | }) 42 | } else { 43 | return ['vue-style-loader'].concat(loaders) 44 | } 45 | } 46 | 47 | // https://vue-loader.vuejs.org/en/configurations/extract-css.html 48 | return { 49 | css: generateLoaders(), 50 | postcss: generateLoaders(), 51 | less: generateLoaders('less'), 52 | sass: generateLoaders('sass', { indentedSyntax: true }), 53 | scss: generateLoaders('sass'), 54 | stylus: generateLoaders('stylus'), 55 | styl: generateLoaders('stylus') 56 | } 57 | } 58 | 59 | // Generate loaders for standalone style files (outside of .vue) 60 | exports.styleLoaders = function (options) { 61 | var output = [] 62 | var loaders = exports.cssLoaders(options) 63 | for (var extension in loaders) { 64 | var loader = loaders[extension] 65 | output.push({ 66 | test: new RegExp('\\.' + extension + '$'), 67 | use: loader 68 | }) 69 | } 70 | return output 71 | } 72 | -------------------------------------------------------------------------------- /build/vue-loader.conf.js: -------------------------------------------------------------------------------- 1 | var utils = require('./utils') 2 | var config = require('../config') 3 | var isProduction = process.env.NODE_ENV === 'production' 4 | 5 | module.exports = { 6 | loaders: utils.cssLoaders({ 7 | sourceMap: isProduction 8 | ? config.build.productionSourceMap 9 | : config.dev.cssSourceMap, 10 | extract: isProduction 11 | }) 12 | } 13 | -------------------------------------------------------------------------------- /build/webpack.base.conf.js: -------------------------------------------------------------------------------- 1 | var path = require('path') 2 | var utils = require('./utils') 3 | var config = require('../config') 4 | var vueLoaderConfig = require('./vue-loader.conf') 5 | 6 | function resolve (dir) { 7 | return path.join(__dirname, '..', dir) 8 | } 9 | 10 | module.exports = { 11 | entry: { 12 | app: './src/main.js' 13 | }, 14 | output: { 15 | path: config.build.assetsRoot, 16 | filename: '[name].js', 17 | publicPath: process.env.NODE_ENV === 'production' 18 | ? config.build.assetsPublicPath 19 | : config.dev.assetsPublicPath 20 | }, 21 | resolve: { 22 | extensions: ['.js', '.vue', '.json'], 23 | alias: { 24 | 'vue$': 'vue/dist/vue.esm.js', 25 | '@': resolve('src') 26 | } 27 | }, 28 | module: { 29 | rules: [ 30 | { 31 | test: /\.vue$/, 32 | loader: 'vue-loader', 33 | options: vueLoaderConfig 34 | }, 35 | { 36 | test: /\.js$/, 37 | loader: 'babel-loader', 38 | include: [resolve('src'), resolve('test')] 39 | }, 40 | { 41 | test: /\.(png|jpe?g|gif|svg)(\?.*)?$/, 42 | loader: 'url-loader', 43 | options: { 44 | limit: 10000, 45 | name: utils.assetsPath('img/[name].[hash:7].[ext]') 46 | } 47 | }, 48 | { 49 | test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/, 50 | loader: 'url-loader', 51 | options: { 52 | limit: 10000, 53 | name: utils.assetsPath('fonts/[name].[hash:7].[ext]') 54 | } 55 | } 56 | ] 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /build/webpack.dev.conf.js: -------------------------------------------------------------------------------- 1 | var utils = require('./utils') 2 | var webpack = require('webpack') 3 | var config = require('../config') 4 | var merge = require('webpack-merge') 5 | var baseWebpackConfig = require('./webpack.base.conf') 6 | var HtmlWebpackPlugin = require('html-webpack-plugin') 7 | var FriendlyErrorsPlugin = require('friendly-errors-webpack-plugin') 8 | 9 | // add hot-reload related code to entry chunks 10 | Object.keys(baseWebpackConfig.entry).forEach(function (name) { 11 | baseWebpackConfig.entry[name] = ['./build/dev-client'].concat(baseWebpackConfig.entry[name]) 12 | }) 13 | 14 | module.exports = merge(baseWebpackConfig, { 15 | module: { 16 | rules: utils.styleLoaders({ sourceMap: config.dev.cssSourceMap }) 17 | }, 18 | // cheap-module-eval-source-map is faster for development 19 | devtool: '#cheap-module-eval-source-map', 20 | plugins: [ 21 | new webpack.DefinePlugin({ 22 | 'process.env': config.dev.env 23 | }), 24 | // https://github.com/glenjamin/webpack-hot-middleware#installation--usage 25 | new webpack.HotModuleReplacementPlugin(), 26 | new webpack.NoEmitOnErrorsPlugin(), 27 | // https://github.com/ampedandwired/html-webpack-plugin 28 | new HtmlWebpackPlugin({ 29 | filename: 'index.html', 30 | template: 'index.html', 31 | inject: true 32 | }), 33 | new FriendlyErrorsPlugin() 34 | ] 35 | }) 36 | -------------------------------------------------------------------------------- /build/webpack.prod.conf.js: -------------------------------------------------------------------------------- 1 | var path = require('path') 2 | var utils = require('./utils') 3 | var webpack = require('webpack') 4 | var config = require('../config') 5 | var merge = require('webpack-merge') 6 | var baseWebpackConfig = require('./webpack.base.conf') 7 | var CopyWebpackPlugin = require('copy-webpack-plugin') 8 | var HtmlWebpackPlugin = require('html-webpack-plugin') 9 | var ExtractTextPlugin = require('extract-text-webpack-plugin') 10 | var OptimizeCSSPlugin = require('optimize-css-assets-webpack-plugin') 11 | 12 | var env = process.env.NODE_ENV === 'testing' 13 | ? require('../config/test.env') 14 | : config.build.env 15 | 16 | var webpackConfig = merge(baseWebpackConfig, { 17 | module: { 18 | rules: utils.styleLoaders({ 19 | sourceMap: config.build.productionSourceMap, 20 | extract: true 21 | }) 22 | }, 23 | devtool: config.build.productionSourceMap ? '#source-map' : false, 24 | output: { 25 | path: config.build.assetsRoot, 26 | filename: utils.assetsPath('js/[name].[chunkhash].js'), 27 | chunkFilename: utils.assetsPath('js/[id].[chunkhash].js') 28 | }, 29 | plugins: [ 30 | // http://vuejs.github.io/vue-loader/en/workflow/production.html 31 | new webpack.DefinePlugin({ 32 | 'process.env': env 33 | }), 34 | new webpack.optimize.UglifyJsPlugin({ 35 | compress: { 36 | warnings: false 37 | }, 38 | sourceMap: true 39 | }), 40 | // extract css into its own file 41 | new ExtractTextPlugin({ 42 | filename: utils.assetsPath('css/[name].[contenthash].css') 43 | }), 44 | // Compress extracted CSS. We are using this plugin so that possible 45 | // duplicated CSS from different components can be deduped. 46 | new OptimizeCSSPlugin({ 47 | cssProcessorOptions: { 48 | safe: true 49 | } 50 | }), 51 | // generate dist index.html with correct asset hash for caching. 52 | // you can customize output by editing /index.html 53 | // see https://github.com/ampedandwired/html-webpack-plugin 54 | new HtmlWebpackPlugin({ 55 | filename: process.env.NODE_ENV === 'testing' 56 | ? 'index.html' 57 | : config.build.index, 58 | template: 'index.html', 59 | inject: true, 60 | minify: { 61 | removeComments: true, 62 | collapseWhitespace: true, 63 | removeAttributeQuotes: true 64 | // more options: 65 | // https://github.com/kangax/html-minifier#options-quick-reference 66 | }, 67 | // necessary to consistently work with multiple chunks via CommonsChunkPlugin 68 | chunksSortMode: 'dependency' 69 | }), 70 | // split vendor js into its own file 71 | new webpack.optimize.CommonsChunkPlugin({ 72 | name: 'vendor', 73 | minChunks: function (module, count) { 74 | // any required modules inside node_modules are extracted to vendor 75 | return ( 76 | module.resource && 77 | /\.js$/.test(module.resource) && 78 | module.resource.indexOf( 79 | path.join(__dirname, '../node_modules') 80 | ) === 0 81 | ) 82 | } 83 | }), 84 | // extract webpack runtime and module manifest to its own file in order to 85 | // prevent vendor hash from being updated whenever app bundle is updated 86 | new webpack.optimize.CommonsChunkPlugin({ 87 | name: 'manifest', 88 | chunks: ['vendor'] 89 | }), 90 | // copy custom static assets 91 | new CopyWebpackPlugin([ 92 | { 93 | from: path.resolve(__dirname, '../static'), 94 | to: config.build.assetsSubDirectory, 95 | ignore: ['.*'] 96 | } 97 | ]) 98 | ] 99 | }) 100 | 101 | if (config.build.productionGzip) { 102 | var CompressionWebpackPlugin = require('compression-webpack-plugin') 103 | 104 | webpackConfig.plugins.push( 105 | new CompressionWebpackPlugin({ 106 | asset: '[path].gz[query]', 107 | algorithm: 'gzip', 108 | test: new RegExp( 109 | '\\.(' + 110 | config.build.productionGzipExtensions.join('|') + 111 | ')$' 112 | ), 113 | threshold: 10240, 114 | minRatio: 0.8 115 | }) 116 | ) 117 | } 118 | 119 | if (config.build.bundleAnalyzerReport) { 120 | var BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin 121 | webpackConfig.plugins.push(new BundleAnalyzerPlugin()) 122 | } 123 | 124 | module.exports = webpackConfig 125 | -------------------------------------------------------------------------------- /build/webpack.test.conf.js: -------------------------------------------------------------------------------- 1 | // This is the webpack config used for unit tests. 2 | 3 | var utils = require('./utils') 4 | var webpack = require('webpack') 5 | var merge = require('webpack-merge') 6 | var baseConfig = require('./webpack.base.conf') 7 | 8 | var webpackConfig = merge(baseConfig, { 9 | // use inline sourcemap for karma-sourcemap-loader 10 | module: { 11 | rules: utils.styleLoaders() 12 | }, 13 | devtool: '#inline-source-map', 14 | resolveLoader: { 15 | alias: { 16 | // necessary to to make lang="scss" work in test when using vue-loader's ?inject option 17 | // see discussion at https://github.com/vuejs/vue-loader/issues/724 18 | 'scss-loader': 'sass-loader' 19 | } 20 | }, 21 | plugins: [ 22 | new webpack.DefinePlugin({ 23 | 'process.env': require('../config/test.env') 24 | }) 25 | ] 26 | }) 27 | 28 | // no need for app entry during tests 29 | delete webpackConfig.entry 30 | 31 | module.exports = webpackConfig 32 | -------------------------------------------------------------------------------- /config/dev.env.js: -------------------------------------------------------------------------------- 1 | var merge = require('webpack-merge') 2 | var prodEnv = require('./prod.env') 3 | 4 | module.exports = merge(prodEnv, { 5 | NODE_ENV: '"development"' 6 | }) 7 | -------------------------------------------------------------------------------- /config/index.js: -------------------------------------------------------------------------------- 1 | // see http://vuejs-templates.github.io/webpack for documentation. 2 | var path = require('path') 3 | 4 | module.exports = { 5 | build: { 6 | env: require('./prod.env'), 7 | index: path.resolve(__dirname, '../dist/index.html'), 8 | assetsRoot: path.resolve(__dirname, '../dist'), 9 | assetsSubDirectory: 'static', 10 | assetsPublicPath: '/', 11 | productionSourceMap: true, 12 | // Gzip off by default as many popular static hosts such as 13 | // Surge or Netlify already gzip all static assets for you. 14 | // Before setting to `true`, make sure to: 15 | // npm install --save-dev compression-webpack-plugin 16 | productionGzip: false, 17 | productionGzipExtensions: ['js', 'css'], 18 | // Run the build command with an extra argument to 19 | // View the bundle analyzer report after build finishes: 20 | // `npm run build --report` 21 | // Set to `true` or `false` to always turn it on or off 22 | bundleAnalyzerReport: process.env.npm_config_report 23 | }, 24 | dev: { 25 | env: require('./dev.env'), 26 | port: 8080, 27 | autoOpenBrowser: true, 28 | assetsSubDirectory: 'static', 29 | assetsPublicPath: '/', 30 | proxyTable: {}, 31 | // CSS Sourcemaps off by default because relative paths are "buggy" 32 | // with this option, according to the CSS-Loader README 33 | // (https://github.com/webpack/css-loader#sourcemaps) 34 | // In our experience, they generally work as expected, 35 | // just be aware of this issue when enabling this option. 36 | cssSourceMap: false 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /config/prod.env.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | NODE_ENV: '"production"' 3 | } 4 | -------------------------------------------------------------------------------- /config/test.env.js: -------------------------------------------------------------------------------- 1 | var merge = require('webpack-merge') 2 | var devEnv = require('./dev.env') 3 | 4 | module.exports = merge(devEnv, { 5 | NODE_ENV: '"testing"' 6 | }) 7 | -------------------------------------------------------------------------------- /doc/zhuishushenqi.md: -------------------------------------------------------------------------------- 1 | ## nReader 2 | 3 | #### 追书神器api文档 4 | 5 | 追书神器`api`官方地址: 6 | 7 | ```javascript 8 | http://api.zhuishushenqi.com 9 | http://api05iye5.zhuishushenqi.com 10 | http://http://chapterup.zhuishushenqi.com/chapter 11 | ``` 12 | 13 | 由于官方`api`地址没有进行CROS处理,所以调用时会存在跨域问题,这里提供了一个代理地址: 14 | 15 | ```JavaScript 16 | http://65.49.197.99/:3000 17 | ``` 18 | 19 | 有能力的童鞋可以自己搭一个代理,对请求进行转发. 20 | 21 | #### 接口 22 | 23 | 1. 获取所有分类 24 | 2. 获取排行榜类型 25 | 3. 获取排行榜小说 26 | 4. 获取分类下小类别 27 | 5. 根据分类获取小说列表 28 | 6. 获取小说信息 29 | 7. 获取小说正版源 30 | 8. 获取小说源(正版➕盗版) 31 | 9. 获取小说章节(根据小说id) 32 | 10. 获取小说章节(根据小说源id) 33 | 11. 获取小说章节内容 34 | 12. 获取搜索热词 35 | 13. 搜索自动补充 36 | 14. 模糊搜索 37 | 15. 获取小说最新章节 38 | 39 | 40 | 41 | **所有接口都是`GET`请求** 42 | 43 | ##### 1. 获取所有分类 44 | 45 | | 类型 | 值 | 46 | | ------ | ---------------------------------------- | 47 | | 接口地址 | /cats/lv2/statistics | 48 | | 参数 | null | 49 | | 实例接口地址 | http://api.zhuishushenqi.com/cats/lv2/statistics | 50 | 51 | ##### 2. 获取排行榜类型 52 | 53 | | 类型 | 值 | 54 | | ------ | ---------------------------------------- | 55 | | 接口地址 | /ranking/gender | 56 | | 参数 | null | 57 | | 实例接口地址 | http://api.zhuishushenqi.com/ranking/gender | 58 | 59 | ##### 3. 获取排行榜小说 60 | 61 | | 类型 | 值 | 62 | | ------ | ---------------------------------------- | 63 | | 接口地址 | /ranking/:rankId | 64 | | 参数 | 排行榜的ID,不同字段对应不同的榜单,具体ID从接口2中获取 | 65 | | | _id: 周榜ID | 66 | | | monthRank: 月榜ID | 67 | | | totalRank: 总榜ID | 68 | | 实例接口地址 | http://api.zhuishushenqi.com/ranking/54d43437d47d13ff21cad58b | 69 | 70 | ##### 4. 获取分类下小类别 71 | 72 | | 类型 | 值 | 73 | | ------ | ------------------------------------- | 74 | | 接口地址 | /cats/lv2 | 75 | | 参数 | null | 76 | | 实例接口地址 | http://api.zhuishushenqi.com/cats/lv2 | 77 | 78 | ##### 5. 根据分类获取小说列表 79 | 80 | | 类型 | 值 | 81 | | ------ | ---------------------------------------- | 82 | | 接口地址 | /book/by-categories | 83 | | 参数 | 说明无 | 84 | | | gender: 男生:`mael` 女生:`female` 出版:`press` | 85 | | | type: 热门:`hot` 新书:`new` 好评:`repulation` 完结: `over` 包月: `month` | 86 | | | major: 大类别 从接口1获取 | 87 | | | minor: 小类别 从接口4获取 (非必填) | 88 | | | start: 分页开始页 | 89 | | | limit: 分页条数 | 90 | | 实例接口地址 | https://api.zhuishushenqi.com/book/by-categories?gender=male&type=hot&major=%E5%A5%87%E5%B9%BB&minor=&start=0&limit=20 | 91 | 92 | ##### 6. 获取小说信息 93 | 94 | | 类型 | 值 | 95 | | ------ | ---------------------------------------- | 96 | | 接口地址 | /book/:booId | 97 | | 参数 | booId具体小说的ID | 98 | | 实例接口地址 | http://api.zhuishushenqi.com/book/548d9c17eb0337ee6df738f5 | 99 | 100 | ##### 7. 获取小说正版源 101 | 102 | | 类型 | 值 | 103 | | ------ | ---------------------------------------- | 104 | | 接口地址 | /btoc | 105 | | 参数 | view: 暂时只知道`summary`这个参数 book: 对应的bookId | 106 | | 实例接口地址 | http://api.zhuishushenqi.com/btoc?view=summary&book=548d9c17eb0337ee6df738f5 | 107 | 108 | ##### 8. 获取小说正版源于盗版源(混合) 109 | 110 | | 类型 | 值 | 111 | | ------ | ---------------------------------------- | 112 | | 接口地址 | /atoc | 113 | | 参数 | `view`: 暂时只知道`summary`这个参数` book`: 对应的bookId | 114 | | 实例接口地址 | http://api.zhuishushenqi.com/atoc?view=summary&book=548d9c17eb0337ee6df738f5 | 115 | 116 | ##### 9. 获取小说章节(根据小说id) 117 | 118 | | 类型 | 值 | 119 | | ------ | ---------------------------------------- | 120 | | 接口地址 | /mix-atoc/:bookId | 121 | | 参数 | `bookId`:对应小说id `view`:暂时只知道`chapters` | 122 | | 实例接口地址 | http://api.zhuishushenqi.com/mix-atoc/50bff3ec209793513100001c?view=chapters | 123 | 124 | ##### 10. 获取小说章节(根据小说源id) 125 | 126 | | 类型 | 值 | 127 | | ------ | ---------------------------------------- | 128 | | 接口地址 | /atoc 或者/btoc | 129 | | 参数 | `sourceId`:对应小说源id `view`:暂时只知道`chapters | 130 | | 实例接口地址 | http://api.zhuishushenqi.com/atoc/568fef99adb27bfb4b3a58dc?view=chapters | 131 | 132 | ##### 11. 获取小说章节内容 133 | 134 | | 类型 | 值 | 135 | | ------ | ---------------------------------------- | 136 | | 接口地址 | chapterup.zhuishushenqi.com/chapter/ | 137 | | 参数 | link: 章节地址 | 138 | | 实例接口地址 | http://chapterup.zhuishushenqi.com/chapter/http://vip.zhuishushenqi.com/chapter/5817f1161bb2ca566b0a5973?cv=1481275033588 | 139 | 140 | ##### 12. 获取搜索热词 141 | 142 | | 类型 | 值 | 143 | | ------ | ---------------------------------------- | 144 | | 接口 | /book/search-hotwords | 145 | | 参数 | null | 146 | | 实例接口地址 | http://api.zhuishushenqi.com/book/search-hotword | 147 | 148 | ##### 13. 搜索自动补充 149 | 150 | | 类型 | 值 | 151 | | ------ | ---------------------------------------- | 152 | | 接口 | /book/auto-complete | 153 | | 参数 | `query`:查询值 | 154 | | 实例接口地址 | http://api.zhuishushenqi.com/book/auto-complete?query=%E6%96%97%E7%BD%97 | 155 | 156 | ##### 14. 模糊搜索 157 | 158 | | 类型 | 值 | 159 | | ---- | ---------------------------------------- | 160 | | 接口 | /book/fuzzy-search | 161 | | 参数 | `query`:查询值 | 162 | | 实例地址 | http://api.zhuishushenqi.com/book/fuzzy-search?query=%E6%96%97%E7%BD%97 | 163 | 164 | ##### 15. 获取小说最新章节 165 | 166 | | 类型 | 值 | 167 | | ------ | ---------------------------------------- | 168 | | 接口 | /book | 169 | | 参数 | `view`: updated `id`:以都好分割的bookId | 170 | | 实例接口地址 | http://api05iye5.zhuishushenqi.com/book?view=updated&id=531169b3173bfacb4904ca67 | 171 | -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 随便看 21 | 22 | 23 | 24 |
25 | 26 | 27 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "vue-nReader", 3 | "version": "1.0.0", 4 | "description": "A novel reader webapp", 5 | "author": "zimplexing ", 6 | "private": true, 7 | "scripts": { 8 | "dev": "node build/dev-server.js", 9 | "start": "node build/dev-server.js", 10 | "build": "node build/build.js", 11 | "unit": "cross-env BABEL_ENV=test karma start test/unit/karma.conf.js --single-run", 12 | "e2e": "node test/e2e/runner.js", 13 | "test": "npm run unit && npm run e2e" 14 | }, 15 | "dependencies": { 16 | "axios": "^0.16.1", 17 | "lodash": "^4.17.4", 18 | "mint-ui": "^2.2.7", 19 | "moment": "^2.18.1", 20 | "vue": "^2.2.6", 21 | "vue-router": "^2.3.1", 22 | "vue-scroll": "^2.0.3", 23 | "vue-touch": "^2.0.0-beta.4", 24 | "vuex": "^2.3.1" 25 | }, 26 | "devDependencies": { 27 | "autoprefixer": "^6.7.2", 28 | "babel-core": "^6.22.1", 29 | "babel-loader": "^6.2.10", 30 | "babel-plugin-istanbul": "^4.1.1", 31 | "babel-plugin-transform-runtime": "^6.22.0", 32 | "babel-preset-env": "^1.3.2", 33 | "babel-preset-stage-2": "^6.22.0", 34 | "babel-register": "^6.22.0", 35 | "chai": "^3.5.0", 36 | "chalk": "^1.1.3", 37 | "chromedriver": "^2.27.2", 38 | "connect-history-api-fallback": "^1.3.0", 39 | "copy-webpack-plugin": "^4.0.1", 40 | "cross-env": "^4.0.0", 41 | "cross-spawn": "^5.0.1", 42 | "css-loader": "^0.28.0", 43 | "eslint": "^4.1.1", 44 | "eslint-config-standard": "^10.2.1", 45 | "eslint-plugin-html": "^3.0.0", 46 | "eslint-plugin-import": "^2.6.1", 47 | "eslint-plugin-node": "^5.1.0", 48 | "eslint-plugin-promise": "^3.5.0", 49 | "eslint-plugin-standard": "^3.0.1", 50 | "eventsource-polyfill": "^0.9.6", 51 | "express": "^4.14.1", 52 | "extract-text-webpack-plugin": "^2.0.0", 53 | "file-loader": "^0.11.1", 54 | "friendly-errors-webpack-plugin": "^1.1.3", 55 | "html-webpack-plugin": "^2.28.0", 56 | "http-proxy-middleware": "^0.17.3", 57 | "inject-loader": "^3.0.0", 58 | "karma": "^1.4.1", 59 | "karma-coverage": "^1.1.1", 60 | "karma-mocha": "^1.3.0", 61 | "karma-phantomjs-launcher": "^1.0.2", 62 | "karma-phantomjs-shim": "^1.4.0", 63 | "karma-sinon-chai": "^1.3.1", 64 | "karma-sourcemap-loader": "^0.3.7", 65 | "karma-spec-reporter": "0.0.30", 66 | "karma-webpack": "^2.0.2", 67 | "lolex": "^1.5.2", 68 | "mocha": "^3.2.0", 69 | "nightwatch": "^0.9.12", 70 | "opn": "^4.0.2", 71 | "optimize-css-assets-webpack-plugin": "^1.3.0", 72 | "ora": "^1.2.0", 73 | "phantomjs-prebuilt": "^2.1.14", 74 | "rimraf": "^2.6.0", 75 | "selenium-server": "^3.0.1", 76 | "semver": "^5.3.0", 77 | "shelljs": "^0.7.6", 78 | "sinon": "^2.1.0", 79 | "sinon-chai": "^2.8.0", 80 | "url-loader": "^0.5.8", 81 | "vue-loader": "^11.3.4", 82 | "vue-style-loader": "^2.0.5", 83 | "vue-template-compiler": "^2.2.6", 84 | "webpack": "^2.3.3", 85 | "webpack-bundle-analyzer": "^2.2.1", 86 | "webpack-dev-middleware": "^1.10.0", 87 | "webpack-hot-middleware": "^2.18.0", 88 | "webpack-merge": "^4.1.0" 89 | }, 90 | "engines": { 91 | "node": ">= 4.0.0", 92 | "npm": ">= 3.0.0" 93 | }, 94 | "browserslist": [ 95 | "> 1%", 96 | "last 2 versions", 97 | "not ie <= 8" 98 | ] 99 | } 100 | -------------------------------------------------------------------------------- /screenshot/book.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zimplexing/vue-nReader/dc1e3fc19b3cbce1133fd90f8ee85229634d5299/screenshot/book.png -------------------------------------------------------------------------------- /screenshot/bookshelf.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zimplexing/vue-nReader/dc1e3fc19b3cbce1133fd90f8ee85229634d5299/screenshot/bookshelf.png -------------------------------------------------------------------------------- /screenshot/catDetail.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zimplexing/vue-nReader/dc1e3fc19b3cbce1133fd90f8ee85229634d5299/screenshot/catDetail.png -------------------------------------------------------------------------------- /screenshot/catory.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zimplexing/vue-nReader/dc1e3fc19b3cbce1133fd90f8ee85229634d5299/screenshot/catory.png -------------------------------------------------------------------------------- /screenshot/chapter.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zimplexing/vue-nReader/dc1e3fc19b3cbce1133fd90f8ee85229634d5299/screenshot/chapter.png -------------------------------------------------------------------------------- /screenshot/errBook.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zimplexing/vue-nReader/dc1e3fc19b3cbce1133fd90f8ee85229634d5299/screenshot/errBook.png -------------------------------------------------------------------------------- /screenshot/nReader.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zimplexing/vue-nReader/dc1e3fc19b3cbce1133fd90f8ee85229634d5299/screenshot/nReader.png -------------------------------------------------------------------------------- /screenshot/nightMode.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zimplexing/vue-nReader/dc1e3fc19b3cbce1133fd90f8ee85229634d5299/screenshot/nightMode.png -------------------------------------------------------------------------------- /screenshot/rank.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zimplexing/vue-nReader/dc1e3fc19b3cbce1133fd90f8ee85229634d5299/screenshot/rank.png -------------------------------------------------------------------------------- /screenshot/rankType.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zimplexing/vue-nReader/dc1e3fc19b3cbce1133fd90f8ee85229634d5299/screenshot/rankType.png -------------------------------------------------------------------------------- /screenshot/readbook.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zimplexing/vue-nReader/dc1e3fc19b3cbce1133fd90f8ee85229634d5299/screenshot/readbook.png -------------------------------------------------------------------------------- /screenshot/search.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zimplexing/vue-nReader/dc1e3fc19b3cbce1133fd90f8ee85229634d5299/screenshot/search.png -------------------------------------------------------------------------------- /src/App.vue: -------------------------------------------------------------------------------- 1 | 6 | 7 | 13 | 14 | 47 | -------------------------------------------------------------------------------- /src/api/api.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | 3 | export default { 4 | 5 | /** 6 | * 获取所有的排行榜类型 7 | * @returns {null} 8 | */ 9 | getRankType () { 10 | return Vue.http.get('/ranking/gender') 11 | }, 12 | 13 | /** 14 | * 根据id获取排行榜 15 | * @returns {String} id为周榜id,月榜id,总榜id 16 | */ 17 | getRankList (id) { 18 | return Vue.http.get('/ranking/' + id) 19 | }, 20 | 21 | /** 22 | * 获取所有分类 23 | * @returns {null} 24 | * http://api.zhuishushenqi.com/cats/lv2 25 | */ 26 | getCategory () { 27 | return Vue.http.get('/cats/lv2/statistics') 28 | }, 29 | 30 | /** 31 | * 获取细分的类别 32 | */ 33 | getCategoryDetail () { 34 | return Vue.http.get('/cats/lv2') 35 | }, 36 | 37 | /** 38 | * 根据分类获取小说列表 39 | * @param {String} gender 可选:male/female/press 40 | * @param {String} type 可选:hot(热门)/new(新书)/reputation(好评)/over(完结)/monthly(包月) 41 | * @param {String} major 42 | * @param {String} minor 43 | * @param {Number} start 44 | * @param {Number} limit 45 | * https://api.zhuishushenqi.com/book/by-categories?gender=male&type=hot&major=%E5%A5%87%E5%B9%BB&minor=&start=0&limit=20 46 | */ 47 | // todo 入参需要用es6优化 48 | getNovelListByCat (gender, type, major, minor = '', start = 0, limit = 20) { 49 | return Vue.http.get('/book/by-categories?gender=' + gender + '&type=' + type + '&major=' + major + '&minor=' + minor + '&start=' + start + '&limit=' + limit) 50 | }, 51 | 52 | /** 53 | * 根据id获取小说 54 | * @param {String} bookId 小说id 55 | */ 56 | getBook (bookId) { 57 | return Vue.http.get('/book/' + bookId) 58 | }, 59 | 60 | /** 61 | * 获取小说源(正版源) 62 | * @param {String} bookId 小说id 63 | * 'http://api.zhuishushenqi.com/btoc?view=summary&book=548d9c17eb0337ee6df738f5' 64 | */ 65 | getGenuineSource (bookId) { 66 | return Vue.http.get('/btoc?view=summary&book=' + bookId) 67 | }, 68 | 69 | /** 70 | * 获取小说源(正版源与盗版源) 71 | * @param {String} bookId 小说id 72 | * 'http://api.zhuishushenqi.com/atoc?view=summary&book=548d9c17eb0337ee6df738f5' 73 | */ 74 | getMixSource (bookId) { 75 | return Vue.http.get('/atoc?view=summary&book=' + bookId) 76 | }, 77 | 78 | /** 79 | * 获取小说章节(混合源,大概可认为是正版网站的公众章节+最快更新的盗版网站章节的混合) 80 | * @param {String} bookId 小说id 81 | * http://api.zhuishushenqi.com/mix-atoc/50bff3ec209793513100001c?view=chapters 82 | */ 83 | getMixChapters (bookId) { 84 | return Vue.http.get('/mix-atoc/' + bookId + '?view=chapters') 85 | }, 86 | 87 | /** 88 | * 获取小说章节 89 | * @param {String} sourceId 小说源id 90 | */ 91 | getChapters (sourceId) { 92 | return Vue.http.get('/atoc/' + sourceId + '?view=chapters') 93 | }, 94 | 95 | /** 96 | * 获取小说章节内容 97 | * @param {String} chapterUrl 章节url 98 | * http://chapterup.zhuishushenqi.com/chapter/http://vip.zhuishushenqi.com/chapter/5817f1161bb2ca566b0a5973?cv=1481275033588 99 | */ 100 | getBookChapterContent (chapterUrl) { 101 | return Vue.http.get('/getChapter?chapterUrl=' + chapterUrl) 102 | }, 103 | 104 | /** 105 | * 获取搜索热词 106 | * @returns {null} 107 | */ 108 | getHotWords () { 109 | return Vue.http.get('/book/search-hotwords') 110 | }, 111 | 112 | /** 113 | * 搜索自动补充 114 | * @param {String} searchWord 搜索内容 115 | * http://api05iye5.zhuishushenqi.com/book/auto-complete?query=%E6%96%97%E7%BD%97 116 | */ 117 | autoComplete (searchWord) { 118 | return Vue.http.get('/book/auto-complete?query=' + searchWord) 119 | }, 120 | 121 | /** 122 | * 模糊搜索 123 | * @param {String} searchWord 搜索内容 124 | */ 125 | fuzzySearch (searchWord) { 126 | return Vue.http.get('/book/fuzzy-search?query=' + searchWord) 127 | }, 128 | 129 | /** 130 | * 获取小说最新章节(书架) 131 | * @param {Array} bookList 获取更新的小说id 132 | * http://api05iye5.zhuishushenqi.com/book?view=updated&id=531169b3173bfacb4904ca67,51d11e782de6405c45000068 133 | */ 134 | getUpdate (bookList) { 135 | return Vue.http.get('/book?view=updated&id=' + bookList.toString()) 136 | } 137 | 138 | } 139 | -------------------------------------------------------------------------------- /src/assets/book.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/assets/category.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/assets/down.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/assets/font_bigger.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/assets/font_smaller.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/assets/line_spacing_big.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/assets/line_spacing_normal.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/assets/line_spacing_small.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/assets/list.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/assets/moon.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/assets/rank.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/assets/rank_other.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/assets/search.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/assets/setting.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/assets/sun.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/assets/trash.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/assets/up.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/components/Home.vue: -------------------------------------------------------------------------------- 1 | 40 | 41 | 70 | 71 | 80 | -------------------------------------------------------------------------------- /src/components/book/ChangeSource.vue: -------------------------------------------------------------------------------- 1 | 12 | 47 | 56 | -------------------------------------------------------------------------------- /src/components/book/ReadBook.vue: -------------------------------------------------------------------------------- 1 | 72 | 73 | 277 | 278 | 279 | -------------------------------------------------------------------------------- /src/components/bookshelf/Bookshelf.vue: -------------------------------------------------------------------------------- 1 | 20 | 21 | 112 | 113 | 114 | 189 | -------------------------------------------------------------------------------- /src/components/category/BookcatDetail.vue: -------------------------------------------------------------------------------- 1 | 24 | 148 | 194 | -------------------------------------------------------------------------------- /src/components/category/Bookcategory.vue: -------------------------------------------------------------------------------- 1 | 14 | 39 | 74 | -------------------------------------------------------------------------------- /src/components/common/Book.vue: -------------------------------------------------------------------------------- 1 | 46 | 47 | 151 | 152 | 153 | 280 | -------------------------------------------------------------------------------- /src/components/common/Booklist.vue: -------------------------------------------------------------------------------- 1 | 12 | 13 | 42 | 43 | 44 | 96 | -------------------------------------------------------------------------------- /src/components/ranklist/Rank.vue: -------------------------------------------------------------------------------- 1 | 48 | 88 | 89 | 128 | -------------------------------------------------------------------------------- /src/components/ranklist/RankItem.vue: -------------------------------------------------------------------------------- 1 | 7 | 8 | 32 | 33 | 34 | 70 | -------------------------------------------------------------------------------- /src/components/ranklist/Ranklist.vue: -------------------------------------------------------------------------------- 1 | 16 | 17 | 18 | 38 | 39 | 40 | 67 | -------------------------------------------------------------------------------- /src/components/ranklist/RanklistDetail.vue: -------------------------------------------------------------------------------- 1 | 10 | 11 | 88 | 89 | 90 | 102 | -------------------------------------------------------------------------------- /src/components/search/Search.vue: -------------------------------------------------------------------------------- 1 | 42 | 43 | 129 | 130 | 131 | 247 | -------------------------------------------------------------------------------- /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 App from './App.vue' 5 | import VueTouch from 'vue-touch' 6 | import router from './router' 7 | import Ajax from './utils/ajax' 8 | import store from './store' 9 | import MintUI from 'mint-ui' 10 | import 'mint-ui/lib/style.css' 11 | import vuescroll from 'vue-scroll' 12 | 13 | Vue.use(vuescroll) 14 | VueTouch.config.swipe = { 15 | direction: 'horizontal' 16 | } 17 | 18 | Vue.use(VueTouch, { 19 | name: 'v-touch' 20 | }) 21 | Vue.use(MintUI) 22 | Vue.config.productionTip = false 23 | Vue.use(Ajax, { 24 | baseURL: 'http://65.49.197.99:3000/' 25 | }) 26 | 27 | /* eslint-disable no-new */ 28 | new Vue({ 29 | el: '#app', 30 | router, 31 | store, 32 | template: '', 33 | components: { 34 | App 35 | } 36 | }) 37 | 38 | // Disable context menu 39 | document.addEventListener('contextmenu', event => { 40 | event.preventDefault() 41 | event.stopPropagation() 42 | }) 43 | -------------------------------------------------------------------------------- /src/router/index.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import Router from 'vue-router' 3 | 4 | Vue.use(Router) 5 | 6 | const Home = resolve => require(['@/components/Home'], resolve) 7 | const Ranklist = resolve => require(['@/components/ranklist/Ranklist'], resolve) 8 | const RanklistDetail = resolve => require(['@/components/ranklist/RanklistDetail'], resolve) 9 | const Book = resolve => require(['@/components/common/Book'], resolve) 10 | const ReadBook = resolve => require(['@/components/book/ReadBook'], resolve) 11 | const BookcatDetail = resolve => require(['@/components/category/BookcatDetail'], resolve) 12 | const ChangeSource = resolve => require(['@/components/book/ChangeSource'], resolve) 13 | 14 | export default new Router({ 15 | routes: [ 16 | { 17 | path: '/', 18 | name: 'home', 19 | component: Home 20 | }, { 21 | path: '/bookcat/detail', 22 | name: 'bookcatDetail', 23 | component: BookcatDetail 24 | }, { 25 | path: '/readbook/:bookId', 26 | name: 'readbook', 27 | component: ReadBook 28 | }, { 29 | path: '/book/:bookId', 30 | name: 'book', 31 | component: Book 32 | }, { 33 | path: '/changeSource/:bookId', 34 | name: 'changeSource', 35 | component: ChangeSource 36 | }, { 37 | path: '/ranklist', 38 | name: 'ranklist', 39 | redirect: '/ranklist/weekRank', 40 | component: Ranklist, 41 | children: [{ 42 | path: '/ranklist/*', 43 | name: 'RanklistDetail', 44 | component: RanklistDetail 45 | }] 46 | } 47 | ] 48 | }) 49 | -------------------------------------------------------------------------------- /src/store/actions.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zimplexing/vue-nReader/dc1e3fc19b3cbce1133fd90f8ee85229634d5299/src/store/actions.js -------------------------------------------------------------------------------- /src/store/index.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import Vuex from 'vuex' 3 | // import action from 'action' 4 | import mutations from './mutations' 5 | 6 | Vue.use(Vuex) 7 | 8 | const state = { 9 | weekRankId: '', 10 | monthRankId: '', 11 | totalRankId: '', 12 | headTitle: '', // 头部文字 13 | previousPosition: '书架', 14 | source: '', // 小说源 15 | backPath: {}, 16 | bookInfo: {} 17 | } 18 | 19 | export default new Vuex.Store({ 20 | state, 21 | mutations 22 | }) 23 | -------------------------------------------------------------------------------- /src/store/mutations.js: -------------------------------------------------------------------------------- 1 | import { 2 | SET_RANK, 3 | SET_BACK_POSITION, 4 | SET_CURRENT_SOURCE, 5 | SET_SEC_PATH, 6 | SET_THIRD_PATH, 7 | SET_HEAD_TITLE, 8 | SET_READ_BOOK 9 | } from './mutationsType' 10 | 11 | export default { 12 | [SET_RANK] (state, rankDetail) { 13 | state.weekRankId = rankDetail._id 14 | state.monthRankId = rankDetail.monthRank 15 | state.totalRankId = rankDetail.totalRank 16 | state.headTitle = rankDetail.shortTitle 17 | }, 18 | [SET_BACK_POSITION] (state, position) { 19 | state.previousPosition = position 20 | }, 21 | [SET_CURRENT_SOURCE] (state, source) { 22 | state.source = source 23 | }, 24 | [SET_SEC_PATH] (state, prePath) { 25 | state.backPath.secPath = prePath 26 | }, 27 | [SET_THIRD_PATH] (state, prePath) { 28 | state.backPath.thirdPath = prePath 29 | }, 30 | [SET_HEAD_TITLE] (state, text) { 31 | state.headTitle = text 32 | }, 33 | [SET_READ_BOOK] (state, book) { 34 | state.bookInfo = book 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/store/mutationsType.js: -------------------------------------------------------------------------------- 1 | export const SET_RANK = 'SET_RANK' 2 | export const SET_BACK_POSITION = 'SET_BACK_POSITION' 3 | export const SET_CURRENT_SOURCE = 'SET_CURRENT_SOURCE' 4 | export const SET_SEC_PATH = 'SET_SEC_PATH' 5 | export const SET_THIRD_PATH = 'SET_THIRD_PATH' 6 | export const SET_HEAD_TITLE = 'SET_HEAD_TITLE' 7 | export const SET_READ_BOOK = 'SET_READ_BOOK' 8 | -------------------------------------------------------------------------------- /src/utils/ajax.js: -------------------------------------------------------------------------------- 1 | import axios from 'axios' 2 | 3 | export default { 4 | install (Vue, option = {}) { 5 | const http = axios.create(option) 6 | Vue.http = http 7 | Vue.prototype.$http = http 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/utils/util.js: -------------------------------------------------------------------------------- 1 | /* 2 | * @Author: zimplexing 3 | * @Date: 2017-06-24 19:24:32 4 | * @Last Modified by: zimplexing 5 | * @Last Modified time: 2017-07-02 12:48:13 6 | */ 7 | 8 | import _ from 'lodash' 9 | 10 | const localStroage = window.localStorage 11 | 12 | export default { 13 | 14 | staticPath: 'http://statics.zhuishushenqi.com', 15 | 16 | /** 17 | * 获取localstroage的数据 18 | * @param {String} key 获取localstroage的item 19 | */ 20 | getLocalStroageData (item) { 21 | return _.isEmpty(JSON.parse(localStroage.getItem(item))) ? null : JSON.parse(localStroage.getItem(item)) 22 | }, 23 | 24 | /** 25 | * 设置localstroage的值 26 | * @param {String} item 27 | * @param {Object} obj 28 | */ 29 | setLocalStroageData (item, obj) { 30 | localStroage.setItem(item, JSON.stringify(obj)) 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /static/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zimplexing/vue-nReader/dc1e3fc19b3cbce1133fd90f8ee85229634d5299/static/.gitkeep -------------------------------------------------------------------------------- /test/e2e/custom-assertions/elementCount.js: -------------------------------------------------------------------------------- 1 | // A custom Nightwatch assertion. 2 | // the name of the method is the filename. 3 | // can be used in tests like this: 4 | // 5 | // browser.assert.elementCount(selector, count) 6 | // 7 | // for how to write custom assertions see 8 | // http://nightwatchjs.org/guide#writing-custom-assertions 9 | exports.assertion = function (selector, count) { 10 | this.message = 'Testing if element <' + selector + '> has count: ' + count 11 | this.expected = count 12 | this.pass = function (val) { 13 | return val === this.expected 14 | } 15 | this.value = function (res) { 16 | return res.value 17 | } 18 | this.command = function (cb) { 19 | var self = this 20 | return this.api.execute(function (selector) { 21 | return document.querySelectorAll(selector).length 22 | }, [selector], function (res) { 23 | cb.call(self, res) 24 | }) 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /test/e2e/nightwatch.conf.js: -------------------------------------------------------------------------------- 1 | require('babel-register') 2 | var config = require('../../config') 3 | 4 | // http://nightwatchjs.org/gettingstarted#settings-file 5 | module.exports = { 6 | src_folders: ['test/e2e/specs'], 7 | output_folder: 'test/e2e/reports', 8 | custom_assertions_path: ['test/e2e/custom-assertions'], 9 | 10 | selenium: { 11 | start_process: true, 12 | server_path: require('selenium-server').path, 13 | host: '127.0.0.1', 14 | port: 4444, 15 | cli_args: { 16 | 'webdriver.chrome.driver': require('chromedriver').path 17 | } 18 | }, 19 | 20 | test_settings: { 21 | default: { 22 | selenium_port: 4444, 23 | selenium_host: 'localhost', 24 | silent: true, 25 | globals: { 26 | devServerURL: 'http://localhost:' + (process.env.PORT || config.dev.port) 27 | } 28 | }, 29 | 30 | chrome: { 31 | desiredCapabilities: { 32 | browserName: 'chrome', 33 | javascriptEnabled: true, 34 | acceptSslCerts: true 35 | } 36 | }, 37 | 38 | firefox: { 39 | desiredCapabilities: { 40 | browserName: 'firefox', 41 | javascriptEnabled: true, 42 | acceptSslCerts: true 43 | } 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /test/e2e/runner.js: -------------------------------------------------------------------------------- 1 | // 1. start the dev server using production config 2 | process.env.NODE_ENV = 'testing' 3 | var server = require('../../build/dev-server.js') 4 | 5 | server.ready.then(() => { 6 | // 2. run the nightwatch test suite against it 7 | // to run in additional browsers: 8 | // 1. add an entry in test/e2e/nightwatch.conf.json under "test_settings" 9 | // 2. add it to the --env flag below 10 | // or override the environment flag, for example: `npm run e2e -- --env chrome,firefox` 11 | // For more information on Nightwatch's config file, see 12 | // http://nightwatchjs.org/guide#settings-file 13 | var opts = process.argv.slice(2) 14 | if (opts.indexOf('--config') === -1) { 15 | opts = opts.concat(['--config', 'test/e2e/nightwatch.conf.js']) 16 | } 17 | if (opts.indexOf('--env') === -1) { 18 | opts = opts.concat(['--env', 'chrome']) 19 | } 20 | 21 | var spawn = require('cross-spawn') 22 | var runner = spawn('./node_modules/.bin/nightwatch', opts, { stdio: 'inherit' }) 23 | 24 | runner.on('exit', function (code) { 25 | server.close() 26 | process.exit(code) 27 | }) 28 | 29 | runner.on('error', function (err) { 30 | server.close() 31 | throw err 32 | }) 33 | }) 34 | -------------------------------------------------------------------------------- /test/e2e/specs/test.js: -------------------------------------------------------------------------------- 1 | // For authoring Nightwatch tests, see 2 | // http://nightwatchjs.org/guide#usage 3 | 4 | module.exports = { 5 | 'default e2e tests': function (browser) { 6 | // automatically uses dev Server port from /config.index.js 7 | // default: http://localhost:8080 8 | // see nightwatch.conf.js 9 | const devServer = browser.globals.devServerURL 10 | 11 | browser 12 | .url(devServer) 13 | .waitForElementVisible('#app', 5000) 14 | .assert.elementPresent('.hello') 15 | .assert.containsText('h1', 'Welcome to Your Vue.js App') 16 | .assert.elementCount('img', 1) 17 | .end() 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /test/unit/.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "env": { 3 | "mocha": true 4 | }, 5 | "globals": { 6 | "expect": true, 7 | "sinon": true 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /test/unit/index.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | 3 | Vue.config.productionTip = false 4 | 5 | // require all test files (files that ends with .spec.js) 6 | const testsContext = require.context('./specs', true, /\.spec$/) 7 | testsContext.keys().forEach(testsContext) 8 | 9 | // require all src files except main.js for coverage. 10 | // you can also change this to match only the subset of files that 11 | // you want coverage for. 12 | const srcContext = require.context('../../src', true, /^\.\/(?!main(\.js)?$)/) 13 | srcContext.keys().forEach(srcContext) 14 | -------------------------------------------------------------------------------- /test/unit/karma.conf.js: -------------------------------------------------------------------------------- 1 | // This is a karma config file. For more details see 2 | // http://karma-runner.github.io/0.13/config/configuration-file.html 3 | // we are also using it with karma-webpack 4 | // https://github.com/webpack/karma-webpack 5 | 6 | var webpackConfig = require('../../build/webpack.test.conf') 7 | 8 | module.exports = function (config) { 9 | config.set({ 10 | // to run in additional browsers: 11 | // 1. install corresponding karma launcher 12 | // http://karma-runner.github.io/0.13/config/browsers.html 13 | // 2. add it to the `browsers` array below. 14 | browsers: ['PhantomJS'], 15 | frameworks: ['mocha', 'sinon-chai', 'phantomjs-shim'], 16 | reporters: ['spec', 'coverage'], 17 | files: ['./index.js'], 18 | preprocessors: { 19 | './index.js': ['webpack', 'sourcemap'] 20 | }, 21 | webpack: webpackConfig, 22 | webpackMiddleware: { 23 | noInfo: true 24 | }, 25 | coverageReporter: { 26 | dir: './coverage', 27 | reporters: [ 28 | { type: 'lcov', subdir: '.' }, 29 | { type: 'text-summary' } 30 | ] 31 | } 32 | }) 33 | } 34 | -------------------------------------------------------------------------------- /test/unit/specs/Hello.spec.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import Hello from '@/components/Hello' 3 | 4 | describe('Hello.vue', () => { 5 | it('should render correct contents', () => { 6 | const Constructor = Vue.extend(Hello) 7 | const vm = new Constructor().$mount() 8 | expect(vm.$el.querySelector('.hello h1').textContent) 9 | .to.equal('Welcome to Your Vue.js App') 10 | }) 11 | }) 12 | --------------------------------------------------------------------------------