CN113254237A - Front-end application calling method, device, storage medium and program product - Google Patents

Front-end application calling method, device, storage medium and program product Download PDF

Info

Publication number
CN113254237A
CN113254237A CN202110656431.3A CN202110656431A CN113254237A CN 113254237 A CN113254237 A CN 113254237A CN 202110656431 A CN202110656431 A CN 202110656431A CN 113254237 A CN113254237 A CN 113254237A
Authority
CN
China
Prior art keywords
application
target sub
sub
main
information
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202110656431.3A
Other languages
Chinese (zh)
Inventor
王少华
武红强
崔凤丽
张涛
李亚宁
林洪东
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Haier Digital Technology Qingdao Co Ltd
Haier Caos IoT Ecological Technology Co Ltd
Original Assignee
Haier Digital Technology Qingdao Co Ltd
Haier Caos IoT Ecological Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Haier Digital Technology Qingdao Co Ltd, Haier Caos IoT Ecological Technology Co Ltd filed Critical Haier Digital Technology Qingdao Co Ltd
Priority to CN202110656431.3A priority Critical patent/CN113254237A/en
Publication of CN113254237A publication Critical patent/CN113254237A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/70Software maintenance or management
    • G06F8/71Version control; Configuration management

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Security & Cryptography (AREA)
  • Stored Programmes (AREA)

Abstract

The invention provides a front-end application calling method, equipment, a storage medium and a program product.A front-end service is divided into sub-modules, each sub-application can be independently deployed, independently developed and independently operated, the target sub-application is called as required through a service platform, target sub-application information is obtained, and the target sub-application is registered on a main application according to the target sub-application information so as to be mounted on the main application; and controlling the target sub-application to display a corresponding page on the main application according to the configuration information of the main application. The software development efficiency is improved in the front-end software development process, the front-end development process is simplified, and the time cost caused by complex development environment and overstaffed code logic is reduced; the sub-applications are independent from each other, so that the sub-application problem can be responded to in time, and the influence range is minimized; in addition, the sub-application can display the corresponding content according to the configuration information of the main application, and does not need to manually configure and display the corresponding page.

Description

