A menu dynamic loading method and device, a server and a storage medium
By building common and serial session components in the server, parsing and generating menu loading information, the problem of low menu loading efficiency in configuration software is solved, and efficient and independent menu information management and installation/uninstallation are achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- SUPCON TECH CO LTD
- Filing Date
- 2022-08-10
- Publication Date
- 2026-06-19
AI Technical Summary
In existing technologies, the dynamic loading efficiency of menus in configuration software is low, and it is impossible to install and uninstall menu information corresponding to a single project separately, resulting in decreased client performance and complex menu content management.
By pre-building a common session component and multiple series of session components in the server, the client's page switching requests are parsed, menu loading information is generated and sent, reducing the burden on the client and enabling independent management and efficient loading of menu information.
It improves the efficiency of dynamic menu loading, reduces client-side pressure, achieves menu information independence for each controller series, and supports individual installation and uninstallation.
Smart Images

Figure CN115269054B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and more specifically, to a method, apparatus, server, and storage medium for dynamically loading menus. Background Technology
[0002] When switching pages in configuration software, the menu content and menu status of the corresponding page are different. At the same time, configuration software can be applied to different projects and connected to different multi-controller series. In different projects, the pages that users need to display are different, that is, the menu content and menu status of different multi-controllers are also different.
[0003] In existing technologies, the menu content corresponding to the menu in the configuration software is fixed, which cannot meet the needs of multiple different projects. Alternatively, the menu content and menu status in the configuration software are stored in the client. The client can calculate and update the menu content and menu status according to different projects. However, when there is a lot of data on menu content and menu status, the client's memory is occupied. In addition, the client needs to perform calculations constantly when switching pages, which affects the client's performance and makes the dynamic loading efficiency of menus low. At the same time, a client stores the menu content and menu status corresponding to multiple different projects through multiple branches, which makes it impossible to install and uninstall the menu information corresponding to a single project individually. Summary of the Invention
[0004] The purpose of this invention is to address the shortcomings of the prior art by providing a method, apparatus, server, and storage medium for dynamic menu loading, thereby solving the technical problems of low efficiency in dynamic menu loading and the inability to individually install and uninstall menu information corresponding to a single project.
[0005] To achieve the above objectives, the technical solutions adopted in the embodiments of this application are as follows:
[0006] In a first aspect, embodiments of this application provide a method for dynamically loading a menu, the method comprising:
[0007] Receive page switching request messages from the client for the configuration software;
[0008] A pre-built public session component is used to parse the page switching request message to obtain request parameters, which include: information of the first page and information of the second page;
[0009] Based on the information on the first page, obtain the menu information of the first page;
[0010] If the request parameters include component indication information, then based on the information of the second page, the target series of session components indicated by the component indication information are used to obtain the first menu information of the second page;
[0011] Generate first menu loading information based on the first menu information;
[0012] Send a first page switching response message to the client. The first page switching response message includes: first menu loading information. The first menu loading information is used to enable the client to load the first menu loading information and switch the configuration software from the first page to the second page.
[0013] Optionally, the component indication information is a series identifier of the controller corresponding to the configuration software; before obtaining the first menu information of the second page by using the target series session component indicated by the component indication information according to the information of the second page, the method further includes:
[0014] Using the public session component, the series session component corresponding to the series identifier is determined from multiple series session components as the target series session component based on the series identifier.
[0015] Optionally, the component indication information is the identifier of the controller corresponding to the configuration software; before obtaining the first menu information of the second page by using the target series session components indicated by the component indication information based on the information of the second page, the method further includes:
[0016] Using the public session component, the series identifier of the controller is determined based on the identifier of the controller;
[0017] Based on the series identifier, the series session component corresponding to the series identifier is determined from multiple series session components as the target series session component.
[0018] Optionally, the method further includes:
[0019] If the request parameters do not include the component indication information, then the second menu information of the second page is obtained by using the public session component based on the information of the second page;
[0020] Based on the second menu information, generate second menu loading information;
[0021] A second page switching response message is sent to the client. The second page switching response message includes: second menu loading information. The second menu loading information is used to enable the client to load the second menu loading information and switch the configuration software from the first page to the second page.
[0022] Optionally, before receiving the configuration software page switching request message sent by the client, the method further includes:
[0023] Using the public session component, the public menu configuration file of the configuration software is loaded to obtain the public menu information of the configuration software;
[0024] At least one series of session components are used to load at least one series of menu configuration files of the configuration software to obtain at least one series of menu information of the configuration software;
[0025] The menu information of the first page is sent to each of the clients. The menu information of the first page includes: the public menu information and a corresponding series of menu information. The menu information of the first page is used to enable each of the clients to load the public menu information and the corresponding series of menu information and display the first page of the configuration software.
[0026] Optionally, the request parameters may further include: the language type displayed by the client;
[0027] The step of generating first menu loading information based on the first menu information includes:
[0028] Generate the first menu loading information based on the first menu information and the language type.
[0029] Optionally, generating first menu loading information based on the first menu information includes:
[0030] Based on the menu information of the first page and the first menu information, menu change information is generated, and the first menu loading information includes the menu change information.
[0031] Secondly, embodiments of this application provide a menu dynamic loading device, comprising:
[0032] The receiving module is used to receive page switching request messages from the client's configuration software;
[0033] The parsing module is used to parse the page switching request message using a pre-built public session component to obtain request parameters, which include: information of the first page and information of the second page;
[0034] The acquisition module is used to acquire the menu information of the first page based on the information of the first page;
[0035] The module is configured to, if the request parameters include component indication information, obtain the first menu information of the second page by using the target series of session components indicated by the component indication information, based on the information of the second page;
[0036] The generation module is used to generate first menu loading information based on the first menu information;
[0037] The sending module is used to send a first page switching response message to the client. The first page switching response message includes: first menu loading information. The first menu loading information is used to enable the client to load the first menu loading information and switch the configuration software from the first page to the second page.
[0038] Thirdly, embodiments of this application provide a server, including: a storage medium and a processor, wherein the storage medium stores a computer program executable by the processor, and the processor executes the computer program to implement the menu dynamic loading method described in the first aspect above.
[0039] Fourthly, embodiments of this application provide a computer-readable storage medium storing a computer program, which, when read and executed, implements a menu dynamic loading method as described in the first aspect.
[0040] Compared with the prior art, this application has the following beneficial effects:
[0041] This application provides a method, apparatus, server, and storage medium for dynamic menu loading. It receives a page switching request message from a client's configuration software, uses a pre-built common session component to parse the message, and obtains request parameters, including information for a first page and information for a second page. Based on the information for the first page, it obtains the menu information for that page. If the request parameters include component indication information, it uses the target series session component indicated by the component indication information to obtain the first menu information for the second page. Based on the first menu information, it generates first menu loading information and sends a first page switching response message to the client. The first menu loading information enables the client to load the first menu loading information and switch the configuration software from the first page to the second page. This application generates the first menu loading information from the server and sends it to the client, which not only reduces the client's workload but also improves the efficiency of dynamic menu loading. Furthermore, the menu information for multiple controller series corresponds to multiple independent and different series session components, ensuring that the menu information for each controller series is independent and does not affect each other. This allows for the separate installation and uninstallation of menu information for session components corresponding to a single project. Attached Figure Description
[0042] To more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings used in the embodiments will be briefly introduced below. It should be understood that the following drawings only show some embodiments of the present invention and should not be regarded as a limitation on the scope. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.
[0043] Figure 1 A schematic diagram of a menu dynamic loading system provided in an embodiment of this application;
[0044] Figure 2 A flowchart illustrating a method for dynamically loading menus provided in an embodiment of this application;
[0045] Figure 3 A flowchart illustrating another method for dynamically loading menus provided in this application embodiment;
[0046] Figure 4 A flowchart illustrating another method for dynamically loading menus provided in this application embodiment;
[0047] Figure 5 A flowchart illustrating another method for dynamically loading menus provided in this application embodiment;
[0048] Figure 6 A schematic diagram of a menu dynamic loading device provided in an embodiment of this application;
[0049] Figure 7 This is a schematic diagram of a server provided in an embodiment of this application. Detailed Implementation
[0050] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present application, and not all embodiments. The components of the embodiments of the present application described and shown in the accompanying drawings can generally be arranged and designed in various different configurations.
[0051] Therefore, the following detailed description of the embodiments of this application provided in the accompanying drawings is not intended to limit the scope of the claimed application, but merely to illustrate selected embodiments of the application. All other embodiments obtained by those skilled in the art based on the embodiments of this application without inventive effort are within the scope of protection of this application.
[0052] Furthermore, the terms "first" and "second" are used only to distinguish descriptions and should not be interpreted as indicating or implying relative importance.
[0053] It should be noted that, where there is no conflict, the features in the embodiments of the present invention can be combined with each other.
[0054] In configuration software, most menu information is displayed by the client based on fixed settings. When menu information needs to be modified, both the client's front-end and back-end need to be modified, resulting in poor scalability. The client can also configure menu information via configuration files, where the client stores and updates the menu information. This means that operations such as adding, deleting, and modifying configuration data are handled by the client. While this improves scalability compared to fixed settings, the client's computing power is limited, and caching configuration data on the client results in significant memory usage. When the amount of configuration data is large, this can lead to performance issues on the client side. Therefore, this application proposes using a server to configure and store menu information and process related data via configuration files. This reduces the burden on the client. Since servers generally outperform clients, using a server improves the efficiency of dynamic menu loading compared to client-side storage and updates.
[0055] Traditionally, menu information displayed for different controller series is often processed with various branches, resulting in mixed code that is difficult to read and makes it impossible to install and uninstall menu information for a single project. Therefore, this application addresses this by setting up session components on the server for multiple menu items corresponding to different controller series. This allows the menu information across multiple projects to be independent, enabling the individual installation and uninstallation of menu information for a single project.
[0056] To alleviate the pressure on the client side, improve the efficiency of dynamic menu loading, and enable the individual installation and uninstallation of menu information corresponding to a single project, this application provides a dynamic menu loading system. The following is an explanation of the dynamic menu loading system provided by the embodiments of this application through specific examples. Figure 1 This is a schematic diagram of a menu dynamic loading system provided in an embodiment of this application, as shown below. Figure 1 As shown, the menu dynamic loading system includes: client 10 and server 20.
[0057] Client 10 communicates with server 20. Client 10 sends requests to server 20 to retrieve menu information returned by server 20, which can then be displayed on client 10's page. Server 20 processes the requests sent by client 10 and returns response messages, enabling client 10 to perform operations such as displaying information based on the menu information in the response messages.
[0058] In this embodiment, multiple different series session components 21 corresponding to the multi-controller series and a common session component 22 corresponding to the common menu information are pre-built in the server 20. The common session component 22 is communicatively connected to the multiple different series session components 21. When the server 20 processes a request sent by the client 10, it selects and calls the corresponding common session component 22 or series session component according to the relevant request parameters in the request. The session component parses and processes the client's request and then returns the response information to the client.
[0059] In this embodiment of the application, the public session component 22 can receive a request sent by the client 10, process the request, and respond to the client 10 with the processing result. At the same time, the public session component 22 can also forward the request to the corresponding series session component, and the corresponding series session component can process the request and respond to the client 10 with the processing result.
[0060] The common session component 22 stores common menu information, and multiple different series session components 21 store the series menu information corresponding to multiple controller series respectively. The multiple different series session components 21 can extend the common menu information for each controller series according to the differences of their respective series.
[0061] This application provides a method for dynamically loading menus. A session component in the server processes client requests and returns menu information. The client can then display the menu messages to dynamically load the menu. By storing menu information and processing requests through the server, the client's workload is reduced compared to storing menu information and dynamically loading the menu through the client. Furthermore, the server improves the efficiency of dynamic menu loading. Simultaneously, the server constructs multiple session components corresponding to different controller series and a common session component for common menu information. These components are isolated from each other, ensuring that the menu information for each controller series is independent and does not affect each other. This allows for the separate installation and uninstallation of menu information for the session component corresponding to a single project.
[0062] To improve the efficiency of dynamic menu loading, this application provides a method for dynamic menu loading. The following specific examples illustrate the method for dynamic menu loading provided by this application. Figure 2This is a flowchart illustrating a method for dynamically loading menus provided in an embodiment of this application. Figure 2 As shown, the execution entity of this method is the server, and the method includes:
[0063] S201 receives a page switching request message from the client for the configuration software.
[0064] The client initiates a page switching request, and the server receives the page switching request message from the client's configuration software.
[0065] Configuration software is software for data acquisition and process control. It is the software at the monitoring layer of an automatic control system. Through a flexible component approach, it can provide users with the ability to quickly build monitoring functions for industrial automatic control systems. In this embodiment, the configuration software is CONTRIX PLUS, which supports FBD, LD, and ST programming languages. Of course, other configuration software can also be used, and no specific limitations are made in this embodiment.
[0066] Optionally, the configuration software can be deployed in a front-end and back-end separation mode and deployed within the client. The data in the configuration software can be called configuration data.
[0067] S202 uses a pre-built public session component to parse the page switching request message and obtain the request parameters.
[0068] The pre-built public session component in the server receives the page switching request message sent by the client from the configuration software, parses the page switching request message, and obtains the request parameters in the page switching request message.
[0069] In this embodiment, the page switching request can be an HTTP request, but it can also be other request types; no specific limitations are imposed in this embodiment. When the page switching request is an HTTP request, the public session component in the server can obtain the information contained in the HTTP request message. Among the multiple pieces of information contained in the message, the information containing the body portion can be selected, and then the request parameters in the page switching request message can be obtained.
[0070] The request parameters may include: information from the first page and information from the second page. The information from the first page refers to the current page, while the information from the second page refers to the target page.
[0071] S203, Based on the information on the first page, obtain the menu information of the first page.
[0072] In this embodiment, the server can cache all information displayed on historical pages. Therefore, the server's cache stores the information displayed on the first page, i.e., the menu information of the first page. When the server receives the information of the first page in the page change request message, it can retrieve the menu information of the first page from the cache based on this information.
[0073] Specifically, the information of the first page includes the page type and the page identifier of the first page. The menu information of the first page includes the menu content and the menu status of the first page. The server retrieves the menu content corresponding to the page type of the first page from the cache. Simultaneously, the server also retrieves the menu status corresponding to the page identifier of the first page from the cache. Of course, the information of the first page may also include other page information, and correspondingly, the menu information of the first page may also include other menu information; however, this embodiment does not impose specific limitations.
[0074] S204, If the request parameters include component indication information, then based on the information on the second page, the target series of session components indicated by the component indication information are used to obtain the first menu information of the second page.
[0075] The common session component parses the page switching request message. The request parameters, in addition to information about the first and second pages, may include other information. If the request parameters include component indication information, it indicates that the page switching request is a strongly related request to a series, meaning it is strongly related to the controller series and requires processing through the corresponding series session component. Therefore, the common session component needs to forward the page switching request message to the series session component corresponding to the component indication information, where the request will be processed.
[0076] The public session component forwards the page switching request to the target series session component indicated by the component indication information according to the component indication information. For example, if the component indication information is 1, the page switching request can be forwarded to the series 1 session component indicated by the component indication information. At this time, the target series session component is the series 1 session component.
[0077] The target series session component obtains the first menu information of the second page based on the information of the second page in the request parameters. In this embodiment, the server stores the menu information of multiple pages corresponding to each session component, that is, the target series session component also corresponds to the menu information of multiple pages. Therefore, the target series session component can select and obtain the first menu information of the second page corresponding to the information of the second page from the menu information of its multiple corresponding pages based on the information of the second page.
[0078] Specifically, the information on the second page includes the page type and page identifier of the second page. The first menu information on the second page includes the first menu content and first menu status of the second page. The target series session component obtains the first menu content of the second page corresponding to the page type based on the page type. Simultaneously, the target series session component also obtains the first menu status of the second page corresponding to the page identifier based on the page identifier. Of course, the information on the second page may also include other page information, and correspondingly, the menu information on the second page may also include other menu information; however, no specific limitations are imposed in this embodiment.
[0079] S205, Generate first menu loading information based on the first menu information.
[0080] The client sends a page switching request message to switch the configuration software from the first page to the second page in order to dynamically load the menu information in the page. Therefore, in this embodiment, the first menu loading information can be generated based on the first menu information of the second page, and then the first page can be switched to the second page based on the first menu loading information.
[0081] Alternatively, in one possible implementation, the first menu loading information can be the first menu information.
[0082] S206, send the first page switching response message to the client.
[0083] The first page switching response message includes: first menu loading information, which is used to enable the client to load the first menu loading information and switch the configuration software from the first page to the second page.
[0084] After receiving a page switching request from a client, the server needs to respond to the client with the processing result of the page switching request, or send a response message corresponding to the processing result back to the client. In this embodiment, the processing result of the target series session component for the page switching request is the first menu loading information. Therefore, the target series session component sends the first menu loading information as the first page switching response message to the client.
[0085] The response message may also include other information. For example, the response message may include: menu ID, menu content, icon, menu type, menu status, whether it is enabled, whether it is visible, whether it has been clicked and selected, shortcut key, callback function of the front-end processing menu call, etc. No specific limitation is made in this application embodiment.
[0086] Optionally, other information in the response message may be appended after the first menu loading information, or the first menu loading information may be appended to the end of the response message. The first menu loading information may also be in other positions in the response message, and no specific restrictions are imposed in this embodiment.
[0087] This application provides a method for dynamically loading menus, in which the server generates the first menu loading information and sends it to the client. This not only reduces the pressure on the client but also improves the efficiency of dynamic menu loading. At the same time, the menu information of multiple controller series corresponds to multiple independent and different series session components, so that the menu information corresponding to each controller series is independent and does not affect each other. This enables the separate installation and uninstallation of the menu information of the session component corresponding to a single project.
[0088] In the above Figure 2 Based on the aforementioned method for dynamically loading menus, this application embodiment also provides another method for implementing a dynamic menu loading method. Optionally, the component indication information is the series identifier of the controller corresponding to the configuration software. Before obtaining the first menu information of the second page by using the target series session component indicated by the component indication information according to the information on the second page, the method further includes:
[0089] A common session component is used, and the series session component corresponding to the series identifier is determined from multiple series session components as the target series session component based on the series identifier.
[0090] For example, if the component indication information is 1, then the series identifier of the corresponding controller in the configuration software is 1. Based on the series identifier, the series session component corresponding to the series identifier can be determined from multiple series session components as the series 1 session component. That is, the target series session component corresponding to the component indication information of 1 is the series 1 session component.
[0091] Optionally, in this embodiment of the application, if the parsed page switching request message includes: suc = 1, where suc is used to represent the identifier name of the series identifier of the controller corresponding to the configuration software, when the common session component detects that the parsed page switching request message contains the identifier name suc, the component indication information is the series identifier 1 corresponding to the identifier name suc, and then the series session component corresponding to the series identifier 1 can be determined from multiple series session components according to the series identifier 1 as the series 1 session component, that is, the target series session component.
[0092] This application provides a method for dynamically loading menus. The component indication information is the series identifier of the controller corresponding to the configuration software. Before obtaining the first menu information of the second page by using the target series session component indicated by the component indication information according to the information of the second page, the method further includes: using a common session component, determining the series session component corresponding to the series identifier as the target series session component from multiple series session components according to the series identifier. Therefore, this application can handle menu requests for multiple different controller series by their respective corresponding target series session components, realizing mutual isolation between series session components.
[0093] In the above Figure 2 Based on the aforementioned method for dynamically loading menus, this application embodiment also provides another implementation method for dynamically loading menus, optionally... Figure 3 A flowchart illustrating another method for dynamically loading menus provided in this application embodiment is shown below. Figure 3 As shown, the component indication information is the identifier of the controller corresponding to the configuration software. Before obtaining the first menu information of the second page by using the target series session component indicated by the component indication information according to the information on the second page in method S204, the method further includes:
[0094] S301 uses a common session component to determine the controller's series identifier based on the controller's identifier.
[0095] In this embodiment of the application, the server stores the correspondence between the controller identifier and the controller series identifier, and obtains the controller series identifier corresponding to the controller identifier based on the controller identifier and the correspondence.
[0096] For example, in this embodiment of the application, if the parsed page switching request message does not include suc, but includes id=01, where id is used to represent the identifier name of the controller corresponding to the configuration software, when the common session component detects that the parsed page switching request message contains the identifier name id, the component indication information is the identifier 01 corresponding to the identifier name id. The common session component can determine that the suc corresponding to id=01 is 1 according to the correspondence between suc and id stored in the server, that is, the series identifier of the controller corresponding to the identifier 01 of the controller is 1.
[0097] S302, Based on the series identifier, determine the series session component corresponding to the series identifier as the target series session component from multiple series session components.
[0098] After determining the series identifier of the controller based on the controller's identifier, the series session component corresponding to the series identifier can be selected as the target series session component from multiple series session components based on the series identifier.
[0099] This application provides a method for dynamically loading menus. The component indication information is the identifier of the controller corresponding to the configuration software. A common session component is used. Based on the controller identifier, the series identifier of the controller is determined. Based on the series identifier, the series session component corresponding to the series identifier is determined from multiple series session components as the target series session component. If the request does not contain the controller series identifier, the controller series identifier corresponding to the controller identifier can be determined based on the controller identifier in the request and the correspondence between the controller series identifier and the controller identifier stored in the server. Thus, the target series session component is determined. This method solves the problem of request processing when the client thinks the request is unrelated to the controller series, while the server thinks the request is related to the controller series.
[0100] In the above Figure 2 Based on the aforementioned method for dynamically loading menus, this application embodiment also provides another implementation method for dynamically loading menus, optionally... Figure 4 A flowchart illustrating another method for dynamically loading menus provided in this application embodiment is shown below. Figure 4 As shown, the method also includes:
[0101] S401, If the request parameters do not include component indication information, then the second menu information of the second page is obtained by using the public session component based on the information of the second page.
[0102] If the request parameters do not include component indication information, it indicates that the page switching request is not strongly related to the series, meaning that the request is not strongly related to the controller series. In other words, requests not strongly related to the series can be handled by the common session component. Therefore, when the common session component receives this page switching request message, it processes the request directly and does not need to forward the page switching request message to the series session component corresponding to the component indication information. The fact that requests not strongly related to the series are handled by the common session component can be understood as similarly, that common menu requests are handled by the common session component.
[0103] The public session component obtains the second menu information of the second page based on the information of the second page in the request parameters. In this embodiment, the server stores the menu information of multiple pages corresponding to each session component, that is, the public session component also corresponds to the menu information of multiple pages. Therefore, the public session component can select and obtain the second menu information of the second page corresponding to the information of the second page from the menu information of its multiple corresponding pages based on the information of the second page.
[0104] Specifically, the information on the second page includes the page type and page identifier of the second page, and the information on the second menu includes the content and status of the second menu. The public conversation component obtains the content of the second menu corresponding to the page type, and also obtains the status of the second menu corresponding to the page identifier.
[0105] S402, Generate second menu loading information based on the second menu information.
[0106] Alternatively, in one possible implementation, the second menu loading information can be second menu information.
[0107] S403 sends a second page switching response message to the client.
[0108] The second page switching response message includes: second menu loading information, which is used to enable the client to load the second menu loading information and switch the configuration software from the first page to the second page.
[0109] The public session component processes the page switching request and returns the second menu loading information. Therefore, the public session component sends this second menu loading information to the client as the second page switching response message.
[0110] This application provides a method for dynamically loading menus. If the request parameters do not include component indication information, the method uses a common session component to obtain the second menu information of the second page based on the information of the second page. Based on the second menu information, second menu loading information is generated, and a second page switching response message is sent to the client. The second page switching response message includes the second menu loading information, which is used to enable the client to load the second menu loading information and switch the configuration software from the first page to the second page. In this method, all common menu requests are handled by the common session component, eliminating the need to forward page switching requests, thus improving request processing efficiency. At the same time, extracting common items from multiple series of session components to form a common session component can save server resources.
[0111] In the above Figure 2 Based on the aforementioned method for dynamically loading menus, this application embodiment also provides another implementation method for dynamically loading menus, optionally... Figure 5 A flowchart illustrating another method for dynamically loading menus provided in this application embodiment is shown below. Figure 5 As shown, before method S201 above, and before receiving the configuration software switching page request message sent by the client, the method further includes:
[0112] S501 uses a common session component to load the common menu configuration file of the configuration software and obtain the common menu information of the configuration software.
[0113] In this embodiment of the application, when the server starts, it loads a menu configuration file. The menu information configuration file is divided into a common part and a series part. The common part can be called the common menu configuration file. The common menu configuration file is loaded by the common session component.
[0114] The public menu configuration file may include public menu information, and of course, it may also include other information, which is not specifically limited in this embodiment.
[0115] S502, using at least one series of session components, load at least one series of menu configuration files of the configuration software to obtain at least one series of menu information of the configuration software.
[0116] The menu information configuration file is divided into a common section and a series section, which can be called the series menu configuration file. When the server starts up, it can load all series menu configuration files. Multiple different series menu configuration files are loaded by multiple different series session components.
[0117] Specifically, multiple different series of session components in the server can load their respective series of menu configuration files to obtain multiple different series of menu information.
[0118] Multiple different series menu configuration files may include multiple different series menu information. Of course, other information may also be included, but no specific limitations are made in this application embodiment.
[0119] In the embodiments of this application, it can be understood that the order of loading the public menu configuration file and loading the series menu configuration file is not limited to the above steps S501 and S502. It can also be that step S502 is performed first and then step S501. No specific restrictions are made in the embodiments of this application.
[0120] S503 sends the menu information of the first page to each client.
[0121] The menu information on the first page includes: common menu information and a corresponding series of menu information. The menu information on the first page is used to enable each client to load the common menu information and the corresponding series of menu information, and to display the first page of the configuration software.
[0122] Optionally, after the server loads the menu information configuration file, it can send the public menu information corresponding to the public session component to the client. At the same time, based on the series of controllers corresponding to the current configuration software, it can also send the series menu information of the corresponding series session component to the client, so that the client's current page is the first page of the configuration software, and then the client can send a page switching request based on the first page.
[0123] This application provides a method for dynamically loading menus. It employs a common session component to load the common menu configuration file of the configuration software, obtaining the common menu information of the configuration software. It also employs at least one series session component to load at least one series menu configuration file of the configuration software, obtaining at least one series menu information of the configuration software. Finally, it sends the menu information of a first page to each client. The menu information of the first page includes: common menu information and a corresponding series menu information. The menu information of the first page is used to enable each client to load the common menu information and the corresponding series menu information, displaying the first page of the configuration software, allowing the client to send a page switching request based on the first page.
[0124] In the above Figure 2 Based on the aforementioned method for dynamically loading menus, this application embodiment also provides another method for implementing a dynamic menu loading method. Optionally, the request parameters further include: the language type displayed by the client. In method S205, first menu loading information is generated based on the first menu information, including:
[0125] Generate first menu loading information based on the first menu information and language type.
[0126] The server caches or stores the content of all supported language packs. For example, this could be a text language pack, an English language pack, or other language packs; no specific limitations are made in this embodiment. Each language pack contains relevant information about that language.
[0127] The server can retrieve the language pack content corresponding to the language type displayed on the client, and then generate the first menu loading information for that language type based on the language pack content and the first menu information. Therefore, the language type of the first menu loading information is the same as the language type of the content displayed on the client. When the server sends the first page switching response message to the client, the first page switching response message includes the first menu loading information corresponding to that language type, thus achieving language type uniformity.
[0128] Optionally, in the code implementation layer, when generating the first menu loading information, the content of the language identifier corresponding to the first menu loading information can be replaced with the language type displayed by the client. In addition, the language pack content corresponding to the language type needs to be imported to generate the first menu loading information corresponding to the language type.
[0129] This application provides a method for dynamically loading menus, in which the request parameters also include: the language type displayed on the client. Based on the first menu information and the language type, first menu loading information is generated, thereby realizing language switching of the content and ensuring that the language type of the generated first menu loading information is consistent with the language type displayed on the client, thus achieving language type unification.
[0130] Based on the menu dynamic loading method provided in all the above embodiments, this application embodiment also provides another implementation method for the menu dynamic loading method. Optionally, the request parameters further include: the language type displayed by the client. In the above method S205, the first menu loading information is generated according to the first menu information, including:
[0131] Based on the menu information on the first page and the first menu information, generate menu change information. The first menu loading information includes: menu change information.
[0132] Optionally, the first menu information is the first menu information of the second page. When switching from the first page to the second page, the first menu information of the second page can be returned to the client as the first menu loading information, so that the client's page displays the first menu information of the second page.
[0133] In this embodiment, the menu information of the first page can be compared with the first menu information of the second page to find the menu information that has changed and generate menu change information. At this time, the menu change information can be returned to the client as the first menu loading information, so that the client can modify the menu information of the first page according to the menu change information to obtain the first menu information of the second page.
[0134] Before sending each response message, the server can check for changes in the menu information of the first page and then send the menu change information to the client via the response message. The client then incrementally updates the menu information. Optionally, if the first page is located within the control station, i.e., the request for the first page is a strongly related request in a series, the corresponding series session component calculates the changed menu information and sends it to the client as the first menu loading information. Otherwise, the common session component calculates the changed menu information and sends it to the client as the first menu loading information.
[0135] For example, when the client's configuration software switches to any page, it sends a page switch request to the server. The server returns the menu content and status of the current page. The server determines whether the page switch request is related to or unrelated to the series based on whether the request contains component indication information. If it is unrelated to the series, the server processes the page switch request through the common session component, calculates the changed menu information, and sends the menu change information to the client. If it is related to the series, the server forwards the page switch request to the series session component corresponding to the component indication information to process the page switch request, calculates the changed menu information, and sends the menu change information to the client.
[0136] For example, when the client's configuration software switches to a certain program page, there is a menu item whose paste state is grayed out and cannot be clicked. When the client sends a copy function block request and the server returns a success message, it checks whether the menu information of the current page has changed. If the menu state in the menu information has changed, the new state of the pasted menu item is returned to the client, so that the client can modify the information of the current page according to the new state of the pasted menu item.
[0137] This application provides a method for dynamically loading menus. Based on the menu information of the first page and the first menu information, menu change information is generated. The first menu loading information includes menu change information. This method enables incremental return of menu information, reduces the amount of data communication between the client and the server without affecting functionality, and improves the efficiency of dynamic menu loading.
[0138] The following describes a menu dynamic loading device, server, and storage medium provided in this application for execution. The specific implementation process and technical effects are described above and will not be repeated below.
[0139] Figure 6 This is a schematic diagram of a menu dynamic loading device provided in an embodiment of this application, as shown below. Figure 6 As shown, the menu dynamic loading device includes:
[0140] The receiving module 601 is used to receive the page switching request message of the configuration software sent by the client.
[0141] The parsing module 602 is used to parse the page switching request message using a pre-built public session component to obtain the request parameters, which include: information of the first page and information of the second page.
[0142] The acquisition module 603 is used to obtain the menu information of the first page based on the information of the first page.
[0143] The module 604 is used to obtain the first menu information of the second page by using the target series of session components indicated by the component indication information, based on the information of the second page, if the request parameters include component indication information.
[0144] The first generation module 605 is used to generate first menu loading information based on the first menu information.
[0145] The sending module 606 is used to send a first page switching response message to the client. The first page switching response message includes: first menu loading information. The first menu loading information is used to enable the client to load the first menu loading information and switch the configuration software from the first page to the second page.
[0146] Optionally, module 604 is further configured to use a common session component to determine the series session component corresponding to the series identifier as the target series session component from multiple series session components based on the series identifier.
[0147] Optionally, module 604 is further configured to use a common session component to determine the series identifier of the controller based on the identifier of the controller; and to determine the series session component corresponding to the series identifier as the target series session component from multiple series session components based on the series identifier.
[0148] The second generation module 607 is used to obtain the second menu information of the second page by using a public session component based on the information of the second page if the request parameters do not include component indication information, generate second menu loading information based on the second menu information, and send a second page switching response message to the client. The second page switching response message includes the second menu loading information, which is used to enable the client to load the second menu loading information and switch the configuration software from the first page to the second page.
[0149] Optionally, the receiving module 601 is further configured to use a common session component to load the common menu configuration file of the configuration software to obtain the common menu information of the configuration software, use at least one series session component to load at least one series menu configuration file of the configuration software to obtain at least one series menu information of the configuration software, and send the menu information of the first page to each client. The menu information of the first page includes: common menu information and a corresponding series menu information. The menu information of the first page is used to enable each client to load the common menu information and the corresponding series menu information and display the first page of the configuration software.
[0150] Optionally, the first generation module 605 is specifically used to generate first menu loading information based on the first menu information and language type.
[0151] Optionally, the first generation module 605 is specifically used to generate menu change information based on the menu information of the first page and the first menu information. The first menu loading information includes: menu change information.
[0152] These modules can be one or more integrated circuits configured to implement the above methods, such as one or more Application Specific Integrated Circuits (ASICs), one or more digital signal processors (DSPs), or one or more Field Programmable Gate Arrays (FPGAs). Alternatively, when a module is implemented using processing element scheduler code, the processing element can be a general-purpose processor, such as a Central Processing Unit (CPU) or other processor capable of calling program code. Furthermore, these modules can be integrated together as a system-on-a-chip (SOC).
[0153] Figure 7 This is a schematic diagram of a server provided in an embodiment of this application. The server can be integrated into a computing device with computing processing capabilities.
[0154] The server includes a processor 701, a storage medium 702, and a bus 703. The processor 701 and the storage medium 702 are connected via the bus 703.
[0155] Storage medium 702 is used to store programs, and processor 701 calls the programs stored in storage medium 702 to execute the above method embodiments. The specific implementation and technical effects are similar, and will not be described again here.
[0156] Optionally, the present invention also provides a program product, such as a computer-readable storage medium, including a program that, when executed by a processor, is used to perform the above-described method embodiments.
[0157] In the several embodiments provided by this invention, it should be understood that the disclosed apparatus and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between apparatuses or units may be electrical, mechanical, or other forms.
[0158] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0159] Furthermore, the functional units in the various embodiments of the present invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or in the form of hardware plus software functional units.
[0160] The integrated units implemented as software functional units described above can be stored in a computer-readable storage medium. These software functional units, stored in a storage medium, include several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) or processor to execute some steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0161] The above are merely specific embodiments of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
Claims
1. A method for dynamically loading menus, characterized in that, The method includes: By using a common session component, the common menu configuration file of the configuration software is loaded to obtain the common menu information of the configuration software; At least one series of session components are used to load at least one series of menu configuration files of the configuration software to obtain at least one series of menu information of the configuration software; The menu information of the first page is sent to each client. The menu information of the first page includes: the public menu information and a corresponding series of menu information. The menu information of the first page is used to enable each client to load the public menu information and the corresponding series of menu information and display the first page of the configuration software. Receive the page switching request message for the configuration software sent by the client; The pre-built public session component is used to parse the page switching request message to obtain request parameters, which include: information of the first page and information of the second page; Based on the information on the first page, obtain the menu information of the first page; If the request parameters include component indication information, then based on the information of the second page, the target series of session components indicated by the component indication information are used to obtain the first menu information of the second page; Generate first menu loading information based on the first menu information; Send a first page switching response message to the client. The first page switching response message includes: first menu loading information. The first menu loading information is used to enable the client to load the first menu loading information and switch the configuration software from the first page to the second page. The component indication information is the series identifier of the controller corresponding to the configuration software; before obtaining the first menu information of the second page by using the target series session component indicated by the component indication information according to the information of the second page, the method further includes: Using the public session component, the series session component corresponding to the series identifier is determined from multiple series session components as the target series session component based on the series identifier.
2. The menu dynamic loading method according to claim 1, characterized in that, The component indication information is the identifier of the controller corresponding to the configuration software; before obtaining the first menu information of the second page by using the target series session components indicated by the component indication information based on the information of the second page, the method further includes: Using the public session component, the series identifier of the controller is determined based on the identifier of the controller; Based on the series identifier, the series session component corresponding to the series identifier is determined from multiple series session components as the target series session component.
3. The menu dynamic loading method according to claim 1, characterized in that, The method further includes: If the request parameters do not include the component indication information, then the second menu information of the second page is obtained by using the public session component based on the information of the second page; Based on the second menu information, generate second menu loading information; A second page switching response message is sent to the client. The second page switching response message includes: second menu loading information. The second menu loading information is used to enable the client to load the second menu loading information and switch the configuration software from the first page to the second page.
4. The menu dynamic loading method according to claim 1, characterized in that, The request parameters also include: the language type displayed by the client; The step of generating first menu loading information based on the first menu information includes: Generate the first menu loading information based on the first menu information and the language type.
5. The menu dynamic loading method according to any one of claims 1-4, characterized in that, The step of generating first menu loading information based on the first menu information includes: Based on the menu information of the first page and the first menu information, menu change information is generated, and the first menu loading information includes the menu change information.
6. A menu dynamic loading device, characterized in that, include: The receiving module is used to receive page switching request messages from the client's configuration software; The parsing module is used to parse the page switching request message using a pre-built public session component to obtain request parameters, which include: information of the first page and information of the second page; The acquisition module is used to acquire the menu information of the first page based on the information of the first page; The module is configured to, if the request parameters include component indication information, obtain the first menu information of the second page by using the target series of session components indicated by the component indication information, based on the information of the second page; The generation module is used to generate first menu loading information based on the first menu information; The sending module is used to send a first page switching response message to the client. The first page switching response message includes: first menu loading information. The first menu loading information is used to enable the client to load the first menu loading information and switch the configuration software from the first page to the second page. The component indication information is the series identifier of the controller corresponding to the configuration software; the obtaining module is further configured to: use the common session component, and determine the series session component corresponding to the series identifier as the target series session component from multiple series session components according to the series identifier; The receiving module is also used to load the configuration software's public menu configuration file using the public session component to obtain the configuration software's public menu information; At least one series of session components are used to load at least one series of menu configuration files of the configuration software to obtain at least one series of menu information of the configuration software; The menu information of the first page is sent to each of the clients. The menu information of the first page includes: the public menu information and a corresponding series of menu information. The menu information of the first page is used to enable each of the clients to load the public menu information and the corresponding series of menu information and display the first page of the configuration software.
7. A server, characterized in that, include: A storage medium and a processor, wherein the storage medium stores a computer program executable by the processor, and the processor executes the computer program to implement the menu dynamic loading method according to any one of claims 1-5.
8. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program, which, when read and executed, implements the menu dynamic loading method according to any one of claims 1-5.