Rendering method, device, equipment and storage medium for shared front-end components

Developing and packaging front-end components through a unified development framework solves the problem of low coding efficiency of front-end components of online customer service robots in multiple business fields, achieves fast rendering and sharing, and improves work efficiency.

CN111258675BActive Publication Date: 2024-10-29PING AN BANK CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202010043561.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-01-15
Publication Date
2024-10-29
Estimated Expiration
2040-01-15

AI Technical Summary

Technical Problem

When using online customer service robots in multiple business areas simultaneously, the traditional development model requires a large amount of coding and parsing of front-end components, resulting in low work efficiency.

Method used

Use a unified development framework to develop front-end components, package them as JS files and upload them to the resource sharing platform, and dynamically call the corresponding JS files for rendering according to user instructions to avoid repeated coding and parsing.

Benefits of technology

It improves work efficiency, reduces repeated coding and parsing of business data, and enables fast rendering and sharing of front-end components.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN111258675B_ABST
    Figure CN111258675B_ABST
Patent Text Reader

Abstract

The present invention relates to the technical field of research and development management, and discloses a rendering method, device, equipment and storage medium for sharing front-end components, which downloads corresponding front-end components for rendering according to user instructions, thereby improving work efficiency. The method of the present invention includes: setting parameters of an entry function and a preset JS object, the parameters including a mount node value and basic rendering parameter data of the preset JS object; generating candidate front-end components according to the preset JS object and the preset development framework; generating a hypertext markup language HTML code snippet and an initialized candidate front-end component according to the entry function, the parameters and the candidate front-end component; dynamically rendering the corresponding initialized candidate front-end component according to the HTML code snippet, and obtaining the rendered target front-end component; generating a JS file according to the rendered target front-end component; obtaining a user instruction, and obtaining a target JS file from a pre-stored JS file according to the user instruction, and generating a corresponding rendered target front-end component in a preset page.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of research and development management, and in particular to a rendering method, device, equipment and storage medium for a shared front-end component. Background Art

[0002] The online customer service system is a multi-channel, all-weather online service robot based on natural language technology. The online customer service system has a wide range of applications, especially in the financial industry. This method of solving various user problems in the form of questions and answers has become an important support for companies to improve communication efficiency with customers and reduce communication costs. The online customer service system involves a lot of corporate knowledge and user data. Different questions asked by users will be matched with different knowledge and data, and this knowledge and data need to be informed to users in different display styles.

[0003] The traditional development model is that when the business needs to render special knowledge, the user's question is transmitted to the background service, and the robot performs semantic analysis to match the corresponding question and answer. The answer is an instruction tag, which will notify the big data system to query the user's bill, and then pass the instruction tag and user data to the front-end page. The front-end page renders the interface design and data according to the instruction tag.

[0004] The traditional development model can ensure work efficiency when one business field needs an online customer service robot. However, if multiple different business fields need to use online customer service robots to serve users at the same time, the online customer service robots need to encode, parse and render the same business data on different front ends, which results in very low work efficiency. Summary of the invention

[0005] The present invention provides a rendering method, device, equipment and storage medium for a shared front-end component, which is used to develop the front-end component using a unified development framework according to different JS objects, and package the front-end component into a JS file and upload it to a resource sharing platform, and call the corresponding JS file according to user instructions.

[0006] A rendering method for a shared front-end component is provided for the first aspect of an embodiment of the present invention, comprising: setting an entry function and parameters of a preset JS object, the parameters including a mounting node value and basic rendering parameter data of the preset JS object; generating a candidate front-end component according to the preset JS object and a preset development framework; generating a hypertext markup language HTML code snippet and an initialized candidate front-end component according to the entry function, the parameters and the candidate front-end component; dynamically rendering the corresponding initialized candidate front-end component according to the HTML code snippet to obtain a rendered target front-end component; generating a JS file according to the rendered target front-end component, and storing all the JS files, the JS file being packaged and generated by the rendered target front-end component; obtaining a user instruction, and obtaining a target JS file from a pre-stored JS file according to the user instruction, and generating a corresponding rendered target front-end component in a preset page according to the target JS file.

[0007] Optionally, in a first implementation method of the first aspect of the embodiment of the present invention, generating a hypertext markup language HTML code snippet and an initialized candidate front-end component based on the entry function, the parameters and the candidate front-end component includes: inputting the mounting node value and the rendering parameter basic data into the entry function, assigning a value to the candidate front-end component, and generating an HTML code snippet; updating the preset JS object and entry function, completing the initialization of the candidate front-end component, and obtaining an initialized candidate front-end component.

[0008] Optionally, in a second implementation method of the first aspect of the embodiment of the present invention, the dynamically rendering the initialized candidate front-end component corresponding to the HTML code fragment, and obtaining the rendered target front-end component include: generating an interface UI node according to the HTML code fragment, the UI node including business logic and cascading style sheet CSS style; mounting the UI node into a position node to obtain the rendered target front-end component, the position node being the node whose mounting node value is passed in during initialization.