Front-end application calling method, device, storage medium and program product
Technical Field
The invention belongs to the technical field of household appliances, and particularly relates to a front-end application calling method, front-end application calling equipment, a storage medium and a program product.
Background
Currently, the mainstream software development method in the industry is to separate front and back ends, a back-end service can adopt a micro-service mode, and a front-end service is usually constructed in one project, so that the back-end service can be decoupled, and the front-end service is coupled together.
In the prior art, with the continuous development of services, software functions are abundant continuously, front ends are bloated more and more, development, maintenance and deployment costs are higher and higher, complexity is higher and higher, technical debt of application programs is gradually formed, the online deployment frequency is reduced, reliability is poor, and technical innovation is hindered.
Disclosure of Invention
The invention provides a front-end application calling method, a device, a storage medium and a program product, which aim to solve the independence between front-end services, meet the calling requirement of an application and enable a user to construct an application program as required.
The first aspect of the present invention provides a front-end application calling method, which is applied to a business system, where the business system includes a sub-application library and at least one main application, the sub-application library includes a plurality of sub-applications isolated from each other, each sub-application is a front-end application, each main application is a business platform, and the method is applied to a device where the main application is located, and the method includes:
receiving a call instruction of any target sub-application in the sub-application library;
acquiring target sub-application information according to the calling instruction, and registering a target sub-application on the main application according to the target sub-application information so as to mount the target sub-application on the main application;
and sending configuration information to the target sub-application according to the target sub-application information so that the target sub-application displays a corresponding page on the main application.
Optionally, the obtaining target sub-application information according to the call instruction, and registering a target sub-application on the main application according to the target sub-application information includes:
controlling the target sub-application to run a registration program in the target sub-application according to the calling instruction, and receiving the target sub-application information sent by the target sub-application, wherein the target sub-application information comprises at least one of the following items: the name, interface, container, main entry path, input data information, deployment address and routing information of the target sub-application;
and mounting on the main application according to the target sub-application information.
Optionally, the target sub-application information includes description information of the target sub-application, where the description information includes a function and/or a menu of the target sub-application;
the sending configuration information to the target sub-application according to the target sub-application information to enable the target sub-application to display a corresponding page on the main application includes:
sending configuration information to the target sub-application according to the description information of the target sub-application;
and acquiring the page content of the target sub-application corresponding to the configuration information, and rendering the page content of the target sub-application on the main application.
Optionally, there are at least two of the target sub-applications; the method further comprises the following steps:
receiving a mutual calling instruction between a first target sub application and a second target sub application in the at least two target sub applications;
and receiving the output parameters of the output interface of the first target sub-application by the main application according to the mutual calling instruction, and inputting the output parameters to the input interface of the second target sub-application.
Optionally, the method further includes:
receiving access requests of users to the at least two target sub-applications, and caching corresponding access paths;
and after receiving a backspacing instruction of a user, sequentially backspacing according to the access path.
Optionally, the method further includes:
and acquiring the preloaded content of the target sub-application in the idle time of the main application, and rendering the preloaded content of the target sub-application on the main application in advance.
Optionally, the method further includes:
receiving an update instruction sent by the target sub-application, wherein the update instruction is sent by the target sub-application to the main application after the target sub-application migrates the target equipment from the current equipment, and the update instruction comprises a deployment address and/or routing information of the target equipment;
and controlling the main application to update the target sub-application information according to the update instruction.
Optionally, the method further includes:
receiving an uninstalling instruction of the target sub-application;
and according to the uninstalling instruction, uninstalling the target sub-application from the main application.
Optionally, the target sub-application information includes a lifecycle hook function; the method further comprises the following steps:
calling the life cycle hook function by the main application in a heartbeat mode to obtain the state of the target sub-application, wherein the state of the target sub-application comprises the following steps: unmounted, mounted, or uninstalled;
and monitoring the life cycle of the target sub-application according to the state of the target sub-application.
A second aspect of the present invention provides a front-end application invoking device, which is applied to a service system, where the service system includes a sub-application library and at least one main application, the sub-application library includes a plurality of sub-applications isolated from each other, each sub-application is a front-end application, each main application is a service platform, and the device is applied to a device where the main application is located, and the device includes:
the communication module is used for receiving a calling instruction of any target sub-application in the sub-application library;
the processing module is used for acquiring target sub-application information according to the calling instruction, registering target sub-applications on the main application according to the target sub-application information, and mounting the target sub-applications on the main application;
and the display module is used for sending configuration information to the target sub-application according to the target sub-application information so as to enable the target sub-application to display a corresponding page on the main application.
Optionally, the processing module, when obtaining the target sub-application information according to the call instruction and registering the target sub-application on the main application according to the target sub-application information, is configured to:
controlling the target sub-application to run a registration program in the target sub-application according to the calling instruction, and receiving the target sub-application information sent by the target sub-application, wherein the target sub-application information comprises at least one of the following items: the name, interface, container, main entry path, input data information, deployment address and routing information of the target sub-application;
and mounting on the main application according to the target sub-application information.
Optionally, the target sub-application information includes description information of the target sub-application, where the description information includes a function and/or a menu of the target sub-application;
the display module is configured to, when sending configuration information to the target sub-application according to the target sub-application information to enable the target sub-application to display a corresponding page on the main application,:
sending configuration information to the target sub-application according to the description information of the target sub-application;
and acquiring the page content of the target sub-application corresponding to the configuration information, and rendering the page content of the target sub-application on the main application.
Optionally, there are at least two of the target sub-applications;
the communication module is further used for receiving a mutual calling instruction between a first target sub-application and a second target sub-application in the at least two target sub-applications;
the processing module is further configured to receive, by the main application according to the mutual invocation instruction, an output parameter of the output interface of the first target sub-application, and input the output parameter to the input interface of the second target sub-application.
Optionally, the communication module is further configured to receive an access request of a user to the at least two target sub-applications, and cache a corresponding access path;
and the processing module is also used for sequentially backing according to the access path after receiving a backing instruction of a user.
Optionally, the display module is further configured to obtain the preloaded content of the target sub-application during idle time of the primary application, and render the preloaded content of the target sub-application on the primary application in advance.
Optionally, the communication module is further configured to receive an update instruction sent by the target sub-application, where the update instruction is sent by the target sub-application to the main application after migrating the target device from the current device, and the update instruction includes a deployment address and/or routing information of the target device;
and the processing module is further used for controlling the main application to update the target sub-application information according to the update instruction.
Optionally, the communication module is further configured to receive an uninstall instruction for the target sub-application;
the processing module is further configured to uninstall the target sub-application from the main application according to the uninstalling instruction.
Optionally, the target sub-application information includes a lifecycle hook function;
the processing module is further configured to invoke, by the main application, the lifecycle hook function in a heartbeat manner, and obtain a state of the target sub-application, where the state of the target sub-application includes: unmounted, mounted, or uninstalled; and monitoring the life cycle of the target sub-application according to the state of the target sub-application.
A third aspect of the present invention is to provide an electronic apparatus, comprising:
a memory for storing a computer program;
a processor for executing a computer program stored in the memory to implement the method according to the first aspect.
A fourth aspect of the present invention is to provide a computer-readable storage medium having stored thereon a computer program;
which when executed by a processor implements the method according to the first aspect.
A fifth aspect of the invention provides a computer program product comprising a computer program;
which when executed by a processor implements the method according to the first aspect.
The front-end application calling method, the front-end application calling equipment, the storage medium and the program product provided by the invention receive a calling instruction of any target sub-application in the sub-application library; acquiring target sub-application information according to the calling instruction, and registering a target sub-application on the main application according to the target sub-application information so as to mount the target sub-application on the main application; and sending configuration information to the target sub-application according to the target sub-application information so that the target sub-application displays a corresponding page on the main application. In the embodiment, the front-end service is split into the sub-modules, each sub-application can be independently deployed, independently developed and independently operated, and the target sub-application can be called as required through the service platform, so that the software development efficiency can be obviously improved in the front-end software development process, the front-end development process is simplified, developers only need to pay attention to own service codes, and compared with the non-split front-end sub-application in the prior art, the time cost caused by complex development environment and bloated code logic is greatly reduced; moreover, because the sub-applications are independent, one sub-application has a problem, the running state of other sub-applications on the line is not influenced or is slightly influenced, the sub-application with the problem can be repaired and put on the line only, the problem can be responded in time, and the influence range is minimized; in addition, the sub-application can display the corresponding content according to the configuration information of the main application, and does not need to manually configure and display the corresponding page.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to these drawings without creative efforts.
Fig. 1a is a schematic diagram of a service system architecture according to an embodiment of the present invention;
fig. 1b is a schematic diagram of a service system according to another embodiment of the present invention;
fig. 2 is a flowchart of a front-end application calling method according to an embodiment of the present invention;
fig. 3 is a flowchart of a front-end application calling method according to another embodiment of the present invention;
fig. 4 is a flowchart of a front-end application calling method according to another embodiment of the present invention;
fig. 5 is a flowchart of a front-end application calling method according to another embodiment of the present invention;
fig. 6 is a structural diagram of a front-end application calling device according to an embodiment of the present invention;
fig. 7 is a block diagram of an electronic device according to an embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
Currently, the mainstream software development method in the industry is to separate the front end from the back end, the back end service can adopt a micro service mode, for example, a certain software has three modules of a product, an order and a user, in the micro service mode, the three modules of the product, the order and the user are respectively an independent service, each service can be operated and deployed independently, and the back end service can be decoupled. While the front-end services are usually built into one project, i.e. the front-end services are also coupled together.
In the prior art, with the continuous development of services, the functions of software are abundant, the front end is bloated, the development, maintenance and deployment costs are high, and the following problems are highlighted:
the complexity is high: the whole project contains a great number of modules, the boundaries of the modules are fuzzy, the dependency relationship is not clear, the code quality is uneven, and the modules are stacked together in a chaotic way. It is conceivable that the entire project is very complex. Each time the code is modified, the war is surprised, even a simple function is added, or modification of a Bug brings implicit defects;
technical debt: over time, demand changes, and staffing, the technical debt of an application develops and the more is the product. The system design or code that has been used is difficult to modify because other modules in the application may use it in an unexpected way;
the deployment frequency is low: as code grows, the time to build and deploy also increases. In front-end applications, each change in functionality or repair of a bug may result in the need to redeploy the entire application. The mode of full deployment is long-lasting, influence scope is big, the risk is high, and this makes the frequency of online deployment lower on the project. Due to low deployment frequency, a large amount of function changes and defect repair can be caused between two releases, and the error rate is high;
poor reliability: an application Bug, such as a dead cycle, memory overflow, etc., may cause the crash of the entire application;
hindering the technical innovation: a single front-end application tends to solve all the problems using a unified technology platform or solution, each member of the team must use the same development language and framework, and it can be very difficult to introduce a new framework or new technology platform.
Aiming at the technical problems, the invention decouples the front-end service of the application program, splits the front-end service of the application program into sub-modules, provides a sub-application library, the sub-application library comprises a plurality of sub-applications which are isolated from each other, each sub-application is a front-end application, each sub-application can be independently deployed, independently developed and independently operated, and realizes the calling of the sub-applications as required by a service platform, the service platform is a main application, target sub-application information can be acquired according to a call instruction for any target sub-application in the sub-application library, registering the target sub-application on the main application according to the target sub-application information to mount the target sub-application on the main application, and sending configuration information to the target sub-application according to the target sub-application information so that the target sub-application displays a corresponding page on the main application, thereby constructing the required application program front end.
The front-end application calling method provided by the invention is suitable for a business system architecture shown in figure 1a, and comprises a main application and a sub-application library, wherein each platform is a main application, the platforms can be divided according to business lines, a plurality of sub-applications form the sub-application library, each sub-application in the sub-application library can be called by different main applications, each sub-application in the sub-application library is isolated from each other and can be independently deployed, independently developed and independently operated, the sub-applications required to be called can be registered to the main application according to requirements (unnecessary modules can not be registered), so that the main application mounts the sub-applications, the sub-applications can display different contents according to the configuration information of the main application, and a core module is a necessary module of each main application and can comprise functions of login, registration, authority management and the like; the sub-applications communicate with each other through the exposed hook function and the window (window), and the data required to be transmitted between the sub-applications is transmitted through the main application.
Each sub-application may include more components and tools, and in the example of the sub-application configuration in fig. 1a, it is implemented based on Vue technology stack, and includes various components and general toolkit modules, and the general toolkit modules are developed as separate modules, and are deployed independently, and provide some general components and basic tool classes, including some third party UI components encapsulated again after unifying style, and introduced into engineering as a dependency library in the form of npm package; in addition, the page-level authority is controlled by the Vue Router, and a routing table is filtered according to the user authority, so that the accessed page is controlled; the button-level authority is controlled according to the authority verification instruction (self-defined packaged instruction) provided by the universal toolkit module according to the user authority.
The front-end application calling process is explained and illustrated in detail below with reference to specific embodiments.
Fig. 2 is a flowchart of a front-end application calling method according to an embodiment of the present invention. The embodiment provides a front-end application calling method, which is applied to a business system, wherein the business system comprises a sub-application library and at least one main application, the sub-application library comprises a plurality of mutually isolated sub-applications, each sub-application is a front-end application, each main application is a business platform,
in this embodiment, the front-end service of the application program is decoupled, the front-end service of the application program is split into sub-modules, a sub-application library is provided, the sub-application library includes a plurality of sub-applications isolated from each other, each sub-application is a front-end application, each sub-application can be independently deployed, independently developed, and independently operated, and each sub-application can be deployed on the same server, or on a different server, or on any server in the same network as the main application; the method includes the steps that the sub-applications are called as required through a service platform, one or more sub-applications can be called, the sub-applications can display corresponding content according to configuration information of a main application, optionally, the sub-applications can be displayed in the same interface to share a window object, the sub-applications are isolated from each other, the window object comprises a style isolation, a JS isolation and a resource isolation, and each sub-application runs in a sandbox of the sub-application and does not cause conflict. Alternatively, sub-application module development can be performed based on Vue scaffolding.
Each main application is a service platform, and provides underlying support for sub-applications, the main application may be deployed on an electronic device such as a server, and the main application may include a core module (also referred to as a base module) that includes functions of login, registration, rights management, and the like, and the sub-applications may be registered on the main application and then mounted on the main application, for example, the main application may mount the sub-applications in a url () (Uniform Resource Locator ), and in addition, the main application may also transmit routing information (such as top-level routing information) and some configuration information to the sub-applications through a hook function, and the sub-applications may display corresponding contents according to the configuration information. Optionally, the service system may include at least one platform, that is, at least one main application, where each platform is divided according to a product line, and at least one main application may call each sub-application in the same sub-application library. Optionally, as an example, a complete service system may be as shown in fig. 1b, and include a main application and a plurality of sub-applications.
As shown in fig. 2, the front-end application calling method of this embodiment is applied to a device where a main application is located, where the device may be a server or other electronic devices, and the method includes the following specific steps:
s201, receiving a call instruction of any target sub-application in the sub-application library.
In this embodiment, a user can select which sub-application or sub-applications (denoted as target sub-applications) in the sub-application library to invoke according to a requirement, and a device where the main application is located can receive an instruction of invoking the target sub-application by the user.
S202, acquiring target sub-application information according to the calling instruction, and registering the target sub-application on the main application according to the target sub-application information so as to mount the target sub-application on the main application.
In this embodiment, it may be determined which one or more target sub-applications need to be called according to the call instruction, and then target sub-application information may be obtained, where the target sub-application information may include, but is not limited to, at least one of the following: the name, interface, container, main entry path, input data information, deployment address, routing information of the target sub-application, and optionally, description information of the target sub-application, where the description information includes functions and/or menus of the target sub-application.
Further, the target sub-application can be registered on the main application based on the target sub-application information, so that the target sub-application can be mounted on the main application.
In an optional embodiment, the target sub-application may be controlled to run a registration program in the target sub-application according to the call instruction, and the target sub-application information sent by the target sub-application is received, where the target sub-application information includes at least one of: the name, interface, container, main entry path, input data information, deployment address and routing information of the target sub-application; and then mounting the main application according to the target sub-application information.
Alternatively, the registration procedure may be as follows:
Figure BDA0003113024620000101
by controlling the target sub-program to run the registration program, the target sub-application information can be sent to the main application program, and the main application program registers to mount the target sub-application, specifically, the target sub-application can be mounted in a url manner, and certainly, other manners can be adopted to mount the target sub-application, which is not described herein again.
S203, sending configuration information to the target sub-application according to the target sub-application information so that the target sub-application displays a corresponding page on the main application.
In this embodiment, after the target sub-application is mounted, the main application may send configuration information to the target sub-application according to the target sub-application information, so as to configure what interface the target sub-application displays on the main application.
Optionally, the target sub-application information includes description information of the target sub-application, where the description information includes a function and/or a menu of the target sub-application; as an example, the description information may be described by a menu.
Figure BDA0003113024620000111
Figure BDA0003113024620000121
In this embodiment, complete routing information may be recorded by a menu.
Further, as shown in fig. 3, the sending configuration information to the target sub-application according to the target sub-application information to enable the target sub-application to display a corresponding page on the main application may include:
s2031, sending configuration information to the target sub-application according to the description information of the target sub-application;
s2032, obtaining the page content of the target sub-application corresponding to the configuration information, and rendering the page content of the target sub-application on the main application.
In this embodiment, because the description information of the target sub-application records the function and/or menu of the target sub-application, the page content that needs to be displayed by the target sub-application can be determined according to the recorded information after registration, and then the page content is rendered on the main application, so that the function display or menu display of the target sub-application is realized, manual menu configuration is not needed, and a system administrator only needs to allocate corresponding menu permissions to the roles of the relevant users after the target sub-system is successfully registered.
In the front-end application calling method provided by this embodiment, a calling instruction for any target sub-application in the sub-application library is received; acquiring target sub-application information according to the calling instruction, and registering a target sub-application on the main application according to the target sub-application information so as to mount the target sub-application on the main application; and sending configuration information to the target sub-application according to the target sub-application information so that the target sub-application displays a corresponding page on the main application. In the embodiment, the front-end service is split into the sub-modules, each sub-application can be independently deployed, independently developed and independently operated, and the target sub-application can be called as required through the service platform, so that the software development efficiency can be obviously improved in the front-end software development process, the front-end development process is simplified, developers only need to pay attention to own service codes, and compared with the non-split front-end sub-application in the prior art, the time cost caused by complex development environment and bloated code logic is greatly reduced; moreover, because the sub-applications are independent, one sub-application has a problem, the running state of other sub-applications on the line is not influenced or is slightly influenced, the sub-application with the problem can be repaired and put on the line only, the problem can be responded in time, and the influence range is minimized; in addition, the sub-application can display the corresponding content according to the configuration information of the main application, and does not need to manually configure and display the corresponding page.
As a further refinement of the above embodiment, the target sub-applications have at least two; the method further comprises the following steps:
receiving a mutual calling instruction between a first target sub application and a second target sub application in the at least two target sub applications;
and receiving the output parameters of the output interface of the first target sub-application by the main application according to the mutual calling instruction, and inputting the output parameters to the input interface of the second target sub-application.
In this embodiment, there may be a case that at least two target sub-applications need to be called, and at least two sub-applications need to be called each other, and taking a case that a second target sub-application needs to call an output parameter of a first target sub-application as an example, because the first target sub-application and the second target sub-application are independent from each other, the first target sub-application and the second target sub-application operate in respective sandboxes, and the first target sub-application and the second target sub-application cannot be directly connected to each other, which needs to be implemented by a main application, that is, the main application receives an output parameter of an output interface of the first target sub-program, and then the main application inputs the output parameter to an input interface of the second target sub-application, so as to implement the mutual calling between at least two sub-applications.
On the basis of any of the above embodiments, the method further comprises:
receiving access requests of users to the at least two target sub-applications, and caching corresponding access paths;
and after receiving a backspacing instruction of a user, sequentially backspacing according to the access path.
In this embodiment, a user may access a target sub-application after permission verification, and an access path of the user may be cached in an access process, for example, which function of which sub-application is accessed in a first step, and which function of which sub-application is accessed in a second step, so that when rollback is required, rollback is performed according to the access path, that is, when the user backs to the previous step, which function of which sub-application is accessed in the previous step is directly determined according to the access path, and a page of the function of the sub-application is displayed. Through the process, the problem of how to perform rollback under the condition that the user only accesses different functions of one sub-application can be solved, and the problem of how to perform rollback under the condition that at least two target sub-applications exist in the main application interface and the user respectively accesses the functions of the different sub-applications can also be solved.
On the basis of any of the above embodiments, the method further comprises: and acquiring the preloaded content of the target sub-application in the idle time of the main application, and rendering the preloaded content of the target sub-application on the main application in advance.
In this embodiment, the primary application may preload the pre-request resource of the target sub-application, and may obtain the pre-loaded content of the target sub-application in the idle time of the primary application, and then pre-render the pre-loaded content of the target sub-application on the primary application, so as to improve the opening speed when the contents of the target sub-application are subsequently opened, and improve user experience.
On the basis of any of the above embodiments, as shown in fig. 4, the method further includes:
s301, receiving an update instruction sent by the target sub-application, wherein the update instruction is sent to the main application after the target sub-application migrates a target device from a current device, and the update instruction comprises a deployment address and/or routing information of the target device;
s302, controlling the main application to update the target sub-application information according to the updating instruction.
In this embodiment, since each sub-application is independent and can be deployed to any server in the same network as the main application, the target sub-application can be dynamically switched to the server, that is, the target sub-application is migrated to another server. In this embodiment, after the target sub-application is migrated to the target device, the deployment address and/or the routing information of the target device may be synchronized to the main application, and the main application may update the information of the target sub-application, without affecting the operation of other sub-applications. It should be noted that, if the target sub-application uses domain name information when registering with the main application, the domain name information is not changed after migration, and therefore, an update instruction may not be reported to the main application.
On the basis of any of the above embodiments, the method further comprises: receiving an uninstalling instruction of the target sub-application; and according to the uninstalling instruction, uninstalling the target sub-application from the main application.
In this embodiment, when the target sub-application is not needed or needs to be offline, the target sub-application may be uninstalled, and the main application may uninstall the target sub-application from the main application according to the uninstalling instruction, so as to avoid the front end from being bloated.
On the basis of any of the above embodiments, the target sub-application information includes a life cycle hook function, specifically, the target sub-application may derive the life cycle hook function at its entry js, and the optional life cycle hook function may include three life cycle hook functions of bootstrap, mount, and unmount, and may be used to obtain different states of the target sub-application, including unmounted, mounted, and unmounted; as shown in fig. 5, the method further comprises:
s401, calling the life cycle hook function by the main application in a heartbeat mode to obtain the state of the target sub-application, wherein the state of the target sub-application comprises the following steps: unmounted, mounted, or uninstalled;
s402, monitoring the life cycle of the target sub-application according to the state of the target sub-application.
In this embodiment, the main application may use a heartbeat method, that is, call the life cycle hook function at predetermined intervals to obtain the state of the target sub-application, and of course, the main application may call the life cycle hook function at any other time. Further, the main application may perform lifecycle monitoring on the target sub-application based on the state of the target sub-application, so as to perform corresponding operations such as data management and rendering on the target sub-application in different lifecycles.
The above embodiment will be illustrated below with a specific example:
assume a main application (root), a first sub-application (frame-web), a second sub-application (test-web). The http:// localhost:8080/main is the route of the main application, the fixed prefix of the first sub application (frame-web) is set as '/frame', the fixed prefix of the second sub application (test-web) is set as '/test', when the navigation to the http:// localhost:8080/frame is needed, the first sub application (frame-web) is hung, and after the first sub application resource is loaded, the navigation to the http:// localhost: 8080/frame/login is needed according to the route configuration of the frame-web, so that the navigation from the main application to the sub applications is completed. If then navigation to http:// localhost:8080/test is also required, the main application can uninstall the first sub-application (frame-web) and then mount the second sub-application (test-web) to match the sub-level route of the test.
Taking the second sub-application as an example in the mounting process, the second sub-application is registered in the main application, which specifically includes the following steps:
Figure BDA0003113024620000151
then, a lifecycle function is derived in the second sub-application, that is, routing information (routes) of the second sub-application is registered in the main application, and the second sub-application needs to derive three lifecycle hooks, bootstrap, mount, and unmount, at a portal js of the second sub-application, so that the main application can call at an appropriate time, which is described in detail below.
Figure BDA0003113024620000161
Then, the corresponding page of the second sub-application can be displayed by accessing http:// localhost: 8080/main/test.
Fig. 6 is a structural diagram of a front-end application calling device according to an embodiment of the present invention. The front-end application calling apparatus provided in this embodiment is applied to a service system, where the service system includes a sub-application library and at least one main application, the sub-application library includes a plurality of sub-applications isolated from each other, each sub-application is a front-end application, each main application is a service platform, the apparatus is applied to a device where the main application is located, and the apparatus can execute a processing flow provided in the front-end application calling method embodiment, as shown in fig. 6, the front-end application calling apparatus 600 includes a communication module 601, a processing module 602, and a display module 603.
The communication module is used for receiving a calling instruction of any target sub-application in the sub-application library;
the processing module is used for acquiring target sub-application information according to the calling instruction, registering target sub-applications on the main application according to the target sub-application information, and mounting the target sub-applications on the main application;
and the display module is used for sending configuration information to the target sub-application according to the target sub-application information so as to enable the target sub-application to display a corresponding page on the main application.
Optionally, the processing module, when obtaining the target sub-application information according to the call instruction and registering the target sub-application on the main application according to the target sub-application information, is configured to:
controlling the target sub-application to run a registration program in the target sub-application according to the calling instruction, and receiving the target sub-application information sent by the target sub-application, wherein the target sub-application information comprises at least one of the following items: the name, interface, container, main entry path, input data information, deployment address and routing information of the target sub-application;
and mounting on the main application according to the target sub-application information.
Optionally, the target sub-application information includes description information of the target sub-application, where the description information includes a function and/or a menu of the target sub-application;
the display module is configured to, when sending configuration information to the target sub-application according to the target sub-application information to enable the target sub-application to display a corresponding page on the main application,:
sending configuration information to the target sub-application according to the description information of the target sub-application;
and acquiring the page content of the target sub-application corresponding to the configuration information, and rendering the page content of the target sub-application on the main application.
Optionally, there are at least two of the target sub-applications;
the communication module is further used for receiving a mutual calling instruction between a first target sub-application and a second target sub-application in the at least two target sub-applications;
the processing module is further configured to receive, by the main application according to the mutual invocation instruction, an output parameter of the output interface of the first target sub-application, and input the output parameter to the input interface of the second target sub-application.
Optionally, the communication module is further configured to receive an access request of a user to the at least two target sub-applications, and cache a corresponding access path;
and the processing module is also used for sequentially backing according to the access path after receiving a backing instruction of a user.
Optionally, the display module is further configured to obtain the preloaded content of the target sub-application during idle time of the primary application, and render the preloaded content of the target sub-application on the primary application in advance.
Optionally, the communication module is further configured to receive an update instruction sent by the target sub-application, where the update instruction is sent by the target sub-application to the main application after migrating the target device from the current device, and the update instruction includes a deployment address and/or routing information of the target device;
and the processing module is further used for controlling the main application to update the target sub-application information according to the update instruction.
Optionally, the communication module is further configured to receive an uninstall instruction for the target sub-application;
the processing module is further configured to uninstall the target sub-application from the main application according to the uninstalling instruction.
Optionally, the target sub-application information includes a lifecycle hook function;
the processing module is further configured to invoke, by the main application, the lifecycle hook function in a heartbeat manner, and obtain a state of the target sub-application, where the state of the target sub-application includes: unmounted, mounted, or uninstalled; and monitoring the life cycle of the target sub-application according to the state of the target sub-application.
The front-end application calling device provided in the embodiment of the present invention may be specifically configured to execute the method embodiments provided in fig. 2 to 5, and specific functions are not described herein again.
The front-end application calling device provided by the embodiment of the invention receives a calling instruction of any target sub-application in the sub-application library; acquiring target sub-application information according to the calling instruction, and registering a target sub-application on the main application according to the target sub-application information so as to mount the target sub-application on the main application; and sending configuration information to the target sub-application according to the target sub-application information so that the target sub-application displays a corresponding page on the main application. In the embodiment, the front-end service is split into the sub-modules, each sub-application can be independently deployed, independently developed and independently operated, and the target sub-application can be called as required through the service platform, so that the software development efficiency can be obviously improved in the front-end software development process, the front-end development process is simplified, developers only need to pay attention to own service codes, and compared with the non-split front-end sub-application in the prior art, the time cost caused by complex development environment and bloated code logic is greatly reduced; moreover, because the sub-applications are independent, one sub-application has a problem, the running state of other sub-applications on the line is not influenced or is slightly influenced, the sub-application with the problem can be repaired and put on the line only, the problem can be responded in time, and the influence range is minimized; in addition, the sub-application can display the corresponding content according to the configuration information of the main application, and does not need to manually configure and display the corresponding page.
Fig. 7 is a schematic structural diagram of an electronic device according to an embodiment of the present invention. The electronic device provided in the embodiment of the present invention may execute the processing flow provided in the embodiment of the front-end application calling method, as shown in fig. 7, the electronic device 70 includes a memory 71, a processor 72, and a computer program; wherein the computer program is stored in the memory 71 and configured to be executed by the processor 72 for the front-end application calling method as described in the above embodiments. In addition, the electronic device 70 may also have a communication interface 73 for transmitting data.
The electronic device of the embodiment shown in fig. 7 may be used to implement the technical solution of the above method embodiment, and the implementation principle and technical effect are similar, which are not described herein again.
In addition, the present embodiment also provides a computer-readable storage medium, on which a computer program is stored, where the computer program is executed by a processor to implement the front-end application calling method described in the foregoing embodiment.
In addition, the present embodiment also provides a computer program product, which includes a computer program, where the computer program is executed by a processor to implement the front-end application calling method described in the foregoing embodiment.
In the embodiments provided in the present invention, it should be understood that the disclosed apparatus and method may be implemented in other ways. For example, the above-described apparatus embodiments are merely illustrative, and for example, the division of the units is only one logical division, and other divisions may be realized in practice, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, or in a form of hardware plus a software functional unit.
The integrated unit implemented in the form of a software functional unit may be stored in a computer readable storage medium. The software functional unit is stored in a storage medium and includes several instructions to enable a computer device (which may be a personal computer, a server, or a network device) or a processor (processor) to execute some steps of the methods according to the embodiments of the present invention. And the aforementioned storage medium includes: various media capable of storing program codes, such as a usb disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk, or an optical disk.
It is obvious to those skilled in the art that, for convenience and simplicity of description, the foregoing division of the functional modules is merely used as an example, and in practical applications, the above function distribution may be performed by different functional modules according to needs, that is, the internal structure of the device is divided into different functional modules to perform all or part of the above described functions. For the specific working process of the device described above, reference may be made to the corresponding process in the foregoing method embodiment, which is not described herein again.
Finally, it should be noted that: the above embodiments are only used to illustrate the technical solution of the present invention, and not to limit the same; while the invention has been described in detail and with reference to the foregoing embodiments, it will be understood by those skilled in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some or all of the technical features may be equivalently replaced; and the modifications or the substitutions do not make the essence of the corresponding technical solutions depart from the scope of the technical solutions of the embodiments of the present invention.

