-
background
Why write this article?
Basically oneself suffer greatly in the development process. I hope that through my experience and lessons, I can help more partners. At the same time, I also want to make fun of the documents of Zhejiang Provincial Office. I also want to thank my friends who have helped me.
Technology Stack declaration
I mainly use vue.js to develop the front-end H5 page, plus a Vant mobile UI component library, scaffolding using VUE-CLI.
-
Problems encountered and solutions
Upload to test environment whiteboard page, local is possible
First, the publicPath in vue.config.js must be set to ‘./’. I believe that many friends like to use the history mode of vue-router routing, but ignore that the history mode needs the cooperation of the server. Zhejiang Provincial Office does not open the server configuration, so we can only choose hash mode to deal with the problem.
The single sign-on (SSO) fails to jump to the specified page
This problem is also a pitfall of the routing hash mode, which does not support redirection. It is easy to solve this problem by removing the ‘#/’ from the route. I have cheated twice on this routing problem, but I am also tired of the documentation.
const url = window.location.href;
const href = url.replace('# /'.' ');
window.location.href = `https://puser.zjzwfw.gov.cn/sso/alipay.do?action=ssoLogin&servicecode=****&goto=${href}`;
Copy the code
Does zhejiang Office allow third party service interface?
Although Zhejiang Provincial Office provides RPC access and officially recommends RPC access, the RPC of Zhejiang Provincial Office does not support picture uploading. So third party service interfaces are allowed.
The online test environment could not call the interface, which returned no content
What I’m talking about here is that the third-party interface service cannot be invoked. There are two cases: 1. The problem of cross-domain interface needs to be dealt with by the students at the back end. 2. It is a certificate problem. The interface of Zhejiang Office needs HTTPS.
Buried some questions
Written this document also has a problem, how to bury some documents should be written can read, said the main problem is not understand test points, how to judge buried point success, is to see a “# # # / m.g if” behind this request to connect a bunch of things inside the content of the right, I understand a look at my call will bring back a bunch of buried on the interface point. If you select ALL in browser debugging, you can see that the test is successful in the application of government center, but there is no callback in your browser. It should be cross-domain, which is a normal phenomenon. Buried content requires URL escape to read, you can find a tool to escape to see buried content.
Test JSBridge API in government
Maybe it is because I used to develop micro channel small program before, thinking that the government affairs center call this JSBridge is also feedback, I explain here, there is no feedback, your phone connected to the Zhejiang office will have feedback, don’t think about this government affairs center can do front-end debugging front-end page. The correct way to connect the mobile phone to the government affairs center, used in the debugging of JSBridge, such as call scan code function, computer point, mobile phone can scan code. This thing has to open the Zhili Office application, and the phone is ok under the condition of bright screen, zhili Office exit or go to the background or the phone black screen will be disconnected, maybe because of my MAC environment, anyway, it is not very friendly, I always finish not involving JSBridge and then test this thing. As for setting the title function to see the effect, please upload the code to the test environment to view.
Alipay small program testing problems
The official is to say a set of code to run at both ends, then why the H5 page opened with Alipay can not call JSBridge interface? I wanted to introduce Alipay’s H5 developed JSBridge to deal with it. Let me first say the principle, in fact, zhejiang Office alipay small program embedded a browser, with this embedded browser can call Zhejiang Office JSBridge. Application management in the preview of the TWO-DIMENSIONAL code is for zhejiang office APP, Alipay in the two-dimensional code you need to convert. 3PWls.csb. app/ in this webpage input your Zhejiang office preview TWO-DIMENSIONAL code url, and then converted into alipay can identify the TWO-DIMENSIONAL code can see the effect in Alipay. Why not backstage at the same time to two TWO-DIMENSIONAL code, this conversion is not trouble ah?
-
conclusion
These series of operations in Zhejiang office have given a lot of work to the operation and problem solving students. I doubt that they need the amount of questions answered to achieve some purpose. Why invest so much manpower in a company that doesn’t even have basic documentation that works? Why do you need to manually configure a problem that can be handled by software? Although I also ridicule micro channel small program audit now do more and more strict, but micro channel small program to not in the development stage “dissuade” me, CARD I development process.