├── README.md ├── mongoDB-shop ├── .browserslistrc ├── public │ ├── favicon.ico │ └── index.html ├── src │ ├── assets │ │ ├── logo.png │ │ ├── 购物车.png │ │ ├── css │ │ │ └── global.css │ │ ├── pingheng.jpg │ │ ├── logo.svg │ │ └── logo_wps图片.svg │ ├── views │ │ ├── About.vue │ │ ├── Home │ │ │ ├── componets │ │ │ │ ├── NavBread.vue │ │ │ │ ├── CartItem.vue │ │ │ │ ├── HomeTop.vue │ │ │ │ └── Content.vue │ │ │ └── index.vue │ │ ├── Cart │ │ │ └── index.vue │ │ ├── Cart.vue │ │ └── Home.vue │ ├── store │ │ └── index.js │ ├── App.vue │ ├── router │ │ └── index.js │ └── main.js ├── server │ ├── views │ │ ├── index.pug │ │ ├── error.pug │ │ └── layout.pug │ ├── public │ │ └── stylesheets │ │ │ └── style.css │ ├── resource │ │ ├── carts.json │ │ ├── goods-net.json │ │ └── dumall-users.json │ ├── models │ │ ├── db.js │ │ ├── goods.js │ │ └── users.js │ ├── .gitignore │ ├── index.html │ ├── package.json │ ├── routes │ │ ├── goods.js │ │ └── users.js │ ├── app.js │ ├── bin │ │ └── www │ └── README.md ├── .gitignore ├── babel.config.js ├── .eslintrc.js ├── package.json ├── README.en.md ├── mongo │ └── readme.md └── README.md ├── small-douban ├── .browserslistrc ├── public │ ├── favicon.ico │ └── index.html ├── src │ ├── assets │ │ ├── logo.png │ │ └── images │ │ │ ├── bg.jpg │ │ │ ├── pan.png │ │ │ ├── top.png │ │ │ ├── vr.png │ │ │ ├── wx.png │ │ │ ├── 洲际.jpg │ │ │ ├── iqiyi.png │ │ │ ├── item.jpg │ │ │ ├── logo.png │ │ │ ├── pause.png │ │ │ ├── play.png │ │ │ ├── shou.png │ │ │ ├── avatar │ │ │ ├── 1.png │ │ │ ├── 2.png │ │ │ ├── 3.png │ │ │ ├── 4.png │ │ │ ├── 5.png │ │ │ └── sls.png │ │ │ ├── icon │ │ │ ├── xx.png │ │ │ ├── chat.png │ │ │ ├── chat1.png │ │ │ ├── pause.png │ │ │ ├── play.png │ │ │ ├── share.png │ │ │ ├── star.png │ │ │ ├── view.png │ │ │ ├── location.png │ │ │ ├── search.png │ │ │ ├── collection.png │ │ │ ├── none-star.png │ │ │ ├── share-anti.png │ │ │ ├── arrow-right.png │ │ │ └── collection-anti.png │ │ │ ├── post │ │ │ ├── bl.png │ │ │ ├── cat.png │ │ │ ├── sls.png │ │ │ ├── vr.png │ │ │ ├── crab.png │ │ │ └── xiaolong.jpg │ │ │ ├── tab │ │ │ ├── ciwei.png │ │ │ ├── music.png │ │ │ ├── yuedu.png │ │ │ ├── ciwei_hl.png │ │ │ ├── dianying.png │ │ │ ├── music_hl.png │ │ │ ├── profile.png │ │ │ ├── yuedu_hl.png │ │ │ ├── dianying_hl.png │ │ │ └── profile-actived.png │ │ │ └── music │ │ │ ├── xuwei.jpg │ │ │ ├── music-start.png │ │ │ └── music-stop.png │ ├── store │ │ └── index.js │ ├── main.js │ ├── views │ │ ├── My │ │ │ └── index.vue │ │ ├── Music │ │ │ ├── hotSongs.vue │ │ │ ├── japanSongs.vue │ │ │ ├── recommendDj.vue │ │ │ ├── musicDetail.vue │ │ │ ├── index.vue │ │ │ └── musicPlay.vue │ │ ├── Movie │ │ │ ├── comingsoon.vue │ │ │ ├── intheaters.vue │ │ │ ├── top250.vue │ │ │ ├── index.vue │ │ │ └── movieDetail.vue │ │ ├── Admin.vue │ │ └── Read │ │ │ ├── readDetail.vue │ │ │ └── index.vue │ ├── components │ │ ├── MusicItem.vue │ │ └── MovieItem.vue │ ├── App.vue │ └── router │ │ └── index.js ├── babel.config.js ├── postcss.config.js ├── .gitignore ├── .eslintrc.js ├── README.md └── package.json ├── vantUI-maizuo ├── .browserslistrc ├── public │ ├── favicon.ico │ └── index.html ├── src │ ├── assets │ │ ├── logo.png │ │ └── images │ │ │ ├── 错误.png │ │ │ ├── search.png │ │ │ └── meilirensheng.jpg │ ├── views │ │ ├── ComingSoon.vue │ │ ├── NowPlaying.vue │ │ ├── City.vue │ │ └── Detail.vue │ ├── store │ │ └── index.js │ ├── router │ │ └── index.js │ ├── main.js │ ├── components │ │ └── Item.vue │ └── App.vue ├── babel.config.js ├── .gitignore ├── postcss.config.js ├── .eslintrc.js ├── README.md └── package.json ├── shopcar ├── vue.config.js ├── public │ ├── favicon.ico │ └── index.html ├── src │ ├── assets │ │ └── logo.png │ ├── main.js │ ├── components │ │ └── Modal.vue │ └── App.vue ├── babel.config.js ├── .gitignore ├── README.md └── package.json └── todolist ├── vue.config.js ├── public ├── favicon.ico └── index.html ├── src ├── assets │ ├── logo.png │ └── delete.png ├── main.js ├── components │ └── Item.vue └── App.vue ├── babel.config.js ├── .gitignore ├── README.md └── package.json /README.md: -------------------------------------------------------------------------------- 1 | # VUE -------------------------------------------------------------------------------- /mongoDB-shop/.browserslistrc: -------------------------------------------------------------------------------- 1 | > 1% 2 | last 2 versions 3 | -------------------------------------------------------------------------------- /small-douban/.browserslistrc: -------------------------------------------------------------------------------- 1 | > 1% 2 | last 2 versions 3 | -------------------------------------------------------------------------------- /vantUI-maizuo/.browserslistrc: -------------------------------------------------------------------------------- 1 | > 1% 2 | last 2 versions 3 | -------------------------------------------------------------------------------- /shopcar/vue.config.js: -------------------------------------------------------------------------------- 1 | module.exports={ 2 | lintOnSave:false 3 | } -------------------------------------------------------------------------------- /todolist/vue.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | lintOnSave :false 3 | } -------------------------------------------------------------------------------- /shopcar/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijiaxin0621/VUE/HEAD/shopcar/public/favicon.ico -------------------------------------------------------------------------------- /shopcar/src/assets/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijiaxin0621/VUE/HEAD/shopcar/src/assets/logo.png -------------------------------------------------------------------------------- /todolist/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijiaxin0621/VUE/HEAD/todolist/public/favicon.ico -------------------------------------------------------------------------------- /todolist/src/assets/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijiaxin0621/VUE/HEAD/todolist/src/assets/logo.png -------------------------------------------------------------------------------- /todolist/src/assets/delete.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijiaxin0621/VUE/HEAD/todolist/src/assets/delete.png -------------------------------------------------------------------------------- /mongoDB-shop/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijiaxin0621/VUE/HEAD/mongoDB-shop/public/favicon.ico -------------------------------------------------------------------------------- /mongoDB-shop/src/assets/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijiaxin0621/VUE/HEAD/mongoDB-shop/src/assets/logo.png -------------------------------------------------------------------------------- /mongoDB-shop/src/assets/购物车.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijiaxin0621/VUE/HEAD/mongoDB-shop/src/assets/购物车.png -------------------------------------------------------------------------------- /shopcar/babel.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | presets: [ 3 | '@vue/cli-plugin-babel/preset' 4 | ] 5 | } 6 | -------------------------------------------------------------------------------- /small-douban/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijiaxin0621/VUE/HEAD/small-douban/public/favicon.ico -------------------------------------------------------------------------------- /small-douban/src/assets/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijiaxin0621/VUE/HEAD/small-douban/src/assets/logo.png -------------------------------------------------------------------------------- /todolist/babel.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | presets: [ 3 | '@vue/cli-plugin-babel/preset' 4 | ] 5 | } 6 | -------------------------------------------------------------------------------- /vantUI-maizuo/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijiaxin0621/VUE/HEAD/vantUI-maizuo/public/favicon.ico -------------------------------------------------------------------------------- /vantUI-maizuo/src/assets/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijiaxin0621/VUE/HEAD/vantUI-maizuo/src/assets/logo.png -------------------------------------------------------------------------------- /mongoDB-shop/server/views/index.pug: -------------------------------------------------------------------------------- 1 | extends layout 2 | 3 | block content 4 | h1= title 5 | p Welcome to #{title} 6 | -------------------------------------------------------------------------------- /mongoDB-shop/src/assets/css/global.css: -------------------------------------------------------------------------------- 1 | body{ 2 | background:#f5f7fc; 3 | font-size: 14px; 4 | color:#777; 5 | } -------------------------------------------------------------------------------- /small-douban/babel.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | presets: [ 3 | '@vue/cli-plugin-babel/preset' 4 | ] 5 | } 6 | -------------------------------------------------------------------------------- /vantUI-maizuo/babel.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | presets: [ 3 | '@vue/cli-plugin-babel/preset' 4 | ] 5 | } 6 | -------------------------------------------------------------------------------- /mongoDB-shop/src/assets/pingheng.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijiaxin0621/VUE/HEAD/mongoDB-shop/src/assets/pingheng.jpg -------------------------------------------------------------------------------- /small-douban/src/assets/images/bg.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijiaxin0621/VUE/HEAD/small-douban/src/assets/images/bg.jpg -------------------------------------------------------------------------------- /small-douban/src/assets/images/pan.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijiaxin0621/VUE/HEAD/small-douban/src/assets/images/pan.png -------------------------------------------------------------------------------- /small-douban/src/assets/images/top.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijiaxin0621/VUE/HEAD/small-douban/src/assets/images/top.png -------------------------------------------------------------------------------- /small-douban/src/assets/images/vr.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijiaxin0621/VUE/HEAD/small-douban/src/assets/images/vr.png -------------------------------------------------------------------------------- /small-douban/src/assets/images/wx.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijiaxin0621/VUE/HEAD/small-douban/src/assets/images/wx.png -------------------------------------------------------------------------------- /small-douban/src/assets/images/洲际.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijiaxin0621/VUE/HEAD/small-douban/src/assets/images/洲际.jpg -------------------------------------------------------------------------------- /vantUI-maizuo/src/assets/images/错误.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijiaxin0621/VUE/HEAD/vantUI-maizuo/src/assets/images/错误.png -------------------------------------------------------------------------------- /small-douban/src/assets/images/iqiyi.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijiaxin0621/VUE/HEAD/small-douban/src/assets/images/iqiyi.png -------------------------------------------------------------------------------- /small-douban/src/assets/images/item.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijiaxin0621/VUE/HEAD/small-douban/src/assets/images/item.jpg -------------------------------------------------------------------------------- /small-douban/src/assets/images/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijiaxin0621/VUE/HEAD/small-douban/src/assets/images/logo.png -------------------------------------------------------------------------------- /small-douban/src/assets/images/pause.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijiaxin0621/VUE/HEAD/small-douban/src/assets/images/pause.png -------------------------------------------------------------------------------- /small-douban/src/assets/images/play.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijiaxin0621/VUE/HEAD/small-douban/src/assets/images/play.png -------------------------------------------------------------------------------- /small-douban/src/assets/images/shou.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijiaxin0621/VUE/HEAD/small-douban/src/assets/images/shou.png -------------------------------------------------------------------------------- /small-douban/src/assets/images/avatar/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijiaxin0621/VUE/HEAD/small-douban/src/assets/images/avatar/1.png -------------------------------------------------------------------------------- /small-douban/src/assets/images/avatar/2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijiaxin0621/VUE/HEAD/small-douban/src/assets/images/avatar/2.png -------------------------------------------------------------------------------- /small-douban/src/assets/images/avatar/3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijiaxin0621/VUE/HEAD/small-douban/src/assets/images/avatar/3.png -------------------------------------------------------------------------------- /small-douban/src/assets/images/avatar/4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijiaxin0621/VUE/HEAD/small-douban/src/assets/images/avatar/4.png -------------------------------------------------------------------------------- /small-douban/src/assets/images/avatar/5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijiaxin0621/VUE/HEAD/small-douban/src/assets/images/avatar/5.png -------------------------------------------------------------------------------- /small-douban/src/assets/images/icon/xx.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijiaxin0621/VUE/HEAD/small-douban/src/assets/images/icon/xx.png -------------------------------------------------------------------------------- /small-douban/src/assets/images/post/bl.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijiaxin0621/VUE/HEAD/small-douban/src/assets/images/post/bl.png -------------------------------------------------------------------------------- /small-douban/src/assets/images/post/cat.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijiaxin0621/VUE/HEAD/small-douban/src/assets/images/post/cat.png -------------------------------------------------------------------------------- /small-douban/src/assets/images/post/sls.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijiaxin0621/VUE/HEAD/small-douban/src/assets/images/post/sls.png -------------------------------------------------------------------------------- /small-douban/src/assets/images/post/vr.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijiaxin0621/VUE/HEAD/small-douban/src/assets/images/post/vr.png -------------------------------------------------------------------------------- /vantUI-maizuo/src/assets/images/search.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijiaxin0621/VUE/HEAD/vantUI-maizuo/src/assets/images/search.png -------------------------------------------------------------------------------- /mongoDB-shop/server/views/error.pug: -------------------------------------------------------------------------------- 1 | extends layout 2 | 3 | block content 4 | h1= message 5 | h2= error.status 6 | pre #{error.stack} 7 | -------------------------------------------------------------------------------- /mongoDB-shop/src/views/About.vue: -------------------------------------------------------------------------------- 1 | 6 | -------------------------------------------------------------------------------- /small-douban/src/assets/images/avatar/sls.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijiaxin0621/VUE/HEAD/small-douban/src/assets/images/avatar/sls.png -------------------------------------------------------------------------------- /small-douban/src/assets/images/icon/chat.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijiaxin0621/VUE/HEAD/small-douban/src/assets/images/icon/chat.png -------------------------------------------------------------------------------- /small-douban/src/assets/images/icon/chat1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijiaxin0621/VUE/HEAD/small-douban/src/assets/images/icon/chat1.png -------------------------------------------------------------------------------- /small-douban/src/assets/images/icon/pause.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijiaxin0621/VUE/HEAD/small-douban/src/assets/images/icon/pause.png -------------------------------------------------------------------------------- /small-douban/src/assets/images/icon/play.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijiaxin0621/VUE/HEAD/small-douban/src/assets/images/icon/play.png -------------------------------------------------------------------------------- /small-douban/src/assets/images/icon/share.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijiaxin0621/VUE/HEAD/small-douban/src/assets/images/icon/share.png -------------------------------------------------------------------------------- /small-douban/src/assets/images/icon/star.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijiaxin0621/VUE/HEAD/small-douban/src/assets/images/icon/star.png -------------------------------------------------------------------------------- /small-douban/src/assets/images/icon/view.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijiaxin0621/VUE/HEAD/small-douban/src/assets/images/icon/view.png -------------------------------------------------------------------------------- /small-douban/src/assets/images/post/crab.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijiaxin0621/VUE/HEAD/small-douban/src/assets/images/post/crab.png -------------------------------------------------------------------------------- /small-douban/src/assets/images/tab/ciwei.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijiaxin0621/VUE/HEAD/small-douban/src/assets/images/tab/ciwei.png -------------------------------------------------------------------------------- /small-douban/src/assets/images/tab/music.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijiaxin0621/VUE/HEAD/small-douban/src/assets/images/tab/music.png -------------------------------------------------------------------------------- /small-douban/src/assets/images/tab/yuedu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijiaxin0621/VUE/HEAD/small-douban/src/assets/images/tab/yuedu.png -------------------------------------------------------------------------------- /small-douban/src/assets/images/icon/location.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijiaxin0621/VUE/HEAD/small-douban/src/assets/images/icon/location.png -------------------------------------------------------------------------------- /small-douban/src/assets/images/icon/search.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijiaxin0621/VUE/HEAD/small-douban/src/assets/images/icon/search.png -------------------------------------------------------------------------------- /small-douban/src/assets/images/music/xuwei.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijiaxin0621/VUE/HEAD/small-douban/src/assets/images/music/xuwei.jpg -------------------------------------------------------------------------------- /small-douban/src/assets/images/post/xiaolong.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijiaxin0621/VUE/HEAD/small-douban/src/assets/images/post/xiaolong.jpg -------------------------------------------------------------------------------- /small-douban/src/assets/images/tab/ciwei_hl.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijiaxin0621/VUE/HEAD/small-douban/src/assets/images/tab/ciwei_hl.png -------------------------------------------------------------------------------- /small-douban/src/assets/images/tab/dianying.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijiaxin0621/VUE/HEAD/small-douban/src/assets/images/tab/dianying.png -------------------------------------------------------------------------------- /small-douban/src/assets/images/tab/music_hl.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijiaxin0621/VUE/HEAD/small-douban/src/assets/images/tab/music_hl.png -------------------------------------------------------------------------------- /small-douban/src/assets/images/tab/profile.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijiaxin0621/VUE/HEAD/small-douban/src/assets/images/tab/profile.png -------------------------------------------------------------------------------- /small-douban/src/assets/images/tab/yuedu_hl.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijiaxin0621/VUE/HEAD/small-douban/src/assets/images/tab/yuedu_hl.png -------------------------------------------------------------------------------- /small-douban/src/assets/images/icon/collection.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijiaxin0621/VUE/HEAD/small-douban/src/assets/images/icon/collection.png -------------------------------------------------------------------------------- /small-douban/src/assets/images/icon/none-star.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijiaxin0621/VUE/HEAD/small-douban/src/assets/images/icon/none-star.png -------------------------------------------------------------------------------- /small-douban/src/assets/images/icon/share-anti.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijiaxin0621/VUE/HEAD/small-douban/src/assets/images/icon/share-anti.png -------------------------------------------------------------------------------- /small-douban/src/assets/images/tab/dianying_hl.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijiaxin0621/VUE/HEAD/small-douban/src/assets/images/tab/dianying_hl.png -------------------------------------------------------------------------------- /vantUI-maizuo/src/assets/images/meilirensheng.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijiaxin0621/VUE/HEAD/vantUI-maizuo/src/assets/images/meilirensheng.jpg -------------------------------------------------------------------------------- /small-douban/src/assets/images/icon/arrow-right.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijiaxin0621/VUE/HEAD/small-douban/src/assets/images/icon/arrow-right.png -------------------------------------------------------------------------------- /small-douban/src/assets/images/music/music-start.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijiaxin0621/VUE/HEAD/small-douban/src/assets/images/music/music-start.png -------------------------------------------------------------------------------- /small-douban/src/assets/images/music/music-stop.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijiaxin0621/VUE/HEAD/small-douban/src/assets/images/music/music-stop.png -------------------------------------------------------------------------------- /small-douban/src/assets/images/icon/collection-anti.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijiaxin0621/VUE/HEAD/small-douban/src/assets/images/icon/collection-anti.png -------------------------------------------------------------------------------- /small-douban/src/assets/images/tab/profile-actived.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijiaxin0621/VUE/HEAD/small-douban/src/assets/images/tab/profile-actived.png -------------------------------------------------------------------------------- /todolist/src/main.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import App from './App.vue' 3 | Vue.config.productionTip = false 4 | new Vue({ 5 | render: h => h(App), 6 | }).$mount('#app') 7 | -------------------------------------------------------------------------------- /mongoDB-shop/server/public/stylesheets/style.css: -------------------------------------------------------------------------------- 1 | body { 2 | padding: 50px; 3 | font: 14px "Lucida Grande", Helvetica, Arial, sans-serif; 4 | } 5 | 6 | a { 7 | color: #00B7FF; 8 | } 9 | -------------------------------------------------------------------------------- /mongoDB-shop/server/views/layout.pug: -------------------------------------------------------------------------------- 1 | doctype html 2 | html 3 | head 4 | title= title 5 | link(rel='stylesheet', href='/stylesheets/style.css') 6 | body 7 | block content 8 | -------------------------------------------------------------------------------- /mongoDB-shop/server/resource/carts.json: -------------------------------------------------------------------------------- 1 | { 2 | "userId":"1001", 3 | "cartList":[ 4 | {"id":"100","name":"手机"}, 5 | {"id":"200","name":"mac"}, 6 | {"id":"300","name":"iphone"} 7 | ] 8 | } -------------------------------------------------------------------------------- /shopcar/src/main.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import App from './App.vue' 3 | import axios from 'axios' 4 | Vue.config.productionTip = false 5 | Vue.prototype.axios = axios 6 | new Vue({ 7 | render: h => h(App), 8 | }).$mount('#app') 9 | -------------------------------------------------------------------------------- /mongoDB-shop/server/models/db.js: -------------------------------------------------------------------------------- 1 | const mongoose = require('mongoose'); 2 | mongoose.connect( 'mongodb://127.0.0.1:27017/shop', {useNewUrlParser: true},(err)=>{ 3 | if(err) throw err; 4 | console.log("database连接成功") 5 | }); 6 | module.exports = mongoose; -------------------------------------------------------------------------------- /mongoDB-shop/src/store/index.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import Vuex from 'vuex' 3 | 4 | Vue.use(Vuex) 5 | 6 | export default new Vuex.Store({ 7 | state: { 8 | }, 9 | mutations: { 10 | }, 11 | actions: { 12 | }, 13 | modules: { 14 | } 15 | }) 16 | -------------------------------------------------------------------------------- /small-douban/src/store/index.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import Vuex from 'vuex' 3 | 4 | Vue.use(Vuex) 5 | 6 | export default new Vuex.Store({ 7 | state: { 8 | }, 9 | mutations: { 10 | }, 11 | actions: { 12 | }, 13 | modules: { 14 | } 15 | }) 16 | -------------------------------------------------------------------------------- /small-douban/postcss.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | plugins: { 3 | 'autoprefixer': { 4 | browsers: ['Android >= 4.0', 'iOS >= 7'] 5 | }, 6 | 'postcss-pxtorem': { 7 | rootValue: 37.5, 8 | propList: ['*'] 9 | } 10 | } 11 | } -------------------------------------------------------------------------------- /shopcar/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | node_modules 3 | /dist 4 | 5 | # local env files 6 | .env.local 7 | .env.*.local 8 | 9 | # Log files 10 | npm-debug.log* 11 | yarn-debug.log* 12 | yarn-error.log* 13 | 14 | # Editor directories and files 15 | .idea 16 | .vscode 17 | *.suo 18 | *.ntvs* 19 | *.njsproj 20 | *.sln 21 | *.sw? 22 | -------------------------------------------------------------------------------- /mongoDB-shop/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | node_modules 3 | /dist 4 | 5 | # local env files 6 | .env.local 7 | .env.*.local 8 | 9 | # Log files 10 | npm-debug.log* 11 | yarn-debug.log* 12 | yarn-error.log* 13 | 14 | # Editor directories and files 15 | .idea 16 | .vscode 17 | *.suo 18 | *.ntvs* 19 | *.njsproj 20 | *.sln 21 | *.sw? 22 | -------------------------------------------------------------------------------- /small-douban/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | node_modules 3 | /dist 4 | 5 | # local env files 6 | .env.local 7 | .env.*.local 8 | 9 | # Log files 10 | npm-debug.log* 11 | yarn-debug.log* 12 | yarn-error.log* 13 | 14 | # Editor directories and files 15 | .idea 16 | .vscode 17 | *.suo 18 | *.ntvs* 19 | *.njsproj 20 | *.sln 21 | *.sw? 22 | -------------------------------------------------------------------------------- /todolist/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | node_modules 3 | /dist 4 | 5 | # local env files 6 | .env.local 7 | .env.*.local 8 | 9 | # Log files 10 | npm-debug.log* 11 | yarn-debug.log* 12 | yarn-error.log* 13 | 14 | # Editor directories and files 15 | .idea 16 | .vscode 17 | *.suo 18 | *.ntvs* 19 | *.njsproj 20 | *.sln 21 | *.sw? 22 | -------------------------------------------------------------------------------- /vantUI-maizuo/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | node_modules 3 | /dist 4 | 5 | # local env files 6 | .env.local 7 | .env.*.local 8 | 9 | # Log files 10 | npm-debug.log* 11 | yarn-debug.log* 12 | yarn-error.log* 13 | 14 | # Editor directories and files 15 | .idea 16 | .vscode 17 | *.suo 18 | *.ntvs* 19 | *.njsproj 20 | *.sln 21 | *.sw? 22 | -------------------------------------------------------------------------------- /mongoDB-shop/server/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | node_modules 3 | /dist 4 | 5 | # local env files 6 | .env.local 7 | .env.*.local 8 | 9 | # Log files 10 | npm-debug.log* 11 | yarn-debug.log* 12 | yarn-error.log* 13 | 14 | # Editor directories and files 15 | .idea 16 | .vscode 17 | *.suo 18 | *.ntvs* 19 | *.njsproj 20 | *.sln 21 | *.sw? 22 | -------------------------------------------------------------------------------- /mongoDB-shop/server/models/goods.js: -------------------------------------------------------------------------------- 1 | const mongoose = require('./db'); 2 | var GoodsSchema = new mongoose.Schema({ 3 | productId:String, 4 | productName:String, 5 | salePrice:Number, 6 | productImage:String, 7 | productUrl:String 8 | }) 9 | var Goods = mongoose.model('Goods',GoodsSchema,'goods'); 10 | module.exports = Goods; -------------------------------------------------------------------------------- /mongoDB-shop/babel.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | presets: [ 3 | '@vue/cli-plugin-babel/preset', 4 | /* ["es2015", { "modules": false }], */ 5 | ], 6 | "plugins": [ 7 | [ 8 | "component", 9 | { 10 | "libraryName": "element-ui", 11 | "styleLibraryName": "theme-chalk" 12 | } 13 | ] 14 | ] 15 | } 16 | -------------------------------------------------------------------------------- /vantUI-maizuo/postcss.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | /* plugins: { 3 | autoprefixer: {}, 4 | "postcss-pxtorem" :{ 5 | "rootValue":75, 6 | "propList":["*"], 7 | } 8 | } */ 9 | plugins: { 10 | 'autoprefixer': { 11 | browsers: ['Android >= 4.0', 'iOS >= 7'] 12 | }, 13 | 'postcss-pxtorem': { 14 | rootValue: 37.5, 15 | propList: ['*'] 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /mongoDB-shop/.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | root: true, 3 | env: { 4 | node: true 5 | }, 6 | 'extends': [ 7 | 'plugin:vue/essential', 8 | 'eslint:recommended' 9 | ], 10 | rules: { 11 | 'no-console': process.env.NODE_ENV === 'production' ? 'error' : 'off', 12 | 'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off' 13 | }, 14 | parserOptions: { 15 | parser: 'babel-eslint' 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /small-douban/.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | root: true, 3 | env: { 4 | node: true 5 | }, 6 | 'extends': [ 7 | 'plugin:vue/essential', 8 | 'eslint:recommended' 9 | ], 10 | rules: { 11 | 'no-console': process.env.NODE_ENV === 'production' ? 'error' : 'off', 12 | 'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off' 13 | }, 14 | parserOptions: { 15 | parser: 'babel-eslint' 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /small-douban/src/main.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import App from './App.vue' 3 | import router from './router' 4 | import store from './store' 5 | import 'amfe-flexible/index' 6 | import Vant from 'vant' 7 | import "vant/lib/index.css" 8 | import axios from 'axios' 9 | Vue.config.productionTip = false 10 | Vue.use(Vant) 11 | Vue.prototype.axios = axios 12 | new Vue({ 13 | router, 14 | store, 15 | render: h => h(App) 16 | }).$mount('#app') 17 | -------------------------------------------------------------------------------- /vantUI-maizuo/.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | root: true, 3 | env: { 4 | node: true 5 | }, 6 | 'extends': [ 7 | 'plugin:vue/essential', 8 | 'eslint:recommended' 9 | ], 10 | rules: { 11 | 'no-console': process.env.NODE_ENV === 'production' ? 'error' : 'off', 12 | 'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off' 13 | }, 14 | parserOptions: { 15 | parser: 'babel-eslint' 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /mongoDB-shop/server/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Document 8 | 9 | 10 | 15 | 16 | -------------------------------------------------------------------------------- /shopcar/README.md: -------------------------------------------------------------------------------- 1 | # 02cart 2 | 3 | ## Project setup 4 | ``` 5 | yarn install 6 | ``` 7 | 8 | ### Compiles and hot-reloads for development 9 | ``` 10 | yarn run serve 11 | ``` 12 | 13 | ### Compiles and minifies for production 14 | ``` 15 | yarn run build 16 | ``` 17 | 18 | ### Run your tests 19 | ``` 20 | yarn run test 21 | ``` 22 | 23 | ### Lints and fixes files 24 | ``` 25 | yarn run lint 26 | ``` 27 | 28 | ### Customize configuration 29 | See [Configuration Reference](https://cli.vuejs.org/config/). 30 | -------------------------------------------------------------------------------- /small-douban/README.md: -------------------------------------------------------------------------------- 1 | # douban 2 | 3 | ## Project setup 4 | ``` 5 | yarn install 6 | ``` 7 | 8 | ### Compiles and hot-reloads for development 9 | ``` 10 | yarn run serve 11 | ``` 12 | 13 | ### Compiles and minifies for production 14 | ``` 15 | yarn run build 16 | ``` 17 | 18 | ### Run your tests 19 | ``` 20 | yarn run test 21 | ``` 22 | 23 | ### Lints and fixes files 24 | ``` 25 | yarn run lint 26 | ``` 27 | 28 | ### Customize configuration 29 | See [Configuration Reference](https://cli.vuejs.org/config/). 30 | -------------------------------------------------------------------------------- /todolist/README.md: -------------------------------------------------------------------------------- 1 | # ui-todolist 2 | 3 | ## Project setup 4 | ``` 5 | yarn install 6 | ``` 7 | 8 | ### Compiles and hot-reloads for development 9 | ``` 10 | yarn run serve 11 | ``` 12 | 13 | ### Compiles and minifies for production 14 | ``` 15 | yarn run build 16 | ``` 17 | 18 | ### Run your tests 19 | ``` 20 | yarn run test 21 | ``` 22 | 23 | ### Lints and fixes files 24 | ``` 25 | yarn run lint 26 | ``` 27 | 28 | ### Customize configuration 29 | See [Configuration Reference](https://cli.vuejs.org/config/). 30 | -------------------------------------------------------------------------------- /vantUI-maizuo/README.md: -------------------------------------------------------------------------------- 1 | # 01maizuo 2 | 3 | ## Project setup 4 | ``` 5 | yarn install 6 | ``` 7 | 8 | ### Compiles and hot-reloads for development 9 | ``` 10 | yarn run serve 11 | ``` 12 | 13 | ### Compiles and minifies for production 14 | ``` 15 | yarn run build 16 | ``` 17 | 18 | ### Run your tests 19 | ``` 20 | yarn run test 21 | ``` 22 | 23 | ### Lints and fixes files 24 | ``` 25 | yarn run lint 26 | ``` 27 | 28 | ### Customize configuration 29 | See [Configuration Reference](https://cli.vuejs.org/config/). 30 | -------------------------------------------------------------------------------- /mongoDB-shop/src/views/Home/componets/NavBread.vue: -------------------------------------------------------------------------------- 1 | 11 | 12 | 15 | 16 | -------------------------------------------------------------------------------- /vantUI-maizuo/src/views/ComingSoon.vue: -------------------------------------------------------------------------------- 1 | 8 | 9 | 27 | 30 | 31 | -------------------------------------------------------------------------------- /shopcar/src/components/Modal.vue: -------------------------------------------------------------------------------- 1 | 8 | 9 | 18 | 19 | -------------------------------------------------------------------------------- /small-douban/src/views/My/index.vue: -------------------------------------------------------------------------------- 1 | 13 | 14 | 25 | 26 | -------------------------------------------------------------------------------- /shopcar/public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 02cart 9 | 10 | 11 | 14 |
15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /mongoDB-shop/src/App.vue: -------------------------------------------------------------------------------- 1 | 10 | 11 | 33 | -------------------------------------------------------------------------------- /todolist/public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | ui-todolist 9 | 10 | 11 | 14 |
15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /mongoDB-shop/src/router/index.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import VueRouter from 'vue-router' 3 | import Home from '../views/Home.vue' 4 | 5 | Vue.use(VueRouter) 6 | 7 | const routes = [ 8 | { 9 | path: '/', 10 | name: 'home', 11 | component: Home 12 | }, 13 | { 14 | path: '/about', 15 | name: 'about', 16 | component: () => import('../views/About.vue') 17 | },{ 18 | path:"/cart", 19 | name:"cart", 20 | component:() => import('../views/Cart.vue') 21 | } 22 | ] 23 | 24 | const router = new VueRouter({ 25 | mode: 'history', 26 | base: process.env.BASE_URL, 27 | routes 28 | }) 29 | 30 | export default router 31 | -------------------------------------------------------------------------------- /mongoDB-shop/server/models/users.js: -------------------------------------------------------------------------------- 1 | var mongoose = require('./db'); 2 | var UserSchema = new mongoose.Schema({ 3 | userId: String, 4 | userName: String, 5 | userPwd: String, 6 | orderList: Array, 7 | cartList: [{ 8 | productImage: String, 9 | salePrice:Number, 10 | productName:String, 11 | productId:String, 12 | productNum:Number, 13 | checked:{ 14 | type:Boolean, 15 | default:true 16 | } 17 | } 18 | 19 | ], 20 | addressList: Array 21 | }) 22 | var Users = mongoose.model('Users', UserSchema, 'users'); 23 | module.exports = Users; -------------------------------------------------------------------------------- /small-douban/src/components/MusicItem.vue: -------------------------------------------------------------------------------- 1 | 8 | 9 | 25 | 26 | -------------------------------------------------------------------------------- /vantUI-maizuo/src/store/index.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import Vuex from 'vuex' 3 | 4 | Vue.use(Vuex) 5 | function getCity(){ 6 | let defaultCity = "武汉"; 7 | if(localStorage.getItem("city")){ 8 | defaultCity = localStorage.getItem("city") 9 | } 10 | return defaultCity 11 | } 12 | export default new Vuex.Store({ 13 | state: { 14 | isLoading:true, 15 | city:getCity() 16 | }, 17 | mutations: { 18 | changeCity(state,city){ 19 | state.city = city 20 | } 21 | }, 22 | actions: { 23 | changeCity(ctx,city){ 24 | ctx.commit("changeCity",city) 25 | localStorage.setItem("item",city) 26 | } 27 | }, 28 | modules: { 29 | } 30 | }) 31 | -------------------------------------------------------------------------------- /vantUI-maizuo/public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 01maizuo 10 | 11 | 12 | 15 |
16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /mongoDB-shop/src/main.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import App from './App.vue' 3 | import router from './router' 4 | import store from './store' 5 | import axios from 'axios' 6 | import ElementUI from 'element-ui'; 7 | import Vant from 'vant'; 8 | import 'vant/lib/index.css' 9 | import 'element-ui/lib/theme-chalk/index.css'; 10 | Vue.config.productionTip = false 11 | axios.defaults.withCredentials = true //允许http请求携带cookie 12 | axios.defaults.crossDomain = true //允许跨域去访问cookie 13 | //允许跨域访问cookie 14 | axios.defaults.baseURL = 'http://192.168.14.44:3000' 15 | Vue.prototype.$http = axios 16 | Vue.use(ElementUI); 17 | Vue.use(Vant) 18 | new Vue({ 19 | router, 20 | store, 21 | render: h => h(App) 22 | }).$mount('#app') 23 | -------------------------------------------------------------------------------- /mongoDB-shop/public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | vue-shop 10 | 11 | 12 | 15 |
16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /small-douban/public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | douban 11 | 12 | 13 | 16 |
17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /small-douban/src/views/Music/hotSongs.vue: -------------------------------------------------------------------------------- 1 | 6 | 7 | 26 | 27 | -------------------------------------------------------------------------------- /small-douban/src/components/MovieItem.vue: -------------------------------------------------------------------------------- 1 | 9 | 10 | 31 | 32 | -------------------------------------------------------------------------------- /small-douban/src/views/Music/japanSongs.vue: -------------------------------------------------------------------------------- 1 | 6 | 7 | 26 | 27 | -------------------------------------------------------------------------------- /vantUI-maizuo/src/router/index.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import VueRouter from 'vue-router' 3 | Vue.use(VueRouter) 4 | const routes = [{ 5 | path: '/films/nowPlaying', 6 | name:"nowPlaying", 7 | component: () => import('../views/NowPlaying.vue') 8 | }, 9 | { 10 | path: '/films/comingSoon', 11 | component: () => import('../views/ComingSoon.vue') 12 | }, 13 | { 14 | path: '/', 15 | redirect: "/films/nowPlaying" 16 | }, 17 | { 18 | path:'/detail', 19 | component:() => import('../views/Detail.vue') 20 | }, 21 | { 22 | path:'/city', 23 | component:() => import('../views/City.vue') 24 | } 25 | ] 26 | const router = new VueRouter({ 27 | mode: 'hash', 28 | base: process.env.BASE_URL, 29 | routes 30 | }) 31 | 32 | export default router -------------------------------------------------------------------------------- /small-douban/src/views/Movie/comingsoon.vue: -------------------------------------------------------------------------------- 1 | 6 | 7 | 27 | 28 | -------------------------------------------------------------------------------- /mongoDB-shop/server/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "server", 3 | "version": "0.1.0", 4 | "private": true, 5 | "scripts": { 6 | "start": "node bin/www", 7 | "dev": "./node_modules/.bin/nodemon bin/www", 8 | "prd": "pm2 start bin/www", 9 | "test": "echo \"Error: no test specified\" && exit 1" 10 | }, 11 | "dependencies": { 12 | "debug": "^4.1.1", 13 | "koa": "^2.7.0", 14 | "koa-bodyparser": "^4.2.1", 15 | "koa-convert": "^1.2.0", 16 | "koa-json": "^2.0.2", 17 | "koa-logger": "^3.2.0", 18 | "koa-onerror": "^4.1.0", 19 | "koa-router": "^7.4.0", 20 | "koa-static": "^5.0.0", 21 | "koa-views": "^6.2.0", 22 | "koa2-cors": "^2.0.6", 23 | "mongoose": "^5.7.13", 24 | "pug": "^2.0.3" 25 | }, 26 | "devDependencies": { 27 | "nodemon": "^1.19.1" 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /small-douban/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "douban", 3 | "version": "0.1.0", 4 | "private": true, 5 | "scripts": { 6 | "serve": "vue-cli-service serve", 7 | "build": "vue-cli-service build", 8 | "lint": "vue-cli-service lint" 9 | }, 10 | "dependencies": { 11 | "amfe-flexible": "^2.2.1", 12 | "axios": "^0.19.0", 13 | "core-js": "^3.4.3", 14 | "postcss-pxtorem": "^4.0.1", 15 | "vant": "^2.2.14", 16 | "vue": "^2.6.10", 17 | "vue-router": "^3.1.3", 18 | "vuex": "^3.1.2" 19 | }, 20 | "devDependencies": { 21 | "@vue/cli-plugin-babel": "^4.1.0", 22 | "@vue/cli-plugin-eslint": "^4.1.0", 23 | "@vue/cli-service": "^4.1.0", 24 | "babel-eslint": "^10.0.3", 25 | "eslint": "^5.16.0", 26 | "eslint-plugin-vue": "^5.0.0", 27 | "vue-template-compiler": "^2.6.10" 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /small-douban/src/views/Movie/intheaters.vue: -------------------------------------------------------------------------------- 1 | 6 | 7 | 27 | 28 | -------------------------------------------------------------------------------- /vantUI-maizuo/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "01maizuo", 3 | "version": "0.1.0", 4 | "private": true, 5 | "scripts": { 6 | "serve": "vue-cli-service serve", 7 | "build": "vue-cli-service build", 8 | "lint": "vue-cli-service lint" 9 | }, 10 | "dependencies": { 11 | "amfe-flexible": "^2.2.1", 12 | "axios": "^0.19.0", 13 | "core-js": "^3.3.2", 14 | "lib-flexible": "^0.3.2", 15 | "postcss-pxtorem": "^4.0.1", 16 | "vant": "^2.2.13", 17 | "vue": "^2.6.10", 18 | "vue-router": "^3.1.3", 19 | "vuex": "^3.0.1" 20 | }, 21 | "devDependencies": { 22 | "@vue/cli-plugin-babel": "^4.0.0", 23 | "@vue/cli-plugin-eslint": "^4.0.0", 24 | "@vue/cli-service": "^4.0.0", 25 | "babel-eslint": "^10.0.3", 26 | "eslint": "^5.16.0", 27 | "eslint-plugin-vue": "^5.0.0", 28 | "vue-template-compiler": "^2.6.10" 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /small-douban/src/views/Movie/top250.vue: -------------------------------------------------------------------------------- 1 | 6 | 7 | 27 | 28 | -------------------------------------------------------------------------------- /mongoDB-shop/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "vue-shop", 3 | "version": "0.1.0", 4 | "private": true, 5 | "scripts": { 6 | "serve": "vue-cli-service serve", 7 | "build": "vue-cli-service build", 8 | "lint": "vue-cli-service lint" 9 | }, 10 | "dependencies": { 11 | "axios": "^0.19.0", 12 | "core-js": "^3.4.3", 13 | "element-ui": "^2.13.0", 14 | "vant": "^2.2.16", 15 | "vue": "^2.6.10", 16 | "vue-router": "^3.1.3", 17 | "vuex": "^3.1.2" 18 | }, 19 | "devDependencies": { 20 | "@vue/cli-plugin-babel": "^4.1.0", 21 | "@vue/cli-plugin-eslint": "^4.1.0", 22 | "@vue/cli-service": "^4.1.0", 23 | "babel-eslint": "^10.0.3", 24 | "babel-plugin-component": "^1.1.1", 25 | "eslint": "^5.16.0", 26 | "eslint-plugin-vue": "^5.0.0", 27 | "sass": "^1.23.7", 28 | "sass-loader": "^8.0.0", 29 | "vue-template-compiler": "^2.6.10" 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /mongoDB-shop/server/routes/goods.js: -------------------------------------------------------------------------------- 1 | const router = require('koa-router')() 2 | const GoodsModel = require('../models/goods') 3 | router.get('/goods/list', async (ctx) => { 4 | /* ctx.cookies.set("name") */ 5 | var {start,limit} = ctx.query; 6 | var total = await GoodsModel.find({}).count(); 7 | var data = await GoodsModel.find({}).skip(Number(start)).limit(Number(limit)); 8 | ctx.body ={ 9 | code:200, 10 | msg:"首页数据请求成功", 11 | result:data, 12 | total:total 13 | } 14 | }) 15 | /* 根据区间查询 */ 16 | router.get("/goods/price",async ctx=>{ 17 | var {gt,lt} = ctx.query; 18 | var data = await GoodsModel.find({salePrice:{$gt:gt,$lt:lt}}) 19 | if(data.length){ 20 | ctx.body ={ 21 | code:200, 22 | msg:"数据请求成功", 23 | result:data, 24 | total:data.length 25 | } 26 | }else{ 27 | ctx.body = { 28 | code:1001, 29 | msg:'没有数据' 30 | } 31 | } 32 | }) 33 | module.exports = router 34 | -------------------------------------------------------------------------------- /vantUI-maizuo/src/main.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import App from './App.vue' 3 | import router from './router' 4 | import store from './store' 5 | /* import 'lib-flexible/flexible' */ 6 | import axios from 'axios' 7 | import Vant from 'vant' 8 | import 'vant/lib/index.css'; 9 | import 'amfe-flexible/index.js' 10 | import { IndexBar, IndexAnchor } from 'vant'; 11 | Vue.config.productionTip = false 12 | axios.defaults.baseURL = 'https://douban.uieee.com/v2/movie'; 13 | Vue.use(Vant); 14 | Vue.use(IndexBar).use(IndexAnchor); 15 | Vue.prototype.axios = axios 16 | axios.interceptors.request.use(function (config) { 17 | // Do something before request is sent 18 | store.state.isLoading = true; 19 | return config; 20 | }); 21 | axios.interceptors.response.use(function (response) { 22 | // Do something with response data 23 | store.state.isLoading = false 24 | return response; 25 | }) 26 | new Vue({ 27 | router, 28 | store, 29 | render: h => h(App) 30 | }).$mount('#app') -------------------------------------------------------------------------------- /small-douban/src/views/Music/recommendDj.vue: -------------------------------------------------------------------------------- 1 | 6 | 7 | 35 | 36 | -------------------------------------------------------------------------------- /mongoDB-shop/src/views/Home/index.vue: -------------------------------------------------------------------------------- 1 | 12 | 13 | 39 | 46 | -------------------------------------------------------------------------------- /mongoDB-shop/README.en.md: -------------------------------------------------------------------------------- 1 | # vue-shop 2 | 3 | #### Description 4 | {**When you're done, you can delete the content in this README and update the file with details for others getting started with your repository**} 5 | 6 | #### Software Architecture 7 | Software architecture description 8 | 9 | #### Installation 10 | 11 | 1. xxxx 12 | 2. xxxx 13 | 3. xxxx 14 | 15 | #### Instructions 16 | 17 | 1. xxxx 18 | 2. xxxx 19 | 3. xxxx 20 | 21 | #### Contribution 22 | 23 | 1. Fork the repository 24 | 2. Create Feat_xxx branch 25 | 3. Commit your code 26 | 4. Create Pull Request 27 | 28 | 29 | #### Gitee Feature 30 | 31 | 1. You can use Readme\_XXX.md to support different languages, such as Readme\_en.md, Readme\_zh.md 32 | 2. Gitee blog [blog.gitee.com](https://blog.gitee.com) 33 | 3. Explore open source project [https://gitee.com/explore](https://gitee.com/explore) 34 | 4. The most valuable open source project [GVP](https://gitee.com/gvp) 35 | 5. The manual of Gitee [https://gitee.com/help](https://gitee.com/help) 36 | 6. The most popular members [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/) 37 | -------------------------------------------------------------------------------- /small-douban/src/views/Admin.vue: -------------------------------------------------------------------------------- 1 | 8 | 9 | 18 | 19 | -------------------------------------------------------------------------------- /shopcar/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "02cart", 3 | "version": "0.1.0", 4 | "private": true, 5 | "scripts": { 6 | "serve": "vue-cli-service serve", 7 | "build": "vue-cli-service build", 8 | "lint": "vue-cli-service lint" 9 | }, 10 | "dependencies": { 11 | "axios": "^0.19.0", 12 | "core-js": "^3.3.2", 13 | "vue": "^2.6.10" 14 | }, 15 | "devDependencies": { 16 | "@vue/cli-plugin-babel": "^4.0.0", 17 | "@vue/cli-plugin-eslint": "^4.0.0", 18 | "@vue/cli-service": "^4.0.0", 19 | "babel-eslint": "^10.0.3", 20 | "eslint": "^5.16.0", 21 | "eslint-plugin-vue": "^5.0.0", 22 | "vue-template-compiler": "^2.6.10" 23 | }, 24 | "eslintConfig": { 25 | "root": true, 26 | "env": { 27 | "node": true 28 | }, 29 | "extends": [ 30 | "plugin:vue/essential", 31 | "eslint:recommended" 32 | ], 33 | "rules": {}, 34 | "parserOptions": { 35 | "parser": "babel-eslint" 36 | } 37 | }, 38 | "postcss": { 39 | "plugins": { 40 | "autoprefixer": {} 41 | } 42 | }, 43 | "browserslist": [ 44 | "> 1%", 45 | "last 2 versions" 46 | ] 47 | } 48 | -------------------------------------------------------------------------------- /todolist/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ui-todolist", 3 | "version": "0.1.0", 4 | "private": true, 5 | "scripts": { 6 | "serve": "vue-cli-service serve", 7 | "build": "vue-cli-service build", 8 | "lint": "vue-cli-service lint" 9 | }, 10 | "dependencies": { 11 | "core-js": "^3.3.2", 12 | "element-ui": "^2.12.0", 13 | "vue": "^2.6.10" 14 | }, 15 | "devDependencies": { 16 | "@vue/cli-plugin-babel": "^4.0.0", 17 | "@vue/cli-plugin-eslint": "^4.0.0", 18 | "@vue/cli-service": "^4.0.0", 19 | "babel-eslint": "^10.0.3", 20 | "eslint": "^5.16.0", 21 | "eslint-plugin-vue": "^5.0.0", 22 | "vue-template-compiler": "^2.6.10" 23 | }, 24 | "eslintConfig": { 25 | "root": true, 26 | "env": { 27 | "node": true 28 | }, 29 | "extends": [ 30 | "plugin:vue/essential", 31 | "eslint:recommended" 32 | ], 33 | "rules": {}, 34 | "parserOptions": { 35 | "parser": "babel-eslint" 36 | } 37 | }, 38 | "postcss": { 39 | "plugins": { 40 | "autoprefixer": {} 41 | } 42 | }, 43 | "browserslist": [ 44 | "> 1%", 45 | "last 2 versions" 46 | ] 47 | } 48 | -------------------------------------------------------------------------------- /small-douban/src/App.vue: -------------------------------------------------------------------------------- 1 | 12 | 13 | 47 | -------------------------------------------------------------------------------- /mongoDB-shop/src/views/Home/componets/CartItem.vue: -------------------------------------------------------------------------------- 1 | 11 | 12 | 34 | 35 | -------------------------------------------------------------------------------- /mongoDB-shop/mongo/readme.md: -------------------------------------------------------------------------------- 1 | ``` 2 | show dbs //显示所有的数据库 3 | use shop //切换shop这个库 4 | show collections //看库中有几张表 5 | 6 | ``` 7 | 8 | ``` 9 | db.goods.find({}) 10 | //只查第一条和第二条 skip limit 11 | //skip是下标 limit查询多少条 12 | db.goods.find({}).skip(0).limit(2) 13 | ``` 14 | 15 | ``` 16 | //升序sort({condition:1}) 降序sort({condition:-1}) 17 | ``` 18 | 19 | ```js 20 | //根据价格大小排序 升序 21 | db.goods.find({}).sort({price:1}) 22 | //根据价格大小排序 降序 23 | db.goods.find({}).sort({price:-1}) 24 | ``` 25 | 26 | ``` 27 | //> 大于某个数 28 | //选择price大于1000的商品 29 | db.goods.find({condition:{$gt:1000}}) 30 | //$lt 小于某个数 31 | //选择price小于1000的商品 32 | db.goods.find({condition:{$lt:1000}}) 33 | //选择price大于900,小于1100的商品 34 | db.goods.find({price:{$gt:900,$lt:1100}}) 35 | ``` 36 | 37 | ``` 38 | //count()统计数据 39 | db.goods.find({}).count(); 40 | ``` 41 | 42 | ## 二、内嵌数组的添加和删除,更新 43 | 44 | ``` 45 | //carts 46 | { 47 | userId:1001, 48 | cartList:[ 49 | {id:100,name:"book"} 50 | ] 51 | 52 | } 53 | ``` 54 | 55 | ``` 56 | //$push 向carts这张表中的cartList添加一条数据 57 | db.carts.update({userId:1001},{$push:{cartList:{id:200,name:"imac"}}}) 58 | ``` 59 | 60 | ``` 61 | //$pull 删除 将carts这张表中的cartList中id等于100的数据删除 62 | db.carts.update({userId:1001},{$pull:{cartList:{id:100}}}) 63 | ``` 64 | 65 | ``` 66 | //$set 更新的操作 67 | db.carts.update({userId:1001,"cartList.id":100},{$set:{"cartList.$.name":"xiaomi"}}) 68 | ``` 69 | 70 | -------------------------------------------------------------------------------- /todolist/src/components/Item.vue: -------------------------------------------------------------------------------- 1 | 10 | 11 | 31 | 32 | -------------------------------------------------------------------------------- /vantUI-maizuo/src/components/Item.vue: -------------------------------------------------------------------------------- 1 | 17 | 18 | 33 | 34 | -------------------------------------------------------------------------------- /vantUI-maizuo/src/views/NowPlaying.vue: -------------------------------------------------------------------------------- 1 | 8 | 9 | 53 | 55 | -------------------------------------------------------------------------------- /mongoDB-shop/server/app.js: -------------------------------------------------------------------------------- 1 | const Koa = require('koa') 2 | const app = new Koa() 3 | const views = require('koa-views') 4 | const json = require('koa-json') 5 | const onerror = require('koa-onerror') 6 | const bodyparser = require('koa-bodyparser') 7 | const logger = require('koa-logger') 8 | const cors = require('koa2-cors') 9 | const goods = require('./routes/goods') 10 | const users = require('./routes/users') 11 | 12 | // error handler 13 | onerror(app) 14 | 15 | // middlewares 16 | app.use(bodyparser({ 17 | enableTypes:['json', 'form', 'text'] 18 | })) 19 | app.use(cors({ 20 | origin:"http://192.168.14.44:8080", //配置允许跨域的域名 "*" 所有 21 | credentials:true 22 | })) 23 | app.use(json()) 24 | app.use(logger()) 25 | app.use(require('koa-static')(__dirname + '/public')) 26 | 27 | app.use(views(__dirname + '/views', { 28 | extension: 'pug' 29 | })) 30 | 31 | // logger 32 | app.use(async (ctx, next) => { 33 | const start = new Date() 34 | await next() 35 | const ms = new Date() - start 36 | console.log(`${ctx.method} ${ctx.url} - ${ms}ms`) 37 | }) 38 | //中间件 39 | app.use(async (ctx,next)=>{ 40 | console.log(ctx.path) 41 | //登录才能访问后端其他的接口 42 | if(ctx.cookies.get("userId")){ 43 | await next() 44 | }else{ 45 | //白名单 46 | //没有登陆的情况下后端有些接口可以访问 47 | if(ctx.path =='/users/login'||ctx.path=='/goods/list'||ctx.path == '/users/Logout'){ 48 | await next() 49 | }else{ 50 | ctx.body = { 51 | code:1001, 52 | msg:"未登录" 53 | } 54 | } 55 | 56 | } 57 | }) 58 | // routes 59 | app.use(goods.routes(), goods.allowedMethods()) 60 | app.use(users.routes(), users.allowedMethods()) 61 | 62 | // error-handling 63 | app.on('error', (err, ctx) => { 64 | console.error('server error', err, ctx) 65 | }); 66 | 67 | module.exports = app 68 | -------------------------------------------------------------------------------- /small-douban/src/views/Read/readDetail.vue: -------------------------------------------------------------------------------- 1 | 17 | 18 | 42 | 43 | -------------------------------------------------------------------------------- /small-douban/src/views/Music/musicDetail.vue: -------------------------------------------------------------------------------- 1 | 14 | 15 | 43 | 44 | -------------------------------------------------------------------------------- /small-douban/src/router/index.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import VueRouter from 'vue-router' 3 | import Read from '../views/Read/index.vue' 4 | Vue.use(VueRouter) 5 | 6 | const routes = [ 7 | { 8 | path:'/', 9 | redirect:"admin" 10 | }, 11 | { 12 | path: '/read', 13 | name: 'read', 14 | component: Read 15 | }, 16 | { 17 | path:'/readDetail', 18 | component:()=>import('../views/Read/readDetail.vue') 19 | }, 20 | { 21 | path: '/movie', 22 | name: 'movie', 23 | component: () => import('../views/Movie') 24 | }, 25 | { 26 | path:'/admin', 27 | name:'admin', 28 | component:() =>import('../views/Admin') 29 | }, 30 | { 31 | path:'/in_theaters', 32 | component:()=>import('../views/Movie/intheaters.vue') 33 | }, 34 | { 35 | path:'/coming_soon', 36 | component:()=>import('../views/Movie/comingsoon.vue') 37 | }, 38 | { 39 | path:'/top250', 40 | component:()=>import('../views/Movie/top250.vue') 41 | }, 42 | { 43 | path:'/music', 44 | component:()=>import('../views/Music') 45 | }, 46 | { 47 | path:'/movieDetail', 48 | component:()=>import('../views/Movie/movieDetail') 49 | }, 50 | { 51 | path:'/hotSongs', 52 | component:()=>import('../views/Music/hotSongs.vue') 53 | }, 54 | { 55 | path:'/japanSongs', 56 | component:()=>import('../views/Music/japanSongs.vue') 57 | }, 58 | { 59 | path:'/recommendDj', 60 | component:()=>import('../views/Music/recommendDj.vue') 61 | }, 62 | { 63 | path:'/musicDetail', 64 | component:()=>import('../views/Music/musicDetail.vue') 65 | }, 66 | { 67 | path:'/musicPlay', 68 | component:()=>import('../views/Music/musicPlay.vue') 69 | },{ 70 | path:'/my', 71 | component:()=>import('../views/My') 72 | } 73 | ] 74 | 75 | const router = new VueRouter({ 76 | mode: 'hash', 77 | base: process.env.BASE_URL, 78 | routes 79 | }) 80 | 81 | export default router 82 | -------------------------------------------------------------------------------- /mongoDB-shop/server/bin/www: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | /** 4 | * Module dependencies. 5 | */ 6 | 7 | var app = require('../app'); 8 | var debug = require('debug')('demo:server'); 9 | var http = require('http'); 10 | 11 | /** 12 | * Get port from environment and store in Express. 13 | */ 14 | 15 | var port = normalizePort(process.env.PORT || '3000'); 16 | // app.set('port', port); 17 | 18 | /** 19 | * Create HTTP server. 20 | */ 21 | 22 | var server = http.createServer(app.callback()); 23 | 24 | /** 25 | * Listen on provided port, on all network interfaces. 26 | */ 27 | 28 | server.listen(port); 29 | server.on('error', onError); 30 | server.on('listening', onListening); 31 | 32 | /** 33 | * Normalize a port into a number, string, or false. 34 | */ 35 | 36 | function normalizePort(val) { 37 | var port = parseInt(val, 10); 38 | 39 | if (isNaN(port)) { 40 | // named pipe 41 | return val; 42 | } 43 | 44 | if (port >= 0) { 45 | // port number 46 | return port; 47 | } 48 | 49 | return false; 50 | } 51 | 52 | /** 53 | * Event listener for HTTP server "error" event. 54 | */ 55 | 56 | function onError(error) { 57 | if (error.syscall !== 'listen') { 58 | throw error; 59 | } 60 | 61 | var bind = typeof port === 'string' 62 | ? 'Pipe ' + port 63 | : 'Port ' + port; 64 | 65 | // handle specific listen errors with friendly messages 66 | switch (error.code) { 67 | case 'EACCES': 68 | console.error(bind + ' requires elevated privileges'); 69 | process.exit(1); 70 | break; 71 | case 'EADDRINUSE': 72 | console.error(bind + ' is already in use'); 73 | process.exit(1); 74 | break; 75 | default: 76 | throw error; 77 | } 78 | } 79 | 80 | /** 81 | * Event listener for HTTP server "listening" event. 82 | */ 83 | 84 | function onListening() { 85 | var addr = server.address(); 86 | var bind = typeof addr === 'string' 87 | ? 'pipe ' + addr 88 | : 'port ' + addr.port; 89 | debug('Listening on ' + bind); 90 | } 91 | -------------------------------------------------------------------------------- /vantUI-maizuo/src/App.vue: -------------------------------------------------------------------------------- 1 | 22 | 23 | 42 | 88 | -------------------------------------------------------------------------------- /shopcar/src/App.vue: -------------------------------------------------------------------------------- 1 | 30 | 31 | 85 | 86 | 95 | -------------------------------------------------------------------------------- /todolist/src/App.vue: -------------------------------------------------------------------------------- 1 | 20 | 21 | 67 | 68 | 105 | -------------------------------------------------------------------------------- /mongoDB-shop/src/assets/logo.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /mongoDB-shop/src/assets/logo_wps图片.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /small-douban/src/views/Music/index.vue: -------------------------------------------------------------------------------- 1 | 32 | 72 | -------------------------------------------------------------------------------- /small-douban/src/views/Movie/index.vue: -------------------------------------------------------------------------------- 1 | 34 | 77 | -------------------------------------------------------------------------------- /small-douban/src/views/Read/index.vue: -------------------------------------------------------------------------------- 1 | 25 | 53 | -------------------------------------------------------------------------------- /mongoDB-shop/server/routes/users.js: -------------------------------------------------------------------------------- 1 | const router = require('koa-router')() 2 | const UsersModel = require('../models/users') 3 | const GoodsModel = require('../models/goods'); 4 | router.prefix('/users') 5 | 6 | router.get('/', async ctx => { 7 | var data = await UsersModel.find({}); 8 | ctx.body = { 9 | code:200, 10 | msg:"用户数据请求成功", 11 | result:data 12 | } 13 | }) 14 | 15 | router.post('/addCart' , async ctx=>{ 16 | var userId = ctx.cookies.get('userId'); 17 | if(userId){ 18 | var {productId} = ctx.request.body; 19 | console.log(productId) 20 | var goodsData = await GoodsModel.findOne({productId:productId}); 21 | var obj= JSON.parse(JSON.stringify(goodsData)); 22 | obj.productNum = 1; 23 | obj.checked = true; 24 | var userData = await UsersModel.findOne({}); 25 | if(userData.cartList.every(item => item.productId !=productId)){ 26 | await UsersModel.update({userId:userId},{$push:{"cartList":obj}}) 27 | ctx.body = { 28 | msg:"添加成功", 29 | code:200 30 | } 31 | }else{ 32 | ctx.body={ 33 | msg:"已经添加到购物车", 34 | code:200 35 | } 36 | } 37 | }else{ 38 | ctx.body = { 39 | msg:"没有登录" 40 | } 41 | } 42 | /* 从goods查询数据 添加到users */ 43 | }) 44 | //登录模块 45 | router.post('/login',async ctx=>{ 46 | var data = ctx.request.body; 47 | var res = await UsersModel.findOne(data); 48 | if(res){ 49 | ctx.cookies.set('userId',res.userId,{ 50 | maxAge:1000*60*60 51 | }) 52 | ctx.cookies.set('userName',res.userName,{ 53 | maxAge:1000*60*60 54 | }) 55 | ctx.body = { 56 | code:"200", 57 | msg:"登录成功", 58 | result:res.userName 59 | } 60 | }else{ 61 | ctx.body = { 62 | code:"400", 63 | msg:"用户名和密码错误" 64 | } 65 | } 66 | }) 67 | //检查一下登陆的状态 68 | router.get('/checkLogin',async ctx =>{ 69 | var userId = ctx.cookies.get("userId"); 70 | if(userId){ 71 | ctx.body={ 72 | code:200, 73 | msg:"登录成功", 74 | result:ctx.cookies.get("userName") 75 | } 76 | }else{ 77 | ctx.body={ 78 | code:1001, 79 | msg:"未登录" 80 | } 81 | } 82 | }) 83 | 84 | //注销登陆 85 | router.post('/logout',async ctx=>{ 86 | ctx.cookies.set("userId","",{ 87 | maxAge:-1 88 | }) 89 | ctx.cookies.set("userName","",{ 90 | maxAge:-1 91 | }) 92 | ctx.body = { 93 | code:200, 94 | msg:"退出登录" 95 | } 96 | }) 97 | router.get('/cartList',async ctx=>{ 98 | var data = await UsersModel.findOne({}); 99 | var res = data.cartList; 100 | console.log(res) 101 | ctx.body = { 102 | code:200, 103 | result:res 104 | } 105 | }) 106 | router.post('/cartList/del',async ctx=>{ 107 | var {productId} = ctx.request.body; 108 | var userId = ctx.cookies.get("userId"); 109 | var data = await UsersModel.update({userId:userId},{$pull:{cartList:{productId:productId}}}) 110 | if(data.ok==1){ 111 | ctx.body = { 112 | code:200, 113 | msg:"删除成功" 114 | } 115 | }else{ 116 | ctx.body = { 117 | code:1001, 118 | msg:"删除失败" 119 | } 120 | } 121 | }) 122 | router.post('/cartList/edit',async ctx=>{ 123 | var {productNum,productId,checked} = ctx.request.body; 124 | var userId = ctx.cookies.get("userId"); 125 | var data = await UsersModel.update( 126 | {userId:userId,"cartList.productId": 127 | productId},{$set:{ 128 | "cartList.$.productNum":productNum, 129 | "cartList.$.checked":checked, 130 | }}); 131 | if(data.ok==1){ 132 | ctx.body = { 133 | msg:"修改成功", 134 | code:200 135 | } 136 | } 137 | }) 138 | module.exports = router 139 | -------------------------------------------------------------------------------- /mongoDB-shop/README.md: -------------------------------------------------------------------------------- 1 | # vue-shop 2 | 3 | # 一、koa脚手架 4 | ```js 5 | //1.安装依赖 cmd 6 | npm i koa-generator -g 7 | ``` 8 | 9 | ```js 10 | //2.创建项目 vue-shop 打开命令窗口 11 | koa2 server 12 | ``` 13 | 14 | ```js 15 | //3.启动项目 vscode打开server文件夹 16 | npm i 17 | npm run dev //bin目录下看端口 3000 ,localhost:3000 18 | ``` 19 | 20 | # 二、操作数据库 21 | 22 | ```js 23 | //1.安装mongoose 24 | yarn add mongoose 25 | ``` 26 | 27 | ## 2-1 mongoose模块化 28 | 29 | ```js 30 | //db.js 31 | //1.导入 32 | const mongoose = require('mongoose'); 33 | 34 | //2.连接 35 | mongoose.connect( 'mongodb://127.0.0.1:27017/shop', {useNewUrlParser: true},(err)=>{ 36 | if(err){throw err}; 37 | console.log("数据库连接成功") 38 | }); 39 | module.exports = mongoose 40 | ``` 41 | 42 | ```js 43 | //goods.js 44 | //3.定义schema和数据库中的表映射 45 | const mongoose = require('./db'); 46 | var GoodsSchema = new mongoose.Schema({ 47 | productId:String, 48 | productName:String, 49 | salePrice:Number, 50 | productImage:String, 51 | productUrl:String 52 | }) 53 | var Goods = mongoose.model('Goods',GoodsSchema,'goods'); 54 | module.exports = Goods; 55 | ``` 56 | 57 | # 三、给前端返回的数据格式 58 | 59 | ```js 60 | //routers/goods.js 61 | { 62 | //200请求成功 1001没有请求成功 63 | code:200, 64 | msg:"请求成功", 65 | result:data, 66 | total:17 67 | //从数据中请求的数据装载到result中 68 | } 69 | ``` 70 | 71 | # 四、实现后端跨域 72 | 73 | ```js 74 | //1.安装 75 | yarn add koa2-cors 76 | //2.配置 http://localhost:8080/ 读取后台的数据 77 | //server/app.js 78 | const cors = require('koa2-cors'); 79 | app.use(cors({ 80 | origin:"*" //配置允许跨域的域名 81 | })) 82 | 83 | ``` 84 | 85 | # 五、axios-get 86 | 87 | ## 5-1 parmas参数传递数据给后端 88 | 89 | ```js 90 | //src/views/Home.vue 91 | axiosx({ 92 | url:'/goods/list', 93 | method:'get', 94 | params:{} 95 | }) 96 | ``` 97 | 98 | ```js 99 | methods:{ 100 | handlePrice(gt,lt){ 101 | console.log(gt,lt) 102 | this.$http({ 103 | url:'/goods/price', 104 | method:'get', 105 | params:{ 106 | gt, 107 | lt 108 | } 109 | }).then(res=>{ 110 | if(res.data.result ==200){ 111 | this.goodList = res.data.result 112 | }else{ 113 | this.goodList = []; 114 | this.message({ 115 | message:'没有数据', 116 | duration:1000, 117 | type:'warning' 118 | }) 119 | } 120 | }) 121 | } 122 | } 123 | ``` 124 | 125 | ## 5-2 后端query接受get传值 126 | 127 | ```js 128 | //根据价格大小查询 129 | router.get("/goods/price",async ctx=>{ 130 | var {gt,lt} = ctx.query; 131 | } 132 | ``` 133 | 134 | ## 5-3 对数据库进行查询 135 | 136 | ``` 137 | var data = await GoodsModel.find({salePrice:{$gt:gt,$lt:lt}}) 138 | ``` 139 | 140 | ## 5-4 对有数据和没数据的处理 141 | 142 | ```js 143 | //后台 144 | //根据价格大小查询 145 | router.get("/goods/price",async ctx=>{ 146 | var {gt,lt} = ctx.query; 147 | var data = await GoodsModel.find({salePrice:{$gt:gt,$lt:lt}}) 148 | if(data.length){ 149 | ctx.body ={ 150 | code:200, 151 | msg:"数据请求成功", 152 | result:data, 153 | total:data.length 154 | } 155 | }else{ 156 | ctx.body = { 157 | code:1001, 158 | msg:'没有数据' 159 | } 160 | } 161 | }) 162 | ``` 163 | 164 | ```js 165 | //前端 166 | methods:{ 167 | handlePrice(gt,lt){ 168 | console.log(gt,lt) 169 | this.$http({ 170 | url:'/goods/price', 171 | method:'get', 172 | params:{ 173 | gt, 174 | lt 175 | } 176 | }).then(res=>{ 177 | if(res.data.result ==200){ 178 | this.goodList = res.data.result 179 | }else{ 180 | this.goodList = []; 181 | this.message({ 182 | message:'没有数据', 183 | duration:1000, 184 | type:'warning' 185 | }) 186 | } 187 | }) 188 | } 189 | } 190 | ``` 191 | 192 | # -------------------------------------------------------------------------------- /mongoDB-shop/src/views/Home/componets/HomeTop.vue: -------------------------------------------------------------------------------- 1 | 29 | 30 | 114 | 115 | -------------------------------------------------------------------------------- /mongoDB-shop/src/views/Home/componets/Content.vue: -------------------------------------------------------------------------------- 1 | 35 | 36 | 117 | 118 | -------------------------------------------------------------------------------- /small-douban/src/views/Music/musicPlay.vue: -------------------------------------------------------------------------------- 1 | 22 | 23 | 75 | 76 | -------------------------------------------------------------------------------- /small-douban/src/views/Movie/movieDetail.vue: -------------------------------------------------------------------------------- 1 | 43 | 44 | 64 | 65 | -------------------------------------------------------------------------------- /mongoDB-shop/server/resource/goods-net.json: -------------------------------------------------------------------------------- 1 | {"_id":{"$oid":"58c284b13a1bb9aa7033801b"},"productId":"201710003","productName":"平衡车","salePrice":{"$numberInt":"1999"},"productImage":"https://cdn.cnbj0.fds.api.mi-img.com/b2c-miapp-a1/T1xVE_Bydv1RXrhCrK.jpg","productUrl":""} 2 | {"_id":{"$oid":"58c284d7117a2e6599abef5e"},"productId":"201710004","productName":"头戴式耳机-3","salePrice":{"$numberInt":"80"},"productImage":"https://cdn.cnbj0.fds.api.mi-img.com/b2c-miapp-a1/e4c0f21c-3bd4-323e-673b-a9c1c1c6e294.jpg","productUrl":""} 3 | {"_id":{"$oid":"58c284e6117a2e6599abef5f"},"productId":"201710005","productName":"小米笔记本","salePrice":{"$numberInt":"3549"},"productImage":"https://cdn.cnbj0.fds.api.mi-img.com/b2c-shopapi-pms/pms_1561023757.05432233.jpg","productUrl":""} 4 | {"_id":{"$oid":"58c284f4117a2e6599abef60"},"productId":"201710006","productName":"小米9","salePrice":{"$numberInt":"2499"},"productImage":"https://cdn.cnbj1.fds.api.mi-img.com/mi-mall/6e50095e49ec9acad6b91370373d99a8.jpg","productUrl":""} 5 | {"_id":{"$oid":"58e704ef98dab115d336b3f1"},"productId":"201710002","productName":"智能插线板","salePrice":{"$numberInt":"59"},"productImage":"https://cdn.cnbj0.fds.api.mi-img.com/b2c-shopapi-pms/pms_1557474791.84184829.jpg","productUrl":""} 6 | {"_id":{"$oid":"58e7050398dab115d336b3f2"},"productId":"201710007","productName":"自拍杆","salePrice":{"$numberInt":"39"},"productImage":"https://cdn.cnbj0.fds.api.mi-img.com/b2c-miapp-a1/dc04dc04-9a43-b521-dfbe-8f8039d16c95.jpg","productUrl":""} 7 | {"_id":{"$oid":"58e7050c98dab115d336b3f3"},"productId":"201710008","productName":"小米净水器","salePrice":{"$numberInt":"1999"},"productImage":"https://cdn.cnbj0.fds.api.mi-img.com/b2c-shopapi-pms/pms_1555486031.585971.jpg","productUrl":""} 8 | {"_id":{"$oid":"58e7051698dab115d336b3f4"},"productId":"201710009","productName":"IH 电饭煲","salePrice":{"$numberInt":"999"},"productImage":"https://cdn.cnbj0.fds.api.mi-img.com/b2c-shopapi-pms/pms_1553764670.0369286.jpg","productUrl":""} 9 | {"_id":{"$oid":"58e7052198dab115d336b3f5"},"productId":"201710010","productName":"小米电视4A","salePrice":{"$numberInt":"2099"},"productImage":"https://cdn.cnbj0.fds.api.mi-img.com/b2c-shopapi-pms/pms_1572837419.47939903.jpg","productUrl":""} 10 | {"_id":{"$oid":"58e7052a98dab115d336b3f6"},"productId":"201710011","productName":"小米空调","salePrice":{"$numberInt":"1000"},"productImage":"//cdn.cnbj0.fds.api.mi-img.com/b2c-mimall-media/2b911be4c2f156bb6e4cf367c6080045.jpg?thumb=1&w=200&h=200","productUrl":""} 11 | {"_id":{"$oid":"58e7053298dab115d336b3f7"},"productId":"201710012","productName":"小米洗衣机","salePrice":{"$numberInt":"1100"},"productImage":"//cdn.cnbj1.fds.api.mi-img.com/mi-mall/ec20453216dcd42f982cffe5fdbc3115.jpg?thumb=1&w=200&h=200&f=webp&q=90","productUrl":""} 12 | {"_id":{"$oid":"58e7053c98dab115d336b3f8"},"productId":"201710013","productName":"小米智能门锁","salePrice":{"$numberInt":"2000"},"productImage":"//cdn.cnbj1.fds.api.mi-img.com/mi-mall/0baacf6e54cbf89cab2c543cc02344e9.jpg?thumb=1&w=200&h=200&f=webp&q=90","productUrl":""} 13 | {"_id":{"$oid":"58e7054798dab115d336b3f9"},"productId":"201710014","productName":"九号平衡车","salePrice":{"$numberInt":"1600"},"productImage":"//cdn.cnbj1.fds.api.mi-img.com/mi-mall/0c65d472682f0679e192dc7b4cd6e64c.jpg?thumb=1&w=200&h=200&f=webp&q=90","productUrl":""} 14 | {"_id":{"$oid":"58e7055198dab115d336b3fa"},"productId":"201710015","productName":"米家烤箱","salePrice":{"$numberInt":"1200"},"productImage":"https://cdn.cnbj0.fds.api.mi-img.com/b2c-shopapi-pms/pms_1559644554.04136931.jpg","productUrl":""} 15 | {"_id":{"$oid":"58e7057798dab115d336b3fb"},"productId":"201710016","productName":"曲面电视","salePrice":{"$numberInt":"700"},"productImage":"//cdn.cnbj1.fds.api.mi-img.com/mi-mall/ef6b4e9b9151849b3b1fb1dbf069c6ed.jpg?thumb=1&w=200&h=200&f=webp&q=90","productUrl":""} 16 | {"_id":{"$oid":"58e7058498dab115d336b3fc"},"productId":"201710017","productName":"小钢炮蓝牙音箱","salePrice":{"$numberInt":"129"},"productImage":"https://cdn.cnbj0.fds.api.mi-img.com/b2c-miapp-a1/T1o7bgB5Kv1RXrhCrK.jpg","productUrl":""} 17 | {"_id":{"$oid":"58e7058d98dab115d336b3fd"},"productId":"201710018","productName":"智能摄像机","salePrice":{"$numberInt":"389"},"productImage":"https://cdn.cnbj0.fds.api.mi-img.com/b2c-shopapi-pms/pms_1529062317.63437020.jpg","productUrl":""} 18 | -------------------------------------------------------------------------------- /mongoDB-shop/src/views/Cart/index.vue: -------------------------------------------------------------------------------- 1 | 46 | 116 | -------------------------------------------------------------------------------- /mongoDB-shop/src/views/Cart.vue: -------------------------------------------------------------------------------- 1 | 40 | 41 | 116 | 117 | -------------------------------------------------------------------------------- /vantUI-maizuo/src/views/City.vue: -------------------------------------------------------------------------------- 1 | 77 | 78 | 95 | 96 | -------------------------------------------------------------------------------- /vantUI-maizuo/src/views/Detail.vue: -------------------------------------------------------------------------------- 1 | 67 | 68 | 106 | 107 | -------------------------------------------------------------------------------- /mongoDB-shop/server/resource/dumall-users.json: -------------------------------------------------------------------------------- 1 | {"_id":{"$oid":"58c41d5d3eddd93e9ab5b078"},"userId":"100000077","userName":"admin","userPwd":"123456","orderList":[{"orderId":"6224201705302250301","orderTotal":3359,"addressInfo":{"addressId":"100001","userName":"JackBean","streetName":"北京市朝阳区朝阳公园","postCode":100001,"tel":12345678901.0,"isDefault":true},"goodsList":[{"productImage":"mi6.jpg","salePrice":"2499","productName":"小米6","productId":"201710006","_id":{"$oid":"58c284f4117a2e6599abef60"},"productNum":"1","checked":"1"},{"productImage":"2.jpg","salePrice":"80","productName":"头戴式耳机-3","productId":"201710004","_id":{"$oid":"58c284d7117a2e6599abef5e"},"productNum":"7","checked":"1"}],"orderStatus":"1","createDate":"2017-05-30 22:50:30"},{"orderId":"9201706071525282","orderTotal":"5558","orderStatus":1,"_id":{"$oid":"5937aa68adad24614cb310af"},"createDate":"2017-06-07 15:25:28","goodsList":[{"productImage":"mi6.jpg","salePrice":"2499","productName":"小米6","productId":"201710006","_id":{"$oid":"58c284f4117a2e6599abef60"},"productNum":"2"},{"productImage":"2.jpg","salePrice":"80","productName":"头戴式耳机-3","productId":"201710004","_id":{"$oid":"58c284d7117a2e6599abef5e"},"productNum":"7"}]},{"orderId":"7201706081545294","orderTotal":"5558","orderStatus":1,"_id":{"$oid":"59390099c0444831c461d576"},"createDate":"2017-06-08 15:45:29","goodsList":[{"productImage":"mi6.jpg","salePrice":"2499","productName":"小米6","productId":"201710006","_id":{"$oid":"58c284f4117a2e6599abef60"},"productNum":"2"},{"productImage":"2.jpg","salePrice":"80","productName":"头戴式耳机-3","productId":"201710004","_id":{"$oid":"58c284d7117a2e6599abef5e"},"productNum":"7"}]},{"orderId":"7201706131105338","orderTotal":"560","orderStatus":1,"_id":{"$oid":"593f567d366e42108986268a"},"createDate":"2017-06-13 11:05:33","goodsList":[{"productImage":"2.jpg","salePrice":"80","productName":"头戴式耳机-3","productId":"201710004","_id":{"$oid":"58c284d7117a2e6599abef5e"},"productNum":"7"}]},{"orderId":"5201706131122131","orderTotal":"30160","orderStatus":1,"_id":{"$oid":"593f5a65366e42108986268b"},"createDate":"2017-06-13 11:22:13","goodsList":[{"productImage":"9.jpg","salePrice":"999","productName":"IH 电饭煲","productId":"201710009","_id":{"$oid":"58e7051698dab115d336b3f4"},"productNum":"3"},{"productImage":"14.jpg","salePrice":"1600","productName":"Ear1600","productId":"201710014","_id":{"$oid":"58e7054798dab115d336b3f9"},"productNum":"1"},{"productImage":"note.jpg","salePrice":"3549","productName":"小米笔记本","productId":"201710005","_id":{"$oid":"58c284e6117a2e6599abef5f"},"productNum":"7"},{"productImage":"2.jpg","salePrice":"80","productName":"头戴式耳机-3","productId":"201710004","_id":{"$oid":"58c284d7117a2e6599abef5e"},"productNum":"9"}]},{"orderId":"8201706131828404","orderTotal":"32367","orderStatus":1,"_id":{"$oid":"593fbe58e1a5b7147605cb33"},"createDate":"2017-06-13 18:28:40","goodsList":[{"productImage":"9.jpg","salePrice":"999","productName":"IH 电饭煲","productId":"201710009","_id":{"$oid":"58e7051698dab115d336b3f4"},"productNum":"5"},{"productImage":"14.jpg","salePrice":"1600","productName":"Ear1600","productId":"201710014","_id":{"$oid":"58e7054798dab115d336b3f9"},"productNum":"1"},{"productImage":"note.jpg","salePrice":"3549","productName":"小米笔记本","productId":"201710005","_id":{"$oid":"58c284e6117a2e6599abef5f"},"productNum":"7"},{"productImage":"2.jpg","salePrice":"80","productName":"头戴式耳机-3","productId":"201710004","_id":{"$oid":"58c284d7117a2e6599abef5e"},"productNum":"10"},{"productImage":"1.jpg","salePrice":"129","productName":"小钢炮蓝牙音箱","productId":"201710017","_id":{"$oid":"58e7058498dab115d336b3fc"},"productNum":"1"}]},{"orderId":"7201706142225144","orderTotal":"2738","orderStatus":1,"_id":{"$oid":"5941474ae1a5b7147605cb34"},"createDate":"2017-06-14 22:25:14","goodsList":[{"productImage":"14.jpg","salePrice":"1600","productName":"Ear1600","productId":"201710014","_id":{"$oid":"58e7054798dab115d336b3f9"},"productNum":"1"},{"productImage":"2.jpg","salePrice":"80","productName":"头戴式耳机-3","productId":"201710004","_id":{"$oid":"58c284d7117a2e6599abef5e"},"productNum":"11"},{"productImage":"1.jpg","salePrice":"129","productName":"小钢炮蓝牙音箱","productId":"201710017","_id":{"$oid":"58e7058498dab115d336b3fc"},"productNum":"2"}]},{"orderId":"1201706142242198","orderTotal":"2738","orderStatus":1,"_id":{"$oid":"59414b4be1a5b7147605cb35"},"createDate":"2017-06-14 22:42:19","goodsList":[{"productImage":"14.jpg","salePrice":"1600","productName":"Ear1600","productId":"201710014","_id":{"$oid":"58e7054798dab115d336b3f9"},"productNum":"1"},{"productImage":"2.jpg","salePrice":"80","productName":"头戴式耳机-3","productId":"201710004","_id":{"$oid":"58c284d7117a2e6599abef5e"},"productNum":"11"},{"productImage":"1.jpg","salePrice":"129","productName":"小钢炮蓝牙音箱","productId":"201710017","_id":{"$oid":"58e7058498dab115d336b3fc"},"productNum":"2"}]},{"orderId":"8201706150102580","orderTotal":"2499","orderStatus":1,"_id":{"$oid":"59416c42e1a5b7147605cb36"},"createDate":"2017-06-15 01:02:58","goodsList":[{"productImage":"mi6.jpg","salePrice":"2499","productName":"小米6","productId":"201710006","_id":{"$oid":"58c284f4117a2e6599abef60"},"productNum":"1"}]},{"orderId":"5201706150146458","orderTotal":"2886","orderStatus":1,"_id":{"$oid":"59417685e1a5b7147605cb37"},"createDate":"2017-06-15 01:46:45","goodsList":[{"productImage":"1.jpg","salePrice":"129","productName":"小钢炮蓝牙音箱","productId":"201710017","_id":{"$oid":"58e7058498dab115d336b3fc"},"productNum":"3"},{"productImage":"mi6.jpg","salePrice":"2499","productName":"小米6","productId":"201710006","_id":{"$oid":"58c284f4117a2e6599abef60"},"productNum":"1"}]},{"orderId":"9201706151140355","orderTotal":"4548","orderStatus":1,"_id":{"$oid":"594201b348d881235342dbc0"},"createDate":"2017-06-15 11:40:35","goodsList":[{"productImage":"9.jpg","salePrice":"999","productName":"IH 电饭煲","productId":"201710009","_id":{"$oid":"58e7051698dab115d336b3f4"},"productNum":"1"},{"productImage":"note.jpg","salePrice":"3549","productName":"小米笔记本","productId":"201710005","_id":{"$oid":"58c284e6117a2e6599abef5f"},"productNum":"1"}]},{"orderId":"1201706151143137","orderTotal":"4548","orderStatus":1,"_id":{"$oid":"5942025148d881235342dbc1"},"createDate":"2017-06-15 11:43:13","goodsList":[{"productImage":"9.jpg","salePrice":"999","productName":"IH 电饭煲","productId":"201710009","_id":{"$oid":"58e7051698dab115d336b3f4"},"productNum":"1"},{"productImage":"note.jpg","salePrice":"3549","productName":"小米笔记本","productId":"201710005","_id":{"$oid":"58c284e6117a2e6599abef5f"},"productNum":"1"}]}],"cartList":[{"productImage":"1.jpg","salePrice":"129","productName":"小钢炮蓝牙音箱","productId":"201710017","_id":{"$oid":"58e7058498dab115d336b3fc"},"productNum":"6","checked":"0"},{"productImage":"mi6.jpg","salePrice":"2499","productName":"小米6","productId":"201710006","_id":{"$oid":"58c284f4117a2e6599abef60"},"productNum":"6","checked":"0"},{"productImage":"9.jpg","salePrice":"999","productName":"IH 电饭煲","productId":"201710009","_id":{"$oid":"58e7051698dab115d336b3f4"},"productNum":"1","checked":"1"},{"productImage":"note.jpg","salePrice":"3549","productName":"小米笔记本","productId":"201710005","_id":{"$oid":"58c284e6117a2e6599abef5f"},"productNum":"1","checked":"1"},{"productImage":"6.jpg","salePrice":"59","productName":"智能插线板","productId":"201710002","_id":{"$oid":"58e704ef98dab115d336b3f1"},"productNum":"1"}],"addressList":[{"addressId":"100001","userName":"JackBean","streetName":"北京市朝阳区朝阳公园","postCode":"100001","tel":"12345678901","isDefault":true},{"addressId":"100004","userName":"Mary","streetName":"北京市朝阳区SOHO","postCode":"100005","tel":"010555555","isDefault":false},{"addressId":"100005","userName":"Donie","streetName":"北京市海淀区西二旗","postCode":"100009","tel":"18710987654","isDefault":false},{"addressId":"100006","userName":"Cherry","streetName":"北京市海淀区回龙观","postCode":"100009","tel":"010655555","isDefault":false},{"addressId":"100007","userName":"Joke","streetName":"北京市朝阳区望京","postCode":"100010","tel":"13619898722","isDefault":false},{"addressId":"100008","userName":"Frank","streetName":"北京市海淀区中关村软件园","postCode":"100011","tel":"10125652345","isDefault":false}],"__v":30} 2 | -------------------------------------------------------------------------------- /mongoDB-shop/server/README.md: -------------------------------------------------------------------------------- 1 | # vue-shop 2 | 3 | # 一、加载首页数据 4 | 5 | ```js 6 | 39 | ``` 40 | 41 | ```js 42 | //后端业务 43 | router.get('/goods/list', async (ctx) => { 44 | var {start,limit} = ctx.query; 45 | var total = await GoodsModel.find({}).count(); 46 | var data = await GoodsModel.find({}).skip(Number(start)).limit(Number(limit)); 47 | ctx.body ={ 48 | code:200, 49 | msg:"首页数据请求成功", 50 | result:data, 51 | //给前端设置分页 52 | total:total 53 | } 54 | }) 55 | ``` 56 | 57 | # 二、分页 58 | 59 | ```js 60 | //前端代码 61 | //total 10为只有1页 为30就有3页 62 | 67 | ``` 68 | 69 | ```js 70 | methods: { 71 | getPage(page){ 72 | this.start = (page-1)*this.limit; 73 | this.initData(); 74 | }, 75 | } 76 | ``` 77 | 78 | # 三、价格的升序和降序 79 | 80 | ```js 81 | //对goodsList进行升序和降序 82 | ``` 83 | 84 | ```js 85 | //前端代码 86 | 价格{{(sortFlag==1)?'':''}} 87 | ``` 88 | 89 | ```js 90 | methods:{ 91 | compareUp(value){ 92 | return (a,b)=>{ 93 | return a[value]-b[value] 94 | } 95 | }, 96 | compareDown(value){ 97 | return (a,b)=>{ 98 | return b[value]-a[value] 99 | } 100 | }, 101 | handleSort(){ 102 | this.sortFlag = (this.sortFlag == 1)?-1:1; 103 | if(this.sortFlag ==1 ){ 104 | this.goodsList.sort(this.compareUp("salePrice")) 105 | }else{ 106 | this.goodsList.sort(this.compareDown("salePrice")) 107 | } 108 | }, 109 | } 110 | 111 | ``` 112 | 113 | # 四、根据价格区间进行排序 114 | 115 | ```js 116 | handlePrice(gt, lt) { 117 | this.$http({ 118 | url: "/goods/price", 119 | method: "get", 120 | params: { 121 | gt, 122 | lt 123 | } 124 | }).then(res => { 125 | if (res.data.code == 200) { 126 | this.goodsList = res.data.result; 127 | this.total = 10; 128 | } else { 129 | this.goodsList = []; 130 | this.$message({ 131 | message: "没有数据", 132 | duration: 1000, 133 | type: "warning" 134 | }); 135 | } 136 | }); 137 | }, 138 | ``` 139 | 140 | ```js 141 | //后端 routes/goods.js 142 | /* 根据区间查询 */ 143 | router.get("/goods/price",async ctx=>{ 144 | var {gt,lt} = ctx.query; 145 | var data = await GoodsModel.find({salePrice:{$gt:gt,$lt:lt}}) 146 | if(data.length){ 147 | ctx.body ={ 148 | code:200, 149 | msg:"数据请求成功", 150 | result:data, 151 | total:data.length 152 | } 153 | }else{ 154 | ctx.body = { 155 | code:1001, 156 | msg:'没有数据' 157 | } 158 | } 159 | }) 160 | ``` 161 | 162 | # 五、默认 163 | 164 | ```js 165 | 默认 166 | ``` 167 | 168 | ```js 169 | methods:{ 170 | handleDefault(){ 171 | this.initData() 172 | } 173 | } 174 | ``` 175 | 176 | # 六、添加到购物车 177 | 178 | ```js 179 | methods:{ 180 | addCart(productId){ 181 | this.$http({ 182 | method:"post", 183 | url:"/users/addCart", 184 | data:{ 185 | productId 186 | } 187 | }).then(res=>{ 188 | console.log(res.data) 189 | this.$message({ 190 | message:res.data.msg, 191 | duration:1000, 192 | type:"success" 193 | }) 194 | }) 195 | } 196 | } 197 | ``` 198 | 199 | ```js 200 | //后端代码 添加到购物车 201 | router.post('/addCart' , async ctx=>{ 202 | var userId = 100000077; 203 | var {productId} = ctx.request.body; 204 | console.log(productId) 205 | var goodsData = await GoodsModel.findOne({productId:productId}) 206 | var obj= JSON.parse(JSON.stringify(goodsData)) 207 | obj.checked = true; 208 | obj.prductNum = 1; 209 | var userData = await UsersModel.findOne({}); 210 | if(userData.cartList.every(item => item.productId !=productId)){ 211 | await UsersModel.update({userId:userId},{$push:{"cartList":obj}}) 212 | ctx.body = { 213 | msg:"添加成功", 214 | code:200 215 | } 216 | }else{ 217 | ctx.body={ 218 | msg:"已经添加到购物车", 219 | code:200 220 | } 221 | } 222 | /* console.log(res) */ 223 | /* 从goods查询数据 添加到users */ 224 | }) 225 | ``` 226 | 227 | # 七、登陆模块 228 | 229 | ## 7-1 跨域访问服务器 230 | 231 | ```js 232 | //1.前端代码的配置 main.js 233 | axios.defaults.withCredentials = true //允许http请求携带cookie 234 | axios.defaults.crossDomain = true //允许跨域去访问cookie 235 | ``` 236 | 237 | ```js 238 | //2.配置服务器 app.js 239 | app.use(cors({ 240 | origin:"http://192.168.14.44:8080", //配置允许跨域的域名 "*" 所有 241 | credentails:true 242 | })) 243 | ``` 244 | 245 | ## 7-2 实现登录功能 246 | 247 | ``` 248 | 1.前端获取用户和密码 249 | 2.携带用户和密码后向后台发送http请求 250 | 3.后端接受用户和密码 251 | 4.向数据库查询 252 | 5.将结果返回给前端 253 | ``` 254 | 255 | ```js 256 | 前端获取用户和密码 257 | 确 定 258 | ``` 259 | 260 | ```js 261 | //登录模块 后端 262 | router.post('/login',async ctx=>{ 263 | var data = ctx.request.body; 264 | var res = await UsersModel.findOne(data); 265 | if(res){ 266 | ctx.body = { 267 | code:"200", 268 | msg:"登录成功" 269 | result:res.userName 270 | } 271 | }else{ 272 | ctx.body = { 273 | code:"400", 274 | msg:"用户名和密码错误" 275 | } 276 | } 277 | }) 278 | ``` 279 | 280 | ```js 281 | handleLogin(){ 282 | if(this.form.username && this.form.pass){ 283 | this.$http({ 284 | url:'/users/login', 285 | method:"post", 286 | data:{ 287 | userName:this.form.username, 288 | userPwd:this.form.pass 289 | } 290 | }).then(res=>{ 291 | if(res.data.code==200){ 292 | this.$message({ 293 | message:res.data.msg, 294 | duration:1000, 295 | type:"success", 296 | }) 297 | this.dialogFormVisible=false 298 | }else{ 299 | this.$message({ 300 | message:res.data.msg, 301 | duration:1000, 302 | type:"error" 303 | }) 304 | } 305 | }) 306 | }else{ 307 | this.$message({ 308 | message:"用户名和密码不能为空", 309 | duration:1000, 310 | type:"error" 311 | }) 312 | } 313 | } 314 | ``` 315 | 316 | ## 7-3 使用cookies记录登陆的状态 317 | 318 | ```js 319 | //1.登陆成功设置cookies 320 | //登录模块 321 | router.post('/login',async ctx=>{ 322 | ..... 323 | if(res){ 324 | ctx.cookies.set('userId',res.userId,{ 325 | maxAge:1000*60*60 326 | }) 327 | ctx.cookies.set('userName',res.userName,{ 328 | maxAge:1000*60*60 329 | }) 330 | .... 331 | }) 332 | ``` 333 | 334 | ```js 335 | //检查一下登陆的状态 336 | router.get('/checkLogin',async ctx =>{ 337 | var userId = ctx.cookies.get("userId"); 338 | if(userId){ 339 | ctx.body={ 340 | code:200, 341 | msg:"登录成功", 342 | result:ctx.cookies.get("userName") 343 | } 344 | }else{ 345 | ctx.body={ 346 | code:1001, 347 | msg:"未登录" 348 | } 349 | } 350 | }) 351 | ``` 352 | 353 | ```js 354 | //3.页面初始加载时,调用/user/checkLogin检查用户是否登录 355 | mounted() { 356 | ...... 357 | this.$http.get('/users/checkLogin').then(res=>{ 358 | if(res.data.code==200){ 359 | this.successName = res.data.result 360 | }else{ 361 | this.$message({ 362 | message:"未登陆", 363 | duration:1000, 364 | type:"warning" 365 | }) 366 | } 367 | }) 368 | }, 369 | ``` 370 | 371 | ## 7-4 退出登录 372 | 373 | ``` 374 | 375 | ``` 376 | 377 | -------------------------------------------------------------------------------- /mongoDB-shop/src/views/Home.vue: -------------------------------------------------------------------------------- 1 | 67 | 68 | 251 | 320 | --------------------------------------------------------------------------------