Page data processing method and device, computer equipment, readable storage medium and program product

By detecting the form data snapshot when the page is closed and the variable attributes of the current data, and pushing a save confirmation message, the problem of low page data processing efficiency in the existing technology is solved, and efficient data storage and reduction of loss is achieved.

CN119106002APending Publication Date: 2024-12-10SHENZHEN COMTOP INFORMATION TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411069714.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-06
Publication Date
2024-12-10

AI Technical Summary

Technical Problem

The existing page data processing method is not efficient when the page is closed, and it is impossible to effectively detect and push form data to save confirmation messages, resulting in an increase in the possibility of data loss.

Method used

By obtaining the current form data of the target page and the latest form snapshot data, it detects whether the initial form snapshot is consistent with the variable attribute data of the target object in the current form data, and pushes the form data to save the confirmation message when it is inconsistent, reducing the detection calculation amount. Improve processing efficiency.

Benefits of technology

It realizes efficient detection and push form data saving confirmation messages when the page is closed, reducing the possibility of data loss and improving the efficiency of page data processing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119106002A_ABST
    Figure CN119106002A_ABST
Patent Text Reader

Abstract

The invention relates to a page data processing method and device, computer equipment, a computer readable storage medium and a computer program product. The method comprises the steps of obtaining current form data and latest form snapshot data of a target page in response to a closing operation for the target page; detecting whether the initial form snapshot is consistent with target attribute data of a target object in the current form data, wherein the target attribute data is variable data; and when it is detected that the form snapshot data is inconsistent with the target attribute data in the current form data, pushing a form data storage confirmation message. By adopting the method, the page data processing efficiency can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of data processing technology, and in particular to a page data processing method, apparatus, computer equipment, computer-readable storage medium, and computer program product. Background Art

[0002] With the development of science and technology, page data detection technology has become a topic of great concern. Page data detection technology refers to the detection of form data in a page when the page is closed to determine whether there are any changes in the form data in the page, and give users corresponding feedback to reduce the possibility of loss of changed data due to users' failure to save data in time.

[0003] In traditional technology, when a page close event is detected, the page data is processed by comparing the current data of the page with the data when the page was initially opened through preset data comparison rules. If the comparison result is inconsistent, the page push warning message is triggered to prompt the user to save the changed data.

[0004] However, the current page data processing method is still not efficient enough. Summary of the invention

[0005] Based on this, it is necessary to provide an efficient page data processing method, apparatus, computer device, computer-readable storage medium and computer program product to address the above technical issues.

[0006] In a first aspect, the present application provides a page data processing method, comprising:

[0007] In response to the closing operation on the target page, obtain the current form data of the target page and the latest form snapshot data;

[0008] Check whether the target attribute data of the target object in the initial form snapshot is consistent with that in the current form data. The target attribute data is variable data.

[0009] When it is detected that the target attribute data in the form snapshot data is inconsistent with the target attribute data in the current form data, a form data saving confirmation message is pushed.

[0010] In one embodiment, detecting whether the target attribute data of the target object in the initial form snapshot is consistent with the target attribute data in the current form data includes:

[0011] Determine the object types of multiple sub-objects of the target object in the initial form snapshot and the current form data;

[0012] For each sub-object, based on the object type, check whether the attribute data of the sub-object in the initial form snapshot and the current form data are consistent.

[0013] In one of the embodiments, the attribute data includes an attribute field and an attribute value of the attribute field;

[0014] Based on the object type, check whether the attribute data of the sub-objects in the initial form snapshot and the current form data are consistent, including:

[0015] When the object type is the first object type, it is detected whether the attribute values ​​of the sub-objects in the initial form snapshot and the current form data are consistent; or, it is detected whether the attribute fields and attribute values ​​of the sub-objects in the initial form snapshot and the current form data are consistent.

[0016] In one embodiment, based on the object type, detecting whether the attribute data of the sub-object in the initial form snapshot and the current form data are consistent includes:

[0017] When the object type is the second object type, it is detected whether the root attribute field and the root attribute value of the sub-object in the initial form snapshot and the current form data are consistent, and the complexity of the first type is higher than the complexity of the second type.

[0018] In one embodiment, after detecting whether the root attribute field and the root attribute value of the child object in the initial form snapshot and the current form data are consistent, the method further includes:

[0019] Check whether the sub-attribute fields and sub-attribute values ​​of the root attribute fields in the initial form snapshot and the current form data are consistent.

[0020] In one embodiment, based on the object type, detecting whether the attribute data of the sub-object in the initial form snapshot and the current form data are consistent includes:

[0021] When the object type is a formatted object type, the attribute data of the sub-object in the current form data is converted into the attribute data of the target format, and the target format is the data format of the attribute data of the sub-object in the initial form snapshot; it is detected whether the attribute data of the sub-object in the current form data after the conversion format is consistent with the attribute data of the sub-object in the initial form snapshot.