[0009] Optionally, in a third implementation manner of the first aspect of the embodiment of the present invention, before setting the entry function of the development framework and the parameters of the JS object, wherein the parameters include the mounting node value of the entry function and the basic data of the rendering parameters, the method further includes: defining a JS object, obtaining a preset JS object, and the defined JS object is generated according to the business data; setting the development framework and the basic style of the development framework, and obtaining the preset development framework.

[0010] Optionally, in a fourth implementation method of the first aspect of the embodiment of the present invention, setting the development framework and the basic style of the development framework, and obtaining the preset development framework include: setting the development framework to a unified development framework, which is one of the front-end technology frameworks; calling a flexible plug-in to set the root node pixel value of the unified development framework as a benchmark value, to obtain the set unified development framework; determining a preset size ratio as the interface UI design standard of the set unified development framework, to obtain the preset development framework.

[0011] Optionally, in a fifth implementation method of the first aspect of the embodiment of the present invention, a JS file is generated according to the rendered target front-end component, and all the JS files are stored. The JS file is generated by packaging the rendered target front-end component, including: mounting the rendered target front-end component into a global object to obtain a mounted front-end component, and the global object is a window object; packaging the mounted front-end component to obtain a packaged file; configuring a component name for the packaged file, and the component name is defined with the file name of the packaged file to obtain a JS file; uploading the JS file to a resource sharing platform for registration and publication to realize the storage of all the JS files.

[0012] Optionally, in a sixth implementation method of the first aspect of the embodiment of the present invention, obtaining user instructions, obtaining a target JS file from a pre-stored JS file according to the user instructions, and generating a corresponding rendered target front-end component in a preset page according to the target JS file includes: obtaining user instructions, the user instructions including voice instructions and text instructions; searching for JS files associated with the user instructions in the resource sharing platform according to the user instructions to obtain the target JS file; downloading the target JS file from the resource sharing platform, and rendering the corresponding rendered target front-end component in the preset page according to the target JS file.

[0013] The second aspect of an embodiment of the present invention provides a rendering device for a shared front-end component, comprising: a setting unit, used to set parameters of an entry function and a preset JS object, the parameters including a mount node value of the preset JS object and basic rendering parameter data; a first generating unit, used to generate a candidate front-end component according to the preset JS object and a preset development framework; an initialization unit, used to generate a hypertext markup language HTML code snippet and an initialized candidate front-end component according to the entry function, the parameters and the candidate front-end component; a rendering unit, used to dynamically render the corresponding initialized candidate front-end component according to the HTML code snippet, and obtain a rendered target front-end component; a second generating unit, used to generate a JS file according to the rendered target front-end component, and store all the JS files, the JS file being packaged and generated by the rendered target front-end component; a processing unit, used to obtain a user instruction, and obtain a target JS file from a pre-stored JS file according to the user instruction, and generate a corresponding rendered target front-end component in a preset page according to the target JS file.

[0014] Optionally, in a first implementation method of the second aspect of the embodiment of the present invention, the initialization unit specifically includes: a first generation module, used to input the mounting node value and the rendering parameter basic data into the entry function, assign values ​​to the candidate front-end component, and generate an HTML code snippet; an update module, used to update the preset JS object and entry function, complete the initialization of the candidate front-end component, and obtain an initialized candidate front-end component.

[0015] Optionally, in a second implementation method of the second aspect of the embodiment of the present invention, the rendering unit specifically includes: a second generation module, used to generate an interface UI node according to the HTML code fragment, and the UI node includes business logic and cascading style sheet CSS style; an acquisition module, used to mount the UI node into a location node to obtain the rendered target front-end component, and the location node is the node into which the mount node value is passed during initialization.

[0016] Optionally, in a third implementation method of the second aspect of the embodiment of the present invention, the rendering device of the shared front-end component also includes: a definition unit, used to define a JS object and obtain a preset JS object, and the defined JS object is generated according to business data; a preset unit, used to set a development framework and a basic style of the development framework, and obtain a preset development framework.

[0017] Optionally, in a fourth implementation method of the second aspect of the embodiment of the present invention, the preset unit is specifically used to: set the development framework to a unified development framework, which is one of the front-end technology frameworks; call a flexible plug-in to set the root node pixel value of the unified development framework as a benchmark value to obtain the set unified development framework; determine the preset size ratio as the interface UI design standard of the set unified development framework to obtain the preset development framework.

[0018] Optionally, in a fifth implementation method of the second aspect of the embodiment of the present invention, the second generation unit is specifically used to: mount the rendered target front-end component into a global object to obtain a mounted front-end component, where the global object is a window object; package the mounted front-end component to obtain a packaged file; configure a component name for the packaged file, where the component name is defined by the file name of the packaged file to obtain a JS file; upload the JS file to a resource sharing platform for registration and publication to achieve storage of all the JS files.

[0019] Optionally, in a sixth implementation method of the second aspect of the embodiment of the present invention, the processing unit is specifically used to: obtain user instructions, the user instructions including voice instructions and text instructions; according to the user instructions, search the resource sharing platform for JS files associated with the user instructions to obtain a target JS file; download the target JS file from the resource sharing platform, and render the corresponding rendered target front-end component according to the target JS file in the preset page.

