Coder Social home page Coder Social logo

mpvue-shop-node's Introduction

为了快速让学习者搭建本地的服务,现在对程序进行了修改

  1. 删除了对wafer2的依赖,删除了小程序登陆等相关的
  2. 数据库中存了一个用户数据,供接口使用,无需掉登陆

下载源码

git clone https://github.com/heyushuo/mpvue-shop-node.git

开始使用

1.项目开始前本机安装mysql5.7版本,然后创建数据库nodemysql并导入项目根目录下的nodemysql.sql

2.项目根目录有一个config.js文件,在这里可以配置数据库相关信息账号密码等

  	mysql: {
		host: 'localhost',
		port: 3306,
		user: '',   
		db: 'nodemysql',  //数据库名字
		pass: '',   //数据库密码
		char: 'utf8mb4'
    };

安装依赖

npm install

启动项目

npm run dev

项目目录结构

1.mysql.js存放对knex的引用(用来操作数据库使用)

2.本项目所有的业务逻辑都在controllers文件夹中

3.本项目所有的接口都写在router文件夹下的index.js里边

 //首页数据
    //1.首页
    router.get('/index/index', controllers.home.index)
    //2.首页品牌制造商直供的详情内的列表数据
    router.get('/brand/listaction', controllers.brand.index.listAction)
    //3.首页品牌制造商直供的详情数据
    router.get('/brand/detailaction', controllers.brand.index.detailAction)
    
    
    /**
     *  分类
     */
    //1.分类和子类
    router.get('/category/indexaction', controllers.category.index.indexAction)
    //2.通过分类的id来查询子类接口
    router.get('/category/currentaction', controllers.category.index.currentAction)
    //3.获取导航数据
    router.get('/category/categoryNav', controllers.category.index.categoryNav)
    
    
    /**
     *  商品相关接口
     */
    //1.商品详情接口
    router.get('/goods/detailaction', controllers.goods.index.detailAction)
    //2.获取商品列表
    router.get('/goods/goodsList', controllers.goods.index.goodsList)
    
    
    /**
     *  专题接口
     */
    //1.列表
    router.get('/topic/listaction', controllers.topic.index.listAction)
    //2.详情加下方四个专题推荐
    router.get('/topic/detailaction', controllers.topic.index.detailAction)
    
    
    /**
     * 搜索相关接口
     */
    //1.关键词和搜索历史接口
    router.get('/search/indexaction', controllers.search.index.indexAction)
    //2.搜索提示接口
    router.get('/search/helperaction', controllers.search.index.helperAction)
    //3.搜索的关键词添加到数据库
    router.post('/search/addhistoryaction', controllers.search.index.addHistoryAction)
    //4.清空搜索历史
    router.post('/search/clearhistoryAction', controllers.search.index.clearhistoryAction)
    
    
    /**
     *  收藏相关接口
     */
    //1.添加收藏
    router.post('/collect/addcollect', controllers.collect.index.addCollect)
    //2.获取收藏列表
    router.get('/collect/listAction', controllers.collect.index.listAction)
    //2.获取收藏列表
    router.get('/collect/deleteCollect', controllers.collect.index.deleteCollect)
    
    /**
     *  购物车相关接口
     */
    //1.添加购物车
    router.post('/cart/addCart', controllers.cart.index.addCart)
    //2.购物车列表
    router.get('/cart/cartList', controllers.cart.index.cartList)
    //3.删除商品
    router.get('/cart/deleteAction', controllers.cart.index.deleteAction)
    
    
    /**
     *  订单相关
     */
    router.post('/order/submitAction', controllers.order.index.submitAction)
    
    router.get('/order/detailAction', controllers.order.index.detailAction)
    /**
     *  收货地址相关接口
     */
    //1.保存和跟新收货地址
    router.post('/address/saveAction', controllers.address.index.saveAction)
    //2.获取收货地址列表
    router.get('/address/getListAction', controllers.address.index.getListAction)
    //3.获取收货地址详情
    router.get('/address/detailAction', controllers.address.index.detailAction)
    //4.删除收货地址
    router.get('/address/deleteAction', controllers.address.index.deleteAction)
    
    
    /**
     *  意见反馈
     */
    router.post('/feedback/submitAction', controllers.feedback.index.submitAction)

如果需要小程序登陆的可以看,腾讯提供的小程序node解决方案

下方为微信小程序效果展示

1.首页展示和专题页效果

2、分类页面,分类子页面以及搜索功能、搜索列表、历史记录、模糊搜索提示

3、购物车功能添加购物车,单选多选,删除和商品收藏功能

4、地址管理

小程序端传送门 点击进入小程序地址

最后

  • 喜欢的记得点个start,鼓励一下谢谢哈!!
  • 微信号 hys838723
  • qq群号 647099996

mpvue-shop-node's People

Contributors

heyushuo avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.