A page configuration method, device, electronic device and storage medium
By obtaining the window parameters and target layout types, the content area parameters of the page to be accessed are calculated, and the page is configured based on these parameters, the problem of cumbersome setting of content area parameters in the existing technology is solved, and the layout changes are not adapted to, and efficient Accurate page configuration and display effects.
Patent Information
- Application Number
- CN202211562066.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-07
- Publication Date
- 2025-02-11
- Estimated Expiration
- 2042-12-07
AI Technical Summary
In the prior art, setting content area parameters requires a lot of human resources, which is prone to errors in calculation results. When the page layout changes, the original set content area parameters cannot be applied, resulting in confusion in the page layout and affecting the display effect. and user experience.
By obtaining the window parameters and target layout types, obtaining the corresponding target parameter calculation rules, calculate the content area parameters of the page to be accessed, and configure the page based on these parameters. If there are unknown layout elements in the target layout type, use the parameter calculation rules set to build the target parameter calculation rules, or obtain the parameter calculation rules for the alternative layout type through similarity matching to ensure the accuracy of the content area parameters.
It avoids errors in manual calculations, saves human resources, ensures the accuracy of content area parameters, adapts to changes in page layout, and optimizes the display effect of page content.
Smart Images

Figure CN116069421B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of web pages, and in particular to a page configuration method, device, electronic equipment and storage medium. Background Art
[0002] The content area is the most important area in a Web (World Wide Web) page. It displays the main information of the page, such as text and pictures. The parameter setting of the content area has also become an important part of the page configuration.
[0003] In the prior art, the setting of parameters such as the height and width of the content area in a page is usually performed by programmers who calculate the corresponding content area parameters for each layout type based on the type and number of function bars appearing in each page, and assign the calculated content area parameters to each page.
[0004] However, this method of assigning content area parameters not only requires a lot of human resources and has calculation result errors, but also once the page is modified, for example, the type or number of function bars in the page is changed, the originally set content area parameters cannot be applied to the modified page, which often causes chaotic page layout, greatly affects the page display effect, and reduces the user experience. Summary of the invention
[0005] The present invention provides a page configuration method, device, electronic device and storage medium to solve the problem that content area parameters lead to chaotic page layout.
[0006] According to one aspect of the present invention, there is provided a page configuration method, comprising:
[0007] In response to obtaining the page access request, obtaining window parameters and a target layout type of the page to be accessed;
[0008] Acquire a corresponding target parameter calculation rule according to the target layout type;
[0009] According to the window parameters and the target parameter calculation rule, the content area parameters of the page to be visited are obtained, and the page to be visited is configured according to the content area parameters.
[0010] After obtaining the window parameters and the target layout type of the page to be accessed, it also includes: if the corresponding target parameter calculation rules are not obtained according to the target layout type, then determine whether there are unknown layout elements in the target layout type; wherein the unknown layout elements do not appear in any parameter calculation rules of the parameter calculation rule set; if there are no unknown layout elements, then construct the target parameter calculation rules according to the parameter calculation rule set. When there are no parameter calculation rules corresponding to the current layout type and the content area parameters cannot be directly obtained, the parameter calculation rule set can be used to directly construct matching parameter calculation rules for layout types that do not have unknown layout elements, thereby still obtaining accurate content area parameters. Compared with using default values as content area parameters, the accuracy of obtaining content area parameters is greatly improved, so that the displayed content in the content area is more in line with the view under the current layout type, and the display effect of the page content is optimized.
[0011] After determining whether there are unknown layout elements in the target layout type, the method further includes: if there are unknown layout elements, obtaining a set of alternative layout types with the same number of layout elements as the target layout type; obtaining the first alternative layout type with the greatest similarity to the target layout type in the set of alternative layout types; and using the first parameter calculation rule corresponding to the first alternative layout type as the target parameter calculation rule. This allows the current layout type to obtain relatively accurate content area parameters through the parameter calculation rules under layout types with similar layout element composition structures and equal numbers when there are no corresponding target parameter calculation rules and there are unknown layout elements in the parameter calculation rule set, thereby achieving the acquisition of parameter calculation rules under diversified layouts and avoiding the occurrence of layout confusion caused by unknown layout elements.
[0012] After obtaining the first candidate layout type with the greatest similarity to the target layout type, it also includes: determining whether the similarity between the first candidate layout type and the target layout type is greater than or equal to a first preset threshold; if less than the first preset threshold, obtaining the first layout type with the largest number of layout elements hitting the target layout type and the second layout type with the largest number of layout elements hit by the target layout type in the layout type set; wherein the number of layout elements of the first layout type is greater than that of the target layout type, and the number of layout elements of the second layout type is less than that of the target layout type; obtaining the second parameter calculation rule corresponding to the first layout type and the third parameter calculation rule corresponding to the second layout type; obtaining the content area parameters of the page to be visited according to the window parameters, the second parameter calculation rule and the third parameter calculation rule; using the first parameter calculation rule corresponding to the first candidate layout type as the target parameter calculation rule includes: if greater than or equal to the first preset threshold, using the first parameter calculation rule corresponding to the first candidate layout type as the target parameter calculation rule. When there is no corresponding target parameter calculation rule for the current layout type, and there are unknown layout elements that do not appear in any parameter calculation rule of the parameter calculation rule set, but there are no layout types with similar structures and equal numbers, more accurate content area parameters can be obtained through the first layout type with similar structure but more function bars, and the second layout type with similar structure but fewer function bars, thereby further realizing the acquisition of parameter calculation rules under diversified layouts and avoiding the phenomenon of layout confusion caused by unknown layout elements.
[0013] After configuring the page to be visited according to the content area parameters, the method further includes: obtaining a predicted page to be visited that is associated with the page to be visited according to the layout type of the page to be visited, and obtaining the content area parameters of the predicted page to be visited. The predicted page to be visited is obtained through the function bar of the layout type of the page to be visited, so as to achieve the pre-acquisition of content area parameters, thereby improving the configuration efficiency of the page and ensuring the rationality of the layout of the content displayed on the page.
[0014] In response to obtaining the page test instruction, the layout types of each page are traversed, and it is determined whether the layout type of the current page has been added to the layout type set; if it has been added to the layout type set, it continues to determine whether the parameter calculation rule corresponding to the layout type of the current page has been added to the parameter calculation rule set; if it has not been added to the layout type set, the layout type of the current page is added to the layout type set, and it continues to determine whether the parameter calculation rule corresponding to the layout type of the current page has been added to the parameter calculation rule set; if it has not been added to the parameter calculation rule set, the parameter calculation rule corresponding to the layout type of the current page is added to the parameter calculation rule set, and the layout types of other pages are continued to be traversed until all pages have been traversed; if it has been added to the parameter calculation rule set, it continues to traverse the layout types of other pages until all pages have been traversed. In this way, the data integrity of the layout type set and the parameter calculation rule set in the business system is achieved, so that each page in the business system can obtain the matching layout type and parameter calculation rule, ensuring the accurate acquisition of the content area parameters in each page, so that the reasonable layout of the page optimizes the content display effect.
[0015] If the target layout type includes a target height layout type and a target width layout type, and the window parameters include a window height and a window width, then the step of obtaining the corresponding target parameter calculation rule according to the target layout type includes: obtaining the corresponding target height calculation rule according to the target height layout type, and obtaining the corresponding target width calculation rule according to the target width layout type; the step of obtaining the content area parameters of the page to be visited according to the window parameters and the target parameter calculation rule includes: obtaining the content area height of the page to be visited according to the window height and the target height calculation rule, and obtaining the content area width of the page to be visited according to the window width and the target width calculation rule. The area height and area width of the content area are obtained by the layout type of the page to be visited in the height direction and the width direction, thereby ensuring the integrity of the boundary parameters of the content area, so that the area boundary of the content area matches the window height and the window width of the browser, and further optimizing the display effect of the page content in the configured page.
[0016] According to another aspect of the present invention, there is provided a page configuration device, comprising:
[0017] A layout type acquisition module, used to acquire window parameters and a target layout type of a page to be accessed in response to acquiring a page access request;
[0018] A parameter calculation rule acquisition module, used to acquire corresponding target parameter calculation rules according to the target layout type;
[0019] The page configuration execution module is used to obtain the content area parameters of the page to be visited according to the window parameters and the target parameter calculation rule, and configure the page to be visited according to the content area parameters.
[0020] According to another aspect of the present invention, an electronic device is provided, the electronic device comprising:
[0021] at least one processor; and
[0022] a memory communicatively connected to the at least one processor; wherein,
[0023] The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the page configuration method described in any embodiment of the present invention.
[0024] According to another aspect of the present invention, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the page configuration method described in any embodiment of the present invention when executed.
[0025] The technical solution of the embodiment of the present invention obtains the content area parameters of the page to be visited according to the target parameter calculation rules corresponding to the target layout type of the page to be visited and the obtained window parameters, and completes the page configuration according to the content area parameters, thereby avoiding calculation errors existing in manual calculations and saving wasted human resources. At the same time, the content area parameters are assigned based on the parameter calculation rules. When the layout type of the page changes, the accurate content area parameters can be directly obtained based on the matching relationship between the layout type and the parameter calculation rules, thereby ensuring the accuracy of the content area parameters in the page after the layout type is changed and optimizing the content display effect of the page.
[0026] It should be understood that the contents described in this section are not intended to identify the key or important features of the embodiments of the present invention, nor are they intended to limit the scope of the present invention. Other features of the present invention will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0027] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0028] Figure 1A is a flow chart of a page configuration method provided according to Embodiment 1 of the present invention;
[0029] Figure 1B is a schematic diagram of a function bar provided according to Embodiment 1 of the present invention;
[0030] Figure 1C is a schematic diagram of a function bar provided according to Embodiment 1 of the present invention;
[0031] Figure 1D is a schematic diagram of a function bar provided according to Embodiment 1 of the present invention;
[0032] Figure 1E is a schematic diagram of a layout type provided according to Embodiment 1 of the present invention;
[0033] Figure 1F is a schematic diagram of a layout type provided according to Embodiment 1 of the present invention;
[0034] Figure 2 is a flow chart of a page configuration method provided according to Embodiment 2 of the present invention;
[0035] Figure 3 is a flow chart of a page configuration method provided according to Embodiment 3 of the present invention;
[0036] Figure 4 is a structural schematic diagram of a page configuration device provided according to a fourth embodiment of the present invention;
[0037] Figure 5 It is a structural schematic diagram of an electronic device for implementing the page configuration method according to an embodiment of the present invention. DETAILED DESCRIPTION
[0038] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.
[0039] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0040] Embodiment 1
[0041] Figure 1A This is a flow chart of a page configuration method provided in the first embodiment of the present invention. This embodiment can be applied to obtaining content area parameters in a page. The method can be executed by a page configuration device. The page configuration device can be implemented in the form of hardware and / or software. The page configuration device is configured in an electronic device such as a server. Figure 1A As shown, the method includes:
[0042] S101 . In response to obtaining a page access request, obtain window parameters and a target layout type of a page to be accessed.
[0043] by Figure 1B , Figure 1C and Figure 1D For example, from the height direction of a Web page, in addition to the content area for displaying the main content, the page may also include a function bar at the top, such as a menu bar, a breadcrumb bar (i.e., a path bar for navigation), and a search bar, etc., as well as a function bar at the bottom, such as a logo bar, etc.; and different pages may have different menu bars according to different functional requirements, and the menu bar may specifically include a first-level menu bar, a second-level menu bar, and a third-level menu bar, etc.; in particular, if the page content of the content area is displayed in a list form, the function bar in the page may also include a paging bar to perform a page turning function of the list content; wherein the paging bar may be located above the content area, i.e., close to the top function bar, or below the content area, i.e., close to the bottom function bar.
[0044] Taking the above-mentioned layout in the height direction as an example, each layout type includes one or more of the above-mentioned function bars in addition to the content area, and may not include any function bar. Therefore, the combination of different function bars in the page forms different layout types; for example, layout type A is composed of "first-level menu bar + second-level menu bar + content area + identification bar", and layout type B is composed of "first-level menu bar + breadcrumbs bar + content area + identification bar".
[0045] Similarly, from the width direction of the page, the page may include a function bar on the left side of the page and a function bar on the right side of the page. Therefore, in the width direction of the page, each layout may include one or more of the above function bars in addition to the content area, and may not include any function bar. For example, layout type C is composed of only "left function bar + content area", and page D is composed of "left function bar + content area + right function bar". In the embodiment of the present invention, the type, number and position of the function bar in each layout type are not specifically limited.
[0046] Since the layout type of each page is pre-configured, when a page access request is obtained, the layout type of the page, that is, the target layout type, can be directly determined based on the page to be accessed in the page access request; the target layout type may include only the layout type in the height direction, or only the layout type in the width direction, or may include both the height and width directions.
[0047] The window parameters are the display parameters of the browser that issues the page access request. The window parameters are different for different screen sizes where the browser is located. If the target layout type only includes the layout type in the height direction, then the window parameters only include the window height. If the target layout type only includes the layout type in the width direction, then the window parameters only include the window width. If the target layout type includes both the height and width layout types, then the window parameters also need to include the window width and the window height. The browser's window height can be obtained through the Web page's API interface using the "window.innerHeight" method, and the window width can be obtained through the "window.innerWidth" method. In particular, the browser's window height and window width do not include the parameter values of the browser's own toolbars, drop-down bars and other functional elements.
[0048] S102: Acquire corresponding target parameter calculation rules according to the target layout type.
[0049] In the parameter calculation rule in the height direction, that is, the height calculation rule, the height of the content area is equal to the window height minus the height of each function bar under the layout type in the height direction, and the height of each function bar has been pre-configured as a fixed height; wherein, the height of each function bar can be obtained through the class name and the "window.getComputedStyle" method; in the parameter calculation rule in the width direction, that is, the width calculation rule, the width of the content area is equal to the window width minus the width of each function bar under the layout type in the width direction, and the width of each function bar is also pre-configured as a fixed width.
[0050] Since different layout types are composed of different function bars, different layout types correspond to different parameter calculation rules; taking the above-mentioned layout type in the height direction as an example, layout type A is composed of "first-level menu bar + second-level menu bar + content area + identification bar", and the parameter calculation rule corresponding to this layout type is "content area height = window height - first-level menu bar height - second-level menu bar height - identification bar height"; layout type B is composed of "first-level menu bar + breadcrumbs bar + content area + identification bar", and the parameter calculation rule corresponding to this layout type is "content area height = window height - first-level menu bar height - breadcrumbs bar height - identification bar height".
[0051] Optionally, in an embodiment of the present invention, after obtaining the window parameters and the target layout type of the page to be visited, it also includes: if the corresponding target parameter calculation rule is not obtained according to the target layout type, then judging whether there is an unknown layout element in the target layout type; wherein the unknown layout element does not appear in any parameter calculation rule of the parameter calculation rule set; if there is no unknown layout element, then constructing the target parameter calculation rule according to the parameter calculation rule set.
[0052] Specifically, the parameter calculation rule set includes the existing parameter calculation rules. According to the parameter calculation rule set, the height or width of each known function bar can be obtained; still taking the layout type in the height direction as an example, layout type A is composed of "first-level menu bar + second-level menu bar + content area + identification bar", and layout type B is composed of "first-level menu bar + breadcrumbs bar + content area + identification bar". Since the parameter calculation rules corresponding to layout type A and layout type B are respectively known, the parameter calculation rule set can actually cover the heights of function bars such as the first-level menu bar, second-level menu bar, breadcrumbs bar and identification bar.
[0053] If the target layout type is composed of "first-level menu bar + second-level menu bar + breadcrumb bar + content area + identification bar", although the target parameter calculation rule matching the target layout type cannot be directly obtained, the height information of each component function bar under the target layout type has been known, so the target parameter calculation rule corresponding to the target layout type can be directly constructed as "content area height = window height - first-level menu bar height - second-level menu bar height - breadcrumb bar height - identification bar height". When there is no parameter calculation rule corresponding to the current layout type and the content area parameters cannot be directly obtained, the parameter calculation rule set can be used to directly construct a matching parameter calculation rule for the layout type without unknown layout elements, thereby still obtaining accurate content area parameters. Compared with using the default value as the content area parameter, the accuracy of obtaining the content area parameters is greatly improved, so that the displayed content in the content area is more in line with the view under the current layout type, and the display effect of the page content is optimized.
[0054] S103: Acquire content area parameters of the page to be visited according to the window parameters and the target parameter calculation rule, and configure the page to be visited according to the content area parameters.
[0055] Since the parameters of each function bar in the target parameter calculation rule are known, the content area parameters of the page to be visited can be directly obtained by substituting the window parameters into the obtained target parameter calculation rule; at the same time, after the content area parameters are configured, different display contents can be configured according to the height and / or width of the content area. Figure 1E and Figure 1F For example, at different window heights ( Figure 1E The window height is greater than Figure 1F The height of the content area is also different ( Figure 1E The content area height is greater than Figure 1F Thus, different content area heights are set according to different viewport heights. When there is a lot of content to be displayed, a page with a higher viewport height can carry more content to make full use of the display space of the content area.
[0056] Optionally, in an embodiment of the present invention, after configuring the page to be visited according to the content area parameters, it also includes: obtaining a predicted visited page associated with the page to be visited according to the layout type in the page to be visited, and obtaining the content area parameters of the predicted visited page. After obtaining the page to be visited, in addition to determining the page that the user may continue to visit based on the displayed content in the content area of the page, the displayed page that the user may continue to visit can also be determined based on the function bar of the layout type of the page; for example, if the page includes a paging bar, then the previous page and next page corresponding to the paging bar are both predicted visited pages; if the page includes a breadcrumb bar, then each upper-level path in the breadcrumb bar is a predicted visited page; by obtaining the predicted visited page through the function bar of the layout type of the page to be visited, the content area parameters are pre-acquired, thereby improving the configuration efficiency of the page and ensuring the rationality of the layout of the displayed content on the page.
[0057] Optionally, in an embodiment of the present invention, the page configuration method also includes: in response to obtaining a page test instruction, traversing the layout types of each page, and determining whether the layout type of the current page has been added to the layout type set; if it has been added to the layout type set, continuing to determine whether the parameter calculation rules corresponding to the layout type of the current page have been added to the parameter calculation rule set; if it has not been added to the layout type set, adding the layout type of the current page to the layout type set, and continuing to determine whether the parameter calculation rules corresponding to the layout type of the current page have been added to the parameter calculation rule set; if it has not been added to the parameter calculation rule set, adding the parameter calculation rules corresponding to the layout type of the current page to the parameter calculation rule set, and continuing to traverse the layout types of other pages until all pages have been traversed; if it has been added to the parameter calculation rule set, continuing to traverse the layout types of other pages until all pages have been traversed.
[0058] Specifically, each page in the business system is traversed in turn, and when each page is traversed, it is determined whether the layout type of the current page has been added to the layout type set, and whether the parameter calculation rule corresponding to the layout type has been added to the parameter calculation rule set. If not, the layout type and parameter calculation rule are added to the corresponding sets respectively, until each page in the business system is traversed, thereby achieving data integrity of the layout type set and parameter calculation rule set in the business system, and then each page in the business system can obtain the matching layout type and parameter calculation rule, ensuring the accurate acquisition of content area parameters in each page, so that the reasonable layout of the page optimizes the content display effect.
[0059] Optionally, in an embodiment of the present invention, if the target layout type includes a target height layout type and a target width layout type, and the window parameters include a window height and a window width, then obtaining the corresponding target parameter calculation rule according to the target layout type includes: obtaining the corresponding target height calculation rule according to the target height layout type, and obtaining the corresponding target width calculation rule according to the target width layout type; obtaining the content area parameters of the page to be visited according to the window parameters and the target parameter calculation rule includes: obtaining the content area height of the page to be visited according to the window height and the target height calculation rule, and obtaining the content area width of the page to be visited according to the window width and the target width calculation rule.
[0060] Specifically, if the target layout type includes a target height layout type and a target width layout type, it indicates that the setting of the content area in the page to be visited not only needs to determine the height of the content area according to the function bar layout in the height direction, but also needs to determine the width of the content area according to the function bar layout in the width direction; therefore, the calculation rules in the height direction and the width direction are obtained respectively, that is, the height calculation rule and the width calculation rule, and then the window height and the window width are respectively substituted into the above calculation rules to obtain the complete content area parameters; the area height and area width of the content area are obtained through the layout type of the page to be visited in the height direction and the width direction, thereby ensuring the integrity of the boundary parameters of the content area, so that the area boundary of the content area matches the window height and window width of the browser, and further optimizes the display effect of the page content in the configured page.
[0061] The technical solution of the embodiment of the present invention obtains the content area parameters of the page to be visited according to the target parameter calculation rules corresponding to the target layout type of the page to be visited and the obtained window parameters, and completes the page configuration according to the content area parameters, thereby avoiding calculation errors existing in manual calculations and saving wasted human resources. At the same time, the content area parameters are assigned based on the parameter calculation rules. When the layout type of the page changes, the accurate content area parameters can be directly obtained based on the matching relationship between the layout type and the parameter calculation rules, thereby ensuring the accuracy of the content area parameters in the page after the layout type is changed and optimizing the content display effect of the page.
[0062] Embodiment 2
[0063] Figure 2 This is a flow chart of a page configuration method provided by Embodiment 2 of the present invention. The relationship between this embodiment and the above embodiment is that the target layout type includes unknown layout elements that do not appear in any parameter calculation rule of the parameter calculation rule set. Figure 2 As shown, the method includes:
[0064] S201. In response to obtaining a page access request, obtain window parameters and a target layout type of a page to be accessed; and execute S202.
[0065] S202. If the corresponding target parameter calculation rule is not obtained according to the target layout type, and there are unknown layout elements in the target layout type, obtain a set of alternative layout types with the same number of layout elements as the target layout type; wherein the unknown layout elements do not appear in any parameter calculation rule of the parameter calculation rule set; and execute S203.
[0066] For example, the target layout type is "first-level menu bar + breadcrumb bar + search bar + content area + identification bar", and layout type E is composed of "first-level menu bar + second-level menu bar + third-level menu bar + content area + identification bar", and layout type F is "first-level menu bar + second-level menu bar + search bar + content area + identification bar". Both layout type E and layout type F are added to the set of alternative layout types.
[0067] S203. Obtain a first candidate layout type with the greatest similarity to the target layout type from the candidate layout type set; and execute S204.
[0068] Taking the above technical solution as an example, there are two different function columns between the target layout type and layout type E, with a similarity of 50%; there is only one different function column between the target layout type and layout type F, with a similarity of 75%; therefore, layout type F is selected as the first alternative layout type.
[0069] S204: Use the first parameter calculation rule corresponding to the first candidate layout type as the target parameter calculation rule; and execute S205.
[0070] S205: Acquire content area parameters of the page to be visited according to the window parameters and the target parameter calculation rule, and configure the page to be visited according to the content area parameters.
[0071] Since the first alternative layout type and the target layout type have the same number of function bars, and the composition structure of the function bars are similar, the first parameter calculation rule corresponding to the first alternative layout type is used as the target parameter calculation rule corresponding to the target layout type, which essentially replaces the parameters of the unknown function bar with the parameters of other function bars; taking the above technical solution as an example, the target layout type is "first-level menu bar + breadcrumbs bar + search bar + content area + identification bar", and the first alternative layout type is "first-level menu bar + second-level menu bar + search bar + content area + identification bar". Using the first parameter calculation rule as the target parameter calculation rule means that the height of the breadcrumbs bar is regarded as equal to the height of the second-level menu bar, so as to obtain content area parameters with similar results.
[0072] The technical solution of the embodiment of the present invention enables, when there is no corresponding target parameter calculation rule for the current layout type and there are unknown layout elements that do not appear in any of the parameter calculation rules in the parameter calculation rule set, to obtain more accurate content area parameters through the parameter calculation rules under the layout types with similar layout element composition structures and equal numbers, thereby realizing the acquisition of parameter calculation rules under diversified layouts and avoiding the phenomenon of layout confusion caused by unknown layout elements.
[0073] Embodiment 3
[0074] Figure 3 A flowchart of a page configuration method provided in Embodiment 3 of the present invention. In the embodiment of the present invention, after obtaining a first candidate layout type having the greatest similarity to the target layout type, the method further includes: determining whether the similarity between the first candidate layout type and the target layout type is greater than or equal to a first preset threshold. The method includes:
[0075] S301. In response to obtaining a page access request, obtain window parameters and a target layout type of a page to be accessed; and execute S302.
[0076] S302. If the corresponding target parameter calculation rule is not obtained according to the target layout type, and there are unknown layout elements in the target layout type, obtain a set of alternative layout types with the same number of layout elements as the target layout type, and obtain a first alternative layout type with the greatest similarity to the target layout type from the set of alternative layout types; wherein the unknown layout element does not appear in any parameter calculation rule in the parameter calculation rule set; and execute S303.
[0077] S303, determining whether the similarity between the first candidate layout type and the target layout type is greater than or equal to a first preset threshold; if so, executing S304; if not, executing S305.
[0078] S304. Use the first parameter calculation rule corresponding to the first candidate layout type as the target parameter calculation rule; and execute S308.
[0079] S305. Obtain, from the layout type set, a first layout type having the largest number of layout elements that hit the target layout type, and a second layout type having the largest number of layout elements that are hit by the target layout type; wherein the number of layout elements of the first layout type is greater than that of the target layout type, and the number of layout elements of the second layout type is less than that of the target layout type; and execute S306.
[0080] If the similarity between the first alternative layout type and the target layout type is less than the first preset threshold, it indicates that the target layout type and the first alternative layout type have significantly different composition structures, and it is not suitable to use the content area parameters under the first alternative layout type to predict the content area parameters under the target layout type; for example, when the target layout type is “first-level menu bar + breadcrumb bar + search bar + content area + logo bar”, if the first alternative layout type is “first-level menu bar + second-level menu bar + third-level menu bar + content area + paging bar”, obviously, although the number of function bars is equal, the composition structures of the function bars are significantly different, and when using the content area parameters under the first alternative layout type to predict the content area parameters under the target layout type, there will be a large error.
[0081] Therefore, when the similarity between the first candidate layout type and the target layout type is less than the first preset threshold, the first layout type and the second layout type are obtained. Taking the above technical solution as an example, when the target layout type is "first-level menu bar + breadcrumb bar + search bar + content area + logo bar", the first layout type may be "first-level menu bar + second-level menu bar + third-level menu bar + search bar + content area + logo bar", and the second layout type may be "first-level menu bar + search bar + content area + logo bar".
[0082] S306, obtaining a second parameter calculation rule corresponding to the first layout type and a third parameter calculation rule corresponding to the second layout type; and executing S307.
[0083] S307: Obtain content area parameters of the page to be accessed according to the window parameters, the second parameter calculation rule, and the third parameter calculation rule.
[0084] As described in the above technical solution, since the first layout type has one more function bar than the target layout type, and the second layout type has one less function bar than the target layout type, therefore, after obtaining the first calculation result according to the window parameters and the second parameter calculation rules and obtaining the second calculation result according to the window parameters and the third parameter calculation rules, the content area parameters of the page to be visited can be obtained according to the average of the first calculation result and the second calculation result.
[0085] In particular, when the difference in the number of function bars between the first layout type and the target layout type is greater than one, and / or the difference in the number of function bars between the target layout type and the second layout type is greater than one, different weights can be assigned to the first calculation result and the second calculation result based on the above difference results; for example, when the first layout type has two more function bars than the target layout type, and the target layout type has three more function bars than the second layout type, weight values of 0.6 and 0.4 can be assigned to the first calculation result and the second calculation result, respectively, so as to obtain matching content area parameters according to the different numbers of function bars in the first layout type and the second layout type.
[0086] S308: Obtain content area parameters of the page to be visited according to the window parameters and the target parameter calculation rule, and configure the page to be visited according to the content area parameters.
[0087] The technical solution of the embodiment of the present invention enables, when there is no corresponding target parameter calculation rule for the current layout type, and there are unknown layout elements that do not appear in any parameter calculation rule of the parameter calculation rule set, but there are no layout types with similar structure and equal number, to jointly obtain relatively accurate content area parameters through a first layout type with similar structure but a larger number of function bars, and a second layout type with similar structure but a smaller number of function bars, thereby further realizing the acquisition of parameter calculation rules under diversified layouts and also avoiding the phenomenon of layout confusion caused by unknown layout elements.
[0088] Embodiment 4
[0089] Figure 4 : is a structural block diagram of a page configuration device provided by Embodiment 4 of the present invention, the device specifically comprises:
[0090] The layout type acquisition module 401 is used to acquire window parameters and a target layout type of a page to be accessed in response to acquiring a page access request;
[0091] A parameter calculation rule acquisition module 402 is used to acquire a corresponding target parameter calculation rule according to the target layout type;
[0092] The page configuration execution module 403 is used to obtain the content area parameters of the page to be visited according to the window parameters and the target parameter calculation rule, and configure the page to be visited according to the content area parameters.
[0093] The technical solution of the embodiment of the present invention obtains the content area parameters of the page to be visited according to the target parameter calculation rules corresponding to the target layout type of the page to be visited and the obtained window parameters, and completes the page configuration according to the content area parameters, thereby avoiding calculation errors existing in manual calculations and saving wasted human resources. At the same time, the content area parameters are assigned based on the parameter calculation rules. When the layout type of the page changes, the accurate content area parameters can be directly obtained based on the matching relationship between the layout type and the parameter calculation rules, thereby ensuring the accuracy of the content area parameters in the page after the layout type is changed and optimizing the content display effect of the page.
[0094] Optionally, the page configuration device further includes:
[0095] an unknown layout element determination module, configured to determine whether an unknown layout element exists in the target layout type if no corresponding target parameter calculation rule is obtained according to the target layout type; wherein the unknown layout element does not appear in any parameter calculation rule of the parameter calculation rule set;
[0096] The parameter calculation rule construction module is used to construct the target parameter calculation rule according to the parameter calculation rule set if there is no unknown layout element.
[0097] Optionally, the page configuration device further includes:
[0098] an alternative layout type acquisition module, configured to acquire, if there are unknown layout elements, a set of alternative layout types having the same number of layout elements as the target layout type; and acquire, from the set of alternative layout types, a first alternative layout type having the greatest similarity to the target layout type;
[0099] The target rule acquisition module is used to use the first parameter calculation rule corresponding to the first candidate layout type as the target parameter calculation rule.
[0100] Optionally, the page configuration device further includes:
[0101] A similarity determination execution module, used to determine whether the similarity between the first candidate layout type and the target layout type is greater than or equal to a first preset threshold;
[0102] a hit result acquisition module, configured to acquire, if the hit result is less than a first preset threshold, a first layout type having the largest number of layout elements hitting the target layout type and a second layout type having the largest number of layout elements hit by the target layout type in the layout type set; wherein the number of layout elements of the first layout type is greater than that of the target layout type, and the number of layout elements of the second layout type is less than that of the target layout type;
[0103] The content area parameter acquisition module is used to obtain the second parameter calculation rule corresponding to the first layout type and the third parameter calculation rule corresponding to the second layout type; and obtain the content area parameters of the page to be visited according to the window parameters, the second parameter calculation rule and the third parameter calculation rule.
[0104] Optionally, the target rule acquisition module is specifically configured to use the first parameter calculation rule corresponding to the first candidate layout type as the target parameter calculation rule if it is greater than or equal to a first preset threshold.
[0105] Optionally, the page configuration device further includes:
[0106] The prediction result acquisition module is used to acquire a predicted access page associated with the page to be visited according to the layout type of the page to be visited, and acquire content area parameters of the predicted access page.
[0107] Optionally, the page configuration device further includes:
[0108] A page test execution module is used to respond to the acquisition of a page test instruction, traverse the layout types of each page, and determine whether the layout type of the current page has been added to the layout type set; if it has been added to the layout type set, continue to determine whether the parameter calculation rule corresponding to the layout type of the current page has been added to the parameter calculation rule set; if it has not been added to the layout type set, add the layout type of the current page to the layout type set, and continue to determine whether the parameter calculation rule corresponding to the layout type of the current page has been added to the parameter calculation rule set; if it has not been added to the parameter calculation rule set, add the parameter calculation rule corresponding to the layout type of the current page to the parameter calculation rule set, and continue to traverse the layout types of other pages until all pages have been traversed; if it has been added to the parameter calculation rule set, continue to traverse the layout types of other pages until all pages have been traversed.
[0109] Optionally, if the target layout type includes a target height layout type and a target width layout type, the window parameters include window height and window width, and the parameter calculation rule acquisition module 402 is specifically used to obtain the corresponding target height calculation rule according to the target height layout type, and to obtain the corresponding target width calculation rule according to the target width layout type.
[0110] The page configuration execution module 403 is specifically used to obtain the content area height of the page to be visited according to the window height and the target height calculation rule, and to obtain the content area width of the page to be visited according to the window width and the target width calculation rule.
[0111] The above device can execute the page configuration method provided by any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method. For technical details not described in detail in this embodiment, please refer to the page configuration method provided by any embodiment of the present invention.
[0112] Embodiment 5
[0113] Figure 5A schematic diagram of the structure of an electronic device 10 that can be used to implement an embodiment of the present invention is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices (such as helmets, glasses, watches, etc.) and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present invention described and / or required herein.
[0114] like Figure 5 As shown, the electronic device 10 includes at least one processor 11, and a memory connected to the at least one processor 11, such as a read-only memory (ROM) 12, a random access memory (RAM) 13, etc., wherein the memory stores a computer program that can be executed by at least one processor, and the processor 11 can perform various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 12 or the computer program loaded from the storage unit 18 to the random access memory (RAM) 13. In the RAM 13, various programs and data required for the operation of the electronic device 10 can also be stored. The processor 11, the ROM 12, and the RAM 13 are connected to each other through a bus 14. The input / output (I / O) interface 15 is also connected to the bus 14.
[0115] A number of components in the electronic device 10 are connected to the I / O interface 15, including: an input unit 16, such as a keyboard, a mouse, etc.; an output unit 17, such as various types of displays, speakers, etc.; a storage unit 18, such as a disk, an optical disk, etc.; and a communication unit 19, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 19 allows the electronic device 10 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.
[0116] The processor 11 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any appropriate processor, controller, microcontroller, etc. The processor 11 executes the various methods and processes described above, such as a page configuration method.
[0117] In some embodiments, the page configuration method may be implemented as a computer program, which is tangibly contained in a computer-readable storage medium, such as a storage unit. In some embodiments, part or all of the computer program may be loaded and / or installed on a heterogeneous hardware accelerator via a ROM and / or a communication unit. When the computer program is loaded into RAM and executed by a processor, one or more steps of the page configuration method described above may be performed. Alternatively, in other embodiments, the processor may be configured to perform the page configuration method in any other appropriate manner (e.g., by means of firmware).
[0118] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0119] Computer programs for implementing the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that when the computer program is executed by the processor, the functions / operations specified in the flow chart and / or block diagram are implemented. The computer program may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.
[0120] In the context of the present invention, a computer-readable storage medium may be a tangible medium that may contain or store a computer program for use by or in conjunction with an instruction execution system, device, or equipment. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices, or equipment, or any suitable combination of the foregoing. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0121] To provide interaction with a user, the systems and techniques described herein may be implemented on a heterogeneous hardware accelerator having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to a user; and a keyboard and a pointing device (e.g., a mouse or trackball) through which a user can provide input to the heterogeneous hardware accelerator. Other types of devices may also be used to provide interaction with a user; for example, the feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form (including acoustic input, voice input, or tactile input).
[0122] The systems and techniques described herein may be implemented in a computing system that includes backend components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes frontend components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), a blockchain network, and the Internet.
[0123] A computing system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The client and server relationship is generated by computer programs running on the corresponding computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS services.
[0124] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps described in the present invention can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solution of the present invention can be achieved, and this document does not limit this.
[0125] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.
Claims
1. A page configuration method, characterized in that: include: In response to obtaining the page access request, obtaining window parameters and a target layout type of the page to be accessed; Acquire a corresponding target parameter calculation rule according to the target layout type; According to the window parameters and the target parameter calculation rule, the content area parameters of the page to be visited are obtained, and the page to be visited is configured according to the content area parameters; After obtaining the viewport parameters and the target layout type of the page to be accessed, it also includes: If the corresponding target parameter calculation rule is not obtained according to the target layout type, determining whether there is an unknown layout element in the target layout type; wherein the unknown layout element does not appear in any parameter calculation rule of the parameter calculation rule set; If there is no unknown layout element, constructing the target parameter calculation rule according to the parameter calculation rule set; After determining whether there is an unknown layout element in the target layout type, the method further includes: If there are unknown layout elements, obtaining a set of candidate layout types with the same number of layout elements as that of the target layout type; From the candidate layout type set, obtain a first candidate layout type having the greatest similarity to the target layout type; The first parameter calculation rule corresponding to the first candidate layout type is used as the target parameter calculation rule.
2. The method according to claim 1, characterized in that After obtaining the first candidate layout type having the greatest similarity to the target layout type, the method further includes: Determine whether the similarity between the first candidate layout type and the target layout type is greater than or equal to a first preset threshold; If it is less than a first preset threshold, obtaining, in the layout type set, a first layout type with the largest number of layout elements that hit the target layout type, and a second layout type with the largest number of layout elements that are hit by the target layout type; wherein the number of layout elements of the first layout type is greater than that of the target layout type, and the number of layout elements of the second layout type is less than that of the target layout type; Acquire a second parameter calculation rule corresponding to the first layout type and a third parameter calculation rule corresponding to the second layout type; According to the window parameters, the second parameter calculation rule and the third parameter calculation rule, obtaining the content area parameters of the page to be visited; The step of using the first parameter calculation rule corresponding to the first candidate layout type as the target parameter calculation rule includes: If it is greater than or equal to a first preset threshold, the first parameter calculation rule corresponding to the first candidate layout type is used as the target parameter calculation rule.
3. The method according to claim 1, characterized in that After configuring the page to be visited according to the content area parameters, the method further includes: According to the layout type of the page to be visited, a predicted visited page associated with the page to be visited is obtained, and content area parameters of the predicted visited page are obtained.
4. The method according to claim 1, characterized in that: The page configuration method also includes: In response to obtaining the page test instruction, traverse the layout types of each page, and determine whether the layout type of the current page has been added to the layout type set; If it has been added to the layout type set, then continue to determine whether the parameter calculation rule corresponding to the layout type of the current page has been added to the parameter calculation rule set; If it is not added to the layout type set, then add the layout type of the current page to the layout type set, and continue to determine whether the parameter calculation rule corresponding to the layout type of the current page has been added to the parameter calculation rule set; If it is not added to the parameter calculation rule set, then the parameter calculation rule corresponding to the layout type of the current page is added to the parameter calculation rule set, and the layout types of other pages are traversed continuously until all pages have been traversed; If it has been added to the parameter calculation rule set, continue to traverse the layout types of other pages until all pages have been traversed.
5. The method according to claim 1, characterized in that If the target layout type includes a target height layout type and a target width layout type, and the window parameters include a window height and a window width, then obtaining a corresponding target parameter calculation rule according to the target layout type includes: Acquire a corresponding target height calculation rule according to the target height layout type, and acquire a corresponding target width calculation rule according to the target width layout type; The step of obtaining the content area parameters of the page to be accessed according to the window parameters and the target parameter calculation rule includes: The height of the content area of the page to be visited is obtained according to the window height and the target height calculation rule, and the width of the content area of the page to be visited is obtained according to the window width and the target width calculation rule.
6. A page configuration device, characterized in that: include: A layout type acquisition module, used to obtain window parameters and a target layout type of a page to be accessed in response to obtaining a page access request; A parameter calculation rule acquisition module, used to acquire corresponding target parameter calculation rules according to the target layout type; A page configuration execution module, used to obtain content area parameters of the page to be visited according to the window parameters and the target parameter calculation rule, and configure the page to be visited according to the content area parameters; The page configuration device further includes: an unknown layout element determination module, configured to determine whether an unknown layout element exists in the target layout type if no corresponding target parameter calculation rule is obtained according to the target layout type; wherein the unknown layout element does not appear in any parameter calculation rule of the parameter calculation rule set; A parameter calculation rule construction module, configured to construct the target parameter calculation rule according to the parameter calculation rule set if no unknown layout element exists; an alternative layout type acquisition module, configured to acquire, if there are unknown layout elements, a set of alternative layout types having the same number of layout elements as the target layout type; and acquire, from the set of alternative layout types, a first alternative layout type having the greatest similarity to the target layout type; The target rule acquisition module is used to use the first parameter calculation rule corresponding to the first candidate layout type as the target parameter calculation rule.
7. An electronic device, characterized in that: The electronic device comprises: at least one processor; and a memory communicatively connected to the at least one processor; wherein, The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the page configuration method according to any one of claims 1 to 5.
8. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the page configuration method according to any one of claims 1 to 5 when executed.
Citation Information
Patent Citations
Navigation bar switching method and device, electronic equipment and storage medium
CN114816174A