[0020] A third aspect of an embodiment of the present invention provides a rendering device for a shared front-end component, comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, wherein the processor implements the rendering method based on the shared front-end component described in any one of the above-mentioned embodiments when executing the computer program.

[0021] A fourth aspect of an embodiment of the present invention provides a computer-readable storage medium, wherein the computer-readable storage medium stores instructions, which, when executed on a computer, enable the computer to execute the method described in the first aspect above.

[0022] It can be seen from the above technical solutions that the embodiments of the present invention have the following advantages:

[0023] The present invention provides a rendering method, device, equipment and storage medium for a shared front-end component, setting an entry function and parameters of a preset JS object, wherein the parameters include a mount node value and rendering parameter basic data of the preset JS object; generating a candidate front-end component according to the preset JS object and a preset development framework; generating a hypertext markup language HTML code snippet and an initialized candidate front-end component according to the entry function, the parameters and the candidate front-end component; dynamically rendering the corresponding initialized candidate front-end component according to the HTML code snippet, and obtaining a rendered target front-end component; generating a JS file according to the rendered target front-end component, and storing all the JS files, wherein the JS file is generated by packaging the rendered target front-end component; obtaining a user instruction, and obtaining a target JS file from a pre-stored JS file according to the user instruction, and generating a corresponding rendered target front-end component in a preset page according to the target JS file. In an embodiment of the present invention, the corresponding rendered target front-end component is downloaded for rendering according to the user instruction, without the need for a large amount of encoding and parsing of business data, thereby improving work efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0024] Figure 1 A schematic diagram of an embodiment of a rendering method for sharing a front-end component in the present invention;

[0025] Figure 2 It is a schematic diagram of another embodiment of the rendering method of the shared front-end component in the present invention;

[0026] Figure 3 A schematic diagram of an embodiment of a rendering device for sharing front-end components in the present invention;

[0027] Figure 4 It is a schematic diagram of another embodiment of a rendering device for sharing front-end components in the present invention;

[0028] Figure 5 A schematic diagram of an embodiment of a rendering device that shares a front-end component in the present invention. DETAILED DESCRIPTION

[0029] The present invention provides a rendering method, device, equipment and storage medium for sharing front-end components, which are used to develop front-end components using a unified development framework according to different JS objects, package the front-end components into JS files and upload them to a resource sharing platform, and call the corresponding JS files according to user instructions.

[0030] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.

[0031] The terms "first", "second", "third", "fourth", etc. (if any) in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments described herein can be implemented in an order other than that illustrated or described herein. In addition, the terms "including" or "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0032] See also Figure 1 , an embodiment of a rendering method for sharing a front-end component in an embodiment of the present invention includes:

[0033] 101. Set the parameters of the entry function and the preset JS object, including the mount node value and rendering parameter basic data of the preset JS object.

[0034] The terminal sets the entry function and the parameters of the preset JS object, including the mount node value of the preset JS object and the basic data of the rendering parameters.

[0035] When constructing the initial function, the terminal uses unified parameters to pass into a unified entry function. The parameters include the mount node value and the basic data of the rendering parameters. The basic data of the rendering parameters include information such as location, user, account, and role. The basic data of the rendering parameters can also be empty. The specific selection of which information to use as the basic data of the rendering parameters requires the IT developers in each business field to decide. In development, the entire document is a node tree. Each component in the document is a node. These nodes constitute a node tree. The nodes include element nodes, attribute nodes, and text nodes. In development, only element nodes and attribute nodes are generally required. The terminal can obtain the node value of the node through the attribute node. The node value is a string value. The mount node value mentioned in this embodiment is the node value of the location node where the component needs to be placed after it is rendered.

[0036] 102. Generate candidate front-end components based on preset JS objects and preset development frameworks.

[0037] The terminal generates candidate front-end components based on preset JS objects and preset development frameworks.

[0038] In this embodiment, the preset development framework is the vue framework. For example, if the preset JS object is "credit limit direct push", the terminal uses the vue framework, entry function and parameters to develop a "credit limit direct push" front-end component corresponding to the preset JS object of "credit limit direct push".

[0039] 103. Generate a Hypertext Markup Language HTML code snippet and initialized candidate front-end components based on the entry function, parameters and candidate front-end components.

[0040] The terminal generates a hypertext markup language HTML code snippet and initialized candidate front-end components according to the entry function, parameters and candidate front-end components.

[0041] The terminal completes the initialization of the front-end component by assigning initial values ​​to the front-end component and obtains a HTML code snippet.

[0042] It should be noted that initialization refers to the practice of assigning initial values ​​to data objects or variables. How to initialize depends on the programming language used and properties such as the storage type of the object to be initialized. In this embodiment, an initialization constructor, i.e., an entry function, is provided inside the front-end component and is open to external page calls.

[0043] 104. Dynamically render the corresponding initialized candidate front-end component according to the HTML code snippet, and obtain the rendered target front-end component.

[0044] The terminal dynamically renders the corresponding initialized candidate front-end component according to the HTML code snippet, and obtains the rendered target front-end component.