[0022] In a second aspect, the present application further provides a page data processing device, comprising:

[0023] The acquisition module is used to respond to the closing operation on the target page and obtain the current form data and the latest form snapshot data of the target page;

[0024] A detection module is used to detect whether the target attribute data of the target object in the initial form snapshot is consistent with the target attribute data in the current form data, and the target attribute data is variable data;

[0025] The push module is used to push a form data saving confirmation message when it is detected that the form snapshot data is inconsistent with the target attribute data in the current form data.

[0026] In a third aspect, the present application further provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the following steps are implemented:

[0027] In response to the closing operation on the target page, obtain the current form data of the target page and the latest form snapshot data;

[0028] Check whether the target attribute data of the target object in the initial form snapshot is consistent with that in the current form data. The target attribute data is variable data.

[0029] When it is detected that the target attribute data in the form snapshot data is inconsistent with the target attribute data in the current form data, a form data saving confirmation message is pushed.

[0030] In a fourth aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the following steps are implemented:

[0031] In response to the closing operation on the target page, obtain the current form data of the target page and the latest form snapshot data;

[0032] Check whether the target attribute data of the target object in the initial form snapshot is consistent with that in the current form data. The target attribute data is variable data.

[0033] When it is detected that the target attribute data in the form snapshot data is inconsistent with the target attribute data in the current form data, a form data saving confirmation message is pushed.

[0034] In a fifth aspect, the present application further provides a computer program product, including a computer program, which implements the following steps when executed by a processor:

[0035] In response to the closing operation on the target page, obtain the current form data of the target page and the latest form snapshot data;

[0036] Check whether the target attribute data of the target object in the initial form snapshot is consistent with that in the current form data. The target attribute data is variable data.

[0037] When it is detected that the target attribute data in the form snapshot data is inconsistent with the target attribute data in the current form data, a form data saving confirmation message is pushed.

[0038] The above-mentioned page data processing method, apparatus, computer device, computer-readable storage medium and computer program product, in response to a closing operation on a target page, obtain the current form data and the latest form snapshot data of the target page, and detect whether the variable attribute data of the target object in the initial form snapshot is consistent with the current form data, and push a form data save confirmation message when it is detected that the target attribute data in the form snapshot data and the current form data are inconsistent. Different from directly detecting whether the current form data of the target page and the latest form snapshot data are consistent, the variable attribute data of the target object in the current form snapshot data and the latest form snapshot data are detected, which reduces the calculation amount of the detection, so that the form data save confirmation message can be pushed efficiently when the target attribute data is inconsistent, so that the user can save the current form data of the target page, and the entire page data processing process is very efficient. BRIEF DESCRIPTION OF THE DRAWINGS

[0039] In order to more clearly illustrate the technical solutions in the embodiments of the present application or related technologies, the drawings required for use in the embodiments of the present application or related technical descriptions will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.

[0040] Figure 1 An application environment diagram of a page data processing method in an embodiment;

[0041] Figure 2 A schematic diagram of a flow chart of a page data processing method in one embodiment;

[0042] Figure 3 A schematic diagram of a flow chart of a page data processing method in another embodiment;

[0043] Figure 4 is a structural block diagram of a page data processing device in one embodiment;

[0044] Figure 5 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION

[0045] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0046] The page data processing method provided in the embodiment of the present application can be applied to Figure 1 In the application environment shown.

[0047] When the user clicks the Save button of the target page on the terminal 102, the terminal 102 obtains the form data of the target page at this time as the form snapshot data; and if the user clicks the Save button of the target page on the terminal 102 multiple times, the terminal 102 will also generate new form snapshot data multiple times. The terminal 102 stores the form snapshot data generated each time the Save button is pressed locally.

[0048] When the user clicks the close button of the target page, the terminal 102 obtains the current form data of the target page and obtains the latest form snapshot data from the local computer. The terminal 102 responds by comparing the target attribute data of the target object in the initial form snapshot with the target attribute data in the current form data to see if they are consistent. The target attribute data is variable data. If the target attribute data in the form snapshot data is inconsistent with the target attribute data in the current form data, the terminal 102 pushes a form data save confirmation message to the user.

[0049] The terminal 102 may be, but is not limited to, various personal computers, laptops, smart phones, tablet computers, IoT devices, and portable wearable devices. IoT devices may be smart speakers, smart TVs, smart air conditioners, smart vehicle-mounted devices, projection devices, etc. Portable wearable devices may be smart watches, smart bracelets, head-mounted devices, etc. Head-mounted devices may be virtual reality (VR) devices, augmented reality (AR) devices, smart glasses, etc.

[0050] In an exemplary embodiment, Figure 2 As shown, a page data processing method is provided, which is applied to Figure 1 The terminal 102 in FIG. 1 is used as an example for explanation.

