[2020-01-11] Use the proxy API provided by https://github.com/zce/douban-api-proxy to request Douban data
[2019-04-20] Modify the proxy data response logic. Douban Books API can no longer be proxied and requires an API key to access. No solution:
{
"msg" : " invalid_apikey " ,
"code" : 104 ,
"request" : " GET /v2/book/search "
}
[2019-03-09] Delete some console
statements and talk about common problems:
Each mini program in this project is not configured with
appid
. If you want to run the project, you need to assign anappid
to the project. Otherwise, the project will not be able to use the real device preview function, and some mini program APIs may not be used normally.Some netizens reported that after opening Zhihu Daily in the IDE and clicking compile and preview , the program could not be displayed normally on the real machine. Solution: After clicking Compile and Preview , the real machine will automatically open the mini program. Click the first menu button in the upper right corner of the mini program and choose to turn on debugging . After restarting the mini program, the data will be displayed normally. The specific cause of this problem is unknown.
[2019-01-19] Reconstruct the Zhihu Daily Mini Program. Since the official app no longer has thematic daily reports and the interface can no longer return thematic data, the logic related to the themed daily reports has been removed this time and picture previews and encapsulation have been added. Reusable UI components, web-view
pages and my favorites pages.
[2019-01-16] Refactor the Matter Assistant applet, convert the code into ES6, and optimize the data operation code. Since the applet now resumes support for Promise, this version of bluebird will be removed.
[2019-01-14] Reconstruct the Douban Books applet and convert the old code into ES6. Add the server
directory. There is a Douban Books interface proxy server program. You can start the code in this directory to proxy requests for the Douban Books interface. To a certain extent, it solves the problem that the WeChat applet cannot request the Douban book interface. ( This method is no longer valid. Douban Books API now requires a key to access. There is no solution ).
Usage( invalid )
The Douban interface proxy server code is in theDouBanBookApp/server
directory.
Open the command line and switch to the current directory. If this is the first time running, please usenpm install
to install dependencies.
Then usenode index.js
to run it.
Please make sure port8081
is not occupied before running, or you can modify the port number in the code. If you use this server proxy to request the Douban Books interface, please point the interface path inapi.js
to this server address.
[2018-03-31] Fixed the picture display problem and empty data error problem in Zhihu Daily, and fixed the empty data problem in Matter Assistant. Since the Douban interface is officially blocked, there is currently no direct solution. You can refer to the Nginx proxy method online.
[2017-09-09] The default IDE version for code development is upgraded to v1.0.1.170907, adding wx:key
attribute to wx:for
, modifying the ActionSheet behavior of the matter assistant, and displaying the statement cancellation event (i.e. Promise's catch). Modify bindchange
to bindinput
.
[2017-08-23] Fixed the data request failure problem of Douban Books Demo, and modified Content-Type
in header
of request
to json
or html
.
[2017-02-12] Modify the image path of the Zhihu Daily case and fix the problem of failure to obtain Zhihu images. The image acquisition interface of the startup interface is restricted, and there is currently no solution!
[2016-11-23] Since the official IDE was updated to version 0.11.112301
, support for Promise
was removed, causing事项助手
to not run normally. To solve this problem, the third-party compatibility library Bluebird was introduced into the project to support Promise
. The code has been Integrated into project code.
[2016-11-16] Updated the Case事项助手
to cooperate with the development of WeChat Mini Program ES6 and Matter Assistant tutorials. It mainly introduces the ES6 development method of the Mini Program.
[2016-10-31] The mini program is updated to the latest version 0.10.102800. It is compatible with new annotations before deletion. The carousel image on the homepage of知乎日报
returns to normal. A new case plan is added. It is initially developed. It is temporarily named事项助手
. Its main The function is to dynamically display the number of days in the calendar month.
[2016-10-29] Due to the irregular official upgrade of the IDE, some functions of the mini program have been modified and removed, causing the previous projects to not run properly. The current code is based on the latest version of the IDE operating environment, which is version 0.10.102800. You can click to download. Although the code has been modified to adapt to the latest version of the development environment, some previous layouts and practices are no longer officially supported, so Actual operating results may differ from those shown in the renderings.
After the知乎日报
case was uploaded, some enthusiastic netizens contributed their own code to fix many bugs. Thank you very much.
Briefly introduce the ES6 development method of small programs, and finally give the event assistant as a demonstration example. The function of the event assistant is relatively simple, with a calendar component and a simple event information storage function.
front page | date selection | Details page |
Douban Books is a book search applet that simply uses network requests and simple page layout. The example this time is知乎日报
, which has more function points and the page is more complex than the previous example. Before I wrote this DEMO, many netizens had already created the same DEMO, and they were all very good. After all, this case is very classic and has a relatively complete API, which is worth imitating and learning. This DEMO can be regarded as a small exercise.
front page | Sidebar menu | Detailed page |
Settings page | Long review and short review | my collection |
A very simple example, using two Douban Books APIs: searching for books and getting book details API. This is my first WeChat mini program.
front page | List page | Detail page |
The following article was written when I started learning small programs. It is also the first time I have written an article. There are many errors in it, and there are many bad sentences and typos. The content is outdated. The code in this warehouse has been reconstructed and is different from the code in the article. There are major discrepancies in the clips. If you want to continue reading, just browse.
MIT LICENSE