Mini Program's page jump problem

the Mini Program project is currently under development, and now we have made a login page in Mini Program the same as the h5 login page. When entering this Mini Program, the login page is displayed at first (the first path of the page path in app.json is the login page). When the user enters the user name or password, he or she jumps to the home page.

now"s problem: now I"m logged in, but after refreshing in the developer tool, I jump to the login page (normally I log in and refresh and then display the home page). After quitting Mini Program in the real machine, it will also be displayed on the login page after entering Mini Program. How to solve this problem. Please give me some advice.

Mar.21,2021

you can add a flag to determine whether the user has logged in. Then in Mini Program's onshow life cycle function, it is judged that if the user logs in, he will jump to the home page directly. Jump to the login page if you are not logged in. The same judgment should be made when the login status is invalid.


this is my judgment: first log in and store a value locally.
then other pages use app.js app.globalData.isLogin () to determine whether to log in
or each page uses token to determine whether to log in

.

the solution is to configure the entry on the home page, and then go to the home page to determine whether to log in. If you do not log in, skip to login. Because you configure the entry to refresh the login page, you will enter the original entry, which is the one you configured, so your method is not feasible. Please adopt

.
Menu