[0051] S200, in response to a close operation on a target page, obtaining current form data and the latest form snapshot data of the target page.

[0052] The target page refers to a specific browser window, tab page, or other page. The form is the space in the target page responsible for data collection, which is used to collect information entered or selected by the user. A snapshot is a fully usable copy of a specified data set, which includes an image of the corresponding data at a certain point in time. The form snapshot data is the form data of the target page when the user clicks the Save button.

[0053] Specifically, when the user clicks the Save button of the target page on the terminal, the terminal obtains the form data of the target page at this time as the form snapshot data; and if the user clicks the Save button of the target page on the terminal multiple times, the terminal will also generate new form snapshot data multiple times. The terminal stores the form snapshot data generated each time the Save button is pressed locally.

[0054] When the user clicks the close button of the target page, the terminal obtains the current form data of the target page and obtains the latest form snapshot data from the local. Furthermore, the closing operation for the target page includes but is not limited to closing the browser window or tab page, or navigating to another page. The reason why the terminal can respond to the closing operation for the target page is mainly because a Beforeunload event handler is set in the terminal. The Beforeunload event handler is an event handler in JavaScript, which is used to trigger before the browser window or tab page is about to be closed.

[0055] In one embodiment, the form snapshot data generated by the terminal is not only generated each time the user presses the save button of the target page, but also can be generated when the user just opens the target page, that is, during the initialization process of the target page, by collecting the form data of the target page to generate the initial form snapshot data.

[0056] If the user has not clicked the Save button on the target page, the initial form snapshot data will be used as the latest form snapshot data. If the user has clicked the Save button on the target page at least once, the form snapshot data generated when the Save button on the target page was most recently clicked will be used as the latest form snapshot data.

[0057] S400, detecting whether the target attribute data of the target object in the initial form snapshot is consistent with that in the current form data.

[0058] The target object is a summary of the form's information, such as user information. The target attribute data is variable data. Variable data refers to data that can be modified by the user.

[0059] Specifically, the terminal detects whether the variable attribute data of the target object in the initial form snapshot and the current form data are consistent through a data detection algorithm. Further, the terminal first filters the static attribute data of the target object in the initial form snapshot and the current form data, and then detects whether the attribute data of the target object in the filtered initial form snapshot and the current form data are consistent. Among them, the static attribute data is data that cannot be modified by the user.

[0060] For example, when the target page is user information management, if only the home address in the user information form in the user information management page is editable, and the user name, gender and other information are not editable, then there is no need to detect whether the initial form snapshot is consistent with the user name, gender and other non-editable information in the current form data. Therefore, the non-editable information in the user information management page is filtered, and only the home address in the initial form snapshot is detected to improve the efficiency of page data detection.

[0061] In one embodiment, the terminal filters the static attribute data of the target object in the initial form snapshot and the current form data by defining a static attribute variable, which contains the static attribute data of the target object in the initial form snapshot and the current form data, so as to filter the static attribute data of the target object in the initial form snapshot and the current form data, and then compare the local data to improve the detection performance. Furthermore, the terminal also supports the definition of static attributes in the global configuration file, which can meet the terminal's reconfiguration of global static attributes and realize decoupling from the business code.

[0062] In one embodiment, static attributes are mainly set in each sub-object of the target object. Taking user information as an example, there is a code as follows:

[0063] {

[0064] name: 'zhangsan',

[0065] age: 18,

[0066] location: {province: 'Guangdong Province', city: 'Shenzhen'},

[0067] loginLog: [{ip: '10.10.160.2', address: 'Shenzhen'}, {ip: '10.10.162.32',address: 'Guangzhou'}]

[0068] }

[0069] The following three situations are used to determine the static attribute fields:

[0070] The first method is to determine a certain attribute field of the child object as a static attribute field, and define the static attribute field name in the static attribute variable, such as name.

[0071] The second type is that when the attribute data of the sub-object includes a root attribute field and a sub-attribute field of the root attribute field, the root attribute field and the sub-attribute field are determined as static attribute fields, and the attribute field names of the root attribute field and the sub-attribute field are defined in the static attribute variable, such as location.city.

[0072] The third method is to define the root attribute field and sub-attribute field corresponding to the array as static attribute fields when the sub-attribute field of the sub-object is an array, and define the root attribute field name and sub-attribute field name in the static attribute variable. The difference from the second method is that a square bracket "[]" is required after the root attribute field name, such as loginLog[].city.

[0073] S600: When it is detected that the target attribute data in the form snapshot data is inconsistent with the target attribute data in the current form data, a form data saving confirmation message is pushed.

[0074] Specifically, when it is detected that the target attribute data in the form snapshot data is inconsistent with the target attribute data in the current form data, it means that the current form data has been modified compared to the latest form snapshot data. At this time, it is necessary to push a form data save confirmation message to the user to reduce the possibility of loss of modified data.

