A WASM-based multi-form page online generation method, storage medium and device

Through the WASM-based multi-form page online generation method, the Appium service plug-in is used to identify page design pictures and generate pages, which solves the design error and repetitive workload problems when assembling page templates or components in the prior art, and achieves efficient Flexible page generation and development efficiency improvement.

CN117311685BActive Publication Date: 2024-11-15CHINA TELECOM DIGITAL INTELLIGENCE TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311024053.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-08-15
Publication Date
2024-11-15
Estimated Expiration
2043-08-15

AI Technical Summary

Technical Problem

The existing web page rapid development method is difficult to achieve zero design error when reusing page templates or assembling components, and a large number of functional pages of the same type cannot be fully reused, resulting in a large amount of repetitive workload and lack of online front-end rendering environment, which affects the vision. Present effect and development efficiency.

Method used

Adopt the WASM-based multi-form page online generation method, and use the WASM service to initialize WASM services, import page design pictures, use the Appium service plug-in to identify image element components, and generate pages, supporting flexible generation of static and dynamic pages, and using WebAssembly format .wasm files Perform client persistent storage and rendering.

Benefits of technology

It realizes the full-process visual page generation, reduces the design error rate, improves development efficiency, reduces the workload of developers, and supports the generation of multi-form pages in different application scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117311685B_ABST
    Figure CN117311685B_ABST
Patent Text Reader

Abstract

The present invention discloses a multi-form page online generation method based on WASM, a storage medium and a device, including: based on the native WASM service, initializing and caching the matching web page element component resource library to obtain an initialized online web page generation environment; in the initialized online web page generation environment, importing the page design picture to be identified; the matching service plug-in in WASM traverses and identifies the page design picture to be identified according to the element block diagram in the web page element component resource library, and obtains the image element component of the page design picture to be identified; and rendering the page according to the obtained image element component of the page design picture to be identified to generate the page. The multi-form page online generation method can generate the whole process of visualized page online, and meet the needs of different development stages.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of IT application technology, and specifically relates to a WASM-based multi-form page online generation method, storage medium and device. Background Art

[0002] WebAssembly (WASM) is a standard for a universal binary and text format for the Web, jointly initiated by several large companies such as Google, Microsoft, Mozilla, and Apple. As a newly emerging technology in the past two years, it provides a capture and conversion mechanism (LLVM IR) to compile high-level languages ​​such as C, C++, and Rust into WebAssembly, which can realize an assembly language running on the Web client and execute low-level binary syntax through the Web, realizing a front-end architecture model that is more efficient than the current JavaScript processing and is memory-safe and open.

[0003] React / Vue is a front-end modular development framework. In order to meet the ever-changing page requirements of users, it is necessary to improve the traditional page generation method in the page design and development process. As the business system operation becomes increasingly complex, a large amount of page module development work is required. Therefore, it is necessary to consider how to efficiently solve the development and reuse of pages with similar functions.

[0004] With the emergence of front-end frameworks such as React and Vue that are based on modular components (instructions, etc.), front-end componentization has gradually become an urgent need for front-end development. It can improve the development efficiency of the front-end and reduce maintenance costs. At the same time, developers no longer need to face a bunch of complex and difficult-to-read codes, but only need to focus on code snippets that exist in the form of components.

[0005] At present, the main methods for rapid development of web pages based on the mainstream modular web front-end framework on the market are:

[0006] 1. By establishing a template library for similar function pages, templates for various function pages and corresponding page configuration information are generated in advance or accumulated during the development process. Therefore, when developers encounter the development requirements of new pages of the same type, they can quickly reuse page templates and add relevant data logic processing involved in the new requirements to quickly complete the development and application of new pages;

[0007] 2. The page template library is refined into a module component-level template library, and a general modular component library is developed. When a new page development requirement is encountered, the developer will assemble the required module components according to the new page design requirements, associate the page with the components involved, and the module components correspond to the data relationship of each module, so as to complete the development and application of the new page, reduce the requirements for design engineers, and improve the page development efficiency;

[0008] 3. Various forms of pages are provided to meet the page requirements of different applications. Some are static pages, and some are modular framework pages as semi-finished services that can flexibly adapt to their own environment architecture. In addition, local pages are developed and produced in specific scenarios such as confidentiality, which can more flexibly meet and adapt to universal designs.

[0009] However, the existing rapid development methods for web pages have the following main disadvantages:

[0010] 1. Developers generate pages by combining and matching page template libraries or component template libraries according to the page design drawings of page designers. The degree of restoration of page design cannot achieve zero design error, including module spacing, page coordinate positions of functional elements, etc., which affects the visual presentation of the overall page to a certain extent;