[0045] After generating the HTML code snippet, the terminal automatically generates a UI node, and the terminal mounts the automatically generated UI node into the node tree, thereby realizing dynamic rendering of the initialized candidate front-end component.

[0046] It should be noted that the candidate front-end component for dynamic rendering initialization is the interface that needs to be displayed to the user after the UI node executes the business logic.

[0047] 105. Generate JS files according to the rendered target front-end components, and store all JS files. The JS files are generated by packaging the rendered target front-end components.

[0048] The terminal generates JS files according to the rendered target front-end components and stores all JS files. The JS files are generated by packaging the rendered target front-end components.

[0049] The terminal packages the rendered target front-end component to obtain a JS file, then uploads the JS file to the resource sharing platform, registers and publishes it on the resource sharing platform to complete the storage of the JS file. After receiving the user's instructions, the terminal calls the corresponding JS file from the resource sharing platform through the middle platform, and renders the rendered target front-end component corresponding to the JS file.

[0050] 106. Obtain user instructions, and obtain a target JS file from pre-stored JS files according to the user instructions, and generate a corresponding rendered target front-end component in a preset page according to the target JS file.

[0051] Obtain user instructions, and obtain the target JS file from the pre-stored JS file according to the user instructions, and generate the corresponding rendered target front-end component in the preset page according to the target JS file.

[0052] The user enters instructions in the dialog box of the page, and the terminal obtains the user instructions.

[0053] For example, the user enters "credit limit" in the page dialog box, and the user instruction obtained by the terminal is "credit limit". According to the user instruction of "credit limit", the target JS file of "credit limit direct push" is obtained and downloaded, and then the terminal renders the target front-end component of "credit limit direct push" rendered corresponding to the target JS file of "credit limit direct push".

[0054] According to the embodiment of the present invention, the corresponding rendered target front-end component is downloaded according to the user instruction for rendering, without the need for a large amount of encoding and parsing of the business data, thereby improving work efficiency.

[0055] See also Figure 2 Another embodiment of the rendering method of the shared front-end component in the embodiment of the present invention includes:

[0056] 201. Define a JS object and obtain a preset JS object. The defined JS object is generated according to the business data.

[0057] The terminal defines a JS object, obtains a preset JS object, and the defined JS object is generated according to the business data.

[0058] The terminal defines a JS object, which can be business data such as credit card, debit card, financial management and VIP. Different JS objects can be generated according to different business data, thereby obtaining preset JS objects.

[0059] For example, the "credit limit direct push" of the credit card business data can be defined as a JS object, and the terminal obtains the preset JS object of the "credit limit direct push".

[0060] 202. Set the development framework and the basic style of the development framework, and obtain the preset development framework.

[0061] Set the development framework and the basic style of the development framework, and obtain the preset development framework.

[0062] Specifically, the terminal sets the development framework as a unified development framework, which is one of the front-end technical frameworks; the terminal calls the flexible plug-in to set the root node pixel value of the unified development framework as a reference value, and obtains the set unified development framework; the terminal determines the preset size ratio as the interface UI design standard of the set unified development framework, and obtains the preset development framework.

[0063] After the terminal completes the definition of JS objects, it prepares to develop front-end components. Since many different JS objects can be defined according to different business fields, many IT developers are required. In order to avoid style incompatibility and the problem of non-reusability of front-end components, the terminal of this solution chooses to adopt a unified basic style and development framework.

[0064] The terminal can adopt front-end technology frameworks such as native JS, vue, react and Angularjs according to actual conditions. In this embodiment, the terminal adopts vue as the development framework. The terminal calls the flexible plug-in to set the benchmark value to 32. The benchmark value can be set to other values, the preset size ratio can be set to 16:9, or the preset size ratio can be set to other ratios. This embodiment does not specifically limit the development framework, benchmark value and preset size ratio.

[0065] It should be noted that calling the flexible plug-in to set the benchmark value can enable the front-end component developed to automatically adjust the width according to the electronic screen resolution when the page is displayed. The IT developers in each business field use the preset size ratio as the UI design standard for the basic style of the development framework, which can effectively avoid the problem of inconsistent display ratios when used by IT developers in other business fields.

[0066] 203. Set the parameters of the entry function and the preset JS object, the parameters including the mount node value and the basic data of the rendering parameters of the preset JS object.

[0067] The terminal sets the entry function and the parameters of the preset JS object, including the mount node value of the preset JS object and the basic data of the rendering parameters.

[0068] When constructing the initial function, the terminal uses unified parameters to pass into a unified entry function. The parameters include the mount node value and the basic data of the rendering parameters. The basic data of the rendering parameters include information such as location, user, account, and role. The basic data of the rendering parameters can also be empty. The specific selection of which information to use as the basic data of the rendering parameters requires the IT developers in each business field to decide. In development, the entire document is a node tree. Each component in the document is a node. These nodes constitute a node tree. The nodes include element nodes, attribute nodes, and text nodes. In development, only element nodes and attribute nodes are generally required. The terminal can obtain the node value of the node through the attribute node. The node value is a string value. The mount node value mentioned in this embodiment is the node value of the location node where the component needs to be placed after it is rendered.