[0075] In the above page data processing method, in response to the closing operation on the target page, the current form data and the latest form snapshot data of the target page are obtained, and it is detected whether the variable attribute data of the target object in the initial form snapshot is consistent with the current form data. When it is detected that the target attribute data in the form snapshot data and the current form data are inconsistent, a form data save confirmation message is pushed. Different from directly detecting whether the current form data of the target page and the latest form snapshot data are consistent, the variable attribute data of the target object in the current form data and the latest form snapshot data are detected, which reduces the calculation amount of the detection, so that when the target attribute data is inconsistent, the form data save confirmation message can be pushed efficiently, so that the user can save the current form data of the target page, and the entire page data processing process is very efficient.

[0076] In an exemplary embodiment, Figure 3 As shown, S400 includes:

[0077] S420: Determine the object types of multiple sub-objects of the target object in the initial form snapshot and the current form data.

[0078] S440: For each sub-object, based on the object type, detect whether the attribute data of the sub-object in the initial form snapshot and the current form data are consistent.

[0079] Here, let A and B be two objects in the category. If there is a monomorphism i: A→B, then A is called a subobject of B. Here, A can be the target object and B can be the subobject. When the target object is user A's information, the subobject can include user A's gender, user A's name, user A's address and other information; when the target object is user B's information, the subobject can include user B's gender, user B's name, user B's address and other information.

[0080] There is more than one object type. For example, the object type can be a formatted object type or an unformatted object type. The object type can also be a structured object type, etc.

[0081] Specifically, in the process of detecting whether the target attribute data of the target object in the initial form snapshot is consistent with that in the current form data, the target object has multiple sub-objects, each of which has a different type, and the means for detecting the attribute data of different types of sub-objects are also different. Therefore, based on the object type of each sub-object, a detection method matching the sub-object can be used to detect whether the attribute data of the sub-object in the initial form snapshot and the current form data are consistent.

[0082] In the above embodiment, based on the object type of each sub-object, a detection method that matches the sub-object is used to detect whether the attribute data of the sub-object in the initial form snapshot and the current form data are consistent. This can efficiently cope with any complex business scenarios, that is, there can be corresponding detection methods for any different scenarios, so that page data detection is accurate and reliable.

[0083] In one embodiment, the attribute data includes an attribute field and an attribute value of the attribute field;

[0084] Based on the object type, check whether the attribute data of the sub-objects in the initial form snapshot and the current form data are consistent, including:

[0085] When the object type is the first object type, it is detected whether the attribute values ​​of the sub-objects in the initial form snapshot and the current form data are consistent; or, it is detected whether the attribute fields and attribute values ​​of the sub-objects in the initial form snapshot and the current form data are consistent.

[0086] The first object type is a simple object type, that is, the structure of the sub-object corresponding to the first object type is relatively simple.

[0087] Specifically, taking JavaScript programming language as an example, for all sub-objects corresponding to the first object type in JavaScript, data detection can be performed on all sub-objects corresponding to the first object type by the following detection means:

[0088] The first is to detect whether the attribute values ​​of the sub-objects in the initial form snapshot and the current form data are consistent. When detecting data, the terminal also supports the configuration of judgment conditions. For example, "==" indicates whether the attribute values ​​of the sub-objects in the initial form snapshot and the current form data are consistent, and whether the attribute fields of the sub-objects in the initial form snapshot and the current form data are consistent are not detected.

[0089] The second type is to detect whether the attribute fields and attribute values ​​of the sub-objects in the initial form snapshot and the current form data are consistent. For example, "===" indicates whether the attribute fields and attribute values ​​of the sub-objects in the initial form snapshot and the current form data are consistent. Only when both are consistent, the initial form snapshot and the current form data are considered consistent.

[0090] Furthermore, detecting whether the attribute fields and attribute values ​​of the sub-objects in the initial form snapshot and the current form data are consistent is actually divided into two stages: the first stage is detecting whether the attribute fields of the sub-objects in the initial form snapshot and the current form data are consistent; and the second stage is detecting whether the attribute values ​​of the sub-objects in the initial form snapshot and the current form data are consistent. The two stages can be executed simultaneously or one after the other. For example, you can simultaneously detect whether the attribute fields and attribute values ​​of the sub-objects in the initial form snapshot and the current form data are consistent; for another example, you can first detect whether the attribute fields of the sub-objects in the initial form snapshot and the current form data are consistent, and if they are consistent, then detect whether the attribute values ​​of the sub-objects in the initial form snapshot and the current form data are consistent.

[0091] In one embodiment, the first object type includes, but is not limited to, the following object types:

[0092] 1. Number (numeric object type): for example, 5, 3.14, -11, etc.

[0093] 2. String (string object type): Enclose it in single or double quotes, such as: 'zhangsan', "hello".

[0094] 3. Boolean (Boolean object type): only two values, true and false.

