├── .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 | [](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 |
{{$store.state.bookInfo.title}}:目录
61 |{{book.title}}
11 |{{book.updated | ago}}:{{book.lastChapter}}
12 |{{categoryType[key]}}
5 |{{cat.name}}
8 | {{cat.bookCount}} 9 |{{book.title}}
16 | 17 |18 | {{book.updated | ago}} | {{wordCount}}万 | {{book.cat}}
19 |{{book.longIntro}}
43 |{{book.title}}
6 | 7 |{{book.shortIntro}}
8 |{{latelyFollower}}万人气 | {{book.retentionRatio}}%读者留存
9 |男生
5 |女生
26 |