Loading…

Announcement example

# Preface This tutorial is based on the "apifm-wxapi" module and teaches you how to quickly implement small program development, so you may need to understand the following knowledge points first: ["Creating HelloWorld Project"](https://www.yuque.com/apifm/doc/hezlrm) ["Use "apifm-wxapi" to quickly develop small programs"](https://www.yuque.com/apifm/doc/mdldsd) ["Register for free to open the backend and obtain an exclusive domain name"](https://www.yuque.com/apifm/doc/qr6l4m) # Requirements description Announcements are made in the background; The mini program displays the latest announcements and announcement list, and you can click to view announcement details; # budget 0 yuan, free implementation # Requirements realization ### Enable the "Platform Announcement Module" module Log in to the "First Step" registration background, left menu --> Factory settings --> Module management Find the "Platform Announcement Module" module, click "Enable Module", then F5 to refresh the background interface, you will see a new menu: "Announcement Management"; ### Publish and manage announcement data in the background: ![](https://dcdn.it120.cc/yuque/0/2019/png/572726/1572848056837-dbb3ec68-448a-4610-bebb-c1ccf9a66a6b.png) ### Write small program code: ```plain const WXAPI = require('apifm-wxapi') WXAPI.init('gooking') Page({ data: { }, onLoad: function (options) { //Read the latest announcement WXAPI.noticeLastOne().then(res => { console.log('Latest announcement:', res) }) //Read the announcement list WXAPI.noticeList().then(res => { console.log('Announcement list data:', res) }) } }) ``` > WXAPI.init('gooking') This code links your mini program to your backend, where gooking is your exclusive domain name (please check the chapter about exclusive domain names in the preface); > ### Thinking questions: In the above example, all the announcement list data released in the background can be obtained. You can click on an announcement yourself to read the detailed data of this announcement; Calling method: > WXAPI.noticeDetail(id) > Looking forward to your progress! grateful!