[0011] 2. When developing a large number of pages with the same type of functions, for example, different topic analysis pages have similar scenes but slightly different detailed structures, and the page templates or components cannot be fully reused after assembly. In addition, when there are a large number of page function requirements, although the page types are mostly similar, the duplication of work in module assembly cannot be avoided;

[0012] 3. Generating pages through the server backend lacks the natural web page rendering environment of key JS or modular virtual DOM in the page. Even if the backend is supplemented by NODEJS and other capabilities, it is still not as intuitive as the WYSIWYG of the direct online frontend. Summary of the invention

[0013] In view of the problems existing in the prior art, the present invention provides a WASM-based multi-form page online generation method, which can generate fully visualized pages online and meet the needs of pages in different development stages.

[0014] To achieve the above technical objectives, the present invention adopts the following technical solution: a WASM-based multi-form page online generation method, which specifically includes the following steps:

[0015] Step 1: Based on the native WASM service, initialize and cache the supporting web page element component resource library to obtain the initialized online web page generation environment;

[0016] Step 2: In the initialized online web page generation environment, import the page design image to be identified;

[0017] Step 3: The matching service plug-in in WASM traverses and identifies the page design image to be identified based on the element block diagram in the web page element component resource library, and obtains the image element component of the page design image to be identified;

[0018] Step 4: Render the page according to the image element components of the page design image to be identified, and generate the page.

[0019] Furthermore, step 1 includes the following sub-steps:

[0020] Step 101: construct a .wasm file in WebAssembly format based on a web page element component resource library and a processing logic package of an online generated web page, and stream the .wasm file in the page through a js native API method;

[0021] Step 102: The client browser loads the localForage js library, calls the setItem method of localForage, and performs client-side persistent storage of the .wasm file.

[0022] Furthermore, the specific process of step 102 is: the client browser loads the localForage js library, and the localForage js framework uses a unified API to automatically select or determine to use webSql / localStorage to perform client-side cache persistence on the .wasm file based on the client browser version and API support.

[0023] Furthermore, in step 2, the method of importing the page design image to be identified is: uploading the page design image to be identified through an online operation portal or placing the page design image to be identified into a designated folder.

[0024] Furthermore, step 3 includes the following sub-steps:

[0025] Step 301: Install the Appium service plug-in in WASM, and send the image element on the page design picture to be identified to the Appium service plug-in through the image positioning strategy in the Appium service plug-in. The Appium service plug-in finds the element block diagram that matches the image element from the initialized online web page generation environment, and packages the relevant information of the matching element block diagram as a standard WebElement.

[0026] Step 302: Convert the packaged standard WebElement into a component, and map it to the page design image to be identified according to the coordinates of the image element;

[0027] Step 303: Traverse the image elements on the to-be-recognized page design picture, and repeat Steps 301 - 302 to obtain the image element components of the to-be-recognized page design picture.

[0028] Further, the specific process of Step 4 is as follows: Add the JS library and CSS library involved in the image element components of the to-be-recognized page design picture into the web page head, and perform loading, rendering, and combination according to the requirements of specific applications to generate a page.

[0029] Further, when the generated page is a static page, directly combine the obtained image element components of the to-be-recognized page design picture into a page.

[0030] Further, when the generated page is a modular dynamic page, perform Map<key identifier, value module> through the react or vue modules associated with the obtained image element components of the to-be-recognized page design picture to obtain the replacement of the corresponding value module, and then perform data encapsulation and framework rendering on the value module to generate a page.

[0031] Further, the present invention also provides a computer-readable storage medium storing a computer program, and the computer program enables a computer to execute the above-mentioned WASM-based multi-form page online generation method.

[0032] Further, the present invention also provides an electronic device, including: a memory, a processor, and a computer program stored on the memory and executable on the processor. When the processor executes the computer program, the above-mentioned WASM-based multi-form page online generation method is implemented.

[0033] Compared with the prior art, the present invention has the following beneficial effects: The WASM-based multi-form page online generation method of the present invention utilizes the characteristics of WASM in the same environment on the web page and in an independent container, and uses the image positioning strategy in the Appium service plugin to find the element block diagram matching the to-be-recognized page design picture, and directly performs online loading and rendering to generate a page. Whether it is a static page or a dynamic page, it can be flexibly supported to generate multi-form pages that meet different application requirement scenarios. At the same time, the element block diagram in the present invention comes from the web page element component resource library, and a page is generated through relevant information, and the error rate of the design effect is relatively low compared to manually assembling and cutting the page or adjusting the layout position by page developers; the general components are used to assemble the page, and the solidified design drawing is converted into a page of instance modular code. Whether it is directly applied in practice or further improved or extended on this basis, it has greatly improved the efficiency of the actual development process and reduced the actual page development workload of developers. Description of the Drawings

