├── static └── .gitkeep ├── config ├── prod.env.js ├── dev.env.js └── index.js ├── src ├── assets │ ├── logo.png │ ├── images │ │ ├── 1.png │ │ ├── 2.png │ │ ├── 3.png │ │ └── 4.png │ ├── banks │ │ └── banks.png │ └── slideShow │ │ ├── pic1.jpg │ │ ├── pic2.jpg │ │ ├── pic3.jpg │ │ └── pic4.jpg ├── eventBus.js ├── main.js ├── router │ └── index.js ├── components │ ├── base │ │ ├── chooser.vue │ │ ├── pagenation.vue │ │ ├── dialog.vue │ │ ├── multiplyChooser.vue │ │ ├── counter.vue │ │ ├── selection.vue │ │ └── datepicker.vue │ ├── checkOrder.vue │ ├── HelloWorld.vue │ ├── regForm.vue │ ├── logForm.vue │ ├── slideShow.vue │ ├── bankChooser.vue │ └── layout.vue ├── pages │ ├── detail │ │ ├── forecast.vue │ │ ├── analysis.vue │ │ ├── count.vue │ │ └── publish.vue │ ├── detail.vue │ ├── orderList.vue │ └── index.vue ├── mock │ └── mock.js └── App.vue ├── .babelrc ├── .gitignore ├── index.html ├── README.md └── package.json /static/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /config/prod.env.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | module.exports = { 3 | NODE_ENV: '"production"' 4 | } 5 | -------------------------------------------------------------------------------- /src/assets/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fishenal/vuejs-demo-project/HEAD/src/assets/logo.png -------------------------------------------------------------------------------- /src/eventBus.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | 3 | const eventBus = new Vue() 4 | 5 | export { eventBus } 6 | -------------------------------------------------------------------------------- /src/assets/images/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fishenal/vuejs-demo-project/HEAD/src/assets/images/1.png -------------------------------------------------------------------------------- /src/assets/images/2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fishenal/vuejs-demo-project/HEAD/src/assets/images/2.png -------------------------------------------------------------------------------- /src/assets/images/3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fishenal/vuejs-demo-project/HEAD/src/assets/images/3.png -------------------------------------------------------------------------------- /src/assets/images/4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fishenal/vuejs-demo-project/HEAD/src/assets/images/4.png -------------------------------------------------------------------------------- /src/assets/banks/banks.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fishenal/vuejs-demo-project/HEAD/src/assets/banks/banks.png -------------------------------------------------------------------------------- /src/assets/slideShow/pic1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fishenal/vuejs-demo-project/HEAD/src/assets/slideShow/pic1.jpg -------------------------------------------------------------------------------- /src/assets/slideShow/pic2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fishenal/vuejs-demo-project/HEAD/src/assets/slideShow/pic2.jpg -------------------------------------------------------------------------------- /src/assets/slideShow/pic3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fishenal/vuejs-demo-project/HEAD/src/assets/slideShow/pic3.jpg -------------------------------------------------------------------------------- /src/assets/slideShow/pic4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fishenal/vuejs-demo-project/HEAD/src/assets/slideShow/pic4.jpg -------------------------------------------------------------------------------- /.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": [ 3 | ["env", { 4 | "modules": false 5 | }], 6 | "stage-2" 7 | ], 8 | "plugins": ["transform-runtime"] 9 | } 10 | -------------------------------------------------------------------------------- /config/dev.env.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | const merge = require('webpack-merge') 3 | const prodEnv = require('./prod.env') 4 | 5 | module.exports = merge(prodEnv, { 6 | NODE_ENV: '"development"' 7 | }) 8 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | node_modules/ 3 | /dist/ 4 | npm-debug.log* 5 | yarn-debug.log* 6 | yarn-error.log* 7 | 8 | # Editor directories and files 9 | .idea 10 | .vscode 11 | *.suo 12 | *.ntvs* 13 | *.njsproj 14 | *.sln 15 | -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | my-project 7 | 8 | 9 |
10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /src/main.js: -------------------------------------------------------------------------------- 1 | // The Vue build version to load with the `import` command 2 | // (runtime-only or standalone) has been set in webpack.base.conf with an alias. 3 | import Vue from 'vue' 4 | import App from './App' 5 | import router from './router' 6 | import mock from './mock/mock' 7 | Vue.config.productionTip = false 8 | 9 | /* eslint-disable no-new */ 10 | new Vue({ 11 | el: '#app', 12 | router, 13 | template: '', 14 | components: { App } 15 | }) 16 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | #此项目使用说明 2 | 3 | 1. 确保安装了nodejs,以及版本"node": ">= 4.0.0", "npm": ">= 3.0.0" 4 | 2. 在终端里运行 5 | ``` 6 | npm install --registry=https://registry.npm.taobao.org 7 | ``` 8 | 3. 运行下面命令启动项目 9 | ``` 10 | npm run start 11 | ``` 12 | * 注意终端里的端口提示,新版模板采用了自动寻找端口功能,端口由8080叠加 13 | 14 | 4. 运行下面命令打包项目 15 | ``` 16 | npm run build 17 | ``` 18 | 19 | #2017.12更新, 与旧版对比 20 | 21 | 1. 基于最新的vue init webpack xxx 的空白模板 22 | 2. 摒弃vue-resource, 采用axios替代 23 | 3. 放弃dev-server和express搭建模拟数据服务的方式,采用mock.js替代 24 | 4. 去除store层的使用 25 | 5. 使用vue-carousel,取代原来的幻灯片组件 26 | 6. 一些样式上的美化 27 | 7. router-link 改用name -------------------------------------------------------------------------------- /src/router/index.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import Router from 'vue-router' 3 | 4 | import IndexPage from '@/pages/index' 5 | import DetailPage from '@/pages/detail' 6 | import OrderListPage from '@/pages/orderList' 7 | import DetailAnaPage from '@/pages/detail/analysis' 8 | import DetailCouPage from '@/pages/detail/count' 9 | import DetailForPage from '@/pages/detail/forecast' 10 | import DetailPubPage from '@/pages/detail/publish' 11 | 12 | Vue.use(Router) 13 | 14 | export default new Router({ 15 | routes: [ 16 | { 17 | path: '/', 18 | name: 'index', 19 | component: IndexPage 20 | }, 21 | { 22 | path: '/orderList', 23 | name: 'orderList', 24 | component: OrderListPage 25 | }, 26 | { 27 | path: '/detail', 28 | component: DetailPage, 29 | redirect: '/detail/analysis', 30 | children: [ 31 | { 32 | path: 'analysis', 33 | name: 'analysis', 34 | component: DetailAnaPage 35 | }, 36 | { 37 | path: 'count', 38 | name: 'count', 39 | component: DetailCouPage 40 | }, 41 | { 42 | path: 'forecast', 43 | name: 'forecast', 44 | component: DetailForPage 45 | }, 46 | { 47 | path: 'publish', 48 | name: 'publish', 49 | component: DetailPubPage 50 | } 51 | ] 52 | } 53 | ] 54 | }) 55 | -------------------------------------------------------------------------------- /src/components/base/chooser.vue: -------------------------------------------------------------------------------- 1 | 14 | 15 | 39 | 40 | 62 | -------------------------------------------------------------------------------- /src/components/base/pagenation.vue: -------------------------------------------------------------------------------- 1 | 11 | 12 | 40 | 41 | 65 | -------------------------------------------------------------------------------- /src/components/checkOrder.vue: -------------------------------------------------------------------------------- 1 | 20 | 21 | 63 | 64 | 65 | 68 | -------------------------------------------------------------------------------- /src/components/base/dialog.vue: -------------------------------------------------------------------------------- 1 | 14 | 15 | 35 | 36 | 91 | -------------------------------------------------------------------------------- /src/components/base/multiplyChooser.vue: -------------------------------------------------------------------------------- 1 | 14 | 15 | 53 | 54 | 76 | -------------------------------------------------------------------------------- /src/components/HelloWorld.vue: -------------------------------------------------------------------------------- 1 | 22 | 23 | 47 | 48 | 49 | 65 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "new_Vuejs_Demo_project", 3 | "version": "2.0.0", 4 | "description": "A Vue.js project", 5 | "author": "fishenal / yudonghan", 6 | "private": true, 7 | "scripts": { 8 | "dev": "webpack-dev-server --inline --progress --config build/webpack.dev.conf.js", 9 | "start": "npm run dev", 10 | "build": "node build/build.js" 11 | }, 12 | "dependencies": { 13 | "axios": "^0.17.1", 14 | "lodash": "^4.17.4", 15 | "vue": "^2.5.2", 16 | "vue-carousel": "^0.6.5", 17 | "vue-router": "^3.0.1" 18 | }, 19 | "devDependencies": { 20 | "autoprefixer": "^7.1.2", 21 | "babel-core": "^6.22.1", 22 | "babel-loader": "^7.1.1", 23 | "babel-plugin-transform-runtime": "^6.22.0", 24 | "babel-preset-env": "^1.3.2", 25 | "babel-preset-stage-2": "^6.22.0", 26 | "chalk": "^2.0.1", 27 | "copy-webpack-plugin": "^4.0.1", 28 | "css-loader": "^0.28.0", 29 | "eventsource-polyfill": "^0.9.6", 30 | "extract-text-webpack-plugin": "^3.0.0", 31 | "file-loader": "^1.1.4", 32 | "friendly-errors-webpack-plugin": "^1.6.1", 33 | "html-webpack-plugin": "^2.30.1", 34 | "mockjs": "^1.0.1-beta3", 35 | "node-notifier": "^5.1.2", 36 | "optimize-css-assets-webpack-plugin": "^3.2.0", 37 | "ora": "^1.2.0", 38 | "portfinder": "^1.0.13", 39 | "postcss-import": "^11.0.0", 40 | "postcss-loader": "^2.0.8", 41 | "rimraf": "^2.6.0", 42 | "semver": "^5.3.0", 43 | "shelljs": "^0.7.6", 44 | "uglifyjs-webpack-plugin": "^1.1.1", 45 | "url-loader": "^0.5.8", 46 | "vue-loader": "^13.3.0", 47 | "vue-style-loader": "^3.0.1", 48 | "vue-template-compiler": "^2.5.2", 49 | "webpack": "^3.6.0", 50 | "webpack-bundle-analyzer": "^2.9.0", 51 | "webpack-dev-server": "^2.9.1", 52 | "webpack-merge": "^4.1.0" 53 | }, 54 | "engines": { 55 | "node": ">= 4.0.0", 56 | "npm": ">= 3.0.0" 57 | }, 58 | "browserslist": [ 59 | "> 1%", 60 | "last 2 versions", 61 | "not ie <= 8" 62 | ] 63 | } -------------------------------------------------------------------------------- /src/components/base/counter.vue: -------------------------------------------------------------------------------- 1 | 10 | 11 | 62 | 63 | 99 | -------------------------------------------------------------------------------- /src/components/regForm.vue: -------------------------------------------------------------------------------- 1 | 19 | 20 | 69 | 70 | 71 | 114 | -------------------------------------------------------------------------------- /src/components/logForm.vue: -------------------------------------------------------------------------------- 1 | 29 | 30 | 97 | 98 | 99 | 102 | -------------------------------------------------------------------------------- /src/components/base/selection.vue: -------------------------------------------------------------------------------- 1 | 14 | 15 | 55 | 56 | 110 | -------------------------------------------------------------------------------- /config/index.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | // Template version: 1.2.5 3 | // see http://vuejs-templates.github.io/webpack for documentation. 4 | 5 | const path = require('path') 6 | 7 | module.exports = { 8 | dev: { 9 | 10 | // Paths 11 | assetsSubDirectory: 'static', 12 | assetsPublicPath: '/', 13 | proxyTable: {}, 14 | 15 | // Various Dev Server settings 16 | host: 'localhost', // can be overwritten by process.env.HOST 17 | port: 8080, // can be overwritten by process.env.PORT, if port is in use, a free one will be determined 18 | autoOpenBrowser: false, 19 | errorOverlay: true, 20 | notifyOnErrors: true, 21 | poll: false, // https://webpack.js.org/configuration/dev-server/#devserver-watchoptions- 22 | 23 | // Use Eslint Loader? 24 | // If true, your code will be linted during bundling and 25 | // linting errors and warnings will be shown in the console. 26 | useEslint: true, 27 | // If true, eslint errors and warnings will also be shown in the error overlay 28 | // in the browser. 29 | showEslintErrorsInOverlay: false, 30 | 31 | /** 32 | * Source Maps 33 | */ 34 | 35 | // https://webpack.js.org/configuration/devtool/#development 36 | devtool: 'eval-source-map', 37 | 38 | // If you have problems debugging vue-files in devtools, 39 | // set this to false - it *may* help 40 | // https://vue-loader.vuejs.org/en/options.html#cachebusting 41 | cacheBusting: true, 42 | 43 | // CSS Sourcemaps off by default because relative paths are "buggy" 44 | // with this option, according to the CSS-Loader README 45 | // (https://github.com/webpack/css-loader#sourcemaps) 46 | // In our experience, they generally work as expected, 47 | // just be aware of this issue when enabling this option. 48 | cssSourceMap: false, 49 | }, 50 | 51 | build: { 52 | // Template for index.html 53 | index: path.resolve(__dirname, '../dist/index.html'), 54 | 55 | // Paths 56 | assetsRoot: path.resolve(__dirname, '../dist'), 57 | assetsSubDirectory: 'static', 58 | assetsPublicPath: '/', 59 | 60 | /** 61 | * Source Maps 62 | */ 63 | 64 | productionSourceMap: true, 65 | // https://webpack.js.org/configuration/devtool/#production 66 | devtool: '#source-map', 67 | 68 | // Gzip off by default as many popular static hosts such as 69 | // Surge or Netlify already gzip all static assets for you. 70 | // Before setting to `true`, make sure to: 71 | // npm install --save-dev compression-webpack-plugin 72 | productionGzip: false, 73 | productionGzipExtensions: ['js', 'css'], 74 | 75 | // Run the build command with an extra argument to 76 | // View the bundle analyzer report after build finishes: 77 | // `npm run build --report` 78 | // Set to `true` or `false` to always turn it on or off 79 | bundleAnalyzerReport: process.env.npm_config_report 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /src/pages/detail/forecast.vue: -------------------------------------------------------------------------------- 1 | 59 | 60 | 92 | 93 | 94 | 97 | -------------------------------------------------------------------------------- /src/components/slideShow.vue: -------------------------------------------------------------------------------- 1 | 25 | 26 | 84 | 85 | 138 | -------------------------------------------------------------------------------- /src/components/bankChooser.vue: -------------------------------------------------------------------------------- 1 | 13 | 14 | 71 | 72 | 73 | 153 | -------------------------------------------------------------------------------- /src/mock/mock.js: -------------------------------------------------------------------------------- 1 | import Mock from 'mockjs' 2 | 3 | Mock.mock(/getNewsList/, { 4 | 'list|5': [{ 5 | 'url': '@url', 6 | 'title': '@ctitle(5, 20)' 7 | }] 8 | }) 9 | function getRImg () { 10 | return Mock.Random.image('700x300', Mock.Random.hex()) 11 | } 12 | Mock.mock(/getSlides/, [ 13 | { 14 | src: getRImg (), 15 | title: '@ctitle(4, 12)', 16 | ky: 1, 17 | toKey: 'analysis' 18 | }, 19 | { 20 | src: getRImg (), 21 | title: '@ctitle(4, 12)', 22 | ky: 2, 23 | toKey: 'count' 24 | }, 25 | { 26 | src: getRImg (), 27 | title: '@ctitle(4, 12)', 28 | ky: 3, 29 | toKey: 'publish' 30 | }, 31 | { 32 | src: getRImg (), 33 | title: '@ctitle(4, 12)', 34 | ky: 4, 35 | toKey: 'forecast' 36 | } 37 | ]) 38 | 39 | Mock.mock(/getPrice/, { 40 | 'number|1-100': 100 41 | }) 42 | Mock.mock(/createOrder/, 'number|1-100') 43 | 44 | Mock.mock(/getBoardList/, [ 45 | { 46 | title: '@ctitle(4)', 47 | description: '@ctitle(8, 12)', 48 | id: 'car', 49 | toKey: 'analysis', 50 | saleout: '@boolean' 51 | }, 52 | { 53 | title: '@ctitle(4)', 54 | description: '@ctitle(8, 12)', 55 | id: 'earth', 56 | toKey: 'count', 57 | saleout: '@boolean' 58 | }, 59 | { 60 | title: '@ctitle(4)', 61 | description: '@ctitle(8, 12)', 62 | id: 'loud', 63 | toKey: 'forecast', 64 | saleout: '@boolean' 65 | }, 66 | { 67 | title: '@ctitle(4)', 68 | description: '@ctitle(8, 12)', 69 | id: 'hill', 70 | toKey: 'publish', 71 | saleout: '@boolean' 72 | } 73 | ]) 74 | 75 | Mock.mock(/getProductList/, { 76 | pc: { 77 | title: 'PC产品', 78 | list: [ 79 | { 80 | name: '@ctitle(4)', 81 | url: '@url', 82 | hot: '@boolean' 83 | }, 84 | { 85 | name: '@ctitle(4)', 86 | url: '@url', 87 | hot: '@boolean' 88 | }, 89 | { 90 | name: '@ctitle(4)', 91 | url: '@url', 92 | hot: '@boolean' 93 | }, 94 | { 95 | name: '@ctitle(4)', 96 | url: '@url', 97 | hot: '@boolean' 98 | } 99 | ] 100 | }, 101 | app: { 102 | title: '手机应用类', 103 | last: true, 104 | list: [ 105 | { 106 | name: '@ctitle(4)', 107 | url: '@url', 108 | hot: '@boolean' 109 | }, 110 | { 111 | name: '@ctitle(4)', 112 | url: '@url', 113 | hot: '@boolean' 114 | }, 115 | { 116 | name: '@ctitle(4)', 117 | url: '@url', 118 | hot: '@boolean' 119 | }, 120 | { 121 | name: '@ctitle(4)', 122 | url: '@url', 123 | hot: '@boolean' 124 | } 125 | ] 126 | } 127 | }) 128 | Mock.mock(/getTableData/, { 129 | "total": 25, 130 | "list|25": [ 131 | { 132 | "orderId": "@id", 133 | "product": "@ctitle(4)", 134 | "version": "@ctitle(3)", 135 | "period": "@integer(1,5)年", 136 | "buyNum": "@integer(1,8)", 137 | "date": "@date()", 138 | "amount": "@integer(100, 500)元" 139 | } 140 | ] 141 | }) -------------------------------------------------------------------------------- /src/pages/detail.vue: -------------------------------------------------------------------------------- 1 | 20 | 21 | 63 | 64 | 165 | -------------------------------------------------------------------------------- /src/pages/orderList.vue: -------------------------------------------------------------------------------- 1 | 33 | 122 | 123 | 176 | -------------------------------------------------------------------------------- /src/App.vue: -------------------------------------------------------------------------------- 1 | 35 | 36 | 63 | 64 | 209 | -------------------------------------------------------------------------------- /src/pages/index.vue: -------------------------------------------------------------------------------- 1 | 51 | 52 | 104 | 105 | 231 | -------------------------------------------------------------------------------- /src/components/layout.vue: -------------------------------------------------------------------------------- 1 | 43 | 44 | 87 | 88 | 236 | -------------------------------------------------------------------------------- /src/pages/detail/analysis.vue: -------------------------------------------------------------------------------- 1 | 114 | 115 | 258 | 259 | 260 | 284 | -------------------------------------------------------------------------------- /src/components/base/datepicker.vue: -------------------------------------------------------------------------------- 1 | 110 | 111 | 150 | 151 | -------------------------------------------------------------------------------- /src/pages/detail/count.vue: -------------------------------------------------------------------------------- 1 | 245 | 246 | 300 | 301 | 302 | 305 | -------------------------------------------------------------------------------- /src/pages/detail/publish.vue: -------------------------------------------------------------------------------- 1 | 253 | 254 | 310 | 311 | 312 | 315 | --------------------------------------------------------------------------------