Record of WeChat Mini Program Development-Getting Started for Novices

I am trying to develop a WeChat applet for the first time, and I plan to write a blog post to record the difficulties, ideas, and content of Baidu programming in the development process in as much detail as possible for reference.

first day

Development background

Participate in development with another newly hired colleague. I am responsible for the front-end WeChat applet, and the back-end uses the lua language he is good at (normal java, springboot series or jsp-servlet series can be implemented), and data is transmitted through json in the middle.

Completed project link
https://gitee.com/lyuhuyuteru/weixin/tree/master/%E6%8E%A5%E9%BE%99%E7%AE%A1%E7%90%86%E5%B0%8F%E7%A8%8B%E5%BA%8F

Registration test number, applet number

https://mp.weixin.qq.com/
Open the official website of the WeChat public platform, find the small program and click to register to
Insert picture description here
Insert picture description here
download the development tool. The version when the author writes the article is 1.03.2010240, which
Insert picture description here
can be seen in the development managementAppID and AppSecret
Insert picture description here
After the installation is complete, open the program
Insert picture description here
and create a new project after opening . The AppID can be filled in before the registration or the test number can be used. It does not matter whether the cloud development function is used or not.
Insert picture description here

Page jump, login interception

Click to enter the newly created project, app.js (this file is a common part of the program), index (this is the home page) to
Insert picture description here
create a new loginPage login interface, right-click to create a new folder, and create a new page loginPage under the folder. Four files will be automatically generated. It is wxml, wxss, js, json to
Insert picture description here
open app.js, add code in the position of the figure, the
Insert picture description here
code is to make the page jump to the login interface when the user is not logged in

Check whether the page is declared in the app.Json page.
Insert picture description here
Homepage wxml code
Insert picture description here
Js code
Insert picture description here
Css code
Insert picture description here
Json code
Insert picture description here
Import components component Import
Insert picture description here
homepage icon
Insert picture description here
homepage code
Insert picture description here
Insert picture description here
Insert picture description here

File directory structure

│  app.js
│  app.json
│  app.wxss
│  project.config.json
│  sitemap.json
│
├─components
│  ├─cell
│  │      cell.js
│  │      cell.json
│  │      cell.wxml
│  │      cell.wxss
│  │
│  ├─cells
│  │      cells.js
│  │      cells.json
│  │      cells.wxml
│  │      cells.wxss
│  │
│  ├─icon
│  │      icon.js
│  │      icon.json
│  │      icon.wxml
│  │      icon.wxss
│  │
│  ├─import
│  │  │  base64.js
│  │  │  common.wxss
│  │  │  CustomPage.js
│  │  │
│  │  └─behaviors
│  │          theme.js
│  │
│  └─weui-wxss
│      └─dist
│          └─style
│              │  weui.wxss
│              │
│              └─icon
│                      weui-icon.wxss
│
├─images
│      icon_nav_feedback.png
│      icon_nav_form.png
│      icon_nav_special.png
│      icon_nav_z-index.png
│      jielong.jpg
│      tabbar_icon_chat_active.png
│      tabbar_icon_setting_active.png
│
├─pages
│  ├─icons
│  │      icons.js
│  │      icons.json
│  │      icons.wxml
│  │      icons.wxss
│  │
│  ├─index
│  │      index.js
│  │      index.json
│  │      index.wxml
│  │      index.wxss
│  │
│  ├─loginPage
│  │      loginPage.js
│  │      loginPage.json
│  │      loginPage.wxml
│  │      loginPage.wxss
│  │
│  └─logs
│          logs.js
│          logs.json
│          logs.wxml
│          logs.wxss
│
└─utils
        util.js

effect
Insert picture description here

Off-topic skills

To continue the process of debugging authorization, the authorization can be canceled by setting
Insert picture description here
Insert picture description here
Insert picture description here
Insert picture description here
the debug json
can Stager nodejs json format by the json-server
to achieve the separation of the front and rear end of the program
in detail hereinafter link learning operation
https://blog.csdn.net/weixin_44612322/article/details/102960647

json example

{
    
    
	"data": [{
    
    
		"username": "ldh",
		"password": "123"
	}]
}

svg conversion to
get the svg tag code
Insert picture description here
, rename the svg suffix after
Insert picture description here
creating a new txt , open the browser and you can view the png

Insert picture description here
Insert picture description here

Guess you like

Origin blog.csdn.net/weixin_43596589/article/details/111224437