Claims (13)

1. A front-end application calling method is applied to a business system, the business system comprises a sub-application library and at least one main application, the sub-application library comprises a plurality of mutually isolated sub-applications, each sub-application is a front-end application, each main application is a business platform, and the method is applied to equipment where the main application is located and comprises the following steps:
receiving a call instruction of any target sub-application in the sub-application library;
acquiring target sub-application information according to the calling instruction, and registering a target sub-application on the main application according to the target sub-application information so as to mount the target sub-application on the main application;
and sending configuration information to the target sub-application according to the target sub-application information so that the target sub-application displays a corresponding page on the main application.
2. The method according to claim 1, wherein the obtaining target sub-application information according to the call instruction, and registering a target sub-application on the main application according to the target sub-application information comprises:
controlling the target sub-application to run a registration program in the target sub-application according to the calling instruction, and receiving the target sub-application information sent by the target sub-application, wherein the target sub-application information comprises at least one of the following items: the name, interface, container, main entry path, input data information, deployment address and routing information of the target sub-application;
and mounting on the main application according to the target sub-application information.
3. The method according to claim 1 or 2, wherein the target sub-application information comprises description information of the target sub-application, the description information comprising functions and/or menus of the target sub-application;
the sending configuration information to the target sub-application according to the target sub-application information to enable the target sub-application to display a corresponding page on the main application includes:
sending configuration information to the target sub-application according to the description information of the target sub-application;
and acquiring the page content of the target sub-application corresponding to the configuration information, and rendering the page content of the target sub-application on the main application.
4. The method of claim 1 or 2, wherein there are at least two of the target sub-applications; the method further comprises the following steps:
receiving a mutual calling instruction between a first target sub application and a second target sub application in the at least two target sub applications;
and receiving the output parameters of the output interface of the first target sub-application by the main application according to the mutual calling instruction, and inputting the output parameters to the input interface of the second target sub-application.
5. The method of claim 4, further comprising:
receiving access requests of users to the at least two target sub-applications, and caching corresponding access paths;
and after receiving a backspacing instruction of a user, sequentially backspacing according to the access path.
6. The method of claim 3, further comprising:
and acquiring the preloaded content of the target sub-application in the idle time of the main application, and rendering the preloaded content of the target sub-application on the main application in advance.
7. The method of claim 2, further comprising:
receiving an update instruction sent by the target sub-application, wherein the update instruction is sent by the target sub-application to the main application after the target sub-application migrates the target equipment from the current equipment, and the update instruction comprises a deployment address and/or routing information of the target equipment;
and controlling the main application to update the target sub-application information according to the update instruction.
8. The method according to claim 1 or 2, characterized in that the method further comprises:
receiving an uninstalling instruction of the target sub-application;
and according to the uninstalling instruction, uninstalling the target sub-application from the main application.
9. The method of claim 1 or 2, wherein the target sub-application information comprises a lifecycle hook function; the method further comprises the following steps:
calling the life cycle hook function by the main application in a heartbeat mode to obtain the state of the target sub-application, wherein the state of the target sub-application comprises the following steps: unmounted, mounted, or uninstalled;
and monitoring the life cycle of the target sub-application according to the state of the target sub-application.
10. A front-end application calling device is applied to a business system, the business system comprises a sub-application library and at least one main application, the sub-application library comprises a plurality of mutually isolated sub-applications, each sub-application is a front-end application, each main application is a business platform, the device is applied to equipment where the main application is located, and the device comprises:
the communication module is used for receiving a calling instruction of any target sub-application in the sub-application library;
the processing module is used for acquiring target sub-application information according to the calling instruction, registering target sub-applications on the main application according to the target sub-application information, and mounting the target sub-applications on the main application;
and the display module is used for sending configuration information to the target sub-application according to the target sub-application information so as to enable the target sub-application to display a corresponding page on the main application.
11. An electronic device, comprising: a memory, a processor, a display;
a memory for storing a computer program; the display is used for displaying a page;
a processor for executing a computer program stored in the memory to implement the method of any one of claims 1-9.
12. A computer-readable storage medium, having stored thereon a computer program;
the computer program, when executed by a processor, implementing the method of any one of claims 1-9.
13. A computer program product, comprising a computer program;
the computer program, when executed by a processor, implementing the method of any one of claims 1-9.
CN202110656431.3A 2021-06-11 2021-06-11 Front-end application calling method, device, storage medium and program product Pending CN113254237A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110656431.3A CN113254237A (en) 2021-06-11 2021-06-11 Front-end application calling method, device, storage medium and program product

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110656431.3A CN113254237A (en) 2021-06-11 2021-06-11 Front-end application calling method, device, storage medium and program product

Publications (1)

Publication Number Publication Date
CN113254237A true CN113254237A (en) 2021-08-13

Family

ID=77187796

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110656431.3A Pending CN113254237A (en) 2021-06-11 2021-06-11 Front-end application calling method, device, storage medium and program product

Country Status (1)

Country Link
CN (1) CN113254237A (en)

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113821194A (en) * 2021-09-10 2021-12-21 上海云轴信息科技有限公司 Micro front-end system
CN113986226A (en) * 2021-12-28 2022-01-28 中国电子科技网络信息安全有限公司 Micro front end architecture based on qiankun and Web Component and construction method thereof
CN114401320A (en) * 2021-12-14 2022-04-26 杭州趣链科技有限公司 Sub-application access method, system, block chain platform, gateway and storage medium
CN114546524A (en) * 2022-02-11 2022-05-27 支付宝(杭州)信息技术有限公司 Application permission processing method and device
CN114721633A (en) * 2022-05-17 2022-07-08 广东精工智能***有限公司 Multi-application integration method and system for digital factory
CN114764354A (en) * 2022-04-19 2022-07-19 卡奥斯工业智能研究院(青岛)有限公司 Dependency management method and device based on PAAS, electronic equipment and medium

Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106802803A (en) * 2017-01-06 2017-06-06 腾讯科技(深圳)有限公司 The method and apparatus of application data treatment
CN109840146A (en) * 2019-01-16 2019-06-04 腾讯科技(深圳)有限公司 Method for processing business, device, terminal and storage medium
US10565029B1 (en) * 2018-12-12 2020-02-18 Sap Se Automatically integrating applications via an integration discovery service
CN111158799A (en) * 2019-12-31 2020-05-15 北京百度网讯科技有限公司 Page rendering method and device, electronic equipment and storage medium
CN111290753A (en) * 2020-01-20 2020-06-16 远光软件股份有限公司 Method, device, equipment and storage medium for building front-end development environment
CN111737032A (en) * 2020-07-27 2020-10-02 腾讯科技(深圳)有限公司 Subprogram running method and device based on microkernel system and electronic equipment
CN112000353A (en) * 2020-08-18 2020-11-27 北京三快在线科技有限公司 Application running method and device and storage medium
CN112416415A (en) * 2020-09-18 2021-02-26 山东英信计算机技术有限公司 Front-end micro-service implementation method and related components
CN112631679A (en) * 2020-12-28 2021-04-09 北京三快在线科技有限公司 Preloading method and device for micro-application
CN112667305A (en) * 2019-09-30 2021-04-16 北京国双科技有限公司 Page display method and device

Patent Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106802803A (en) * 2017-01-06 2017-06-06 腾讯科技(深圳)有限公司 The method and apparatus of application data treatment
US10565029B1 (en) * 2018-12-12 2020-02-18 Sap Se Automatically integrating applications via an integration discovery service
CN109840146A (en) * 2019-01-16 2019-06-04 腾讯科技(深圳)有限公司 Method for processing business, device, terminal and storage medium
CN112667305A (en) * 2019-09-30 2021-04-16 北京国双科技有限公司 Page display method and device
CN111158799A (en) * 2019-12-31 2020-05-15 北京百度网讯科技有限公司 Page rendering method and device, electronic equipment and storage medium
CN111290753A (en) * 2020-01-20 2020-06-16 远光软件股份有限公司 Method, device, equipment and storage medium for building front-end development environment
CN111737032A (en) * 2020-07-27 2020-10-02 腾讯科技(深圳)有限公司 Subprogram running method and device based on microkernel system and electronic equipment
CN112000353A (en) * 2020-08-18 2020-11-27 北京三快在线科技有限公司 Application running method and device and storage medium
CN112416415A (en) * 2020-09-18 2021-02-26 山东英信计算机技术有限公司 Front-end micro-service implementation method and related components
CN112631679A (en) * 2020-12-28 2021-04-09 北京三快在线科技有限公司 Preloading method and device for micro-application

Cited By (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113821194A (en) * 2021-09-10 2021-12-21 上海云轴信息科技有限公司 Micro front-end system
CN114401320A (en) * 2021-12-14 2022-04-26 杭州趣链科技有限公司 Sub-application access method, system, block chain platform, gateway and storage medium
CN113986226A (en) * 2021-12-28 2022-01-28 中国电子科技网络信息安全有限公司 Micro front end architecture based on qiankun and Web Component and construction method thereof
CN113986226B (en) * 2021-12-28 2022-04-22 中国电子科技网络信息安全有限公司 Micro front end architecture based on qiankun and Web Component and construction method thereof
CN114546524A (en) * 2022-02-11 2022-05-27 支付宝(杭州)信息技术有限公司 Application permission processing method and device
CN114546524B (en) * 2022-02-11 2024-04-05 支付宝(杭州)信息技术有限公司 Application authority processing method and device
CN114764354A (en) * 2022-04-19 2022-07-19 卡奥斯工业智能研究院(青岛)有限公司 Dependency management method and device based on PAAS, electronic equipment and medium
CN114764354B (en) * 2022-04-19 2024-01-05 卡奥斯工业智能研究院(青岛)有限公司 PAAS-based dependency management method, PAAS-based dependency management device, electronic equipment and medium
CN114721633A (en) * 2022-05-17 2022-07-08 广东精工智能***有限公司 Multi-application integration method and system for digital factory

Similar Documents

Publication Publication Date Title
CN113254237A (en) Front-end application calling method, device, storage medium and program product
US10827008B2 (en) Integrated user interface for consuming services across different distributed networks
JP6750054B2 (en) A system for building and modeling web pages
US10992758B2 (en) Virtualizing device management services on a multi-session platform
US9582319B2 (en) Migrating virtual machines across network separated data centers
EP3284213B1 (en) Managing virtual network functions
US8683464B2 (en) Efficient virtual machine management
US10656971B2 (en) Agile framework for vertical application development and delivery
JP2022022077A (en) Method and device for deploying application, electronic apparatus, readable storage medium, and computer program
US20120072555A1 (en) Linking instances within a cloud computing environment
WO2013133975A1 (en) Offline provisioning of virtual machines
CN104009880B (en) Web test methods, proxy server and Web test devices
US11838296B1 (en) Providing secure software project development environments
US11681585B2 (en) Data migration for a shared database
CN112328390A (en) Method and device for automatically implementing cloud management platform and storage medium
CN112887440B (en) IP address management method and device
CN113485927A (en) Test data generation method, device, equipment and storage medium
WO2022199324A1 (en) Run-time communications protocol parameter adjustment in containerized applications
US11966880B2 (en) Policies and controls for building and validating database software in a shared management environment
CN114679491A (en) Micro front-end service application method and device, storage medium and electronic equipment
CN110971665A (en) Management method, system, equipment and storage medium for interfacing multi-type storage
JP7461318B2 (en) Data mining systems, methods, devices, electronic devices and storage media
Hirway Hybrid Cloud for Developers: Develop and deploy cost-effective applications on the AWS and OpenStack platforms with ease
US20230125904A1 (en) Recommendation system for building and validating database software in a shared management environment
US20230148314A1 (en) Fast Launch Based on Hibernated Pre-launch Sessions

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20210813