Page display method, device, apparatus and readable storage medium
By calculating the position offset of the displayed objects in the data list and refreshing accordingly, the content offset problem caused by dynamic refresh of multi-data source lists is solved, thus improving the user experience.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- BEIJING ZITIAO NETWORK TECH CO LTD
- Filing Date
- 2022-09-02
- Publication Date
- 2026-07-31
AI Technical Summary
Existing technologies struggle to support dynamic refresh of multiple data source lists, causing content to shift position when users view the page, thus impacting user experience.
By determining the preset sorting rules between the first and second display objects, the position offset is calculated, and the data list is refreshed using this offset to keep the display position of the first display object unchanged.
During the dynamic refresh of the data list, the content remains visually static for the user, thus improving the user experience.
Smart Images

Figure CN117687726B_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of computer processing technology, and specifically to a page display method, apparatus, device, and readable storage medium. Background Technology
[0002] During application development, many data list requests are involved. Typically, a data list may have multiple data sources, meaning data is obtained from multiple network request interfaces to form a data list. Then, each piece of data in the data list is rendered to be displayed in the application for users to browse or view. Summary of the Invention
[0003] This disclosure provides a page display method, apparatus, device, and readable storage medium to solve the problem that current processing methods are unable to support dynamic refreshing of multiple data source lists, thus affecting users' page viewing experience.
[0004] According to a first aspect, embodiments of this disclosure provide a page display method, comprising: displaying a first display object on a display page; obtaining a data list corresponding to the display page, wherein a rendered screen corresponding to the data list includes first data information corresponding to the first display object; when loading second data information corresponding to a second display object to be rendered into the data list, determining the loading position of the second data information based on a preset sorting rule between the first display object and the second display object, wherein the data sources of the first data information and the second data information are different; determining a position offset of the first display object in the rendered screen corresponding to the data list based on the loading position; and refreshing the display page according to the position offset and the second display object, so that the display position of the first display object in the display page remains unchanged.
[0005] The page display method provided in this disclosure, when loading second data information corresponding to a second display object to be rendered into a data list, determines the loading position of the second data information in the data list through a preset sorting rule between the first and second display objects. Then, based on this loading position, it determines the position offset of the first display object and refreshes the data list using the position offset and the second data information. In other words, it refreshes the display page corresponding to the data list using the position offset and the second display object, ensuring that the display position of the first display object remains unchanged in the current display page. This avoids the problem of the first display object's position changing on the display page due to loading the second display object, ensuring that the content on the corresponding display page remains visually static during the dynamic refresh of the data list, thereby improving the user's viewing experience.
[0006] In conjunction with the first aspect, in a first embodiment of the first aspect, when loading second data information corresponding to a second display object to be rendered into the data list, determining the loading position of the second data information based on a preset sorting rule between the first display object and the second display object includes: obtaining a first sorting value of the first data information corresponding to the first display object in the data list, and a second sorting value of the second data information corresponding to the second display object in the data list; comparing the first sorting value and the second sorting value, and determining the loading position of the second data information corresponding to the second display object in the data list based on the preset sorting rule.
[0007] The page display method provided in this disclosure determines the loading position of the second data information corresponding to the second display object in the data list by comparing the first sorting value and the second sorting value. This enables the display object to be loaded into the data list according to the preset sorting rules, thereby realizing the real-time updating of the display page corresponding to the data list.
[0008] In conjunction with the first embodiment of the first aspect, in the second embodiment of the first aspect, the preset sorting rule is priority sorting, and the step of comparing the first sorting value and the second sorting value and determining the loading position of the second data information based on the preset sorting rule includes: when the first sorting value is less than the second sorting value, loading the second data information before the first data information; or, when the first sorting value is greater than or equal to the second sorting value, loading the second data information after the first data information.
[0009] The page display method provided in this disclosure determines the order of data information corresponding to each display object in the data list according to the priority of different display objects, thereby realizing the insertion of data information according to the order of arrangement, avoiding disorder of data information insertion logic, and facilitating dynamic updating of the data list.
[0010] In conjunction with the first aspect, or the first or second embodiment of the first aspect, in the third embodiment of the first aspect, the method further includes: obtaining a first network request interface pointing to the first data information and a second network request interface pointing to the second data information, wherein the first network request interface and the second network request interface correspond to different identification information; determining a first data processing method for the first data returned by the first network request interface and a second data processing method for the second data returned by the second network request interface based on the mapping relationship between the identification information and the data processing method; performing serialization processing on the first data based on the first data processing method to obtain first serialized data, wherein the first serialized data includes first data information corresponding to the first display object; performing serialization processing on the second data based on the second data processing method to obtain second serialized data, wherein the second serialized data includes second data information corresponding to the second display object.
[0011] The page display method provided in this disclosure performs corresponding data processing on the data returned by different network request interfaces, which facilitates asynchronous processing of the data returned by different network request interfaces, realizes data convergence from multiple data sources, and facilitates dynamic adjustment of the data list and dynamic updating of data information.
[0012] In conjunction with the third embodiment of the first aspect, in the fifth embodiment of the first aspect, the method further includes: setting a priority identifier in the first serialized data and the second serialized data.
[0013] The page display method provided in this embodiment obtains serialized data and sets priority identifiers for different serialized data in the serialized data, so as to facilitate the determination of the display order of each data in the data list according to the priority identifiers.
[0014] In conjunction with the fourth embodiment of the first aspect, in the sixth embodiment of the first aspect, the method further includes: storing the first serialized data and the second serialized data in a target queue, the target queue being used to load the first data information and / or the second data information into the data list.
[0015] The page display method provided in this disclosure stores the processed serialized data in a target queue, which facilitates the insertion of data information obtained from processing each data source into a data list according to the response time.
[0016] In conjunction with the first aspect, in the sixth embodiment of the first aspect, refreshing the display page according to the position offset and the second display object includes: determining the second data information corresponding to the second display object loaded into the data list; rendering the data list loaded with the second data information; and refreshing the display page according to the position offset.
[0017] The page display method provided in this embodiment renders a data list using second data information and position offset, and while refreshing the display page in real time with the rendered second display object, ensures that the display position of the current display object on the display page remains unchanged.
[0018] In conjunction with the sixth embodiment of the first aspect, in the seventh embodiment of the first aspect, rendering the data list loaded with the second data information and refreshing the display page according to the position offset includes: obtaining the offset direction corresponding to the position offset; sliding the rendered screen corresponding to the data list by a preset distance in the opposite direction of the offset direction, wherein the preset distance is equal to the position offset.
[0019] The page display method provided in this embodiment inserts second data information into the data list, and then slides the rendering screen corresponding to the data list in the opposite direction of the offset direction by a preset distance, and the preset distance is equal to the position offset, so that the position of the first display object in the display page remains unchanged, thereby ensuring that the display content in the current display page remains unchanged and realizing the real-time dynamic refresh of the data list corresponding to the display page.
[0020] According to a second aspect, embodiments of this disclosure provide a page display device, comprising: a display module for displaying a first display object on a display page; a data acquisition module for acquiring a data list corresponding to the display page, wherein a rendered screen corresponding to the data list includes first data information corresponding to the first display object; a dynamic calculation module for determining the loading position of the second data information based on a preset sorting rule between the first display object and the second display object when loading second data information corresponding to a second display object to be rendered into the data list, wherein the data sources of the first data information and the second data information are different; an offset determination module for determining a position offset of the first display object in the rendered screen corresponding to the data list based on the loading position; and a refresh module for refreshing the display page according to the position offset and the second display object, so that the display position of the first display object in the display page remains unchanged.
[0021] In conjunction with the second aspect, in the first embodiment of the second aspect, the apparatus further includes: a network request module, configured to acquire a first network request interface pointing to the first data information and a second network request interface pointing to the second data information; an interface distribution module, configured to receive first data returned by the first network request interface and second data returned by the second network request interface; and to distribute the first data and the second data to corresponding data processing modules according to the identification information corresponding to the first network request interface and the second network request interface; and a data processing module, configured to receive the first data or the second data, and to perform serialization processing on the first data or the second data to obtain first serialized data corresponding to the first data, or second serialized data corresponding to the second data; wherein the first serialized data includes first data information corresponding to the first display object, and the second serialized data includes second data information corresponding to the second display object.
[0022] According to a third aspect, this disclosure provides an electronic device, including: a memory and a processor, the memory and the processor being communicatively connected to each other, the memory storing computer instructions, and the processor executing the computer instructions to perform the page display method described in the first aspect or any embodiment of the first aspect.
[0023] According to a fourth aspect, embodiments of this disclosure provide a computer-readable storage medium storing computer instructions for causing a computer to perform the page display method described in the first aspect or any embodiment of the first aspect.
[0024] It should be noted that the beneficial effects of the page display device, electronic device, and computer-readable storage medium provided in the embodiments of this disclosure can be found in the description of the corresponding content in the page display method, and will not be repeated here. Attached Figure Description
[0025] To more clearly illustrate the technical solutions in the specific embodiments of this disclosure or the prior art, the drawings used in the description of the specific embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this disclosure. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.
[0026] Figure 1 A schematic diagram of the application code architecture in an embodiment of this disclosure is shown;
[0027] Figure 2 This is a flowchart of a page display method according to an embodiment of the present disclosure;
[0028] Figure 3 This is another flowchart of a page display method according to an embodiment of the present disclosure;
[0029] Figure 4 This is yet another flowchart of a page display method according to an embodiment of the present disclosure;
[0030] Figure 5 This is a schematic diagram illustrating the insertion of second data information into a data list according to an embodiment of this disclosure;
[0031] Figure 6 This is a schematic diagram illustrating the sorting of different data information in a data list according to an embodiment of this disclosure;
[0032] Figure 7 This is a schematic diagram illustrating the loading of second data information according to an embodiment of this disclosure;
[0033] Figure 8 This is a structural block diagram of a page display device according to an embodiment of the present disclosure;
[0034] Figure 9 This is a schematic diagram of the hardware structure of the electronic device provided in the embodiments of this disclosure. Detailed Implementation
[0035] To make the objectives, technical solutions, and advantages of the embodiments of this disclosure clearer, the technical solutions of the embodiments of this disclosure will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this disclosure, and not all embodiments. Based on the embodiments of this disclosure, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this disclosure.
[0036] Currently, for requests involving multiple data source lists in an application process, due to inconsistencies in data formats, response times, and display order of different network requests, as well as dynamic changes in data, the dynamic refresh method of multiple data source lists can cause the position of the content displayed on the currently displayed page to shift when loading higher-priority page objects. In other words, the position of the page that the user is currently viewing will shift, which seriously affects the user experience.
[0037] To address the issue of dynamically refreshing lists from multiple data sources, there are currently three main approaches:
[0038] 1) Reduce the number of data sources and try to send data from a single network request interface. Since the complexity of data processing and display logic from multiple data sources increases with the number of data sources, the most direct solution is to reduce the number of network requests. However, this solution only mitigates the impact of the problem; it does not fundamentally solve the problem of dynamically refreshing a list of multiple data sources.
[0039] 2) Perform unified data processing after all network request interfaces return data. When data in the data list needs to send data requests to multiple network request interfaces, wait for all network request interfaces to respond and return data before performing unified data processing and data display sorting. Although this method can greatly reduce system complexity, the inconsistent response time and latency of each network request interface may increase the overall data loading time of the data list due to the "weakest link" effect, thus deteriorating the user experience.
[0040] 3) Process the data returned by each network request interface separately, and then refresh the list according to a predetermined sorting. Whenever a network request interface returns data, the received data is processed, the data list is refreshed, and then rendered and displayed. The data will be sorted according to a pre-agreed order, for example, the last returned data is loaded at the end of the data list. While this method is feasible for handling lists from multiple data sources, in some scenarios, the position of data returned by a network request may not be fixed; its position may dynamically change depending on user actions. Furthermore, reprocessing the data and refreshing the data list every time a network request interface returns results in list jumps, severely impacting the user experience.
[0041] Based on this, the technical solution disclosed herein calculates the position offset of the displayed objects caused by the insertion of new data into the data list when loading new data. This position offset is then used to refresh and adjust the data list to ensure that the display position of existing data in the data list remains unchanged on the current display page during the loading of new data. This avoids changes in the display position of the objects corresponding to existing data in the data list due to the loading of new data, thus ensuring that the content on the display page remains visually static during dynamic refresh of the data list, improving the user experience.
[0042] Based on the page display method proposed in this disclosure, for applications in electronic devices, embodiments of this disclosure provide an application code architecture, specifically, as follows: Figure 1As shown, the application's code architecture is divided into a network request management module, an interface distribution module, an interface data processing module, a dynamic sequence calculation module, and a real-time list refresh module, and each module is logically independent of the others.
[0043] The network request management module is primarily used to manage network request interfaces from different data sources. Since the multi-data source list involves multiple network request interfaces, this module provides unified management of the timing and status of network requests. It's important to note that network request interfaces in the multi-data source list need to be registered in the network request management module. This module then binds these interfaces to the data list, facilitating the subsequent loading of data returned by the network request interfaces into the data list.
[0044] The interface distribution module is mainly used to distribute the data returned by different network request interfaces to different data processing modules. Since the data formats returned by different network request interfaces may be inconsistent, and their required data processing logic may also be different, the interface distribution module is used to match different network request interfaces with their corresponding data processing modules, so as to separate the data processing process returned by different network request interfaces and avoid the data processing logic from becoming disordered.
[0045] The interface data processing module is primarily used to serialize the data sent from the network request interface and map it into a data format specified in the data list. Simultaneously, to determine the final sorting of data from each data source within the data list, priority markers can be added to different data items to represent their order in the list, allowing for flexible adjustment of the order of data returned by different network request interfaces.
[0046] The dynamic order calculation module can sort and refresh the data in the data list based on the asynchronous data processing results returned by different data processing modules. This sorting result is determined by the priority identifier in the data format. The insertion of new data may cause existing data in the data list to shift, potentially pushing the displayed content (i.e., the content rendered from the data in the data list) off the screen. To address this, the dynamic order calculation module calculates the positional offset after inserting new data and automatically scrolls the data list to keep the displayed page visually static, preventing sudden changes in the screen.
[0047] The real-time refresh module can dynamically adjust and update the data list based on the position offset of the displayed objects caused by the insertion of new data.
[0048] According to an embodiment of this disclosure, an embodiment of a page display method is provided. It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions. Furthermore, although a logical order is shown in the flowchart, in some cases, the steps shown or described may be executed in a different order than that shown here.
[0049] This embodiment provides a page display method that can be used in electronic devices such as mobile phones, tablets, and computers. The electronic devices have applications with the above-mentioned code architecture, which improves the user experience of the applications. Figure 2 This is a flowchart of a page display method according to an embodiment of the present disclosure, such as... Figure 2 As shown, the flowchart includes the following steps:
[0050] S11, Display the first object on the display page.
[0051] The display page is the page on which the screen of an electronic device can display content, through which users view or browse content of interest. The primary display object represents the content currently displayed on the display page, that is, the content of interest that the user is currently viewing or browsing.
[0052] Specifically, when a user opens the display page of an application to browse content, they can find content of interest by swiping the display page or using the application's "search" function. Correspondingly, the electronic device can respond to the user's operation and display the first object on the display page.
[0053] S12, obtain the data list corresponding to the display page, the rendering screen corresponding to the data list includes the first data information corresponding to the first display object.
[0054] The data list is a multi-data source list, containing data returned by different network request interfaces. The first data information corresponding to the first displayed object is any data from a specific data source in the data list, such as... Figure 4 As shown.
[0055] The content displayed on the page is one or more data items from the data list.
[0056] S13, when loading the second data information corresponding to the second display object to be rendered into the data list, the loading position of the second data information is determined based on the preset sorting rules between the first display object and the second display object, wherein the data sources of the first data information and the second data information are different.
[0057] The preset sorting rule is the order in which different display objects are displayed on the display page, that is, the loading order of data information from different data sources in the data list. The second data information corresponding to the second display object has a different data source than the first data information corresponding to the first display object, and the second data information is loaded into the data list later than the first data information.
[0058] When the first display object is displayed on the display page of the electronic device, if the interface data processing module completes data processing, returns the second data information corresponding to the second display object, and loads the second data information into the data list, the dynamic order calculation module can determine the display order of the first display object and the second display object on the display page according to the preset sorting rules, and then determine the loading position of the second data information in the data list according to the display order.
[0059] S14, determine the position offset of the first display object in the rendering screen corresponding to the data list based on the loading position.
[0060] The position offset represents the offset caused by the movement of the first data information already existing in the data list. After the second data information is inserted into the data list, the first data information already existing in the data list will be offset by a certain amount, and correspondingly, the first display object will also be offset by a certain amount in the display page. At this time, the dynamic sequence calculation module can calculate the position offset of the first data information in the data list based on the loading position of the second data information. This position offset is the position offset of the first display object in the rendering screen corresponding to the data list.
[0061] like Figure 5 Taking the data list shown as an example, when inserting second data information into the data list... Figure 5 After (represented by dashed lines), the first data information ( Figure 5 (Represented by a bold solid line) will be squeezed downwards, and the distance the first data information moves downwards is the position offset of the first display object in the rendered screen.
[0062] It should be noted that this position offset can be determined based on the position of the second display object on the display page obtained by rendering the second data information. That is, the determination of the position offset depends on the screen size of the current electronic device.
[0063] S15, refresh the display page according to the position offset and the second display object, so that the display position of the first display object in the display page remains unchanged.
[0064] After the second data information corresponding to the second display object is inserted into the data list, the original display content (i.e. the first display object) on the electronic device display page will be squeezed out of the current display page, which seriously affects the user experience.
[0065] To ensure the smooth insertion of the second data information, the real-time refresh module scrolls the data list according to the position offset during the refresh process, so that the position of the first display object obtained by rendering the first data information remains unchanged on the display page, that is, the page remains static in the user's eyes. Thus, the user's viewing experience is guaranteed while refreshing the data list.
[0066] This example illustrates inserting a recommendation card into the video stream on the Friends page. The video stream and the recommendation card originate from different data sources. The multiple video data points corresponding to the video stream are displayed as a data list. When a recommendation card (such as a push card or prop card) is inserted into the video stream on the Friends page, the insertion of the recommendation card may cause the video stream data in the data list to shift, resulting in the video being pushed off the current page from the user's screen.
[0067] Using the above page display method, when inserting a recommendation card, the positional offset of the existing video stream in the data list caused by the insertion of the recommendation card is calculated. The data list is scrolled according to the positional offset to compensate for the offset of the video currently displayed on the terminal device screen, ensuring that the video seen by the user on the terminal device screen does not change, that is, ensuring that the page remains static in the user's vision.
[0068] This example illustrates inserting a mini-program into a friend's Moments feed. Friend's Moments feed and the mini-program use data from different sources, and different friend's Moments feeds are displayed as a data list based on their posting time. When a mini-program is inserted into multiple Moments feeds, the insertion may cause the friend's Moments data in the data list to shift, resulting in a particular friend's Moments feed being pushed off the current page when viewed by the user.
[0069] Using the above page display method, when inserting a mini-program, the positional offset of the friend activity data in the data list caused by the insertion of the mini-program is calculated. The data list is scrolled according to the positional offset to compensate for the offset of the friend activity displayed on the current terminal device screen, ensuring that the friend activity seen by the user on the terminal device screen does not change, that is, ensuring that the page remains static in the user's vision.
[0070] The page display method provided in this embodiment, when loading the second data information corresponding to the second display object to be rendered into the data list, determines the loading position of the second data information in the data list through a preset sorting rule between the first and second display objects. Then, based on this loading position, it determines the position offset of the first display object and refreshes the data list using the position offset and the second data information. In other words, it refreshes the display page corresponding to the data list using the position offset and the second display object to ensure that the display position of the first display object remains unchanged in the current display page. This avoids the problem of the first display object's position changing on the display page due to loading the second display object, ensuring that the content on the corresponding display page remains visually static during the dynamic refresh of the data list, thereby improving the user's viewing experience.
[0071] This embodiment provides a page display method that can be used in electronic devices such as mobile phones, tablets, and computers. The electronic devices have applications with the above-mentioned code architecture, which improves the user experience of the applications. Figure 3 This is a flowchart of a page display method according to an embodiment of the present disclosure, such as... Figure 3 As shown, the flowchart includes the following steps:
[0072] S21, the first display object is displayed on the display page. For detailed explanation, please refer to the relevant descriptions in the above embodiments; they will not be repeated here.
[0073] S22, obtain the data list corresponding to the display page. The rendering screen corresponding to this data list includes the first data information corresponding to the first display object. For detailed explanation, please refer to the relevant descriptions in the above embodiments, which will not be repeated here.
[0074] S23, when loading the second data information corresponding to the second display object to be rendered into the data list, the loading position of the second data information is determined based on the preset sorting rules between the first and second display objects. The data sources for the first and second data information are different.
[0075] Specifically, step S23 above may include:
[0076] S231, obtain the first sort value of the first data information corresponding to the first display object in the data list, and the second sort value of the second data information corresponding to the second display object in the data list.
[0077] The first sorting value indicates the loading position of the first piece of data in the data list, and the second sorting value indicates the loading position of the second piece of data in the data list. The loading positions of different pieces of data in the data list determine the display positions of the different display objects obtained from rendering the data on the display page. Both the first and second sorting values are pre-defined data display orders from different data sources; they are not specifically limited here and can be determined according to actual needs.
[0078] Different data from the same data source correspond to their respective sort values, which may be the same or different. Specifically, for example... Figure 6 The data list shown contains multiple data entries from the same data source (solid and dashed lines represent different data sources), and different data entries have corresponding sorting values. Figure 6 The sorting values a, b, c, d, and e are shown in descending order. For data with the same sorting value, their order in the data list can be determined according to actual needs.
[0079] S232, compare the first sort value and the second sort value, and determine the loading position of the second data information corresponding to the second display object in the data list based on the preset sorting rules.
[0080] By comparing the size relationship between the first sort value and the second sort value, the loading position of the second data information in the data list can be determined.
[0081] Optionally, the preset sorting rule can be priority sorting. Accordingly, the first sorting value represents the loading priority of the first data information, and the second sorting value represents the loading priority of the second data information. That is, the first sorting value and the second sorting value respectively represent the display priority of the first display object and the second display object on the display page. Accordingly, step S232 above can include:
[0082] (1) When the first sort value is less than the second sort value, the second data information is loaded in front of the first data information.
[0083] When the first sorting value is less than the second sorting value, it means that the display priority of the first display object is lower than that of the second display object. At this time, the second data information corresponding to the second display object is loaded before the first data information corresponding to the first display object, that is, the second data information is inserted in front of the first data information in the data list.
[0084] (2) When the first sort value is greater than or equal to the second sort value, the second data information is loaded after the first data information.
[0085] When the first sorting value is greater than or equal to the second sorting value, it means that the display priority of the first display object is greater than or equal to the display priority of the second display object. At this time, the second data information corresponding to the second display object is loaded after the first data information corresponding to the first display object, that is, the second data information is inserted after the first data information in the data list.
[0086] Specifically, such as Figure 7 As shown, the first data information corresponding to the first displayed object is represented by a bold solid line, and the second data information corresponding to the second displayed object is represented by a dashed line. If the data list stores multiple data entries from different data sources from top to bottom, when the first sorting value (i.e., sorting value d) is less than the second sorting value (i.e., sorting value c), the second data information is inserted above the first data information; when the first sorting value (i.e., sorting value d) is greater than or equal to the second sorting value (i.e., sorting value c), the second data information is inserted below the first data information. If the data list stores multiple data entries from different data sources from left to right, when the first sorting value is less than the second sorting value, the second data information is inserted to the left of the first data information; when the first sorting value is greater than or equal to the second sorting value, the second data information is inserted to the right of the first data information. Of course, the data list can also be in other forms. The form of the data list is not limited here, as long as the second data information is inserted before or after the first data information according to the preset sorting rules.
[0087] As an optional implementation, the above page display method may further include:
[0088] 1) Obtain the first network request interface pointing to the first data information and the second network request interface pointing to the second data information.
[0089] The first network request interface and the second network request interface each correspond to different identification information.
[0090] As mentioned above, each data item in the data list requires a network request interface, which must be registered in the network request management unit. The network request management unit then associates and binds each network request interface with the data list. Different network request interfaces correspond to different identifiers, which are unique identifiers for the network request interfaces and can be represented by a string.
[0091] When a user uses an application (APP) on an electronic device, the application (APP) can obtain the first network request interface corresponding to the first data information and the second network request interface corresponding to the second data information, so as to obtain the relevant data of the first data information from the first network request interface and the relevant data of the second data information from the second network request interface.
[0092] 2) Based on the mapping relationship between identification information and data processing method, determine the first data processing method of the first data returned by the first network request interface and the second data processing method of the second data returned by the second network request interface.
[0093] Different network request interfaces return data in different formats, and their data processing methods also differ. Data returned by different network request interfaces is input to different interface data processing modules for corresponding data processing.
[0094] Specifically, different interface data processing modules have different identifiers. A mapping relationship is established between the identification information of the network request interface and the identifier of the interface data processing module. For example, an information lookup table is generated through the mapping relationship between the identification information of the network request interface and the identifier of the interface data processing module. The lookup table stores the correspondence between the network request interface and the interface data processing module.
[0095] After obtaining the data returned by the network request interface, the interface data processing module corresponding to the network request interface can be determined by scanning the information lookup table. That is, the first data processing method corresponding to the first data returned by the first network request interface can be determined based on the identification information of the first network request interface. At the same time, the second data processing method corresponding to the second data returned by the second network request interface can be determined based on the identification information of the second network request interface.
[0096] 3) The first data is serialized based on the first data processing method to obtain the first serialized data, which includes the first data information corresponding to the first display object.
[0097] The first data returned by the first network interface is serialized according to the first data processing method, decomposing the first data into a byte stream for easier storage and transmission. Simultaneously, the data format of the first data is converted to the data format specified by the data list, thus obtaining the first serialized data containing the first data information. The data format specified by the data list is determined according to actual needs and is not specifically limited here.
[0098] For example, when converting between different data types, if the data in the data list is of string type and the first data returned by the first network request interface is of integer type int, then a conversion between integer and string type is required. Those skilled in the art will understand the methods for converting between different data types, and will not elaborate further here.
[0099] 4) The second data is serialized based on the second data processing method to obtain second serialized data, which includes the second data information corresponding to the second display object.
[0100] The processing of the second data is similar to that of the first data, as detailed in step (3) above, and will not be repeated here.
[0101] The system performs corresponding data processing on the data returned by different network request interfaces, which facilitates asynchronous processing of data returned by different network request interfaces, enabling data convergence from multiple data sources and facilitating dynamic adjustment of data lists and dynamic updating of data information.
[0102] While outputting the first serialized data and the second serialized data, a priority flag is set in the first serialized data and the second serialized data.
[0103] To determine the order of the first and second serialized data in the data list, the data returned by different network request interfaces includes data priorities, which indicate the order of different data information in the data list. Similarly, a priority field can be set in the data format specified in the data list. When the interface data processing module processes the data returned by the network request interface, it serializes the data carrying priorities in a uniform format, thereby marking the priority in the serialized data. This facilitates flexible adjustment of the order of data returned by different network request interfaces in the data list.
[0104] To facilitate the insertion of data from different data sources into the data list according to response time, after obtaining the first serialized data and the second serialized data, the first serialized data and the second serialized data are stored in a target queue, which is used to load the first data information and / or the second data information into the data list.
[0105] The target queue stores serialized data corresponding to different network request interfaces. Different interface data processing modules asynchronously return their processed serialized data and store it in the target queue. Since the processing efficiency of different interface data processing modules is different, that is, the processing time of the first and second serialized data is inconsistent, the first and second serialized data can be stored in the target queue according to the data processing time, that is, the serialized data that is processed first is stored first.
[0106] Optionally, the target queue can be a first-in-first-out (FIFO) queue. Since the serialized data returned by different interface data processing modules are asynchronous, different serialized data can be enqueued, that is, the serialized data that is processed first is inserted into the FIFO queue.
[0107] Accordingly, when data exists in the data queue, the data at the head of the queue is retrieved according to the first-in-first-out (FIFO) rule. This retrieved data is then compared in priority with the first or second data already present in the current data list. The order of priority determines the loading position of the data at the head of the queue into the data list. If the data list is empty, no comparison is needed; the data at the head of the queue is simply inserted into the data list. This process allows data from the target queue to be inserted into the corresponding positions in the data list.
[0108] S24, determine the position offset of the first display object in the rendering screen corresponding to the data list based on the loading position. For detailed explanation, please refer to the relevant descriptions in the above embodiments, which will not be repeated here.
[0109] S25, refresh the display page according to the position offset and the second display object to ensure that the display position of the first display object remains unchanged on the display page. For detailed explanation, please refer to the relevant descriptions in the above embodiments, which will not be repeated here.
[0110] The page display method provided in this embodiment determines the loading position of the second data information corresponding to the second display object in the data list by comparing a first sorting value and a second sorting value. This allows display objects to be loaded into the data list according to a preset sorting rule, achieving real-time updates of the display page corresponding to the data list. By determining the arrangement order of the data information corresponding to each display object in the data list based on the priority of different display objects, data information can be inserted according to this arrangement order, avoiding disordered data insertion logic and facilitating dynamic updates of the data list.
[0111] This embodiment provides a page display method that can be used in electronic devices such as mobile phones, tablets, and computers. The electronic devices have applications with the above-mentioned code architecture, which improves the user experience of the applications. Figure 4 This is a flowchart of a page display method according to an embodiment of the present disclosure, such as... Figure 4 As shown, the process includes the following steps:
[0112] S31, the first display object is displayed on the display page. For detailed explanation, please refer to the relevant descriptions in the above embodiments.
[0113] S32, obtain the data list corresponding to the display page. The rendered screen corresponding to this data list includes the first data information corresponding to the first display object. For detailed explanation, please refer to the relevant descriptions in the above embodiments.
[0114] S33, when loading the second data information corresponding to the second display object to be rendered into the data list, the loading position of the second data information is determined based on the preset sorting rules between the first and second display objects. The data sources for the first and second data information are different. See the relevant descriptions in the above embodiments for detailed explanation.
[0115] S34, determine the position offset of the first display object in the rendered screen corresponding to the data list based on the loading position. See the relevant description in the above embodiment for detailed explanation.
[0116] S35, refresh the display page according to the position offset and the second display object, so that the display position of the first display object in the display page remains unchanged.
[0117] Specifically, step S35 above may include:
[0118] S351, determine the second data information loaded into the data list that corresponds to the second display object.
[0119] S352, render the data list loaded with the second data information, and refresh the display page according to the position offset.
[0120] The second data information corresponding to the second display object is inserted into the data list, and the data list is refreshed to load the second data information. The second data information in the data list is then rendered to refresh the display page, enabling the second display object to be displayed on the page for the user to view or browse later.
[0121] As the second data information is loaded, the position of the existing first data information in the data list will shift, and correspondingly, the first display object on the display page will also shift. To ensure that the content displayed on the electronic device screen does not move, the rendering of the data list can be adjusted according to the positional shift caused by the first data information, so that the first display object obtained by rendering the first data information is still displayed on the display page.
[0122] As an optional implementation, step S352 above may include:
[0123] (1) Obtain the offset direction corresponding to the position offset.
[0124] The offset direction is the direction in which the first data information moves within the data list after the second data information is inserted. This offset direction corresponds to the position offset amount, for example, offsetting downwards or upwards.
[0125] (2) Slide the rendering screen corresponding to the data list a preset distance in the opposite direction of the offset direction. The preset distance is equal to the position offset.
[0126] The rendered screen corresponding to the data list is slid in the opposite direction of the offset direction to ensure that the preset sliding distance is equal to the position offset. The position offset caused by the insertion of the second data information into the first data information is automatically filled in by the offset caused by the insertion of the second data information into the first display object, thereby keeping the page still in the user's visual perception.
[0127] The page display method provided in this embodiment refreshes the data list in real time using a second display object and a position offset. While refreshing the display page in real time with the rendered second display object, it ensures that the current display object's position on the display page remains unchanged. After inserting second data information into the data list, the rendered screen corresponding to the data list is slid away by a preset distance in the opposite direction of the offset direction. This preset distance is equal to the position offset, ensuring that the position of the first display object on the display page remains unchanged. This guarantees that the displayed content on the current display page remains constant, achieving real-time dynamic refreshing of the data list corresponding to the display page.
[0128] This embodiment also provides a page display device for implementing the above embodiments and preferred embodiments; details already described will not be repeated. As used below, the term "module" can refer to a combination of software and / or hardware that performs a predetermined function. Although the device described in the following embodiments is preferably implemented in software, hardware implementation, or a combination of software and hardware, is also possible and contemplated.
[0129] This embodiment provides a page display device, such as... Figure 8 As shown, it includes:
[0130] Display module 41 is used to display the first display object on the display page.
[0131] The data acquisition module 42 is used to acquire the data list corresponding to the display page. The rendering screen corresponding to the data list includes the first data information corresponding to the first display object.
[0132] The dynamic calculation module 43 is used to determine the loading position of the second data information based on the preset sorting rules between the first and second display objects when loading the second data information corresponding to the second display object to be rendered into the data list. The data sources of the first and second data information are different.
[0133] The offset determination module 44 is used to determine the position offset of the first display object in the rendering screen corresponding to the data list based on the loading position.
[0134] The refresh module 45 is used to refresh the display page according to the position offset and the second display object, so that the display position of the first display object in the display page remains unchanged.
[0135] Optionally, the dynamic calculation module 43 described above may include:
[0136] The first acquisition submodule is used to acquire the first sort value of the first data information corresponding to the first display object in the data list, and the second sort value of the second data information corresponding to the second display object in the data list.
[0137] The comparison submodule is used to compare the first sort value and the second sort value, and determine the loading position of the second data information corresponding to the second display object in the data list based on the preset sorting rules.
[0138] Optionally, when the preset sorting rule is priority sorting, the comparison submodule is further used to load the second data information before the first data information when the first sorting value is less than the second sorting value; or, when the first sorting value is greater than or equal to the second sorting value, load the second data information after the first data information.
[0139] Optionally, the refresh module 45 may include:
[0140] The first determination submodule is used to determine the second data information loaded into the data list that corresponds to the second display object.
[0141] The refresh submodule is used to render the data list loaded with the second data information and refresh the display page according to the position offset.
[0142] Optionally, the refresh submodule is specifically used to: obtain the offset direction corresponding to the position offset; slide the rendering screen corresponding to the data list by a preset distance in the opposite direction of the offset direction, wherein the preset distance is equal to the position offset.
[0143] Optionally, the above-mentioned page display device may further include:
[0144] The network request module is used to obtain a first network request interface pointing to a first display object and a second network request interface pointing to a second display object. The first and second network request interfaces correspond to different identification information.
[0145] The interface distribution module is used to receive the first data returned by the first network request interface and the second data returned by the second network request interface, and distribute the first data and the second data to the corresponding data processing modules according to the identification information corresponding to the first network request interface and the second network request interface.
[0146] The data processing module is used to receive first data or second data, and perform serialization processing on the first data or second data to obtain first serialized data corresponding to the first data, or second serialized data corresponding to the second data. The first serialized data includes first data information corresponding to a first display object, and the second serialized data includes second data information corresponding to a second display object.
[0147] Optionally, the data processing module described above is also used to set a priority identifier in the first serialized data and the second serialized data.
[0148] Optionally, the data processing module described above is further configured to store the first serialized data and the second serialized data into a target queue, which is used to load the first data information and / or the second data information into a data list.
[0149] In this embodiment, the page display device is presented in the form of a functional unit. Here, a unit refers to an ASIC circuit, a processor and memory that execute one or more software or fixed programs, and / or other devices that can provide the above functions.
[0150] The further functional descriptions of the above modules are the same as those in the corresponding embodiments of the above methods, and will not be repeated here.
[0151] The page display device provided in this embodiment, when loading second data information corresponding to a second display object to be rendered into a data list, determines the loading position of the second data information in the data list according to a preset sorting rule between the first and second display objects. Then, it determines the position offset of the first display object based on this loading position, and refreshes the data list using the position offset and the second data information. In other words, it refreshes the display page corresponding to the data list using the position offset and the second display object, ensuring that the display position of the first display object remains unchanged in the current display page. This avoids the problem of the first display object's position changing on the display page due to loading the second display object, ensuring that the content on the corresponding display page remains visually static during the dynamic refresh of the data list, thereby improving the user's viewing experience.
[0152] This disclosure also provides an electronic device having the above-described features. Figure 8 The page display device shown.
[0153] Please see Figure 9 , Figure 9 This is a schematic diagram of the structure of an electronic device provided in an optional embodiment of this disclosure, such as... Figure 9As shown, the electronic device may include: at least one processor 501, such as a central processing unit (CPU), at least one communication interface 503, memory 504, and at least one communication bus 502. The communication bus 502 is used to enable communication between these components. The communication interface 503 may include a display screen or a keyboard; optionally, the communication interface 503 may also include a standard wired interface or a wireless interface. The memory 504 may be high-speed volatile random access memory (RAM) or non-volatile memory, such as at least one disk storage device. Optionally, the memory 504 may also be at least one storage device located remotely from the aforementioned processor 501. The processor 501 may be combined with... Figure 8 The described apparatus has an application program stored in memory 504, and a processor 501 calls the program code stored in memory 504 to perform any of the above method steps.
[0154] The communication bus 502 can be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus, etc. The communication bus 502 can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 9 The bus is represented by a single thick line, but this does not mean that there is only one bus or one type of bus.
[0155] The memory 504 may include volatile memory, such as random-access memory (RAM); the memory may also include non-volatile memory, such as flash memory, hard disk drive (HDD) or solid-state drive (SSD); the memory 504 may also include a combination of the above types of memory.
[0156] The processor 501 can be a central processing unit (CPU), a network processor (NP), or a combination of a CPU and an NP.
[0157] The processor 501 may further include a hardware chip. This hardware chip may be an application-specific integrated circuit (ASIC), a programmable logic device (PLD), or a combination thereof. The PLD may be a complex programmable logic device (CPLD), a field-programmable gate array (FPGA), a generic array logic (GAL), or any combination thereof.
[0158] Optionally, memory 504 is also used to store program instructions. Processor 501 can call the program instructions to implement the functions described in this application. Figures 1 to 3 The page display method shown in the embodiment.
[0159] This disclosure also provides a non-transitory computer storage medium storing computer-executable instructions that can execute the page display method in any of the above method embodiments. The storage medium may be a magnetic disk, optical disk, read-only memory (ROM), random access memory (RAM), flash memory, hard disk drive (HDD), or solid-state drive (SSD), etc.; the storage medium may also include combinations of the above types of memory.
[0160] Although embodiments of the present disclosure have been described in conjunction with the accompanying drawings, those skilled in the art can make various modifications and variations without departing from the spirit and scope of the present disclosure, and such modifications and variations all fall within the scope defined by the appended claims.
Claims
1. A page display method characterized by comprising: include: The first displayed object is shown on the display page; Obtain the data list corresponding to the display page, wherein the rendered screen corresponding to the data list includes the first data information corresponding to the first display object; When loading the second data information corresponding to the second display object to be rendered into the data list, the loading position of the second data information is determined based on the preset sorting rules between the first display object and the second display object, wherein the data sources of the first data information and the second data information are different; Based on the loading position, determine the position offset of the first display object in the rendered screen corresponding to the data list; The display page is refreshed based on the position offset and the second display object to keep the display position of the first display object in the display page unchanged.
2. The method of claim 1, wherein, When loading the second data information corresponding to the second display object to be rendered into the data list, determining the loading position of the second data information based on the preset sorting rule between the first display object and the second display object includes: Obtain the first sort value of the first data information corresponding to the first display object in the data list, and the second sort value of the second data information corresponding to the second display object in the data list; By comparing the first sort value and the second sort value, the loading position of the second data information corresponding to the second display object in the data list is determined based on the preset sorting rule.
3. The method of claim 2, wherein, The preset sorting rule is a priority sorting. The step of comparing the first sorting value and the second sorting value, and determining the loading position of the second data information based on the preset sorting rule, includes: When the first sort value is less than the second sort value, the second data information is loaded in front of the first data information; Alternatively, when the first sort value is greater than or equal to the second sort value, the second data information is loaded after the first data information.
4. The method according to any one of claims 1 to 3, characterized in that, Also includes: Obtain a first network request interface pointing to the first data information and a second network request interface pointing to the second data information, wherein the first network request interface and the second network request interface correspond to different identification information; Based on the mapping relationship between the identification information and the data processing method, the first data processing method of the first data returned by the first network request interface and the second data processing method of the second data returned by the second network request interface are determined. The first data is serialized based on the first data processing method to obtain first serialized data, which includes first data information corresponding to the first display object. The second data is serialized based on the second data processing method to obtain second serialized data, which includes second data information corresponding to the second display object.
5. The method of claim 4, wherein, Also includes: A priority flag is set in the first serialized data and the second serialized data.
6. The method of claim 5, wherein, Also includes: The first serialized data and the second serialized data are stored in a target queue, which is used to load the first data information and / or the second data information into the data list.
7. The method of claim 1, wherein, Refreshing the display page based on the position offset and the second display object includes: Determine the second data information loaded into the data list that corresponds to the second display object; The data list containing the second data information is rendered, and the display page is refreshed according to the position offset.
8. The method according to claim 7, characterized in that, The step of rendering the data list loaded with the second data information and refreshing the display page according to the position offset includes: Obtain the offset direction corresponding to the position offset; The rendered screen corresponding to the data list is slid a preset distance in the opposite direction of the offset direction, wherein the preset distance is equal to the position offset.
9. A page display device, characterized in that, include: The display module is used to display the first display object on the display page; The data acquisition module is used to acquire the data list corresponding to the display page, and the rendering screen corresponding to the data list includes the first data information corresponding to the first display object; The dynamic calculation module is used to determine the loading position of the second data information based on the preset sorting rules between the first display object and the second display object when loading the second data information corresponding to the second display object to be rendered into the data list, wherein the data sources of the first data information and the second data information are different; An offset determination module is used to determine the position offset of the first display object in the rendered screen corresponding to the data list based on the loading position. The refresh module is used to refresh the display page according to the position offset and the second display object, so that the display position of the first display object in the display page remains unchanged.
10. The apparatus of claim 9, wherein, Also includes: The network request module is used to obtain a first network request interface pointing to the first data information and a second network request interface pointing to the second data information. An interface distribution module is used to receive first data returned by the first network request interface and second data returned by the second network request interface. Based on the identification information corresponding to the first network request interface and the second network request interface, the first data and the second data are distributed to the corresponding data processing modules; The data processing module is configured to receive the first data or the second data, and perform serialization processing on the first data or the second data to obtain first serialized data corresponding to the first data, or second serialized data corresponding to the second data; wherein, the first serialized data includes first data information corresponding to the first display object, and the second serialized data includes second data information corresponding to the second display object.
11. An electronic device, comprising: include: A memory and a processor are communicatively connected, the memory stores computer instructions, and the processor executes the page display method according to any one of claims 1-7 by executing the computer instructions.
12. A computer-readable storage medium, characterized in that, The computer readable storage medium stores computer instructions for causing a computer to execute the page display method of any one of claims 1-7.