[0095] 4. Null (null value object type): represents an empty object reference with only one value null.

[0096] 5. Undefined (undefined object type): When a variable is declared but not initialized, its value is undefined.

[0097] 6. Symbol (Symbol object type): A new, unique value type, usually used to create private properties of objects.

[0098] In the above embodiment, when the object type is a simple object type, the initial form snapshot and the current form data can be used to detect whether the attribute values ​​of the sub-objects are consistent; or the attribute fields and attribute values ​​of the sub-objects in the initial form snapshot and the current form data are detected to determine whether the attribute data of the sub-objects in the current form data are consistent, thereby improving the accuracy of page data detection. Furthermore, the present application treats business scenarios with special data types, such as values ​​of null, undefined, empty strings, empty objects, and empty arrays as the same type, providing support for extended adaptation capabilities, and developers do not need to add additional logic to the business code for processing.

[0099] In one embodiment, based on the object type, detecting whether the attribute data of the sub-object in the initial form snapshot and the current form data are consistent includes:

[0100] When the object type is the second object type, it is detected whether the root attribute field and the root attribute value in the initial form snapshot are consistent with those in the current form data.

[0101] The complexity of the first type is higher than that of the second type. The second object type can be regarded as a complex object type, for example, a structured object type. The root attribute field is a concept corresponding to the sub-attribute field. If several attribute fields are regarded as a tree, the root attribute field can be regarded as the upper-level attribute field of the sub-attribute field, and the sub-attribute field can be regarded as the lower-level attribute field of the root attribute field. The root attribute field and the sub-attribute field can be understood as a parent-child relationship.

[0102] Specifically, when the object type is a complex object type, all root attribute fields of the sub-objects in the initial form snapshot and the current form data are traversed to detect whether the root attribute fields of the sub-objects in the initial form snapshot and the current form data are consistent with the root attribute values ​​of the root attribute fields.

[0103] Further, detecting whether the root attribute fields and root attribute values of sub-objects in the initial form snapshot and the current form data are consistent actually involves two stages: The first stage is to detect whether the root attribute fields of sub-objects in the initial form snapshot and the current form data are consistent; and the second stage is to detect whether the root attribute values of sub-objects in the initial form snapshot and the current form data are consistent. The two stages can be executed synchronously or sequentially. For example, it is possible to simultaneously detect whether the root attribute fields and root attribute values of sub-objects in the initial form snapshot and the current form data are consistent; or, it is possible to first detect whether the root attribute fields of sub-objects in the initial form snapshot and the current form data are consistent, and if they are consistent, then detect whether the root attribute values of sub-objects in the initial form snapshot and the current form data are consistent.

[0104] In another embodiment, when the object type is the second object type, detecting whether the attribute data of sub-objects in the initial form snapshot and the current form data are consistent further includes: detecting whether the root attribute values of sub-objects in the initial form snapshot and the current form data are consistent.

[0105] In yet another embodiment, the second object type includes, but is not limited to, the following object types:

[0106] 1. Object: The most basic structured object type, enclosed in curly braces, with key-value pairs, for example: {name: "Zhang San", age: 18};

[0107] 2. Array: Used to store an ordered set of data, enclosed in square brackets, with each value separated by a comma, for example: [1, 2, 3];

[0108] 3. Date object: Used to handle dates and times, such as: new Date().

[0109] In the above embodiments, when the object type is the second object type, detecting whether the root attribute fields and root attribute values of sub-objects in the initial form snapshot and the current form data are consistent, and when there are multiple root attribute fields of sub-objects, detecting each root attribute field one by one improves the data detection ability of the terminal for complex object types, and only detecting the root attribute fields without detecting the sub-attribute fields of the root attribute fields can also improve the efficiency of page data detection.

[0110] In one embodiment, after detecting whether the root attribute fields and root attribute values in the initial form snapshot and the current form data are consistent, it further includes:

[0111] Detecting whether the sub-attribute fields of the root attribute fields and the sub-attribute values of the sub-attribute fields in the initial form snapshot and the current form data are consistent.

[0112] Specifically, when the object type is the second object type, detecting whether the root attribute field and the root attribute value in the initial form snapshot are consistent with those in the current form data can be regarded as shallow detection. The page data detection in the present application not only supports shallow detection, but also supports deep detection. Deep detection means not only detecting whether the root attribute field and the root attribute value in the initial form snapshot and the current form data are consistent, but also detecting whether the sub-attribute field and the sub-attribute value of the root attribute field in the initial form snapshot and the current form data are consistent.

[0113] In the above embodiment, not only is it detected whether the root attribute field and root attribute value in the initial form snapshot and the current form data are consistent, but also it is detected whether the sub-attribute field and sub-attribute value of the root attribute field in the initial form snapshot and the current form data are consistent. This enables a comprehensive detection of each attribute in the initial form snapshot and the current form data, thereby improving the accuracy of page data processing.

