Repository: xiaotiandada/takeaway Branch: master Commit: 8be27e1e7e04 Files: 62 Total size: 109.0 KB Directory structure: gitextract_slkvwrwy/ ├── .babelrc ├── .editorconfig ├── .eslintignore ├── .eslintrc.js ├── .gitignore ├── .postcssrc.js ├── LICENSE ├── README.md ├── build/ │ ├── build.js │ ├── check-versions.js │ ├── dev-client.js │ ├── dev-server.js │ ├── utils.js │ ├── vue-loader.conf.js │ ├── webpack.base.conf.js │ ├── webpack.dev.conf.js │ └── webpack.prod.conf.js ├── config/ │ ├── dev.env.js │ ├── index.js │ └── prod.env.js ├── index.html ├── package.json ├── project.config.json ├── src/ │ ├── App.vue │ ├── components/ │ │ ├── card.vue │ │ ├── deladdress.vue │ │ ├── message.vue │ │ └── pay.vue │ ├── main.js │ ├── pages/ │ │ ├── address/ │ │ │ ├── index.vue │ │ │ └── main.js │ │ ├── addressAdd/ │ │ │ ├── index.vue │ │ │ └── main.js │ │ ├── addressUpdate/ │ │ │ ├── index.vue │ │ │ └── main.js │ │ ├── commodity/ │ │ │ ├── index.vue │ │ │ ├── main.js │ │ │ └── store.js │ │ ├── contactmerchant/ │ │ │ ├── index.vue │ │ │ └── main.js │ │ ├── contactus/ │ │ │ ├── index.vue │ │ │ └── main.js │ │ ├── counter/ │ │ │ ├── index.vue │ │ │ ├── main.js │ │ │ └── store.js │ │ ├── feedback/ │ │ │ ├── index.vue │ │ │ └── main.js │ │ ├── index/ │ │ │ ├── index.vue │ │ │ └── main.js │ │ ├── logs/ │ │ │ ├── index.vue │ │ │ └── main.js │ │ ├── order/ │ │ │ ├── index.vue │ │ │ └── main.js │ │ ├── settlement/ │ │ │ ├── index.vue │ │ │ └── main.js │ │ ├── shopp/ │ │ │ ├── index.vue │ │ │ └── main.js │ │ └── user/ │ │ ├── index.vue │ │ └── main.js │ ├── store/ │ │ └── index.js │ └── utils/ │ └── index.js └── static/ └── .gitkeep ================================================ FILE CONTENTS ================================================ ================================================ FILE: .babelrc ================================================ { "presets": [ ["env", { "modules": false, "targets": { "browsers": ["> 1%", "last 2 versions", "not ie <= 8"] } }], "stage-2" ], "plugins": ["transform-runtime"], "env": { "test": { "presets": ["env", "stage-2"], "plugins": ["istanbul"] } } } ================================================ FILE: .editorconfig ================================================ root = true [*] charset = utf-8 indent_style = space indent_size = 2 end_of_line = lf insert_final_newline = true trim_trailing_whitespace = true ================================================ FILE: .eslintignore ================================================ build/*.js config/*.js ================================================ FILE: .eslintrc.js ================================================ // http://eslint.org/docs/user-guide/configuring module.exports = { root: true, parser: 'babel-eslint', parserOptions: { sourceType: 'module' }, env: { browser: false, node: true, es6: true }, // https://github.com/standard/standard/blob/master/docs/RULES-en.md extends: 'standard', // required to lint *.vue files plugins: [ 'html' ], // add your custom rules here 'rules': { // allow paren-less arrow functions 'arrow-parens': 0, // allow async-await 'generator-star-spacing': 0, // allow debugger during development 'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0 }, globals: { App: true, Page: true, wx: true, getApp: true, getPage: true, requirePlugin: true } } ================================================ FILE: .gitignore ================================================ .DS_Store node_modules/ dist/ npm-debug.log* yarn-debug.log* yarn-error.log* # Editor directories and files .idea *.suo *.ntvs* *.njsproj *.sln ================================================ FILE: .postcssrc.js ================================================ // https://github.com/michael-ciniawsky/postcss-load-config module.exports = { "plugins": { "postcss-mpvue-wxss": {} } } ================================================ FILE: LICENSE ================================================ MIT License Copyright (c) 2018 _xiaotian Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ================================================ FILE: README.md ================================================ # mpvue-signin > A Mpvue project (以前随意写的一个小东西, 现在肯定年久失修 仅供参考!!! 具体大家还是可以多看看文档哦 mpvue 写的小程序 [文章地址](https://github.com/xiaotiandada/blog/issues/14) 欢迎start 和 pr ![mpvue](doc/mpvue1.png) ![mpvue](doc/mpvue2.png) ![mpvue](doc/mpvue3.png) ![mpvue](doc/mpvue4.png) ![mpvue](doc/mpvue5.png) ##技术栈 [mpvue](http://mpvue.com/) 是一个使用 Vue.js 开发小程序的前端框架。框架基于 Vue.js......(可以看官网介绍~). [iview weapp ](https://weapp.iviewui.com/) 一套高质量的 微信小程序 UI 组件库. ## Build Setup ``` bash # install dependencies npm install # serve with hot reload at localhost:8080 npm run dev # build for production with minification npm run build # build for production and view the bundle analyzer report npm run build --report ``` For detailed explanation on how things work, checkout the [guide](http://vuejs-templates.github.io/webpack/) and [docs for vue-loader](http://vuejs.github.io/vue-loader). ================================================ FILE: build/build.js ================================================ require('./check-versions')() process.env.NODE_ENV = 'production' var ora = require('ora') var rm = require('rimraf') var path = require('path') var chalk = require('chalk') var webpack = require('webpack') var config = require('../config') var webpackConfig = require('./webpack.prod.conf') var spinner = ora('building for production...') spinner.start() rm(path.join(config.build.assetsRoot, '*'), err => { if (err) throw err webpack(webpackConfig, function (err, stats) { spinner.stop() if (err) throw err process.stdout.write(stats.toString({ colors: true, modules: false, children: false, chunks: false, chunkModules: false }) + '\n\n') if (stats.hasErrors()) { console.log(chalk.red(' Build failed with errors.\n')) process.exit(1) } console.log(chalk.cyan(' Build complete.\n')) console.log(chalk.yellow( ' Tip: built files are meant to be served over an HTTP server.\n' + ' Opening index.html over file:// won\'t work.\n' )) }) }) ================================================ FILE: build/check-versions.js ================================================ var chalk = require('chalk') var semver = require('semver') var packageConfig = require('../package.json') var shell = require('shelljs') function exec (cmd) { return require('child_process').execSync(cmd).toString().trim() } var versionRequirements = [ { name: 'node', currentVersion: semver.clean(process.version), versionRequirement: packageConfig.engines.node } ] if (shell.which('npm')) { versionRequirements.push({ name: 'npm', currentVersion: exec('npm --version'), versionRequirement: packageConfig.engines.npm }) } module.exports = function () { var warnings = [] for (var i = 0; i < versionRequirements.length; i++) { var mod = versionRequirements[i] if (!semver.satisfies(mod.currentVersion, mod.versionRequirement)) { warnings.push(mod.name + ': ' + chalk.red(mod.currentVersion) + ' should be ' + chalk.green(mod.versionRequirement) ) } } if (warnings.length) { console.log('') console.log(chalk.yellow('To use this template, you must update following to modules:')) console.log() for (var i = 0; i < warnings.length; i++) { var warning = warnings[i] console.log(' ' + warning) } console.log() process.exit(1) } } ================================================ FILE: build/dev-client.js ================================================ /* eslint-disable */ require('eventsource-polyfill') var hotClient = require('webpack-hot-middleware/client?noInfo=true&reload=true') hotClient.subscribe(function (event) { if (event.action === 'reload') { window.location.reload() } }) ================================================ FILE: build/dev-server.js ================================================ require('./check-versions')() var config = require('../config') if (!process.env.NODE_ENV) { process.env.NODE_ENV = JSON.parse(config.dev.env.NODE_ENV) } // var opn = require('opn') var path = require('path') var express = require('express') var webpack = require('webpack') var proxyMiddleware = require('http-proxy-middleware') var portfinder = require('portfinder') var webpackConfig = require('./webpack.dev.conf') // default port where dev server listens for incoming traffic var port = process.env.PORT || config.dev.port // automatically open browser, if not set will be false var autoOpenBrowser = !!config.dev.autoOpenBrowser // Define HTTP proxies to your custom API backend // https://github.com/chimurai/http-proxy-middleware var proxyTable = config.dev.proxyTable var app = express() var compiler = webpack(webpackConfig) // var devMiddleware = require('webpack-dev-middleware')(compiler, { // publicPath: webpackConfig.output.publicPath, // quiet: true // }) // var hotMiddleware = require('webpack-hot-middleware')(compiler, { // log: false, // heartbeat: 2000 // }) // force page reload when html-webpack-plugin template changes // compiler.plugin('compilation', function (compilation) { // compilation.plugin('html-webpack-plugin-after-emit', function (data, cb) { // hotMiddleware.publish({ action: 'reload' }) // cb() // }) // }) // proxy api requests Object.keys(proxyTable).forEach(function (context) { var options = proxyTable[context] if (typeof options === 'string') { options = { target: options } } app.use(proxyMiddleware(options.filter || context, options)) }) // handle fallback for HTML5 history API app.use(require('connect-history-api-fallback')()) // serve webpack bundle output // app.use(devMiddleware) // enable hot-reload and state-preserving // compilation error display // app.use(hotMiddleware) // serve pure static assets var staticPath = path.posix.join(config.dev.assetsPublicPath, config.dev.assetsSubDirectory) app.use(staticPath, express.static('./static')) // var uri = 'http://localhost:' + port var _resolve var readyPromise = new Promise(resolve => { _resolve = resolve }) // console.log('> Starting dev server...') // devMiddleware.waitUntilValid(() => { // console.log('> Listening at ' + uri + '\n') // // when env is testing, don't need open it // if (autoOpenBrowser && process.env.NODE_ENV !== 'testing') { // opn(uri) // } // _resolve() // }) module.exports = new Promise((resolve, reject) => { portfinder.basePort = port portfinder.getPortPromise() .then(newPort => { if (port !== newPort) { console.log(`${port}端口被占用,开启新端口${newPort}`) } var server = app.listen(newPort, 'localhost') // for 小程序的文件保存机制 require('webpack-dev-middleware-hard-disk')(compiler, { publicPath: webpackConfig.output.publicPath, quiet: true }) resolve({ ready: readyPromise, close: () => { server.close() } }) }).catch(error => { console.log('没有找到空闲端口,请打开任务管理器杀死进程端口再试', error) }) }) ================================================ FILE: build/utils.js ================================================ var path = require('path') var config = require('../config') var ExtractTextPlugin = require('extract-text-webpack-plugin') exports.assetsPath = function (_path) { var assetsSubDirectory = process.env.NODE_ENV === 'production' ? config.build.assetsSubDirectory : config.dev.assetsSubDirectory return path.posix.join(assetsSubDirectory, _path) } exports.cssLoaders = function (options) { options = options || {} var cssLoader = { loader: 'css-loader', options: { minimize: process.env.NODE_ENV === 'production', sourceMap: options.sourceMap } } var postcssLoader = { loader: 'postcss-loader', options: { sourceMap: true } } var px2rpxLoader = { loader: 'px2rpx-loader', options: { baseDpr: 1, rpxUnit: 0.5 } } // generate loader string to be used with extract text plugin function generateLoaders (loader, loaderOptions) { var loaders = [cssLoader, px2rpxLoader, postcssLoader] if (loader) { loaders.push({ loader: loader + '-loader', options: Object.assign({}, loaderOptions, { sourceMap: options.sourceMap }) }) } // Extract CSS when that option is specified // (which is the case during production build) if (options.extract) { return ExtractTextPlugin.extract({ use: loaders, fallback: 'vue-style-loader' }) } else { return ['vue-style-loader'].concat(loaders) } } // https://vue-loader.vuejs.org/en/configurations/extract-css.html return { css: generateLoaders(), wxss: generateLoaders(), postcss: generateLoaders(), less: generateLoaders('less'), sass: generateLoaders('sass', { indentedSyntax: true }), scss: generateLoaders('sass'), stylus: generateLoaders('stylus'), styl: generateLoaders('stylus') } } // Generate loaders for standalone style files (outside of .vue) exports.styleLoaders = function (options) { var output = [] var loaders = exports.cssLoaders(options) for (var extension in loaders) { var loader = loaders[extension] output.push({ test: new RegExp('\\.' + extension + '$'), use: loader }) } return output } ================================================ FILE: build/vue-loader.conf.js ================================================ var utils = require('./utils') var config = require('../config') // var isProduction = process.env.NODE_ENV === 'production' // for mp var isProduction = true module.exports = { loaders: utils.cssLoaders({ sourceMap: isProduction ? config.build.productionSourceMap : config.dev.cssSourceMap, extract: isProduction }), transformToRequire: { video: 'src', source: 'src', img: 'src', image: 'xlink:href' } } ================================================ FILE: build/webpack.base.conf.js ================================================ var path = require('path') var fs = require('fs') var utils = require('./utils') var config = require('../config') var vueLoaderConfig = require('./vue-loader.conf') var MpvuePlugin = require('webpack-mpvue-asset-plugin') var glob = require('glob') function resolve (dir) { return path.join(__dirname, '..', dir) } function getEntry (rootSrc, pattern) { var files = glob.sync(path.resolve(rootSrc, pattern)) return files.reduce((res, file) => { var info = path.parse(file) var key = info.dir.slice(rootSrc.length + 1) + '/' + info.name res[key] = path.resolve(file) return res }, {}) } const appEntry = { app: resolve('./src/main.js') } const pagesEntry = getEntry(resolve('./src'), 'pages/**/main.js') const entry = Object.assign({}, appEntry, pagesEntry) module.exports = { // 如果要自定义生成的 dist 目录里面的文件路径, // 可以将 entry 写成 {'toPath': 'fromPath'} 的形式, // toPath 为相对于 dist 的路径, 例:index/demo,则生成的文件地址为 dist/index/demo.js entry, target: require('mpvue-webpack-target'), output: { path: config.build.assetsRoot, filename: '[name].js', publicPath: process.env.NODE_ENV === 'production' ? config.build.assetsPublicPath : config.dev.assetsPublicPath }, resolve: { extensions: ['.js', '.vue', '.json'], alias: { 'vue': 'mpvue', '@': resolve('src'), 'socket.io-client': 'weapp.socket.io' }, symlinks: false, aliasFields: ['mpvue', 'weapp', 'browser'], mainFields: ['browser', 'module', 'main'] }, module: { rules: [ { test: /\.(js|vue)$/, loader: 'eslint-loader', enforce: 'pre', include: [resolve('src'), resolve('test')], options: { formatter: require('eslint-friendly-formatter') } }, { test: /\.vue$/, loader: 'mpvue-loader', options: vueLoaderConfig }, { test: /\.js$/, include: [resolve('src'), resolve('test')], use: [ 'babel-loader', { loader: 'mpvue-loader', options: { checkMPEntry: true } }, ] }, { test: /\.(png|jpe?g|gif|svg)(\?.*)?$/, loader: 'url-loader', options: { limit: 10000, name: utils.assetsPath('img/[name].[ext]') } }, { test: /\.(mp4|webm|ogg|mp3|wav|flac|aac)(\?.*)?$/, loader: 'url-loader', options: { limit: 10000, name: utils.assetsPath('media/[name].[ext]') } }, { test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/, loader: 'url-loader', options: { limit: 10000, name: utils.assetsPath('fonts/[name].[ext]') } } ] }, plugins: [ new MpvuePlugin() ] } ================================================ FILE: build/webpack.dev.conf.js ================================================ var utils = require('./utils') var webpack = require('webpack') var config = require('../config') var merge = require('webpack-merge') var baseWebpackConfig = require('./webpack.base.conf') // var HtmlWebpackPlugin = require('html-webpack-plugin') var FriendlyErrorsPlugin = require('friendly-errors-webpack-plugin') // copy from ./webpack.prod.conf.js var path = require('path') var ExtractTextPlugin = require('extract-text-webpack-plugin') var CopyWebpackPlugin = require('copy-webpack-plugin') var OptimizeCSSPlugin = require('optimize-css-assets-webpack-plugin') // add hot-reload related code to entry chunks // Object.keys(baseWebpackConfig.entry).forEach(function (name) { // baseWebpackConfig.entry[name] = ['./build/dev-client'].concat(baseWebpackConfig.entry[name]) // }) module.exports = merge(baseWebpackConfig, { module: { rules: utils.styleLoaders({ sourceMap: config.dev.cssSourceMap, extract: true }) }, // cheap-module-eval-source-map is faster for development // devtool: '#cheap-module-eval-source-map', devtool: '#source-map', output: { path: config.build.assetsRoot, // filename: utils.assetsPath('js/[name].[chunkhash].js'), // chunkFilename: utils.assetsPath('js/[id].[chunkhash].js') filename: utils.assetsPath('js/[name].js'), chunkFilename: utils.assetsPath('js/[id].js') }, plugins: [ new webpack.DefinePlugin({ 'process.env': config.dev.env }), // copy from ./webpack.prod.conf.js // extract css into its own file new ExtractTextPlugin({ // filename: utils.assetsPath('css/[name].[contenthash].css') filename: utils.assetsPath('css/[name].wxss') }), // Compress extracted CSS. We are using this plugin so that possible // duplicated CSS from different components can be deduped. new OptimizeCSSPlugin({ cssProcessorOptions: { safe: true } }), new webpack.optimize.CommonsChunkPlugin({ name: 'vendor', minChunks: function (module, count) { // any required modules inside node_modules are extracted to vendor return ( module.resource && /\.js$/.test(module.resource) && module.resource.indexOf('node_modules') >= 0 ) || count > 1 } }), new webpack.optimize.CommonsChunkPlugin({ name: 'manifest', chunks: ['vendor'] }), // copy custom static assets new CopyWebpackPlugin([ { from: path.resolve(__dirname, '../static'), to: config.build.assetsSubDirectory, ignore: ['.*'] } ]), // https://github.com/glenjamin/webpack-hot-middleware#installation--usage // new webpack.HotModuleReplacementPlugin(), new webpack.NoEmitOnErrorsPlugin(), // https://github.com/ampedandwired/html-webpack-plugin // new HtmlWebpackPlugin({ // filename: 'index.html', // template: 'index.html', // inject: true // }), new FriendlyErrorsPlugin() ] }) ================================================ FILE: build/webpack.prod.conf.js ================================================ var path = require('path') var utils = require('./utils') var webpack = require('webpack') var config = require('../config') var merge = require('webpack-merge') var baseWebpackConfig = require('./webpack.base.conf') var UglifyJsPlugin = require('uglifyjs-webpack-plugin') var CopyWebpackPlugin = require('copy-webpack-plugin') // var HtmlWebpackPlugin = require('html-webpack-plugin') var ExtractTextPlugin = require('extract-text-webpack-plugin') var OptimizeCSSPlugin = require('optimize-css-assets-webpack-plugin') var env = config.build.env var webpackConfig = merge(baseWebpackConfig, { module: { rules: utils.styleLoaders({ sourceMap: config.build.productionSourceMap, extract: true }) }, devtool: config.build.productionSourceMap ? '#source-map' : false, output: { path: config.build.assetsRoot, // filename: utils.assetsPath('js/[name].[chunkhash].js'), // chunkFilename: utils.assetsPath('js/[id].[chunkhash].js') filename: utils.assetsPath('js/[name].js'), chunkFilename: utils.assetsPath('js/[id].js') }, plugins: [ // http://vuejs.github.io/vue-loader/en/workflow/production.html new webpack.DefinePlugin({ 'process.env': env }), new UglifyJsPlugin({ sourceMap: true }), // extract css into its own file new ExtractTextPlugin({ // filename: utils.assetsPath('css/[name].[contenthash].css') filename: utils.assetsPath('css/[name].wxss') }), // Compress extracted CSS. We are using this plugin so that possible // duplicated CSS from different components can be deduped. new OptimizeCSSPlugin({ cssProcessorOptions: { safe: true } }), // generate dist index.html with correct asset hash for caching. // you can customize output by editing /index.html // see https://github.com/ampedandwired/html-webpack-plugin // new HtmlWebpackPlugin({ // filename: config.build.index, // template: 'index.html', // inject: true, // minify: { // removeComments: true, // collapseWhitespace: true, // removeAttributeQuotes: true // // more options: // // https://github.com/kangax/html-minifier#options-quick-reference // }, // // necessary to consistently work with multiple chunks via CommonsChunkPlugin // chunksSortMode: 'dependency' // }), // keep module.id stable when vender modules does not change new webpack.HashedModuleIdsPlugin(), // split vendor js into its own file new webpack.optimize.CommonsChunkPlugin({ name: 'vendor', minChunks: function (module, count) { // any required modules inside node_modules are extracted to vendor return ( module.resource && /\.js$/.test(module.resource) && module.resource.indexOf('node_modules') >= 0 ) || count > 1 } }), // extract webpack runtime and module manifest to its own file in order to // prevent vendor hash from being updated whenever app bundle is updated new webpack.optimize.CommonsChunkPlugin({ name: 'manifest', chunks: ['vendor'] }), // copy custom static assets new CopyWebpackPlugin([ { from: path.resolve(__dirname, '../static'), to: config.build.assetsSubDirectory, ignore: ['.*'] } ]) ] }) // if (config.build.productionGzip) { // var CompressionWebpackPlugin = require('compression-webpack-plugin') // webpackConfig.plugins.push( // new CompressionWebpackPlugin({ // asset: '[path].gz[query]', // algorithm: 'gzip', // test: new RegExp( // '\\.(' + // config.build.productionGzipExtensions.join('|') + // ')$' // ), // threshold: 10240, // minRatio: 0.8 // }) // ) // } if (config.build.bundleAnalyzerReport) { var BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin webpackConfig.plugins.push(new BundleAnalyzerPlugin()) } module.exports = webpackConfig ================================================ FILE: config/dev.env.js ================================================ var merge = require('webpack-merge') var prodEnv = require('./prod.env') module.exports = merge(prodEnv, { NODE_ENV: '"development"' }) ================================================ FILE: config/index.js ================================================ // see http://vuejs-templates.github.io/webpack for documentation. var path = require('path') module.exports = { build: { env: require('./prod.env'), index: path.resolve(__dirname, '../dist/index.html'), assetsRoot: path.resolve(__dirname, '../dist'), assetsSubDirectory: 'static', assetsPublicPath: '/', productionSourceMap: false, // Gzip off by default as many popular static hosts such as // Surge or Netlify already gzip all static assets for you. // Before setting to `true`, make sure to: // npm install --save-dev compression-webpack-plugin productionGzip: false, productionGzipExtensions: ['js', 'css'], // Run the build command with an extra argument to // View the bundle analyzer report after build finishes: // `npm run build --report` // Set to `true` or `false` to always turn it on or off bundleAnalyzerReport: process.env.npm_config_report }, dev: { env: require('./dev.env'), port: 8080, // 在小程序开发者工具中不需要自动打开浏览器 autoOpenBrowser: false, assetsSubDirectory: 'static', assetsPublicPath: '/', proxyTable: {}, // CSS Sourcemaps off by default because relative paths are "buggy" // with this option, according to the CSS-Loader README // (https://github.com/webpack/css-loader#sourcemaps) // In our experience, they generally work as expected, // just be aware of this issue when enabling this option. cssSourceMap: false } } ================================================ FILE: config/prod.env.js ================================================ module.exports = { NODE_ENV: '"production"' } ================================================ FILE: index.html ================================================ mpvue-signin
================================================ FILE: package.json ================================================ { "name": "mpvue-signin", "version": "1.0.0", "description": "A Mpvue project", "author": "xiaotiandada <95282399@qq.com>", "private": true, "scripts": { "dev": "node build/dev-server.js", "start": "node build/dev-server.js", "build": "node build/build.js", "lint": "eslint --ext .js,.vue src" }, "dependencies": { "axios": "^0.18.0", "flyio": "^0.6.0", "less": "^3.8.0", "less-loader": "^4.1.0", "lodash": "^4.17.10", "mockjs": "^1.0.1-beta3", "mpvue": "^1.0.11", "vuex": "^3.0.1", "vuex-persistedstate": "^2.5.4" }, "devDependencies": { "babel-core": "^6.22.1", "babel-eslint": "^8.2.3", "babel-loader": "^7.1.1", "babel-plugin-transform-runtime": "^6.22.0", "babel-preset-env": "^1.3.2", "babel-preset-stage-2": "^6.22.0", "babel-register": "^6.22.0", "chalk": "^2.4.0", "connect-history-api-fallback": "^1.3.0", "copy-webpack-plugin": "^4.5.1", "css-loader": "^0.28.11", "cssnano": "^3.10.0", "eslint": "^4.19.1", "eslint-config-standard": "^11.0.0", "eslint-friendly-formatter": "^4.0.1", "eslint-loader": "^2.0.0", "eslint-plugin-html": "^4.0.3", "eslint-plugin-import": "^2.11.0", "eslint-plugin-node": "^6.0.1", "eslint-plugin-promise": "^3.4.0", "eslint-plugin-standard": "^3.0.1", "eventsource-polyfill": "^0.9.6", "express": "^4.16.3", "extract-text-webpack-plugin": "^3.0.2", "file-loader": "^1.1.11", "friendly-errors-webpack-plugin": "^1.7.0", "glob": "^7.1.2", "html-webpack-plugin": "^3.2.0", "http-proxy-middleware": "^0.18.0", "mpvue-loader": "1.0.13", "mpvue-template-compiler": "^1.0.11", "mpvue-webpack-target": "^1.0.0", "optimize-css-assets-webpack-plugin": "^3.2.0", "ora": "^2.0.0", "portfinder": "^1.0.13", "postcss-loader": "^2.1.4", "postcss-mpvue-wxss": "^1.0.0", "prettier": "~1.12.1", "px2rpx-loader": "^0.1.10", "rimraf": "^2.6.0", "semver": "^5.3.0", "shelljs": "^0.8.1", "uglifyjs-webpack-plugin": "^1.2.5", "url-loader": "^1.0.1", "vue-style-loader": "^4.1.0", "vuetron": "^1.1.3", "weapp.socket.io": "^2.0.1", "webpack": "^3.11.0", "webpack-bundle-analyzer": "^2.2.1", "webpack-dev-middleware-hard-disk": "^1.12.0", "webpack-merge": "^4.1.0", "webpack-mpvue-asset-plugin": "0.0.2" }, "engines": { "node": ">= 4.0.0", "npm": ">= 3.0.0" }, "browserslist": [ "> 1%", "last 2 versions", "not ie <= 8" ] } ================================================ FILE: project.config.json ================================================ { "description": "项目配置文件。", "setting": { "urlCheck": true, "es6": false, "postcss": true, "minified": true, "newFeature": true }, "miniprogramRoot": "./dist/", "compileType": "miniprogram", "appid": "touristappid", "projectname": "mpvue-signin", "condition": { "search": { "current": -1, "list": [] }, "conversation": { "current": -1, "list": [] }, "game": { "currentL": -1, "list": [] }, "miniprogram": { "current": -1, "list": [] } } } ================================================ FILE: src/App.vue ================================================ ================================================ FILE: src/components/card.vue ================================================ ================================================ FILE: src/components/deladdress.vue ================================================ ================================================ FILE: src/components/message.vue ================================================ ================================================ FILE: src/components/pay.vue ================================================ ================================================ FILE: src/main.js ================================================ import Vue from 'vue' import App from './App' import store from './store/index' Vue.config.productionTip = false App.mpType = 'app' Vue.prototype.$store = store const app = new Vue(App) app.$mount() export default { // 这个字段走 app.json config: { // 页面前带有 ^ 符号的,会被编译成首页,其他页面可以选填,我们会自动把 webpack entry 里面的入口页面加进去 pages: [ '^pages/index/main', 'pages/order/main', 'pages/shopp/main', 'pages/user/main' ], window: { backgroundTextStyle: 'light', navigationBarBackgroundColor: '#0097ff', navigationBarTitleText: '小优外卖', navigationBarTextStyle: 'white' }, tabBar: { color: '#6f6f6f', selectedColor: '#18a3ff', backgroundColor: '#ffffff', borderStyle: 'black', list: [ { pagePath: 'pages/index/main', iconPath: 'static/img/wm.png', selectedIconPath: 'static/img/wms.png', text: '外卖' }, { pagePath: 'pages/order/main', iconPath: 'static/img/dd.png', selectedIconPath: 'static/img/dds.png', text: '订单' }, { pagePath: 'pages/shopp/main', iconPath: 'static/img/tj1.png', selectedIconPath: 'static/img/tj1s.png', text: '推荐' }, { pagePath: 'pages/user/main', iconPath: 'static/img/user.png', selectedIconPath: 'static/img/users.png', text: '我的' } ] } } } ================================================ FILE: src/pages/address/index.vue ================================================ ================================================ FILE: src/pages/address/main.js ================================================ import Vue from 'vue' import App from './index' const app = new Vue(App) app.$mount() export default { config: { // 这儿添加要用的小程序组件 usingComponents: { 'i-icon': '../../static/dist/icon/index', 'i-cell-group': '../../static/dist/cell-group/index', 'i-cell': '../../static/dist/cell/index', 'i-radio': '../../static/dist/radio/index' } } } ================================================ FILE: src/pages/addressAdd/index.vue ================================================ ================================================ FILE: src/pages/addressAdd/main.js ================================================ import Vue from 'vue' import App from './index' const app = new Vue(App) app.$mount() export default { config: { // 这儿添加要用的小程序组件 usingComponents: { 'i-icon': '../../static/dist/icon/index', 'i-cell-group': '../../static/dist/cell-group/index', 'i-cell': '../../static/dist/cell/index', 'i-input': '../../static/dist/input/index', 'i-panel': '../../static/dist/panel/index' } } } ================================================ FILE: src/pages/addressUpdate/index.vue ================================================ ================================================ FILE: src/pages/addressUpdate/main.js ================================================ import Vue from 'vue' import App from './index' const app = new Vue(App) app.$mount() export default { config: { // 这儿添加要用的小程序组件 usingComponents: { 'i-icon': '../../static/dist/icon/index', 'i-cell-group': '../../static/dist/cell-group/index', 'i-cell': '../../static/dist/cell/index', 'i-input': '../../static/dist/input/index', 'i-panel': '../../static/dist/panel/index' } } } ================================================ FILE: src/pages/commodity/index.vue ================================================ ================================================ FILE: src/pages/commodity/main.js ================================================ import Vue from 'vue' import App from './index' const app = new Vue(App) app.$mount() export default { config: { // 这儿添加要用的小程序组件 usingComponents: { 'i-icon': '../../static/dist/icon/index', 'i-cell-group': '../../static/dist/cell-group/index', 'i-cell': '../../static/dist/cell/index' } } } ================================================ FILE: src/pages/commodity/store.js ================================================ // https://vuex.vuejs.org/zh-cn/intro.html // make sure to call Vue.use(Vuex) if using a module system import Vue from 'vue' import Vuex from 'vuex' Vue.use(Vuex) const store = new Vuex.Store({ state: { count: 0 }, mutations: { increment: (state) => { const obj = state obj.count += 1 }, decrement: (state) => { const obj = state obj.count -= 1 } } }) export default store ================================================ FILE: src/pages/contactmerchant/index.vue ================================================ ================================================ FILE: src/pages/contactmerchant/main.js ================================================ import Vue from 'vue' import App from './index' const app = new Vue(App) app.$mount() export default { config: { // 这儿添加要用的小程序组件 usingComponents: { 'i-cell-group': '../../static/dist/cell-group/index', 'i-cell': '../../static/dist/cell/index', 'i-icon': '../../static/dist/icon/index' } } } ================================================ FILE: src/pages/contactus/index.vue ================================================ ================================================ FILE: src/pages/contactus/main.js ================================================ import Vue from 'vue' import App from './index' const app = new Vue(App) app.$mount() export default { config: { // 这儿添加要用的小程序组件 usingComponents: { 'i-cell-group': '../../static/dist/cell-group/index', 'i-cell': '../../static/dist/cell/index', 'i-icon': '../../static/dist/icon/index' } } } ================================================ FILE: src/pages/counter/index.vue ================================================ ================================================ FILE: src/pages/counter/main.js ================================================ import Vue from 'vue' import App from './index' const app = new Vue(App) app.$mount() ================================================ FILE: src/pages/counter/store.js ================================================ // https://vuex.vuejs.org/zh-cn/intro.html // make sure to call Vue.use(Vuex) if using a module system import Vue from 'vue' import Vuex from 'vuex' Vue.use(Vuex) const store = new Vuex.Store({ state: { count: 0 }, mutations: { increment: (state) => { const obj = state obj.count += 1 }, decrement: (state) => { const obj = state obj.count -= 1 } } }) export default store ================================================ FILE: src/pages/feedback/index.vue ================================================ ================================================ FILE: src/pages/feedback/main.js ================================================ import Vue from 'vue' import App from './index' const app = new Vue(App) app.$mount() export default { config: { // 这儿添加要用的小程序组件 usingComponents: { 'i-input': '../../static/dist/input/index' } } } ================================================ FILE: src/pages/index/index.vue ================================================ ================================================ FILE: src/pages/index/main.js ================================================ import Vue from 'vue' import App from './index' const app = new Vue(App) app.$mount() // 添加 config json export default { config: { // 这儿添加要用的小程序组件 usingComponents: { 'i-row': '../../static/dist/row/index', 'i-col': '../../static/dist/col/index', 'i-button': '../../static/dist/button/index', 'i-input': '../../static/dist/input/index', 'i-tab-bar': '../../static/dist/tab-bar/index', 'i-tab-bar-item': '../../static/dist/tab-bar-item/index', 'i-divider': '../../static/dist/divider/index', 'i-card': '../../static/dist/card/index', 'i-grid': '../../static/dist/grid/index', 'i-grid-item': '../../static/dist/grid-item/index', 'i-grid-icon': '../../static/dist/grid-icon/index', 'i-grid-label': '../../static/dist/grid-label/index', 'i-spin': '../../static/dist/spin/index', 'i-icon': '../../static/dist/icon/index', 'i-load-more': '../../static/dist/load-more/index' } } } ================================================ FILE: src/pages/logs/index.vue ================================================ ================================================ FILE: src/pages/logs/main.js ================================================ import Vue from 'vue' import App from './index' const app = new Vue(App) app.$mount() export default { config: { navigationBarTitleText: '查看启动日志' } } ================================================ FILE: src/pages/order/index.vue ================================================ ================================================ FILE: src/pages/order/main.js ================================================ import Vue from 'vue' import App from './index' const app = new Vue(App) app.$mount() export default { config: { // 这儿添加要用的小程序组件 usingComponents: { 'i-cell-group': '../../static/dist/cell-group/index', 'i-cell': '../../static/dist/cell/index', 'i-icon': '../../static/dist/icon/index' } } } ================================================ FILE: src/pages/settlement/index.vue ================================================ ================================================ FILE: src/pages/settlement/main.js ================================================ import Vue from 'vue' import App from './index' const app = new Vue(App) app.$mount() export default { config: { // 这儿添加要用的小程序组件 usingComponents: { 'i-cell-group': '../../static/dist/cell-group/index', 'i-cell': '../../static/dist/cell/index' } } } ================================================ FILE: src/pages/shopp/index.vue ================================================ ================================================ FILE: src/pages/shopp/main.js ================================================ import Vue from 'vue' import App from './index' const app = new Vue(App) app.$mount() export default { config: { // 这儿添加要用的小程序组件 usingComponents: { 'i-load-more': '../../static/dist/load-more/index' } } } ================================================ FILE: src/pages/user/index.vue ================================================ ================================================ FILE: src/pages/user/main.js ================================================ import Vue from 'vue' import App from './index' const app = new Vue(App) app.$mount() export default { config: { // 这儿添加要用的小程序组件 usingComponents: { 'i-cell-group': '../../static/dist/cell-group/index', 'i-cell': '../../static/dist/cell/index', 'i-icon': '../../static/dist/icon/index' } } } ================================================ FILE: src/store/index.js ================================================ import Vue from 'vue' import Vuex from 'vuex' // import vuetron from 'vuetron ' import createPersistedState from 'vuex-persistedstate' import _ from 'lodash' Vue.use(Vuex) export default new Vuex.Store({ plugins: [ // 保持会话持久 createPersistedState({ storage: { getItem: key => wx.getStorageSync(key), // Please see https://github.com/js-cookie/js-cookie#json, on how to handle JSON. setItem: (key, value) => wx.getStorageSync(key, value), removeItem: key => wx.clearStorageSync(key) } }) ], state: { /** * 商家名字 commdityShoppingName: '', /** * 商家商品 */ commdityShopping: [], /** * 商家订单 */ commdityOrder: [], /** * 用户地址 后期使用数据库存储 */ userAddres: [], userOrderAddres: 0, // 意见反馈 feedbackList: [] }, mutations: { /** * 设置商家名称 * @param state * @param commdityShoppingName */ setCommdityShoppingName (state, commdityShoppingName) { state.commdityShoppingName = commdityShoppingName }, /** * 设置商家购物车商品 * @param state * @param commdityShopping */ setCommdityShopping (state, commdityShopping) { state.commdityShopping.push(commdityShopping) }, /** * 商家购物车商品添加 * @param state * @param commdityShoppingIndex */ setCommdityShoppingAdd (state, commdityShoppingIndex) { state.commdityShopping[commdityShoppingIndex].commoditySum++ }, /** * 商家购物车减少 * @param state * @param commdityShoppingIndex */ setCommdityShoppingLess (state, commdityShoppingIndex) { if (state.commdityShopping[commdityShoppingIndex].commoditySum >= 1) { state.commdityShopping[commdityShoppingIndex].commoditySum-- if (state.commdityShopping[commdityShoppingIndex].commoditySum === 0) { _.pullAt(state.commdityShopping, commdityShoppingIndex) } } }, /** * 清空商家购物车 * @param state */ setCommdityShoppingClear (state) { state.commdityShopping = [] }, /** * 将购物车的内容变成订单 * @param state * @param commdityOrder */ setCommdityOrder (state, commdityOrder) { let commdityOrderClone = _.clone(commdityOrder) state.commdityOrder.push(commdityOrderClone) }, /** * 设置用户收货地址 * @param state * @param userAddres */ setUserAddres (state, userAddres) { let userAddresClone = _.clone(userAddres) state.userAddres.push(userAddresClone) }, /** * 设置订单收货地址 * @param state * @param userOrderAddres */ setUserOrderAddres (state, userOrderAddres) { state.userOrderAddres = userOrderAddres }, /** * 更新用户收货地址 * @param state * @param userAddress */ updateUserAddress (state, userAddress) { state.userAddres[userAddress.index].addressName = userAddress.addressName state.userAddres[userAddress.index].addressPhone = userAddress.addressPhone state.userAddres[userAddress.index].addressDetail = userAddress.addressDetail }, /** * 删除用户收货地址 * @param state * @param userAddressIndex */ delUserAddress (state, userAddressIndex) { _.pullAt(state.userAddres, userAddressIndex) }, /** * 删除用户订单 * @param state * @param commdityOrderIndex */ delCommdityOrder (state, commdityOrderIndex) { _.pullAt(state.commdityOrder, commdityOrderIndex) }, /** * 增加意见反馈 * @param state * @param feedbackList */ addFeedbackList (state, feedbackList) { let feedbackListClone = _.clone(feedbackList) state.feedbackList.push(feedbackListClone) } }, /** * 下面调用上面的方法 */ actions: { setCommdityShoppingName ({ commit }, commdityShoppingName) { commit('setCommdityShoppingName', commdityShoppingName) }, setCommdityShopping ({commit}, commdityShopping) { commit('setCommdityShopping', commdityShopping) }, setCommdityShoppingAdd ({commit}, commdityShoppingIndex) { commit('setCommdityShoppingAdd', commdityShoppingIndex) }, setCommdityShoppingLess ({commit}, commdityShoppingIndex) { commit('setCommdityShoppingLess', commdityShoppingIndex) }, setCommdityShoppingClear ({commit}) { commit('setCommdityShoppingClear') }, setCommdityOrder ({commit}, commdityOrder) { commit('setCommdityOrder', commdityOrder) }, setUserAddres ({commit}, userAddres) { commit('setUserAddres', userAddres) }, setUserOrderAddres ({commit}, userOrderAddres) { commit('setUserOrderAddres', userOrderAddres) }, updateUserAddress ({commit}, userAddress) { commit('updateUserAddress', userAddress) }, delUserAddress ({commit}, userAddressIndex) { commit('delUserAddress', userAddressIndex) }, delCommdityOrder ({commit}, commdityOrderIndex) { commit('delCommdityOrder', commdityOrderIndex) }, addFeedbackList ({commit}, addFeedbackList) { commit('addFeedbackList', addFeedbackList) } } }) ================================================ FILE: src/utils/index.js ================================================ function formatNumber (n) { const str = n.toString() return str[1] ? str : `0${str}` } export function formatTime (date) { const year = date.getFullYear() const month = date.getMonth() + 1 const day = date.getDate() const hour = date.getHours() const minute = date.getMinutes() const second = date.getSeconds() const t1 = [year, month, day].map(formatNumber).join('/') const t2 = [hour, minute, second].map(formatNumber).join(':') return `${t1} ${t2}` } export default { formatNumber, formatTime } ================================================ FILE: static/.gitkeep ================================================