[0034] Figure 1 The figure is a flowchart of the WASM-based online generation method of polymorphic pages of the present invention. DETAILED DESCRIPTION

[0035] The technical solution of the present invention is further explained below in conjunction with the accompanying drawings.

[0036] like Figure 1 This is a flow chart of the WASM-based online generation method for polymorphic pages of the present invention. The online generation method for polymorphic pages specifically includes the following steps:

[0037] Step 1: Based on the native WASM service, initialize and cache the supporting web page element component resource library to obtain the initialized online web page generation environment; specifically, it includes the following sub-steps:

[0038] Step 101: construct a .wasm file in WebAssembly format based on a webpage element component resource library and a processing logic program package of an online generated webpage, and stream the .wasm file in the page through a js native API method; the webpage element component resource library and the processing logic program package in the present invention can be components or controls with preset functions and can be independently packaged;

[0039] Step 102, the client browser loads the localForage js library, calls the setItem method of localForage, and performs client-side persistent storage of the .wasm file; specifically, the client browser loads the localForage js library, and the localForage js framework uses a unified API according to the client browser version and API support to automatically select or determine to use webSql / localStorage to perform client-side cache persistence on the .wasm file, so as to ensure that the client browser can directly read the corresponding .wasm file from the local database cache and quickly instantiate and restore the page status when multiple instances of the wasm module are required or when the browser is refreshed.

[0040] Step 2: In the initialized online web page generation environment, import the page design picture to be identified; specifically, upload the page design picture to be identified through the online operation portal or put the page design picture to be identified into a designated folder. In the present invention, the page design picture to be identified can be a display interface design picture in various forms such as an application page design picture, a program page design picture, and a software page design picture.

[0041] Step 3: The matching service plug-in in WASM traverses and identifies the page design image to be identified based on the element block diagram in the web page element component resource library, and obtains the image element component of the page design image to be identified; specifically, the following sub-steps are included:

[0042] Step 301, install the Appium service plug-in in WASM. The Appium service plug-in is an automated open source tool that uses OpenCV for image processing. OpenCV is a cross-platform computer vision and machine learning software library released under the Apache2.0 license (open source). The Appium service plug-in extends the WebDriver protocol to support the automation of native, mobile Web, and hybrid applications on iOS, Android, and Windows desktop platforms. Through the image positioning strategy in the Appium service plug-in, the Appium service plug-in can define different strategies according to different technical languages ​​and methods, for example: python: driver.find_element_by_image(), send the image element on the page design picture to be identified to the Appium service plug-in, the Appium service plug-in finds the element block diagram that matches the image element from the initialized online web page generation environment, and packages the relevant information of the matching element block diagram as a standard WebElement.

[0043] Among them, the way to match image elements with element block diagrams can be to train an element recognition model through an algorithm set in machine learning, and determine the element component recognition rules based on the element recognition model; it is also possible to create an element component library based on the pre-collected attribute information of each page element component, establish a schematic wireframe layer of each page element, and traverse and retrieve all elements in the element component resource library on the page design through basic judgments of conventional image inclusion and comparison.

[0044] Step 302: Convert the packaged standard WebElement into a component and map it to the page design image to be identified according to the coordinates of the image element; for example, using Map<String(x_y),Object(elements)> The structure is mapped;

[0045] Step 303, traverse the image elements on the page design picture to be identified, repeat steps 301-302, and obtain the image element components of the page design picture to be identified, including: the type of the image element component, page coordinates, module spacing, and element size.

[0046] Step 4: Render the page according to the image element components of the page design image to be recognized, generate the page, and use the set of component element Map<String(x_y), Object(elements)> corresponding to the page design drawing as the information source for generating the instance page. According to the structural content of each element component, associate and reference the module component code in the element component library, create the relative position of the div for each element, to support the module content structure of the instance page, and convert the absolute position of each element in the element component set to the relative position between each component module, so as to quickly and accurately restore the entire page design image according to the recognized page element component objects. Specifically, add the JS library and CSS library involved in the image element components of the page design image to be recognized to the web page head, load, render, and combine the type, page coordinates, module spacing, and element size of the image element components according to the specific application requirements to generate the page, realizing full-process visual online generation, so as to obtain a page that meets the requirements of different development stages. When the generated page is a static page, directly combine the image element components of the page design image to be recognized into the page; when the generated page is a modular dynamic page, perform the replacement of Map<key identifier, value module>.value through the react or vue module associated with the image element components of the page design image to be recognized, and then perform data encapsulation and framework rendering on the value module to generate the page.

[0047] The multi-form page online generation method based on WASM of the present invention has a relatively low error rate in the design effect compared with manually assembling the page or adjusting the layout position by page developers. Assembling the page with general components, from the fixed design drawing to the page of the generated instance modular code, and directly applying it in practice or further improving or expanding on this basis, all have greatly improved the efficiency of the actual development process and reduced the actual page development workload of developers.