[0114] In one embodiment, when the object type is the second object type, the identifier of the initial form snapshot is user01 and the identifier of the current form data is user02, wherein;

[0115] var user01 = {

[0116] name: "zhangsan",

[0117] location: {

[0118] province: 'Guangdong Province',

[0119] city: 'Shenzhen'

[0120] }

[0121] };

[0122] var user02 = {

[0123] name: "lisi",

[0124] location: {

[0125] province: 'Guangdong Province',

[0126] city: 'Guangzhou'

[0127] }

[0128] };

[0129] Deep detection, that is, to detect whether the root attribute fields and root attribute values ​​of the sub-objects in the initial form snapshot and the current form data are consistent, and to detect whether the sub-attribute fields of the root attributes are consistent with the sub-attribute values ​​of the sub-attribute fields:

[0130] user01.name === user02.name

[0131] user01.location.province === user02.location.province

[0132] user01.location.city=== user02.location.city

[0133] In other words, deep detection will traverse all attributes in the initial form snapshot and the current form data, and detect them one by one to improve the accuracy of detection.

[0134] Shallow detection only detects whether the root attribute fields and root attribute values ​​of the child objects in the initial form snapshot and the current form data are consistent:

[0135] user01.name === user02.name

[0136] user01.location === user02.location

[0137] In other words, shallow detection only compares the root attribute fields and root attribute values ​​of the sub-objects in the initial form snapshot and the current form data, but does not compare the sub-attribute fields of the root attribute fields with the sub-attribute values ​​of the sub-attribute fields, in order to improve detection efficiency.

[0138] By configuring the terminal to perform data detection on the sub-object of the second object type in a deep detection or shallow detection manner, the flexibility of page data processing can be enhanced and the coupling degree of codes and performance consumption can be reduced.

[0139] In one embodiment, based on the object type, detecting whether the attribute data of the sub-object in the initial form snapshot and the current form data are consistent includes:

[0140] In the case where the object type is a formatted object type, the attribute data of the sub-object in the current form data is converted into the attribute data of the target format; and it is detected whether the attribute data of the sub-object in the current form data after the conversion is consistent with the attribute data of the sub-object in the initial form snapshot.

[0141] The target format is the data format of the attribute data of the child object in the initial form snapshot. The formatted object type refers to the data displayed on the front end and the data stored in the back end, which are presented in different formats. For example, taking gender as an example, the back end usually uses numbers to represent men and women, 1: male, 0: female, and the request data fed back to the front end by the back end is 1 or 0. If 1 or 0 is displayed between pages, users cannot understand it. At this time, formatting conversion is required to turn it into text that users can understand, such as male or female; for example, the date is fed back to the front end as a timestamp (such as: 5789514454114), and the front end page presents May 1, 2024 to the user.

[0142] Specifically, when the user modifies the data of the target page, what is modified is actually the data displayed on the foreground. In order to compare the data displayed on the foreground with the data snapshot stored in the background, it is necessary to convert the data format of the attribute data of the sub-object in the current form data to the data format of the attribute data of the sub-object in the initial form snapshot, so that the data is independent of the format. Then, it is detected whether the attribute data of the sub-object in the current form data after the conversion format is consistent with that in the initial form snapshot.

[0143] Furthermore, a sub-object can belong to both the formatted object type and the first object type, or both the formatted object type and the second object type. When the object type is the formatted object type, first determine whether the sub-object can also belong to the first object type or the second object type, and then automatically match the detection algorithm corresponding to the judgment result in the formatted data rule library according to the data presentation form. For example, for dates, the built-in date formatting detection algorithm can be used to compare the date data. For business-customized formatted data, the business is allowed to expand the corresponding detection algorithm by itself, and then compare the current form data of the target page with the latest form snapshot data.

[0144] In the above embodiment, when the format of the attribute data of a sub-object is inconsistent when displayed in the foreground and stored in the background, the format of the attribute data of the sub-object in the current form data can be automatically converted into the data format of the attribute data of the sub-object in the initial form snapshot, thereby improving the accuracy of subsequent detection of whether the attribute data of the sub-object in the current form data after the conversion format is consistent with the attribute data of the sub-object in the initial form snapshot.

[0145] In one embodiment, when the user triggers the opening and saving operations of the target page, the terminal collects the form snapshot data of the target page at that moment and stores it locally.

[0146] When the user triggers the closing operation of the target page, such as clicking the jump or return button, in order to reduce the possibility of page data loss, it is necessary to determine whether the form data in the target page has been modified. The specific page data processing methods include:

[0147] Filter static attribute data of the target object in the initial form snapshot and the current form data, and retain variable attribute data of the target object in the initial form snapshot and the current form data, such as variable attribute data related to user information;

[0148] Each target object includes several sub-objects, and the sub-objects may be of the same or different types. For example, a sub-object may be a simple object type, a complex object type, or a formatted object type. A sub-object may be a simple object type and a formatted object type, or a complex object type and a formatted object type.

