├── .babelrc
├── .editorconfig
├── .gitignore
├── .postcssrc.js
├── README.md
├── build
├── build.js
├── check-versions.js
├── logo.png
├── utils.js
├── vue-loader.conf.js
├── webpack.base.conf.js
├── webpack.dev.conf.js
└── webpack.prod.conf.js
├── config
├── dev.env.js
├── index.js
└── prod.env.js
├── index.html
├── package.json
├── src
├── App.vue
├── assets
│ ├── css
│ │ └── main.less
│ └── img
│ │ ├── delete.png
│ │ ├── det-file.png
│ │ ├── det-write.png
│ │ ├── dis-1.png
│ │ ├── dis-2.png
│ │ ├── dis-22.png
│ │ ├── editor.png
│ │ ├── foot1-1020.png
│ │ ├── foot2-1020.png
│ │ ├── foot3-1020.png
│ │ ├── icon.png
│ │ ├── icon_login_code.png
│ │ ├── icon_login_password.png
│ │ ├── icon_login_password_again.png
│ │ ├── icon_login_user.png
│ │ ├── logo.png
│ │ ├── per-bg.jpg
│ │ ├── per-in.png
│ │ ├── top_bg.jpg
│ │ └── up.png
├── components
│ ├── api.js
│ ├── load
│ │ ├── index.js
│ │ └── load.vue
│ └── tip
│ │ ├── index.js
│ │ └── tip.vue
├── main.js
├── mock
│ ├── game.js
│ └── index.js
├── router
│ └── index.js
└── view
│ ├── detail.vue
│ ├── edit.vue
│ ├── index.vue
│ ├── login.vue
│ ├── myRemind.vue
│ ├── myReply.vue
│ ├── myWrite.vue
│ ├── newThread.vue
│ ├── systemMessage.vue
│ └── userCenter.vue
└── static
└── .gitkeep
/.babelrc:
--------------------------------------------------------------------------------
1 | {
2 | "presets": [
3 | ["env", {
4 | "modules": false,
5 | "targets": {
6 | "browsers": ["> 1%", "last 2 versions", "not ie <= 8"]
7 | }
8 | }],
9 | "stage-2"
10 | ],
11 | "plugins": ["transform-runtime",["component",[
12 | {"libraryName":"mint-ui","style":true}
13 | ]]],
14 | "env": {
15 | "test": {
16 | "presets": ["env", "stage-2"],
17 | "plugins": ["istanbul"]
18 | }
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/.editorconfig:
--------------------------------------------------------------------------------
1 | root = true
2 |
3 | [*]
4 | charset = utf-8
5 | indent_style = space
6 | indent_size = 2
7 | end_of_line = lf
8 | insert_final_newline = true
9 | trim_trailing_whitespace = true
10 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 | node_modules/
3 | /dist/
4 | npm-debug.log*
5 | yarn-debug.log*
6 | yarn-error.log*
7 |
8 | # Editor directories and files
9 | .idea
10 | .vscode
11 | *.suo
12 | *.ntvs*
13 | *.njsproj
14 | *.sln
15 |
--------------------------------------------------------------------------------
/.postcssrc.js:
--------------------------------------------------------------------------------
1 | // https://github.com/michael-ciniawsky/postcss-load-config
2 |
3 | module.exports = {
4 | "plugins": {
5 | "postcss-import": {},
6 | "postcss-url": {},
7 | // to edit target browsers: use "browserslist" field in package.json
8 | "autoprefixer": {}
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # vue-mintUI-demo
2 |
3 | > 利用vue2、mockjs实现前后分离,开发时vue-cli proxyTable 可以解决开发环境的跨域问题,所以针对没有接口数据时采用mockjs方法,有接口时采用修改vue-cli的config文件里index.js的参数proxyTable来开发。
4 |
5 | > UI采用的是[Mint UI](http://mint-ui.github.io/#!/zh-cn),基于 Vue.js 的移动端组件库
6 |
7 | > 要想统一处理所有http请求和响应,就得用上 axios 的拦截器。通过配置http response inteceptor,当后端接口返回-555 (未授权),让用户重新登录。
8 |
9 | ```code
10 | axios.interceptors.request.use(function (config) {
11 | return config;
12 | }, function (error) {
13 | return Promise.reject(error);
14 | });
15 |
16 | //请求完成
17 | axios.interceptors.response.use(function (response) {
18 | if(response.data.code == -555){
19 | //未登录
20 | router.replace({
21 | path: 'login',
22 | query: {path: router.currentRoute.fullPath.slice(1)}
23 | })
24 | }
25 | return response;
26 | }, function (error) {
27 | return Promise.reject(error);
28 | });
29 | ```
30 |
31 | 通过上面这两步,就可以在前端实现登录拦截了。登出功能也就很简单,只需要把当前token清除,再跳转到首页即可。
32 |
33 | > 如果对您有帮助,您可以点右上角 "Star" 支持一下 谢谢! ^_^
34 |
35 | # 说明
36 |
37 | 因该例子是以公司项目开发的,并没完全做完,所以仅提供学习参考。
38 |
39 | ## 技术栈
40 |
41 | > vue
42 |
43 | > vue-router
44 |
45 | > axios
46 |
47 | > mockjs
48 |
49 | > webpack
50 |
51 | ## 执行命令
52 |
53 | 通过npm安装本地服务第三方依赖模块(需要已安装Node.js),使用npm安装依赖模块可能会很慢,建议换成cnpm
54 |
55 | npm install -g cnpm --registry=http://registry.npm.taobao.org
56 |
57 | > cnpm install
58 |
59 | > npm run dev
60 |
61 | > npm run build
62 |
63 |
--------------------------------------------------------------------------------
/build/build.js:
--------------------------------------------------------------------------------
1 | 'use strict'
2 | require('./check-versions')()
3 |
4 | process.env.NODE_ENV = 'production'
5 |
6 | const ora = require('ora')
7 | const rm = require('rimraf')
8 | const path = require('path')
9 | const chalk = require('chalk')
10 | const webpack = require('webpack')
11 | const config = require('../config')
12 | const webpackConfig = require('./webpack.prod.conf')
13 |
14 | const spinner = ora('building for production...')
15 | spinner.start()
16 |
17 | rm(path.join(config.build.assetsRoot, config.build.assetsSubDirectory), err => {
18 | if (err) throw err
19 | webpack(webpackConfig, (err, stats) => {
20 | spinner.stop()
21 | if (err) throw err
22 | process.stdout.write(stats.toString({
23 | colors: true,
24 | modules: false,
25 | children: false, // If you are using ts-loader, setting this to true will make TypeScript errors show up during build.
26 | chunks: false,
27 | chunkModules: false
28 | }) + '\n\n')
29 |
30 | if (stats.hasErrors()) {
31 | console.log(chalk.red(' Build failed with errors.\n'))
32 | process.exit(1)
33 | }
34 |
35 | console.log(chalk.cyan(' Build complete.\n'))
36 | console.log(chalk.yellow(
37 | ' Tip: built files are meant to be served over an HTTP server.\n' +
38 | ' Opening index.html over file:// won\'t work.\n'
39 | ))
40 | })
41 | })
42 |
--------------------------------------------------------------------------------
/build/check-versions.js:
--------------------------------------------------------------------------------
1 | 'use strict'
2 | const chalk = require('chalk')
3 | const semver = require('semver')
4 | const packageConfig = require('../package.json')
5 | const shell = require('shelljs')
6 |
7 | function exec (cmd) {
8 | return require('child_process').execSync(cmd).toString().trim()
9 | }
10 |
11 | const versionRequirements = [
12 | {
13 | name: 'node',
14 | currentVersion: semver.clean(process.version),
15 | versionRequirement: packageConfig.engines.node
16 | }
17 | ]
18 |
19 | if (shell.which('npm')) {
20 | versionRequirements.push({
21 | name: 'npm',
22 | currentVersion: exec('npm --version'),
23 | versionRequirement: packageConfig.engines.npm
24 | })
25 | }
26 |
27 | module.exports = function () {
28 | const warnings = []
29 |
30 | for (let i = 0; i < versionRequirements.length; i++) {
31 | const mod = versionRequirements[i]
32 |
33 | if (!semver.satisfies(mod.currentVersion, mod.versionRequirement)) {
34 | warnings.push(mod.name + ': ' +
35 | chalk.red(mod.currentVersion) + ' should be ' +
36 | chalk.green(mod.versionRequirement)
37 | )
38 | }
39 | }
40 |
41 | if (warnings.length) {
42 | console.log('')
43 | console.log(chalk.yellow('To use this template, you must update following to modules:'))
44 | console.log()
45 |
46 | for (let i = 0; i < warnings.length; i++) {
47 | const warning = warnings[i]
48 | console.log(' ' + warning)
49 | }
50 |
51 | console.log()
52 | process.exit(1)
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/build/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/galan99/vue-mintUI-demo/4c6b247bbc04cdcaca2462e9adc74b0c72a324f4/build/logo.png
--------------------------------------------------------------------------------
/build/utils.js:
--------------------------------------------------------------------------------
1 | 'use strict'
2 | const path = require('path')
3 | const config = require('../config')
4 | const ExtractTextPlugin = require('extract-text-webpack-plugin')
5 | const packageConfig = require('../package.json')
6 |
7 | exports.assetsPath = function (_path) {
8 | const assetsSubDirectory = process.env.NODE_ENV === 'production'
9 | ? config.build.assetsSubDirectory
10 | : config.dev.assetsSubDirectory
11 |
12 | return path.posix.join(assetsSubDirectory, _path)
13 | }
14 |
15 | exports.cssLoaders = function (options) {
16 | options = options || {}
17 |
18 | const cssLoader = {
19 | loader: 'css-loader',
20 | options: {
21 | sourceMap: options.sourceMap
22 | }
23 | }
24 |
25 | const postcssLoader = {
26 | loader: 'postcss-loader',
27 | options: {
28 | sourceMap: options.sourceMap
29 | }
30 | }
31 |
32 | // generate loader string to be used with extract text plugin
33 | function generateLoaders (loader, loaderOptions) {
34 | const loaders = options.usePostCSS ? [cssLoader, postcssLoader] : [cssLoader]
35 |
36 | if (loader) {
37 | loaders.push({
38 | loader: loader + '-loader',
39 | options: Object.assign({}, loaderOptions, {
40 | sourceMap: options.sourceMap
41 | })
42 | })
43 | }
44 |
45 | // Extract CSS when that option is specified
46 | // (which is the case during production build)
47 | if (options.extract) {
48 | return ExtractTextPlugin.extract({
49 | use: loaders,
50 | fallback: 'vue-style-loader'
51 | })
52 | } else {
53 | return ['vue-style-loader'].concat(loaders)
54 | }
55 | }
56 |
57 | // https://vue-loader.vuejs.org/en/configurations/extract-css.html
58 | return {
59 | css: generateLoaders(),
60 | postcss: generateLoaders(),
61 | less: generateLoaders('less'),
62 | sass: generateLoaders('sass', { indentedSyntax: true }),
63 | scss: generateLoaders('sass'),
64 | stylus: generateLoaders('stylus'),
65 | styl: generateLoaders('stylus')
66 | }
67 | }
68 |
69 | // Generate loaders for standalone style files (outside of .vue)
70 | exports.styleLoaders = function (options) {
71 | const output = []
72 | const loaders = exports.cssLoaders(options)
73 |
74 | for (const extension in loaders) {
75 | const loader = loaders[extension]
76 | output.push({
77 | test: new RegExp('\\.' + extension + '$'),
78 | use: loader
79 | })
80 | }
81 |
82 | return output
83 | }
84 |
85 | exports.createNotifierCallback = () => {
86 | const notifier = require('node-notifier')
87 |
88 | return (severity, errors) => {
89 | if (severity !== 'error') return
90 |
91 | const error = errors[0]
92 | const filename = error.file && error.file.split('!').pop()
93 |
94 | notifier.notify({
95 | title: packageConfig.name,
96 | message: severity + ': ' + error.name,
97 | subtitle: filename || '',
98 | icon: path.join(__dirname, 'logo.png')
99 | })
100 | }
101 | }
102 |
--------------------------------------------------------------------------------
/build/vue-loader.conf.js:
--------------------------------------------------------------------------------
1 | 'use strict'
2 | const utils = require('./utils')
3 | const config = require('../config')
4 | const isProduction = process.env.NODE_ENV === 'production'
5 | const sourceMapEnabled = isProduction
6 | ? config.build.productionSourceMap
7 | : config.dev.cssSourceMap
8 |
9 | module.exports = {
10 | loaders: utils.cssLoaders({
11 | sourceMap: sourceMapEnabled,
12 | extract: isProduction
13 | }),
14 | cssSourceMap: sourceMapEnabled,
15 | cacheBusting: config.dev.cacheBusting,
16 | transformToRequire: {
17 | video: ['src', 'poster'],
18 | source: 'src',
19 | img: 'src',
20 | image: 'xlink:href'
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/build/webpack.base.conf.js:
--------------------------------------------------------------------------------
1 | 'use strict'
2 | const path = require('path')
3 | const utils = require('./utils')
4 | const config = require('../config')
5 | const vueLoaderConfig = require('./vue-loader.conf')
6 |
7 |
8 | function resolve (dir) {
9 | return path.join(__dirname, '..', dir)
10 | }
11 |
12 |
13 | module.exports = {
14 | context: path.resolve(__dirname, '../'),
15 | entry: {
16 | app: './src/main.js'
17 | },
18 | output: {
19 | path: config.build.assetsRoot,
20 | filename: '[name].js',
21 | publicPath: process.env.NODE_ENV === 'production'
22 | ? config.build.assetsPublicPath
23 | : config.dev.assetsPublicPath
24 | },
25 | resolve: {
26 | extensions: ['.js', '.vue', '.json','.less'],
27 | modules: [
28 | resolve('src'),
29 | resolve('node_modules')
30 | ],
31 | alias: {
32 | 'vue$': 'vue/dist/vue.common.js',
33 | 'src': resolve('src'),
34 | 'assets': resolve('src/assets'),
35 | 'components': resolve('src/components')
36 | }
37 | },
38 | module: {
39 | loaders: [
40 | {
41 | test: /\.js$/,
42 | exclude: /(node_modules|bower_components)/,
43 | loader: 'babel',
44 | query: {
45 | presets: ['es2015']
46 | }
47 | }
48 | ],
49 | rules: [
50 | {
51 | test: /\.vue$/,
52 | loader: 'vue-loader',
53 | options: vueLoaderConfig
54 | },
55 | {
56 | test: /\.js$/,
57 | loader: 'babel-loader',
58 | include: [resolve('src'), resolve('test'), resolve('node_modules/webpack-dev-server/client')]
59 | },
60 | {
61 | test: /\.(png|jpe?g|gif|svg)(\?.*)?$/,
62 | loader: 'url-loader',
63 | options: {
64 | limit: 10000,
65 | name: utils.assetsPath('img/[name].[ext]')
66 | }
67 | },
68 | {
69 | test: /\.(mp4|webm|ogg|mp3|wav|flac|aac)(\?.*)?$/,
70 | loader: 'url-loader',
71 | options: {
72 | limit: 10000,
73 | name: utils.assetsPath('media/[name].[ext]')
74 | }
75 | },
76 | {
77 | test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/,
78 | loader: 'url-loader',
79 | options: {
80 | limit: 10000,
81 | name: utils.assetsPath('fonts/[name].[ext]')
82 | }
83 | }
84 | ]
85 | },
86 | node: {
87 | // prevent webpack from injecting useless setImmediate polyfill because Vue
88 | // source contains it (although only uses it if it's native).
89 | setImmediate: false,
90 | // prevent webpack from injecting mocks to Node native modules
91 | // that does not make sense for the client
92 | dgram: 'empty',
93 | fs: 'empty',
94 | net: 'empty',
95 | tls: 'empty',
96 | child_process: 'empty'
97 | },
98 | }
99 |
100 |
101 |
--------------------------------------------------------------------------------
/build/webpack.dev.conf.js:
--------------------------------------------------------------------------------
1 | 'use strict'
2 | const utils = require('./utils')
3 | const webpack = require('webpack')
4 | const config = require('../config')
5 | const merge = require('webpack-merge')
6 | const path = require('path')
7 | const baseWebpackConfig = require('./webpack.base.conf')
8 | const CopyWebpackPlugin = require('copy-webpack-plugin')
9 | const HtmlWebpackPlugin = require('html-webpack-plugin')
10 | const FriendlyErrorsPlugin = require('friendly-errors-webpack-plugin')
11 | const portfinder = require('portfinder')
12 |
13 | const HOST = process.env.HOST
14 | const PORT = process.env.PORT && Number(process.env.PORT)
15 |
16 | const devWebpackConfig = merge(baseWebpackConfig, {
17 | module: {
18 | rules: utils.styleLoaders({ sourceMap: config.dev.cssSourceMap, usePostCSS: true })
19 | },
20 | // cheap-module-eval-source-map is faster for development
21 | devtool: config.dev.devtool,
22 |
23 | // these devServer options should be customized in /config/index.js
24 | devServer: {
25 | clientLogLevel: 'warning',
26 | historyApiFallback: {
27 | rewrites: [
28 | { from: /.*/, to: path.join(config.dev.assetsPublicPath, 'index.html') },
29 | ],
30 | },
31 | hot: true,
32 | contentBase: false, // since we use CopyWebpackPlugin.
33 | compress: true,
34 | host: HOST || config.dev.host,
35 | port: PORT || config.dev.port,
36 | open: config.dev.autoOpenBrowser,
37 | overlay: config.dev.errorOverlay
38 | ? { warnings: false, errors: true }
39 | : false,
40 | publicPath: config.dev.assetsPublicPath,
41 | proxy: config.dev.proxyTable,
42 | quiet: true, // necessary for FriendlyErrorsPlugin
43 | watchOptions: {
44 | poll: config.dev.poll,
45 | }
46 | },
47 | plugins: [
48 | new webpack.DefinePlugin({
49 | 'process.env': require('../config/dev.env')
50 | }),
51 | new webpack.HotModuleReplacementPlugin(),
52 | new webpack.NamedModulesPlugin(), // HMR shows correct file names in console on update.
53 | new webpack.NoEmitOnErrorsPlugin(),
54 | // https://github.com/ampedandwired/html-webpack-plugin
55 | new HtmlWebpackPlugin({
56 | filename: 'index.html',
57 | template: 'index.html',
58 | inject: true
59 | }),
60 | // copy custom static assets
61 | new CopyWebpackPlugin([
62 | {
63 | from: path.resolve(__dirname, '../static'),
64 | to: config.dev.assetsSubDirectory,
65 | ignore: ['.*']
66 | }
67 | ])
68 | ]
69 | })
70 |
71 | module.exports = new Promise((resolve, reject) => {
72 | portfinder.basePort = process.env.PORT || config.dev.port
73 | portfinder.getPort((err, port) => {
74 | if (err) {
75 | reject(err)
76 | } else {
77 | // publish the new Port, necessary for e2e tests
78 | process.env.PORT = port
79 | // add port to devServer config
80 | devWebpackConfig.devServer.port = port
81 |
82 | // Add FriendlyErrorsPlugin
83 | devWebpackConfig.plugins.push(new FriendlyErrorsPlugin({
84 | compilationSuccessInfo: {
85 | messages: [`Your application is running here: http://${devWebpackConfig.devServer.host}:${port}`],
86 | },
87 | onErrors: config.dev.notifyOnErrors
88 | ? utils.createNotifierCallback()
89 | : undefined
90 | }))
91 |
92 | resolve(devWebpackConfig)
93 | }
94 | })
95 | })
96 |
--------------------------------------------------------------------------------
/build/webpack.prod.conf.js:
--------------------------------------------------------------------------------
1 | 'use strict'
2 | const path = require('path')
3 | const utils = require('./utils')
4 | const webpack = require('webpack')
5 | const config = require('../config')
6 | const merge = require('webpack-merge')
7 | const baseWebpackConfig = require('./webpack.base.conf')
8 | const CopyWebpackPlugin = require('copy-webpack-plugin')
9 | const HtmlWebpackPlugin = require('html-webpack-plugin')
10 | const ExtractTextPlugin = require('extract-text-webpack-plugin')
11 | const OptimizeCSSPlugin = require('optimize-css-assets-webpack-plugin')
12 | const UglifyJsPlugin = require('uglifyjs-webpack-plugin')
13 |
14 | const env = require('../config/prod.env')
15 |
16 | const webpackConfig = merge(baseWebpackConfig, {
17 | module: {
18 | rules: utils.styleLoaders({
19 | sourceMap: config.build.productionSourceMap,
20 | extract: true,
21 | usePostCSS: true
22 | })
23 | },
24 | devtool: config.build.productionSourceMap ? config.build.devtool : false,
25 | output: {
26 | path: config.build.assetsRoot,
27 | filename: utils.assetsPath('js/[name].[chunkhash].js'),
28 | chunkFilename: utils.assetsPath('js/[id].[chunkhash].js')
29 | },
30 | plugins: [
31 | // http://vuejs.github.io/vue-loader/en/workflow/production.html
32 | new webpack.DefinePlugin({
33 | 'process.env': env
34 | }),
35 | new UglifyJsPlugin({
36 | uglifyOptions: {
37 | compress: {
38 | warnings: false
39 | }
40 | },
41 | sourceMap: config.build.productionSourceMap,
42 | parallel: true
43 | }),
44 | // extract css into its own file
45 | new ExtractTextPlugin({
46 | filename: utils.assetsPath('css/[name].[contenthash].css'),
47 | // Setting the following option to `false` will not extract CSS from codesplit chunks.
48 | // Their CSS will instead be inserted dynamically with style-loader when the codesplit chunk has been loaded by webpack.
49 | // It's currently set to `true` because we are seeing that sourcemaps are included in the codesplit bundle as well when it's `false`,
50 | // increasing file size: https://github.com/vuejs-templates/webpack/issues/1110
51 | allChunks: true,
52 | }),
53 | // Compress extracted CSS. We are using this plugin so that possible
54 | // duplicated CSS from different components can be deduped.
55 | new OptimizeCSSPlugin({
56 | cssProcessorOptions: config.build.productionSourceMap
57 | ? { safe: true, map: { inline: false } }
58 | : { safe: true }
59 | }),
60 | // generate dist index.html with correct asset hash for caching.
61 | // you can customize output by editing /index.html
62 | // see https://github.com/ampedandwired/html-webpack-plugin
63 | new HtmlWebpackPlugin({
64 | filename: config.build.index,
65 | template: 'index.html',
66 | inject: true,
67 | minify: {
68 | removeComments: true,
69 | collapseWhitespace: true,
70 | removeAttributeQuotes: true
71 | // more options:
72 | // https://github.com/kangax/html-minifier#options-quick-reference
73 | },
74 | // necessary to consistently work with multiple chunks via CommonsChunkPlugin
75 | chunksSortMode: 'dependency'
76 | }),
77 | // keep module.id stable when vendor modules does not change
78 | new webpack.HashedModuleIdsPlugin(),
79 | // enable scope hoisting
80 | new webpack.optimize.ModuleConcatenationPlugin(),
81 | // split vendor js into its own file
82 | new webpack.optimize.CommonsChunkPlugin({
83 | name: 'vendor',
84 | minChunks (module) {
85 | // any required modules inside node_modules are extracted to vendor
86 | return (
87 | module.resource &&
88 | /\.js$/.test(module.resource) &&
89 | module.resource.indexOf(
90 | path.join(__dirname, '../node_modules')
91 | ) === 0
92 | )
93 | }
94 | }),
95 | // extract webpack runtime and module manifest to its own file in order to
96 | // prevent vendor hash from being updated whenever app bundle is updated
97 | new webpack.optimize.CommonsChunkPlugin({
98 | name: 'manifest',
99 | minChunks: Infinity
100 | }),
101 | // This instance extracts shared chunks from code splitted chunks and bundles them
102 | // in a separate chunk, similar to the vendor chunk
103 | // see: https://webpack.js.org/plugins/commons-chunk-plugin/#extra-async-commons-chunk
104 | new webpack.optimize.CommonsChunkPlugin({
105 | name: 'app',
106 | async: 'vendor-async',
107 | children: true,
108 | minChunks: 3
109 | }),
110 |
111 | // copy custom static assets
112 | new CopyWebpackPlugin([
113 | {
114 | from: path.resolve(__dirname, '../static'),
115 | to: config.build.assetsSubDirectory,
116 | ignore: ['.*']
117 | }
118 | ])
119 | ]
120 | })
121 |
122 | if (config.build.productionGzip) {
123 | const CompressionWebpackPlugin = require('compression-webpack-plugin')
124 |
125 | webpackConfig.plugins.push(
126 | new CompressionWebpackPlugin({
127 | asset: '[path].gz[query]',
128 | algorithm: 'gzip',
129 | test: new RegExp(
130 | '\\.(' +
131 | config.build.productionGzipExtensions.join('|') +
132 | ')$'
133 | ),
134 | threshold: 10240,
135 | minRatio: 0.8
136 | })
137 | )
138 | }
139 |
140 | if (config.build.bundleAnalyzerReport) {
141 | const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin
142 | webpackConfig.plugins.push(new BundleAnalyzerPlugin())
143 | }
144 |
145 | module.exports = webpackConfig
146 |
--------------------------------------------------------------------------------
/config/dev.env.js:
--------------------------------------------------------------------------------
1 | 'use strict'
2 | const merge = require('webpack-merge')
3 | const prodEnv = require('./prod.env')
4 |
5 | module.exports = merge(prodEnv, {
6 | NODE_ENV: '"development"'
7 | })
8 |
--------------------------------------------------------------------------------
/config/index.js:
--------------------------------------------------------------------------------
1 | 'use strict'
2 | // Template version: 1.2.8
3 | // see http://vuejs-templates.github.io/webpack for documentation.
4 |
5 | const path = require('path')
6 |
7 | module.exports = {
8 | dev: {
9 |
10 | // Paths
11 | assetsSubDirectory: 'static',
12 | assetsPublicPath: '/',
13 | proxyTable: {
14 | '/config': {
15 | target: 'http://192.168.4.124:9900',
16 | changeOrigin: true,
17 | pathRewrite: {
18 | '^/config': '/config'
19 | }, /*headers: {
20 | 'Cookie': 'SID=810q3nmoi5mfp8geb9bkm9jql0;' //这里可以设置cookies, 也可以不设置
21 | }*/
22 | },
23 | },
24 |
25 | // Various Dev Server settings
26 | host: 'localhost', // can be overwritten by process.env.HOST
27 | port: 7777, // can be overwritten by process.env.PORT, if port is in use, a free one will be determined
28 | autoOpenBrowser: true,
29 | errorOverlay: true,
30 | notifyOnErrors: true,
31 | poll: false, // https://webpack.js.org/configuration/dev-server/#devserver-watchoptions-
32 |
33 |
34 | /**
35 | * Source Maps
36 | */
37 |
38 | // https://webpack.js.org/configuration/devtool/#development
39 | devtool: 'cheap-module-eval-source-map',
40 |
41 | // If you have problems debugging vue-files in devtools,
42 | // set this to false - it *may* help
43 | // https://vue-loader.vuejs.org/en/options.html#cachebusting
44 | cacheBusting: true,
45 |
46 | cssSourceMap: true,
47 | },
48 |
49 | build: {
50 | // Template for index.html
51 | index: path.resolve(__dirname, '../dist/index.html'),
52 |
53 | // Paths
54 | assetsRoot: path.resolve(__dirname, '../dist'),
55 | assetsSubDirectory: 'static',
56 | assetsPublicPath: './',
57 |
58 | /**
59 | * Source Maps
60 | */
61 |
62 | productionSourceMap: false,
63 | // https://webpack.js.org/configuration/devtool/#production
64 | devtool: '#source-map',
65 |
66 | // Gzip off by default as many popular static hosts such as
67 | // Surge or Netlify already gzip all static assets for you.
68 | // Before setting to `true`, make sure to:
69 | // npm install --save-dev compression-webpack-plugin
70 | productionGzip: false,
71 | productionGzipExtensions: ['js', 'css'],
72 |
73 | // Run the build command with an extra argument to
74 | // View the bundle analyzer report after build finishes:
75 | // `npm run build --report`
76 | // Set to `true` or `false` to always turn it on or off
77 | bundleAnalyzerReport: process.env.npm_config_report
78 | }
79 | }
80 |
--------------------------------------------------------------------------------
/config/prod.env.js:
--------------------------------------------------------------------------------
1 | 'use strict'
2 | module.exports = {
3 | NODE_ENV: '"production"'
4 | }
5 |
--------------------------------------------------------------------------------
/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 | 微信社区
10 |
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "shequ",
3 | "version": "1.0.0",
4 | "description": "A Vue.js project",
5 | "author": "galan.wang <619531862@qq.com>",
6 | "private": true,
7 | "scripts": {
8 | "dev": "webpack-dev-server --inline --progress --config build/webpack.dev.conf.js",
9 | "start": "npm run dev",
10 | "build": "node build/build.js"
11 | },
12 | "dependencies": {
13 | "axios": "^0.17.1",
14 | "less": "^2.7.3",
15 | "less-loader": "^4.0.5",
16 | "mint-ui": "^2.2.13",
17 | "mockjs": "^1.0.1-beta3",
18 | "vue": "^2.5.2",
19 | "vue-router": "^3.0.1"
20 | },
21 | "devDependencies": {
22 | "autoprefixer": "^7.1.2",
23 | "babel-core": "^6.22.1",
24 | "babel-helper-vue-jsx-merge-props": "^2.0.3",
25 | "babel-loader": "^7.1.1",
26 | "babel-plugin-component": "^1.0.0",
27 | "babel-plugin-syntax-jsx": "^6.18.0",
28 | "babel-plugin-transform-runtime": "^6.22.0",
29 | "babel-plugin-transform-vue-jsx": "^3.5.0",
30 | "babel-preset-env": "^1.3.2",
31 | "babel-preset-es2015": "^6.24.1",
32 | "babel-preset-stage-2": "^6.22.0",
33 | "chalk": "^2.0.1",
34 | "copy-webpack-plugin": "^4.0.1",
35 | "css-loader": "^0.28.0",
36 | "extract-text-webpack-plugin": "^3.0.0",
37 | "file-loader": "^1.1.4",
38 | "friendly-errors-webpack-plugin": "^1.6.1",
39 | "html-webpack-plugin": "^2.30.1",
40 | "node-notifier": "^5.1.2",
41 | "optimize-css-assets-webpack-plugin": "^3.2.0",
42 | "ora": "^1.2.0",
43 | "portfinder": "^1.0.13",
44 | "postcss-import": "^11.0.0",
45 | "postcss-loader": "^2.0.8",
46 | "postcss-url": "^7.2.1",
47 | "rimraf": "^2.6.0",
48 | "semver": "^5.3.0",
49 | "shelljs": "^0.7.6",
50 | "uglifyjs-webpack-plugin": "^1.1.1",
51 | "url-loader": "^0.5.8",
52 | "vue-loader": "^13.3.0",
53 | "vue-style-loader": "^3.0.1",
54 | "vue-template-compiler": "^2.5.2",
55 | "webpack": "^3.6.0",
56 | "webpack-bundle-analyzer": "^2.9.0",
57 | "webpack-dev-server": "^2.9.1",
58 | "webpack-merge": "^4.1.0"
59 | },
60 | "engines": {
61 | "node": ">= 6.0.0",
62 | "npm": ">= 3.0.0"
63 | },
64 | "browserslist": [
65 | "> 1%",
66 | "last 2 versions",
67 | "not ie <= 8"
68 | ]
69 | }
70 |
--------------------------------------------------------------------------------
/src/App.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
12 |
37 |
--------------------------------------------------------------------------------
/src/assets/css/main.less:
--------------------------------------------------------------------------------
1 | body,div,span,h1,h2,h3,h4,h5,h6,p,a,code,em,img,q,small,blockquote,strong,dd,dl,dt,li,ol,ul,form,label,table,tbody,tr,th,td,input{margin:0;padding:0;border:0}
2 | body{font-size:.28rem;max-width:1080px;margin:0 auto;background:#f6f6f6;font-family:'STHeiti','Microsoft YaHei',Helvetica,Arial,sans-serif;-webkit-tap-highlight-color:rgba(0,0,0,0)}
3 | h1,h3,h4,h5,h6,h2{font-weight: normal;}
4 | em,b,s{font-style: normal;}
5 | a,a:active,a:hover,a:focus,a:visited{text-decoration:none}
6 | a,img{-webkit-touch-callout:none}
7 | li{list-style:none}
8 | textarea,input[type="password"],input[type="text"]{resize:none;outline:0;-webkit-appearance:none;white-space:pre-wrap;word-wrap:break-word;background:#fff}
9 | .clearfix:after{display:block;clear:both;content:"";visibility:hidden;height:0}
10 | html{-webkit-text-size-adjust: 100%;}
11 | body{width:7.5rem}
12 | input {
13 | -webkit-appearance: none;
14 | -webkit-tap-highlight-color: transparent;
15 | }
16 | img {
17 | max-width: 100%;
18 | border:none;
19 | vertical-align:middle;
20 | }
21 | /*box*/
22 | .dbox{
23 | display: -webkit-box;
24 | display: box;
25 | display: -webkit-flex;
26 | display: flex;
27 | }
28 | .box-justify {
29 | display: -webkit-box;
30 | display: box;
31 | display: -webkit-flex;
32 | display: flex;
33 | -webkit-box-pack: justify;
34 | box-pack: justify;
35 | -webkit-justify-content: space-between;
36 | justify-content: space-between;
37 | }
38 | .box-center {
39 | display: -webkit-box;
40 | display: box;
41 | display: -webkit-flex;
42 | display: flex;
43 | -webkit-box-pack: center;
44 | box-pack: center;
45 | -webkit-justify-content: center;
46 | justify-content: center;
47 | }
48 | .flex {
49 | -webkit-box-flex: 1;
50 | box-flex: 1;
51 | -webkit-flex: 1;
52 | flex: 1;
53 | }
54 | .elli{
55 | text-overflow: ellipsis;
56 | white-space: nowrap;
57 | overflow: hidden;
58 | }
59 |
60 | /*load*/
61 | .zz{
62 | position: absolute;
63 | left: 0;
64 | top: 0;
65 | right: 0;
66 | bottom: 0;
67 | background: rgba(0,0,0,.5);
68 | z-index: 9999;
69 | }
70 | .zz>p{
71 | position: absolute;
72 | left: 0;
73 | top: 35%;
74 | width: 100%;
75 | text-align: center;
76 | color: #fff;
77 | }
78 |
79 | .loading{
80 | width: 30px;
81 | height: 30px;
82 | border: 1px #fff solid;
83 | border-radius: 50%;
84 | -webkit-animation: rotation 1s ease-in-out infinite;
85 | -moz-animation: rotation 1s ease-in-out infinite;
86 | animation: rotation 1s ease-in-out infinite;
87 | margin: 130px auto;
88 | }
89 | .loading:after{
90 | width: 5px;
91 | height: 5px;
92 | background-color: rgba(255,255,255,1);
93 | border-radius: 100%;
94 | position: absolute;
95 | content: "";
96 | }
97 | @-webkit-keyframes rotation{
98 | 0%{-webkit-transform: rotate(0deg);}
99 | 100%{-webkit-transform: rotate(360deg);}
100 | }
101 | @keyframes rotation{
102 | 0%{transform: rotate(0deg);}
103 | 100%{transform: rotate(360deg);}
104 | }
105 |
106 | /*提示语*/
107 | .cmTips{
108 | position:fixed;
109 | left:0;
110 | right:0;
111 | top:10px;
112 | z-index:99;
113 | padding:20px 20px 5px;
114 | text-align:center;
115 | z-index:99999;
116 | color:#fff;
117 | overflow:hidden;
118 | display:-webkit-box;
119 | display:box;
120 | -webkit-transform:translateY(-100%);
121 | transform:translateY(-100%);
122 | -webkit-transition-delay:1s;
123 | transition-delay: 1s;
124 | -webkit-transition-duration:.5s;
125 | transition-duration:.5s;
126 | -webkit-transition-duration:500ms;
127 | transition-duration:500ms;
128 | }
129 | .cmTips p{
130 | min-width:150px;
131 | padding:5px 20px;
132 | margin:0 auto;
133 | border-radius:5px;
134 | box-shadow:0 1px 2px rgba(0,0,0,.8);
135 | background:rgba(0,0,0,.8);
136 | font-size:14px;
137 | line-height:30px;
138 | }
139 | .cmTips{-webkit-animation:tips .5s linear both,tipsHide .5s 3s linear forwards;/*animation:tips .5s linear both,tipsHide .5s 3s linear forwards;*/}
140 | @-webkit-keyframes tips{from {-webkit-transform:translateY(-100%);opacity:0}to { -webkit-transform:translateY(0%);opacity:1;}}
141 | @keyframes tips{from{-webkit-transform:translateY(-100%);opacity:0}to{ -webkit-transform:translateY(0%);opacity:1;}}
142 | @-webkit-keyframes tipsHide{from{-webkit-transform:translateY(0%);opacity:1}to{-webkit-transform:translateY(-100%);opacity:0;}}
143 | @keyframes tipsHide{from{-webkit-transform:translateY(0%);opacity:1}to{-webkit-transform:translateY(-100%);opacity:0;}}
144 |
145 | .page-infinite-loading,.nomore{
146 | text-align: center;
147 | height: 50px;
148 | line-height: 50px;
149 | color:#666;
150 | }
151 | .page-infinite-loading .mint-spinner-fading-circle{
152 | display: inline-block;
153 | vertical-align: middle;
154 | margin-right: 8px;
155 | }
156 | body,html{
157 | -webkit-overflow-scrolling: touch;
158 | }
159 | .mint-toast{
160 | min-width: 3rem;
161 | }
--------------------------------------------------------------------------------
/src/assets/img/delete.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/galan99/vue-mintUI-demo/4c6b247bbc04cdcaca2462e9adc74b0c72a324f4/src/assets/img/delete.png
--------------------------------------------------------------------------------
/src/assets/img/det-file.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/galan99/vue-mintUI-demo/4c6b247bbc04cdcaca2462e9adc74b0c72a324f4/src/assets/img/det-file.png
--------------------------------------------------------------------------------
/src/assets/img/det-write.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/galan99/vue-mintUI-demo/4c6b247bbc04cdcaca2462e9adc74b0c72a324f4/src/assets/img/det-write.png
--------------------------------------------------------------------------------
/src/assets/img/dis-1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/galan99/vue-mintUI-demo/4c6b247bbc04cdcaca2462e9adc74b0c72a324f4/src/assets/img/dis-1.png
--------------------------------------------------------------------------------
/src/assets/img/dis-2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/galan99/vue-mintUI-demo/4c6b247bbc04cdcaca2462e9adc74b0c72a324f4/src/assets/img/dis-2.png
--------------------------------------------------------------------------------
/src/assets/img/dis-22.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/galan99/vue-mintUI-demo/4c6b247bbc04cdcaca2462e9adc74b0c72a324f4/src/assets/img/dis-22.png
--------------------------------------------------------------------------------
/src/assets/img/editor.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/galan99/vue-mintUI-demo/4c6b247bbc04cdcaca2462e9adc74b0c72a324f4/src/assets/img/editor.png
--------------------------------------------------------------------------------
/src/assets/img/foot1-1020.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/galan99/vue-mintUI-demo/4c6b247bbc04cdcaca2462e9adc74b0c72a324f4/src/assets/img/foot1-1020.png
--------------------------------------------------------------------------------
/src/assets/img/foot2-1020.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/galan99/vue-mintUI-demo/4c6b247bbc04cdcaca2462e9adc74b0c72a324f4/src/assets/img/foot2-1020.png
--------------------------------------------------------------------------------
/src/assets/img/foot3-1020.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/galan99/vue-mintUI-demo/4c6b247bbc04cdcaca2462e9adc74b0c72a324f4/src/assets/img/foot3-1020.png
--------------------------------------------------------------------------------
/src/assets/img/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/galan99/vue-mintUI-demo/4c6b247bbc04cdcaca2462e9adc74b0c72a324f4/src/assets/img/icon.png
--------------------------------------------------------------------------------
/src/assets/img/icon_login_code.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/galan99/vue-mintUI-demo/4c6b247bbc04cdcaca2462e9adc74b0c72a324f4/src/assets/img/icon_login_code.png
--------------------------------------------------------------------------------
/src/assets/img/icon_login_password.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/galan99/vue-mintUI-demo/4c6b247bbc04cdcaca2462e9adc74b0c72a324f4/src/assets/img/icon_login_password.png
--------------------------------------------------------------------------------
/src/assets/img/icon_login_password_again.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/galan99/vue-mintUI-demo/4c6b247bbc04cdcaca2462e9adc74b0c72a324f4/src/assets/img/icon_login_password_again.png
--------------------------------------------------------------------------------
/src/assets/img/icon_login_user.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/galan99/vue-mintUI-demo/4c6b247bbc04cdcaca2462e9adc74b0c72a324f4/src/assets/img/icon_login_user.png
--------------------------------------------------------------------------------
/src/assets/img/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/galan99/vue-mintUI-demo/4c6b247bbc04cdcaca2462e9adc74b0c72a324f4/src/assets/img/logo.png
--------------------------------------------------------------------------------
/src/assets/img/per-bg.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/galan99/vue-mintUI-demo/4c6b247bbc04cdcaca2462e9adc74b0c72a324f4/src/assets/img/per-bg.jpg
--------------------------------------------------------------------------------
/src/assets/img/per-in.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/galan99/vue-mintUI-demo/4c6b247bbc04cdcaca2462e9adc74b0c72a324f4/src/assets/img/per-in.png
--------------------------------------------------------------------------------
/src/assets/img/top_bg.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/galan99/vue-mintUI-demo/4c6b247bbc04cdcaca2462e9adc74b0c72a324f4/src/assets/img/top_bg.jpg
--------------------------------------------------------------------------------
/src/assets/img/up.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/galan99/vue-mintUI-demo/4c6b247bbc04cdcaca2462e9adc74b0c72a324f4/src/assets/img/up.png
--------------------------------------------------------------------------------
/src/components/api.js:
--------------------------------------------------------------------------------
1 | /*
2 | *author:anlen.wang
3 | *day:2018-01-05
4 | */
5 | import Vue from 'vue';
6 | import Qs from 'qs';
7 | import axios from 'axios';
8 | import router from '../router'
9 |
10 |
11 | //开始请求
12 | axios.interceptors.request.use(function (config) {
13 | return config;
14 | }, function (error) {
15 | return Promise.reject(error);
16 | });
17 |
18 | //请求完成
19 | axios.interceptors.response.use(function (response) {
20 | if(response.data.code == -555){
21 | //未登录
22 | router.replace({
23 | path: 'login',
24 | query: {path: router.currentRoute.fullPath.slice(1)}
25 | })
26 | }
27 | if(response.data.code==0){
28 | //console.log('请求完成')
29 | }
30 | return response;
31 | }, function (error) {
32 | return Promise.reject(error);
33 | });
34 |
35 |
36 | export const Ajax= (...rest) => {
37 |
38 | function checkStatus(response) {
39 | if(response.data.code!=0 && response.data.msg){
40 | console.log(response.data.msg);
41 | }
42 | return response.data
43 | }
44 |
45 | function checkCode(res) {
46 | alert('请求出错,请稍后再试!');
47 | return res
48 | }
49 |
50 | let data=rest[2];
51 | let headers={'X-Requested-With': 'XMLHttpRequest'};
52 | let json={};
53 |
54 | if(rest[0].toLowerCase()!='get'){
55 | data= rest.length == 3 ? Qs.stringify(data) : data;
56 | headers= {
57 | 'X-Requested-With': 'XMLHttpRequest',
58 | 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'
59 | };
60 | json.data=data;
61 | }else{
62 | //data.t=new Date().getTime(); //去除get缓存
63 | json.params=data;
64 | }
65 |
66 |
67 | json.method=rest[0]; // 请求方式
68 | json.url=rest[1]; // 请求的地址
69 | json.timeout= 80000; // 超时时间, 单位毫秒
70 | json.headers=headers;
71 |
72 | return axios(json).then(checkStatus).catch(checkCode);
73 |
74 | }
75 |
76 | /*
77 | ajax使用
78 | async comeIn(){
79 | let postData = {
80 | page: this.curPage,
81 | pageSize: this.pageSize,
82 | sort: this.sort,
83 | };
84 | const data=await Ajax('get',`${this.$url}wpk/popups/list`,postData);
85 | if(data.code==0){
86 |
87 | }
88 | }
89 | */
--------------------------------------------------------------------------------
/src/components/load/index.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Created by anlen.wang on 2018/1/4.
3 | */
4 | import MyLoad from './load.vue'
5 | const Loading = {
6 | install: function(Vue){
7 | Vue.component('Loading',MyLoad)
8 | }
9 | }
10 |
11 | // 导出组件
12 | export default Loading
13 |
--------------------------------------------------------------------------------
/src/components/load/load.vue:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
7 |
13 |
14 |
17 |
--------------------------------------------------------------------------------
/src/components/tip/index.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Created by anlen.wang on 2018/1/4.
3 | */
4 | import MyTip from './tip.vue'
5 | const Tip = {
6 | install: function(Vue){
7 | Vue.component('Tip',MyTip)
8 | }
9 | }
10 |
11 | // 导出组件
12 | export default Tip
13 |
--------------------------------------------------------------------------------
/src/components/tip/tip.vue:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
7 |
34 |
--------------------------------------------------------------------------------
/src/main.js:
--------------------------------------------------------------------------------
1 | import Vue from 'vue'
2 | import App from './App'
3 | import router from './router'
4 | //import 'mint-ui/lib/style.css';
5 |
6 | //按需加载mint-ui组件
7 | import { Toast,Indicator,Spinner,InfiniteScroll } from 'mint-ui';
8 | window.Toast= Toast;
9 | window.Indicator= Indicator;
10 | Vue.component(Spinner.name, Spinner);
11 | Vue.use(InfiniteScroll);
12 |
13 | import {Ajax} from './components/api'
14 | Vue.prototype.$ajax = Ajax;
15 |
16 | //添加mockjs拦截请求,模拟返回服务器数据
17 | if(process.env.NODE_ENV === 'development') {
18 | require('./mock/index.js');
19 | }
20 |
21 | Vue.config.productionTip = false
22 |
23 |
24 | /* 同级组件通信通道Bus ,将Bus注册为全局事件 */
25 | const EventBus = new Vue();
26 | Object.defineProperties(Vue.prototype, {
27 | $bus: {
28 | get: function () {
29 | return EventBus
30 | }
31 | }
32 | });
33 |
34 | /* 配置请求域名 */
35 | let $url = '';
36 | let $http = document.location.protocol + "//";
37 | let $host = window.location.host;
38 | if (location.href.indexOf('//localhost') != -1) {
39 | //本地接口地址
40 | $url = '';
41 | } else if (location.href.indexOf('//192.168') != -1) {
42 | //测试接口地址
43 | $url = $http + $host + "/";
44 | } else {
45 | // 线上接口地址
46 | $url = $http + $host + "/";
47 | }
48 | Vue.prototype.$url = $url;
49 |
50 | /* eslint-disable no-new */
51 | new Vue({
52 | created(){
53 | var devieWidth= Math.min(640,document.documentElement.clientWidth,document.documentElement.clientHeight);
54 | var fonSize= devieWidth > 1080 ? 144 : devieWidth / 6.4;
55 | document.documentElement.style.fontSize=fonSize+'px';
56 | },
57 | el: '#app',
58 | router,
59 | template: '',
60 | components: { App }
61 | })
62 |
--------------------------------------------------------------------------------
/src/mock/game.js:
--------------------------------------------------------------------------------
1 | export const gameList = [
2 | {
3 | path: '/sdk-game-data/player-data/index',
4 | data: {
5 | "code": 0,
6 | "msg": "操作成功",
7 | "data": {
8 | "count": 373,
9 | "curPage": 1,
10 | "totalPage": 25,
11 | "pageSize": 15,
12 | "items|2-10": [
13 | {
14 | "id":1,
15 | "player_id":"1",
16 | "fid":229,
17 | "game_id":2,
18 | "created":'@datetime',
19 | "updated":'@datetime',
20 | "field_data|15":[
21 | {
22 | "field_name":"field1",
23 | "alias":"field1",
24 | "notes":"星星数",
25 | "icon":"http://192.168.4.124:930/wpk/0/image/b40/0c7/944/b4000c7a9446de87fdf2938aedaa6f02.jpg",
26 | "is_rank|0-1":0,
27 | "rank_num|1-100":20,
28 | "show_type|0-2":1,
29 | "value":"100"
30 | },
31 | ],
32 | "g_name":'游戏@cname',
33 | "f_name":'游戏@cname'
34 | }
35 | ],
36 | "config":{
37 | "fieldList":[
38 | "field_name1",
39 | "field_name2",
40 | "field_name3",
41 | "field_name4",
42 | ],
43 | "gidList":{
44 | "2":"地铁跑酷",
45 | "3":"乱斗之王",
46 | "4":"苍穹变",
47 | "5":"神庙逃亡2",
48 | "8":"南瓜先生大冒险",
49 | "9":"英雄永不灭",
50 | "10":"水果忍者",
51 | "12":"快乐点点消",
52 | },
53 | "fidList":{
54 | "0":"乐逗游戏",
55 | "229":"三剑豪",
56 | "250":"烈焰遮天",
57 | "299":"地铁跑酷",
58 | "302":"苍穹变",
59 | "307":"纪念碑谷",
60 | "308":"乱斗之王",
61 | },
62 | "is_rank":[
63 | {"id":"0","name":"否"},
64 | {"id":"1","name":"是"}
65 | ],
66 | "show_type":[
67 | {"id":"0","name":"不展示"},
68 | {"id":"1","name":"文字"},
69 | {"id":"2","name":"图片"}
70 | ],
71 | },
72 | "next": 1
73 | }
74 | }
75 | }
76 | ]
--------------------------------------------------------------------------------
/src/mock/index.js:
--------------------------------------------------------------------------------
1 | /*
2 | *author:anlen.wang
3 | *day:2018-01-08
4 |
5 | 使用方法
6 | let postData={'mobile':13512345123}
7 | this.$axios.post('/sdk-game-data/player-data/index',postData).then((data)=>{
8 | console.log(data)
9 | })
10 | */
11 | import Vue from 'vue';
12 | import qs from 'qs';
13 | import axios from 'axios';
14 | import Mock from 'mockjs';
15 | import {gameList} from './game.js';
16 |
17 | let data = [].concat(gameList);
18 |
19 | data.forEach(function(res){
20 | Mock.mock(res.path, res.data);
21 | });
22 |
23 |
24 | axios.defaults.timeout = 5000;
25 |
26 | //POST传参序列化
27 | axios.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded;charset=UTF-8';
28 | axios.interceptors.request.use((config) => {
29 | if(config.method === 'post'){
30 | config.data = qs.stringify(config.data);
31 | }
32 | return config;
33 | },(error) =>{
34 | alert("错误的传参");
35 | return Promise.reject(error);
36 | });
37 |
38 | Vue.prototype.$axios = axios;
39 |
40 |
41 | export default Vue;
42 |
--------------------------------------------------------------------------------
/src/router/index.js:
--------------------------------------------------------------------------------
1 | import Vue from 'vue'
2 | import Router from 'vue-router'
3 |
4 | Vue.use(Router)
5 |
6 | const router = new Router({
7 | /*mode: 'history',*/
8 | routes: [
9 | {
10 | path: "*",
11 | redirect: "/"
12 | },
13 | {
14 | path: '/',
15 | redirect: '/index'
16 | },
17 | {
18 | path: '/index',
19 | component: resolve => require(['../view/index.vue'], resolve) //首页
20 | },
21 | {
22 | path: '/detail',
23 | component: resolve => require(['../view/detail.vue'], resolve) //详情页
24 | },
25 | {
26 | path: '/new',
27 | component: resolve => require(['../view/newThread.vue'], resolve) //创建帖子
28 | },
29 | {
30 | path: '/login',
31 | component: resolve => require(['../view/login.vue'], resolve) //登录
32 | },
33 | {
34 | path: '/center',
35 | component: resolve => require(['../view/userCenter.vue'], resolve) //个人中心
36 | },
37 | {
38 | path: '/edit',
39 | component: resolve => require(['../view/edit.vue'], resolve) //编辑信息
40 | },
41 | {
42 | path: '/myRemind',
43 | component: resolve => require(['../view/myRemind.vue'], resolve) //提醒-我的回复
44 | },
45 | {
46 | path: '/systemMessage',
47 | component: resolve => require(['../view/systemMessage.vue'], resolve) //提醒-系统消息
48 | },
49 | {
50 | path: '/myWrite',
51 | component: resolve => require(['../view/myWrite.vue'], resolve) //我的讨论-发表
52 | },
53 | {
54 | path: '/myReply',
55 | component: resolve => require(['../view/myReply.vue'], resolve) //我的讨论-回复
56 | },
57 |
58 | ]
59 | })
60 |
61 | router.beforeEach((to, from, next) => {
62 | /*next({
63 | path: '/login',
64 | query: {redirect: to.fullPath} // 将跳转的路由path作为参数,登录成功后跳转到该路由
65 | })*/
66 | next();
67 | })
68 |
69 | export default router;
70 |
--------------------------------------------------------------------------------
/src/view/detail.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
三剑豪大大
12 |
楼主
13 |
版主
14 |
2017-12-26 17:49
15 |
16 |
17 |
18 |
关于《三剑豪》近期调整公告,请大侠们知晓
19 |
20 | 各位大侠:
21 |
22 | 由于服务器优化,原定于每周四《三剑豪》的更新暂时停止,同样每周一新服也暂停开放,等服务器优化好后我们再操作。活动本周四会在上周的基础上做一波累加活动,请大侠们留意,感谢支持!
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 | -
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 | guanguihong0614
39 |
40 |
7楼
41 |
42 |
43 |
44 |
45 |
46 | 引用: MM135869 发表于 2017-12-27 17:20
47 | 感觉像关服?
48 |
49 |
50 |
51 | 这是要倒闭的节奏!
52 |
53 |
2017-12-28 08:18
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 | 取消
75 | 发送
76 |
77 |
84 |
85 |
86 |
87 |
88 |
89 |
111 |
112 |
379 |
--------------------------------------------------------------------------------
/src/view/edit.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
40 |
41 |
42 |
51 |
52 |
53 |
54 |
55 |
修改{{editText}}
56 |
保存
57 |
58 |
59 |
60 |
61 |
64 |
65 |
66 |
67 |
68 | 年
69 |
70 |
71 |
73 | 月
74 |
75 |
76 |
78 | 日
79 |
80 |
81 |
82 |
83 |
84 |
85 |
88 |
89 |
90 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
153 |
154 |
155 |
356 |
--------------------------------------------------------------------------------
/src/view/index.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
8 |
9 |
10 |

11 |
12 |
三剑壕
13 |
14 | 帖子666今日61
15 |
16 |
17 |
18 |
19 | - 关于《三剑豪》近期调整公告,请大侠们知晓请大侠们知晓
20 | - 关于《三剑豪》近期调整公告,请大侠们知晓
21 | - 关于《三剑豪》近期调整公告,请大侠们知晓
22 |
23 |
24 |
25 |
51 |
52 | 加载中...
53 |
54 |
没有更多了哦
55 |
56 |
57 |
58 |
59 |
64 |
65 |
66 |
67 |
68 |
133 |
326 |
--------------------------------------------------------------------------------
/src/view/login.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
42 |
43 |
57 |
58 |
76 |
77 |
79 |
80 |
81 |
82 |
282 |
283 |
284 |
423 |
--------------------------------------------------------------------------------
/src/view/myRemind.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | 回复我的
6 | 系统消息
7 |
8 |
26 |
27 |
28 |
29 |
53 |
54 |
55 |
130 |
--------------------------------------------------------------------------------
/src/view/myReply.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
24 |
25 |
26 |
52 |
53 |
54 |
133 |
--------------------------------------------------------------------------------
/src/view/myWrite.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
27 |
28 |
29 |
54 |
55 |
56 |
131 |
--------------------------------------------------------------------------------
/src/view/newThread.vue:
--------------------------------------------------------------------------------
1 |
2 |
13 |
14 |
15 |
36 |
37 |
38 |
138 |
--------------------------------------------------------------------------------
/src/view/systemMessage.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | 回复我的
6 | 系统消息
7 |
8 |
26 |
27 |
28 |
29 |
54 |
55 |
56 |
131 |
--------------------------------------------------------------------------------
/src/view/userCenter.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |

7 |
8 |
9 |
别瞅我1
10 |
11 | 29岁
12 | 广东省 深圳市
13 |
14 |
编辑资料
15 |
16 |
17 |
18 |
19 | -
20 |
我的讨论0
21 |
22 |
23 | -
24 |
我的提醒
25 |
26 |
27 |
28 | -
29 |
退出
30 |
31 |
32 |
33 |
34 |
35 |
36 |
60 |
61 |
62 |
157 |
--------------------------------------------------------------------------------
/static/.gitkeep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/galan99/vue-mintUI-demo/4c6b247bbc04cdcaca2462e9adc74b0c72a324f4/static/.gitkeep
--------------------------------------------------------------------------------