[0048] In one technical solution of the present invention, there is also provided a computer-readable storage medium storing a computer program, and the computer program causes a computer to execute the multi-form page online generation method based on WASM.

[0049] In another technical solution of the present invention, there is also provided an electronic device, including: a memory, a processor, and a computer program stored on the memory and executable on the processor, and when the processor executes the computer program, the multi-form page online generation method based on WASM is implemented.

[0050] In the embodiments disclosed in the present application, the computer storage medium can be a tangible medium that can contain or store a program for use by or in conjunction with an instruction execution system, device or equipment. The computer storage medium can include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices or equipment, or any suitable combination of the above. More specific examples of computer storage media can include electrical connections based on one or more lines, portable computer disks, hard disks, random access memories (RAM), read-only memories (ROM), erasable programmable read-only memories (EPROM or flash memory), optical fibers, portable compact disk read-only memories (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the above.

[0051] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed in this application can be implemented in electronic hardware or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.

[0052] The above are only preferred embodiments of the present invention, and the protection scope of the present invention is not limited to the above embodiments. All technical solutions under the concept of the present invention belong to the protection scope of the present invention. It should be pointed out that for ordinary technicians in this technical field, some improvements and modifications without departing from the principle of the present invention should be regarded as the protection scope of the present invention.

Claims

1. A WASM-based online method for generating polymorphic pages, characterized in that: The specific steps include: Step 1: Based on the native WASM service, initialize and cache the supporting web page element component resource library to obtain the initialized online web page generation environment; Step 2: In the initialized online web page generation environment, import the page design image to be identified; Step 3: The matching service plug-in in WASM traverses and identifies the page design image to be identified based on the element block diagram in the web page element component resource library, and obtains the image element component of the page design image to be identified; including the following sub-steps: Step 301: Install the Appium service plug-in in WASM, and send the image element on the page design picture to be identified to the Appium service plug-in through the image positioning strategy in the Appium service plug-in. The Appium service plug-in finds the element block diagram that matches the image element from the initialized online web page generation environment, and packages the relevant information of the matching element block diagram as a standard WebElement. Step 302: Convert the packaged standard WebElement into a component, and map it to the page design image to be identified according to the coordinates of the image element; Step 303, traverse the image elements on the page design picture to be identified, repeat steps 301-302, and obtain the image element components of the page design picture to be identified; Step 4: Render the page according to the image element components of the page design image to be identified, and generate the page.

2. According to the WASM-based multi-form page online generation method according to claim 1, it is characterized in that: Step 1 includes the following sub-steps: Step 101: construct a .wasm file in WebAssembly format based on a web page element component resource library and a processing logic package of an online generated web page, and stream the .wasm file in the page through a js native API method; Step 102: The client browser loads the localForagejs library, calls the setItem method of localForage, and performs client-side persistent storage of the .wasm file.

3. According to the WASM-based multi-form page online generation method according to claim 2, it is characterized in that: The specific process of step 102 is: the client browser loads the localForagejs library, and the localForagejs framework uses a unified API according to the client browser version and API support, and automatically selects or determines to use webSql / localStorage to perform client-side cache persistence on the .wasm file.

4. According to the WASM-based multi-form page online generation method according to claim 1, it is characterized in that: The method of importing the page design image to be identified in step 2 is: uploading the page design image to be identified through the online operation portal or placing the page design image to be identified into a designated folder.

5. According to the WASM-based multi-form page online generation method according to claim 1, it is characterized in that: The specific process of step 4 is: add the JS library and CSS library involved in the image element components of the page design picture to be identified into the head of the web page, and load, render, and combine to generate a page according to the needs of the specific application.

6. According to the WASM-based multi-form page online generation method according to claim 5, it is characterized in that: When the generated page is a static page, the image element components of the obtained page design picture to be identified are directly combined into a page.

7. According to the WASM-based multi-form page online generation method according to claim 5, it is characterized in that: When the generated page is a modular dynamic page, the react or vue module associated with the image element component of the page design image to be recognized is obtained, and Map<key identifier, value module> is performed to obtain the replacement of the corresponding value module. Then, data encapsulation and framework rendering are performed on the value module to generate the page.

8. A computer-readable storage medium storing a computer program, characterized in that: The computer program causes the computer to execute the WASM-based multi-form page online generation method according to any one of claims 1-7.

9. An electronic device, characterized in that: Including: A memory, a processor, and a computer program stored on the memory and executable on the processor. When the processor executes the computer program, the WASM-based multi-form page online generation method according to any one of claims 1-7 is implemented.