[0069] 204. Generate candidate front-end components according to preset JS objects and preset development frameworks.

[0070] The terminal generates candidate front-end components based on preset JS objects and preset development frameworks.

[0071] In this embodiment, the preset development framework is the vue framework. For example, if the preset JS object is "credit limit direct push", the terminal uses the vue framework, entry function and parameters to develop a "credit limit direct push" front-end component corresponding to the preset JS object of "credit limit direct push".

[0072] 205. Input the mount node value and the basic data of the rendering parameters into the entry function, assign values ​​to the candidate front-end components, and generate HTML code snippets.

[0073] The terminal inputs the mount node value and rendering parameter basic data into the entry function, assigns values ​​to the candidate front-end components, and generates HTML code snippets.

[0074] It should be noted that the mount node value is the value of the node where the component needs to be mounted, and the basic data of the rendering parameters includes location, user, account, and role.

[0075] 206. Update the preset JS object and entry function, complete the initialization of the candidate front-end component, and obtain the initialized candidate front-end component.

[0076] The terminal updates the preset JS object and entry function, completes the initialization of the candidate front-end component, and obtains the initialized candidate front-end component.

[0077] The constructor is mainly used to initialize the object when creating the object, that is, to assign initial values ​​to the object member variables. Most of them are used together with the new operator in the statement of creating the object. In this embodiment, the constructor is the entry function; the "update" in the update JS object and the entry function is actually the execution of an operator "new". When updating the object, the updated object must specify a defined class that can be used to create an instance. New can be used in a declaration statement or an assignment statement. When the statement is executed, it will create the object and call the function of the specified class. In this embodiment, the terminal passes the mounting node value and rendering parameter basic data required by the front-end component into the entry parameter, so that a HTML code snippet is generated inside the terminal, and then the JS object and the entry function are updated. The terminal calls this HTML code snippet, thus completing the initialization of the candidate front-end component, thereby obtaining the initialized candidate front-end component.

[0078] It should be noted that after initialization, the terminal can enable the front-end component to implement relevant business logic, including HTTP requests, data visualization, charting, etc.

[0079] For example, if you need to compile statistics on user usage trajectories, you can use data visualization to chart the business data. If the basic data is insufficient and you need to compile statistics on more business data in the user dimension, you can define HTTP requests or socket requests in the front-end components to obtain more accurate business data for display.

[0080] 207. Generate an interface UI node according to the HTML code snippet, where the UI node includes business logic and cascading style sheet CSS style.

[0081] The terminal generates an interface UI node according to the HTML code snippet. The UI node includes business logic and cascading style sheet CSS style.

[0082] After the mount node value and rendering parameter basic data of the JS object are passed into the entry function, an HTML code snippet is generated inside the front-end component, and the terminal automatically generates a UI node based on the HTML code snippet.

[0083] 208. The UI node is mounted into the position node to obtain the rendered target front-end component. The position node is the node into which the mount node value is passed during initialization.

[0084] The terminal mounts the UI node to the location node to obtain the rendered target front-end component. The location node is the node that passes the mount node value during initialization.

[0085] The position node can be understood as the node where the mount node value is passed in when the front-end component is initialized. The terminal uses the append method to mount the generated UI node in the position node, that is, the automatically generated UI node is mounted to its own position in the node tree using the append method, thereby realizing the dynamic rendering of the front-end component and obtaining the rendered target front-end component.

[0086] It should be noted that the dynamic rendering front-end component is the interface that needs to be displayed to the user after the UI node executes the business logic.

[0087] 209. Generate a JS file according to the rendered target front-end component, and store all JS files. The JS file is generated by packaging the rendered target front-end component.

[0088] The terminal generates JS files according to the rendered target front-end components and stores all JS files. The JS files are generated by packaging the rendered target front-end components.

[0089] Specifically, the terminal mounts the rendered target front-end component into the global object to obtain the mounted front-end component, and the global object is the window object; the terminal packages the mounted front-end component to obtain a packaged file; the terminal configures the component name for the packaged file, and the component name is defined by the file name of the packaged file to obtain a JS file; the terminal uploads the JS file to the resource sharing platform for registration and publication to realize the storage of all JS files.

[0090] The terminal uses the roll up module packaging tool to package the rendered target front-end component into a separate executable package file. The format of the package file is min.js. The terminal names the package file in the min.js format. For example, the package file of "Quota Direct Push" is named "limitContent.min.js" to obtain the JS file of "limitContent.min.js". Finally, the terminal uploads the JS file of "limitContent.min.js" to the resource sharing platform, registers and publishes it on the resource sharing platform, and completes the storage of all JS files. After receiving the user's instructions, the terminal downloads the corresponding JS file from the resource sharing platform through the middle platform, and renders the rendered target front-end component corresponding to the JS file.

[0091] 210. Obtain user instructions, and obtain a target JS file from pre-stored JS files according to the user instructions, and generate a corresponding rendered target front-end component in a preset page according to the target JS file.

[0092] The terminal obtains a user instruction, obtains a target JS file from a pre-stored JS file according to the user instruction, and generates a corresponding rendered target front-end component in a preset page according to the target JS file.

[0093] Specifically, the terminal obtains user instructions, which include voice instructions and text instructions; the terminal searches for JS files associated with the user instructions in the resource sharing platform according to the user instructions, and obtains the target JS file; the terminal downloads the target JS file from the resource sharing platform, and renders the corresponding rendered target front-end component according to the target JS file in the preset page.

[0094] The user enters instructions in the dialog box of the page, and the terminal obtains the user instructions.

[0095] For example, when the user enters "amount" in the page dialog box, the user instruction obtained by the terminal is "amount". According to the user instruction of "amount", the terminal searches for the related JS files in the resource sharing platform to obtain the target JS file of "limitContent.min.js". The terminal downloads the target JS file of "limitContent.min.js" through the middle platform, and generates the target front-end component after rendering corresponding to the target JS file of "limitContent.min.js" on the preset page.

[0096] The embodiment of the present invention is used to download the corresponding rendered target front-end component for rendering according to user instructions, without the need for a large amount of encoding and parsing of business data, thereby improving work efficiency.

[0097] The above describes the rendering method of the shared front-end component in the embodiment of the present invention. The following describes the rendering device of the shared front-end component in the embodiment of the present invention. Figure 3 , an embodiment of a rendering device for sharing a front-end component in an embodiment of the present invention includes:

[0098] A setting unit 301 is used to set parameters of an entry function and a preset JS object, wherein the parameters include a mount node value of the preset JS object and basic rendering parameter data;

[0099] The first generating unit 302 is used to generate a candidate front-end component according to a preset JS object and a preset development framework;

[0100] Initialization unit 303, used to generate a hypertext markup language HTML code fragment and an initialized candidate front-end component according to the entry function, parameters and candidate front-end components;

[0101] The rendering unit 304 is used to dynamically render the corresponding initialized candidate front-end component according to the HTML code fragment, and obtain the rendered target front-end component;

[0102] The second generating unit 305 is used to generate a JS file according to the rendered target front-end component and store all JS files, where the JS file is generated by packaging the rendered target front-end component;

[0103] The processing unit 306 is used to obtain a user instruction, and obtain a target JS file from a pre-stored JS file according to the user instruction, and generate a corresponding rendered target front-end component in a preset page according to the target JS file.

[0104] According to the embodiment of the present invention, the corresponding rendered target front-end component is downloaded according to the user instruction for rendering, without the need for a large amount of encoding and parsing of the business data, thereby improving work efficiency.

[0105] See also Figure 4 Another embodiment of the rendering device for sharing the front-end component in the embodiment of the present invention includes:

[0106] A setting unit 301 is used to set parameters of an entry function and a preset JS object, wherein the parameters include a mount node value of the preset JS object and basic rendering parameter data;

[0107] The first generating unit 302 is used to generate a candidate front-end component according to a preset JS object and a preset development framework;

[0108] Initialization unit 303, used to generate a hypertext markup language HTML code fragment and an initialized candidate front-end component according to the entry function, parameters and candidate front-end components;

[0109] The rendering unit 304 is used to dynamically render the corresponding initialized candidate front-end component according to the HTML code fragment, and obtain the rendered target front-end component;

[0110] The second generating unit 305 is used to generate a JS file according to the rendered target front-end component and store all JS files, where the JS file is generated by packaging the rendered target front-end component;

[0111] The processing unit 306 is used to obtain a user instruction, and obtain a target JS file from a pre-stored JS file according to the user instruction, and generate a corresponding rendered target front-end component in a preset page according to the target JS file.

[0112] Optionally, the initialization unit 303 specifically includes:

[0113] The first generation module 3031 is used to input the mount node value and the rendering parameter basic data into the entry function, assign values ​​to the candidate front-end components, and generate HTML code snippets;

[0114] The updating module 3032 is used to update the preset JS object and entry function, call the HTML code snippet, complete the initialization of the candidate front-end component, and obtain the initialized candidate front-end component.

[0115] Optionally, the rendering unit 304 specifically includes:

[0116] The second generating module 3041 is used to generate an interface UI node according to the HTML code fragment, and the UI node includes business logic and cascading style sheet CSS style;

[0117] The acquisition module 3042 is used to mount the UI node into the position node to obtain the rendered target front-end component. The position node is the node into which the mount node value is passed during initialization.

[0118] Optionally, the rendering device of the shared front-end component further includes:

[0119] A definition unit 307 is used to define a JS object and obtain a preset JS object, wherein the defined JS object is generated according to the business data;

[0120] The preset unit 308 is used to set the development framework and the basic style of the development framework, and obtain the preset development framework.

[0121] Optionally, the preset unit 308 is specifically used for:

[0122] Set the development framework to the unified development framework, which is one of the front-end technology frameworks;

[0123] Call the flexible plug-in to set the root node pixel value of the unified development framework as the reference value, and obtain the unified development framework after setting;

[0124] The preset size ratio is determined as the interface UI design standard of the unified development framework after setting, so as to obtain the preset development framework.

[0125] Optionally, the second generating unit 305 is specifically configured to:

[0126] Mount the rendered target front-end component to the global object to obtain the mounted front-end component. The global object is the window object.

[0127] Package the mounted front-end components to obtain package files;

[0128] Configure the component name for the packaged file. The component name is defined by the file name of the packaged file to obtain the JS file.

[0129] Upload the JS file to the resource sharing platform for registration and publishing to achieve storage of all JS files.

[0130] Optionally, the processing unit 306 is specifically configured to:

[0131] Obtain user instructions, which include voice instructions and text instructions;

[0132] According to the user instruction, the JS file associated with the user instruction is searched in the resource sharing platform to obtain the target JS file;

[0133] The target JS file is downloaded from the resource sharing platform, and in the preset page, the corresponding rendered target front-end component is rendered according to the target JS file.

[0134] According to the embodiment of the present invention, the corresponding rendered target front-end component is downloaded according to the user instruction for rendering, without the need for a large amount of encoding and parsing of the business data, thereby improving work efficiency.

[0135] above Figure 3 to Figure 4 The rendering apparatus of the shared front-end component in the embodiment of the present invention is described in detail from the perspective of modular functional entities. The rendering device of the shared front-end component in the embodiment of the present invention is described in detail from the perspective of hardware processing.

[0136] Combine the following Figure 5 A detailed introduction to the various components of the rendering device that shares the front-end components:

[0137] Figure 5 : is a schematic diagram of the structure of a rendering device for a shared front-end component provided by an embodiment of the present invention. The rendering device 500 for the shared front-end component may have relatively large differences due to different configurations or performances, and may include one or more processors (central processing units, CPU) 501 (for example, one or more processors) and a memory 509, and one or more storage media 508 (for example, one or more massive storage devices) for storing application programs 507 or data 506. Among them, the memory 509 and the storage medium 508 may be short-term storage or persistent storage. The program stored in the storage medium 508 may include one or more modules (not shown in the figure), and each module may include a series of instruction operations in the sign-in management device. Furthermore, the processor 501 may be configured to communicate with the storage medium 508 to execute a series of instruction operations in the storage medium 508 on the rendering device 500 for the shared front-end component.

[0138] The rendering device 500 sharing the front-end component may also include one or more power supplies 502, one or more wired or wireless network interfaces 503, one or more input and output interfaces 504, and / or one or more operating systems 505, such as Windows Server, Mac OS X, Unix, Linux, FreeBSD, etc. It will be appreciated by those skilled in the art that Figure 5 The structure of the rendering device sharing the front-end component shown in the figure does not constitute a limitation on the rendering device sharing the front-end component, and may include more or less components than shown in the figure, or combine certain components, or arrange the components differently.

[0139] Combine the following Figure 5 A detailed introduction to the various components of the rendering device that shares the front-end components:

[0140] Processor 501 is the control center of the rendering device of the shared front-end component, and can be processed according to the rendering method of the shared front-end component. Processor 501 uses various interfaces and lines to connect the various parts of the rendering device of the entire shared front-end component, and by running or executing the software program and / or module stored in the memory 509, and calling the data stored in the memory 509, the corresponding rendered target front-end component is called and rendered using user instructions to improve work efficiency. Storage medium 508 and memory 509 are both carriers for storing data. In the embodiment of the present invention, storage medium 508 may refer to an internal memory with a small storage capacity but a fast speed, and memory 509 may be an external memory with a large storage capacity but a slow storage speed.

[0141] The memory 509 can be used to store software programs and modules. The processor 501 executes various functional applications and data processing of the rendering device 500 of the shared front-end component by running the software programs and modules stored in the memory 509. The memory 509 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function, etc.; the data storage area may store data created according to the use of the rendering device of the shared front-end component, etc. In addition, the memory 509 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other non-volatile solid-state storage devices. The rendering program of the shared front-end component provided in the embodiment of the present invention and the received data stream are stored in the memory, and when needed, the processor 501 calls from the memory 509.

[0142] When loading and executing computer program instructions on a computer, a process or function according to an embodiment of the present invention is generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. Computer instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium, for example, a computer instruction may be transmitted from a website site, a computer, a server, or a data center to another website site, a computer, a server, or a data center by wired (e.g., coaxial cable, optical fiber, twisted pair) or wireless (e.g., infrared, wireless, microwave, etc.) means. Computer-readable storage media may be any available medium that a computer can store or a data storage device such as a server or a data center that includes one or more available media integrations. Available media may be magnetic media, (e.g., floppy disk, hard disk, tape), optical media (e.g., optical disk), or semiconductor media (e.g., solid state disk (SSD)), etc.

[0143] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.

[0144] In the several embodiments provided by the present invention, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic, for example, the division of units is only a logical function division, and there may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.

[0145] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0146] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0147] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods of each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), disk or optical disk, etc., various media that can store program codes.

