├── .babelrc ├── .editorconfig ├── .eslintignore ├── .eslintrc.js ├── .eslintrc.json ├── .gitignore ├── .idea ├── misc.xml ├── modules.xml ├── shopJd.iml ├── vcs.xml └── workspace.xml ├── .postcssrc.js ├── .project ├── .vscode └── launch.json ├── 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 ├── ppe.env.js ├── prod.env.js └── sit.env.js ├── index.html ├── package-lock.json ├── package.json ├── src ├── App.vue ├── assets │ ├── img │ │ ├── cion │ │ │ └── close.png │ │ └── lottery │ │ │ ├── Triangle@1x.png │ │ │ ├── banner.png │ │ │ ├── border.png │ │ │ ├── borderSelect.png │ │ │ ├── btn.png │ │ │ ├── circleLight.png │ │ │ ├── close.png │ │ │ ├── concernBtn.png │ │ │ ├── endLottery.png │ │ │ ├── flowers │ │ │ ├── 01.png │ │ │ ├── 02.png │ │ │ ├── 03.png │ │ │ ├── 04.png │ │ │ ├── 05.png │ │ │ ├── 06.png │ │ │ └── 07.png │ │ │ ├── noStart.png │ │ │ ├── noprizeXF.png │ │ │ ├── point.png │ │ │ ├── prize1.png │ │ │ ├── prizeBig │ │ │ ├── 1.png │ │ │ ├── 2.png │ │ │ ├── 3.png │ │ │ ├── 4.png │ │ │ ├── 5.png │ │ │ ├── 6.png │ │ │ ├── 7.png │ │ │ └── 8.png │ │ │ ├── prizeBtn.png │ │ │ ├── prizeBtnIng.png │ │ │ ├── prizeDetailBanner.png │ │ │ ├── prizeDetailIcon.png │ │ │ ├── prizeIcon.png │ │ │ ├── prizeInfo.png │ │ │ ├── prizeSmall │ │ │ ├── 1.png │ │ │ ├── 2.png │ │ │ ├── 3.png │ │ │ ├── 4.png │ │ │ ├── 5.png │ │ │ ├── 6.png │ │ │ ├── 7.png │ │ │ └── 8.png │ │ │ ├── prizers.png │ │ │ ├── prizinig.png │ │ │ ├── receivedXF.png │ │ │ ├── receivedXF1.png │ │ │ ├── three.png │ │ │ ├── tip.png │ │ │ ├── whiteBar.png │ │ │ ├── yellowCycle.png │ │ │ └── 抽奖-转盘底纹.png │ ├── js │ │ ├── browser.js │ │ ├── filters.js │ │ ├── mixin.js │ │ └── rem.js │ └── less │ │ └── public.less ├── components │ └── province_twon.vue ├── main.js ├── router │ ├── index.js │ └── router_lottery.js ├── utils │ └── inputFormat.js └── view │ ├── index │ └── index.vue │ └── lottery │ ├── lottery.vue │ └── lotteryRecord.vue ├── static ├── data │ ├── lotteryInfo.json │ ├── lotteryRecord.json │ └── prizeInfo.json ├── favicon.ico └── js │ └── vendor.dll.js └── test └── e2e ├── custom-assertions └── elementCount.js ├── nightwatch.conf.js ├── runner.js └── specs └── test.js /.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": [ 3 | ["env", { "modules": false }], 4 | "stage-2" 5 | ], 6 | "plugins": ["transform-runtime"], 7 | "comments": false, 8 | "env": { 9 | "test": { 10 | "presets": ["env", "stage-2"], 11 | "plugins": [ "istanbul" ] 12 | } 13 | } 14 | } -------------------------------------------------------------------------------- /.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 | -------------------------------------------------------------------------------- /.eslintignore: -------------------------------------------------------------------------------- 1 | build/*.js 2 | config/*.js 3 | node_modules/**.* 4 | -------------------------------------------------------------------------------- /.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | root: true, 3 | parser: 'babel-eslint', 4 | parserOptions: { 5 | sourceType: 'module' 6 | }, 7 | env: { 8 | browser: true, 9 | node: true, 10 | es6: true, 11 | }, 12 | extends: 'eslint:recommended', 13 | // required to lint *.vue files 14 | plugins: [ 15 | 'html' 16 | ], 17 | // check if imports actually resolve 18 | 'settings': { 19 | 'import/resolver': { 20 | 'webpack': { 21 | 'config': 'build/webpack.base.conf.js' 22 | } 23 | } 24 | }, 25 | // add your custom rules here 26 | //it is base on https://github.com/vuejs/eslint-config-vue 27 | 'rules': { 28 | 'accessor-pairs': 2, 29 | 'arrow-spacing': [2, { 'before': true, 'after': true }], 30 | 'block-spacing': [2, 'always'], 31 | 'brace-style': [2, '1tbs', { 'allowSingleLine': true }], 32 | 'camelcase': [0, { 'properties': 'always' }], 33 | 'comma-dangle': [2, 'never'], 34 | 'comma-spacing': [2, { 'before': false, 'after': true }], 35 | 'comma-style': [2, 'last'], 36 | 'constructor-super': 2, 37 | 'curly': [2, 'multi-line'], 38 | 'dot-location': [2, 'property'], 39 | 'eol-last': 2, 40 | 'eqeqeq': [0, 'allow-null'], 41 | 'generator-star-spacing': [2, { 'before': true, 'after': true }], 42 | 'handle-callback-err': [2, '^(err|error)$' ], 43 | 'indent': [2, 2, { 'SwitchCase': 1 }], 44 | 'jsx-quotes': [2, 'prefer-single'], 45 | 'key-spacing': [2, { 'beforeColon': false, 'afterColon': true }], 46 | 'keyword-spacing': [2, { 'before': true, 'after': true }], 47 | 'new-cap': [2, { 'newIsCap': true, 'capIsNew': false }], 48 | 'new-parens': 2, 49 | 'no-array-constructor': 2, 50 | 'no-caller': 2, 51 | 'no-console': 'off', 52 | 'no-class-assign': 2, 53 | 'no-cond-assign': 2, 54 | 'no-const-assign': 2, 55 | 'no-control-regex': 2, 56 | 'no-delete-var': 2, 57 | 'no-dupe-args': 2, 58 | 'no-dupe-class-members': 2, 59 | 'no-dupe-keys': 2, 60 | 'no-duplicate-case': 2, 61 | 'no-empty-character-class': 2, 62 | 'no-empty-pattern': 2, 63 | 'no-eval': 2, 64 | 'no-ex-assign': 2, 65 | 'no-extend-native': 2, 66 | 'no-extra-bind': 2, 67 | 'no-extra-boolean-cast': 2, 68 | 'no-extra-parens': [2, 'functions'], 69 | 'no-fallthrough': 2, 70 | 'no-floating-decimal': 2, 71 | 'no-func-assign': 2, 72 | 'no-implied-eval': 2, 73 | 'no-inner-declarations': [2, 'functions'], 74 | 'no-invalid-regexp': 2, 75 | 'no-irregular-whitespace': 2, 76 | 'no-iterator': 2, 77 | 'no-label-var': 2, 78 | 'no-labels': [2, { 'allowLoop': false, 'allowSwitch': false }], 79 | 'no-lone-blocks': 2, 80 | 'no-mixed-spaces-and-tabs': 2, 81 | 'no-multi-spaces': 2, 82 | 'no-multi-str': 2, 83 | 'no-multiple-empty-lines': [2, { 'max': 1 }], 84 | 'no-native-reassign': 2, 85 | 'no-negated-in-lhs': 2, 86 | 'no-new-object': 2, 87 | 'no-new-require': 2, 88 | 'no-new-symbol': 2, 89 | 'no-new-wrappers': 2, 90 | 'no-obj-calls': 2, 91 | 'no-octal': 2, 92 | 'no-octal-escape': 2, 93 | 'no-path-concat': 2, 94 | 'no-proto': 2, 95 | 'no-redeclare': 2, 96 | 'no-regex-spaces': 2, 97 | 'no-return-assign': [2, 'except-parens'], 98 | 'no-self-assign': 2, 99 | 'no-self-compare': 2, 100 | 'no-sequences': 2, 101 | 'no-shadow-restricted-names': 2, 102 | 'no-spaced-func': 2, 103 | 'no-sparse-arrays': 2, 104 | 'no-this-before-super': 2, 105 | 'no-throw-literal': 2, 106 | 'no-trailing-spaces': 2, 107 | 'no-undef': 2, 108 | 'no-undef-init': 2, 109 | 'no-unexpected-multiline': 2, 110 | 'no-unmodified-loop-condition': 2, 111 | 'no-unneeded-ternary': [2, { 'defaultAssignment': false }], 112 | 'no-unreachable': 2, 113 | 'no-unsafe-finally': 2, 114 | 'no-unused-vars': [2, { 'vars': 'all', 'args': 'none' }], 115 | 'no-useless-call': 2, 116 | 'no-useless-computed-key': 2, 117 | 'no-useless-constructor': 2, 118 | 'no-useless-escape': 0, 119 | 'no-whitespace-before-property': 2, 120 | 'no-with': 2, 121 | 'one-var': [2, { 'initialized': 'never' }], 122 | 'operator-linebreak': [2, 'after', { 'overrides': { '?': 'before', ':': 'before' } }], 123 | 'padded-blocks': [2, 'never'], 124 | 'quotes': [2, 'single', { 'avoidEscape': true, 'allowTemplateLiterals': true }], 125 | 'semi': [2, 'never'], 126 | 'semi-spacing': [2, { 'before': false, 'after': true }], 127 | 'space-before-blocks': [2, 'always'], 128 | 'space-before-function-paren': [2, 'never'], 129 | 'space-in-parens': [2, 'never'], 130 | 'space-infix-ops': 2, 131 | 'space-unary-ops': [2, { 'words': true, 'nonwords': false }], 132 | 'spaced-comment': [2, 'always', { 'markers': ['global', 'globals', 'eslint', 'eslint-disable', '*package', '!', ','] }], 133 | 'template-curly-spacing': [2, 'never'], 134 | 'use-isnan': 2, 135 | 'valid-typeof': 2, 136 | 'wrap-iife': [2, 'any'], 137 | 'yield-star-spacing': [2, 'both'], 138 | 'yoda': [2, 'never'], 139 | 'prefer-const': 2, 140 | 'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0, 141 | 'object-curly-spacing': [2, 'always', { objectsInObjects: false }], 142 | 'array-bracket-spacing': [2, 'never'] 143 | } 144 | } -------------------------------------------------------------------------------- /.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "env": { 3 | "browser": true, 4 | "node": true 5 | }, 6 | "rules": { 7 | "no-undef": 1, 8 | "no-new": 0, 9 | "no-tabs": 0, 10 | "indent": 1, 11 | "no-mixed-spaces-and-tabs": [0, false], 12 | "camelcase": 0, 13 | "eqeqeq": 0, 14 | "arrow-parens": 0, 15 | "generator-star-spacing": 0, 16 | "semi": 0, 17 | "quotes": [ 18 | "error", 19 | "single" 20 | ] 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | node_modules/ 3 | dist/ 4 | build/ 5 | config/ 6 | index.html 7 | npm-debug.log* 8 | yarn-debug.log* 9 | yarn-error.log* 10 | test/e2e/reports 11 | selenium-debug.log 12 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 16 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /.idea/shopJd.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.idea/workspace.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 14 | 15 | 16 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | true 61 | 62 | 63 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 101 | 102 | 103 | 104 | 107 | 108 | 111 | 112 | 113 | 114 | 117 | 118 | 121 | 122 | 125 | 126 | 127 | 128 | 131 | 132 | 135 | 136 | 139 | 140 | 143 | 144 | 145 | 146 | 149 | 150 | 153 | 154 | 157 | 158 | 161 | 162 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 187 | 188 | C:\Users\Leon\AppData\Roaming\Subversion 189 | 190 | 191 | 192 | 193 | 1502258631276 194 | 199 | 200 | 201 | 202 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 231 | 234 | 235 | 236 | 238 | 239 | 240 | 241 | 242 | 243 | 244 | 245 | 246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | 257 | 258 | 259 | 260 | 261 | 262 | -------------------------------------------------------------------------------- /.postcssrc.js: -------------------------------------------------------------------------------- 1 | // https://github.com/michael-ciniawsky/postcss-load-config 2 | 3 | module.exports = { 4 | "plugins": { 5 | // to edit target browsers: use "browserlist" field in package.json 6 | "autoprefixer": {} 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | vuecli-build 4 | 5 | 6 | 7 | 8 | 9 | com.aptana.ide.core.unifiedBuilder 10 | 11 | 12 | 13 | 14 | 15 | com.aptana.projects.webnature 16 | 17 | 18 | 19 | 1505815925860 20 | 21 | 26 22 | 23 | org.eclipse.ui.ide.multiFilter 24 | 1.0-name-matches-false-false-node_modules 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "0.2.0", 3 | "configurations": [ 4 | 5 | { 6 | "type": "node", 7 | "request": "launch", 8 | "name": "Launch via NPM", 9 | "runtimeExecutable": "npm", 10 | "windows": { 11 | "runtimeExecutable": "npm.cmd" 12 | }, 13 | "runtimeArgs": [ 14 | "run dev" 15 | ], 16 | "port": 5858 17 | }, 18 | { 19 | "type": "chrome", 20 | "request": "launch", 21 | "name": "Launch Chrome against localhost", 22 | "url": "http://localhost:2222", 23 | "webRoot": "${workspaceRoot}" 24 | }, 25 | { 26 | "type": "chrome", 27 | "request": "attach", 28 | "name": "Attach to Chrome", 29 | "port": 9222, 30 | "webRoot": "${workspaceRoot}" 31 | } 32 | ] 33 | } -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # vuedemo 2 | 3 | > A Vue.js project 4 | 5 | 6 | ### 7 | *** 8 | * 不同环境调用不同的接口,分为开发环境,测试环境,预生产环境,生产环境, 9 | * 本地调用接口,实用proxyTable代理 10 | * 使用DllReferencePlugin将第三方资源分离打包,提高打包速度 11 | 12 | 13 | 安装 vue-cli 14 | ``` 15 | npm install -g vue-cli 16 | ``` 17 | 18 | 安装 19 | ``` 20 | npm install 21 | ``` 22 | 23 | 24 | 25 | 启动开发环境 26 | ``` 27 | npm run dev 28 | ``` 29 | 30 | 31 | 32 | 打包到生产环境 33 | ``` 34 | npm run build 35 | ``` 36 | 37 | 38 | 打包到预生产环境 39 | ``` 40 | npm run buildppe 41 | ``` 42 | 43 | 44 | 打包到测试产环境 45 | ``` 46 | npm run buildtest 47 | ``` 48 | 49 | 50 | 51 | 将第三方资源分离打包,提高打包速度 52 | ``` 53 | npm run build:dll 54 | ``` 55 | 56 | ``` 57 | *新增demo,vue九宫格抽奖 58 | 59 | ``` 60 | *** 61 | * config中配合本地代理,处理跨域 62 | * package.json为项目拷贝文件,可忽略 63 | *** 64 | 65 | 66 | -------------------------------------------------------------------------------- /build/build.js: -------------------------------------------------------------------------------- 1 | require('./check-versions')() 2 | 3 | // process.env.NODE_ENV = 'production' 4 | 5 | var ora = require('ora') 6 | var rm = require('rimraf') 7 | var path = require('path') 8 | var chalk = require('chalk') 9 | var webpack = require('webpack') 10 | var config = require('../config') 11 | var webpackConfig = require('./webpack.prod.conf') 12 | 13 | var spinner = ora('building for ' + process.env.NODE_ENV + ' of ' + process.env.env_config+ ' mode...' ) 14 | spinner.start() 15 | 16 | rm(path.join(config.build.assetsRoot, config.build.assetsSubDirectory), err => { 17 | if (err) throw err 18 | webpack(webpackConfig, function (err, stats) { 19 | spinner.stop() 20 | if (err) throw err 21 | process.stdout.write(stats.toString({ 22 | colors: true, 23 | modules: false, 24 | children: false, 25 | chunks: false, 26 | chunkModules: false 27 | }) + '\n\n') 28 | 29 | console.log(chalk.cyan(' Build complete.\n')) 30 | console.log(chalk.yellow( 31 | ' Tip: built files are meant to be served over an HTTP server.\n' + 32 | ' Opening index.html over file:// won\'t work.\n' 33 | )) 34 | }) 35 | }) -------------------------------------------------------------------------------- /build/check-versions.js: -------------------------------------------------------------------------------- 1 | var chalk = require('chalk') 2 | var semver = require('semver') 3 | var packageConfig = require('../package.json') 4 | 5 | function exec (cmd) { 6 | return require('child_process').execSync(cmd).toString().trim() 7 | } 8 | 9 | var versionRequirements = [ 10 | { 11 | name: 'node', 12 | currentVersion: semver.clean(process.version), 13 | versionRequirement: packageConfig.engines.node 14 | }, 15 | { 16 | name: 'npm', 17 | currentVersion: exec('npm --version'), 18 | versionRequirement: packageConfig.engines.npm 19 | } 20 | ] 21 | 22 | module.exports = function () { 23 | var warnings = [] 24 | for (var i = 0; i < versionRequirements.length; i++) { 25 | var mod = versionRequirements[i] 26 | if (!semver.satisfies(mod.currentVersion, mod.versionRequirement)) { 27 | warnings.push(mod.name + ': ' + 28 | chalk.red(mod.currentVersion) + ' should be ' + 29 | chalk.green(mod.versionRequirement) 30 | ) 31 | } 32 | } 33 | 34 | if (warnings.length) { 35 | console.log('') 36 | console.log(chalk.yellow('To use this template, you must update following to modules:')) 37 | console.log() 38 | for (var i = 0; i < warnings.length; i++) { 39 | var warning = warnings[i] 40 | console.log(' ' + warning) 41 | } 42 | console.log() 43 | process.exit(1) 44 | } 45 | } -------------------------------------------------------------------------------- /build/dev-client.js: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | 'use strict' 3 | require('eventsource-polyfill') 4 | var hotClient = require('webpack-hot-middleware/client?noInfo=true&reload=true') 5 | 6 | hotClient.subscribe(function (event) { 7 | if (event.action === 'reload') { 8 | window.location.reload() 9 | } 10 | }) 11 | -------------------------------------------------------------------------------- /build/dev-server.js: -------------------------------------------------------------------------------- 1 | require('./check-versions')() 2 | 3 | var config = require('../config') 4 | if (!process.env.NODE_ENV) { 5 | process.env.NODE_ENV = JSON.parse(config.dev.env.NODE_ENV) 6 | } 7 | 8 | var opn = require('opn') 9 | var path = require('path') 10 | var express = require('express') 11 | var webpack = require('webpack') 12 | var proxyMiddleware = require('http-proxy-middleware') 13 | var webpackConfig = process.env.NODE_ENV === 'testing' ? 14 | require('./webpack.prod.conf') : 15 | require('./webpack.dev.conf') 16 | 17 | // default port where dev server listens for incoming traffic 18 | var port = process.env.PORT || config.dev.port 19 | // automatically open browser, if not set will be false 20 | var autoOpenBrowser = !!config.dev.autoOpenBrowser 21 | // Define HTTP proxies to your custom API backend 22 | // https://github.com/chimurai/http-proxy-middleware 23 | var proxyTable = config.dev.proxyTable 24 | 25 | var app = express() 26 | var compiler = webpack(webpackConfig) 27 | 28 | var devMiddleware = require('webpack-dev-middleware')(compiler, { 29 | publicPath: webpackConfig.output.publicPath, 30 | quiet: true 31 | }) 32 | 33 | var hotMiddleware = require('webpack-hot-middleware')(compiler, { 34 | log: () => {} 35 | }) 36 | // force page reload when html-webpack-plugin template changes 37 | compiler.plugin('compilation', function(compilation) { 38 | compilation.plugin('html-webpack-plugin-after-emit', function(data, cb) { 39 | hotMiddleware.publish({ action: 'reload' }) 40 | cb() 41 | }) 42 | }) 43 | 44 | // proxy api requests 45 | Object.keys(proxyTable).forEach(function(context) { 46 | var options = proxyTable[context] 47 | if (typeof options === 'string') { 48 | options = { target: options } 49 | } 50 | app.use(proxyMiddleware(options.filter || context, options)) 51 | }) 52 | 53 | // handle fallback for HTML5 history API 54 | app.use(require('connect-history-api-fallback')()) 55 | 56 | // serve webpack bundle output 57 | app.use(devMiddleware) 58 | 59 | // enable hot-reload and state-preserving 60 | // compilation error display 61 | app.use(hotMiddleware) 62 | 63 | // serve pure static assets 64 | var staticPath = path.posix.join(config.dev.assetsPublicPath, config.dev.assetsSubDirectory) 65 | app.use(staticPath, express.static('./static')) 66 | 67 | var uri = 'http://localhost:' + port 68 | // var uri = 's.avicare.cn:' + port 69 | // var uri = 'http://192.168.1.110:' + port 70 | // var uri = 'http://192.168.199.192:'+ port 71 | // var uri = 'http://169.254.199.95:'+ port 72 | 73 | var _resolve 74 | var readyPromise = new Promise(resolve => { 75 | _resolve = resolve 76 | }) 77 | 78 | console.log('> Starting dev server...') 79 | devMiddleware.waitUntilValid(() => { 80 | console.log('> Listening at ' + uri + '\n') 81 | // when env is testing, don't need open it 82 | if (autoOpenBrowser && process.env.NODE_ENV !== 'testing') { 83 | opn(uri) 84 | } 85 | _resolve() 86 | }) 87 | 88 | var server = app.listen(port) 89 | 90 | module.exports = { 91 | ready: readyPromise, 92 | close: () => { 93 | server.close() 94 | } 95 | } -------------------------------------------------------------------------------- /build/utils.js: -------------------------------------------------------------------------------- 1 | var path = require('path') 2 | var config = require('../config') 3 | var ExtractTextPlugin = require('extract-text-webpack-plugin') 4 | 5 | exports.assetsPath = function (_path) { 6 | var assetsSubDirectory = process.env.NODE_ENV === 'production' 7 | ? config.build.assetsSubDirectory 8 | : config.dev.assetsSubDirectory 9 | return path.posix.join(assetsSubDirectory, _path) 10 | } 11 | 12 | exports.cssLoaders = function (options) { 13 | options = options || {} 14 | 15 | var cssLoader = { 16 | loader: 'css-loader', 17 | options: { 18 | minimize: process.env.NODE_ENV === 'production', 19 | sourceMap: options.sourceMap 20 | } 21 | } 22 | 23 | // generate loader string to be used with extract text plugin 24 | function generateLoaders (loader, loaderOptions) { 25 | var loaders = [cssLoader] 26 | if (loader) { 27 | loaders.push({ 28 | loader: loader + '-loader', 29 | options: Object.assign({}, loaderOptions, { 30 | sourceMap: options.sourceMap 31 | }) 32 | }) 33 | } 34 | 35 | // Extract CSS when that option is specified 36 | // (which is the case during production build) 37 | if (options.extract) { 38 | return ExtractTextPlugin.extract({ 39 | use: loaders, 40 | fallback: 'vue-style-loader' 41 | }) 42 | } else { 43 | return ['vue-style-loader'].concat(loaders) 44 | } 45 | } 46 | 47 | // https://vue-loader.vuejs.org/en/configurations/extract-css.html 48 | return { 49 | css: generateLoaders(), 50 | postcss: generateLoaders(), 51 | less: generateLoaders('less'), 52 | sass: generateLoaders('sass', { indentedSyntax: true }), 53 | scss: generateLoaders('sass'), 54 | stylus: generateLoaders('stylus'), 55 | styl: generateLoaders('stylus') 56 | } 57 | } 58 | 59 | // Generate loaders for standalone style files (outside of .vue) 60 | exports.styleLoaders = function (options) { 61 | var output = [] 62 | var loaders = exports.cssLoaders(options) 63 | for (var extension in loaders) { 64 | var loader = loaders[extension] 65 | output.push({ 66 | test: new RegExp('\\.' + extension + '$'), 67 | use: loader 68 | }) 69 | } 70 | return output 71 | } -------------------------------------------------------------------------------- /build/vue-loader.conf.js: -------------------------------------------------------------------------------- 1 | var utils = require('./utils') 2 | var config = require('../config') 3 | var isProduction = process.env.NODE_ENV === 'production' 4 | 5 | module.exports = { 6 | loaders: utils.cssLoaders({ 7 | sourceMap: isProduction 8 | ? config.build.productionSourceMap 9 | : config.dev.cssSourceMap, 10 | extract: isProduction 11 | }) 12 | } 13 | -------------------------------------------------------------------------------- /build/webpack.base.conf.js: -------------------------------------------------------------------------------- 1 | var path = require('path') 2 | var utils = require('./utils') 3 | var config = require('../config') 4 | var vueLoaderConfig = require('./vue-loader.conf') 5 | 6 | function resolve(dir) { 7 | return path.join(__dirname, '..', dir) 8 | } 9 | 10 | module.exports = { 11 | entry: { 12 | app: './src/main.js' 13 | }, 14 | output: { 15 | path: config.build.assetsRoot, 16 | filename: '[name].js', 17 | // publicPath: process.env.NODE_ENV === 'production' ? 18 | // config.build.assetsPublicPath : 19 | // config.dev.assetsPublicPath 20 | publicPath: process.env.NODE_ENV === 'development' ? 21 | config.dev.assetsPublicPath : config.build.assetsPublicPath 22 | }, 23 | resolve: { 24 | extensions: ['.js', '.vue', '.json'], 25 | alias: { 26 | 'vue$': 'vue/dist/vue.esm.js', 27 | '@': resolve('src') 28 | } 29 | }, 30 | module: { 31 | rules: [ 32 | // { 33 | // test: /\.(js|vue)$/, 34 | // loader: 'eslint-loader', 35 | // enforce: 'pre', 36 | // include: [resolve('src'), resolve('test')], 37 | // options: { 38 | // formatter: require('eslint-friendly-formatter') 39 | // } 40 | // }, 41 | { 42 | test: /\.vue$/, 43 | loader: 'vue-loader', 44 | options: vueLoaderConfig 45 | }, 46 | { 47 | test: /\.js$/, 48 | loader: 'babel-loader', 49 | include: [resolve('src'), resolve('test')] 50 | }, 51 | { 52 | test: /\.(png|jpe?g|gif|svg)(\?.*)?$/, 53 | loader: 'url-loader', 54 | options: { 55 | limit: 10000, 56 | name: utils.assetsPath('img/[name].[hash:7].[ext]') 57 | } 58 | }, 59 | { 60 | test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/, 61 | loader: 'url-loader', 62 | options: { 63 | limit: 10000, 64 | name: utils.assetsPath('fonts/[name].[hash:7].[ext]') 65 | } 66 | }, 67 | { 68 | test: /vue-preview.src.*?js$/, 69 | loader: 'babel' 70 | } 71 | 72 | ] 73 | } 74 | } -------------------------------------------------------------------------------- /build/webpack.dev.conf.js: -------------------------------------------------------------------------------- 1 | var path = require('path') 2 | var utils = require('./utils') 3 | var webpack = require('webpack') 4 | var config = require('../config') 5 | var merge = require('webpack-merge') 6 | var baseWebpackConfig = require('./webpack.base.conf') 7 | var HtmlWebpackPlugin = require('html-webpack-plugin') 8 | var FriendlyErrorsPlugin = require('friendly-errors-webpack-plugin') 9 | 10 | // add hot-reload related code to entry chunks 11 | Object.keys(baseWebpackConfig.entry).forEach(function (name) { 12 | baseWebpackConfig.entry[name] = ['./build/dev-client'].concat(baseWebpackConfig.entry[name]) 13 | }) 14 | function resolveApp(relativePath) { 15 | return path.resolve(relativePath); 16 | } 17 | module.exports = merge(baseWebpackConfig, { 18 | module: { 19 | rules: utils.styleLoaders({ sourceMap: config.dev.cssSourceMap }) 20 | }, 21 | // cheap-module-eval-source-map is faster for development 22 | devtool: '#cheap-module-eval-source-map', 23 | plugins: [ 24 | new webpack.DefinePlugin({ 25 | 'process.env': config.dev.env 26 | }), 27 | // https://github.com/glenjamin/webpack-hot-middleware#installation--usage 28 | new webpack.HotModuleReplacementPlugin(), 29 | new webpack.NoEmitOnErrorsPlugin(), 30 | // https://github.com/ampedandwired/html-webpack-plugin 31 | new HtmlWebpackPlugin({ 32 | filename: 'index.html', 33 | template: 'index.html', 34 | // favicon: resolveApp('favicon.ico'), 35 | inject: true 36 | }), 37 | new FriendlyErrorsPlugin() 38 | ] 39 | }) -------------------------------------------------------------------------------- /build/webpack.prod.conf.js: -------------------------------------------------------------------------------- 1 | var path = require('path') 2 | var utils = require('./utils') 3 | var webpack = require('webpack') 4 | var config = require('../config') 5 | var merge = require('webpack-merge') 6 | var baseWebpackConfig = require('./webpack.base.conf') 7 | var CopyWebpackPlugin = require('copy-webpack-plugin') 8 | var HtmlWebpackPlugin = require('html-webpack-plugin') 9 | var ExtractTextPlugin = require('extract-text-webpack-plugin') 10 | var OptimizeCSSPlugin = require('optimize-css-assets-webpack-plugin') 11 | 12 | const env = config.build[process.env.env_config+'Env'] 13 | // var env = process.env.NODE_ENV === 'testing' ? 14 | // require('../config/test.env') : 15 | // config.build.env 16 | function resolveApp(relativePath) { 17 | return path.resolve(relativePath); 18 | } 19 | var webpackConfig = merge(baseWebpackConfig, { 20 | module: { 21 | rules: utils.styleLoaders({ 22 | sourceMap: config.build.productionSourceMap, 23 | extract: true 24 | }) 25 | }, 26 | // devtool: config.build.productionSourceMap ? '#source-map' : false, 27 | devtool: false, 28 | output: { 29 | path: config.build.assetsRoot, 30 | filename: utils.assetsPath('js/[name].[chunkhash].js'), 31 | chunkFilename: utils.assetsPath('js/[id].[chunkhash].js') 32 | // filename: utils.assetsPath('js/[name].js'), 33 | // chunkFilename: utils.assetsPath('js/[id].js') 34 | }, 35 | plugins: [ 36 | // http://vuejs.github.io/vue-loader/en/workflow/production.html 37 | new webpack.DefinePlugin({ 38 | 'process.env': env 39 | }), 40 | new webpack.optimize.UglifyJsPlugin({ 41 | compress: { 42 | warnings: false, 43 | drop_debugger: true,//打包后移除debugger 44 | drop_console: true,//打包后移除console 45 | pure_funcs: ['console.log']//打包后移除console 46 | }, 47 | sourceMap: false 48 | }), 49 | // extract css into its own file 50 | new ExtractTextPlugin({ 51 | filename: utils.assetsPath('css/[name].[contenthash].css') 52 | // filename: utils.assetsPath('css/[name].css') 53 | }), 54 | // Compress extracted CSS. We are using this plugin so that possible 55 | // duplicated CSS from different components can be deduped. 56 | new OptimizeCSSPlugin({ 57 | cssProcessorOptions: { 58 | safe: true 59 | } 60 | }), 61 | // generate dist index.html with correct asset hash for caching. 62 | // you can customize output by editing /index.html 63 | // see https://github.com/ampedandwired/html-webpack-plugin 64 | new HtmlWebpackPlugin({ 65 | filename: process.env.NODE_ENV === 'testing' ? 66 | 'index.html' : config.build.index, 67 | template: 'index.html', 68 | favicon: resolveApp('favicon.ico'), 69 | inject: true, 70 | minify: { 71 | removeComments: true, 72 | collapseWhitespace: true, 73 | removeAttributeQuotes: true 74 | // more options: 75 | // https://github.com/kangax/html-minifier#options-quick-reference 76 | }, 77 | // necessary to consistently work with multiple chunks via CommonsChunkPlugin 78 | chunksSortMode: 'dependency' 79 | }), 80 | // split vendor js into its own file 81 | new webpack.optimize.CommonsChunkPlugin({ 82 | name: 'vendor', 83 | minChunks: function(module, count) { 84 | // any required modules inside node_modules are extracted to vendor 85 | return ( 86 | module.resource && 87 | /\.js$/.test(module.resource) && 88 | module.resource.indexOf( 89 | path.join(__dirname, '../node_modules') 90 | ) === 0 91 | ) 92 | } 93 | }), 94 | // extract webpack runtime and module manifest to its own file in order to 95 | // prevent vendor hash from being updated whenever app bundle is updated 96 | new webpack.optimize.CommonsChunkPlugin({ 97 | name: 'manifest', 98 | chunks: ['vendor'] 99 | }), 100 | // copy custom static assets 101 | new CopyWebpackPlugin([{ 102 | from: path.resolve(__dirname, '../static'), 103 | to: config.build.assetsSubDirectory, 104 | ignore: ['config.js'] 105 | }]), 106 | new CopyWebpackPlugin([{ 107 | from: path.resolve(__dirname, '../static/config'), 108 | to: config.build.assetsRoot + '/config', 109 | // to: config.build.assetsRoot + '.static/config', 110 | // to: config.build.assetsSubDirectory, 111 | ignore: ['.*'] 112 | }]), 113 | 114 | 115 | ] 116 | }) 117 | 118 | if (config.build.productionGzip) { 119 | var CompressionWebpackPlugin = require('compression-webpack-plugin') 120 | 121 | webpackConfig.plugins.push( 122 | new CompressionWebpackPlugin({ 123 | asset: '[path].gz[query]', 124 | algorithm: 'gzip', 125 | test: new RegExp( 126 | '\\.(' + 127 | config.build.productionGzipExtensions.join('|') + 128 | ')$' 129 | ), 130 | threshold: 10240, 131 | minRatio: 0.8 132 | }) 133 | ) 134 | } 135 | 136 | if (config.build.bundleAnalyzerReport) { 137 | var BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin 138 | webpackConfig.plugins.push(new BundleAnalyzerPlugin()) 139 | } 140 | 141 | module.exports = webpackConfig -------------------------------------------------------------------------------- /config/dev.env.js: -------------------------------------------------------------------------------- 1 | var merge = require('webpack-merge') 2 | var sitEnv = require('./sit.env') 3 | // var sitEnv = require('./prod.env') 4 | 5 | module.exports = merge(sitEnv, { 6 | NODE_ENV: '"development"', 7 | }) 8 | -------------------------------------------------------------------------------- /config/index.js: -------------------------------------------------------------------------------- 1 | // see http://vuejs-templates.github.io/webpack for documentation. 2 | var path = require('path') 3 | var new_date = new Date(); 4 | 5 | /**日期时间格式化 20170413170432**/ 6 | var date_month = new_date.getMonth() <= 8 ? '0' + (new_date.getMonth() + 1) : (new_date.getMonth() + 1); 7 | var date_day = new_date.getDate() <= 9 ? '0' + new_date.getDate() : new_date.getDate(); 8 | var date_hour = new_date.getHours() <= 9 ? '0' + new_date.getHours() : new_date.getHours(); 9 | var date_min = new_date.getMinutes() <= 9 ? '0' + new_date.getMinutes() : new_date.getMinutes(); 10 | var date_sec = new_date.getSeconds() <= 9 ? '0' + new_date.getSeconds() : new_date.getSeconds(); 11 | var new_dateTime = process.env.ENV_CONFIG + new_date.getFullYear() + "年" + date_month + "月" + date_day + "日" + date_hour + "时" + date_min + "分" + date_sec + '秒'; 12 | 13 | module.exports = { 14 | build: { 15 | prodEnv: require('./prod.env'), 16 | sitEnv: require('./sit.env'), 17 | ppeEnv: require('./ppe.env'), 18 | index: path.resolve(__dirname, '../dist/' + new_dateTime + '/index.html'), // 编译输入的 index.html 文件 19 | assetsRoot: path.resolve(__dirname, '../dist/' + new_dateTime), // 编译输出的静态资源路径 20 | assetsSubDirectory: 'static', // 编译输出的二级目录 21 | assetsPublicPath: './', // 编译发布的根目录,可配置为资源服务器域名或 CDN 域名 22 | productionSourceMap: true, // 是否开启 cssSourceMap 23 | // Gzip off by default as many popular static hosts such as 24 | // Surge or Netlify already gzip all static assets for you. 25 | // Before setting to `true`, make sure to: 26 | // npm install --save-dev compression-webpack-plugin 27 | productionGzip: false, // 是否开启 gzip 28 | productionGzipExtensions: ['js', 'css'], // 需要使用 gzip 压缩的文件扩展名 29 | // Run the build command with an extra argument to 30 | // View the bundle analyzer report after build finishes: 31 | // `npm run build --report` 32 | // Set to `true` or `false` to always turn it on or off 33 | bundleAnalyzerReport: process.env.npm_config_report 34 | }, 35 | dev: { 36 | env: require('./dev.env'), 37 | port: 2222, 38 | autoOpenBrowser: true, 39 | assetsSubDirectory: 'static', 40 | assetsPublicPath: '/', 41 | proxyTable: { 42 | '/apis': { //将www.exaple.com印射为/apis 43 | target: 'https://easy-mock.com/mock/5a0505f33ee7f615fd560b73/example_1510153908343_1510278643389/home', // 接口域名 44 | changeOrigin: true, //是否跨域 45 | pathRewrite: { 46 | '^/apis': '' //需要rewrite的, 47 | } 48 | }, 49 | '/base': { /* 当发生跨域请求是调用此接口 本地代理*/ 50 | target: 'https://api.douban.com/v2/event/list?loc=108288&start=1&count=3', 51 | changeOrigin: true, 52 | pathRewrite: { 53 | '^/base': '/base' 54 | } 55 | }, 56 | }, 57 | cssSourceMap: false 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /config/ppe.env.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | NODE_ENV: '"ppeEnvironment"', 3 | ENV_CONFIG: '"ppe"', 4 | NODE_ENV: '"ppe"', 5 | baseUrl: '"http://this is pro-porduction address"', 6 | /*福币商品skuID*/ 7 | rechargeList: `[{ 8 | skuid: "f965d2bfc3ea48389f018507b9a6f37d", 9 | name: "预生产", 10 | thumbPath: '' 11 | }, { 12 | skuid: "e6e795fb819c4342b48668726504c0bf", 13 | name: "预生产", 14 | thumbPath: '' 15 | }, { 16 | skuid: "40d52960d59b44fea76840ef6d9a365c", 17 | name: "预生产", 18 | thumbPath: '' 19 | }, { 20 | skuid: "6770509a9deb4d8e87b9cbbe76737258", 21 | name: "预生产", 22 | thumbPath: '' 23 | }]`, 24 | 25 | } 26 | -------------------------------------------------------------------------------- /config/prod.env.js: -------------------------------------------------------------------------------- 1 | module.exports ={ 2 | 3 | NODE_ENV: '"production"', 4 | ENV_CONFIG: '"prod"', 5 | baseUrl: '"http://this is production address"', 6 | /*福币商品skuID*/ 7 | rechargeList: `[{ 8 | skuid: "f965d2bfc3ea48389f018507b9a6f37d", 9 | name: "生产", 10 | thumbPath: '' 11 | }, { 12 | skuid: "e6e795fb819c4342b48668726504c0bf", 13 | name: "生产", 14 | thumbPath: '' 15 | }, { 16 | skuid: "40d52960d59b44fea76840ef6d9a365c", 17 | name: "生产", 18 | thumbPath: '' 19 | }, { 20 | skuid: "6770509a9deb4d8e87b9cbbe76737258", 21 | name: "生产", 22 | thumbPath: '' 23 | }]`, 24 | 25 | } 26 | -------------------------------------------------------------------------------- /config/sit.env.js: -------------------------------------------------------------------------------- 1 | //测试 2 | module.exports = { 3 | NODE_ENV: '"sitEnvironment"', 4 | ENV_CONFIG: '"sit"', 5 | baseUrl:'"/base"', 6 | rechargeList: `[{ 7 | skuid: "020d73154fea407aba111e8a0b010cb1", 8 | name: "开发", 9 | thumbPath: '' 10 | }, { 11 | skuid: "b7ef02ebab9f4edf9cb44cb184f7dec3", 12 | name: "开发", 13 | thumbPath: '' 14 | }, { 15 | skuid: "52856479a6e74c4e9ea943ce6b4d4827", 16 | name: "开发", 17 | thumbPath: '' 18 | }, { 19 | skuid: "a4b821d1bcf34d4b9af286c1a9cedc92", 20 | name: "开发", 21 | thumbPath: '' 22 | }]`, 23 | } -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 |
21 |
22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "vuedemo", 3 | "version": "1.0.0", 4 | "description": "A Vue.js project", 5 | "author": "", 6 | "private": true, 7 | "scripts": { 8 | "dev": "node build/dev-server.js", 9 | "build": "node build/build.js", 10 | "build:prod": "cross-env NODE_ENV=production env_config=prod node build/build.js", 11 | "build:ppe": "cross-env NODE_ENV=ppeEnvironment env_config=ppe node build/build.js", 12 | "build:sit": "cross-env NODE_ENV=sitEnvironment env_config=sit node build/build.js", 13 | "e2e": "node test/e2e/runner.js", 14 | "test": "npm run e2e", 15 | "analyz": "NODE_ENV=production npm_config_report=true npm run build" 16 | }, 17 | "dependencies": { 18 | "babel-preset-es2015": "^6.24.1", 19 | "hammerjs": "^2.0.8", 20 | "js-md5": "^0.4.2", 21 | "vue-router": "^2.2.0", 22 | "vue2-datepick": "^1.0.6", 23 | "vuex": "^2.3.0", 24 | "cross-env": "^5.1.1", 25 | "weixin-js-sdk": "^1.2.0" 26 | }, 27 | "devDependencies": { 28 | "autoprefixer": "^6.7.2", 29 | "axios": "^0.16.2", 30 | "babel-core": "^6.22.1", 31 | "babel-loader": "^6.2.10", 32 | "babel-plugin-transform-runtime": "^6.22.0", 33 | "babel-preset-env": "^1.2.1", 34 | "babel-preset-stage-2": "^6.22.0", 35 | "babel-register": "^6.22.0", 36 | "better-scroll": "^0.1.15", 37 | "chalk": "^1.1.3", 38 | "chromedriver": "^2.27.2", 39 | "connect-history-api-fallback": "^1.3.0", 40 | "copy-webpack-plugin": "^4.0.1", 41 | "cross-spawn": "^5.0.1", 42 | "css-loader": "^0.26.4", 43 | "eslint-plugin-html": "^3.2.0", 44 | "eventsource-polyfill": "^0.9.6", 45 | "express": "^4.14.1", 46 | "extract-text-webpack-plugin": "^2.0.0", 47 | "file-loader": "^0.10.0", 48 | "friendly-errors-webpack-plugin": "^1.1.3", 49 | "function-bind": "^1.1.0", 50 | "hammerjs": "^2.0.8", 51 | "html-webpack-plugin": "^2.28.0", 52 | "http-proxy-middleware": "^0.17.3", 53 | "iscroll": "^5.2.0", 54 | "less": "^2.7.2", 55 | "less-loader": "^4.0.2", 56 | "mint-ui": "^2.2.8", 57 | "nightwatch": "^0.9.12", 58 | "opn": "^4.0.2", 59 | "optimize-css-assets-webpack-plugin": "^1.3.0", 60 | "ora": "^1.1.0", 61 | "rimraf": "^2.6.0", 62 | "selenium-server": "^3.0.1", 63 | "semver": "^5.3.0", 64 | "style-loader": "^0.16.1", 65 | "url-loader": "^0.5.7", 66 | "viscroll": "^1.0.4", 67 | "vue": "^2.5.17", 68 | "vue-area": "^1.0.0", 69 | "vue-awesome-swiper": "2.3.8", 70 | "vue-lazyload": "^1.0.3", 71 | "vue-loader": "^11.1.4", 72 | "vue-navigation": "^1.1.1", 73 | "vue-resource": "^1.2.1", 74 | "vue-spinner": "^1.0.2", 75 | "vue-style-loader": "^2.0.0", 76 | "vue-template-compiler": "^2.2.4", 77 | "vue-touch-ripple": "2.3.4", 78 | "webpack": "^2.2.1", 79 | "webpack-bundle-analyzer": "^2.2.1", 80 | "webpack-dev-middleware": "^1.10.0", 81 | "webpack-hot-middleware": "^2.16.1", 82 | "webpack-merge": "^2.6.1" 83 | }, 84 | "engines": { 85 | "node": ">= 4.0.0", 86 | "npm": ">= 3.0.0" 87 | }, 88 | "browserslist": [ 89 | "> 1%", 90 | "last 2 versions", 91 | "not ie <= 8" 92 | ] 93 | } 94 | -------------------------------------------------------------------------------- /src/App.vue: -------------------------------------------------------------------------------- 1 | 8 | 9 | 10 | 24 | -------------------------------------------------------------------------------- /src/assets/img/cion/close.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moshanghan/vue-mo-cli/296d14ac3c3f501456bd2254e0bb196fb48ffd1f/src/assets/img/cion/close.png -------------------------------------------------------------------------------- /src/assets/img/lottery/Triangle@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moshanghan/vue-mo-cli/296d14ac3c3f501456bd2254e0bb196fb48ffd1f/src/assets/img/lottery/Triangle@1x.png -------------------------------------------------------------------------------- /src/assets/img/lottery/banner.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moshanghan/vue-mo-cli/296d14ac3c3f501456bd2254e0bb196fb48ffd1f/src/assets/img/lottery/banner.png -------------------------------------------------------------------------------- /src/assets/img/lottery/border.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moshanghan/vue-mo-cli/296d14ac3c3f501456bd2254e0bb196fb48ffd1f/src/assets/img/lottery/border.png -------------------------------------------------------------------------------- /src/assets/img/lottery/borderSelect.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moshanghan/vue-mo-cli/296d14ac3c3f501456bd2254e0bb196fb48ffd1f/src/assets/img/lottery/borderSelect.png -------------------------------------------------------------------------------- /src/assets/img/lottery/btn.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moshanghan/vue-mo-cli/296d14ac3c3f501456bd2254e0bb196fb48ffd1f/src/assets/img/lottery/btn.png -------------------------------------------------------------------------------- /src/assets/img/lottery/circleLight.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moshanghan/vue-mo-cli/296d14ac3c3f501456bd2254e0bb196fb48ffd1f/src/assets/img/lottery/circleLight.png -------------------------------------------------------------------------------- /src/assets/img/lottery/close.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moshanghan/vue-mo-cli/296d14ac3c3f501456bd2254e0bb196fb48ffd1f/src/assets/img/lottery/close.png -------------------------------------------------------------------------------- /src/assets/img/lottery/concernBtn.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moshanghan/vue-mo-cli/296d14ac3c3f501456bd2254e0bb196fb48ffd1f/src/assets/img/lottery/concernBtn.png -------------------------------------------------------------------------------- /src/assets/img/lottery/endLottery.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moshanghan/vue-mo-cli/296d14ac3c3f501456bd2254e0bb196fb48ffd1f/src/assets/img/lottery/endLottery.png -------------------------------------------------------------------------------- /src/assets/img/lottery/flowers/01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moshanghan/vue-mo-cli/296d14ac3c3f501456bd2254e0bb196fb48ffd1f/src/assets/img/lottery/flowers/01.png -------------------------------------------------------------------------------- /src/assets/img/lottery/flowers/02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moshanghan/vue-mo-cli/296d14ac3c3f501456bd2254e0bb196fb48ffd1f/src/assets/img/lottery/flowers/02.png -------------------------------------------------------------------------------- /src/assets/img/lottery/flowers/03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moshanghan/vue-mo-cli/296d14ac3c3f501456bd2254e0bb196fb48ffd1f/src/assets/img/lottery/flowers/03.png -------------------------------------------------------------------------------- /src/assets/img/lottery/flowers/04.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moshanghan/vue-mo-cli/296d14ac3c3f501456bd2254e0bb196fb48ffd1f/src/assets/img/lottery/flowers/04.png -------------------------------------------------------------------------------- /src/assets/img/lottery/flowers/05.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moshanghan/vue-mo-cli/296d14ac3c3f501456bd2254e0bb196fb48ffd1f/src/assets/img/lottery/flowers/05.png -------------------------------------------------------------------------------- /src/assets/img/lottery/flowers/06.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moshanghan/vue-mo-cli/296d14ac3c3f501456bd2254e0bb196fb48ffd1f/src/assets/img/lottery/flowers/06.png -------------------------------------------------------------------------------- /src/assets/img/lottery/flowers/07.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moshanghan/vue-mo-cli/296d14ac3c3f501456bd2254e0bb196fb48ffd1f/src/assets/img/lottery/flowers/07.png -------------------------------------------------------------------------------- /src/assets/img/lottery/noStart.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moshanghan/vue-mo-cli/296d14ac3c3f501456bd2254e0bb196fb48ffd1f/src/assets/img/lottery/noStart.png -------------------------------------------------------------------------------- /src/assets/img/lottery/noprizeXF.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moshanghan/vue-mo-cli/296d14ac3c3f501456bd2254e0bb196fb48ffd1f/src/assets/img/lottery/noprizeXF.png -------------------------------------------------------------------------------- /src/assets/img/lottery/point.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moshanghan/vue-mo-cli/296d14ac3c3f501456bd2254e0bb196fb48ffd1f/src/assets/img/lottery/point.png -------------------------------------------------------------------------------- /src/assets/img/lottery/prize1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moshanghan/vue-mo-cli/296d14ac3c3f501456bd2254e0bb196fb48ffd1f/src/assets/img/lottery/prize1.png -------------------------------------------------------------------------------- /src/assets/img/lottery/prizeBig/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moshanghan/vue-mo-cli/296d14ac3c3f501456bd2254e0bb196fb48ffd1f/src/assets/img/lottery/prizeBig/1.png -------------------------------------------------------------------------------- /src/assets/img/lottery/prizeBig/2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moshanghan/vue-mo-cli/296d14ac3c3f501456bd2254e0bb196fb48ffd1f/src/assets/img/lottery/prizeBig/2.png -------------------------------------------------------------------------------- /src/assets/img/lottery/prizeBig/3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moshanghan/vue-mo-cli/296d14ac3c3f501456bd2254e0bb196fb48ffd1f/src/assets/img/lottery/prizeBig/3.png -------------------------------------------------------------------------------- /src/assets/img/lottery/prizeBig/4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moshanghan/vue-mo-cli/296d14ac3c3f501456bd2254e0bb196fb48ffd1f/src/assets/img/lottery/prizeBig/4.png -------------------------------------------------------------------------------- /src/assets/img/lottery/prizeBig/5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moshanghan/vue-mo-cli/296d14ac3c3f501456bd2254e0bb196fb48ffd1f/src/assets/img/lottery/prizeBig/5.png -------------------------------------------------------------------------------- /src/assets/img/lottery/prizeBig/6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moshanghan/vue-mo-cli/296d14ac3c3f501456bd2254e0bb196fb48ffd1f/src/assets/img/lottery/prizeBig/6.png -------------------------------------------------------------------------------- /src/assets/img/lottery/prizeBig/7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moshanghan/vue-mo-cli/296d14ac3c3f501456bd2254e0bb196fb48ffd1f/src/assets/img/lottery/prizeBig/7.png -------------------------------------------------------------------------------- /src/assets/img/lottery/prizeBig/8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moshanghan/vue-mo-cli/296d14ac3c3f501456bd2254e0bb196fb48ffd1f/src/assets/img/lottery/prizeBig/8.png -------------------------------------------------------------------------------- /src/assets/img/lottery/prizeBtn.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moshanghan/vue-mo-cli/296d14ac3c3f501456bd2254e0bb196fb48ffd1f/src/assets/img/lottery/prizeBtn.png -------------------------------------------------------------------------------- /src/assets/img/lottery/prizeBtnIng.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moshanghan/vue-mo-cli/296d14ac3c3f501456bd2254e0bb196fb48ffd1f/src/assets/img/lottery/prizeBtnIng.png -------------------------------------------------------------------------------- /src/assets/img/lottery/prizeDetailBanner.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moshanghan/vue-mo-cli/296d14ac3c3f501456bd2254e0bb196fb48ffd1f/src/assets/img/lottery/prizeDetailBanner.png -------------------------------------------------------------------------------- /src/assets/img/lottery/prizeDetailIcon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moshanghan/vue-mo-cli/296d14ac3c3f501456bd2254e0bb196fb48ffd1f/src/assets/img/lottery/prizeDetailIcon.png -------------------------------------------------------------------------------- /src/assets/img/lottery/prizeIcon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moshanghan/vue-mo-cli/296d14ac3c3f501456bd2254e0bb196fb48ffd1f/src/assets/img/lottery/prizeIcon.png -------------------------------------------------------------------------------- /src/assets/img/lottery/prizeInfo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moshanghan/vue-mo-cli/296d14ac3c3f501456bd2254e0bb196fb48ffd1f/src/assets/img/lottery/prizeInfo.png -------------------------------------------------------------------------------- /src/assets/img/lottery/prizeSmall/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moshanghan/vue-mo-cli/296d14ac3c3f501456bd2254e0bb196fb48ffd1f/src/assets/img/lottery/prizeSmall/1.png -------------------------------------------------------------------------------- /src/assets/img/lottery/prizeSmall/2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moshanghan/vue-mo-cli/296d14ac3c3f501456bd2254e0bb196fb48ffd1f/src/assets/img/lottery/prizeSmall/2.png -------------------------------------------------------------------------------- /src/assets/img/lottery/prizeSmall/3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moshanghan/vue-mo-cli/296d14ac3c3f501456bd2254e0bb196fb48ffd1f/src/assets/img/lottery/prizeSmall/3.png -------------------------------------------------------------------------------- /src/assets/img/lottery/prizeSmall/4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moshanghan/vue-mo-cli/296d14ac3c3f501456bd2254e0bb196fb48ffd1f/src/assets/img/lottery/prizeSmall/4.png -------------------------------------------------------------------------------- /src/assets/img/lottery/prizeSmall/5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moshanghan/vue-mo-cli/296d14ac3c3f501456bd2254e0bb196fb48ffd1f/src/assets/img/lottery/prizeSmall/5.png -------------------------------------------------------------------------------- /src/assets/img/lottery/prizeSmall/6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moshanghan/vue-mo-cli/296d14ac3c3f501456bd2254e0bb196fb48ffd1f/src/assets/img/lottery/prizeSmall/6.png -------------------------------------------------------------------------------- /src/assets/img/lottery/prizeSmall/7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moshanghan/vue-mo-cli/296d14ac3c3f501456bd2254e0bb196fb48ffd1f/src/assets/img/lottery/prizeSmall/7.png -------------------------------------------------------------------------------- /src/assets/img/lottery/prizeSmall/8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moshanghan/vue-mo-cli/296d14ac3c3f501456bd2254e0bb196fb48ffd1f/src/assets/img/lottery/prizeSmall/8.png -------------------------------------------------------------------------------- /src/assets/img/lottery/prizers.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moshanghan/vue-mo-cli/296d14ac3c3f501456bd2254e0bb196fb48ffd1f/src/assets/img/lottery/prizers.png -------------------------------------------------------------------------------- /src/assets/img/lottery/prizinig.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moshanghan/vue-mo-cli/296d14ac3c3f501456bd2254e0bb196fb48ffd1f/src/assets/img/lottery/prizinig.png -------------------------------------------------------------------------------- /src/assets/img/lottery/receivedXF.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moshanghan/vue-mo-cli/296d14ac3c3f501456bd2254e0bb196fb48ffd1f/src/assets/img/lottery/receivedXF.png -------------------------------------------------------------------------------- /src/assets/img/lottery/receivedXF1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moshanghan/vue-mo-cli/296d14ac3c3f501456bd2254e0bb196fb48ffd1f/src/assets/img/lottery/receivedXF1.png -------------------------------------------------------------------------------- /src/assets/img/lottery/three.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moshanghan/vue-mo-cli/296d14ac3c3f501456bd2254e0bb196fb48ffd1f/src/assets/img/lottery/three.png -------------------------------------------------------------------------------- /src/assets/img/lottery/tip.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moshanghan/vue-mo-cli/296d14ac3c3f501456bd2254e0bb196fb48ffd1f/src/assets/img/lottery/tip.png -------------------------------------------------------------------------------- /src/assets/img/lottery/whiteBar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moshanghan/vue-mo-cli/296d14ac3c3f501456bd2254e0bb196fb48ffd1f/src/assets/img/lottery/whiteBar.png -------------------------------------------------------------------------------- /src/assets/img/lottery/yellowCycle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moshanghan/vue-mo-cli/296d14ac3c3f501456bd2254e0bb196fb48ffd1f/src/assets/img/lottery/yellowCycle.png -------------------------------------------------------------------------------- /src/assets/img/lottery/抽奖-转盘底纹.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moshanghan/vue-mo-cli/296d14ac3c3f501456bd2254e0bb196fb48ffd1f/src/assets/img/lottery/抽奖-转盘底纹.png -------------------------------------------------------------------------------- /src/assets/js/browser.js: -------------------------------------------------------------------------------- 1 | var browser=navigator.userAgent; 2 | 3 | -------------------------------------------------------------------------------- /src/assets/js/filters.js: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | *自定义过滤器日期格式化 4月15日 4 | * 5 | * @export 6 | * @returns 7 | */ 8 | export function date (value) { 9 | if (!value) { 10 | return '' 11 | } 12 | let d = new Date(value) 13 | // var y = d.getFullYear() 14 | // var m = d.getMonth() < 10 ? '0' + (d.getMonth() + 1) : (d.getMonth() + 1); 15 | let m = d.getMonth() + 1 16 | let r = d.getDate() 17 | // var h = d.getHours() < 10 ? '0' + d.getHours() : d.getHours(); 18 | // var min = d.getMinutes() < 10 ? '0' + d.getMinutes() : d.getMinutes(); 19 | // var s = d.getSeconds() < 10 ? '0' + d.getSeconds() : d.getSeconds(); 20 | return (m + '月' + r + '日') 21 | } 22 | 23 | /** 24 | *自定义过滤器日期格式化 3月29日8:00 25 | * 26 | * @export 27 | * @returns 28 | */ 29 | export function dateTime (value) { 30 | if (!value) { 31 | return '' 32 | } 33 | let d = new Date(value) 34 | let m = d.getMonth() + 1 35 | let r = d.getDate() 36 | var h = d.getHours() < 10 ? '0' + d.getHours() : d.getHours() 37 | var min = d.getMinutes() < 10 ? '0' + d.getMinutes() : d.getMinutes() 38 | var s = d.getSeconds() < 10 ? '0' + d.getSeconds() : d.getSeconds() 39 | return (m + '月' + r + '日' + h + ':' + min) 40 | } 41 | 42 | /** 43 | *金额千位分隔符过滤器 44 | * 45 | * @export 46 | * @returns 47 | */ 48 | export function moneyTurn (s) { 49 | s = s.toString() 50 | if (/[^0-9\.]/.test(s)) return 'invalid value' 51 | s = s.replace(/^(\d*)$/, '$1.') 52 | s = (s + '00').replace(/(\d*\.\d\d)\d*/, '$1') 53 | s = s.replace('.', ',') 54 | var re = /(\d)(\d{3},)/ 55 | while (re.test(s)) { s = s.replace(re, '$1,$2') } 56 | s = s.replace(/,(\d\d)$/, '.$1') 57 | return s.replace(/^\./, '0.') 58 | } 59 | 60 | /** 61 | *卡号后四位 62 | * 63 | * @export 64 | * @returns 65 | */ 66 | export function cardNumber (val) { 67 | return '尾号' + val.substring(val.length - 4, val.length) 68 | } 69 | 70 | /** 71 | * **** **** **** 7663 72 | * 73 | * @export 74 | */ 75 | export function cardNumberStar (val) { 76 | // console.log(val.length-4 ) 77 | console.log(val) 78 | let valLast = val.slice(-4) 79 | let reg = /(\d+)/ 80 | var len = val.slice(1, -4) 81 | var x = '*' 82 | for (let i = 0; i < len; i++) { 83 | x += '*' 84 | } 85 | let valBefore = val.slice(1, -4).replace(reg, x) 86 | console.log(valBefore) 87 | 88 | // let reg = /^(\d{4})\d+(\d{4})$/; 89 | // let reg = /(\d{4})$/; 90 | // return val.replace(reg, "****$1"); 91 | } 92 | 93 | /** 94 | * 手机号中间四位用****代替 95 | * 96 | * @export 97 | * @returns 98 | */ 99 | export function mobileTurn (val) { 100 | if (val) { 101 | return val.substr(0, 3) + '****' + val.substr(8) 102 | } else { 103 | return val 104 | } 105 | } 106 | 107 | /** 108 | * 自定义过滤器日期格式化 2017-04-23 17:25:36 109 | * 110 | * @export 111 | * @returns 112 | */ 113 | export function YStime (value) { 114 | if (!value) { 115 | return '' 116 | } 117 | let d = new Date(value) 118 | let y = d.getFullYear() 119 | // let m = d.getMonth() + 1; 120 | let m = d.getMonth() < 9 ? '0' + (d.getMonth() + 1) : d.getMonth() + 1 121 | // let r = d.getDate(); 122 | let r = d.getDate() < 10 ? '0' + d.getDate() : d.getDate() 123 | var h = d.getHours() < 10 ? '0' + d.getHours() : d.getHours() 124 | var min = d.getMinutes() < 10 ? '0' + d.getMinutes() : d.getMinutes() 125 | var s = d.getSeconds() < 10 ? '0' + d.getSeconds() : d.getSeconds() 126 | return (y + '-' + m + '-' + r + ' ' + h + ':' + min + ':' + s) 127 | } 128 | 129 | /** 130 | *自定义过滤器日期格式化 2017.04.08 131 | * 132 | * @export 133 | * @returns 134 | */ 135 | export function dian_date (t) { 136 | return fmtDate(new Date(t), 'yyyy.MM.dd') 137 | } 138 | 139 | /** 140 | *价格去0 141 | * 142 | * @export 143 | * @param {any} value 144 | * @returns 145 | */ 146 | export function float_price (value) { 147 | if (value) { 148 | return parseFloat(value) 149 | } else { 150 | return '' 151 | } 152 | } 153 | 154 | /** 155 | * 时间格式化 156 | * 157 | * @export 158 | * @param {any} t 159 | * @returns 160 | */ 161 | export function getLastTimeStr (t) { 162 | return fmtDate(new Date(t), 'yyyy-MM-dd hh:mm:ss') 163 | } 164 | export function toFloat (e) { 165 | return parseFloat(e).toFixed(2) 166 | } 167 | export function toJdImgs160x160 (imgurl) { 168 | console.log(imgurl) 169 | return '//img11.360buyimg.com/n1/s160x160_' + imgurl 170 | } 171 | export function places (e) { 172 | return parseFloat(e).toFixed(2) 173 | } 174 | -------------------------------------------------------------------------------- /src/assets/js/mixin.js: -------------------------------------------------------------------------------- 1 | import { fmtDate } from './common' 2 | 3 | export const orderFilters = { 4 | filters: { 5 | // 金钱保留两位 6 | getMonneyStr: function (m) { 7 | if (!m || m == null || m == undefined) { 8 | return 0.0 9 | } 10 | return Number(m).toFixed(2) 11 | }, 12 | // 订单状态处理 13 | getOrderStateStr: function (state) { 14 | let str = '' 15 | switch (Number(state)) { 16 | case 0: 17 | str = '待确认' 18 | break 19 | case 1: 20 | str = '待付款' 21 | break 22 | case 2: 23 | str = '待发货' 24 | break 25 | case 3: 26 | str = '待发货' 27 | break 28 | case 4: 29 | str = '待发货' 30 | break 31 | case 5: 32 | str = '待收货' 33 | break 34 | case 6: 35 | str = '已收货' 36 | break 37 | default: 38 | str = '全部' // -1 39 | } 40 | return str 41 | } 42 | } 43 | } 44 | /** 45 | * 图片路径,京东or爱福客 46 | */ 47 | export const imgPath = { 48 | methods: { 49 | imgPath (item) { 50 | if (item.type == 'jd_mall') { 51 | return '//img11.360buyimg.com/n1/s370x370_' + item.thumbnailPath 52 | } else { 53 | return item.thumbnailPath 54 | } 55 | } 56 | } 57 | } 58 | /** 59 | * 存储localStorage 60 | */ 61 | export const setStore = { 62 | methods: { 63 | setStore (name, content) { 64 | if (!name) return 65 | if (typeof content !== 'string') { 66 | content = JSON.stringify(content) 67 | } 68 | window.localStorage.setItem(name, content) 69 | } 70 | } 71 | } 72 | 73 | /** 74 | * 获取localStorage 75 | */ 76 | export const getStore = { 77 | methods: { 78 | getStore (name) { 79 | if (!name) return 80 | return window.localStorage.getItem(name) 81 | } 82 | } 83 | } 84 | /** 85 | * 删除localStorage 86 | */ 87 | export const removeStore = { 88 | methods: { 89 | removeStore (name) { 90 | if (!name) return 91 | window.localStorage.removeItem(name) 92 | } 93 | } 94 | } 95 | /** 96 | * 处理键盘弹出事件(input的forcus)导致fixed定位的元素向上移动 97 | */ 98 | export const keyboardEvent = { 99 | methods: { 100 | keyboardEvent (el) { 101 | let h = document.body.scrollHeight 102 | window.onresize = function () { 103 | if (document.body.scrollHeight < h) { 104 | document.getElementById(el).style.display = 'none' 105 | } else { 106 | document.getElementById(el).style.display = 'block' 107 | } 108 | } 109 | } 110 | } 111 | } 112 | /** 113 | * 身份证校验 114 | */ 115 | export const idNoVerify = { 116 | methods: { 117 | idNoVerify (idcard) { 118 | idcard = this.idcard15to18(idcard) 119 | if (idcard.length != 18) { 120 | return false 121 | } 122 | 123 | let idcardbase = idcard.substring(0, 17) 124 | if (this.idcardVerifyNumber(idcardbase) != idcard.substring(17, 18).toUpperCase()) { 125 | return false 126 | } else { 127 | return true 128 | } 129 | }, 130 | idcardVerifyNumber (idcardBase) { 131 | // debugger 132 | if (this.isEmpty(idcardBase)) return '' 133 | if (idcardBase.length != 17) { 134 | return '' 135 | } 136 | var factor = [7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2] 137 | var verify_number_list = ['1', '0', 'X', '9', '8', '7', '6', '5', '4', '3', '2'] 138 | var checksum = 0 139 | for (let i = 0; i < idcardBase.length; i++) { 140 | checksum += parseInt(idcardBase.substring(i, i + 1)) * factor[i] 141 | } 142 | var mod = checksum % 11 143 | var verify_number = verify_number_list[mod] 144 | return verify_number + '' 145 | }, 146 | idcard15to18 (idcard) { 147 | if (idcard.length != 15) { 148 | return idcard 149 | } else { 150 | if (['996', '997', '998', '999'].indexOf(idcard.substring(12, 12 + 3)) != -1) { 151 | idcard = idcard.substring(0, 6) + '18' + idcard.substring(6, 15) 152 | } else { 153 | idcard = idcard.substring(0, 6) + '19' + idcard.substring(6, 15) 154 | } 155 | idcard = idcard + this.idcardVerifyNumber(idcard) 156 | return idcard 157 | } 158 | }, 159 | isEmpty (str) { 160 | return !str || str.trim() === '' || str.trim().toLowerCase() === 'null' || 161 | str.length == 0 162 | } 163 | } 164 | } 165 | -------------------------------------------------------------------------------- /src/assets/js/rem.js: -------------------------------------------------------------------------------- 1 | (function (doc, win) { 2 | // 分辨率Resolution适配 3 | var docEl = doc.documentElement, 4 | resizeEvt = 'orientationchange' in window ? 'orientationchange' : 'resize', 5 | recalc = function () { 6 | var clientWidth = docEl.clientWidth; 7 | if (!clientWidth) return; 8 | docEl.style.fontSize = 100 * (clientWidth / 750) + 'px'; 9 | }; 10 | 11 | // Abort if browser does not support addEventListener 12 | if (!doc.addEventListener) return; 13 | win.addEventListener(resizeEvt, recalc, false); 14 | win.addEventListener('pageshow', recalc, false); 15 | doc.addEventListener('DOMContentLoaded', recalc, false); 16 | })(document, window); 17 | -------------------------------------------------------------------------------- /src/assets/less/public.less: -------------------------------------------------------------------------------- 1 | body { 2 | font-size: 16px; 3 | font-family: "Microsoft YaHei", "Arial", "Helvetica", "sans-serif"; 4 | -webkit-text-size-adjust: 100% !important; 5 | background: #f7f7f7; 6 | color: #232323; 7 | } 8 | * { 9 | margin: 0; 10 | padding: 0; 11 | } 12 | ul { 13 | margin: 0; 14 | padding: 0; 15 | } 16 | li { 17 | list-style: none; 18 | } 19 | a { 20 | text-decoration: none; 21 | color: #232323; 22 | } 23 | 24 | 25 | input:disabled { 26 | background-color: #fff; 27 | } 28 | input[type=search]::-webkit-search-cancel-button { 29 | -webkit-appearance: none; 30 | } 31 | 32 | -------------------------------------------------------------------------------- /src/components/province_twon.vue: -------------------------------------------------------------------------------- 1 | 38 | 327 | 471 | -------------------------------------------------------------------------------- /src/main.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import App from './App.vue' 3 | import router from './router' 4 | import resource from 'vue-resource' 5 | import Navigation from 'vue-navigation' 6 | import '../node_modules/mint-ui/lib/style.min.css' // mint-ui 7 | import * as filters from './assets/js/filters' 8 | import './assets/js/browser.js' 9 | import './assets/js/rem' 10 | import './assets/less/public.less' 11 | Vue.use(resource) 12 | Vue.use(Navigation, { 13 | router 14 | }) 15 | 16 | // addroid控制字体不变大 17 | if (!/ipad|iphone/i.test(navigator.userAgent)) { 18 | (function () { 19 | if (typeof WeixinJSBridge == 'object' && typeof WeixinJSBridge.invoke == 'function') { 20 | handleFontSize() 21 | } else { 22 | if (document.addEventListener) { 23 | document.addEventListener('WeixinJSBridgeReady', handleFontSize, false) 24 | } else if (document.attachEvent) { 25 | document.attachEvent('WeixinJSBridgeReady', handleFontSize) 26 | document.attachEvent('onWeixinJSBridgeReady', handleFontSize) 27 | } 28 | } 29 | 30 | function handleFontSize () { 31 | // 设置网页字体为默认大小 32 | WeixinJSBridge.invoke('setFontSizeCallback', { 33 | 'fontSize': 0 34 | }) 35 | // 重写设置网页字体大小的事件 36 | WeixinJSBridge.on('menu:setfont', function () { 37 | WeixinJSBridge.invoke('setFontSizeCallback', { 38 | 'fontSize': 0 39 | }) 40 | }) 41 | } 42 | })() 43 | } 44 | 45 | // 过滤器 46 | Object.keys(filters).forEach(key => { 47 | Vue.filter(key, filters[key]) 48 | }) 49 | // 自定义指令页面title实时更新 50 | Vue.directive('title', { 51 | 52 | inserted: function (el, binding) { 53 | document.title = binding.value 54 | } 55 | 56 | }) 57 | new Vue({ 58 | router, // 挂到vue上 59 | el: '#app', 60 | render: h => h(App) 61 | }).$mount('#app') 62 | -------------------------------------------------------------------------------- /src/router/index.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import Router from 'vue-router' 3 | import { 4 | lottery, 5 | lotteryRecord 6 | } from './router_lottery' 7 | Vue.use(Router) 8 | const router = new Router({ 9 | mode: 'hash', 10 | routes: [{ 11 | path: '/index', // 首页 12 | name: 'index', 13 | component (resolve) { 14 | require.ensure(['../view/index/index.vue'], () => { 15 | resolve(require('../view/index/index.vue')) 16 | }) 17 | } 18 | }, 19 | { 20 | path: '/', // 首页 21 | name: 'index', 22 | component (resolve) { 23 | require.ensure(['../view/index/index.vue'], () => { 24 | resolve(require('../view/index/index.vue')) 25 | }) 26 | } 27 | }, 28 | /* 抽奖 */ 29 | lottery, lotteryRecord 30 | ] 31 | }) 32 | 33 | export default router 34 | -------------------------------------------------------------------------------- /src/router/router_lottery.js: -------------------------------------------------------------------------------- 1 | export const lottery = { 2 | path: '/lottery/lottery', // 抽奖 3 | name: 'lottery', 4 | component (resolve) { 5 | require.ensure(['../view/lottery/lottery.vue'], () => { 6 | resolve(require('../view/lottery/lottery.vue')) 7 | }) 8 | } 9 | } 10 | export const lotteryRecord = { 11 | path: '/lottery/lotteryRecord', // 获奖记录 12 | name: 'lotteryRecord', 13 | component (resolve) { 14 | require.ensure(['../view/lottery/lotteryRecord.vue'], () => { 15 | resolve(require('../view/lottery/lotteryRecord.vue')) 16 | }) 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/utils/inputFormat.js: -------------------------------------------------------------------------------- 1 | export const inputFormat={ 2 | methods:{ 3 | down(e) { 4 | this.keyCode = e.keyCode 5 | }, 6 | cardCount(e) { 7 | // 当前光标位置 8 | let pos = this.$refs.codeIpt.selectionEnd 9 | let b = this.codeStr // 定义变量input value值; 10 | let s = b.substring(0, pos) 11 | b = b.replace(/[^\dA-Za-z]/g, '') // 正则表达式:如果输入框中输入的不是数字或者空格,将不会显示; 12 | s = s.replace(/[^\dA-Za-z]/g, '') 13 | let c = parseInt(s.length / 4) 14 | pos = s.length + c 15 | if ((this.keyCode && this.keyCode == 8) || (e.inputType && e.inputType == 'deleteContentBackward')) { 16 | if (s.length % 4 == 0) { 17 | pos = pos - 1 18 | } 19 | } else { 20 | if (s.length % 4 == 0) { 21 | pos = pos + 1 22 | } 23 | } 24 | const bArr = this.spli(b, 4) 25 | b = '' 26 | for (let i = 0; i < bArr.length; i++) { 27 | b += bArr[i] + ' ' 28 | } 29 | this.codeStr = b.trim() 30 | 31 | // this.mousePosition = pos 32 | setTimeout(() => { 33 | this.$refs.codeIpt.setSelectionRange(pos, pos) 34 | }, 0) 35 | }, 36 | spli(s, i) { 37 | let arr = [] 38 | if (i && i > 0) { 39 | if (s.length <= i) { 40 | arr.push(s) 41 | return arr 42 | } else { 43 | arr.push(s.substring(0, i)) 44 | arr = arr.concat(this.spli(s.substring(i, s.length), i)) 45 | return arr 46 | } 47 | } 48 | }, 49 | } 50 | } -------------------------------------------------------------------------------- /src/view/index/index.vue: -------------------------------------------------------------------------------- 1 | 26 | 57 | 81 | 82 | -------------------------------------------------------------------------------- /src/view/lottery/lottery.vue: -------------------------------------------------------------------------------- 1 | 123 | 408 | 864 | -------------------------------------------------------------------------------- /src/view/lottery/lotteryRecord.vue: -------------------------------------------------------------------------------- 1 | 78 | 220 | 619 | -------------------------------------------------------------------------------- /static/data/lotteryInfo.json: -------------------------------------------------------------------------------- 1 | { 2 | "bizCode": "000000", 3 | "bizMessage": "", 4 | "data": { 5 | "prizeDesc": "每人100次$utf8$一等奖华为p10", 6 | "winners": [{ 7 | "randomId": "11120fba76224eda8f819f0d0058606a", 8 | "level": 1, 9 | "name": "张三", 10 | "mobile": "153****91106", 11 | "commodityName": "华为 P10 Plus 全网通 4G 手机 双卡双待-6G+128G-玫瑰金" 12 | }, { 13 | "randomId": "fd47133f9bb4453a86a659f81640d1ef", 14 | "level": 4, 15 | "name": "张四", 16 | "mobile": "189****01366", 17 | "commodityName": "15福币" 18 | }, { 19 | "randomId": "e9ba39c8773b4edebf45e1e3c35f3fc1", 20 | "level": 2, 21 | "name": "张五", 22 | "mobile": "189****01366", 23 | "commodityName": "200优惠券" 24 | }, { 25 | "randomId": "88e3ecdabc354d7a8c0b56a822a6f5a5", 26 | "level": 3, 27 | "name": "张六", 28 | "mobile": "150****00451", 29 | "commodityName": "100优惠券" 30 | }, { 31 | "randomId": "784227fd523841afac3dee0e6a377113", 32 | "level": 8, 33 | "name": "李四", 34 | "mobile": "189****01366", 35 | "commodityName": "3福币" 36 | }, { 37 | "randomId": "7a95ad0b9522442a8ca12859e41f1fb9", 38 | "level": 8, 39 | "name": "李五", 40 | "mobile": "151****73957", 41 | "commodityName": "3福币" 42 | }, { 43 | "randomId": "0b92100d0a354ad3be334edf826c61e5", 44 | "level": 8, 45 | "name": "李六", 46 | "mobile": "151****73957", 47 | "commodityName": "3福币" 48 | }, { 49 | "randomId": "4b0a012886cd473d962f5ad9b60ba7e6", 50 | "level": 8, 51 | "name": "李七", 52 | "mobile": "151****73957", 53 | "commodityName": "3福币" 54 | }, { 55 | "randomId": "46e31a4dfd0d4cf889f1c0b8f9f04075", 56 | "level": 7, 57 | "name": "李八", 58 | "mobile": "136****49120", 59 | "commodityName": "5福币" 60 | }], 61 | "defineId": "b1dffba5c02f4fe19f3ac766f3432018", 62 | "remainingTimes": 45, 63 | "hasDrawed": true, 64 | "prizeInfo": [{ 65 | "level": 1, 66 | "picUrlDesc": "http://qdtalk.com/wp-content/uploads/2017/09/1-2.png", 67 | "prizeId": "436066c40529401287658bfd67c1d346", 68 | "commodityName": "3福币" 69 | }, { 70 | "level": 2, 71 | "picUrlDesc": "http://qdtalk.com/wp-content/uploads/2017/09/2-2.png", 72 | "prizeId": "acdcb838bda74ec8b1fd202234f852ec", 73 | "commodityName": "200优惠劵" 74 | }, { 75 | "level": 3, 76 | "picUrlDesc": "http://qdtalk.com/wp-content/uploads/2017/09/3-2.png", 77 | "prizeId": "484bf4c856b94265960b3e182e9f597f", 78 | "commodityName": "100优惠劵" 79 | }, { 80 | "level": 4, 81 | "picUrlDesc": "http://qdtalk.com/wp-content/uploads/2017/09/4-2.png", 82 | "prizeId": "d5c7784c4c4d4a33b141fc1be3b11a71", 83 | "commodityName": "15福币" 84 | }, { 85 | "level": 5, 86 | "picUrlDesc": "http://qdtalk.com/wp-content/uploads/2017/09/5-2.png", 87 | "prizeId": "7221846d585a4bed80bf486f94fcabae", 88 | "commodityName": "10福币" 89 | }, { 90 | "level": 6, 91 | "picUrlDesc": "http://qdtalk.com/wp-content/uploads/2017/09/6-1.png", 92 | "prizeId": "33c6413801fd44c594cbf6642840a614", 93 | "commodityName": "8福币" 94 | }, { 95 | "level": 7, 96 | "picUrlDesc": "http://qdtalk.com/wp-content/uploads/2017/09/7-1.png", 97 | "prizeId": "e453f94905334ea083fca649e87b3308", 98 | "commodityName": "5福币" 99 | }, { 100 | "level": 8, 101 | "picUrlDesc":"http://qdtalk.com/wp-content/uploads/2017/09/8-1.png", 102 | "prizeId": "e8df88de1878428bb58d0cc9152d8849", 103 | "commodityName": "3" 104 | }], 105 | "beginTime": 1506519900000, 106 | "endTime": 1601446191000, 107 | "currTime": 1506751791732, 108 | "title": "奖品丰厚", 109 | "lotteryDesc": "100中奖$utf8$抓紧机会" 110 | }, 111 | "success": true 112 | } 113 | -------------------------------------------------------------------------------- /static/data/lotteryRecord.json: -------------------------------------------------------------------------------- 1 | { 2 | "bizCode": "000000", 3 | "bizMessage": "", 4 | "totalCount": 0, 5 | "currCount": 0, 6 | "pageIndex": 0, 7 | "pageSize": 0, 8 | "list": [{ 9 | "ordered": false, 10 | "orderAddress": null, 11 | "picUrlWinning": "http://qdtalk.com/wp-content/uploads/2017/09/1-1.png", 12 | "orderNo": null, 13 | "level": 1, 14 | "receiverName": null, 15 | "drawTime": 1506752670000, 16 | "mobile": "18988881366", 17 | "receiverMobile": null, 18 | "commodityId": "15", 19 | "lotteryPrizeType": 1, 20 | "empName": "张四", 21 | "id": "d14a4cf857ce47b29bae0c966ce18038", 22 | "commodityName": "华为 P10 Plus 全网通 4G 手机 双卡双待-6G+128G-玫瑰金" 23 | }], 24 | "success": true 25 | } 26 | -------------------------------------------------------------------------------- /static/data/prizeInfo.json: -------------------------------------------------------------------------------- 1 | { 2 | "bizCode": "000000", 3 | "bizMessage": null, 4 | "data": { 5 | "picUrlWinning": "http://qdtalk.com/wp-content/uploads/2017/09/1-1.png", 6 | "level": 1, 7 | "commodityName": "华为 P10 Plus 全网通 4G 手机 双卡双待-6G+128G-玫瑰金" 8 | }, 9 | "success": true 10 | } 11 | -------------------------------------------------------------------------------- /static/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moshanghan/vue-mo-cli/296d14ac3c3f501456bd2254e0bb196fb48ffd1f/static/favicon.ico -------------------------------------------------------------------------------- /test/e2e/custom-assertions/elementCount.js: -------------------------------------------------------------------------------- 1 | // A custom Nightwatch assertion. 2 | // the name of the method is the filename. 3 | // can be used in tests like this: 4 | // 5 | // browser.assert.elementCount(selector, count) 6 | // 7 | // for how to write custom assertions see 8 | // http://nightwatchjs.org/guide#writing-custom-assertions 9 | exports.assertion = function (selector, count) { 10 | this.message = 'Testing if element <' + selector + '> has count: ' + count 11 | this.expected = count 12 | this.pass = function (val) { 13 | return val === this.expected 14 | } 15 | this.value = function (res) { 16 | return res.value 17 | } 18 | this.command = function (cb) { 19 | var self = this 20 | return this.api.execute(function (selector) { 21 | return document.querySelectorAll(selector).length 22 | }, [selector], function (res) { 23 | cb.call(self, res) 24 | }) 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /test/e2e/nightwatch.conf.js: -------------------------------------------------------------------------------- 1 | require('babel-register') 2 | var config = require('../../config') 3 | 4 | // http://nightwatchjs.org/getingstarted#settings-file 5 | module.exports = { 6 | src_folders: ['test/e2e/specs'], 7 | output_folder: 'test/e2e/reports', 8 | custom_assertions_path: ['test/e2e/custom-assertions'], 9 | 10 | selenium: { 11 | start_process: true, 12 | server_path: require('selenium-server').path, 13 | host: '127.0.0.1', 14 | port: 4444, 15 | cli_args: { 16 | 'webdriver.chrome.driver': require('chromedriver').path 17 | } 18 | }, 19 | 20 | test_settings: { 21 | default: { 22 | selenium_port: 4444, 23 | selenium_host: 'localhost', 24 | silent: true, 25 | globals: { 26 | devServerURL: 'http://localhost:' + (process.env.PORT || config.dev.port) 27 | } 28 | }, 29 | 30 | chrome: { 31 | desiredCapabilities: { 32 | browserName: 'chrome', 33 | javascriptEnabled: true, 34 | acceptSslCerts: true 35 | } 36 | }, 37 | 38 | firefox: { 39 | desiredCapabilities: { 40 | browserName: 'firefox', 41 | javascriptEnabled: true, 42 | acceptSslCerts: true 43 | } 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /test/e2e/runner.js: -------------------------------------------------------------------------------- 1 | // 1. start the dev server using production config 2 | process.env.NODE_ENV = 'testing' 3 | var server = require('../../build/dev-server.js') 4 | 5 | server.ready.then(() => { 6 | // 2. run the nightwatch test suite against it 7 | // to run in additional browsers: 8 | // 1. add an entry in test/e2e/nightwatch.conf.json under "test_settings" 9 | // 2. add it to the --env flag below 10 | // or override the environment flag, for example: `npm run e2e -- --env chrome,firefox` 11 | // For more information on Nightwatch's config file, see 12 | // http://nightwatchjs.org/guide#settings-file 13 | var opts = process.argv.slice(2) 14 | if (opts.indexOf('--config') === -1) { 15 | opts = opts.concat(['--config', 'test/e2e/nightwatch.conf.js']) 16 | } 17 | if (opts.indexOf('--env') === -1) { 18 | opts = opts.concat(['--env', 'chrome']) 19 | } 20 | 21 | var spawn = require('cross-spawn') 22 | var runner = spawn('./node_modules/.bin/nightwatch', opts, { stdio: 'inherit' }) 23 | 24 | runner.on('exit', function (code) { 25 | server.close() 26 | process.exit(code) 27 | }) 28 | 29 | runner.on('error', function (err) { 30 | server.close() 31 | throw err 32 | }) 33 | }) 34 | -------------------------------------------------------------------------------- /test/e2e/specs/test.js: -------------------------------------------------------------------------------- 1 | // For authoring Nightwatch tests, see 2 | // http://nightwatchjs.org/guide#usage 3 | 4 | module.exports = { 5 | 'default e2e tests': function (browser) { 6 | // automatically uses dev Server port from /config.index.js 7 | // default: http://localhost:8080 8 | // see nightwatch.conf.js 9 | const devServer = browser.globals.devServerURL 10 | 11 | browser 12 | .url(devServer) 13 | .waitForElementVisible('#app', 5000) 14 | .assert.elementPresent('.hello') 15 | .assert.containsText('h1', 'Welcome to Your Vue.js App') 16 | .assert.elementCount('img', 1) 17 | .end() 18 | } 19 | } 20 | --------------------------------------------------------------------------------