CN111309424B - Page restoration method and related equipment - Google Patents

Page restoration method and related equipment Download PDF

Info

Publication number
CN111309424B
CN111309424B CN202010092598.7A CN202010092598A CN111309424B CN 111309424 B CN111309424 B CN 111309424B CN 202010092598 A CN202010092598 A CN 202010092598A CN 111309424 B CN111309424 B CN 111309424B
Authority
CN
China
Prior art keywords
node
virtual
tree
list
target
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202010092598.7A
Other languages
Chinese (zh)
Other versions
CN111309424A (en
Inventor
郑政邦
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Ping An Life Insurance Company of China Ltd
Original Assignee
Ping An Life Insurance Company of China Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Ping An Life Insurance Company of China Ltd filed Critical Ping An Life Insurance Company of China Ltd
Priority to CN202010092598.7A priority Critical patent/CN111309424B/en
Publication of CN111309424A publication Critical patent/CN111309424A/en
Application granted granted Critical
Publication of CN111309424B publication Critical patent/CN111309424B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/451Execution arrangements for user interfaces
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/957Browsing optimisation, e.g. caching or content distillation

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Databases & Information Systems (AREA)
  • Human Computer Interaction (AREA)
  • Data Mining & Analysis (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
  • Stored Programmes (AREA)

Abstract

The embodiment of the invention discloses a page restoration method and related equipment, wherein the method is applied to the technical field of data processing and comprises the following steps: creating an initial logic tree based on the structure data, traversing the appointed attribute information of each node in at least one node of the initial logic tree, and if the first node is detected to be a list virtual node based on the appointed attribute information, constructing an initial virtual tree corresponding to the initial logic tree according to the hierarchical structure of the initial logic tree and the attribute information of each node; and calling a preset layout library to adjust the initial virtual tree, performing list adaptation processing on each list virtual node in the adjusted initial virtual tree to obtain a target virtual tree, converting the target virtual tree into a layout view tree, and rendering the layout view tree to a display screen to restore the target page. The list component in the restored target page can have the characteristic of a primary list, and the accuracy of restoring the target page is improved.

Description

Page restoration method and related equipment
Technical Field
The present invention relates to the field of data processing technologies, and in particular, to a page restore method and related devices.
Background
With the popularity of intelligent mobile terminal devices, terminal Applications (APP) have penetrated aspects of our lives. Each page in the APP needs to have information presentation and interactive features to enable the end user to obtain valuable information from the APP page at the fastest speed and obtain a satisfactory interactive experience.
At present, for updating an APP page, a general flow is to configure a target page for a developer, generate page configuration data corresponding to the target page, and restore the target page based on the page configuration data after the APP acquires the page configuration data. If the page element (hereinafter referred to as a list component) related to the list attribute in the target page, the restored list component has no some characteristics of the original list (for example, if the APP is applied to the android system, the restored list component has no characteristics of multiplexing, dynamic height and the like of the android list), so that the accuracy rate of restoring the target page is low.
Disclosure of Invention
The embodiment of the invention provides a page restoration method and related equipment, which are beneficial to improving the accuracy of restoring a target page.
In a first aspect, an embodiment of the present invention provides a page restore method, where the method is applied to a terminal device, and the method includes:
Obtaining the structure data of a logic tree corresponding to a target page from a server;
creating an initial logical tree based on the structure data, wherein the initial logical tree comprises at least one node, and each node in the at least one node corresponds to each page element in the target page;
traversing the designated attribute information of each node in the at least one node;
if the first node is detected to be a list virtual node based on the appointed attribute information, constructing an initial virtual tree corresponding to the initial logical tree according to the hierarchical structure of the initial logical tree and the attribute information of each node, wherein the first node is any node in the at least one node;
calling a preset layout library to adjust the initial virtual tree, and performing list adaptation processing on each list virtual node in the adjusted initial virtual tree to obtain a target virtual tree;
and converting the target virtual tree into a layout view tree, and rendering the layout view tree to a display screen to restore the target page.
In one embodiment, the specific implementation manner of calling the preset layout library to adjust the initial virtual tree is as follows:
Calling a preset layout library, and calculating a target attribute value of each virtual node according to the relation between each virtual node and other virtual nodes in the initial virtual tree, wherein the target attribute value comprises the position of the page element corresponding to each virtual node in the target page and the size of the page element corresponding to each virtual node; and adjusting the initial virtual node tree based on the target attribute value of each virtual node.
In one embodiment, the terminal device is applied to a target system, and the list adaptation process is performed on each list virtual node in the adjusted initial virtual tree, so as to obtain a specific implementation manner of the target virtual tree, where the specific implementation manner is as follows: and replacing each list virtual node in the adjusted initial virtual tree with a primary list node under the target system, and initializing attribute information of each list virtual node to the corresponding primary list node to obtain the target virtual tree.
In one embodiment, after initializing the attribute information of each list virtual node to the corresponding native list node, attribute information of each sub-list virtual node under a first list virtual node may be further acquired, where the first list virtual node is one or more list virtual nodes including sub-list virtual nodes in each list virtual node; and adjusting the attribute information initialized to the corresponding original list node based on the attribute information of each sub-list virtual node under the first list virtual node.
In one embodiment, if it is detected that each node in the initial logical tree is not a node of a preset type based on the specified attribute information, a preset layout library is called to calculate a target attribute value of each node according to the relationship between each node and other nodes, where the target attribute value includes a position of a page element corresponding to each node in the target page and a size of a page element corresponding to each node; adjusting the initial logic tree based on the target attribute value of each node, and converting the adjusted initial logic tree into a layout view tree; and rendering the layout view tree to a display screen to realize the restoration of the target page.
In one embodiment, the specific implementation of converting the target virtual tree into the layout view tree is as follows: if the fact that the embedded list virtual nodes are included in the target virtual tree is detected, deleting the embedded list virtual nodes in the target virtual tree; adding child nodes of visible parts under the embedded list virtual nodes to the positions under external list virtual nodes corresponding to the embedded list virtual nodes to obtain an adjusted target virtual tree, wherein the external list virtual nodes are the upper level nodes of the embedded list virtual nodes; and converting the adjusted target virtual tree into a layout view tree.
In one embodiment, before the obtaining, from the server, the structural data of the logical tree corresponding to the target page, the logical tree corresponding to the target page may also be created; and carrying out data conversion on the logic tree according to a preset data format, and uploading structural data obtained by data conversion to a server so as to instruct the server to store the structural data.
In a second aspect, an embodiment of the present invention provides a page restore device, where the page restore device includes a module for executing the method of the first aspect.
In a third aspect, an embodiment of the present invention provides a terminal device, where the terminal device includes a processor, a communication interface, an output device, and a memory, where the processor, the communication interface, the output device, and the memory are connected to each other, where the memory is configured to store a computer program supporting the terminal device to perform the method described above, and the computer program includes program instructions, and the processor is configured to invoke the program instructions to perform the method of the first aspect described above.
In a fourth aspect, embodiments of the present invention provide a computer readable storage medium storing a computer program comprising program instructions which, when executed by a processor, cause the processor to perform the method of the first aspect described above.
In the embodiment of the application, the structure data of the logic tree corresponding to the target page can be acquired from the server, the initial logic tree is created based on the structure data, the appointed attribute information of each node in at least one node of the initial logic tree is traversed, and if the first node is detected to be a list virtual node based on the appointed attribute information, the initial virtual tree corresponding to the initial logic tree is constructed according to the hierarchical structure of the initial logic tree and the attribute information of each node. Further, the terminal device may call the preset layout library to adjust the initial virtual tree, and perform list adaptation processing on each list virtual node in the adjusted initial virtual tree to obtain a target virtual tree, further convert the target virtual tree into a layout view tree, and render the layout view tree to a display screen, so as to implement restoration of the target page. By adopting the mode, the list component in the restored target page has the characteristic of a primary list, and the accuracy of restoring the target page is improved.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for the description of the embodiments will be briefly described below, and it is obvious that the drawings in the following description are some embodiments of the present application, and other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
FIG. 1 is a schematic flow chart of a page restore method according to an embodiment of the present invention;
FIG. 2 is a schematic flow chart of converting a target page into a logic tree according to an embodiment of the present invention;
FIG. 3 is a schematic flow chart of converting an initial logical tree into an initial virtual tree according to an embodiment of the present invention;
FIG. 4 is a schematic flow chart of another page restore method according to an embodiment of the present invention;
FIG. 5 is a schematic flow chart of an embedded list splitting method according to an embodiment of the present invention;
FIG. 6 is a schematic diagram of a process for converting between an initial logical tree, an initial index tree, and an initial virtual tree according to an embodiment of the present invention;
FIG. 7 is a schematic block diagram of a page restore device according to an embodiment of the present invention;
fig. 8 is a schematic block diagram of a terminal device according to an embodiment of the present invention.
Detailed Description
The following description of the embodiments of the present invention will be made clearly and fully with reference to the accompanying drawings, in which it is evident that the embodiments described are some, but not all embodiments of the invention. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
Referring to fig. 1, fig. 1 is a flowchart of a page restore method provided by an embodiment of the present invention, where the method may be performed by a terminal device, and as shown in the drawing, the page restore method may include:
s101: and obtaining the structure data of the logic tree corresponding to the target page from the server.
In one embodiment, the terminal device may include a first terminal device and a second terminal device, where the second terminal device installs a target application corresponding to a target page or may access an application corresponding to the target page. The first terminal can be provided with a page editing application (for example, a page editing platform), a user can draw a target page through the page editing application, after the target page is drawn, the first terminal can create a logic tree corresponding to the target page, perform data conversion on the logic tree according to a preset data format, and upload structural data obtained by data conversion to the server so as to instruct the server to store the structural data.
In one embodiment, the terminal device may install or access the target application and the page editing application at the same time, where the page editing application is used to draw a target page, after detecting that the target page is drawn, the terminal device may create a logic tree corresponding to the target page, perform data conversion on the logic tree according to a preset data format, and upload structural data obtained by data conversion to the server to instruct the server to store the structural data. Further, when the target page needs to be restored, the terminal device may acquire structural data of logic corresponding to the target page from the server, and further execute subsequent steps. The preset data format may be, for example, json data format, etc., which is not limited herein, and the preset data format type may be changed according to the actual calling scene.
In one implementation, after the drawing of the target page is completed, the terminal device may create a logical tree corresponding to the target page based on attribute information of each page element in the target page and hierarchical information between each page element, where the logical tree includes at least one node, so that each node in the logical tree corresponds to each page element one by one. Illustratively, referring to FIG. 2, assume that the target page is composed of page elements: the terminal equipment can construct a logic tree based on hierarchical information and attribute information among the drawing boards, the pictures and the texts, wherein the logic tree is respectively a root node, a drawing board node, a picture node and a text node from top to bottom, and the picture node and the text node in the logic tree belong to lower nodes of the drawing board node because the pictures and the texts are embedded in the drawing boards.
The attribute information of the page element may include one or more of a name, a data format type, content data, a style, a position, a size, and a placement angle of the page element.
S102: an initial logical tree is created based on the structure data, the initial logical tree including at least one node, each of the at least one node corresponding to each page element in the target page.
In one embodiment, the terminal device may parse the structure data to obtain attribute information of each page element in the target page and hierarchical information between each page element. Further, the terminal device may construct a logical tree according to the attribute information of each page element and the hierarchical information between each page element, that is, implement reverse restoration of the logical tree.
S103: traversing the specified attribute information of each of the at least one node.
S104: if the first node is detected to be a list virtual node based on the appointed attribute information, constructing an initial virtual tree corresponding to the initial logical tree according to the hierarchical structure of the initial logical tree and the attribute information of each node, wherein the first node is any node in the at least one node.
Wherein the specified attribute information is a style attribute of the page element, the style attribute characterizes a style of the page element, e.g., a picture, text, list, etc. In one implementation, the initial logical tree includes at least one node, and attribute information for each node. The terminal equipment can traverse the style attribute of each node in the initial logic tree from top to bottom, traverse the appointed attribute information of each node in at least one node, and if any node in the initial logic tree is detected to be a list virtual node based on the appointed attribute information, construct an initial virtual tree corresponding to the initial logic tree according to the hierarchical structure of the initial logic tree and the attribute information of each node.
For example, assuming that the initial logical tree is shown on the left side of fig. 3, the terminal device may traverse the style attribute of each node in the initial logical tree from top to bottom by the root node, determine that the first node is a list virtual node, and construct an initial virtual tree corresponding to the initial logical tree according to the hierarchical structure of the initial logical tree and attribute information of each node, where the initial virtual tree is shown on the right side of fig. 3.
S105: and calling a preset layout library to adjust the initial virtual tree, and performing list adaptation processing on each list virtual node in the adjusted initial virtual tree to obtain a target virtual tree.
S106: and converting the target virtual tree into a layout view tree, and rendering the layout view tree to a display screen to realize the restoration of the target page.
The preset layout library may be, for example, a Yoga, which is a cross-platform layout library opened by Facebook. In one embodiment, the terminal device may invoke the preset layout library to calculate, according to a relationship between each virtual node and other virtual nodes in the initial virtual tree, a target attribute value of each virtual node, where the target attribute value includes a position of a page element corresponding to each virtual node in the target page and a size of a page element corresponding to each virtual node, and adjust the initial virtual tree based on the target attribute value of each virtual node.
Illustratively, the size may include a width and a height of each node corresponding to the page element, and so on. The preset layout library can recalculate the position, the width, the height and other attribute values (namely target attribute values) of each virtual node according to the relation between each virtual node and other virtual nodes in the initial virtual tree, and adjust the attribute values of each virtual node in the initial virtual node based on the recalculated position, the width, the height and other attribute values, so that the adjustment of the initial virtual tree is realized.
In one embodiment, the terminal device is applied to a target system, which may be, for example, an android system, a Windows system, or an IOS system. For example, assuming that the target system is an android system, since the preset layout library does not support calculation of native list page elements (may also be referred to as components), the virtual nodes corresponding to the list page elements in the obtained initial virtual tree (hereinafter referred to as list virtual nodes) do not have some characteristics (such as multiplexing, dynamic height, etc.) of the android list, and if the original android native View is converted into the normal android native View, the effect of the target page cannot be restored, so that list adaptation processing needs to be performed on the list virtual nodes in the initial virtual tree. For this case, the terminal device may traverse each virtual node in the initial virtual tree in the order from top to bottom, if it detects that the designated attribute information of any virtual node is a list attribute, it may determine any virtual node as a list virtual node, perform list adaptation processing on the list virtual node, after the processing is completed, continue to traverse the next virtual node, virtual nodes with non-list attribute, do not process, and so on until all virtual nodes in the initial virtual tree are traversed.
For example, assuming that the target system is an android system, since the preset layout library does not support calculation of native list page elements (may also be referred to as components), the virtual nodes corresponding to the list page elements in the obtained initial virtual tree (hereinafter referred to as list virtual nodes) do not have some characteristics (such as multiplexing, dynamic height, etc.) of the android list, and if the original android native View is converted into the normal android native View, the effect of the target page cannot be restored, so that list adaptation processing needs to be performed on the list virtual nodes in the initial virtual tree.
In one embodiment, a specific implementation manner of performing list adaptation processing on each list virtual node may be: and replacing each list virtual node in the adjusted initial virtual tree with a primary list node under the target system, and initializing attribute information of each list virtual node to a corresponding primary list node to obtain the target virtual tree. By adopting the method, the original list can initially generate view by adopting the attribute information of the list virtual node, but the display mode of the list does not depend on the list virtual node, and the original list is taken over by the android, so that the functions special for the original list, such as multiplexing, pull-down refreshing, scrolling and the like, are realized.
For example, as shown in fig. 3, the initial virtual tree is that "virtual node 1" is a list virtual node, and the terminal device may create a native list node corresponding to "virtual node 1", and initialize attribute information such as the existing width, height, spacing, etc. of "virtual node 1" to the created native list node, so as to implement takeover of the native list on "virtual node 1".
In one embodiment, after initializing the attribute information of each list virtual node to the corresponding native list node, the terminal device may further obtain attribute information of each sub-list virtual node under a first list virtual node, where the first list virtual node is one or more list virtual nodes including the sub-list virtual node in each list virtual node. Further, the terminal device may adjust the attribute information initialized to the corresponding native list node based on the attribute information of each sub-list virtual node under the first list virtual node.
The attribute information includes attribute information such as width, height, size, etc. of the list page element corresponding to the list virtual node in the target page. Assuming that the initial virtual tree is shown in fig. 3, the "virtual node 1" is a list virtual node, and the "virtual node 1" includes two sub-column virtual nodes, which are respectively: the terminal equipment correspondingly creates a primary list node from the virtual node 1, initializes the attribute information such as the existing width, height, distance and the like of the virtual node 1 to the created primary list node, and then recalculates the attribute information such as the width, height, distance and the like of the virtual node 1 based on the attribute information such as the width, height, distance and the like of the virtual node 1 corresponding to the two child nodes. For example, the value corresponding to the attribute information "height" of the "virtual node 1" is adjusted to be the sum of the overlapping heights corresponding to the two child nodes, and the value of the "height" may not be the same as the initial height value of the "virtual node 1".
Further, after traversing all the virtual nodes, the terminal device may generate a layout view tree based on the attribute information of each virtual node in the recalculated virtual tree (i.e., the target virtual tree). By adopting the mode, the whole layout view tree comprising the list nodes can highly restore the target page, and the accuracy of restoring the target page is improved.
In the embodiment of the application, the structure data of the logic tree corresponding to the target page can be acquired from the server, the initial logic tree is created based on the structure data, the appointed attribute information of each node in at least one node of the initial logic tree is traversed, and if the first node is detected to be a list virtual node based on the appointed attribute information, the initial virtual tree corresponding to the initial logic tree is constructed according to the hierarchical structure of the initial logic tree and the attribute information of each node. Further, the terminal device may call the preset layout library to adjust the initial virtual tree, and perform list adaptation processing on each list virtual node in the adjusted initial virtual tree to obtain a target virtual tree, further convert the target virtual tree into a layout view tree, and render the layout view tree to a display screen, so as to implement restoration of the target page. By adopting the mode, the list component in the restored target page has the characteristic of a primary list, and the accuracy of restoring the target page is improved.
Referring to fig. 4, fig. 4 is a flowchart of another page restore method provided in an embodiment of the present invention, where the method may be performed by a terminal device, and as shown in the drawing, the page restore method may include:
s401: and obtaining the structure data of the logic tree corresponding to the target page from the server.
S402: an initial logical tree is created based on the structure data, the initial logical tree including at least one node, each of the at least one node corresponding to each page element in the target page.
S403: traversing the specified attribute information of each of the at least one node.
S404: if the first node is detected to be a list virtual node based on the appointed attribute information, constructing an initial virtual tree corresponding to the initial logical tree according to the hierarchical structure of the initial logical tree and the attribute information of each node, wherein the first node is any node in the at least one node.
S405: and calling a preset layout library to adjust the initial virtual tree, and performing list adaptation processing on each list virtual node in the adjusted initial virtual tree to obtain a target virtual tree. The specific implementation manners of step S401 to step S405 may be referred to the specific descriptions of step S101 to step S105 in the above embodiments, and are not repeated here.
S406: if the embedded list virtual node is detected to be included in the target virtual tree, deleting the embedded list virtual node in the target virtual tree.
S407: and adding the child node of the visible part under the embedded list virtual node to the external list virtual node corresponding to the embedded list virtual node to obtain an adjusted target virtual tree, wherein the external list virtual node is the node of the upper stage of the embedded list virtual node.
S408: and converting the adjusted target virtual tree into a layout view tree, and rendering the layout view tree to a display screen to restore the target page.
For the list component, when there is nesting of the list, the list embedded in the list loses the multiplexing characteristic due to the mechanism of the native View of the android system, and the invisible sub View part of the embedded list screen still stays in the memory, so that the memory burden is increased. For this situation, as a possible implementation manner, a split tiling mechanism of the nested list may be introduced, and the main principle of the split tiling mechanism is that each row of nodes in the embedded list is removed, the current node of the embedded list is discarded, then the removed nodes are split into corresponding rows of the external list according to rows, so that the split rows are managed by the external list, and the embedded list is eliminated.
Illustratively, a list component having a list nest is referred to as an embedded list, and a node corresponding to the embedded list in the target virtual tree is referred to as an embedded list virtual node. Referring to fig. 5, a screen page (external list) 50 is included, and the screen page 50 includes an embedded list 501. It can be seen that the inline list 501 includes 3 display rows, wherein the last display row is not visible, but still remains in memory. For this case, the terminal device may tear out each display line in the embedded list 501, discard the embedded list 501, tear out the torn-out display line into the corresponding line of the external list by line, make the split line return to the external list management, and delete the embedded list.
Accordingly, due to the discarding of the embedded list 501, the terminal device may delete the embedded list virtual node corresponding to the embedded list 501 in the target virtual tree; further, since the external list is removed from the display line of the visible portion in the embedded list 501, the child node of the visible portion (i.e., the node corresponding to the display line of the visible portion) under the virtual node of the embedded list may be added under the virtual node of the external list corresponding to the virtual node of the embedded list due to the management of the external list.
In one embodiment, the foregoing list splitting technique is used to optimize the running performance and the list sliding effect of the android client, but after the embedded list is eliminated, if the embedded list is needed to be in the original memory data, a row is inserted after a certain row in the embedded list nodes, and at this time, since the data layer has no embedded list node, the embedded list nodes cannot be accurately inserted, and if a record row subscript mode is adopted, a complex relative subscript mapping relationship needs to be maintained. In this case, in the embodiment of the present invention, the initial index tree may be introduced before the initial logical tree is created, and all subsequent changes to the initial logical tree are only recorded in the initial index tree, without changing the original initial logical tree. Further, the initial virtual tree is built according to the initial index tree, and then the flow of the initial virtual tree- > the target virtual tree- > the layout view tree is executed, so that the implementation principle is the same, and the description is omitted here. For example, the conversion flow of the initial logical tree- > initial index tree- > initial virtual node tree can be seen in fig. 6.
In this way, the initial index tree can be started, the subsequent tree structure changes, the initial logical tree which is analyzed and converted from the structure data of the logical tree corresponding to the target page is maintained to be in the original structure, and the subsequent addition and deletion of various data contents are facilitated.
In one embodiment, after traversing the designated attribute information of each node in at least one node, if it is detected that each node in the initial logical tree is not a node of a preset type based on the designated attribute information, the terminal device invokes a preset layout library to calculate a target attribute value of each node according to a relationship between each node and other nodes, where the target attribute value includes a position of a page element corresponding to each node in a target page and a size of a page element corresponding to each node. Further, the terminal device may adjust the initial logic tree based on the target attribute value of each node, and convert the adjusted initial logic tree into a layout view tree, so as to render the layout view tree to the display screen, so as to implement restoration of the target page. By adopting the mode, on one hand, the target page can be updated rapidly without depending on the release of the application program version corresponding to the target page, and on the other hand, the initial logic tree is adjusted by introducing the preset layout library, so that the accuracy of target page restoration can be improved.
In the embodiment of the application, the structure data of the logic tree corresponding to the target page can be acquired from the server, the initial logic tree is created based on the structure data, the appointed attribute information of each node in at least one node of the initial logic tree is traversed, and if the first node is detected to be a list virtual node based on the appointed attribute information, the initial virtual tree corresponding to the initial logic tree is constructed according to the hierarchical structure of the initial logic tree and the attribute information of each node. Further, the terminal device may call the preset layout library to adjust the initial virtual tree, and perform list adaptation processing on each list virtual node in the adjusted initial virtual tree, so as to obtain the target virtual tree. Further, if it is detected that the target virtual tree includes the embedded list virtual node, deleting the embedded list virtual node, adding a child node of a visible portion under the embedded list virtual node to an external list virtual node corresponding to the embedded list virtual node, obtaining an adjusted target virtual tree, further converting the adjusted target virtual tree into a layout view tree, and rendering the layout view tree to a display screen, so that the target page is restored.
The embodiment of the invention also provides a page reduction device. The device comprises a module for executing the method described in the foregoing fig. 1 or fig. 4, and is configured in a terminal device. Specifically, referring to fig. 7, a schematic block diagram of a page restore device provided by an embodiment of the present invention is shown. The page restore device of this embodiment includes:
the communication module 70 is configured to obtain, from a server, structure data of a logical tree corresponding to a target page;
a processing module 71, configured to create an initial logical tree based on the structure data, where the initial logical tree includes at least one node, and each node in the at least one node corresponds to each page element in the target page;
the processing module 71 is further configured to traverse specified attribute information of each node in the at least one node, and if it is detected that a first node is a list virtual node based on the specified attribute information, construct an initial virtual tree corresponding to the initial logical tree according to a hierarchical structure of the initial logical tree and the attribute information of each node, where the first node is any node in the at least one node;
the processing module 71 is further configured to invoke a preset layout library to adjust the initial virtual tree, and perform list adaptation processing on each list virtual node in the adjusted initial virtual tree to obtain a target virtual tree;
The processing module 71 is further configured to convert the target virtual tree into a layout view tree, and render the layout view tree to a display screen, so as to implement reduction of the target page.
In one embodiment, the processing module 71 is specifically configured to invoke a preset layout library to calculate, according to a relationship between each virtual node and other virtual nodes in the initial virtual tree, a target attribute value of each virtual node, where the target attribute value includes a position of a page element corresponding to each virtual node in the target page and a size of the page element corresponding to each virtual node; and adjusting the initial virtual node tree based on the target attribute value of each virtual node.
In one embodiment, the terminal device is applied to a target system, and the processing module 71 is specifically configured to replace each list virtual node in the adjusted initial virtual tree with a native list node under the target system, and initialize attribute information of each list virtual node to the corresponding native list node to obtain the target virtual tree.
In one embodiment, the processing module 71 is further configured to obtain attribute information of each sub-list virtual node under a first list virtual node, where the first list virtual node is one or more list virtual nodes including the sub-list virtual node in the each list virtual node; and adjusting the attribute information initialized to the corresponding original list node based on the attribute information of each sub-list virtual node under the first list virtual node.
In one embodiment, the processing module 71 is further configured to, if it is detected that each node in the initial logical tree is not a node of a preset type based on the specified attribute information, invoke a preset layout library to calculate a target attribute value of each node according to a relationship between the each node and other nodes, where the target attribute value includes a position of a page element corresponding to each node in the target page and a size of a page element corresponding to each node. Adjusting the initial logic tree based on the target attribute value of each node, and converting the adjusted initial logic tree into a layout view tree; and rendering the layout view tree to a display screen to realize the restoration of the target page.
In one embodiment, the converting the target virtual tree into a layout view tree, the processing module 71 is further configured to delete the embedded list virtual node in the target virtual tree if it is detected that the embedded list virtual node is included in the target virtual tree; adding child nodes of visible parts under the embedded list virtual nodes to the positions under external list virtual nodes corresponding to the embedded list virtual nodes to obtain an adjusted target virtual tree, wherein the external list virtual nodes are the upper level nodes of the embedded list virtual nodes; and converting the adjusted target virtual tree into a layout view tree.
In one embodiment, the processing module 71 is further configured to create a logical tree corresponding to the target page; and carrying out data conversion on the logic tree according to a preset data format, and uploading structural data obtained by data conversion to a server so as to instruct the server to store the structural data.
It should be noted that, the functions of each functional module of the page restore device described in the embodiments of the present invention may be specifically implemented according to the method in the embodiment of the method described in fig. 1 or fig. 4, and the specific implementation process may refer to the related description of the embodiment of the method in fig. 1 or fig. 4, which is not repeated herein.
Referring to fig. 8 again, a schematic structural diagram of a terminal device according to an embodiment of the present invention includes a power supply module and other structures, and includes a processor 801, a memory 802, a communication interface 803, and an output device 804. Data can be interacted among the processor 801, the memory 802, the communication interface 803 and the output device 804, and corresponding page restore functions are realized by the processor 801.
The memory 802 may include volatile memory (RAM), such as random-access memory (RAM); the memory 802 may also include a non-volatile memory (non-volatile memory), such as a flash memory (flash memory), a Solid State Drive (SSD), etc.; the memory 802 may also include a combination of the above types of memory. Output devices 804 may include a display (LCD, etc.), speakers, and the like.
The processor 801 may be a central processing unit (central processing unit, CPU). In one embodiment, the processor 801 may also be a graphics processor 801 (Graphics Processing Unit, GPU). The processor 801 may also be a combination of a CPU and a GPU. In the terminal device, a plurality of CPUs and GPUs may be included as needed to perform corresponding image processing. In one embodiment, the memory 802 is used to store program instructions. The processor 801 may invoke the program instructions to implement the various methods as referred to above in embodiments of the present invention.
In a first possible implementation manner, the processor 801 of the terminal device invokes the program instruction stored in the memory 802, and obtains the structure data of the logic tree corresponding to the target page from the server through the communication interface 803; creating an initial logical tree based on the structure data, wherein the initial logical tree comprises at least one node, and each node in the at least one node corresponds to each page element in the target page; traversing the designated attribute information of each node in the at least one node; if the first node is detected to be a list virtual node based on the appointed attribute information, constructing an initial virtual tree corresponding to the initial logical tree according to the hierarchical structure of the initial logical tree and the attribute information of each node, wherein the first node is any node in the at least one node; calling a preset layout library to adjust the initial virtual tree, and performing list adaptation processing on each list virtual node in the adjusted initial virtual tree to obtain a target virtual tree; the target virtual tree is converted into a layout view tree, and the layout view tree is rendered to an output device 804 to achieve the reduction of the target page.
In one embodiment, the processor 801 is specifically configured to invoke a preset layout library to calculate, according to a relationship between each virtual node and other virtual nodes in the initial virtual tree, a target attribute value of each virtual node, where the target attribute value includes a position of a page element corresponding to each virtual node in the target page and a size of the page element corresponding to each virtual node; and adjusting the initial virtual node tree based on the target attribute value of each virtual node.
In one embodiment, the terminal device is applied to a target system, and the processor 801 is specifically configured to replace each list virtual node in the adjusted initial virtual tree with a native list node under the target system, and initialize attribute information of each list virtual node to the corresponding native list node to obtain the target virtual tree.
In one embodiment, the processor 801 is further configured to obtain attribute information of each sub-list virtual node under a first list virtual node, where the first list virtual node is one or more list virtual nodes including the sub-list virtual node in the each list virtual node; and adjusting the attribute information initialized to the corresponding original list node based on the attribute information of each sub-list virtual node under the first list virtual node.
In one embodiment, the processor 801 is further configured to, if it is detected that each node in the initial logical tree is not a node of a preset type based on the specified attribute information, invoke a preset layout library to calculate a target attribute value of each node according to a relationship between the each node and other nodes, where the target attribute value includes a position of a page element corresponding to each node in the target page and a size of a page element corresponding to each node. Adjusting the initial logic tree based on the target attribute value of each node, and converting the adjusted initial logic tree into a layout view tree; and rendering the layout view tree to a display screen to realize the restoration of the target page.
In one embodiment, the converting the target virtual tree into a layout view tree, the processor 801 is further configured to delete the embedded list virtual node in the target virtual tree if it is detected that the embedded list virtual node is included in the target virtual tree; adding child nodes of visible parts under the embedded list virtual nodes to the positions under external list virtual nodes corresponding to the embedded list virtual nodes to obtain an adjusted target virtual tree, wherein the external list virtual nodes are the upper level nodes of the embedded list virtual nodes; and converting the adjusted target virtual tree into a layout view tree.
In one embodiment, the processor 801 is further configured to create a logical tree corresponding to the target page; and carrying out data conversion on the logic tree according to a preset data format, and uploading structural data obtained by data conversion to a server so as to instruct the server to store the structural data.
In the embodiment of the present invention, the specific implementation of the processor 801 may refer to the description of the related content in the embodiment corresponding to fig. 1 or fig. 4.
In another embodiment of the present invention, there is provided a computer-readable storage medium storing a computer program comprising program instructions that when executed by a processor implement: obtaining the structure data of a logic tree corresponding to a target page from a server; creating an initial logical tree based on the structure data, wherein the initial logical tree comprises at least one node, and each node in the at least one node corresponds to each page element in the target page; traversing the designated attribute information of each node in the at least one node; if the first node is detected to be a list virtual node based on the appointed attribute information, constructing an initial virtual tree corresponding to the initial logical tree according to the hierarchical structure of the initial logical tree and the attribute information of each node, wherein the first node is any node in the at least one node; calling a preset layout library to adjust the initial virtual tree, and performing list adaptation processing on each list virtual node in the adjusted initial virtual tree to obtain a target virtual tree; and converting the target virtual tree into a layout view tree, and rendering the layout view tree to a display screen to restore the target page.
The computer readable storage medium may be an internal storage unit of the terminal device according to any of the foregoing embodiments, for example, a hard disk or a memory of the terminal device. The computer readable storage medium may also be an external storage device of the terminal device, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card) or the like, which are provided on the terminal device. Further, the computer-readable storage medium may further include both an internal storage unit and an external storage device of the terminal device. The computer-readable storage medium is used for storing the computer program and other programs and data required by the terminal device. The computer-readable storage medium may also be used to temporarily store data that has been output or is to be output.
Those skilled in the art will appreciate that implementing all or part of the above-described methods in accordance with the embodiments may be accomplished by way of a computer program stored on a computer readable storage medium, which when executed may comprise the steps of the embodiments of the methods described above. The storage medium may be a magnetic disk, an optical disk, a Read-Only Memory (ROM), a random access Memory (Random Access Memory, RAM), or the like.
The above disclosure is only a few examples of the present invention, and it is not intended to limit the scope of the present invention, but it is understood by those skilled in the art that all or a part of the above embodiments may be implemented and equivalents thereof may be modified according to the scope of the present invention.

Claims (8)

1. A page restore method, wherein the method is applied to a terminal device, and the method comprises:
obtaining the structure data of a logic tree corresponding to a target page from a server;
creating an initial logical tree based on the structure data, wherein the initial logical tree comprises at least one node, and each node in the at least one node corresponds to each page element in the target page;
traversing the designated attribute information of each node in the at least one node;
if the first node is detected to be a list virtual node based on the appointed attribute information, constructing an initial virtual tree corresponding to the initial logical tree according to the hierarchical structure of the initial logical tree and the attribute information of each node, wherein the first node is any node in the at least one node;
calling a preset layout library to adjust the initial virtual tree, replacing each list virtual node in the adjusted initial virtual tree with a primary list node under a target system, and initializing attribute information of each list virtual node to the corresponding primary list node to obtain a target virtual tree;
If the fact that the embedded list virtual nodes are included in the target virtual tree is detected, deleting the embedded list virtual nodes in the target virtual tree;
adding child nodes of visible parts under the embedded list virtual nodes to the positions under external list virtual nodes corresponding to the embedded list virtual nodes to obtain an adjusted target virtual tree, wherein the external list virtual nodes are the upper level nodes of the embedded list virtual nodes;
and converting the adjusted target virtual tree into a layout view tree, and rendering the layout view tree to a display screen to realize the reduction of the target page.
2. The method of claim 1, wherein the invoking the preset topology base to adjust the initial virtual tree comprises:
calling a preset layout library, and calculating a target attribute value of each virtual node according to the relation between each virtual node and other virtual nodes in the initial virtual tree, wherein the target attribute value comprises the position of the page element corresponding to each virtual node in the target page and the size of the page element corresponding to each virtual node;
and adjusting the initial virtual tree based on the target attribute value of each virtual node.
3. The method of claim 1, wherein after initializing the attribute information of each list virtual node to the corresponding native list node to obtain a target virtual tree, the method further comprises:
acquiring attribute information of each sub-list virtual node under a first list virtual node, wherein the first list virtual node is one or more list virtual nodes comprising the sub-list virtual nodes in the list virtual nodes;
and adjusting the attribute information initialized to the corresponding original list node based on the attribute information of each sub-list virtual node under the first list virtual node.
4. A method according to any one of claims 1-3, wherein the method further comprises:
if the fact that each node in the initial logic tree is not a node of a preset type is detected based on the appointed attribute information, a preset layout library is called, and a target attribute value of each node is calculated according to the relation between each node and other nodes, wherein the target attribute value comprises the position of a page element corresponding to each node in the target page and the size of the page element corresponding to each node;
Adjusting the initial logic tree based on the target attribute value of each node, and converting the adjusted initial logic tree into a layout view tree;
and rendering the layout view tree to a display screen to realize the restoration of the target page.
5. The method of claim 1, wherein before the obtaining the structure data of the logical tree corresponding to the target page from the server, the method further comprises:
creating a logic tree corresponding to the target page;
and carrying out data conversion on the logic tree according to a preset data format, and uploading structural data obtained by data conversion to a server so as to instruct the server to store the structural data.
6. A page restore device, wherein the device is configured in a terminal device, the device comprising:
the communication module is used for acquiring the structure data of the logic tree corresponding to the target page from the server;
a processing module, configured to create an initial logical tree based on the structure data, where the initial logical tree includes at least one node, and each node in the at least one node corresponds to each page element in the target page;
the processing module is further configured to traverse specified attribute information of each node in the at least one node, and if a first node is detected to be a list virtual node based on the specified attribute information, construct an initial virtual tree corresponding to the initial logical tree according to a hierarchical structure of the initial logical tree and the attribute information of each node, where the first node is any node in the at least one node;
The processing module is further configured to invoke a preset layout library to adjust the initial virtual tree, replace each list virtual node in the adjusted initial virtual tree with a native list node under a target system, and initialize attribute information of each list virtual node to a corresponding native list node to obtain a target virtual tree;
the processing module is further configured to delete the embedded list virtual node in the target virtual tree if it is detected that the embedded list virtual node is included in the target virtual tree; adding child nodes of visible parts under the embedded list virtual nodes to the positions under external list virtual nodes corresponding to the embedded list virtual nodes to obtain an adjusted target virtual tree, wherein the external list virtual nodes are the upper level nodes of the embedded list virtual nodes; and converting the adjusted target virtual tree into a layout view tree, and rendering the layout view tree to a display screen to realize the reduction of the target page.
7. A terminal device comprising a processor and a memory, the processor and the memory being interconnected, wherein the memory is adapted to store a computer program comprising program instructions, the processor being configured to invoke the program instructions to perform the method of any of claims 1-5.
8. A computer readable storage medium storing a computer program, the computer program being executed by a processor to implement the method of any one of claims 1-5.
CN202010092598.7A 2020-02-12 2020-02-12 Page restoration method and related equipment Active CN111309424B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010092598.7A CN111309424B (en) 2020-02-12 2020-02-12 Page restoration method and related equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010092598.7A CN111309424B (en) 2020-02-12 2020-02-12 Page restoration method and related equipment

Publications (2)

Publication Number Publication Date
CN111309424A CN111309424A (en) 2020-06-19
CN111309424B true CN111309424B (en) 2023-09-22

Family

ID=71154578

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010092598.7A Active CN111309424B (en) 2020-02-12 2020-02-12 Page restoration method and related equipment

Country Status (1)

Country Link
CN (1) CN111309424B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114637499B (en) * 2022-03-31 2022-11-29 阿里巴巴(中国)有限公司 Visualization component processing method, device, equipment and medium
CN117762407A (en) * 2022-09-16 2024-03-26 腾讯科技(深圳)有限公司 Page rendering method, device, equipment, storage medium and computer program product

Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105354013A (en) * 2014-08-18 2016-02-24 阿里巴巴集团控股有限公司 Application interface rendering method and apparatus
CN106371844A (en) * 2016-08-31 2017-02-01 北京奇艺世纪科技有限公司 Method and system for presenting webpage by native user interface assembly
CN106777020A (en) * 2016-12-08 2017-05-31 深圳市小满科技有限公司 Display device and display methods
US9766769B1 (en) * 2014-12-31 2017-09-19 FullStory, Inc. Evaluation of interactions with a user interface
CN107329978A (en) * 2017-05-31 2017-11-07 北京京东尚科信息技术有限公司 The method for routing and device of multi-platform fusion
CN107368487A (en) * 2016-05-12 2017-11-21 阿里巴巴集团控股有限公司 A kind of page assembly Dynamic Distribution method, apparatus and client
CN107608675A (en) * 2017-09-27 2018-01-19 微景天下(北京)科技有限公司 Cross-platform front end development system and method based on virtual document object model
CN109814866A (en) * 2019-01-31 2019-05-28 天津字节跳动科技有限公司 Page application is converted into the treating method and apparatus of native applications
KR20190131348A (en) * 2018-05-16 2019-11-26 엔에이치엔 주식회사 A method for landing a notification page in response to a selection of a user on a terminal and the terminal and a system for implementing the method

Patent Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105354013A (en) * 2014-08-18 2016-02-24 阿里巴巴集团控股有限公司 Application interface rendering method and apparatus
US9766769B1 (en) * 2014-12-31 2017-09-19 FullStory, Inc. Evaluation of interactions with a user interface
CN107368487A (en) * 2016-05-12 2017-11-21 阿里巴巴集团控股有限公司 A kind of page assembly Dynamic Distribution method, apparatus and client
CN106371844A (en) * 2016-08-31 2017-02-01 北京奇艺世纪科技有限公司 Method and system for presenting webpage by native user interface assembly
CN106777020A (en) * 2016-12-08 2017-05-31 深圳市小满科技有限公司 Display device and display methods
CN107329978A (en) * 2017-05-31 2017-11-07 北京京东尚科信息技术有限公司 The method for routing and device of multi-platform fusion
CN107608675A (en) * 2017-09-27 2018-01-19 微景天下(北京)科技有限公司 Cross-platform front end development system and method based on virtual document object model
KR20190131348A (en) * 2018-05-16 2019-11-26 엔에이치엔 주식회사 A method for landing a notification page in response to a selection of a user on a terminal and the terminal and a system for implementing the method
CN109814866A (en) * 2019-01-31 2019-05-28 天津字节跳动科技有限公司 Page application is converted into the treating method and apparatus of native applications

Also Published As

Publication number Publication date
CN111309424A (en) 2020-06-19

Similar Documents

Publication Publication Date Title
CN105069118B (en) A kind of application scenarios management method and system based on GIS configurations
CN108415702B (en) Dynamic rendering method and device for application interface of mobile terminal
US10380227B2 (en) Generating layout for content presentation structures
US11216253B2 (en) Application prototyping tool
CN106339226B (en) A kind of methods of exhibiting and page presentation device of Webpage
CN111552473A (en) Application processing method, device and equipment
KR20150079867A (en) Html5-protocol-based webpage presentation method and device
CN111309424B (en) Page restoration method and related equipment
EA033675B1 (en) System and method for automated conversion of interactive sites and applications to support mobile and other display environments
WO2014138287A1 (en) Automatic alignment of a multi-dimensional layout
JP6157758B2 (en) Information processing apparatus, moving image reproducing method, and moving image reproducing program
US20190266222A1 (en) Online displaying a document
CN104052626A (en) Method, device and system for configuring network element data
US10567472B2 (en) Manipulation of PDF files using HTML authoring tools
CN103324484A (en) Method and device for displaying view
CN113419806B (en) Image processing method, device, computer equipment and storage medium
CN108073646B (en) Directory extraction method and device
CN110473275A (en) Frame animation realization, device, electronic equipment under a kind of Android system
CN114385957A (en) Landing page creation method and station building platform
CN114866801A (en) Video data processing method, device and equipment and computer readable storage medium
CN107402749A (en) Realize the method and device in picture loading storehouse
WO2023246403A1 (en) Model training method, watermark restoration method, and related device
CN116595284B (en) Webpage system operation method, device, equipment, storage medium and program
US11599599B1 (en) Emulating a transparency effect for a display element
CN110221873B (en) Method for improving full-screen animation loading performance based on programming language and electronic equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant