CN116302250A - Interface multiplexing method, device, electronic equipment and storage medium - Google Patents
Interface multiplexing method, device, electronic equipment and storage medium Download PDFInfo
- Publication number
- CN116302250A CN116302250A CN202310108326.5A CN202310108326A CN116302250A CN 116302250 A CN116302250 A CN 116302250A CN 202310108326 A CN202310108326 A CN 202310108326A CN 116302250 A CN116302250 A CN 116302250A
- Authority
- CN
- China
- Prior art keywords
- component
- calling
- interface
- current code
- multiplexing
- 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
Links
- 238000000034 method Methods 0.000 title claims abstract description 62
- 238000012545 processing Methods 0.000 claims description 14
- 239000012634 fragment Substances 0.000 claims description 10
- 238000004590 computer program Methods 0.000 claims description 9
- 230000004048 modification Effects 0.000 claims description 5
- 238000012986 modification Methods 0.000 claims description 5
- 238000010276 construction Methods 0.000 claims description 4
- 230000007246 mechanism Effects 0.000 abstract description 18
- 230000007547 defect Effects 0.000 abstract description 7
- 230000001960 triggered effect Effects 0.000 abstract description 4
- 230000006870 function Effects 0.000 description 20
- 230000008569 process Effects 0.000 description 16
- 238000004891 communication Methods 0.000 description 5
- 238000010586 diagram Methods 0.000 description 4
- 230000033772 system development Effects 0.000 description 4
- 238000012546 transfer Methods 0.000 description 4
- 238000009877 rendering Methods 0.000 description 3
- 230000000977 initiatory effect Effects 0.000 description 2
- 230000003993 interaction Effects 0.000 description 2
- 230000003287 optical effect Effects 0.000 description 2
- 230000008859 change Effects 0.000 description 1
- 238000011161 development Methods 0.000 description 1
- 230000018109 developmental process Effects 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 230000004927 fusion Effects 0.000 description 1
- 230000010354 integration Effects 0.000 description 1
- 238000005457 optimization Methods 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements 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/44—Arrangements for executing specific programs
- G06F9/451—Execution arrangements for user interfaces
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/30—Creation or generation of source code
- G06F8/36—Software reuse
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/40—Transformation of program code
- G06F8/41—Compilation
- G06F8/42—Syntactic analysis
- G06F8/427—Parsing
-
- Y—GENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02D—CLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
- Y02D10/00—Energy efficient computing, e.g. low power processors, power management or thermal 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)
- Human Computer Interaction (AREA)
- Computer And Data Communications (AREA)
Abstract
The invention provides an interface multiplexing method, an interface multiplexing device, electronic equipment and a storage medium, wherein the method comprises the following steps: determining a remote component, the remote component being determined based on an interface of a third party system to be multiplexed; the calling label is inserted into the multiplexing position in the initial code to obtain the current code by configuring calling information of the remote component by the calling label; under the condition of compiling the current code, analyzing the current code to obtain calling information of a remote component called by a calling tag in the current code; based on the calling information, the component content of the remote component is obtained and is inserted into the multiplexing position in the current code, so that the defect that the function multiplexing is difficult due to the fact that the data exchange is difficult when the third party system is referenced by the iframe due to the limitation of the browser security mechanism in the traditional scheme is overcome, the remote component can be called under the condition that the security mechanism in the browser is not triggered, the flexibility of the data exchange is ensured, and the function multiplexing of the third party system is realized.
Description
Technical Field
The present invention relates to the field of computer technologies, and in particular, to an interface multiplexing method, an apparatus, an electronic device, and a storage medium.
Background
In the field of system development, there are many times of integrated references to existing systems, and particularly when integrating functions of an existing third-party system, the functions of the system can be quickly reused by directly referring to interfaces, and meanwhile, the consistency with the original system can be maintained.
At present, when the function multiplexing is performed on the existing third party system, most of the adopted modes are iframe embedding, namely, an interface of the third party system is embedded into a new system through the iframe, however, in the process of performing interface embedding through the iframe, data exchange is difficult to perform when the iframe refers to the third party system due to the limitation of a safety mechanism in a browser, in short, the data exchange between systems is difficult to complete due to the adoption of the iframe embedding mode, and the function multiplexing is difficult to realize.
Disclosure of Invention
The invention provides an interface multiplexing method, an interface multiplexing device, electronic equipment and a storage medium, which are used for solving the defect that data exchange is difficult to complete when a third party system is quoted through an iframe due to the limitation of a browser security mechanism in the prior art, and can exchange data with the third party system when a code is compiled on the premise that the security mechanism in the browser is not triggered.
The invention provides an interface multiplexing method, which comprises the following steps:
determining a remote component, the remote component being determined based on an interface of a third party system to be multiplexed;
configuring calling information of the remote component through a calling tag, and inserting the calling tag into a multiplexing position in an initial code to obtain a current code;
under the condition of compiling the current code, analyzing the current code to obtain the calling information of the remote component called by the calling tag in the current code;
and acquiring the component content of the remote component based on the calling information, and inserting the component content into the multiplexing position in the current code.
According to the interface multiplexing method provided by the invention, the analyzing the current code to obtain the calling information of the remote component called by the calling tag in the current code comprises the following steps:
analyzing the current code to obtain each component called by the current code, and identifying the calling tag in the current code based on the component name and/or the identity of each component;
and analyzing the call label to obtain call information of the remote component, wherein the call information comprises call parameters and call addresses.
According to the interface multiplexing method provided by the invention, the acquiring the component content of the remote component based on the calling information comprises the following steps:
fusing the calling parameters and the calling addresses in the calling information to obtain a component content calling request;
and acquiring the component content of the remote component from the third party system based on the component content calling request.
According to the interface multiplexing method provided by the invention, the method for inserting the component content into the multiplexing position in the current code comprises the following steps:
carrying out style processing on the component content to obtain processed component content;
inserting the processed component content into a multiplexing position in the current code;
the style processing includes at least one of style addition, style modification, style overlay.
According to the interface multiplexing method provided by the invention, the determining remote component comprises the following steps:
determining a third party system to be multiplexed;
determining interfaces and/or interface fragments to be multiplexed from the third party system;
and determining a remote component based on the interface and/or the interface fragment to be multiplexed.
According to the interface multiplexing method provided by the invention, the calling mode of the calling tag is consistent with the calling mode of the local component in each component.
According to the interface multiplexing method provided by the invention, the calling parameters comprise the necessary parameters and the optional parameters, the necessary parameters comprise the component names and the identity marks, and the optional parameters comprise the component numbers and/or the component labels.
The invention also provides an interface multiplexing device, which comprises:
the construction unit is used for determining a remote component, and the remote component is determined based on an interface of a third party system to be multiplexed;
the configuration unit is used for configuring the calling information of the remote component through a calling tag, and inserting the calling tag into a multiplexing position in an initial code to obtain a current code;
the analyzing unit is used for analyzing the calling information of the remote component called by the calling tag in the current code under the condition of compiling the current code;
and the multiplexing unit is used for acquiring the component content of the remote component based on the calling information and inserting the component content into the multiplexing position in the current code.
The invention also provides an electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, the processor implementing the interface multiplexing method as described in any one of the above when executing the program.
The present invention also provides a non-transitory computer readable storage medium having stored thereon a computer program which, when executed by a processor, implements an interface multiplexing method as described in any of the above.
According to the interface multiplexing method, the device, the electronic equipment and the storage medium, the calling information of the remote component is configured through the custom calling tag, the calling tag is inserted into the multiplexing position in the initial code by adopting the remote reference mode to obtain the current code, the remote component is analyzed and identified when the current code is compiled, the complete component content is obtained and inserted into the multiplexing position in the current code, the defect that the function multiplexing is difficult due to the limitation of the browser security mechanism in the traditional scheme is overcome, the defect that the data exchange is difficult when the third party system is referenced through the iframe is overcome, the remote component can be called under the condition that the security mechanism in the browser is not triggered, the flexibility of the data exchange is ensured, the use cost is reduced, and the function multiplexing of the existing third party system is realized.
Drawings
In order to more clearly illustrate the invention or the technical solutions of the prior art, the following description will briefly explain the drawings used in the embodiments or the description of the prior art, and it is obvious that the drawings in the following description are some embodiments of the invention, and other drawings can be obtained according to the drawings without inventive effort for a person skilled in the art.
Fig. 1 is a schematic flow chart of an interface multiplexing method provided by the invention;
FIG. 2 is a general flow chart of an interface multiplexing method provided by the present invention;
fig. 3 is a schematic structural diagram of an interface multiplexing device provided by the present invention;
fig. 4 is a schematic structural diagram of an electronic device provided by the present invention.
Detailed Description
For the purpose of making the objects, technical solutions and advantages of the present invention more apparent, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings, and it is apparent that the described embodiments are some embodiments of the present invention, not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
In the development process of a Web (World Wide Web) system, when the integration of functions of an existing third-party system is involved, the multiplexing of the functions of the third-party system is often realized through direct reference of an interface. At present, the common interface reference mode is iframe embedding, but due to the limitation of a security mechanism in a browser, data exchange is difficult to carry out when the iframe references a third party system, so that function multiplexing is difficult to realize.
In this regard, the present invention provides an interface multiplexing method, which aims to determine a remote component through an interface in a third party system, insert the remote component into an initial code in a remote reference manner, obtain a current code, analyze and identify the remote component when compiling the current code, and obtain the complete component content so as to insert the remote component into a multiplexing position in the current code, so that the remote component can be invoked under the condition that a security mechanism in a browser is not triggered, flexibility of an invocation manner is ensured, and functional multiplexing of the existing third party system is realized. Fig. 1 is a schematic flow chart of an interface multiplexing method provided by the present invention, as shown in fig. 1, the method includes:
considering that when integrating functions of an existing system in a system development process, if the functions are directly referenced through an interface, not only can function multiplexing be quickly realized, but also consistency with an original system can be ensured, therefore, in the embodiment of the invention, when the functions are multiplexed for the existing system, a mode of directly referencing the interface is selected, in the mode, a multiplexing object, namely a system interface needing to be multiplexed, is firstly determined, and because the existing system is usually independent of the current system, the system interface can be called a third party system, and an interface to be multiplexed in the system can be called an interface of the third party system to be multiplexed.
After determining the interface of the third party system to be multiplexed, the remote component needs to be determined according to the interface, where the interface of the third party system may be directly used as the remote component, or a part of the segments in the interface may be used as the remote component, or the interface and a part of the segments in the interface may be used as the remote component, which is not limited in particular in the embodiment of the present invention.
It is worth noting that the mode of constructing the remote component through part of the segments (interface segments) in the interface can meet the specific requirement of only referencing the interface segments in the system development process, reduces the introduction of irrelevant data and ensures multiplexing efficiency and flexibility.
specifically, after determining the remote component in step 110, step 120 may be executed to configure the call information of the remote component by using the call tag, and insert the call tag into the multiplexing location in the initial code to obtain the current code, where the process specifically includes:
firstly, determining a call label corresponding to a remote component, wherein the call label is used for calling the constructed remote component in a code; here, the call tag may be user-defined, and the call mode of the call tag of the user-defined remote component is basically consistent with the call mode of the local component referenced in the current code, so that the use cost of the user can be greatly reduced;
then, parameter information required by calling the remote component of the third party system, namely calling information of the remote component, can be configured by using the calling tag, wherein the calling information can be component address, component name, component number, identity and the like of the remote component;
the parameter configuration of the custom call tag can flexibly transfer parameters from the current system to the third party system, so that the flexibility of data transfer between the current system and the third party system is ensured, and meanwhile, the parameter information and the acquired content can be finely controlled.
And then, the call label after configuration can be inserted into the multiplexing position of the initial code, so that the current code is obtained, the process is essentially to insert the interface of the third party system into the multiplexing position of the initial code in the current system by adopting the custom call label in a remote reference mode, so that the current code is obtained, and the remote component of the third party system can be called by utilizing the call label when the current code is compiled. Here, the multiplexing position is predetermined, and may be a position pointed by a cursor in an editing interface of the initial code in the current system, or may be another position in the initial code.
In the embodiment of the invention, the call label of the remote component is set, and the information configuration is carried out through the custom call label, so that a foundation can be laid for data exchange with a third party system, the flexibility of data exchange between the call label and the third party system is ensured, and the accurate control of information content is realized.
specifically, after the call tag is inserted into the multiplexing position in the current code, if the current code is compiled, call information of a remote component called by the call tag in the current code can be obtained in a parsing mode, and the process specifically includes:
under the condition of current compiling, the current code can be analyzed to acquire the calling information of the remote component contained in the calling label in the current code, specifically, each component referenced in the current system can be acquired through analyzing the current code, and the calling label under the custom component name is identified from the component; and then, extracting calling addresses and other calling parameters required by calling the remote component according to the calling label, thereby obtaining the calling information of the remote component.
And 140, acquiring the component content of the remote component based on the call information, and inserting the component content into the multiplexing position in the current code.
Specifically, after the call information of the remote component is obtained through the parsing in the above steps, step 140 may be executed, according to which the call information obtains the component content of the remote component, and inserts the component content into the multiplexing position in the current code, where the specific process includes:
firstly, the detailed content of the remote component can be obtained according to the call information of the remote component obtained by analyzing the current code under the compiling condition, specifically, the complete component content of the remote component can be obtained from a third party system by taking the call information of the remote component obtained by analyzing as a reference, namely, the call address in the call information of the remote component and the call parameter can be referred, and the detailed content of the remote component pointed by the call parameter can be obtained from the call address in the third party system, thereby obtaining the component content of the remote component;
then, the component content can be inserted into the multiplexing position in the current code, so that multiplexing work is completed, and when the component content is displayed, the component content can be rendered at the multiplexing position in the current system, so that the component content is harmonious with the current system, inconsistencies caused by cross systems are reduced, and abrupt style display is avoided; in short, the component content can be inserted into the multiplexing position in the current code, so that the rendering of the component content on the current interface in the third party system is completed.
The interface multiplexing method provided by the invention configures the calling information of the remote component through the custom calling tag, inserts the calling tag into the multiplexing position in the initial code by adopting the remote reference mode to obtain the current code, analyzes and identifies the remote component when the current code is compiled, and obtains the complete component content to insert the complete component content into the multiplexing position in the current code, thereby overcoming the defect that the function multiplexing is difficult due to the limitation of the security mechanism of the browser in the traditional scheme when the security mechanism of the browser is referenced by the iframe, calling the remote component under the condition of not triggering the security mechanism in the browser, ensuring the flexibility of data exchange, reducing the use cost and realizing the function multiplexing of the existing third-party system.
Based on the above embodiment, in step 120, the parsing of the current code is performed to obtain the call information of the remote component called by the call tag in the current code, including:
analyzing the current code to obtain each component called in the current code, and identifying a calling label in the current code based on the component name and/or the identity of each component;
and analyzing the call label to obtain call information of the remote component, wherein the call information comprises call parameters and call addresses.
Specifically, in step 120, the process of resolving the current code to obtain the call information of the remote component called by the call tag in the current code specifically includes the following steps:
firstly, under the condition of compiling the current code, the current code can be analyzed to obtain all components called by the current code, and specifically, all components called in the current code can be obtained through analysis, wherein the components comprise remote components of a third party system and local components of the current system;
then, the remote components in each component can be identified according to the identity information of each component called by the current code, wherein the identity information can be the component name of each component, the identity of each component, the component name and the identity, and the embodiment of the invention is not particularly limited to the above; specifically, the calling tag in the current code can be identified from each component by taking the component name and/or the identity of each component as a reference;
after that, the call label can be parsed to obtain the call information of the remote component corresponding to the call label, specifically, after the call label in the current code is identified, the call address of the remote component and the call parameter, which are both the call information of the remote component, can be obtained through parsing the call label, and in short, the call information of the remote component can be obtained through parsing the call label.
Based on the above embodiment, in step 140, based on the call information, component content of the remote component is obtained, including:
fusing the call parameters and the call addresses in the call information to obtain a component content call request;
component content of the remote component is obtained from the third party system based on the component content invocation request.
Specifically, in step 140, the process of obtaining the component content of the remote component according to the call information may include the following steps:
firstly, a request for acquiring the component content of a remote component, namely a component content call request, can be generated according to a call address and call parameters in call information obtained by analysis, specifically, the component content call request can be obtained by fusing various information in the call information, namely, the call address and the call parameters in the call information can be fused to obtain the component content call request, and the fusion operation can be splicing;
and then, according to the component content calling request, acquiring the component content of the remote component from the third-party system, specifically, initiating the component content calling request to acquire the pointed detailed content from the address indicated by the request in the third-party system, thereby acquiring the component content of the remote component.
It is noted that the component content call request may be in http form, and the complete component content may be obtained from the third party system through the http request, while consistency with the original system is maintained.
Based on the above embodiment, in step 140, inserting the component content into the multiplexing location in the current code includes:
carrying out style processing on the component content to obtain processed component content;
inserting the processed component content into the multiplexing position in the current code;
the style processing includes at least one of style addition, style modification, style overlay.
Considering that when the interface of the third party system is embedded into the current system through the iframe, besides the problem of the data exchange layer, the problem of inconsistent system style exists, and the problem is directly related to user experience, namely the problem is easy to cause poor use experience of the user.
In view of this, in the embodiment of the present invention, after the component content of the remote component is obtained, before the component content is inserted into the multiplexing position in the current code, the component content may be further processed in a style, so that the component content is closer to the current system in terms of a display style, and can be better fused, thereby finally realizing optimization and promotion of user experience.
Specifically, the style processing is firstly required to be performed on the component content, wherein the style processing can be any one or more of style addition, style change and style coverage, and the theme style of the component content can be changed through various style processing so as to be close to the display style, theme style and the like of the current system, so that the component content can be better fused with the current system, the harmony between the component content and the theme style is ensured, the abrupt is avoided, and the processed component content can be obtained in the process;
then, the processed component content can be inserted into the multiplexing position in the current code, so that the function multiplexing of the third party system is realized, the component content can be rendered at the multiplexing position in the current system under the condition of display, the rendering work of the component content of the third party system on the current interface is completed, finally, the displayed remote component is enabled to be close to the theme style of the current system, the harmony between the remote component and the current system is ensured, the inconsistency caused by crossing systems is reduced, the abrupt style display is avoided, and the user experience is optimized.
Based on the above embodiment, step 110 includes:
determining a third party system to be multiplexed;
determining an interface and/or an interface fragment to be multiplexed from a third party system;
the remote component is determined based on the interface and/or interface fragment to be multiplexed.
In the system development process, not all interface references need to be embedded into the whole interface, and only a certain segment in the interface needs to be referenced under partial conditions, at this time, if the whole interface is directly referenced, a large amount of useless data can be introduced, so that data exchange is complicated, the workload is increased, codes are more complicated, and errors are more prone to occur.
In view of this, in the embodiment of the present invention, when determining the remote component, an interface of the third party system to be multiplexed may be selected as a basis, or a part of segments (interface segments) in the interface may be selected as a basis, or both may be selected as a basis, so as to satisfy the requirements of interface reference under different conditions, and ensure flexibility and practicality of the multiplexing process.
Specifically, a third party system to be multiplexed needs to be determined, then an interface to be multiplexed, or an interface segment to be multiplexed, or an interface to be multiplexed and an interface segment to be multiplexed may be determined from the system, and then a remote component may be constructed according to the interface to be multiplexed and the interface segment to be multiplexed, where the interface to be multiplexed in the third party system may be directly used as the remote component, the interface segment to be multiplexed may be used as the remote component, or the interface segment to be multiplexed may be used as the remote component together, and the embodiment of the present invention is not limited in this way.
In the embodiment of the invention, the remote assembly is constructed through the interface and/or the interface fragment, so that the interface quotation requirement of a third party system under various conditions can be met, the flexibility of the multiplexing process is improved, the intake of irrelevant data is reduced, the relativity between the requirements is ensured, and the high efficiency and the flexibility of the multiplexing process are realized.
Based on the above embodiment, the calling mode of the calling tag is consistent with the calling mode of the local component in each component.
Specifically, in the embodiment of the invention, the calling mode of the customized calling tag is consistent with the calling mode of the local component in each component, so that the use cost can be greatly reduced; in addition, the consistency of the calling modes can also facilitate parameter transfer between the systems so as to perform data interaction, and flexible and convenient data exchange between the third-party system and the current system is realized.
In the embodiment of the invention, the data exchange between the current system and the third party system can be realized through the information configuration of the custom call tag, and the call mode of the call tag is consistent with the call mode of the local component, so that the parameter transfer can be more conveniently carried out, the flexibility of the data interaction between the two is ensured, and the accurate control of the information content is realized.
Based on the above embodiment, the calling parameters include the mandatory parameters including the component name and the identity, and the optional parameters including the component number and/or the component number.
Specifically, the call information of the remote component includes a call address and a call parameter, where the call parameter may be divided into a necessary parameter and an optional parameter, where the necessary parameter is a parameter necessary for the component call process, and the optional parameter is optional.
The optional parameters include component names and identity marks, and the optional parameters may be component numbers, component numbers and component numbers, which are not particularly limited in the embodiment of the present invention.
Based on the above embodiment, fig. 2 is a general flow chart of the interface multiplexing method provided by the present invention, and as shown in fig. 2, the general flow of the method includes: determining a remote component through an interface and/or an interface fragment in a third party system to be multiplexed; configuring a calling address and a calling parameter of a remote component of a third party system to be used through a custom calling tag, and inserting the configured calling tag into a multiplexing position in an initial code to obtain a current code; when the current code is compiled, analyzing and acquiring calling information of a remote component, and initiating a component content calling request to acquire component content of the remote component; and carrying out style processing on the acquired component content, and inserting the processed component content into a multiplexing position, thereby completing the functional multiplexing of the third-party system.
The above procedure is described below based on specific examples:
when an image-text list interface of a third party system is required to be introduced, a remote component can be determined according to the image-text list interface, and the component name of the remote component can be third list; the call information of the remote component is configured through a custom call tag, and the tag is in the form of < third-list id= 'third' http-url= 'http://22.2.2.1/home con=' list > </third-list >. The id is an essential parameter, is fixed as a third party, and can identify the component which is a third party system currently; http-url is an mandatory parameter, specifying an address (call address) acquired by the component; con is an optional parameter, which indicates which component under the call address is to be acquired, here, a list component, and if the con parameter is not transmitted, it indicates that all contents corresponding to the call address are to be acquired.
And inserting the call label into the multiplexing position in the initial code, thereby obtaining the current code. Here, the calling mode of the custom calling tag is consistent with the calling mode of the local component; further, when the current code is compiled, a component with the id of the custom component name being threaded can be obtained through analysis, and the call address and the call parameter of the component can be obtained through analysis, so that a complete request url is obtained through splicing, and the url after the analysis of the referenced component is' http:// 22.2.2.1/homecon=list; and then, the component content corresponding to url can be acquired through http request call.
And after obtaining the component content of the remote component, style processing can be performed on the obtained component content, wherein the style processing comprises at least one of style adding, style changing and style covering, the processed component content is obtained, and the processed component content is added to the multiplexing position in the current code to complete the rendering of the remote component.
The method provided by the embodiment of the invention configures the calling information of the remote component through the custom calling tag, inserts the calling tag into the multiplexing position in the initial code by adopting a remote reference mode to obtain the current code, analyzes and identifies the remote component when the current code is compiled, acquires the complete component content, and inserts the complete component content into the multiplexing position in the current code, thereby overcoming the defect that the function multiplexing is difficult due to the limitation of the security mechanism of the browser in the traditional scheme when the security mechanism of the browser is referenced by the iframe, calling the remote component under the condition of not triggering the security mechanism in the browser, ensuring the flexibility of data exchange, reducing the use cost and realizing the function multiplexing of the existing third-party system.
The interface multiplexing device provided by the invention is described below, and the interface multiplexing device described below and the interface multiplexing method described above can be referred to correspondingly.
Fig. 3 is a schematic structural diagram of an interface multiplexing device provided in the present invention, as shown in fig. 3, the device includes:
a construction unit 310, configured to determine a remote component, where the remote component is determined based on an interface of a third party system to be multiplexed;
a configuration unit 320, configured to configure call information of the remote component by using a call tag, and insert the call tag into a multiplexing position in an initial code, so as to obtain a current code;
the parsing unit 330 is configured to parse the current code under the condition of compiling the current code, to obtain call information of the remote component called by the call tag in the current code;
and the multiplexing unit 340 is configured to obtain component content of the remote component based on the call information, and insert the component content into a multiplexing location in the current code.
The interface multiplexing device provided by the invention configures the calling information of the remote component through the custom calling tag, inserts the calling tag into the multiplexing position in the initial code by adopting a remote reference mode to obtain the current code, analyzes and identifies the remote component when the current code is compiled, and obtains the complete component content to insert the complete component content into the multiplexing position in the current code, thereby overcoming the defect that the function multiplexing is difficult due to the limitation of the safety mechanism of the browser in the traditional scheme when the safety mechanism of the browser is referenced by the iframe, calling the remote component under the condition of not triggering the safety mechanism in the browser, ensuring the flexibility of the data exchange, reducing the use cost and realizing the function multiplexing of the existing third-party system.
Based on the above embodiment, the parsing unit 330 is configured to:
analyzing the current code to obtain each component called in the current code, and identifying the calling tag in the current code based on the component name and/or the identity of each component;
and analyzing the call label to obtain call information of the remote component, wherein the call information comprises call parameters and call addresses.
Based on the above embodiment, the multiplexing unit 340 is configured to:
fusing the calling parameters and the calling addresses in the calling information to obtain a component content calling request;
and acquiring the component content of the remote component from the third party system based on the component content calling request.
Based on the above embodiment, the multiplexing unit 340 is configured to:
carrying out style processing on the component content to obtain processed component content;
inserting the processed component content into a multiplexing position in the current code;
the style processing includes at least one of style addition, style modification, style overlay.
Based on the above embodiment, the construction unit 310 is configured to:
determining a third party system to be multiplexed;
determining interfaces and/or interface fragments to be multiplexed from the third party system;
and determining a remote component based on the interface and/or the interface fragment to be multiplexed.
Based on the above embodiment, the calling mode of the calling tag is consistent with the calling mode of the local component in each component.
Based on the above embodiment, the call parameters include a mandatory parameter and an optional parameter, the mandatory parameter includes a component name and an identity, and the optional parameter includes a component number and/or a component number.
Fig. 4 illustrates a physical schematic diagram of an electronic device, as shown in fig. 4, which may include: processor 410, communication interface (Communications Interface) 420, memory 430 and communication bus 440, wherein processor 410, communication interface 420 and memory 430 communicate with each other via communication bus 440. Processor 410 may invoke logic instructions in memory 430 to perform an interface multiplexing method comprising: determining a remote component, the remote component being determined based on an interface of a third party system to be multiplexed; configuring calling information of the remote component through a calling tag, and inserting the calling tag into a multiplexing position in an initial code to obtain a current code; under the condition of compiling the current code, analyzing the current code to obtain the calling information of the remote component called by the calling tag in the current code; and acquiring the component content of the remote component based on the calling information, and inserting the component content into the multiplexing position in the current code.
Further, the logic instructions in the memory 430 described above may be implemented in the form of software functional units and may be stored in a computer-readable storage medium when sold or used as a stand-alone product. Based on this understanding, the technical solution of the present invention may be embodied essentially or in a part contributing to the prior art or in a part of the technical solution, in the form of a software product stored in a storage medium, comprising several instructions for causing a computer device (which may be a personal computer, a server, a network device, etc.) to perform all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a random access Memory (RAM, random Access Memory), a magnetic disk, or an optical disk, or other various media capable of storing program codes.
In another aspect, the present invention also provides a computer program product comprising a computer program stored on a non-transitory computer readable storage medium, the computer program comprising program instructions which, when executed by a computer, enable the computer to perform the interface multiplexing method provided by the above methods, the method comprising: determining a remote component, the remote component being determined based on an interface of a third party system to be multiplexed; configuring calling information of the remote component through a calling tag, and inserting the calling tag into a multiplexing position in an initial code to obtain a current code; under the condition of compiling the current code, analyzing the current code to obtain the calling information of the remote component called by the calling tag in the current code; and acquiring the component content of the remote component based on the calling information, and inserting the component content into the multiplexing position in the current code.
In yet another aspect, the present invention also provides a non-transitory computer readable storage medium having stored thereon a computer program which, when executed by a processor, is implemented to perform the interface multiplexing method provided by the above methods, the method comprising: determining a remote component, the remote component being determined based on an interface of a third party system to be multiplexed; configuring calling information of the remote component through a calling tag, and inserting the calling tag into a multiplexing position in an initial code to obtain a current code; under the condition of compiling the current code, analyzing the current code to obtain the calling information of the remote component called by the calling tag in the current code; and acquiring the component content of the remote component based on the calling information, and inserting the component content into the multiplexing position in the current code.
The apparatus embodiments described above are merely illustrative, wherein the elements illustrated as separate elements may or may not be physically separate, and the elements shown as elements may or may not be physical elements, may be located in one place, or may be distributed over a plurality of network elements. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment. Those of ordinary skill in the art will understand and implement the present invention without undue burden.
From the above description of the embodiments, it will be apparent to those skilled in the art that the embodiments may be implemented by means of software plus necessary general hardware platforms, or of course may be implemented by means of hardware. Based on this understanding, the foregoing technical solution may be embodied essentially or in a part contributing to the prior art in the form of a software product, which may be stored in a computer readable storage medium, such as ROM/RAM, a magnetic disk, an optical disk, etc., including several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute the method described in the respective embodiments or some parts of the embodiments.
Finally, it should be noted that: the above embodiments are only for illustrating the technical solution of the present invention, and are not limiting; although the invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical scheme described in the foregoing embodiments can be modified or some technical features thereof can be replaced by equivalents; such modifications and substitutions do not depart from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims (10)
1. An interface multiplexing method, comprising:
determining a remote component, the remote component being determined based on an interface of a third party system to be multiplexed;
configuring calling information of the remote component through a calling tag, and inserting the calling tag into a multiplexing position in an initial code to obtain a current code;
under the condition of compiling the current code, analyzing the current code to obtain the calling information of the remote component called by the calling tag in the current code;
and acquiring the component content of the remote component based on the calling information, and inserting the component content into the multiplexing position in the current code.
2. The interface multiplexing method according to claim 1, wherein the parsing the current code to obtain the call information of the remote component called by the call tag in the current code includes:
analyzing the current code to obtain each component called by the current code, and identifying the calling tag in the current code based on the component name and/or the identity of each component;
and analyzing the call label to obtain call information of the remote component, wherein the call information comprises call parameters and call addresses.
3. The interface multiplexing method according to claim 2, wherein the acquiring the component content of the remote component based on the call information includes:
fusing the calling parameters and the calling addresses in the calling information to obtain a component content calling request;
and acquiring the component content of the remote component from the third party system based on the component content calling request.
4. A method of multiplexing an interface according to any one of claims 1 to 3, wherein the inserting the component content into a multiplexing location in the current code comprises:
carrying out style processing on the component content to obtain processed component content;
inserting the processed component content into a multiplexing position in the current code;
the style processing includes at least one of style addition, style modification, style overlay.
5. The interface multiplexing method of any of claims 1-3, wherein the determining a remote component comprises:
determining a third party system to be multiplexed;
determining interfaces and/or interface fragments to be multiplexed from the third party system;
and determining a remote component based on the interface and/or the interface fragment to be multiplexed.
6. A method of multiplexing an interface according to claim 2 or 3, wherein the calling tag is called in a manner consistent with the calling of the local component in the respective component.
7. A method of multiplexing an interface according to claim 2 or 3, wherein the call parameters include a mandatory parameter and an optional parameter, the mandatory parameter including a component name and an identity, the optional parameter including a component number and/or a component number.
8. An interface multiplexing device, comprising:
the construction unit is used for determining a remote component, and the remote component is determined based on an interface of a third party system to be multiplexed;
the configuration unit is used for configuring the calling information of the remote component through a calling tag, and inserting the calling tag into a multiplexing position in an initial code to obtain a current code;
the analyzing unit is used for analyzing the calling information of the remote component called by the calling tag in the current code under the condition of compiling the current code;
and the multiplexing unit is used for acquiring the component content of the remote component based on the calling information and inserting the component content into the multiplexing position in the current code.
9. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor implements the interface multiplexing method of any of claims 1 to 7 when the program is executed by the processor.
10. A non-transitory computer readable storage medium having stored thereon a computer program, wherein the computer program when executed by a processor implements the interface multiplexing method according to any of claims 1 to 7.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202310108326.5A CN116302250A (en) | 2023-02-10 | 2023-02-10 | Interface multiplexing method, device, electronic equipment and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202310108326.5A CN116302250A (en) | 2023-02-10 | 2023-02-10 | Interface multiplexing method, device, electronic equipment and storage medium |
Publications (1)
Publication Number | Publication Date |
---|---|
CN116302250A true CN116302250A (en) | 2023-06-23 |
Family
ID=86835131
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202310108326.5A Pending CN116302250A (en) | 2023-02-10 | 2023-02-10 | Interface multiplexing method, device, electronic equipment and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN116302250A (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN116760812A (en) * | 2023-08-17 | 2023-09-15 | 福建博思软件股份有限公司 | Function component-based local resource access method and system |
-
2023
- 2023-02-10 CN CN202310108326.5A patent/CN116302250A/en active Pending
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN116760812A (en) * | 2023-08-17 | 2023-09-15 | 福建博思软件股份有限公司 | Function component-based local resource access method and system |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
KR102105261B1 (en) | Method and device for displaying interface data | |
US8635548B2 (en) | Configuring a page for drag and drop arrangement of content artifacts in a page development tool | |
WO2018000998A1 (en) | Interface generation method, apparatus and system | |
CN109901834A (en) | Document file page generation method, device, computer equipment and storage medium | |
US11449348B2 (en) | Pre/post deployment customization | |
CN109284102B (en) | Information acquisition method and device | |
CN110276074B (en) | Distributed training method, device, equipment and storage medium for natural language processing | |
US20120110482A1 (en) | Method and apparatus for generating widget | |
CN110688598A (en) | Service parameter acquisition method and device, computer equipment and storage medium | |
CN112000884B (en) | User content recommendation method and device, server and storage medium | |
CN113485927B (en) | Test data generation method, device, equipment and storage medium | |
CN113419728A (en) | Marketing page building method, marketing page building device, marketing page building equipment and storage medium | |
CN116302250A (en) | Interface multiplexing method, device, electronic equipment and storage medium | |
CN108664247B (en) | Page template data interaction method and device | |
CN114020256A (en) | Front-end page generation method, device and equipment and readable storage medium | |
CN113138757A (en) | Method, device, server, system and medium for automatically generating front-end code | |
CN112818270A (en) | Data cross-domain transfer method and device and computer equipment | |
CN113360379B (en) | Program test environment creation method and program test environment creation apparatus | |
CN107229653B (en) | Pseudo static webpage generation method and device | |
CN111414168B (en) | Web application development method and device based on mind map and electronic equipment | |
CN117667607A (en) | Visual buried point method, device and storage medium | |
CN106033364B (en) | Web application program upgrading method and system | |
CN111367519B (en) | Page part using method and device, computing equipment and computer storage medium | |
CN106250112A (en) | A kind of auxiliary system for developing software, method and software development system | |
CN114611045A (en) | Method and device for processing front-end interface request, computer equipment and storage medium |
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 |