[0148] The above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features thereof may be replaced by equivalents. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A rendering method for a shared front-end component, characterized in that: include: Set the parameters of the entry function and the preset JS object, including the mount node value and rendering parameter basic data of the preset JS object; Generate candidate front-end components according to the preset JS object and the preset development framework; Generate a hypertext markup language HTML code snippet and an initialized candidate front-end component according to the entry function, the parameters and the candidate front-end component; Dynamically render the initialized candidate front-end component corresponding to the HTML code snippet, and obtain the rendered target front-end component; Generate a JS file according to the rendered target front-end component, and store all the JS files, wherein the JS file is generated by packaging the rendered target front-end component; Obtaining user instructions, and obtaining a target JS file from a pre-stored JS file according to the user instructions, and generating a corresponding rendered target front-end component in a preset page according to the target JS file; The dynamically rendering the initialized candidate front-end component corresponding to the HTML code snippet to obtain the rendered target front-end component comprises: generating an interface UI node according to the HTML code snippet, wherein the UI node comprises business logic and cascading style sheet CSS style; The UI node is mounted into the position node by using the append method to obtain the rendered target front-end component, and the position node is the node into which the mount node value is passed during initialization.

2. The rendering method of a shared front-end component according to claim 1, characterized in that: The step of generating a hypertext markup language HTML code snippet and an initialized candidate front-end component according to the entry function, the parameter and the candidate front-end component comprises: Input the mount node value and the rendering parameter basic data into the entry function, assign a value to the candidate front-end component, and generate an HTML code snippet; The preset JS object and entry function are updated to complete the initialization of the candidate front-end component, and an initialized candidate front-end component is obtained.

3. The rendering method of a shared front-end component according to claim 1, characterized in that: Before setting the entry function of the development framework and the parameters of the JS object, wherein the parameters include the mount node value of the entry function and the basic data of the rendering parameters, the method further includes: Define the JS object, get the preset JS object, and the defined JS object is generated according to the business data; Set the development framework and the basic style of the development framework, and obtain the preset development framework.

4. The rendering method of the shared front-end component according to claim 3, characterized in that: The setting of the development framework and the basic style of the development framework and obtaining the preset development framework include: Set the development framework to a unified development framework, which is one of the front-end technology frameworks; Calling the flexible plug-in to set the root node pixel value of the unified development framework as a reference value, and obtaining the set unified development framework; The preset size ratio is determined as the interface UI design standard of the set unified development framework to obtain the preset development framework.

5. The rendering method of a shared front-end component according to any one of claims 1 to 4, characterized in that: The generating of JS files according to the rendered target front-end components and storing all the JS files, wherein the JS files are generated by packaging the rendered target front-end components, comprises: Mount the rendered target front-end component into a global object to obtain a mounted front-end component, where the global object is a window object; Packaging the mounted front-end components to obtain a packaged file; Configure a component name for the packaged file, wherein the component name is defined by the file name of the packaged file to obtain a JS file; The JS files are uploaded to the resource sharing platform for registration and publication to achieve storage of all the JS files.

6. The rendering method of the shared front-end component according to claim 5, characterized in that: The obtaining of the user instruction, obtaining the target JS file from the pre-stored JS file according to the user instruction, and generating the corresponding rendered target front-end component in the preset page according to the target JS file comprises: Obtain user instructions, which include voice instructions and text instructions; According to the user instruction, searching the resource sharing platform for a JS file associated with the user instruction to obtain a target JS file; The target JS file is downloaded from the resource sharing platform, and the corresponding rendered target front-end component is rendered in the preset page according to the target JS file.

7. A rendering device sharing a front-end component, characterized in that: include: A setting unit, used to set parameters of the entry function and the preset JS object, wherein the parameters include the mount node value and rendering parameter basic data of the preset JS object; A first generating unit, configured to generate a candidate front-end component according to the preset JS object and the preset development framework; An initialization unit, used to generate a hypertext markup language HTML code fragment and an initialized candidate front-end component according to the entry function, the parameters and the candidate front-end component; A rendering unit, used for dynamically rendering the corresponding initialized candidate front-end component according to the HTML code snippet, and obtaining the rendered target front-end component; A second generating unit is used to generate a JS file according to the rendered target front-end component and store all the JS files, wherein the JS file is generated by packaging the rendered target front-end component; A calling unit, used to obtain a user instruction, and obtain a target JS file from a pre-stored JS file according to the user instruction, and generate a corresponding rendered target front-end component in a preset page according to the target JS file; The rendering unit is specifically used for: generating an interface UI node according to the HTML code snippet, wherein the UI node includes business logic and cascading style sheet CSS style; and mounting the UI node to a position node by using an append method to obtain a rendered target front-end component, wherein the position node is a node to which the mounting node value is passed during initialization.

8. A rendering device sharing a front-end component, characterized in that: It includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, it implements the rendering method of the shared front-end component as described in any one of claims 1 to 6.

9. A computer-readable storage medium, characterized in that: The invention comprises instructions, which, when executed on a computer, enable the computer to execute the steps of the rendering method of a shared front-end component as described in any one of claims 1 to 6.

Citation Information

Patent Citations

  • Customer service system construction method and device, storage medium and electronic equipment

    CN110363542A