├── .babelrc ├── .editorconfig ├── .gitignore ├── .postcssrc.js ├── README.md ├── README.md.orig ├── _config.yml ├── 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 └── test.env.js ├── css ├── dist ├── bmob-blog │ └── dist │ │ └── static │ │ ├── bmob-1.gif │ │ ├── bmob-2.gif │ │ ├── bmob.js │ │ ├── css │ │ ├── app.1ac339c621032d82f92d8ce9977475ea.css │ │ └── app.1ac339c621032d82f92d8ce9977475ea.css.map │ │ ├── fonts │ │ ├── fontawesome-webfont.674f50d.eot │ │ ├── fontawesome-webfont.b06871f.ttf │ │ └── fontawesome-webfont.fee66e7.woff │ │ ├── img │ │ ├── fontawesome-webfont.912ec66.svg │ │ ├── logo-bj.afa9c25.jpg │ │ └── logonameimg.51a331b.png │ │ └── js │ │ ├── app.dbaee0d96f921c5bd0d6.js │ │ ├── app.dbaee0d96f921c5bd0d6.js.map │ │ ├── manifest.51b9cb71825d4fd8d9ca.js │ │ ├── manifest.51b9cb71825d4fd8d9ca.js.map │ │ ├── vendor.dd7e473c296085da3e8d.js │ │ └── vendor.dd7e473c296085da3e8d.js.map ├── index.html ├── input.html └── static │ ├── bmob-1.gif │ ├── bmob-2.gif │ ├── bmob.js │ ├── css │ ├── app.64a88eb41ba6ef0cb293524d16eca6b0.css │ └── app.64a88eb41ba6ef0cb293524d16eca6b0.css.map │ ├── fonts │ ├── fontawesome-webfont.674f50d.eot │ ├── fontawesome-webfont.b06871f.ttf │ └── fontawesome-webfont.fee66e7.woff │ ├── img │ ├── fontawesome-webfont.912ec66.svg │ ├── logo-bj.afa9c25.jpg │ └── logonameimg.51a331b.png │ └── js │ ├── app.a19ff7f2dccde19e3abf.js │ ├── app.a19ff7f2dccde19e3abf.js.map │ ├── manifest.313d60003f4a66688a91.js │ ├── manifest.313d60003f4a66688a91.js.map │ ├── vendor.29bef1e8662570b0a55d.js │ └── vendor.29bef1e8662570b0a55d.js.map ├── index.html ├── master ├── package.json ├── src ├── App.vue ├── App.vue.orig ├── assets │ ├── 400077311.jpg │ ├── bmob.js │ ├── font-awesome.min.css │ ├── logo-bj.jpg │ ├── logo.png │ ├── logonameimg.png │ └── zd-col.scss ├── components │ ├── HelloWorld.vue │ ├── about.vue │ ├── api.js │ ├── content.vue │ ├── login.vue │ ├── message.vue │ ├── newsDetail.vue │ ├── newsModify.vue │ ├── pushNews.vue │ └── top.vue ├── main.js ├── router │ └── index.js ├── svg │ └── deyi.svg └── vuex │ └── store.js ├── static ├── .gitkeep ├── bmob-1.gif ├── bmob-2.gif └── bmob.js └── test ├── e2e ├── custom-assertions │ └── elementCount.js ├── nightwatch.conf.js ├── runner.js └── specs │ └── test.js └── unit ├── .eslintrc ├── jest.conf.js ├── setup.js └── specs └── HelloWorld.spec.js /.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": [ 3 | ["env", { 4 | "modules": false, 5 | "targets": { 6 | "browsers": ["> 1%", "last 2 versions", "not ie <= 8"] 7 | } 8 | }], 9 | "stage-2" 10 | ], 11 | "plugins": ["transform-vue-jsx", "transform-runtime"], 12 | "env": { 13 | "test": { 14 | "presets": ["env", "stage-2"], 15 | "plugins": ["transform-vue-jsx", "transform-es2015-modules-commonjs", "dynamic-import-node"] 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | charset = utf-8 5 | indent_style = space 6 | indent_size = 2 7 | end_of_line = lf 8 | insert_final_newline = true 9 | trim_trailing_whitespace = true 10 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | node_modules/ 3 | /dist/ 4 | npm-debug.log* 5 | yarn-debug.log* 6 | yarn-error.log* 7 | /test/unit/coverage/ 8 | /test/e2e/reports/ 9 | selenium-debug.log 10 | 11 | # Editor directories and files 12 | .idea 13 | .vscode 14 | *.suo 15 | *.ntvs* 16 | *.njsproj 17 | *.sln 18 | -------------------------------------------------------------------------------- /.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 | # Vue2.0 + Bmob 2 | 3 | > A Vue.js project 4 | 5 | ## Build Setup 6 | 7 | ``` bash 8 | ## install dependencies 9 | npm install 10 | 11 | ## serve with hot reload at localhost:8081 12 | npm run dev 13 | ``` 14 | 15 | 在线演示地址:[https://zongducha.github.io/bmob-blog/dist/index.html#/](https://zongducha.github.io/bmob-blog/dist/index.html#/) 16 | 17 | ``` 18 | ## Maybe you need these 19 | 20 | Sass 21 | 22 | NProgress 23 | 24 | Vuex 25 | 26 | Vue-Router 27 | 28 | ES6 29 | 30 | sass-resources-loader 31 | 32 | font-awesome 33 | 34 | font-awesome-animation 35 | 36 | wangEditor 37 | 38 | ``` 39 | 40 | ### 主要实现的功能 41 | 42 | [✔] 登录帐号 (真实登录) 43 | 44 | [✔] 注册帐号 45 | 46 | [✔] 自制 `通用桌面提示组件` 47 | 48 | [✔] 不需要登录进入首页 (随便看看) 49 | 50 | [✔] 首页文章显示 51 | 52 | [✔] 自制 `首页底部滚动 无限刷新数据` 53 | 54 | [✔] Tab 切换文章分类 55 | 56 | [✔] 登录后退出 57 | 58 | [✔] 响应式制作 59 | 60 | [✔] 点击文章查看内容 61 | 62 | [✔] 文章评论 (需要登录) 63 | 64 | [✔] 修改文章 65 | 66 | [✔] 编辑文章 67 | 68 | [✔] 查看个人信息 69 | 70 | [✔] 编辑个人信息 71 | 72 | [✔] 发表文章 73 | 74 | [✔] 有些人爱捣乱,部分加了权限 75 | 76 | 后续: 77 | 78 | [✖] 头像更换 79 | 80 | [✖] 文章点赞 81 | 82 | 83 | ## 数据真实保存 84 | 85 | ![首页访问登录](static//bmob-1.gif) 86 | ![文章](static//bmob-2.gif) 87 | (录的有点卡) 88 | 89 | 2018 - 1 - 21 90 | 91 | 92 | For a detailed explanation on how things work, check out the [guide](http://vuejs-templates.github.io/webpack/) and [docs for vue-loader](http://vuejs.github.io/vue-loader). 93 | -------------------------------------------------------------------------------- /README.md.orig: -------------------------------------------------------------------------------- 1 | <<<<<<< HEAD 2 | # bg 3 | ======= 4 | # Vue2.0 + Bmob 5 | >>>>>>> 45afdb234d20cf9fdb4f1e75d20891ef14759064 6 | 7 | > A Vue.js project 8 | 9 | ## Build Setup 10 | 11 | ``` bash 12 | # install dependencies 13 | npm install 14 | 15 | # serve with hot reload at localhost:8080 16 | npm run dev 17 | <<<<<<< HEAD 18 | 19 | # build for production with minification 20 | npm run build 21 | 22 | # build for production and view the bundle analyzer report 23 | npm run build --report 24 | 25 | # run unit tests 26 | npm run unit 27 | 28 | # run e2e tests 29 | npm run e2e 30 | 31 | # run all tests 32 | npm test 33 | ``` 34 | ======= 35 | ``` 36 | 37 | `Sass` 38 | 39 | `NProgress` 40 | 41 | `Vuex` 42 | 43 | `Router` 44 | 45 | `ES6` 46 | 47 | `sass-resources-loader` 48 | 49 | >>>>>>> 45afdb234d20cf9fdb4f1e75d20891ef14759064 50 | 51 | For a detailed explanation on how things work, check out the [guide](http://vuejs-templates.github.io/webpack/) and [docs for vue-loader](http://vuejs.github.io/vue-loader). 52 | -------------------------------------------------------------------------------- /_config.yml: -------------------------------------------------------------------------------- 1 | theme: jekyll-theme-cayman -------------------------------------------------------------------------------- /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/ZongDuCha/bmob-blog/48d120175ea058e165e9af04526f9c16f5ae0020/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').concat( 64 | { 65 | loader: 'sass-resources-loader', 66 | options: { 67 | resources: path.resolve(__dirname, '../src/assets/zd-col.scss') 68 | } 69 | } 70 | ), 71 | stylus: generateLoaders('stylus'), 72 | styl: generateLoaders('stylus') 73 | } 74 | } 75 | 76 | // Generate loaders for standalone style files (outside of .vue) 77 | exports.styleLoaders = function (options) { 78 | const output = [] 79 | const loaders = exports.cssLoaders(options) 80 | 81 | for (const extension in loaders) { 82 | const loader = loaders[extension] 83 | output.push({ 84 | test: new RegExp('\\.' + extension + '$'), 85 | use: loader 86 | }) 87 | } 88 | 89 | return output 90 | } 91 | 92 | exports.createNotifierCallback = () => { 93 | const notifier = require('node-notifier') 94 | 95 | return (severity, errors) => { 96 | if (severity !== 'error') return 97 | 98 | const error = errors[0] 99 | const filename = error.file && error.file.split('!').pop() 100 | 101 | notifier.notify({ 102 | title: packageConfig.name, 103 | message: severity + ': ' + error.name, 104 | subtitle: filename || '', 105 | icon: path.join(__dirname, 'logo.png') 106 | }) 107 | } 108 | } 109 | -------------------------------------------------------------------------------- /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 | function resolve (dir) { 8 | return path.join(__dirname, '..', dir) 9 | } 10 | 11 | 12 | 13 | module.exports = { 14 | context: path.resolve(__dirname, '../'), 15 | entry: { 16 | app: './src/main.js' 17 | }, 18 | output: { 19 | path: config.build.assetsRoot, 20 | filename: '[name].js', 21 | publicPath: process.env.NODE_ENV === 'production' 22 | ? config.build.assetsPublicPath 23 | : config.dev.assetsPublicPath 24 | }, 25 | resolve: { 26 | extensions: ['.js', '.vue', '.json'], 27 | alias: { 28 | 'vue$': 'vue/dist/vue.esm.js', 29 | '@': resolve('src'), 30 | } 31 | }, 32 | module: { 33 | rules: [ 34 | { 35 | test: /\.vue$/, 36 | loader: 'vue-loader', 37 | options: vueLoaderConfig 38 | }, 39 | { 40 | test: /\.js$/, 41 | loader: 'babel-loader', 42 | include: [resolve('src'), resolve('test'), resolve('node_modules/webpack-dev-server/client')] 43 | }, 44 | { 45 | test: /\.(png|jpe?g|gif|svg)(\?.*)?$/, 46 | loader: 'url-loader', 47 | options: { 48 | limit: 10000, 49 | name: utils.assetsPath('img/[name].[hash:7].[ext]') 50 | } 51 | }, 52 | { 53 | test: /\.scss$/, 54 | loaders: ['style','scss','css'] 55 | }, 56 | { 57 | test: /\.(mp4|webm|ogg|mp3|wav|flac|aac)(\?.*)?$/, 58 | loader: 'url-loader', 59 | options: { 60 | limit: 10000, 61 | name: utils.assetsPath('media/[name].[hash:7].[ext]') 62 | } 63 | }, 64 | { 65 | test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/, 66 | loader: 'url-loader', 67 | options: { 68 | limit: 80000, 69 | name: utils.assetsPath('fonts/[name].[hash:7].[ext]') 70 | } 71 | } 72 | ] 73 | }, 74 | node: { 75 | // prevent webpack from injecting useless setImmediate polyfill because Vue 76 | // source contains it (although only uses it if it's native). 77 | setImmediate: false, 78 | // prevent webpack from injecting mocks to Node native modules 79 | // that does not make sense for the client 80 | dgram: 'empty', 81 | fs: 'empty', 82 | net: 'empty', 83 | tls: 'empty', 84 | child_process: 'empty' 85 | } 86 | } 87 | -------------------------------------------------------------------------------- /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 = process.env.NODE_ENV === 'testing' 15 | ? require('../config/test.env') 16 | : require('../config/prod.env') 17 | 18 | const webpackConfig = merge(baseWebpackConfig, { 19 | module: { 20 | rules: utils.styleLoaders({ 21 | sourceMap: config.build.productionSourceMap, 22 | extract: true, 23 | usePostCSS: true 24 | }) 25 | }, 26 | devtool: config.build.productionSourceMap ? config.build.devtool : false, 27 | output: { 28 | path: config.build.assetsRoot, 29 | filename: utils.assetsPath('js/[name].[chunkhash].js'), 30 | chunkFilename: utils.assetsPath('js/[id].[chunkhash].js') 31 | }, 32 | plugins: [ 33 | // http://vuejs.github.io/vue-loader/en/workflow/production.html 34 | new webpack.DefinePlugin({ 35 | 'process.env': env 36 | }), 37 | new UglifyJsPlugin({ 38 | uglifyOptions: { 39 | compress: { 40 | warnings: false 41 | } 42 | }, 43 | sourceMap: config.build.productionSourceMap, 44 | parallel: true 45 | }), 46 | // extract css into its own file 47 | new ExtractTextPlugin({ 48 | filename: utils.assetsPath('css/[name].[contenthash].css'), 49 | // Setting the following option to `false` will not extract CSS from codesplit chunks. 50 | // Their CSS will instead be inserted dynamically with style-loader when the codesplit chunk has been loaded by webpack. 51 | // It's currently set to `true` because we are seeing that sourcemaps are included in the codesplit bundle as well when it's `false`, 52 | // increasing file size: https://github.com/vuejs-templates/webpack/issues/1110 53 | allChunks: true, 54 | }), 55 | // Compress extracted CSS. We are using this plugin so that possible 56 | // duplicated CSS from different components can be deduped. 57 | new OptimizeCSSPlugin({ 58 | cssProcessorOptions: config.build.productionSourceMap 59 | ? { safe: true, map: { inline: false } } 60 | : { safe: true } 61 | }), 62 | // generate dist index.html with correct asset hash for caching. 63 | // you can customize output by editing /index.html 64 | // see https://github.com/ampedandwired/html-webpack-plugin 65 | new HtmlWebpackPlugin({ 66 | filename: process.env.NODE_ENV === 'testing' 67 | ? 'index.html' 68 | : config.build.index, 69 | template: 'index.html', 70 | inject: true, 71 | minify: { 72 | removeComments: true, 73 | collapseWhitespace: true, 74 | removeAttributeQuotes: true 75 | // more options: 76 | // https://github.com/kangax/html-minifier#options-quick-reference 77 | }, 78 | // necessary to consistently work with multiple chunks via CommonsChunkPlugin 79 | chunksSortMode: 'dependency' 80 | }), 81 | // keep module.id stable when vendor modules does not change 82 | new webpack.HashedModuleIdsPlugin(), 83 | // enable scope hoisting 84 | new webpack.optimize.ModuleConcatenationPlugin(), 85 | // split vendor js into its own file 86 | new webpack.optimize.CommonsChunkPlugin({ 87 | name: 'vendor', 88 | minChunks (module) { 89 | // any required modules inside node_modules are extracted to vendor 90 | return ( 91 | module.resource && 92 | /\.js$/.test(module.resource) && 93 | module.resource.indexOf( 94 | path.join(__dirname, '../node_modules') 95 | ) === 0 96 | ) 97 | } 98 | }), 99 | // extract webpack runtime and module manifest to its own file in order to 100 | // prevent vendor hash from being updated whenever app bundle is updated 101 | new webpack.optimize.CommonsChunkPlugin({ 102 | name: 'manifest', 103 | minChunks: Infinity 104 | }), 105 | // This instance extracts shared chunks from code splitted chunks and bundles them 106 | // in a separate chunk, similar to the vendor chunk 107 | // see: https://webpack.js.org/plugins/commons-chunk-plugin/#extra-async-commons-chunk 108 | new webpack.optimize.CommonsChunkPlugin({ 109 | name: 'app', 110 | async: 'vendor-async', 111 | children: true, 112 | minChunks: 3 113 | }), 114 | 115 | // copy custom static assets 116 | new CopyWebpackPlugin([ 117 | { 118 | from: path.resolve(__dirname, '../static'), 119 | to: config.build.assetsSubDirectory, 120 | ignore: ['.*'] 121 | } 122 | ]) 123 | ] 124 | }) 125 | 126 | if (config.build.productionGzip) { 127 | const CompressionWebpackPlugin = require('compression-webpack-plugin') 128 | 129 | webpackConfig.plugins.push( 130 | new CompressionWebpackPlugin({ 131 | asset: '[path].gz[query]', 132 | algorithm: 'gzip', 133 | test: new RegExp( 134 | '\\.(' + 135 | config.build.productionGzipExtensions.join('|') + 136 | ')$' 137 | ), 138 | threshold: 10240, 139 | minRatio: 0.8 140 | }) 141 | ) 142 | } 143 | 144 | if (config.build.bundleAnalyzerReport) { 145 | const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin 146 | webpackConfig.plugins.push(new BundleAnalyzerPlugin()) 147 | } 148 | 149 | module.exports = webpackConfig 150 | -------------------------------------------------------------------------------- /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 | 15 | // Various Dev Server settings 16 | host: 'localhost', // can be overwritten by process.env.HOST 17 | port: 8080, // can be overwritten by process.env.PORT, if port is in use, a free one will be determined 18 | autoOpenBrowser: false, 19 | errorOverlay: true, 20 | notifyOnErrors: true, 21 | poll: false, // https://webpack.js.org/configuration/dev-server/#devserver-watchoptions- 22 | 23 | 24 | /** 25 | * Source Maps 26 | */ 27 | 28 | // https://webpack.js.org/configuration/devtool/#development 29 | devtool: 'cheap-module-eval-source-map', 30 | 31 | // If you have problems debugging vue-files in devtools, 32 | // set this to false - it *may* help 33 | // https://vue-loader.vuejs.org/en/options.html#cachebusting 34 | cacheBusting: true, 35 | 36 | cssSourceMap: true, 37 | }, 38 | 39 | build: { 40 | // Template for index.html 41 | index: path.resolve(__dirname, '../dist/index.html'), 42 | 43 | // Paths 44 | assetsRoot: path.resolve(__dirname, '../dist'), 45 | assetsSubDirectory: 'bmob-blog/dist/static', 46 | assetsPublicPath: './', 47 | 48 | /** 49 | * Source Maps 50 | */ 51 | 52 | productionSourceMap: true, 53 | // https://webpack.js.org/configuration/devtool/#production 54 | devtool: '#source-map', 55 | 56 | // Gzip off by default as many popular static hosts such as 57 | // Surge or Netlify already gzip all static assets for you. 58 | // Before setting to `true`, make sure to: 59 | // npm install --save-dev compression-webpack-plugin 60 | productionGzip: false, 61 | productionGzipExtensions: ['js', 'css'], 62 | 63 | // Run the build command with an extra argument to 64 | // View the bundle analyzer report after build finishes: 65 | // `npm run build --report` 66 | // Set to `true` or `false` to always turn it on or off 67 | bundleAnalyzerReport: process.env.npm_config_report 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /config/prod.env.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | module.exports = { 3 | NODE_ENV: '"production"' 4 | } 5 | -------------------------------------------------------------------------------- /config/test.env.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | const merge = require('webpack-merge') 3 | const devEnv = require('./dev.env') 4 | 5 | module.exports = merge(devEnv, { 6 | NODE_ENV: '"testing"' 7 | }) 8 | -------------------------------------------------------------------------------- /css: -------------------------------------------------------------------------------- 1 | /* 2 | Errno::ENOENT: No such file or directory @ rb_sysopen - sass 3 | 4 | Backtrace: 5 | C:/Ruby24/lib/ruby/gems/2.4.0/gems/sass-3.5.2/lib/sass/plugin/compiler.rb:454:in `read' 6 | C:/Ruby24/lib/ruby/gems/2.4.0/gems/sass-3.5.2/lib/sass/plugin/compiler.rb:454:in `update_stylesheet' 7 | C:/Ruby24/lib/ruby/gems/2.4.0/gems/sass-3.5.2/lib/sass/plugin/compiler.rb:215:in `block in update_stylesheets' 8 | C:/Ruby24/lib/ruby/gems/2.4.0/gems/sass-3.5.2/lib/sass/plugin/compiler.rb:209:in `each' 9 | C:/Ruby24/lib/ruby/gems/2.4.0/gems/sass-3.5.2/lib/sass/plugin/compiler.rb:209:in `update_stylesheets' 10 | C:/Ruby24/lib/ruby/gems/2.4.0/gems/sass-3.5.2/lib/sass/plugin/compiler.rb:294:in `watch' 11 | C:/Ruby24/lib/ruby/gems/2.4.0/gems/sass-3.5.2/lib/sass/plugin.rb:109:in `method_missing' 12 | C:/Ruby24/lib/ruby/gems/2.4.0/gems/sass-3.5.2/lib/sass/exec/sass_scss.rb:360:in `watch_or_update' 13 | C:/Ruby24/lib/ruby/gems/2.4.0/gems/sass-3.5.2/lib/sass/exec/sass_scss.rb:51:in `process_result' 14 | C:/Ruby24/lib/ruby/gems/2.4.0/gems/sass-3.5.2/lib/sass/exec/base.rb:52:in `parse' 15 | C:/Ruby24/lib/ruby/gems/2.4.0/gems/sass-3.5.2/lib/sass/exec/base.rb:19:in `parse!' 16 | C:/Ruby24/lib/ruby/gems/2.4.0/gems/sass-3.5.2/bin/sass:13:in `' 17 | C:/Ruby24/bin/sass:23:in `load' 18 | C:/Ruby24/bin/sass:23:in `
' 19 | */ 20 | body:before { 21 | white-space: pre; 22 | font-family: monospace; 23 | content: "Errno::ENOENT: No such file or directory @ rb_sysopen - sass"; } 24 | -------------------------------------------------------------------------------- /dist/bmob-blog/dist/static/bmob-1.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZongDuCha/bmob-blog/48d120175ea058e165e9af04526f9c16f5ae0020/dist/bmob-blog/dist/static/bmob-1.gif -------------------------------------------------------------------------------- /dist/bmob-blog/dist/static/bmob-2.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZongDuCha/bmob-blog/48d120175ea058e165e9af04526f9c16f5ae0020/dist/bmob-blog/dist/static/bmob-2.gif -------------------------------------------------------------------------------- /dist/bmob-blog/dist/static/fonts/fontawesome-webfont.674f50d.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZongDuCha/bmob-blog/48d120175ea058e165e9af04526f9c16f5ae0020/dist/bmob-blog/dist/static/fonts/fontawesome-webfont.674f50d.eot -------------------------------------------------------------------------------- /dist/bmob-blog/dist/static/fonts/fontawesome-webfont.b06871f.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZongDuCha/bmob-blog/48d120175ea058e165e9af04526f9c16f5ae0020/dist/bmob-blog/dist/static/fonts/fontawesome-webfont.b06871f.ttf -------------------------------------------------------------------------------- /dist/bmob-blog/dist/static/fonts/fontawesome-webfont.fee66e7.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZongDuCha/bmob-blog/48d120175ea058e165e9af04526f9c16f5ae0020/dist/bmob-blog/dist/static/fonts/fontawesome-webfont.fee66e7.woff -------------------------------------------------------------------------------- /dist/bmob-blog/dist/static/img/logo-bj.afa9c25.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZongDuCha/bmob-blog/48d120175ea058e165e9af04526f9c16f5ae0020/dist/bmob-blog/dist/static/img/logo-bj.afa9c25.jpg -------------------------------------------------------------------------------- /dist/bmob-blog/dist/static/img/logonameimg.51a331b.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZongDuCha/bmob-blog/48d120175ea058e165e9af04526f9c16f5ae0020/dist/bmob-blog/dist/static/img/logonameimg.51a331b.png -------------------------------------------------------------------------------- /dist/bmob-blog/dist/static/js/app.dbaee0d96f921c5bd0d6.js: -------------------------------------------------------------------------------- 1 | webpackJsonp([1],{"0D5i":function(t,e){},"4igE":function(t,e,n){t.exports=n.p+"bmob-blog/dist/static/img/logo-bj.afa9c25.jpg"},"7xjK":function(t,e){},Gj0j:function(t,e,n){t.exports=n.p+"bmob-blog/dist/static/img/logonameimg.51a331b.png"},HBSQ:function(t,e){},NHnr:function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var s=n("VCXJ"),o=n("4YfN"),i=n.n(o),a=n("9rMa"),c=n("ttMC"),r=n.n(c),l={name:"top",data:function(){return{left:!1,name:localStorage.getItem("name"),nameImg:"",pushTitle:"",pushCont:"",tagState:[],pushTag:[{value:"JavaScript"},{value:"Webpack"},{value:"Sass"},{value:"Nodejs"},{value:"Vue"}]}},computed:i()({},Object(a.c)(["pushShow"])),methods:{cleanlocal:function(){this.$store.commit("cleanlocal")},addShow:function(){this.$store.commit("addShow")},newModClose:function(t){"pushNews pushNewsAni"!=t.target.className&&"fa fa-close fa-2x"!=t.target.className||this.$store.commit("cloShow")},addTagState:function(t,e){if(this.tagState.includes(t)){var n=this.tagState.indexOf(t);this.tagState.splice(n,n+1)}else this.tagState.push(t);e.stopPropagation()},delCont:function(){for(var t=this,e=document.querySelectorAll(".operation label input"),n=0;n=document.body.clientHeight-50&&"/"==t.$route.path&&t.getcontent()})}),S()(j,"created",function(){N.a.start(),this.$store.dispatch("getallState",{getlist:this.getlist,tabName:"news",className:this.className}),N.a.done()}),j),A={render:function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"container-fluid"},[n("div",{staticClass:"container"},[n("div",{staticClass:"tag"},t._l(t.tagList,function(e,s){return n("li",{key:s},[n("span",{class:t.className==e.tagName?"active":"",on:{click:function(n){t.getlist=0,t.className=e.tagName,t.getcontent()}}},[t._v("\r\n "+t._s(e.tagName)+"\r\n ")])])})),t._v(" "),n("section",{staticClass:"news-list container"},t._l(t.getCont,function(e,s){return n("div",{key:s,staticClass:"zd-md-12 news-item"},[n("a",{on:{click:function(n){t.getNews(e.id)}}},[t._v(t._s(e.attributes.title))]),t._v(" "),e.attributes.content?n("p",{domProps:{innerHTML:t._s(e.attributes.content.replace(/<\/?[^>]*>/g,""))}}):t._e(),t._v(" "),n("div",{staticClass:"me-tag"},t._l(e.attributes.newTag,function(e,s){return n("a",{key:s,on:{click:function(n){t.className=e,t.getcontent()}}},[t._v(t._s(e))])})),t._v(" "),e.createdAt?n("div",{staticClass:"news-time"},[n("span",[t._v("发布时间:"+t._s(e.createdAt))])]):t._e(),t._v(" "),n("div",{staticClass:"operation"},[n("i",{staticClass:"fa fa-trash faa-wrench animated-hover",attrs:{alt:"删除",title:"删除"},on:{click:function(n){t.removeNew([e.id,e.attributes.newName])}}}),t._v(" "),n("i",{staticClass:"fa fa-wpforms faa-wrench animated-hover",attrs:{alt:"修改",title:"修改"},on:{click:function(n){t.newModShow([e.id,e.attributes.title,e.attributes.content,e.attributes.newName])}}})])])})),t._v(" "),n("div",{staticClass:"loading"},[t.loading?n("div",[t.loginBJ?n("i",{staticClass:"fa fa-spinner faa-spin animated"}):t._e(),t._v(" \r\n 数据加载中.....\r\n ")]):t._e(),t._v(" "),t.loading?t._e():n("div",[t._v("暂无数据")])])]),t._v(" "),n("NewsDetail"),t._v(" "),n("NewsModify")],1)},staticRenderFns:[]};var E=n("8AGX")(B,A,!1,function(t){n("q+35")},null,null).exports,G={name:"about",data:function(){return{editShow:!0,preCont:""}},computed:i()({},Object(a.c)(["aboutContent"])),methods:{editAbout:function(){var t=this,e=new r.a("#editorEleml");e.customConfig.onchange=function(e){t.preCont=e},e.create(),e.txt.html(this.aboutContent)},setAboutCont:function(){this.$store.dispatch("setAboutCont",this.preCont)},edit:function(){var t=this;this.$store.dispatch("getAboutCont");var e=new r.a("#editorEleml");e.customConfig.onchange=function(e){t.preCont=e},e.create(),e.txt.html(this.aboutContent)}},watch:{aboutContent:function(){this.preCont=this.aboutContent}},mounted:function(){this.$store.dispatch("getAboutCont");var t=this,e=new r.a("#editorEleml");e.customConfig.onchange=function(e){t.preCont=e},e.create()}},P={render:function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"about"},[n("div",{staticClass:"edit-about",on:{click:function(e){t.editShow=!1,t.edit()}}},[t._v("编辑")]),t._v(" "),t.editShow?n("div",{staticClass:"about-content",domProps:{innerHTML:t._s(t.aboutContent)}},[t._v("\n 1\n ")]):t._e(),t._v(" "),n("div",{directives:[{name:"show",rawName:"v-show",value:!t.editShow,expression:"!editShow"}],staticClass:"editSec"},[n("div",{staticStyle:{"text-align":"left"},attrs:{id:"editorEleml"}}),t._v(" "),n("span",{staticClass:"edit-suc",on:{click:function(e){t.setAboutCont(),t.editShow=!0}}},[t._v("确定")])])])},staticRenderFns:[]};var I=n("8AGX")(G,P,!1,function(t){n("YUmE")},null,null).exports;s.a.use(C.a);var O,U=new C.a({routes:[{path:"/",name:"Content",component:E},{path:"/about",name:"About",component:I}]});s.a.use(a.a);var J={locaName:localStorage.getItem("name"),mesState:"",mesTitle:"",newID:"",newShow:!1,newTitle:"",newConent:"",newComment:"",newTime:"",newTag:"",newGood:"",newName:"",newModId:"",newModShow:!1,newModTitle:"",newModContent:"",pushShow:!1,aboutContent:"",aboutID:"",err:!0,loginBJ:!1,getCont:""},D={local:function(t){localStorage.getItem("name")?t.loginBJ=!0:t.loginBJ=!1},cleanlocal:function(t){N.a.start(),localStorage.removeItem("name"),location.reload(!1),N.a.done()},login:function(){Bmob.initialize("7150849514c91ed37625710a29c91139","243c886d51cc5d468ccef730afe00cba")},resetMes:function(t){t.mesState="",t.mesTitle="",""!=t.mesState&&t.mesTitle!=t.mesTitle&&(t.mesState=""),t.mesTitle=""},getallState:function(t,e){var n=Bmob.Object.extend(e.tabName),s=new Bmob.Query(n);e.getlist&&s.limit(6*e.getlist),"全部"!=e.className&&s.equalTo("newTag",e.className),s.descending("createdAt"),s.find({success:function(e){t.getCont=e},error:function(t){console.log("查询失败: "+t.code+" "+t.message)}})},inStats:function(t,e){var n=Bmob.Object.extend("user_name"),s=new Bmob.Query(n);e.inUser&&s.equalTo("name",e.inUser),e.inPassword&&s.equalTo("password",e.inPassword),s.find({success:function(n){void 0!=e.inUser&&n.length>0?(n[0].attributes.name==e.inUser&&(t.err=!0),n[0].attributes.password==e.inPassword&&(N.a.start(),t.loginBJ=!0,t.mesState="suc",localStorage.setItem("name",n[0].attributes.name),t.mesTitle=n[0].attributes.name+" , 欢迎您!",t.locaName=localStorage.getItem("name"),N.a.done())):e.inPassword?(t.mesState="err",t.mesTitle="登录失败"):t.err=!1},error:function(n){e.inPassword?(t.mesState="err",t.mesTitle="登录失败"):t.err=!1}})},signUp:function(t,e){if(""==e.upUser||""==e.upPass)return setTimeout(function(){return t.mesState="err"},t.mesTitle="帐号或密码不能为空!"),!1;var n=new(Bmob.Object.extend("user_name"));n.set("name",e.upUser),n.set("password",e.upPass),n.save(null,{success:function(n){console.log(n),n.id&&e.upUser&&e.upPass?(N.a.start(),t.mesState="suc",t.mesTitle="注册成功",console.log("创建成功"),N.a.done()):(t.mesState="err",t.mesTitle="帐号已存在")},error:function(e,n){t.mesState="err",t.mesTitle="帐号已存在"}})},skip:function(t){t.loginBJ=!0},errState:function(t){t.err=!0},getNews:function(t,e){N.a.start();var n=Bmob.Object.extend("news");new Bmob.Query(n).get(e,{success:function(e){t.newShow=!0,t.newID=e.id,t.newTitle=e.get("title"),t.newConent=e.get("content"),t.newComment=e.get("comment")?Array.prototype.reverse.call(e.get("comment")):[],t.newTime=e.createdAt,t.newTag=e.get("newTag"),t.newGood=e.get("newGood"),t.newName=e.attributes.newName,N.a.done()},error:function(e,n){t.mesState="err",t.mesTitle="获取失败",t.newShow=!1,console.log("获取失败")}})},setComment:function(t,e){if(e[0]||alert("不能为空"),!t.locaName)return setTimeout(function(){return t.mesState="err"},t.mesTitle="未登录,转至登录页"),setTimeout(function(){return location.reload(!1)},2e3),!1;N.a.start();var n=Bmob.Object.extend("news");new Bmob.Query(n).get(t.newID,{success:function(n){var s={name:t.locaName,time:e[1],content:e[0]};n.addUnique("comment",s),n.save(),t.newComment=n.attributes.comment.reverse(),n&&(t.mesState="suc"),t.mesTitle="评论成功",N.a.done()},error:function(e,n){t.mesState="err",t.mesTitle="评论失败"}})},newClose:function(t){t.newShow=!1},editMod:function(t,e){t.newModId||(t.mesState="err"),t.mesTitle="错误",N.a.start();var n=Bmob.Object.extend("news");new Bmob.Query(n).get(t.newModId,{success:function(n){for(var s in t.getCont)t.getCont[s].id==t.newModId&&(t.getCont[s].attributes.title=e[0],t.getCont[s].attributes.content=e[1]);n.set("title",e[0]),n.set("content",e[1]),n.save(),t.mesState="suc",t.mesTitle="编辑成功",t.newModShow=!1,N.a.done()},error:function(e,n){t.mesState="err",t.mesTitle="错误"}})},addNewGood:function(t){t.newGood=!t.newGood;var e=Bmob.Object.extend("news");new Bmob.Query(e).get(t.newModId,{success:function(e){e.set("newGood",!1),console.log(t.newGood),e.save()},error:function(e,n){t.mesState="err",t.mesTitle="错误"}})},newModClose:function(t){t.newModShow=!1},newModShow:function(t,e){if(e[3]!=t.locaName)return setTimeout(function(){return t.mesState="err"},t.mesTitle="无权限修改"),!1;t.newModId=e[0],t.newModTitle=e[1],t.newModContent=e[2],t.newModShow=!0},clearNewMod:function(t){t.newModContent=" "},removeNew:function(t,e){if(""!=t.mesState&&t.mesTitle!=t.mesTitle&&(t.mesState=""),t.mesTitle="",e[1]!=t.locaName)return setTimeout(function(){return t.mesState="err"},t.mesTitle="无权限删除"),!1;N.a.start();var n=Bmob.Object.extend("news");new Bmob.Query(n).get(e[0],{success:function(e){e.destroy({success:function(e){for(var n in t.getCont)t.getCont[n].id==e.id&&t.getCont.splice(n,1);t.mesState="suc",t.mesTitle="删除成功",console.log("删除成功"),N.a.done()},error:function(e,n){t.mesState="err",t.mesTitle="删除失败",n&&console.log("删除失败")}})},error:function(e,n){t.mesState="err",t.mesTitle="删除失败",n&&console.log("query object fail")}})},getAboutCont:function(t){N.a.start();var e=Bmob.Object.extend("about");new Bmob.Query(e).find({success:function(e){console.log("共查询到 "+e.length+" 条记录");for(var n=0;n",components:{App:_}})},RYNR:function(t,e){},YUmE:function(t,e){},YfC1:function(t,e){},gsYr:function(t,e){},"q+35":function(t,e){},suVl:function(t,e){},ty0r:function(t,e){},ve9D:function(t,e){}},["NHnr"]); 2 | //# sourceMappingURL=app.dbaee0d96f921c5bd0d6.js.map -------------------------------------------------------------------------------- /dist/bmob-blog/dist/static/js/manifest.51b9cb71825d4fd8d9ca.js: -------------------------------------------------------------------------------- 1 | !function(e){var n=window.webpackJsonp;window.webpackJsonp=function(r,c,a){for(var i,u,f,s=0,d=[];sBmob-vue-dongdusir
-------------------------------------------------------------------------------- /dist/input.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 14 | 15 | 16 | 2222 17 |
18 |
1
19 |
2
20 |
3
21 |
4
22 |
23 | 24 | 97 | 98 | -------------------------------------------------------------------------------- /dist/static/bmob-1.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZongDuCha/bmob-blog/48d120175ea058e165e9af04526f9c16f5ae0020/dist/static/bmob-1.gif -------------------------------------------------------------------------------- /dist/static/bmob-2.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZongDuCha/bmob-blog/48d120175ea058e165e9af04526f9c16f5ae0020/dist/static/bmob-2.gif -------------------------------------------------------------------------------- /dist/static/fonts/fontawesome-webfont.674f50d.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZongDuCha/bmob-blog/48d120175ea058e165e9af04526f9c16f5ae0020/dist/static/fonts/fontawesome-webfont.674f50d.eot -------------------------------------------------------------------------------- /dist/static/fonts/fontawesome-webfont.b06871f.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZongDuCha/bmob-blog/48d120175ea058e165e9af04526f9c16f5ae0020/dist/static/fonts/fontawesome-webfont.b06871f.ttf -------------------------------------------------------------------------------- /dist/static/fonts/fontawesome-webfont.fee66e7.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZongDuCha/bmob-blog/48d120175ea058e165e9af04526f9c16f5ae0020/dist/static/fonts/fontawesome-webfont.fee66e7.woff -------------------------------------------------------------------------------- /dist/static/img/logo-bj.afa9c25.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZongDuCha/bmob-blog/48d120175ea058e165e9af04526f9c16f5ae0020/dist/static/img/logo-bj.afa9c25.jpg -------------------------------------------------------------------------------- /dist/static/img/logonameimg.51a331b.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZongDuCha/bmob-blog/48d120175ea058e165e9af04526f9c16f5ae0020/dist/static/img/logonameimg.51a331b.png -------------------------------------------------------------------------------- /dist/static/js/app.a19ff7f2dccde19e3abf.js: -------------------------------------------------------------------------------- 1 | webpackJsonp([1],{"4igE":function(t,e,n){t.exports=n.p+"static/img/logo-bj.afa9c25.jpg"},"6wUV":function(t,e){},"9cFS":function(t,e){},Gj0j:function(t,e,n){t.exports=n.p+"static/img/logonameimg.51a331b.png"},HBSQ:function(t,e){},MgwY:function(t,e){},NHnr:function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var s=n("VCXJ"),o=n("4YfN"),i=n.n(o),a=n("9rMa"),c=n("sYY+"),r=n.n(c),l={name:"top",data:function(){return{left:!1,name:localStorage.getItem("name"),nameImg:"",pushTitle:"",pushCont:"",tagState:[],pushTag:[{value:"Javascript"},{value:"Webpack"},{value:"Sass"},{value:"Nodejs"},{value:"Vue"}]}},computed:i()({},Object(a.c)(["pushShow"])),methods:{cleanlocal:function(){this.$store.commit("cleanlocal")},addShow:function(){this.$store.commit("addShow")},newModClose:function(t){"pushNews pushNewsAni"!=t.target.className&&"fa fa-close fa-2x"!=t.target.className||this.$store.commit("cloShow")},addTagState:function(t,e){if(this.tagState.includes(t)){var n=this.tagState.indexOf(t);this.tagState.splice(n,n+1)}else this.tagState.push(t);e.stopPropagation()},addNews:function(){var t=this;if(this.$store.dispatch("pushNews",[this.pushTitle,this.pushCont,this.tagState]),this.pushShow){this.pushTitle=this.pushCont="",this.tagState=[];var e=new r.a("#pushedi");e.customConfig.onchange=function(e){t.pushCont=e},e.create(),e.txt.html("请输入内容");var n=document.querySelectorAll(".operation label input");for(var s in n.length)n[s].checked=!1}}},mounted:function(){var t=this,e=new r.a("#pushedi");e.customConfig.onchange=function(e){t.pushCont=e},e.create(),e.txt.html("请输入内容")}},u={render:function(){var t=this,e=t.$createElement,s=t._self._c||e;return s("div",[s("div",{staticClass:"top"},[s("img",{attrs:{src:n("4igE"),alt:""}}),t._v(" "),s("nav",[s("div",{staticClass:"menu",on:{click:function(e){t.left=!t.left}}},[s("span"),t._v(" "),s("span"),t._v(" "),s("span")]),t._v(" "),s("div",{class:t.left?"menu-list left":"menu-list"},[s("li",[s("router-link",{attrs:{to:"/"}},[t._v("Home")])],1),t._v(" "),t._m(0),t._v(" "),t._m(1),t._v(" "),s("li",[s("router-link",{attrs:{to:"/about"}},[t._v("About")])],1)])]),t._v(" "),s("div",{staticClass:"logo"},[s("img",{attrs:{src:n("Gj0j"),alt:""}}),t._v(" "),t.name?s("p",[s("a",[t._v(t._s(t.name))]),t._v(" "),s("a",{on:{click:t.cleanlocal}},[t._v("退出")]),t._v(" "),s("a",{on:{click:t.addShow}},[t._v("发表文章")])]):t._e(),t._v(" "),t.name?t._e():s("p",{attrs:{onclick:"window.location.reload()"}},[s("a",[t._v("去登录")])]),t._v(" "),s("p",[t._v("梦想还是要有的,万一实现了呢")])])]),t._v(" "),s("div",{staticClass:"pushNews",class:t.pushShow?"pushNewsAni":"",on:{click:function(e){t.newModClose(e)}}},[s("div",{staticClass:"push-container"},[s("i",{staticClass:"fa fa-close fa-2x",on:{click:function(e){t.newModClose(e)}}}),t._v(" "),s("div",{staticClass:"opacmod"},[s("input",{directives:[{name:"model",rawName:"v-model",value:t.pushTitle,expression:"pushTitle"}],ref:"",attrs:{type:"text",placeholder:"标题"},domProps:{value:t.pushTitle},on:{input:function(e){e.target.composing||(t.pushTitle=e.target.value)}}}),t._v(" "),s("div",{staticStyle:{"text-align":"left"},attrs:{id:"pushedi"}}),t._v(" "),s("div",{staticClass:"operation"},[s("p",[t._v("文章文类:")]),t._v(" "),t._l(t.pushTag,function(e,n){return s("label",{key:n,attrs:{for:e.value}},[s("input",{attrs:{type:"checkbox",id:e.value},domProps:{value:e.value},on:{click:function(n){t.addTagState(e.value,n)}}}),t._v("\r\n "+t._s(e.value)+"\r\n ")])}),t._v(" "),s("button",[t._v("清空内容")]),t._v(" "),s("button",{on:{click:t.addNews}},[t._v("确定修改")])],2)])])])])},staticRenderFns:[function(){var t=this.$createElement,e=this._self._c||t;return e("li",[e("a",{attrs:{href:"https://github.com/ZongDuCha/bmob-blog",target:"_blank"}},[this._v("Github")])])},function(){var t=this.$createElement,e=this._self._c||t;return e("li",[e("a",{attrs:{href:"https://juejin.im/user/599ef403518825243217317c",target:"_blank"}},[this._v("Juejin")])])}]};var m=n("8AGX")(l,u,!1,function(t){n("kARj")},null,null).exports,d={name:"login",data:function(){return{clickMenu:!0}},computed:i()({},Object(a.c)(["err","inputState","loginBJ","mesState"])),methods:{inUser:function(){this.$store.dispatch("inStats",{inUser:this.$refs.inStats.value})},signIn:function(){this.$store.dispatch("inStats",{inUser:this.$refs.inStats.value,inPassword:this.$refs.inPass.value})},signUp:function(){this.$store.dispatch("signUp",{upUser:this.$refs.upStats.value,upPass:this.$refs.upPass.value})},skip:function(){this.$store.commit("skip")},errState:function(){this.$store.commit("errState")}}},v={render:function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"login"},[n("div",{staticClass:"login-container"},[n("div",{staticClass:"login-title"},[t._v("\n ZongDuSir\n ")]),t._v(" "),n("div",{staticClass:"statsMenu"},[n("li",{class:t.clickMenu?"active":"",on:{click:function(e){t.clickMenu=!0,t.errState()}}},[t._v("Sign in")]),t._v(" "),n("li",{class:t.clickMenu?"":"active",on:{click:function(e){t.clickMenu=!1,t.errState()}}},[t._v("Sign up")])]),t._v(" "),n("div",{directives:[{name:"show",rawName:"v-show",value:t.clickMenu,expression:"clickMenu"}],staticClass:"in"},[n("div",{staticClass:"user"},[t._m(0),t._v(" "),n("div",{staticClass:"user-input"},[n("input",{ref:"inStats",class:t.err?"":"err",attrs:{type:"text"},on:{blur:function(e){t.inUser()}}})])]),t._v(" "),n("div",{staticClass:"password"},[t._m(1),t._v(" "),n("div",{staticClass:"password-input"},[n("input",{ref:"inPass",attrs:{type:"password"},on:{keyup:function(e){if(!("button"in e)&&t._k(e.keyCode,"enter",13,e.key))return null;t.signIn()}}})])]),t._v(" "),n("button",{on:{click:function(e){t.signIn()}}},[t._v("\n 登录\n ")])]),t._v(" "),n("div",{directives:[{name:"show",rawName:"v-show",value:!t.clickMenu,expression:"!clickMenu"}],staticClass:"up"},[n("div",{staticClass:"user"},[t._m(2),t._v(" "),n("div",{staticClass:"user-input"},[n("input",{ref:"upStats",class:t.err?"":"err",attrs:{type:"text"},domProps:{value:(t.mesState,"")}})])]),t._v(" "),n("div",{staticClass:"password"},[t._m(3),t._v(" "),n("div",{staticClass:"password-input"},[n("input",{ref:"upPass",attrs:{type:"password"},domProps:{value:(t.mesState,"")},on:{keyup:function(e){if(!("button"in e)&&t._k(e.keyCode,"enter",13,e.key))return null;t.signUp()}}})])]),t._v(" "),n("button",{on:{click:function(e){t.signUp()}}},[t._v("注册")])]),t._v(" "),n("a",{staticClass:"skip",on:{click:function(e){t.skip()}}},[t._v("随便看看")])])])},staticRenderFns:[function(){var t=this.$createElement,e=this._self._c||t;return e("div",{staticClass:"user-i"},[e("i",{staticClass:"fa fa-user"})])},function(){var t=this.$createElement,e=this._self._c||t;return e("div",{staticClass:"password-i"},[e("i",{staticClass:"fa fa-unlock-alt"})])},function(){var t=this.$createElement,e=this._self._c||t;return e("div",{staticClass:"user-i"},[e("i",{staticClass:"fa fa-user"})])},function(){var t=this.$createElement,e=this._self._c||t;return e("div",{staticClass:"password-i"},[e("i",{staticClass:"fa fa-unlock-alt"})])}]};var f=n("8AGX")(d,v,!1,function(t){n("zcHQ")},null,null).exports,h={name:"message",computed:i()({},Object(a.c)(["mesState","mesTitle"]))},w={render:function(){var t=this.$createElement,e=this._self._c||t;return this.mesState?e("div",{staticClass:"message",class:this.mesState},[e("i",{staticClass:"fa",class:"err"==this.mesState?"fa-info faa-horizontal animated":"fa-check faa-horizontal animated"}),this._v("\n "+this._s(this.mesTitle)+"\n ")]):this._e()},staticRenderFns:[]};var g={name:"app",components:{Top:m,Login:f,Message:n("8AGX")(h,w,!1,function(t){n("Szx7")},null,null).exports},computed:i()({},Object(a.c)(["loginBJ"])),mounted:function(){this.$store.commit("local")}},p={render:function(){var t=this.$createElement,e=this._self._c||t;return e("div",{attrs:{id:"app"}},[e("Message"),this._v(" "),this.loginBJ?this._e():e("Login"),this._v(" "),this.loginBJ?e("Top"):this._e(),this._v(" "),this.loginBJ?e("router-view"):this._e()],1)},staticRenderFns:[]};var _=n("8AGX")(g,p,!1,function(t){n("MgwY")},null,null).exports,C=n("zO6J"),S=n("a3Yh"),b=n.n(S),T=n("E4C3"),M=n.n(T),N={name:"NewDetail",computed:i()({},Object(a.c)(["newShow","newTitle","newConent","newComment","newTime","newTag","newGood","newName"])),methods:{newClose:function(t){"news animate"!=t.target.className&&"fa fa-close fa-2x"!=t.target.className||this.$store.commit("newClose")},setComment:function(t){var e=new Date,n=e.getFullYear()+"-"+(e.getMonth()+1)+"-"+e.getDate()+" "+e.getHours()+":"+e.getMinutes()+":"+e.getSeconds();this.$store.dispatch("setComment",[this.$refs.comment.value,n]),this.$refs.comment.value=""},addNewGood:function(){this.$store.dispatch("addNewGood")}}},k={render:function(){var t=this,e=t.$createElement,s=t._self._c||e;return s("div",{staticClass:"news",class:t.newShow?"animate":"",on:{click:function(e){e.stopPropagation(),t.newClose(e)}}},[s("div",{staticClass:"news-container"},[s("i",{staticClass:"fa fa-close fa-2x",on:{click:function(e){t.newClose(e)}}}),t._v(" "),s("div",{staticClass:"news-title"},[s("img",{attrs:{src:n("Gj0j"),alt:""}}),t._v(" "),s("h2",[t._v(t._s(t.newName))])]),t._v(" "),s("div",{staticClass:"operation"},[s("li",[s("i",{staticClass:"fa fa-calendar"}),t._v(" "),s("span",[t._v(t._s(t.newTime))])]),t._v(" "),t._m(0),t._v(" "),s("li",{on:{click:t.addNewGood}},[s("i",{staticClass:"fa fa-thumbs-o-up"}),t._v(" "),s("span",[t._v(t._s(t.newGood||0))])]),t._v(" "),s("li",[s("i",{staticClass:"fa fa-commenting-o"}),t._v(" "),s("span",[t._v(t._s(t.newComment.length||"0"))])])]),t._v(" "),s("div",{staticClass:"overy"},[s("section",[t._v("\n "+t._s(t.newConent)+"\n ")]),t._v(" "),s("div",{staticClass:"new-comments"},[s("p",[t._v("评论("+t._s(t.newComment.length||"0")+")")])]),t._v(" "),s("div",{staticClass:"comment-content"},[t._l(t.newComment,function(e,n){return t.newComment?s("li",{key:n},[s("div",{staticClass:"comment-operation"},[s("div",{staticClass:"comment-name"},[t._v(t._s(e.name))]),t._v(" "),s("div",{staticClass:"comment-time"},[t._v("发表时间:"+t._s(e.time))])]),t._v(" "),e.content?s("div",{staticClass:"comment-content",domProps:{innerHTML:t._s(e.content)}}):t._e()]):t._e()}),t._v(" "),t.newComment?t._e():s("div",{staticClass:"comment-err"},[t._v("\n (空)\n ")])],2)]),t._v(" "),s("div",{staticClass:"comment"},[s("input",{ref:"comment",attrs:{type:"text"},on:{keyup:function(e){if(!("button"in e)&&t._k(e.keyCode,"enter",13,e.key))return null;t.setComment(e)}}}),t._v(" "),s("button",{on:{click:function(e){t.setComment(e)}}},[s("i",{staticClass:"fa fa-paper-plane fa-2x"}),t._v("评论")])])])])},staticRenderFns:[function(){var t=this.$createElement,e=this._self._c||t;return e("li",[e("i",{staticClass:"fa fa-eye"}),this._v(" "),e("span",[this._v("1")])])}]};var x=n("8AGX")(N,k,!1,function(t){n("SqG2")},null,null).exports,$={name:"NewsModify",data:function(){return{editorContent:"",loadText:"",editorTitle:this.$store.state.newModTitle}},computed:i()({},Object(a.c)(["newModShow","newModTitle","newModContent"])),methods:{newModClose:function(t){"newsModify newsModify-animate"!=t.target.className&&"fa fa-close fa-2x"!=t.target.className||this.$store.commit("newModClose")},setContent:function(){var t=this;console.log(this.editorContent);var e=new r.a("#editorElem");e.customConfig.onchange=function(e){t.editorContent=e},e.create(),this.$store.dispatch("editMod",[this.$refs.modTitle.value,this.editorContent]),e.txt.html(this.editorContent=this.loadText=""),this.$refs.modTitle.value=""},delContent:function(){this.$store.commit("clearNewMod"),this.$refs.modTitle.value=""}},watch:{newModContent:function(){var t=this,e=new r.a("#editorElem");e.customConfig.onchange=function(e){t.editorContent=e},e.create(),e.txt.html(this.editorContent=this.loadText=this.newModContent)},newModTitle:function(){this.editorTitle=this.$store.state.newModTitle},deep:!0},mounted:function(){var t=new r.a("#editorElem");t.create(),t.txt.html(this.editorContent=this.loadText=this.newModContent),this.$refs.modTitle.value=this.newModTitle}},y={render:function(){var t=this,e=t.$createElement,s=t._self._c||e;return s("div",{staticClass:"newsModify",class:t.newModShow?"newsModify-animate":"",on:{click:function(e){t.newModClose(e)}}},[s("div",{staticClass:"news-mod"},[s("i",{staticClass:"fa fa-close fa-2x",on:{click:function(e){t.newModClose(e)}}}),t._v(" "),s("div",{staticClass:"news-title"},[s("img",{attrs:{src:n("Gj0j"),alt:""}}),t._v(" "),s("h2",[t._v(t._s(t.editorTitle))])]),t._v(" "),s("div",{staticClass:"opacmod"},[s("input",{directives:[{name:"model",rawName:"v-model",value:t.editorTitle,expression:"editorTitle"}],ref:"modTitle",attrs:{type:"text",placeholder:"标题"},domProps:{value:t.editorTitle},on:{input:function(e){e.target.composing||(t.editorTitle=e.target.value)}}}),t._v(" "),s("div",{staticStyle:{"text-align":"left"},attrs:{id:"editorElem"}}),t._v(" "),s("div",{staticClass:"operation"},[s("button",{on:{click:t.delContent}},[t._v("清空内容")]),t._v(" "),s("button",{on:{click:t.setContent}},[t._v("确定修改")])])])])])},staticRenderFns:[]};var j,B=(j={data:function(){return{className:"全部",loading:!1,getlist:1,tagList:[{tagName:"全部"},{tagName:"JavaScript"},{tagName:"Webpack"},{tagName:"Sass"},{tagName:"Nodejs"},{tagName:"Vue"}]}},components:{NewsDetail:x,NewsModify:n("8AGX")($,y,!1,function(t){n("lOEH")},null,null).exports},methods:i()({},Object(a.b)(["getallState"])),computed:i()({},Object(a.c)(["getCont","loginBJ"]))},b()(j,"methods",{getcontent:function(){var t=this;this.getlist++,this.loading=!0,M.a.start(),this.$store.dispatch("getallState",{getlist:this.getlist,tabName:"news",className:this.className}).then(function(e){setInterval(function(){t.loading=!1},1e3),M.a.done()})},getNews:function(t){this.$store.dispatch("getNews",t)},newModShow:function(t){this.$store.dispatch("newModShow",t)},removeNew:function(t){this.$store.dispatch("removeNew",t)}}),b()(j,"mounted",function(){var t=this;window.addEventListener("scroll",function(){document.documentElement.scrollTop+window.innerHeight>=document.body.clientHeight-50&&"/"==t.$route.path&&t.getcontent()})}),b()(j,"created",function(){M.a.start(),this.$store.dispatch("getallState",{getlist:this.getlist,tabName:"news",className:this.className}),M.a.done()}),j),A={render:function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"container-fluid"},[n("div",{staticClass:"container"},[n("div",{staticClass:"tag"},t._l(t.tagList,function(e,s){return n("li",{key:s},[n("span",{class:t.className==e.tagName?"active":"",on:{click:function(n){t.getlist=0,t.className=e.tagName,t.getcontent()}}},[t._v("\r\n "+t._s(e.tagName)+"\r\n ")])])})),t._v(" "),n("section",{staticClass:"news-list container"},t._l(t.getCont,function(e,s){return n("div",{key:s,staticClass:"zd-md-12 news-item"},[n("a",{on:{click:function(n){t.getNews(e.id)}}},[t._v(t._s(e.attributes.title))]),t._v(" "),e.attributes.content?n("p",{domProps:{innerHTML:t._s(e.attributes.content.replace(/<\/?[^>]*>/g,""))}}):t._e(),t._v(" "),n("div",{staticClass:"me-tag"},t._l(e.attributes.newTag,function(e,s){return n("a",{key:s,on:{click:function(n){t.className=e,t.getcontent()}}},[t._v(t._s(e))])})),t._v(" "),e.createdAt?n("div",{staticClass:"news-time"},[n("span",[t._v("发布时间:"+t._s(e.createdAt))])]):t._e(),t._v(" "),n("div",{staticClass:"operation"},[n("i",{staticClass:"fa fa-trash faa-wrench animated-hover",attrs:{alt:"删除",title:"删除"},on:{click:function(n){t.removeNew([e.id,e.attributes.newName])}}}),t._v(" "),n("i",{staticClass:"fa fa-wpforms faa-wrench animated-hover",attrs:{alt:"修改",title:"修改"},on:{click:function(n){t.newModShow([e.id,e.attributes.title,e.attributes.content,e.attributes.newName])}}})])])})),t._v(" "),n("div",{staticClass:"loading"},[t.loading?n("div",[t.loginBJ?n("i",{staticClass:"fa fa-spinner faa-spin animated"}):t._e(),t._v(" \r\n 数据加载中.....\r\n ")]):t._e(),t._v(" "),t.loading?t._e():n("div",[t._v("暂无数据")])])]),t._v(" "),n("NewsDetail"),t._v(" "),n("NewsModify")],1)},staticRenderFns:[]};var E=n("8AGX")(B,A,!1,function(t){n("9cFS")},null,null).exports,G={name:"about",data:function(){return{editShow:!0,preCont:""}},computed:i()({},Object(a.c)(["aboutContent"])),methods:{editAbout:function(){var t=this,e=new r.a("#editorEleml");e.customConfig.onchange=function(e){t.preCont=e},e.create(),e.txt.html(this.aboutContent)},setAboutCont:function(){this.$store.dispatch("setAboutCont",this.preCont)},edit:function(){var t=this;this.$store.dispatch("getAboutCont");var e=new r.a("#editorEleml");e.customConfig.onchange=function(e){t.preCont=e},e.create(),e.txt.html(this.aboutContent)}},watch:{aboutContent:function(){this.preCont=this.aboutContent}},mounted:function(){this.$store.dispatch("getAboutCont");var t=this,e=new r.a("#editorEleml");e.customConfig.onchange=function(e){t.preCont=e},e.create()}},I={render:function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"about"},[n("div",{staticClass:"edit-about",on:{click:function(e){t.editShow=!1,t.edit()}}},[t._v("编辑")]),t._v(" "),t.editShow?n("div",{staticClass:"about-content",domProps:{innerHTML:t._s(t.aboutContent)}},[t._v("\n 1\n ")]):t._e(),t._v(" "),n("div",{directives:[{name:"show",rawName:"v-show",value:!t.editShow,expression:"!editShow"}],staticClass:"editSec"},[n("div",{staticStyle:{"text-align":"left"},attrs:{id:"editorEleml"}}),t._v(" "),n("span",{staticClass:"edit-suc",on:{click:function(e){t.setAboutCont(),t.editShow=!0}}},[t._v("确定")])])])},staticRenderFns:[]};var O=n("8AGX")(G,I,!1,function(t){n("6wUV")},null,null).exports;s.a.use(C.a);var P,U=new C.a({routes:[{path:"/",name:"Content",component:E},{path:"/about",name:"About",component:O}]});s.a.use(a.a);var J={local:function(t){localStorage.getItem("name")?t.loginBJ=!0:t.loginBJ=!1},cleanlocal:function(t){M.a.start(),localStorage.removeItem("name"),location.reload(!1),M.a.done()},login:function(){Bmob.initialize("7150849514c91ed37625710a29c91139","243c886d51cc5d468ccef730afe00cba")},resetMes:function(t){t.mesState="",t.mesTitle="",""!=t.mesState&&t.mesTitle!=t.mesTitle&&(t.mesState=""),t.mesTitle=""},getallState:function(t,e){var n=Bmob.Object.extend(e.tabName),s=new Bmob.Query(n);e.getlist&&s.limit(6*e.getlist),"全部"!=e.className&&s.equalTo("newTag",e.className),s.descending("createdAt"),s.find({success:function(e){t.getCont=e},error:function(t){console.log("查询失败: "+t.code+" "+t.message)}})},inStats:function(t,e){var n=Bmob.Object.extend("user_name"),s=new Bmob.Query(n);e.inUser&&s.equalTo("name",e.inUser),e.inPassword&&s.equalTo("password",e.inPassword),s.find({success:function(n){void 0!=e.inUser&&n.length>0?(n[0].attributes.name==e.inUser&&(t.err=!0),n[0].attributes.password==e.inPassword&&(M.a.start(),t.loginBJ=!0,t.mesState="suc",localStorage.setItem("name",n[0].attributes.name),t.mesTitle=n[0].attributes.name+" , 欢迎您!",M.a.done())):e.inPassword?(t.mesState="err",t.mesTitle="登录失败"):t.err=!1},error:function(n){e.inPassword?(t.mesState="err",t.mesTitle="登录失败"):t.err=!1}})},signUp:function(t,e){if(e){var n=new(Bmob.Object.extend("user_name"));n.set("name",e.upUser),n.set("password",e.upPass),n.save(null,{success:function(n){n.id&&e.upUser&&e.upPass?(M.a.start(),t.mesState="suc",t.mesTitle="注册成功",console.log("创建成功"),M.a.done()):(t.mesState="err",t.mesTitle="注册失败",console.log("失败"))},error:function(e,n){t.mesState="err",t.mesTitle="注册失败",console.log("创建日记失败")}})}},skip:function(t){t.loginBJ=!0},errState:function(t){t.err=!0},getNews:function(t,e){M.a.start();var n=Bmob.Object.extend("news");new Bmob.Query(n).get(e,{success:function(e){console.log(e),t.newShow=!0,t.newID=e.id,t.newTitle=e.get("title"),t.newComent=e.get("content"),t.newComment=e.get("comment")?Array.prototype.reverse.call(e.get("comment")):[],t.newTime=e.createdAt,t.newTag=e.get("newTag"),t.newGood=e.get("newGood"),t.newName=e.attributes.newName,console.log(t.newName),M.a.done()},error:function(e,n){t.mesState="err",t.mesTitle="获取失败",t.newShow=!1,console.log("获取失败")}})},setComment:function(t,e){e[0]||alert("不能为空"),t.loginBJ||(t.mesState="err",t.mesTitle="未登录",t.loginBJ=!0,setTimeout(function(){location.reload(!1)},2e3)),M.a.start();var n=Bmob.Object.extend("news");new Bmob.Query(n).get(t.newID,{success:function(n){var s={name:localStorage.getItem("name"),time:e[1],content:e[0]};n.addUnique("comment",s),n.save(),t.newComment=n.attributes.comment.reverse(),n&&(t.mesState="suc"),t.mesTitle="评论成功",M.a.done()},error:function(e,n){t.mesState="err",t.mesTitle="评论失败"}})},newClose:function(t){t.newShow=!1},editMod:function(t,e){t.newModId||(t.mesState="err"),t.mesTitle="错误",M.a.start();var n=Bmob.Object.extend("news");new Bmob.Query(n).get(t.newModId,{success:function(n){for(var s in t.getCont)t.getCont[s].id==t.newModId&&(t.getCont[s].attributes.title=e[0],t.getCont[s].attributes.content=e[1]);n.set("title",e[0]),n.set("content",e[1]),n.save(),t.mesState="suc",t.mesTitle="编辑成功",t.newModShow=!1,M.a.done()},error:function(e,n){t.mesState="err",t.mesTitle="错误"}})},addNewGood:function(t){t.newGood=!t.newGood;var e=Bmob.Object.extend("news");new Bmob.Query(e).get(t.newModId,{success:function(e){e.set("newGood",!1),console.log(t.newGood),e.save()},error:function(e,n){t.mesState="err",t.mesTitle="错误"}})},newModClose:function(t){t.newModShow=!1},newModShow:function(t,e){if(e[3]!=localStorage.getItem("name"))return t.mesState="err",t.mesTitle="无权限修改",console.log(t.mesState,t.mesTitle),!1;t.newModId=e[0],t.newModTitle=e[1],t.newModContent=e[2],t.newModShow=!0},clearNewMod:function(t){t.newModContent=" "},removeNew:function(t,e){if(""!=t.mesState&&t.mesTitle!=t.mesTitle&&(t.mesState=""),t.mesTitle="",e[1]!=localStorage.getItem("name"))return t.mesState="err",t.mesTitle="无权限删除",console.log(t.mesState,t.mesTitle),!1;M.a.start();var n=Bmob.Object.extend("news");new Bmob.Query(n).get(e[0],{success:function(e){e.destroy({success:function(e){for(var n in t.getCont)t.getCont[n].id==e.id&&t.getCont.splice(n,1);t.mesState="suc",t.mesTitle="删除成功",console.log("删除成功"),M.a.done()},error:function(e,n){t.mesState="err",t.mesTitle="删除失败",n&&console.log("删除失败")}})},error:function(e,n){t.mesState="err",t.mesTitle="删除失败",n&&console.log("query object fail")}})},getAboutCont:function(t){M.a.start();var e=Bmob.Object.extend("about");new Bmob.Query(e).find({success:function(e){console.log("共查询到 "+e.length+" 条记录");for(var n=0;n",components:{App:_}})},SqG2:function(t,e){},Szx7:function(t,e){},YfC1:function(t,e){},kARj:function(t,e){},lOEH:function(t,e){},ve9D:function(t,e){},zcHQ:function(t,e){}},["NHnr"]); 2 | //# sourceMappingURL=app.a19ff7f2dccde19e3abf.js.map -------------------------------------------------------------------------------- /dist/static/js/manifest.313d60003f4a66688a91.js: -------------------------------------------------------------------------------- 1 | !function(e){var n=window.webpackJsonp;window.webpackJsonp=function(r,c,a){for(var i,u,f,s=0,l=[];s 2 | 3 | 4 | 5 | 6 | Bmob-vue-dongdusir 7 | 8 | 9 | 10 |
11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /master: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZongDuCha/bmob-blog/48d120175ea058e165e9af04526f9c16f5ae0020/master -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "bg", 3 | "version": "1.0.0", 4 | "description": "A Vue.js project", 5 | "author": "ZongDuCha <1367243169@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 | "unit": "jest --config test/unit/jest.conf.js --coverage", 11 | "e2e": "node test/e2e/runner.js", 12 | "test": "npm run unit && npm run e2e", 13 | "build": "node build/build.js" 14 | }, 15 | "dependencies": { 16 | "css-loader": "^0.28.11", 17 | "font-awesome": "^4.7.0", 18 | "font-awesome-animation": "^0.2.0", 19 | "nprogress": "^0.2.0", 20 | "sass": "^1.2.0", 21 | "sass-resources-loader": "^1.3.3", 22 | "vue": "^2.5.2", 23 | "vue-router": "^3.0.1" 24 | }, 25 | "devDependencies": { 26 | "autoprefixer": "^7.1.2", 27 | "babel-core": "^6.22.1", 28 | "babel-helper-vue-jsx-merge-props": "^2.0.3", 29 | "babel-jest": "^21.0.2", 30 | "babel-loader": "^7.1.1", 31 | "babel-plugin-dynamic-import-node": "^1.2.0", 32 | "babel-plugin-syntax-jsx": "^6.18.0", 33 | "babel-plugin-transform-es2015-modules-commonjs": "^6.26.0", 34 | "babel-plugin-transform-runtime": "^6.22.0", 35 | "babel-plugin-transform-vue-jsx": "^3.5.0", 36 | "babel-preset-env": "^1.3.2", 37 | "babel-preset-stage-2": "^6.22.0", 38 | "babel-register": "^6.22.0", 39 | "chalk": "^2.0.1", 40 | "chromedriver": "^2.27.2", 41 | "copy-webpack-plugin": "^4.0.1", 42 | "cross-spawn": "^5.0.1", 43 | "css-loader": "^0.28.0", 44 | "extract-text-webpack-plugin": "^3.0.0", 45 | "file-loader": "^1.1.4", 46 | "friendly-errors-webpack-plugin": "^1.6.1", 47 | "html-webpack-plugin": "^2.30.1", 48 | "jest": "^21.2.0", 49 | "jest-serializer-vue": "^0.3.0", 50 | "nightwatch": "^0.9.12", 51 | "node-notifier": "^5.1.2", 52 | "optimize-css-assets-webpack-plugin": "^3.2.0", 53 | "ora": "^1.2.0", 54 | "portfinder": "^1.0.13", 55 | "postcss-import": "^11.0.0", 56 | "postcss-loader": "^2.0.8", 57 | "postcss-url": "^7.2.1", 58 | "rimraf": "^2.6.0", 59 | "selenium-server": "^3.0.1", 60 | "semver": "^5.3.0", 61 | "shelljs": "^0.7.6", 62 | "uglifyjs-webpack-plugin": "^1.1.1", 63 | "url-loader": "^0.5.8", 64 | "vue-jest": "^1.0.2", 65 | "vue-loader": "^13.3.0", 66 | "vue-style-loader": "^3.0.1", 67 | "vue-template-compiler": "^2.5.2", 68 | "webpack": "^3.6.0", 69 | "webpack-bundle-analyzer": "^2.9.0", 70 | "webpack-dev-server": "^2.9.1", 71 | "webpack-merge": "^4.1.0" 72 | }, 73 | "engines": { 74 | "node": ">= 6.0.0", 75 | "npm": ">= 3.0.0" 76 | }, 77 | "browserslist": [ 78 | "> 1%", 79 | "last 2 versions", 80 | "not ie <= 8" 81 | ] 82 | } 83 | -------------------------------------------------------------------------------- /src/App.vue: -------------------------------------------------------------------------------- 1 | 9 | 10 | 28 | 29 | 53 | -------------------------------------------------------------------------------- /src/App.vue.orig: -------------------------------------------------------------------------------- 1 | 9 | 10 | 22 | 23 | 41 | -------------------------------------------------------------------------------- /src/assets/400077311.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZongDuCha/bmob-blog/48d120175ea058e165e9af04526f9c16f5ae0020/src/assets/400077311.jpg -------------------------------------------------------------------------------- /src/assets/logo-bj.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZongDuCha/bmob-blog/48d120175ea058e165e9af04526f9c16f5ae0020/src/assets/logo-bj.jpg -------------------------------------------------------------------------------- /src/assets/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZongDuCha/bmob-blog/48d120175ea058e165e9af04526f9c16f5ae0020/src/assets/logo.png -------------------------------------------------------------------------------- /src/assets/logonameimg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZongDuCha/bmob-blog/48d120175ea058e165e9af04526f9c16f5ae0020/src/assets/logonameimg.png -------------------------------------------------------------------------------- /src/assets/zd-col.scss: -------------------------------------------------------------------------------- 1 | @charset 'utf-8'; 2 | /* 3 | github: 4 | https://github.com/ZongDuCha/ZD-1.0 5 | http://www.zongdusir.top/ 6 | Email:1367243169@qq.com 7 | qq:1367243169 8 | */ 9 | @mixin bor($px,$line,$color){ 10 | border: $px $line $color; 11 | } 12 | 13 | @mixin sizing($name:border-box){ 14 | -webkit-box-sizing: $name; 15 | box-sizing: $name; 16 | } 17 | 18 | @mixin clearFloat(){ 19 | position: relative; 20 | 21 | &:after{ 22 | content: ''; 23 | clear: both; 24 | display: block; 25 | } 26 | } 27 | 28 | @mixin box-shadow($v1,$v2,$v3,$color){ 29 | -webkit-box-shadow:$v1 $v2 $v3 $color; 30 | box-shadow:$v1 $v2 $v3 $color; 31 | } 32 | 33 | @mixin round($bool:false,$rods:5px,$rod1:5px,$rod2:5px,$rod3:5px,$rod4:5px){ 34 | @if $bool{ 35 | border-radius: $rods; 36 | } 37 | @else{ 38 | border-radius:$rod1,$rod2,$rod3,$rod4; 39 | } 40 | } 41 | 42 | 43 | @mixin careat($borWidth:10px,$style:solid,$borColor1:transparent,$borColor2:transparent,$borColor3:transparent,$borColor4:transparent,$bool:false,$aftTop:-10px,$aftLeft:-10px){ 44 | border-width: $borWidth; 45 | border-style: $style; 46 | border-color: $borColor1 $borColor2 $borColor3 $borColor4; 47 | 48 | @if $bool{ 49 | &:after{ 50 | top: $aftTop; 51 | content: '';border-width: $borWidth; 52 | height:0; 53 | position:absolute; 54 | right:-$borWidth; 55 | width:0;border-style:solid; 56 | bottom:-$borWidth; 57 | left: $aftLeft; 58 | } 59 | } 60 | 61 | } 62 | 63 | $color:#1d6de2; 64 | $zd-md:1200px; 65 | $zd-sm:990px; 66 | $zd-xs:770px; 67 | 68 | // ---------------------- 69 | 70 | 71 | *{ 72 | padding:0;margin:0; 73 | -webkit-font-smoothing:antialiased; 74 | } 75 | p,a,li,ul,ol,dd,dt,div,h1,h2,h3,h4,h5{ 76 | display: block; 77 | letter-spacing: 0.5px; 78 | text-decoration: none; 79 | color:#000; 80 | margin-bottom: 8px; 81 | word-wrap: break-word; 82 | @include clearFloat(); 83 | } 84 | div{ 85 | margin-bottom:0; 86 | } 87 | [class*=careat]{ 88 | height: 0; 89 | position: relative; 90 | width: 0; 91 | } 92 | .container-fluid{ 93 | width: 100%; 94 | margin-bottom: 8px; 95 | } 96 | .container{ 97 | height:auto; 98 | position:relative;display:block; 99 | width: 1200px;margin:0 auto;margin-bottom: 10px; 100 | @include clearFloat(); 101 | 102 | @media (max-width:$zd-md){ 103 | width:$zd-sm; 104 | } 105 | @media (max-width:$zd-sm){ 106 | width:$zd-xs; 107 | } 108 | @media (max-width:$zd-xs){ 109 | width:100%; 110 | } 111 | } 112 | 113 | [class*=zd-md-],[class*=zd-sm-],[class*=zd-xs-]{ 114 | position: relative; 115 | margin-bottom: 10px; 116 | float: left; 117 | @include sizing(); 118 | padding-left: 5px;padding-right: 5px; 119 | min-height: 1px; 120 | } 121 | 122 | .rnd{ 123 | @include round(true,50%) 124 | } 125 | 126 | [class*=zd-md-]{ 127 | display: inline-block; 128 | } 129 | 130 | @media (max-width:$zd-md) and (max-width:$zd-sm) and (max-width:$zd-xs){ 131 | .container{ 132 | width: 99%; 133 | } 134 | } 135 | 136 | 137 | @for $i from 5 through 1 { 138 | h#{$i}{ 139 | font-size: (6-$i) * 10px; 140 | } 141 | 142 | .rnd-#{$i}{ 143 | border-radius: $i * 5px; 144 | } 145 | } 146 | 147 | 148 | // zd-md-*,zd-smLeft-*,zd-smRight-* 149 | @for $i from 1 through 12{ 150 | .zd-md-#{$i}{ 151 | width: $i/12 * 100%; 152 | } 153 | .zd-mdLeft-#{$i}{ 154 | margin-left:$i/12 *100%; 155 | } 156 | .zd-mdRight-#{$i}{ 157 | margin-right: $i/12*100%; 158 | } 159 | } 160 | 161 | @media (max-width:$zd-sm){ 162 | [class*=zd-md-]{ 163 | width: 100%; 164 | } 165 | [class*=zd-sm-]{ 166 | display: inline-block; 167 | } 168 | 169 | // zd-sm-*,zd-smLeft-*,zd-smRight-* 170 | @for $i from 1 through 12{ 171 | .zd-sm-#{$i}{ 172 | width: $i/12 * 100%; 173 | } 174 | .zd-smLeft-#{$i}{ 175 | margin-left:$i/12 *100%; 176 | } 177 | .zd-smRight-#{$i}{ 178 | margin-right: $i/12*100%; 179 | } 180 | } 181 | 182 | // md-hide 183 | .md-hiden{ 184 | display: none; 185 | } 186 | 187 | // sm-fLeft sm-fRight 188 | .sm-fLeft{ 189 | float: left; 190 | } 191 | .sm-fRight{ 192 | float: right; 193 | } 194 | 195 | // sm-hiden 196 | .sm-hiden{ 197 | display: none; 198 | } 199 | } 200 | 201 | @media (max-width:$zd-xs){ 202 | [class*=zd-sm-]{ 203 | width: 100%; 204 | } 205 | 206 | [class*=zd-xs-]{ 207 | display: inline-block; 208 | } 209 | // zd-xs-*,zd-xsLeft-*,zd-xsRight-* 210 | @for $i from 1 through 12{ 211 | .zd-xs-#{$i}{ 212 | width: $i/12 * 100%; 213 | } 214 | .zd-xsLeft-#{$i}{ 215 | margin-left:$i/12 *100%; 216 | } 217 | .zd-xsRight-#{$i}{ 218 | margin-right: $i/12*100%; 219 | } 220 | } 221 | 222 | // sm-fLeft sm-fRight 223 | .sm-fLeft{ 224 | float: left; 225 | } 226 | .sm-fRight{ 227 | float: right; 228 | } 229 | 230 | // xs-hide 231 | .xs-hide{ 232 | display: none; 233 | } 234 | } 235 | 236 | [class*=grid-]{ 237 | display: grid; 238 | 239 | &:after,&:before{ 240 | position: absolute; 241 | } 242 | @for $i from 1 through 5{ 243 | [class*=column#{$i}]{ 244 | grid-column: #{$i} 245 | } 246 | [class*=-row#{$i}]{ 247 | grid-row: #{$i} 248 | } 249 | } 250 | } 251 | 252 | .flex{ 253 | display: -webkit-box; 254 | display: -ms-flexbox; 255 | display: flex; 256 | position: relative; 257 | 258 | @for $i from 1 through 12{ 259 | .flex-#{$i}{ 260 | -webkit-box-flex:#{$i}; 261 | -ms-flex:#{$i}; 262 | flex:#{$i}; 263 | } 264 | } 265 | } 266 | 267 | @for $i from 1 through 5{ 268 | [class*=grid-c#{$i}]{ 269 | grid-template-columns: repeat(#{$i},1fr); 270 | } 271 | [class*=grid-w#{$i}]{ 272 | grid-template-rows: repeat(#{$i},1fr); 273 | } 274 | } 275 | [class*=zd-mdLeft],[class*=zd-smLeft],[class*=zd-xsLeft]{ 276 | width: auto; 277 | } 278 | 279 | 280 | 281 | 282 | // fLeft fRight 283 | .fLeft{ 284 | float: left; 285 | } 286 | .fRight{ 287 | float: right; 288 | } 289 | 290 | // hiden 291 | .hide{ 292 | display: none; 293 | } 294 | 295 | 296 | 297 | // blockquote 298 | blockquote,.blockquote{ 299 | @include sizing(border-box); 300 | padding: 1.5rem 0.5rem; 301 | border-left: 5px solid #094fb7; 302 | display: block; 303 | font-size: 15px; 304 | word-wrap: break-word; 305 | letter-spacing: 1px; 306 | background: #e3eefb; 307 | max-width: 99%; 308 | margin: 0 auto; 309 | color: #525050; 310 | clear:both; 311 | margin-bottom: 0.5rem; 312 | } 313 | 314 | .clearFloat{ 315 | @include clearFloat(); 316 | } 317 | 318 | [class*=Cent]{ 319 | @include clearFloat(); 320 | margin: auto; 321 | min-width: 1px;min-height: 1px; 322 | position: absolute; 323 | } 324 | .verCent{ 325 | left: 0;right: 0; 326 | } 327 | .levCent{ 328 | top: 0;bottom: 0; 329 | } 330 | .rgCent{ 331 | right: 0; 332 | } 333 | .verhotCent{ 334 | left: 0;right: 0; 335 | top: 0;bottom: 0; 336 | } 337 | 338 | 339 | // text-* 340 | .txt-cent{ 341 | text-align: center; 342 | } 343 | .txt-left{ 344 | text-align: left; 345 | } 346 | .txt-right{ 347 | text-align: right; 348 | } 349 | 350 | // txt-eme 351 | .txt-eme{ 352 | color:$color; 353 | } 354 | .txt-emeW{ 355 | color:$color; 356 | font-weight: bold; 357 | } 358 | 359 | .bor-eme{ 360 | @include bor(1px,solid,$color) 361 | } 362 | 363 | // Button 364 | [class*=bt-]{ 365 | float: left; 366 | margin-left: 5px; 367 | font-size: 15px; 368 | border-radius: 5px;text-align: center; 369 | border: none; 370 | background: transparent; 371 | color:$color; 372 | margin-top: 5px; 373 | position: relative; 374 | -webkit-transition: .3s; 375 | transition: .3s; 376 | padding: 0 20px; 377 | cursor: pointer; 378 | text-decoration: none; 379 | height: 37px; 380 | display: inline-block; 381 | @include bor(1px,solid,transparent); 382 | overflow: hidden; 383 | line-height: 37px; 384 | outline: none; 385 | } 386 | .bt-btn{ 387 | color: #fff; 388 | background: $color; 389 | @include box-shadow(2px,2px,1px,#d7d8dc); 390 | 391 | &:hover{ 392 | background: #114490; 393 | } 394 | } 395 | 396 | .bt-line{ 397 | @include bor(1px,solid,$color); 398 | 399 | &:hover{ 400 | border-color: #6f6b6b; 401 | color: #6f6b6b; 402 | background: #f3f5f9; 403 | } 404 | } 405 | 406 | .bt-group{ 407 | border-color: $color; 408 | @include box-shadow(2px,2px,1px,#d7d8dc); 409 | background: $color; 410 | padding: 0; 411 | 412 | .bt-def{ 413 | color:#fff; 414 | margin: 0; 415 | border-radius: 0; 416 | 417 | &+.bt-def{ 418 | border-left: 1px solid #233e69; 419 | } 420 | 421 | &:hover{ 422 | background: #114490; 423 | } 424 | } 425 | } 426 | 427 | .bt-group-line{ 428 | border-color: $color; 429 | @include box-shadow(2px,2px,1px,#d7d8dc); 430 | background: #fff; 431 | padding: 0; 432 | 433 | .bt-line{ 434 | color:$color; 435 | margin: 0; 436 | border-radius: 0; 437 | border-color: transparent; 438 | 439 | &+.bt-line{ 440 | border-left:1px solid $color; 441 | } 442 | 443 | &:hover{ 444 | color: #6f6b6b; 445 | background: #f1f4fa; 446 | } 447 | } 448 | } 449 | 450 | .bt-groupV{ 451 | border-color: $color; 452 | @include box-shadow(2px,2px,1px,#d7d8dc); 453 | background: $color; 454 | padding: 0;height:auto; 455 | 456 | .bt-def{ 457 | color:#fff; 458 | width: 100%; 459 | margin: 0; 460 | border: none; 461 | padding: 0; 462 | 463 | &:nth-child(1){ 464 | border-radius: 0; 465 | } 466 | 467 | &:hover{ 468 | background:#114490; 469 | } 470 | 471 | &+.bt-def{ 472 | border-top: 1px solid #233e69; 473 | border-radius: 0; 474 | } 475 | } 476 | } 477 | 478 | .bt-group-lineV{ 479 | border-color: $color; 480 | @include box-shadow(2px,2px,1px,#d7d8dc); 481 | background: #fff; 482 | padding: 0;height:auto; 483 | 484 | .bt-line{ 485 | width: 100%; 486 | margin: 0; 487 | padding: 0; 488 | border: none; 489 | 490 | &:hover{ 491 | color: #6f6b6b; 492 | background: #f1f4fa; 493 | } 494 | 495 | & + .bt-line{ 496 | border-top: 1px solid $color; 497 | border-radius: 0; 498 | } 499 | } 500 | } 501 | 502 | [class*=caret]{ 503 | float: left; 504 | } 505 | .caret{ 506 | @include careat(10px,solid,#ddd,transparent,transparent,transparent); 507 | } 508 | .caret-right{ 509 | @include careat(10px,solid,transparent,transparent,transparent,#ddd) 510 | } 511 | .caret-top{ 512 | @include careat(10px,solid,transparent,transparent,#ddd,transparent) 513 | } 514 | .caret-left{ 515 | @include careat(10px,solid,transparent,#ddd,transparent,transparent) 516 | } 517 | 518 | 519 | .caretB{ 520 | @include careat(10px,solid,#ddd,transparent,transparent,transparent,true,-12px); 521 | &:after{ 522 | border-color:#f8f8f8 transparent transparent transparent; 523 | } 524 | } 525 | .caret-rightB{ 526 | @include careat(10px,solid,transparent,transparent,transparent,#ddd,true,-10px,-12px); 527 | &:after{ 528 | border-color:transparent transparent transparent #f8f8f8; 529 | } 530 | } 531 | .caret-topB{ 532 | @include careat(10px,solid,transparent,transparent,#ddd,transparent,true,-8px); 533 | &:after{ 534 | border-color:transparent transparent #f8f8f8 transparent; 535 | } 536 | } 537 | .caret-leftB{ 538 | @include careat(10px,solid,transparent,#ddd,transparent,transparent,true,-10px,-8px); 539 | &:after{ 540 | border-color:transparent #f8f8f8 transparent transparent; 541 | } 542 | } 543 | 544 | .caret-eme{ 545 | @include careat(10px,solid,$color,transparent,transparent,transparent); 546 | } 547 | .caret-right-eme{ 548 | @include careat(10px,solid,transparent,transparent,transparent,$color) 549 | } 550 | .caret-top-eme{ 551 | @include careat(10px,solid,transparent,transparent,$color,transparent) 552 | } 553 | .caret-left-eme{ 554 | @include careat(10px,solid,transparent,$color,transparent,transparent) 555 | } 556 | 557 | 558 | .caretB-eme{ 559 | @include careat(10px,solid,$color,transparent,transparent,transparent,true,-12px); 560 | &:after{ 561 | border-color:#fff transparent transparent transparent; 562 | } 563 | } 564 | .caret-rightB-eme{ 565 | @include careat(10px,solid,transparent,transparent,transparent,$color,true,-10px,-12px); 566 | &:after{ 567 | border-color:transparent transparent transparent #fff; 568 | } 569 | } 570 | .caret-topB-eme{ 571 | @include careat(10px,solid,transparent,transparent,$color,transparent,true,-8px); 572 | &:after{ 573 | border-color:transparent transparent #fff transparent; 574 | } 575 | } 576 | .caret-leftB-eme{ 577 | @include careat(10px,solid,transparent,$color,transparent,transparent,true,-10px,-8px); 578 | &:after{ 579 | border-color:transparent #fff transparent transparent; 580 | } 581 | } 582 | 583 | [class*=panel-]{ 584 | @include clearFloat(); 585 | -webkit-box-sizing: border-box; 586 | box-sizing: border-box; 587 | padding: 15px; 588 | border-radius: 6px; 589 | border: 1px solid transparent; 590 | } 591 | .panel-def,[class*=panel-def-]{ 592 | border-color: #ddd; 593 | background: #f8f8f8; 594 | } 595 | 596 | [class*=panel-def-T],[class*=panel-eme-T]{ 597 | margin-top: 15px; 598 | 599 | [class*=caret]{ 600 | position: absolute; 601 | } 602 | } 603 | 604 | .panel-def-T1{ 605 | 606 | .caret-topB{ 607 | top: -20px; 608 | left: 15%; 609 | } 610 | 611 | .caretB{ 612 | bottom: -29px; 613 | left: 15%; 614 | } 615 | } 616 | 617 | .panel-def-T2{ 618 | 619 | .caret-topB{ 620 | top: -20px; 621 | left: 50%; 622 | } 623 | 624 | .caretB{ 625 | bottom: -29px; 626 | left: 50%; 627 | } 628 | } 629 | 630 | .panel-def-T3{ 631 | 632 | .caret-topB{ 633 | top: -20px; 634 | left: 75%; 635 | } 636 | 637 | .caretB{ 638 | bottom: -29px; 639 | left: 75%; 640 | } 641 | } 642 | 643 | // *-eme 644 | .panel-eme,[class*=panel-eme-]{ 645 | border-color:$color; 646 | background: $color; 647 | color:#fff; 648 | @include box-shadow(1px ,2px, 7px,rgb(175, 206, 251)); 649 | } 650 | .panel-eme-T1{ 651 | 652 | .caret-top-eme{ 653 | top: -20px; 654 | left: 15%; 655 | } 656 | 657 | .caret-eme{ 658 | bottom: -29px; 659 | left: 15%; 660 | } 661 | } 662 | 663 | .panel-eme-T2{ 664 | 665 | .caret-top-eme{ 666 | top: -20px; 667 | left: 50%; 668 | } 669 | 670 | .caret-eme{ 671 | bottom: -29px; 672 | left: 50%; 673 | } 674 | } 675 | 676 | .panel-eme-T3{ 677 | 678 | .caret-top-eme{ 679 | top: -20px; 680 | left: 75%; 681 | } 682 | 683 | .caret-eme{ 684 | bottom: -29px; 685 | left: 75%; 686 | } 687 | } 688 | 689 | [class*=crumbs]{ 690 | position:relative; 691 | display: block; 692 | 693 | li,a,span{ 694 | display: inline-block;float: left;color:#000; 695 | 696 | &+li,&+a,&+span{ 697 | margin-left: 25px; 698 | 699 | &:after{ 700 | content: '/'; 701 | position: absolute; 702 | left: -15px; 703 | top: 0px; 704 | color: #ccc; 705 | } 706 | } 707 | } 708 | } 709 | .crumbs-eme{ 710 | li,a,span{color: $color;} 711 | &+li,&+a,&+span{ 712 | color: $color; 713 | } 714 | } -------------------------------------------------------------------------------- /src/components/HelloWorld.vue: -------------------------------------------------------------------------------- 1 | 5 | 6 | 16 | 17 | 18 | 34 | -------------------------------------------------------------------------------- /src/components/about.vue: -------------------------------------------------------------------------------- 1 | 14 | 15 | 72 | 73 | 100 | -------------------------------------------------------------------------------- /src/components/api.js: -------------------------------------------------------------------------------- 1 | /* 2 | 登录 3 | */ 4 | function login(){ 5 | Bmob.initialize('7150849514c91ed37625710a29c91139','243c886d51cc5d468ccef730afe00cba'); 6 | } 7 | 8 | /* 9 | @添加一行数据 10 | @addScore 添加表名 11 | @addTitle 列的名字 12 | @addContent 内容 13 | */ 14 | export const addStatusOne = (score,addTitle,addContent) => { 15 | login() 16 | var GameScore = Bmob.Object.extend(addScore); 17 | var gameScore = new GameScore(); 18 | 19 | gameScore.set(addTitle,addContent); 20 | gameScore.save(null, { 21 | success: function(object) { 22 | console.log(object.id ? 'ok' : false) 23 | }, 24 | error: function(model, error) { 25 | console.error('添加数据失败') 26 | } 27 | }); 28 | } 29 | 30 | /* 31 | @删除一列 32 | @delScore 删除表名 33 | @delSucc 删除列名 34 | */ 35 | export const delStatus = (delScore,delSucc) => { 36 | login() 37 | var GameScore = Bmob.Object.extend(delScore); 38 | var query = new Bmob.Query(GameScore); 39 | query.get(delSucc, { 40 | success: function(object) { 41 | // The object was retrieved successfully. 42 | object.destroy({ 43 | success: function(deleteObject) { 44 | console.log('ok') 45 | }, 46 | error: function(GameScoretest, error) { 47 | console.error('no') 48 | } 49 | }); 50 | }, 51 | error: function(object, error) { 52 | console.error('删除失败') 53 | } 54 | }); 55 | } 56 | 57 | /** 58 | * @ 获取单个记录 59 | * @getScore 获取表名 60 | * @getCloumn 获取行开头名字 61 | * @getRow 获取列开头名字 62 | * 63 | */ 64 | export const getStatus = (getscore,getCloumn,getRow) => { 65 | var GameScore = Bmob.Object.extend(getscore); 66 | var query = new Bmob.Query(GameScore); 67 | query.get(getCloumn, { 68 | success: function(object) { 69 | // The object was retrieved successfully. 70 | console.log('ok'+object.get(getRow)) 71 | return object.get(getRow) 72 | }, 73 | error: function(object, error) { 74 | console.log('no') 75 | } 76 | }); 77 | } 78 | 79 | /* 80 | @ 查询全部记录 81 | @allscore 表名 82 | */ 83 | export const getallStatus = (allscore) => { 84 | login() 85 | var list,get; 86 | var GameScore = Bmob.Object.extend(allscore); 87 | var query = new Bmob.Query(GameScore); 88 | // 查询所有数据 89 | return query.find({ 90 | success: function(results) { 91 | return results 92 | }, 93 | error: function(error) { 94 | console.log("查询失败: " + error.code + " " + error.message); 95 | } 96 | }); 97 | } -------------------------------------------------------------------------------- /src/components/content.vue: -------------------------------------------------------------------------------- 1 | 47 | 48 | 144 | 145 | 253 | -------------------------------------------------------------------------------- /src/components/login.vue: -------------------------------------------------------------------------------- 1 | 77 | 78 | 127 | 128 | 279 | -------------------------------------------------------------------------------- /src/components/message.vue: -------------------------------------------------------------------------------- 1 | 7 | 8 | 20 | 21 | 64 | -------------------------------------------------------------------------------- /src/components/newsDetail.vue: -------------------------------------------------------------------------------- 1 | 68 | 69 | 108 | 109 | 295 | -------------------------------------------------------------------------------- /src/components/newsModify.vue: -------------------------------------------------------------------------------- 1 | 21 | 22 | 89 | 90 | 196 | -------------------------------------------------------------------------------- /src/components/pushNews.vue: -------------------------------------------------------------------------------- 1 | 4 | 5 | 10 | 11 | 14 | -------------------------------------------------------------------------------- /src/components/top.vue: -------------------------------------------------------------------------------- 1 | 60 | 61 | 165 | 166 | 413 | -------------------------------------------------------------------------------- /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' 5 | import router from './router' 6 | import store from './vuex/store' 7 | import NProgress from 'nprogress' 8 | import 'nprogress/nprogress.css' 9 | import 'font-awesome/css/font-awesome.css' 10 | import 'font-awesome-animation/dist/font-awesome-animation.css' 11 | 12 | Vue.use(NProgress) 13 | Vue.config.productionTip = false 14 | 15 | /* eslint-disable no-new */ 16 | new Vue({ 17 | el: '#app', 18 | router,store, 19 | template: '', 20 | components: { App } 21 | }) 22 | -------------------------------------------------------------------------------- /src/router/index.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import Router from 'vue-router' 3 | import Content from '@/components/content' 4 | import About from '@/components/about' 5 | 6 | Vue.use(Router) 7 | 8 | export default new Router({ 9 | routes: [ 10 | { 11 | path: '/', 12 | name: 'Content', 13 | component: Content, 14 | }, 15 | { 16 | path: '/about', 17 | name: 'About', 18 | component: About 19 | } 20 | ] 21 | }) 22 | -------------------------------------------------------------------------------- /src/svg/deyi.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/vuex/store.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import Vuex from 'vuex' 3 | import NProgress from 'nprogress' 4 | 5 | Vue.use(Vuex) 6 | 7 | const state = { 8 | // localStorage 9 | locaName: localStorage.getItem('name'), 10 | // message 数据 11 | mesState: '', 12 | mesTitle: '', 13 | /* 14 | newID 文章ID 15 | newDetail 数据状态 16 | @newShow 组件显示 17 | @newTitle 文章标题 18 | @newConent 文章内容 19 | @newComment 文章评论 20 | @newTime 文章发表时间 21 | @newTag 文章分类 22 | @newGood 文章赞 23 | @newName 文章发表人 24 | */ 25 | newID : '', 26 | newShow : false, 27 | newTitle: '', 28 | newConent: '', 29 | newComment: '', 30 | newTime: '', 31 | newTag: '', 32 | newGood: '', 33 | newName: '', 34 | /** 35 | * newModID 编辑文章ID 36 | * newModTitle 编辑文章标题 37 | * newModContent 编辑文章内容 38 | */ 39 | newModId : '', 40 | newModShow : false, 41 | newModTitle : '', 42 | newModContent : '', 43 | /** 44 | * top 45 | * pushShow 发布文章标题 46 | */ 47 | pushShow: false, 48 | // about 49 | aboutContent: '', 50 | aboutID: '', 51 | // login 状态 52 | err: true, 53 | loginBJ: false, 54 | // -- content 首页文章条目 55 | getCont: '' 56 | } 57 | 58 | const mutations = { 59 | // app 判断是否有值 60 | local:(state) => { 61 | localStorage.getItem('name') ? state.loginBJ = true : state.loginBJ = false 62 | }, 63 | // content 退出清除localStorage 并刷新 64 | cleanlocal: (state) => { 65 | NProgress.start() 66 | localStorage.removeItem('name') 67 | location.reload(false) 68 | NProgress.done() 69 | }, 70 | login: () => { 71 | Bmob.initialize('7150849514c91ed37625710a29c91139','243c886d51cc5d468ccef730afe00cba'); 72 | }, 73 | // 重置提示框 74 | resetMes:function(state){ 75 | state.mesState= ''; state.mesTitle = ''; 76 | if(state.mesState != '' && state.mesTitle != state.mesTitle) state.mesState= ''; state.mesTitle = ''; 77 | }, 78 | // content 首页文章 (查询所有数据) 79 | getallState : (state,type) => { 80 | var GameScore = Bmob.Object.extend(type.tabName); 81 | var query = new Bmob.Query(GameScore); 82 | type.getlist ? query.limit(6*type.getlist) : '' 83 | type.className != '全部' ? query.equalTo('newTag',type.className) : '' 84 | query.descending('createdAt') 85 | query.find({ 86 | success: results => { 87 | state.getCont = results 88 | }, 89 | error: error => { 90 | console.log("查询失败: " + error.code + " " + error.message); 91 | } 92 | }); 93 | }, 94 | // login 登录 (查询单条数据) 95 | inStats:(state,type) => { 96 | var GameScore = Bmob.Object.extend('user_name'); 97 | var query = new Bmob.Query(GameScore); 98 | // 值存在就执行条件 99 | type.inUser ? query.equalTo('name',type.inUser) : '' 100 | type.inPassword ? query.equalTo('password',type.inPassword) : '' 101 | query.find({ 102 | success: function(results) { 103 | // 登录 判断 用户名存在 和 登录成功 104 | if(type.inUser != undefined && results.length > 0){ 105 | results[0].attributes.name == type.inUser ? state.err = true : '' 106 | 107 | if(results[0].attributes.password == type.inPassword){ 108 | NProgress.start() 109 | state.loginBJ = true 110 | state.mesState = 'suc' 111 | localStorage.setItem('name',results[0].attributes.name) 112 | state.mesTitle = `${results[0].attributes.name} , 欢迎您!` 113 | state.locaName=localStorage.getItem('name') 114 | NProgress.done() 115 | } 116 | 117 | }else{ 118 | // login 判断是否有 添加密码 119 | type.inPassword 120 | ? (state.mesState='err',state.mesTitle = '登录失败') 121 | : state.err = false 122 | } 123 | }, 124 | error: function(error) { 125 | type.inPassword 126 | ? (state.mesState='err',state.mesTitle = '登录失败') 127 | : state.err = false 128 | } 129 | }); 130 | }, 131 | // login 注册 (添加单条数据) 132 | signUp:(state,type) => { 133 | if(type.upUser == '' || type.upPass == ''){ 134 | setTimeout(() => state.mesState='err',state.mesTitle = '帐号或密码不能为空!'); 135 | return false; 136 | } 137 | var Diary = Bmob.Object.extend("user_name"); 138 | var diary = new Diary(); 139 | diary.set("name",type.upUser) 140 | diary.set("password",type.upPass) 141 | diary.save(null, { 142 | success: function(result) { 143 | console.log(result) 144 | if(result.id && type.upUser && type.upPass){ 145 | NProgress.start() 146 | state.mesState='suc',state.mesTitle = '注册成功' 147 | console.log("创建成功") 148 | NProgress.done() 149 | }else{ 150 | state.mesState='err',state.mesTitle = '帐号已存在' 151 | } 152 | }, 153 | error: function(result, error) { 154 | state.mesState='err',state.mesTitle = '帐号已存在' 155 | } 156 | }); 157 | }, 158 | // login 随便看看 159 | skip: (state) => { 160 | state.loginBJ = true 161 | }, 162 | // login 重置 err状态 163 | errState:(state) => { 164 | state.err = true 165 | }, 166 | getNews: (state,type) => { 167 | /* 168 | newID 文章ID 169 | newDetail 数据状态 170 | @newShow 组件显示 171 | @newTitle 文章标题 172 | @newConent 文章内容 173 | @newComment 文章评论 174 | @newTime 文章发表时间 175 | @newTag 文章分类 176 | @newGood 文章点攒数 177 | @newName 文章发表人 178 | */ 179 | NProgress.start() 180 | var news = Bmob.Object.extend("news"); 181 | var query = new Bmob.Query(news); 182 | query.get(type, { 183 | success: function(result) { 184 | state.newShow = true 185 | state.newID = result.id; 186 | state.newTitle = result.get("title"); 187 | state.newConent = result.get("content"); 188 | // Array.prototype.reverse.call(result.get("comment")) 189 | state.newComment = result.get("comment") ? Array.prototype.reverse.call(result.get("comment")) : [] 190 | state.newTime = result.createdAt; 191 | state.newTag = result.get('newTag'); 192 | state.newGood = result.get('newGood') 193 | state.newName = result.attributes.newName 194 | NProgress.done() 195 | }, 196 | error: function(object, error) { 197 | state.mesState = 'err',state.mesTitle = '获取失败' 198 | state.newShow = false,console.log('获取失败') 199 | } 200 | }); 201 | }, 202 | // newsDetail 评论 203 | setComment: (state,type) => { 204 | if (!type[0]) alert('不能为空'); 205 | if(!state.locaName){ 206 | setTimeout(() => state.mesState = 'err',state.mesTitle="未登录,转至登录页") 207 | setTimeout(() => location.reload(false),2000); 208 | return false; 209 | } 210 | NProgress.start() 211 | var Diary = Bmob.Object.extend("news"); 212 | var query = new Bmob.Query(Diary); 213 | query.get(state.newID, { 214 | success: function(result) { 215 | var obj = { 216 | "name": state.locaName, 217 | "time": type[1], 218 | "content": type[0] 219 | } 220 | result.addUnique('comment', obj); 221 | result.save(); 222 | state.newComment = result.attributes.comment.reverse() 223 | if(result) state.mesState = 'suc';state.mesTitle = '评论成功' 224 | NProgress.done() 225 | }, 226 | error: function(object, error) { 227 | state.mesState = 'err',state.mesTitle="评论失败"; 228 | } 229 | }); 230 | }, 231 | // 关闭显示文章组件 232 | newClose: (state) => { 233 | state.newShow = false 234 | }, 235 | /** 236 | * newModID 编辑文章ID 237 | * newModTitle 编辑文章标题 238 | * newModContent 编辑文章内容 239 | */ 240 | editMod: (state,type) => { 241 | if (!state.newModId) state.mesState='err';state.mesTitle='错误' 242 | NProgress.start() 243 | var Diary = Bmob.Object.extend("news"); 244 | var query = new Bmob.Query(Diary); 245 | query.get(state.newModId, { 246 | success: function(result) { 247 | for(let i in state.getCont){ 248 | if(state.getCont[i].id == state.newModId){ 249 | state.getCont[i].attributes.title = type[0] 250 | state.getCont[i].attributes.content = type[1] 251 | } 252 | } 253 | result.set('title', type[0]); 254 | result.set('content', type[1]); 255 | result.save(); 256 | state.mesState= 'suc';state.mesTitle = '编辑成功' 257 | state.newModShow = false 258 | NProgress.done() 259 | }, 260 | error: function(object, error) { 261 | state.mesState='err';state.mesTitle='错误' 262 | } 263 | }); 264 | }, 265 | // 文章点赞 266 | addNewGood: (state) => { 267 | state.newGood = !state.newGood 268 | var Diary = Bmob.Object.extend("news"); 269 | var query = new Bmob.Query(Diary); 270 | query.get(state.newModId, { 271 | success: function(result) { 272 | result.set('newGood',false); 273 | console.log(state.newGood) 274 | result.save(); 275 | }, 276 | error: function(object, error) { 277 | state.mesState='err';state.mesTitle='错误' 278 | } 279 | }); 280 | }, 281 | newModClose: (state) => { 282 | state.newModShow = false 283 | }, 284 | // 修改文章 285 | newModShow: (state,type) => { 286 | if(type[3] != state.locaName){ 287 | setTimeout(() => state.mesState = 'err',state.mesTitle = '无权限修改'); 288 | return false; 289 | } 290 | state.newModId = type[0] 291 | state.newModTitle = type[1] 292 | state.newModContent = type[2] 293 | state.newModShow = true 294 | }, 295 | // 清空 文章修改内容 296 | clearNewMod: (state) => { 297 | state.newModContent = ' ' 298 | }, 299 | // 删除文章 300 | removeNew: (state,type) => { 301 | if(state.mesState != '' && state.mesTitle != state.mesTitle) state.mesState= ''; state.mesTitle = ''; 302 | if(type[1] != state.locaName){ 303 | setTimeout(() => state.mesState = 'err',state.mesTitle = '无权限删除'); 304 | return false; 305 | } 306 | NProgress.start() 307 | var Diary = Bmob.Object.extend("news"); 308 | var query = new Bmob.Query(Diary); 309 | query.get(type[0], { 310 | success: function(object) { 311 | // The object was retrieved successfully. 312 | object.destroy({ 313 | success: function(deleteObject) { 314 | for(let i in state.getCont){ 315 | if(state.getCont[i].id == deleteObject.id){ 316 | state.getCont.splice(i,1) 317 | } 318 | } 319 | state.mesState = 'suc',state.mesTitle = '删除成功' 320 | console.log('删除成功'); 321 | NProgress.done() 322 | }, 323 | error: function(object, error) { 324 | state.mesState = 'err',state.mesTitle = '删除失败' 325 | error ? console.log('删除失败') : ''; 326 | } 327 | }); 328 | }, 329 | error: function(object, error) { 330 | state.mesState = 'err',state.mesTitle = '删除失败' 331 | error ? console.log("query object fail") : ''; 332 | } 333 | }); 334 | }, 335 | // 获取about 336 | getAboutCont: (state) => { 337 | NProgress.start() 338 | var Diary = Bmob.Object.extend("about"); 339 | var query = new Bmob.Query(Diary); 340 | // 查询所有数据 341 | query.find({ 342 | success: function(results) { 343 | console.log("共查询到 " + results.length + " 条记录"); 344 | // 循环处理查询到的数据 345 | for (var i = 0; i < results.length; i++) { 346 | var object = results[i]; 347 | state.aboutID = object.id 348 | state.aboutContent = object.attributes.aboutContent 349 | NProgress.done() 350 | } 351 | }, 352 | error: function(error) { 353 | console.log("查询失败: " + error.code + " " + error.message); 354 | } 355 | }); 356 | }, 357 | // 修改about 358 | setAboutCont: (state,type) => { 359 | var Diary = Bmob.Object.extend("about"); 360 | var query = new Bmob.Query(Diary); 361 | query.get(state.aboutID, { 362 | success: function(result) { 363 | result.set('aboutContent', type); 364 | result.save(); 365 | state.aboutContent = type 366 | state.mesState= 'suc';state.mesTitle = '修改成功' 367 | }, 368 | error: function(object, error) { 369 | state.mesState='err';state.mesTitle='错误' 370 | } 371 | }); 372 | }, 373 | /** 374 | * top 375 | * pushShow 发布文章遮罩 376 | */ 377 | pushNews: (state,type) => { 378 | if(type[0] == '' && type[1] == ''){ 379 | state.mesState= 'err'; 380 | state.mesTitle = '标题或内容不得为空'; 381 | return; 382 | } 383 | console.log(type) 384 | var Diary = Bmob.Object.extend("news"); 385 | var diary = new Diary(); 386 | diary.set("title",type[0]); 387 | diary.set("content",type[1]); 388 | diary.set("newTag",type[2]); 389 | diary.set("newName",state.locaName); 390 | diary.save(null, { 391 | success: function(result) { 392 | if(!result) return 393 | state.mesState= 'suc';state.mesTitle = '发布成功'; 394 | state.pushShow = false 395 | state.getCont.unshift(result) 396 | }, 397 | error: function(result, error) { 398 | state.mesState= 'err';state.mesTitle = '发布失败'; 399 | } 400 | }); 401 | }, 402 | addShow:function(state){ 403 | state.pushShow = true 404 | }, 405 | cloShow:function(state){ 406 | state.pushShow = false 407 | } 408 | } 409 | 410 | const actions = { 411 | getallState : ({commit},type) => { 412 | commit('resetMes') 413 | commit('login') 414 | commit('getallState',type) 415 | }, 416 | inStats: ({commit},type) => { 417 | commit('resetMes') 418 | commit('login') 419 | commit('inStats',type) 420 | }, 421 | signUp: ({commit},type) => { 422 | commit('resetMes') 423 | commit('login') 424 | commit('signUp',type) 425 | }, 426 | // 获取文章信息 427 | getNews: ({commit},type) => { 428 | commit('resetMes') 429 | commit('login') 430 | commit('getNews',type) 431 | }, 432 | setComment: ({commit},type) => { 433 | commit('resetMes') 434 | commit('setComment',type) 435 | }, 436 | newModShow:({commit},type) => { 437 | commit('resetMes') 438 | commit('newModShow',type) 439 | }, 440 | // 文章点赞 441 | addNewGood: ({commit}) => { 442 | commit('resetMes') 443 | commit('login') 444 | commit('addNewGood') 445 | }, 446 | // 编辑文章 447 | editMod: ({commit},type) => { 448 | commit('resetMes') 449 | commit('login') 450 | commit('editMod',type) 451 | }, 452 | newModShow: ({commit},type) => { 453 | commit('resetMes') 454 | commit('newModShow',type) 455 | }, 456 | // 删除文章 457 | removeNew: ({commit},type) => { 458 | commit('resetMes') 459 | commit('removeNew',type) 460 | }, 461 | getAboutCont: ({commit}) => { 462 | commit('resetMes') 463 | commit('login') 464 | commit('getAboutCont') 465 | }, 466 | // 修改about内容 467 | setAboutCont: ({commit},type,state) => { 468 | commit('resetMes') 469 | commit('login') 470 | commit('setAboutCont',type) 471 | }, 472 | pushNews: ({commit},type,state) => { 473 | commit('resetMes') 474 | commit('login') 475 | commit('pushNews',type) 476 | } 477 | } 478 | 479 | export default new Vuex.Store({ 480 | state, 481 | mutations, 482 | actions 483 | }) -------------------------------------------------------------------------------- /static/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZongDuCha/bmob-blog/48d120175ea058e165e9af04526f9c16f5ae0020/static/.gitkeep -------------------------------------------------------------------------------- /static/bmob-1.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZongDuCha/bmob-blog/48d120175ea058e165e9af04526f9c16f5ae0020/static/bmob-1.gif -------------------------------------------------------------------------------- /static/bmob-2.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZongDuCha/bmob-blog/48d120175ea058e165e9af04526f9c16f5ae0020/static/bmob-2.gif -------------------------------------------------------------------------------- /test/e2e/custom-assertions/elementCount.js: -------------------------------------------------------------------------------- 1 | // A custom Nightwatch assertion. 2 | // The assertion name is the filename. 3 | // Example usage: 4 | // 5 | // browser.assert.elementCount(selector, count) 6 | // 7 | // For more information on custom assertions see: 8 | // http://nightwatchjs.org/guide#writing-custom-assertions 9 | 10 | exports.assertion = function (selector, count) { 11 | this.message = 'Testing if element <' + selector + '> has count: ' + count 12 | this.expected = count 13 | this.pass = function (val) { 14 | return val === this.expected 15 | } 16 | this.value = function (res) { 17 | return res.value 18 | } 19 | this.command = function (cb) { 20 | var self = this 21 | return this.api.execute(function (selector) { 22 | return document.querySelectorAll(selector).length 23 | }, [selector], function (res) { 24 | cb.call(self, res) 25 | }) 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /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 | 4 | const webpack = require('webpack') 5 | const DevServer = require('webpack-dev-server') 6 | 7 | const webpackConfig = require('../../build/webpack.prod.conf') 8 | const devConfigPromise = require('../../build/webpack.dev.conf') 9 | 10 | let server 11 | 12 | devConfigPromise.then(devConfig => { 13 | const devServerOptions = devConfig.devServer 14 | const compiler = webpack(webpackConfig) 15 | server = new DevServer(compiler, devServerOptions) 16 | const port = devServerOptions.port 17 | const host = devServerOptions.host 18 | return server.listen(port, host) 19 | }) 20 | .then(() => { 21 | // 2. run the nightwatch test suite against it 22 | // to run in additional browsers: 23 | // 1. add an entry in test/e2e/nightwatch.conf.json under "test_settings" 24 | // 2. add it to the --env flag below 25 | // or override the environment flag, for example: `npm run e2e -- --env chrome,firefox` 26 | // For more information on Nightwatch's config file, see 27 | // http://nightwatchjs.org/guide#settings-file 28 | let opts = process.argv.slice(2) 29 | if (opts.indexOf('--config') === -1) { 30 | opts = opts.concat(['--config', 'test/e2e/nightwatch.conf.js']) 31 | } 32 | if (opts.indexOf('--env') === -1) { 33 | opts = opts.concat(['--env', 'chrome']) 34 | } 35 | 36 | const spawn = require('cross-spawn') 37 | const runner = spawn('./node_modules/.bin/nightwatch', opts, { stdio: 'inherit' }) 38 | 39 | runner.on('exit', function (code) { 40 | server.close() 41 | process.exit(code) 42 | }) 43 | 44 | runner.on('error', function (err) { 45 | server.close() 46 | throw err 47 | }) 48 | }) 49 | -------------------------------------------------------------------------------- /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 | "jest": true 4 | }, 5 | "globals": { 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /test/unit/jest.conf.js: -------------------------------------------------------------------------------- 1 | const path = require('path') 2 | 3 | module.exports = { 4 | rootDir: path.resolve(__dirname, '../../'), 5 | moduleFileExtensions: [ 6 | 'js', 7 | 'json', 8 | 'vue' 9 | ], 10 | moduleNameMapper: { 11 | '^@/(.*)$': '/src/$1' 12 | }, 13 | transform: { 14 | '^.+\\.js$': '/node_modules/babel-jest', 15 | '.*\\.(vue)$': '/node_modules/vue-jest' 16 | }, 17 | testPathIgnorePatterns: [ 18 | '/test/e2e' 19 | ], 20 | snapshotSerializers: ['/node_modules/jest-serializer-vue'], 21 | setupFiles: ['/test/unit/setup'], 22 | mapCoverage: true, 23 | coverageDirectory: '/test/unit/coverage', 24 | collectCoverageFrom: [ 25 | 'src/**/*.{js,vue}', 26 | '!src/main.js', 27 | '!src/router/index.js', 28 | '!**/node_modules/**' 29 | ] 30 | } 31 | -------------------------------------------------------------------------------- /test/unit/setup.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | 3 | Vue.config.productionTip = false 4 | -------------------------------------------------------------------------------- /test/unit/specs/HelloWorld.spec.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import HelloWorld from '@/components/HelloWorld' 3 | 4 | describe('HelloWorld.vue', () => { 5 | it('should render correct contents', () => { 6 | const Constructor = Vue.extend(HelloWorld) 7 | const vm = new Constructor().$mount() 8 | expect(vm.$el.querySelector('.hello h1').textContent) 9 | .toEqual('Welcome to Your Vue.js App') 10 | }) 11 | }) 12 | --------------------------------------------------------------------------------