Giter Club home page Giter Club logo

wxprogram's Introduction

WxProgram

慕课网,微信小程序开发入门练习

微信前端代码在wxFront-end文件夹下
删除操作按照restful规范本该使用DELETE请求,但不知什么原因DELETE请求传参有问题(传入后台参数为空,有兴趣的可以尝试修改一下),所以改成POST请求
注:因部分后端变量和路由命名与老师不同,前端代码很多地方和后端关联,若是跟着视频学习的,后端开发前,请先查看area.sql文件,前端开发前,请先运行查看返回的JSON

  • 慕课网微信小程序开发源码,大体写法和视频一样,部分地方以个人理解做了适当更改,尽可能的使用springboot特性,简化代码(如:除去datasource和sessionFactory类、mybatis.xml的构造,直接在SpringBoot中配置;修改controller访问地址和访问方式,尽可能符合restful规范
    参考资料:
    https://www.imooc.com/learn/945
     微信公众平台

  • 代码写于:2018-05-03
     JDK:JDK1.8版本,
     IDE:IDEA 2017.3.3,
     操作系统为:Windows10

  • 关于POST请求的一些坑
    1.若普通方式传参
     data: {'id':e.target.dataset.id},
     header: {
     //默认是 'content-type': 'application/json',要传post的参数必须写成这样,要传delete参数则为null
      "content-type": "application/x-www-form-urlencoded"
     },
    2.若JSON方式传参,后端controller的参数名要加上@RequestBody注解
     data: JSON.stringify(formData),
     header: {
      "content-type": "application/json"
     },

  • 使用lombok包,springboot的很多特性,虽然知道没有视频讲解对新手很不友好,但能减少代码冗余量,学到更多。(其实是本人太懒,这些工具太好用)建议大家都能了解一下。
    添加响应结果集工具类(util包下的FormatResponseUtil类),用于controller返回结果

  • 为降低代码冗余,所有get/set方法均用lombok包的Data注解,具体使用方法可自行百度
    若不愿使用lombok包可将源码中所有bean的@Data注解去掉,加上get/set方法
    若不喜欢使用响应结果集工具类的,直接删除util包,按照视频教学返回map即可

wxprogram's People

Contributors

bjchen2 avatar

Stargazers

 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.