[0149] In the case where the type of the sub-object is a simple object type, the attribute data of the sub-object includes attribute fields and attribute values ​​of the attribute fields. Check whether the attribute data of the sub-object in the initial form snapshot and the current form data are consistent, that is, check whether the attribute values ​​of the sub-object in the initial form snapshot and the current form data are consistent; or check whether the attribute fields and attribute values ​​of the sub-object in the initial form snapshot and the current form data are consistent.

[0150] In the case where the type of the sub-object is a complex object type, the attribute data of the sub-object includes a root attribute field, a root attribute value of the root attribute field, a sub-attribute field corresponding to the root attribute field, and a sub-attribute value of the sub-attribute field. There are two methods for detecting whether the attribute data of the sub-object in the initial form snapshot and the current form data are consistent. One is deep detection, that is, detecting whether the root attribute field and the root attribute value of the sub-object in the initial form snapshot and the current form data are consistent, and then detecting whether the sub-attribute field and the sub-attribute value of the root attribute field in the initial form snapshot and the current form data are consistent; the other is shallow detection, that is, only detecting whether the root attribute field and the root attribute value of the sub-object in the initial form snapshot and the current form data are consistent.

[0151] When the sub-object type is a formatted object type, such as date, gender, and other sub-objects, it is necessary to match the detection algorithm corresponding to the representation form according to the representation form of the sub-object. For example, the date detection algorithm is used to match the date. The detection algorithm is used to convert the data format of the attribute data of the sub-object in the current form data to the data format of the attribute data of the sub-object in the initial form snapshot. Then, it is detected whether the attribute data of the sub-object in the current form data after the conversion format is consistent with that in the initial form snapshot.

[0152] Finally, when it is detected that the target attribute data in the form snapshot data is inconsistent with the target attribute data in the current form data, a form data saving confirmation message is pushed to enable the user to confirm saving the form data.

[0153] The above page data processing method is an algorithm component independently developed based on pure JavaScript syntax. It does not rely on any front-end framework or component library, can be seamlessly connected with the task technology stack or front-end framework, and has strong compatibility.

[0154] Specifically, the page data processing method of the present application allows the specification of fields that do not need to be detected, whether to enable deep detection, etc., and has very flexible configuration capability support, which can reduce the coupling degree of code and performance consumption, and there is no need to detect the table changes of form data in real time, only the access detection is required at the page exit point; it can efficiently cope with any complex business scenarios, such as: nested forms, multi-level data structures, formatted data types, etc., and the accuracy of algorithm detection is accurate and reliable; for the formatting processing of special data, it also supports expansion in the general configuration to enhance the accuracy of data comparison, and no special processing is required in the business code, and the code coupling is low.

[0155] It should be understood that, although the steps in the flowcharts involved in the above embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps is not strictly limited in order, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above embodiments may include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.

[0156] Based on the same inventive concept, the embodiment of the present application also provides a page data processing device for implementing the page data processing method involved above. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above method, so the specific limitations in one or more embodiments of the page data processing device provided below can refer to the limitations of the page data processing method above, and will not be repeated here.

[0157] In an exemplary embodiment, Figure 4 As shown, a page data processing device 800 is provided, comprising: an acquisition module 200, a detection module 400 and a push module 600, wherein:

[0158] The acquisition module 200 is used to respond to the closing operation on the target page and acquire the current form data and the latest form snapshot data of the target page;

[0159] A detection module 400 is used to detect whether the target attribute data of the target object in the initial form snapshot is consistent with the target attribute data in the current form data, and the target attribute data is variable data;

[0160] The push module 600 is used to push a form data saving confirmation message when it is detected that the form snapshot data is inconsistent with the target attribute data in the current form data.

[0161] In one embodiment, the detection module 400 is also used to determine the object types of multiple sub-objects of the target object in the initial form snapshot and the current form data; for each sub-object, based on the object type, detect whether the attribute data of the sub-object in the initial form snapshot and the current form data are consistent.

[0162] In one embodiment, the attribute data includes attribute fields and attribute values ​​of the attribute fields; the detection module 400 is also used to detect whether the attribute values ​​of the sub-objects in the initial form snapshot and the current form data are consistent when the object type is the first object type; or, to detect whether the attribute fields and attribute values ​​of the sub-objects in the initial form snapshot and the current form data are consistent.

[0163] In one embodiment, the detection module 400 is also used to detect whether the root attribute fields and root attribute values ​​of the sub-objects in the initial form snapshot and the current form data are consistent when the object type is the second object type, and the complexity of the first type is higher than the complexity of the second type.

[0164] In one embodiment, the detection module 400 is further used to detect whether the sub-attribute field and the sub-attribute value of the sub-attribute field of the root attribute field in the initial form snapshot and the current form data are consistent.

