├── static └── .gitkeep ├── 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 ├── App.vue ├── components │ ├── base │ │ ├── chooser.vue │ │ ├── multiplyChooser.vue │ │ ├── dialog.vue │ │ ├── counter.vue │ │ ├── selection.vue │ │ └── datepicker.vue │ ├── HelloWorld.vue │ ├── checkOrder.vue │ ├── regForm.vue │ ├── logForm.vue │ ├── slideShow.vue │ ├── bankChooser.vue │ └── layout.vue ├── main.js └── pages │ ├── detail │ ├── forecast.vue │ ├── count.vue │ ├── analysis.vue │ └── publish.vue │ ├── detail.vue │ ├── orderList.vue │ └── index.vue ├── config ├── prod.env.js ├── dev.env.js └── index.js ├── screenshots ├── about.png ├── index.png ├── login.png ├── analysis.png ├── orderList.png ├── bankChooser.png └── checkOrder.png ├── .editorconfig ├── .gitignore ├── .babelrc ├── .postcssrc.js ├── index.html ├── db.json ├── package.json └── README.md /static/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/assets/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WuChenDi/vue-shop/HEAD/src/assets/logo.png -------------------------------------------------------------------------------- /config/prod.env.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | module.exports = { 3 | NODE_ENV: '"production"' 4 | } 5 | -------------------------------------------------------------------------------- /screenshots/about.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WuChenDi/vue-shop/HEAD/screenshots/about.png -------------------------------------------------------------------------------- /screenshots/index.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WuChenDi/vue-shop/HEAD/screenshots/index.png -------------------------------------------------------------------------------- /screenshots/login.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WuChenDi/vue-shop/HEAD/screenshots/login.png -------------------------------------------------------------------------------- /screenshots/analysis.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WuChenDi/vue-shop/HEAD/screenshots/analysis.png -------------------------------------------------------------------------------- /screenshots/orderList.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WuChenDi/vue-shop/HEAD/screenshots/orderList.png -------------------------------------------------------------------------------- /src/assets/images/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WuChenDi/vue-shop/HEAD/src/assets/images/1.png -------------------------------------------------------------------------------- /src/assets/images/2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WuChenDi/vue-shop/HEAD/src/assets/images/2.png -------------------------------------------------------------------------------- /src/assets/images/3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WuChenDi/vue-shop/HEAD/src/assets/images/3.png -------------------------------------------------------------------------------- /src/assets/images/4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WuChenDi/vue-shop/HEAD/src/assets/images/4.png -------------------------------------------------------------------------------- /screenshots/bankChooser.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WuChenDi/vue-shop/HEAD/screenshots/bankChooser.png -------------------------------------------------------------------------------- /screenshots/checkOrder.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WuChenDi/vue-shop/HEAD/screenshots/checkOrder.png -------------------------------------------------------------------------------- /src/assets/banks/banks.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WuChenDi/vue-shop/HEAD/src/assets/banks/banks.png -------------------------------------------------------------------------------- /src/assets/slideShow/pic1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WuChenDi/vue-shop/HEAD/src/assets/slideShow/pic1.jpg -------------------------------------------------------------------------------- /src/assets/slideShow/pic2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WuChenDi/vue-shop/HEAD/src/assets/slideShow/pic2.jpg -------------------------------------------------------------------------------- /src/assets/slideShow/pic3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WuChenDi/vue-shop/HEAD/src/assets/slideShow/pic3.jpg -------------------------------------------------------------------------------- /src/assets/slideShow/pic4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WuChenDi/vue-shop/HEAD/src/assets/slideShow/pic4.jpg -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | charset = utf-8 5 | indent_style = space 6 | indent_size = 2 7 | end_of_line = lf 8 | insert_final_newline = true 9 | trim_trailing_whitespace = true 10 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | node_modules/ 3 | /dist/ 4 | npm-debug.log* 5 | yarn-debug.log* 6 | yarn-error.log* 7 | 8 | # Editor directories and files 9 | .idea 10 | .vscode 11 | *.suo 12 | *.ntvs* 13 | *.njsproj 14 | *.sln 15 | -------------------------------------------------------------------------------- /.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": [ 3 | ["env", { 4 | "modules": false, 5 | "targets": { 6 | "browsers": ["> 1%", "last 2 versions", "not ie <= 8"] 7 | } 8 | }], 9 | "stage-2" 10 | ], 11 | "plugins": ["transform-vue-jsx", "transform-runtime"] 12 | } 13 | -------------------------------------------------------------------------------- /.postcssrc.js: -------------------------------------------------------------------------------- 1 | // https://github.com/michael-ciniawsky/postcss-load-config 2 | 3 | module.exports = { 4 | "plugins": { 5 | "postcss-import": {}, 6 | "postcss-url": {}, 7 | // to edit target browsers: use "browserslist" field in package.json 8 | "autoprefixer": {} 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | vue-shop2 7 | 8 | 9 |
10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /src/App.vue: -------------------------------------------------------------------------------- 1 | 7 | 8 | 18 | 19 | 29 | -------------------------------------------------------------------------------- /src/components/base/chooser.vue: -------------------------------------------------------------------------------- 1 | 14 | 15 | 39 | 40 | 64 | -------------------------------------------------------------------------------- /db.json: -------------------------------------------------------------------------------- 1 | { 2 | "getNewsList": [ 3 | { 4 | "id": 1, 5 | "title": "新闻条目1新闻条目1新闻条目1新闻条目1", 6 | "url": "https://github.com/WuChenDi" 7 | }, 8 | { 9 | "id": 2, 10 | "title": "新闻条目2新闻条目2新闻条目2新闻条目2", 11 | "url": "https://github.com/WuChenDi" 12 | }, 13 | { 14 | "id": 3, 15 | "title": "新闻条3新闻条3新闻条3", 16 | "url": "https://github.com/WuChenDi" 17 | }, 18 | { 19 | "id": 4, 20 | "title": "新闻条4广告发布", 21 | "url": "https://github.com/WuChenDi" 22 | } 23 | ], 24 | "login": { 25 | "username": "wuchendi", 26 | "userId": 123456 27 | }, 28 | "getPrice": { 29 | "amount": 678 30 | }, 31 | "createOrder": { 32 | "orderId": "6djk979" 33 | }, 34 | "getOrderList": { 35 | "list": [ 36 | { 37 | "orderId": "ddj123", 38 | "product": "数据统计", 39 | "version": "高级版", 40 | "period": "1年", 41 | "buyNum": 2, 42 | "date": "2016-10-10", 43 | "amount": "500元" 44 | }, 45 | { 46 | "orderId": "yuj583", 47 | "product": "流量分析", 48 | "version": "户外版", 49 | "period": "3个月", 50 | "buyNum": 1, 51 | "date": "2016-5-2", 52 | "amount": "2200元" 53 | }, 54 | { 55 | "orderId": "pmd201", 56 | "product": "广告发布", 57 | "version": "商铺版", 58 | "period": "3年", 59 | "buyNum": 12, 60 | "date": "2016-8-3", 61 | "amount": "7890元" 62 | } 63 | ] 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /src/components/HelloWorld.vue: -------------------------------------------------------------------------------- 1 | 22 | 23 | 33 | 34 | 35 | 51 | -------------------------------------------------------------------------------- /src/components/checkOrder.vue: -------------------------------------------------------------------------------- 1 | 20 | 21 | 61 | 62 | 63 | 66 | -------------------------------------------------------------------------------- /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 Layout from './components/layout.vue' 7 | import VueRouter from 'vue-router' 8 | import VueResource from 'vue-resource' 9 | // import axios from 'axios' 10 | import IndexPage from './pages/index' 11 | import DetailPage from './pages/detail' 12 | import OrderListPage from './pages/orderList' 13 | import DetailAnaPage from './pages/detail/analysis' 14 | import DetailCouPage from './pages/detail/count' 15 | import DetailForPage from './pages/detail/forecast' 16 | import DetailPubPage from './pages/detail/publish' 17 | 18 | Vue.config.productionTip = false 19 | Vue.use(VueRouter) 20 | Vue.use(VueResource) 21 | 22 | let router = new VueRouter({ 23 | mode: 'history', 24 | routes: [ 25 | { 26 | path: '/', 27 | component: IndexPage 28 | }, 29 | { 30 | path: '/orderList', 31 | component: OrderListPage 32 | }, 33 | { 34 | path: '/detail', 35 | component: DetailPage, 36 | redirect: '/detail/analysis', 37 | children: [ 38 | { 39 | path: 'analysis', 40 | component: DetailAnaPage 41 | }, 42 | { 43 | path: 'count', 44 | component: DetailCouPage 45 | }, 46 | { 47 | path: 'forecast', 48 | component: DetailForPage 49 | }, 50 | { 51 | path: 'publish', 52 | component: DetailPubPage 53 | } 54 | ] 55 | } 56 | ] 57 | }) 58 | 59 | /* eslint-disable no-new */ 60 | new Vue({ 61 | el: '#app', 62 | router, 63 | template: '', 64 | components: { Layout } 65 | }) 66 | -------------------------------------------------------------------------------- /src/components/base/multiplyChooser.vue: -------------------------------------------------------------------------------- 1 | 15 | 16 | 54 | 55 | 79 | -------------------------------------------------------------------------------- /src/components/base/dialog.vue: -------------------------------------------------------------------------------- 1 | 14 | 15 | 35 | 36 | 99 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "vue-shop2", 3 | "version": "1.0.0", 4 | "description": "wcd vue-shop2", 5 | "author": "", 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 | "vue": "^2.5.2" 14 | }, 15 | "devDependencies": { 16 | "autoprefixer": "^7.1.2", 17 | "axios": "^0.17.1", 18 | "babel-core": "^6.22.1", 19 | "babel-helper-vue-jsx-merge-props": "^2.0.3", 20 | "babel-loader": "^7.1.1", 21 | "babel-plugin-syntax-jsx": "^6.18.0", 22 | "babel-plugin-transform-runtime": "^6.22.0", 23 | "babel-plugin-transform-vue-jsx": "^3.5.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 | "express": "^4.16.2", 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 | "json-loader": "^0.5.7", 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 | "postcss-url": "^7.2.1", 42 | "rimraf": "^2.6.0", 43 | "semver": "^5.3.0", 44 | "shelljs": "^0.7.6", 45 | "uglifyjs-webpack-plugin": "^1.1.1", 46 | "url-loader": "^0.5.8", 47 | "vue-loader": "^13.3.0", 48 | "vue-resource": "^1.3.5", 49 | "vue-router": "^3.0.1", 50 | "vue-style-loader": "^3.0.1", 51 | "vue-template-compiler": "^2.5.2", 52 | "webpack": "^3.6.0", 53 | "webpack-bundle-analyzer": "^2.9.0", 54 | "webpack-dev-server": "^2.9.1", 55 | "webpack-merge": "^4.1.0" 56 | }, 57 | "engines": { 58 | "node": ">= 6.0.0", 59 | "npm": ">= 3.0.0" 60 | }, 61 | "browserslist": [ 62 | "> 1%", 63 | "last 2 versions", 64 | "not ie <= 8" 65 | ] 66 | } 67 | -------------------------------------------------------------------------------- /config/index.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | // Template version: 1.2.8 3 | // see http://vuejs-templates.github.io/webpack for documentation. 4 | 5 | const path = require('path') 6 | 7 | module.exports = { 8 | dev: { 9 | 10 | // Paths 11 | assetsSubDirectory: 'static', 12 | assetsPublicPath: '/', 13 | // proxyTable: {}, 14 | proxyTable: { 15 | '/api/': 'http://localhost:8081/' 16 | }, 17 | 18 | // Various Dev Server settings 19 | host: 'localhost', // can be overwritten by process.env.HOST 20 | port: 8080, // can be overwritten by process.env.PORT, if port is in use, a free one will be determined 21 | autoOpenBrowser: false, 22 | errorOverlay: true, 23 | notifyOnErrors: true, 24 | poll: false, // https://webpack.js.org/configuration/dev-server/#devserver-watchoptions- 25 | 26 | 27 | /** 28 | * Source Maps 29 | */ 30 | 31 | // https://webpack.js.org/configuration/devtool/#development 32 | devtool: 'cheap-module-eval-source-map', 33 | 34 | // If you have problems debugging vue-files in devtools, 35 | // set this to false - it *may* help 36 | // https://vue-loader.vuejs.org/en/options.html#cachebusting 37 | cacheBusting: true, 38 | 39 | cssSourceMap: true, 40 | }, 41 | 42 | build: { 43 | // Template for index.html 44 | index: path.resolve(__dirname, '../dist/index.html'), 45 | 46 | // Paths 47 | assetsRoot: path.resolve(__dirname, '../dist'), 48 | assetsSubDirectory: 'static', 49 | assetsPublicPath: '/', 50 | 51 | /** 52 | * Source Maps 53 | */ 54 | 55 | productionSourceMap: true, 56 | // https://webpack.js.org/configuration/devtool/#production 57 | devtool: '#source-map', 58 | 59 | // Gzip off by default as many popular static hosts such as 60 | // Surge or Netlify already gzip all static assets for you. 61 | // Before setting to `true`, make sure to: 62 | // npm install --save-dev compression-webpack-plugin 63 | productionGzip: false, 64 | productionGzipExtensions: ['js', 'css'], 65 | 66 | // Run the build command with an extra argument to 67 | // View the bundle analyzer report after build finishes: 68 | // `npm run build --report` 69 | // Set to `true` or `false` to always turn it on or off 70 | bundleAnalyzerReport: process.env.npm_config_report 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /src/components/base/counter.vue: -------------------------------------------------------------------------------- 1 | 10 | 11 | 60 | 61 | 101 | -------------------------------------------------------------------------------- /src/components/base/selection.vue: -------------------------------------------------------------------------------- 1 | 14 | 15 | 44 | 45 | 99 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # 基于Vue2.0 + vue-router + webpack + ES6/7 + nodejs + express 实现web端购物商城网站 2 | 3 | 4 | ## 前端构架 5 | *** 6 | - 页面结构(H5,CSS3,原生JS) 7 | - 框架(基于Vue脚手架:vue-cli)进行搭建 8 | - 数据请求处理框架(vue-resource或者Axios) 9 | - Vue-Router进行路由处理 10 | - 使用json-server模拟REST API(目前项目使用express) 11 | 12 | ## 目前项目已实现功能 13 | *** 14 | 1. 登录 15 | 2. 注册 (没有实现,点击按钮跳转回登录页面) 16 | 3. 首页数据的展示 17 | 4. 产品数据与最新消息的展示 18 | 5. 商品详情页 19 | 6. 购物车 20 | 7. 购物确认银行支付选择 21 | 8. 购买订单 (排序 ( 高->低 ) ) 22 | 23 | ## 项目运行 24 | *** 25 | 通过npm安装本地服务第三方依赖模块(需要已安装[Node.js](https://nodejs.org/ "nodejs")) 26 | #### 注意:由于涉及大量的 ES6/7 等新属性,node 需要 6.0 以上版本 27 | ``` 28 | cd vue-shop 29 | 30 | npm install 或 cnpm install(个人比较喜欢使用后者,下载依赖模块速度较快) 31 | 32 | npm run dev 33 | 34 | ``` 35 | 36 | ## 总结 37 | - 了解vue - 数据渲染、前端模块化、路由 38 | - 熟悉VueJs的接口功能 - 指令的用法、选项的用法 39 | - 了解vue组件 - 组件的交互 40 | - 了解vue工程化方案 - 单文件组件Webpack测试数据 41 | - vue项目的搭建流程 42 | - 使用Ajax请求后端数据 43 | - 组件的设计与交互 44 | - 路由和子路由(嵌套路由通信) 45 | 46 | ## 目录结构 47 | 48 | ``` 49 | . 50 | ├── build 51 | ├── config 52 | ├── screenshots 53 | ├── src 54 | │   ├── assets 55 | │   │   ├── banks 56 | │   │   ├── images 57 | │   │   └── slideShow 58 | │   ├── components 59 | │   │   ├── base 60 | │   │   │   ├── chooser.vue 61 | │   │   │   ├── counter.vue 62 | │   │   │   ├── datepicker.vue 63 | │   │   │   ├── dialog.vue 64 | │   │   │   ├── multiplyChooser.vue 65 | │   │   │   └── selection.vue 66 | │   │   ├── bankChooser.vue 67 | │   │   ├── checkOrder.vue 68 | │   │   ├── HelloWorld.vue 69 | │   │   ├── layout.vue 70 | │   │   ├── logForm.vue 71 | │   │   ├── regForm.vue 72 | │   │   └── slideShow.vue 73 | │   ├── pages 74 | │   │   ├── detail 75 | │   │   │   ├── analysis.vue 76 | │   │   │   ├── count.vue 77 | │   │   │   ├── forecast.vue 78 | │   │   │   └── publish.vue 79 | │   │   ├── detail.vue 80 | │   │   ├── index.vue 81 | │   │   └── orderList.vue 82 | │   ├── App.vue 83 | │   └── main.js 84 | ├── static 85 | │   └── .gitkeep 86 | ├── .babelrc 87 | ├── .editorconfig 88 | ├── .gitgnore 89 | ├── .postcssrc.js 90 | ├── db.json 91 | ├── index.html 92 | ├── package.json 93 | └── README.md 94 | . 95 | ``` 96 | 97 | ## 项目效果图 98 | ![](/screenshots/index.png) 99 | ![](/screenshots/login.png) 100 | ![](/screenshots/about.png) 101 | ![](/screenshots/analysis.png) 102 | ![](/screenshots/bankChooser.png) 103 | ![](/screenshots/checkOrder.png) 104 | ![](/screenshots/orderList.png) 105 | -------------------------------------------------------------------------------- /src/components/regForm.vue: -------------------------------------------------------------------------------- 1 | 19 | 20 | 67 | 68 | 69 | 112 | -------------------------------------------------------------------------------- /src/components/logForm.vue: -------------------------------------------------------------------------------- 1 | 29 | 30 | 96 | 97 | 98 | 101 | -------------------------------------------------------------------------------- /src/pages/detail/forecast.vue: -------------------------------------------------------------------------------- 1 | 59 | 60 | 92 | 93 | 94 | 97 | -------------------------------------------------------------------------------- /src/components/slideShow.vue: -------------------------------------------------------------------------------- 1 | 25 | 26 | 82 | 83 | 136 | -------------------------------------------------------------------------------- /src/components/bankChooser.vue: -------------------------------------------------------------------------------- 1 | 13 | 14 | 71 | 72 | 73 | 174 | -------------------------------------------------------------------------------- /src/pages/detail.vue: -------------------------------------------------------------------------------- 1 | 21 | 22 | 65 | 66 | 190 | -------------------------------------------------------------------------------- /src/pages/orderList.vue: -------------------------------------------------------------------------------- 1 | 41 | 42 | 164 | 165 | 223 | -------------------------------------------------------------------------------- /src/components/layout.vue: -------------------------------------------------------------------------------- 1 | 44 | 45 | 85 | 86 | 234 | -------------------------------------------------------------------------------- /src/components/base/datepicker.vue: -------------------------------------------------------------------------------- 1 | 110 | 111 | 151 | 152 | 276 | -------------------------------------------------------------------------------- /src/pages/index.vue: -------------------------------------------------------------------------------- 1 | 58 | 59 | 194 | 195 | 311 | -------------------------------------------------------------------------------- /src/pages/detail/count.vue: -------------------------------------------------------------------------------- 1 | 245 | 246 | 300 | 301 | 302 | 305 | -------------------------------------------------------------------------------- /src/pages/detail/analysis.vue: -------------------------------------------------------------------------------- 1 | 114 | 115 | 256 | 257 | 258 | 286 | -------------------------------------------------------------------------------- /src/pages/detail/publish.vue: -------------------------------------------------------------------------------- 1 | 253 | 254 | 310 | 311 | 312 | 315 | --------------------------------------------------------------------------------