November is the national “119” fire protection publicity month, many enterprises and institutions will hold fire safety knowledge contest activities, so I built fire safety knowledge answer activities based on cloud development mini program.

Then, I also finished the first step of the hand to hand teaching you to build answer activities small program series of articles to help beginners quickly start cloud development.

And here to supplement a build deployment help document, to help you how to use wechat answer activity applets V1.0 source code to build cloud development applets.

Answer mini-program interface

First, preparation

To set up and deploy this mini-program, you need to do the following preparations:

1. First register wechat mini program, mainly to get AppID. This is a prerequisite.

Small program registration is very convenient, go to the wechat public platform, open the small program registration page, according to the requirements to fill in personal information, verify email and mobile phone number, scan the TWO-DIMENSIONAL code binding your wechat signal, about 3 minutes can be done.

Applets registration page

When registering small programs, you can not use the mailbox registered with wechat public account or wechat open platform, that is, you need to use another mailbox.

When we register successfully, we can automatically log in to the background management page of the small program, perfect the corresponding information, and then get AppID here.

2. Secondly, download and install wechat developer tools. This is the development scaffolding, and upload code to the server tools.

Applets developer tools download page

3. Then download the source code of the mini-program. This can be downloaded from gitee address, please click star.

Answer activity small program source download

Two, the construction work

1. Open the wechat developer tool, use the wechat scan code to log in to the developer tool, and then use the developer tool to create a small program project.

Project name: This can be filled in according to their own needs;

Table of contents: Find the folder that downloaded the source code of the answer activity applets in advance, and select it;

AppID: is the AppID(applet ID) obtained after successful registration.

Development mode as applets (default)

Back-end service selection applets · Cloud development

Click “New” to see the cloud development quiz activity applet in the developer tools simulator and the source code of the applet in the editor.

2. Click “Cloud Development” to open cloud development service.

Click the “Cloud Development” icon of wechat developer tool, and click “Open” in the pop-up box. After agreeing to the agreement, a dialog box for creating an environment will pop up. You will be asked to enter the environment name and environment ID, as well as the current base environment quota for cloud development (the base quota is free and sufficient for you to use).

After filling in according to the requirements of the dialog box, click Create, the environment will be initialized, and the environment will automatically pop out of the cloud development console after successful initialization, so that the cloud development service will be opened.

3. Create new collections in turn

(1) Create a topic database set, and create or import topic data.

(2) Create a database set to save answer scores.

Find the cloud development environment ID.

Click the Settings icon in the Cloud Development Console window and find the environment name and environment ID in the environment variables TAB.

5. Specify the cloud development environment for applets

In developer Tools, open app.js in the source folder miniProgram and find the following code:

wx.cloud.init({

// Enter the environment ID. You can view the environment ID on the cloud console

env: ‘env-id’,

traceUser: true,

})

Env: ‘env-id’ change your environment id to env: ‘dtxcxxfaqzsjd’

6. Click “Upload” to upload the code, then go to the background management page of the small program, scan the code to access the experience version or submit the audit for subsequent deployment and go online.

In the future, I will continue to develop on the basis of this V1.0, answer micro channel small program V2.0, V3.0, the function will be more and more perfect, please look forward to it.