[0165] In one of the embodiments, the detection module 400 is also used to convert the attribute data of the sub-object in the current form data into the attribute data of the target format when the object type is a formatted object type, and the target format is the data format of the attribute data of the sub-object in the initial form snapshot; and detect whether the attribute data of the sub-object in the current form data after the conversion is consistent with the attribute data of the sub-object in the initial form snapshot.

[0166] Each module in the above-mentioned page data processing device can be implemented in whole or in part by software, hardware or a combination thereof. Each module can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute the operations corresponding to each module above.

[0167] In an exemplary embodiment, a computer device is provided. The computer device may be a terminal, and its internal structure diagram may be as shown in FIG. Figure 5 As shown. The computer device includes a processor, a memory, an input / output interface, a communication interface, a display unit and an input device. The processor, the memory and the input / output interface are connected through a system bus, and the communication interface, the display unit and the input device are connected to the system bus through the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The input / output interface of the computer device is used to exchange information between the processor and the external device. The communication interface of the computer device is used to communicate with an external terminal in a wired or wireless manner, and the wireless manner can be implemented through WIFI, a mobile cellular network, near field communication (NFC) or other technologies. When the computer program is executed by the processor, a page data processing method is implemented. The display unit of the computer device is used to form a visually visible picture, which can be a display screen, a projection device or a virtual reality imaging device. The display screen can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device can be a touch layer covering the display screen, or a button, trackball or touchpad set on the computer device shell, or an external keyboard, touchpad or mouse.

[0168] Those skilled in the art will understand that Figure 5 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0169] In one embodiment, a computer device is further provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the steps in the above method embodiments when executing the computer program.

[0170] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps in the above-mentioned method embodiments are implemented.

[0171] In one embodiment, a computer program product is provided, including a computer program, which implements the steps in the above method embodiments when executed by a processor.

[0172] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant regulations.

[0173] A person of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment method can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile memory and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, an artificial intelligence (AI) processor, etc., but are not limited to this.

[0174] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this application.

[0175] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.

Claims

1. A page data processing method, characterized in that: The method comprises: In response to a close operation on a target page, obtaining current form data and the latest form snapshot data of the target page; Detecting whether the initial form snapshot is consistent with target attribute data of the target object in the current form data, wherein the target attribute data is variable data; When it is detected that the form snapshot data is inconsistent with the target attribute data in the current form data, a form data saving confirmation message is pushed.

2. The method according to claim 1, characterized in that The detecting whether the target attribute data of the target object in the initial form snapshot is consistent with that in the current form data includes: Determine object types of multiple sub-objects of a target object in the initial form snapshot and the current form data; For each of the sub-objects, based on the object type, it is detected whether the attribute data of the sub-object in the initial form snapshot is consistent with that in the current form data.

3. The method according to claim 2, characterized in that The attribute data includes an attribute field and an attribute value of the attribute field; The detecting, based on the object type, whether the attribute data of the sub-object in the initial form snapshot and the current form data are consistent includes: In the case where the object type is the first object type, detecting whether the attribute values ​​of the sub-object in the initial form snapshot and the current form data are consistent; Alternatively, it is detected whether the attribute fields and attribute values ​​of the sub-object in the initial form snapshot and the current form data are consistent.

4. The method according to claim 3, characterized in that The detecting, based on the object type, whether the attribute data of the sub-object in the initial form snapshot and the current form data are consistent includes: When the object type is the second object type, it is detected whether the root attribute fields and root attribute values ​​of the sub-objects in the initial form snapshot and the current form data are consistent, and the complexity of the first type is higher than that of the second type.

5. The method according to claim 4, characterized in that After detecting whether the root attribute fields and root attribute values ​​of the sub-objects in the initial form snapshot and the current form data are consistent, the method further includes: It is detected whether the sub-attribute field of the root attribute field and the sub-attribute value of the sub-attribute field in the initial form snapshot and the current form data are consistent.

6. The method according to claim 2, characterized in that The detecting, based on the object type, whether the attribute data of the sub-object in the initial form snapshot and the current form data are consistent includes: In the case where the object type is a formatted object type, converting the attribute data of the sub-object in the current form data into attribute data in a target format, wherein the target format is the data format of the attribute data of the sub-object in the initial form snapshot; It is detected whether the attribute data of the sub-object in the initial form snapshot and the current form data after the format conversion are consistent.

7. A page data processing device, characterized in that: The device comprises: An acquisition module, used for responding to a closing operation on a target page, acquiring current form data and the latest form snapshot data of the target page; A detection module, used to detect whether the initial form snapshot is consistent with target attribute data of the target object in the current form data, wherein the target attribute data is variable data; The push module is used to push a form data saving confirmation message when it is detected that the form snapshot data is inconsistent with the target attribute data in the current form data.

8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 6 are implemented.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.

10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.