Webpage code online batch modification method, system and terminal
By obtaining user needs and using page selection modules and server-side parsing library, automated operations of target pages and batch modification of data environments are achieved, and the problems of cumbersome page code modification and inability to be published in real time in the existing technology are solved, improving system update efficiency and flexibility.
Patent Information
- Application Number
- CN202510269663.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-07
- Publication Date
- 2025-08-01
AI Technical Summary
In the prior art, when dealing with code modifications of different pages, each page needs to be edited cumbersomely and individually, and online real-time release cannot be achieved, resulting in low efficiency and flexibility in system updates and iteration, and high labor and time costs.
By obtaining user needs, using the page selection module to generate target requests, combining server-side parsing library and front-end framework technology, it realizes automated operations of the target page and batch modification of the data environment, and supports real-time online updates.
It realizes accurate and fast batch modification of web page code, supports real-time online updates, saves manpower and time costs, and improves the efficiency and flexibility of system updates and iterations.
Smart Images

Figure CN120406922A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of computer software, and particularly to an online batch modification method, system and terminal for web page code. Background Art
[0002] In the continuous development and operation of enterprise-level software systems, the modification of system pages is a common but cumbersome task. The current operation paradigm requires developers to perform manual operations for each page to be modified, which involves opening the page file in the local development environment, using a code editor to adjust specific HTML (HyperText Markup Language), CSS (Cascading Style Sheets) and JavaScript (a widely used programming language, mainly used in web development to enhance the interactivity of web pages) code segments one by one, and then repackaging the modified page file and handing it over to relevant personnel or uploading it to the server through a deployment tool to complete the deployment and update operation.
[0003] However, currently, when dealing with code modifications of different pages, it is often necessary to perform cumbersome individual editing for each page, and online real-time publishing cannot be achieved, which severely limits the efficiency and flexibility of system update and iteration. Therefore, when facing frequent page function fine-tuning requirements, the resulting human and time costs are extremely high.
[0004] Therefore, the prior art still needs to be improved and developed. Summary of the Invention
[0005] The main purpose of the present invention is to provide an online batch modification method, system, terminal and computer-readable storage medium for web page code, aiming to solve the problem in the prior art that when dealing with code modifications of different pages, it is often necessary to perform cumbersome individual editing for each page, and online real-time publishing cannot be achieved, which severely limits the efficiency and flexibility of system update and iteration. Therefore, when facing frequent page function fine-tuning requirements, the resulting human and time costs are extremely high.
[0006] To achieve the above object, the present invention provides an online batch modification method for web page code, and the online batch modification method for web page code includes the following steps:
[0007] Obtain user requirements, and based on a pre-set page selection module, obtain a target request according to the user requirements;
[0008] Obtain target page information according to the target page in the target request, and perform non-empty verification on the target request. When the verification passes, obtain the script content in the parameters;
[0009] Based on the target page information and the parsing library preset on the server side, perform target-oriented operations on the target page to obtain a target page data environment, and based on the target page data environment, use built-in functions to parse the script content to obtain executable code snippets;
[0010] According to the user requirements, use the executable code snippets to automatically modify the target elements in the target page data environment, and send the modified target page data environment to the front end for rendering as a visual web page.
[0011] Optionally, before the steps of obtaining user requirements, and based on the user requirements, obtaining the target page and the target request, further include:
[0012] Pre-write the script content for operating on page elements;
[0013] According to the data binding mechanism, perform two-way binding of front-end data and back-end data.
[0014] Optionally, the obtaining of the user requirements, based on a pre-set page selection module, and according to the user requirements, obtaining the target request specifically includes:
[0015] Obtain user requirements, where the user requirements include the target page and the target element operation requirements;
[0016] Based on a pre-set page selection module, select the target page from the page directory tree, and generate a target request according to the target page.
[0017] Optionally, the obtaining of the target page information according to the target page in the target request, and performing a non-empty verification on the target request, and when the verification passes, obtaining the script content in the parameters specifically includes:
[0018] According to the file system operation on the server side, read and preprocess the target page to obtain the target page information, where the target page information includes the organization and metadata information of the target page;
[0019] Verify whether the token and parameters in the target request are empty. When they are not empty, the verification passes, and obtain the script content from the parameters.
[0020] Optionally, the performing of the target-oriented operations on the target page based on the target page information and the parsing library preset on the server side to obtain a target page data environment specifically includes:
[0021] Parse the target page according to the parsing library on the server side, and convert the page into a tree structure;
[0022] Recursively traverse the tree structure according to the target page information, convert each node of the tree structure and its attribute and child node information into a data object in the target format, and obtain the target page data environment after the conversion ends.
[0023] Optionally, according to the user requirement, using the executable code snippet to automatically modify the target element in the target page data environment, specifically including:
[0024] Obtain the target element operation requirement according to the user requirement;
[0025] According to the target element operation requirement, access the target page data environment according to the executable code snippet, and automatically modify the target element in the target page data environment according to the target element operation requirement.
[0026] Optionally, sending the modified target page data environment to the front end for rendering into a visual web page, specifically including:
[0027] Send the modified page data environment to the front end through a real-time communication protocol;
[0028] The front end renders the modified page data environment into a visual web page according to the rendering mechanism. Among them, during the rendering process, the front end dynamically innovates and updates the corresponding interactive elements according to the element structure and attribute information in the modified page data environment.
[0029] In addition, to achieve the above object, the present invention also provides a web code online batch modification system, wherein the web code online batch modification system includes:
[0030] A target request acquisition module, configured to acquire user requirements, and based on a pre-set page selection module, acquire a target request according to the user requirements;
[0031] A script content acquisition module, configured to acquire target page information according to the target page in the target request, and perform a non-empty verification on the target request, and acquire the script content in the parameter when the verification passes;
[0032] An executable code snippet generation module, configured to perform a targeting operation on the target page based on the target page information and a parsing library preset on the server side to obtain a target page data environment, and based on the target page data environment, parse the script content using a built-in function to obtain an executable code snippet;
[0033] A visualization module, which is used to automatically modify target elements in a target page data environment according to the user requirements by using the executable code snippets, and send the modified target page data environment to the front end for rendering into a visualized web page.
[0034] In addition, to achieve the above object, the present invention also provides a terminal, wherein the terminal includes: a memory, a processor, and a web code online batch modification program stored on the memory and executable on the processor. When the web code online batch modification program is executed by the processor, the steps of the above-mentioned web code online batch modification method are implemented.
[0035] In addition, to achieve the above object, the present invention also provides a computer-readable storage medium, wherein the computer-readable storage medium stores a web code online batch modification program. When the web code online batch modification program is executed by a processor, the steps of the above-mentioned web code online batch modification method are implemented.
[0036] In the present invention, user requirements are obtained. Based on a preset page selection module, a target request is obtained according to the user requirements. Target page information is obtained according to the target page in the target request, and a non-empty verification is performed on the target request. When the verification passes, the script content in the parameters is obtained. Based on the target page information and a preset parsing library on the server side, a targeting operation is performed on the target page to obtain a target page data environment. Based on the target page data environment, the script content is parsed by using built-in functions to obtain executable code snippets. According to the user requirements, the target elements in the target page data environment are automatically modified by using the executable code snippets, and the modified target page data environment is sent to the front end for rendering into a visualized web page. By introducing an advanced front-end and back-end technical architecture, the present invention can accurately and quickly batch modify web code, support real-time online updates, and thus save a large amount of labor and time costs in practical applications for frequent page function fine-tuning requirements. Description of the Drawings
[0037] Figure 1 is a flowchart of a preferred embodiment of the web code online batch modification method of the present invention;
[0038] Figure 2 is a schematic diagram of script content in an embodiment of the web code online batch modification method of the present invention;
[0039] Figure 3 is a schematic diagram of an implementation process in the web code online batch modification method of the present invention;
[0040] Figure 4It is a structural diagram of a preferred embodiment of the online batch modification system for web page code of the present invention;
[0041] Figure 5 It is a structural diagram of a preferred embodiment of the terminal of the present invention. Detailed implementation manners
[0042] To make the objectives, technical solutions and advantages of the present invention clearer and more definite, the following further describes the present invention in detail with reference to the accompanying drawings and by way of examples. It should be understood that the specific examples described herein are only used to explain the present invention and are not used to limit the present invention.
[0043] During the continuous development and operation of enterprise-level software systems, the modification of system pages is a common but cumbersome task. The current operation paradigm requires developers to perform manual operations for each page that needs to be modified. This involves opening the page file in the local development environment, using a code editor to adjust specific HTML, CSS, and JavaScript code snippets one by one, and then repackaging the modified page file and handing it over to relevant personnel or uploading it to the server through a deployment tool to complete the deployment and update operation. However, currently, a large number of page modification requirements often focus on minor function adjustments, such as changing the label name of a specific field, adding a new data display field at a specific position, or locally optimizing the style of page elements. In this case, the traditional per-page editing and overall deployment process is extremely inefficient and time-consuming. When dealing with code modifications of different pages, it often requires cumbersome individual editing of each page and cannot achieve real-time online publishing, severely limiting the efficiency and flexibility of system updates and iterations. Therefore, when facing frequent page function fine-tuning requirements, the resulting human and time costs are extremely high.
[0044] To address one or more of the above problems, the present invention obtains user requirements, based on a pre-set page selection module, obtains a target request according to the user requirements; obtains target page information according to the target page in the target request, and performs a non-empty verification on the target request. When the verification passes, obtains the script content in the parameters; based on the target page information and a parsing library preset on the server side, performs a targeting operation on the target page to obtain a target page data environment, and based on the target page data environment, uses built-in functions to parse the script content to obtain executable code snippets; according to the user requirements, uses the executable code snippets to automatically modify the target elements in the target page data environment, and sends the modified target page data environment to the front end for rendering as a visual web page.
[0045] The online batch modification method for web page code according to a preferred embodiment of the present invention, as Figure 1As shown, the online batch modification method of the web page code includes the following steps:
[0046] Step S10: Obtain user requirements. Based on a pre-set page selection module, obtain a target request according to the user requirements.
[0047] Specifically, in the present invention, when batch-modifying the web page code, first obtain the corresponding user requirements, so as to judge the web page to be modified by the user and the specific content to be modified, and then obtain the target request sent by the page selection module to perform subsequent operations.
[0048] Further, before the steps of obtaining user requirements and obtaining a target page and a target request according to the user requirements, it further includes:
[0049] Pre-write script content for operating on page elements;
[0050] According to the data binding mechanism, perform two-way binding of front-end data and back-end data.
[0051] Specifically, in the present invention, a JavaScript script for operating on page elements is pre-written. Among them, through the combination of JavaScript with HTML and CSS, JavaScript enables the web page to respond to user operations, dynamically update content, and interact with users. As Figure 2 shown, it is a schematic diagram of the script content of an embodiment in the present invention. Developers use JavaScript programming technology, combined with the programming paradigm of the selected front-end framework, such as Vue.js (a progressive JavaScript framework for building user interfaces) or React.js (a JavaScript library for building user interfaces), to write highly targeted and precise script code. These scripts utilize the powerful pre-DOM (a standardized way of representing and operating on web page content) operation APIs (Application Programming Interfaces) provided by the framework, and can accurately locate the page elements that need to be modified or added through CSS selectors, XPath (XML Path Language) expressions, or other precise element positioning strategies. For example, through the document.querySelectorAll() method (a method in JavaScript for selecting all elements that meet the specified CSS selector in an HTML document) combined with specific CSS class names or ID selectors, obtain the Element (in HTML, Labels are used to define a set of paragraphs, or new <input> elements (elements in HTML used to create interactive form controls that allow users to input data), and various attributes such as type, placeholder, etc. are set for them through the setAttribut() method (a method in JavaScript for operating on the DOM (Document Object Model) that allows setting attributes for a specified HTML element or modifying the existing attribute values of an element) to achieve the insertion of new elements and attribute configuration.
[0052] After writing the corresponding script, at the same time, using the data binding mechanism of the front-end framework, such as the v-model directive in Vue.js (a directive in the Vue.js framework for implementing two-way data binding) or useState in React.js (a Hook in React.js used to add state to a functional component, enabling the functional component to store and update data during the rendering process) and the useEffect hook function (a Hook in React.js for handling side effects, where side effects refer to operations that need to be performed during the component rendering process, such as data fetching, event listening, timer setting, DOM update, etc.), to achieve two-way binding and real-time update of the data of page elements, ensuring that the modified page elements can promptly reflect the data changes and maintain consistency with the back-end data.
[0053] In one embodiment, when modifying a product price display field, the modified price data is updated in real time to the corresponding In an element (an inline element in HTML used to group, identify, or style a portion of text or an element in a document), while ensuring that the data is synchronously updated with the product price information in the backend database, thereby achieving the efficiency and accuracy of page element modification and providing a solid technical foundation for subsequent batch modification operations.
[0054] Further, the obtaining of user requirements, based on a pre-set page selection module, according to the user requirements, obtaining a target request, specifically includes:
[0055] Obtaining user requirements, where the user requirements include a target page and target element operation requirements;
[0056] Based on a pre-set page selection module, select the target page from the page directory tree and generate a target request according to the target page.
[0057] Specifically, in the present invention, after obtaining user requirements, the user requirements include a target page and target element operation requirements. The target page is the page that needs to be modified, and the target element operation requirements are the content that needs to be modified. Also in the present invention, the system has pre-constructed a powerful and user-friendly page selection module on the front-end interface. This module uses the <input type="checkbox"> element (a type of HTML form element representing a checkbox) in combination with the event listening mechanism of JavaScript to achieve flexible selection operations for multiple pages. Users can quickly and accurately screen out the target pages that need code modification from the system's page directory tree by clicking on the checkboxes in the page list or using keyboard shortcuts (such as Shift + mouse click for continuous multiple selection, Ctrl + mouse click for discontinuous multiple selection). After selecting the corresponding target page, the page selection module sends the selected page information to the backend server in the form of a target request through AJAX (a technology for creating dynamic web applications). Among them, the target request includes a token and parameters, and the parameters are the pre-constructed script content.
[0058] Step S20: Obtain target page information according to the target page in the target request, and perform non-empty verification on the target request. When the verification passes, obtain the script content in the parameters.
[0059] Specifically, in the backup, the corresponding target page information can be obtained according to the target page in the target request, and the script content can be correspondingly obtained when the verification passes.
[0060] Further, obtaining target page information according to the target page in the target request, and performing non-empty verification on the target request, and when the verification passes, obtaining the script content in the parameter, specifically including:
[0061] According to the file system operation of the server side, reading and preprocessing the target page to obtain target page information, where the target page information includes the organization and metadata information of the target page;
[0062] Verifying whether the token and parameter in the target request are empty. When they are not empty, the verification passes, and the script content is obtained from the parameter.
[0063] Specifically, after the backend server obtains the target request, using the file system operation API (Application Programming Interface) of the server side, such as the fs module (file system) of Node.js (a JavaScript runtime environment built on the Chrome V8 JavaScript engine) or the os module (a module in the Python standard library that provides functions for interacting with the operating system) of Python, perform read and preprocessing operations on the selected page file, including reading the corresponding target page and performing preprocessing, that is, parsing the structure of the page file, extracting key metadata information (such as page title, keywords, description, etc.), and storing this information in the server memory for subsequent JSON (JavaScript Object Notation, a lightweight data exchange format) serialization processing and script operations, ensuring that the system can accurately and efficiently perform batch modification processing on the selected page and meet the diverse page modification requirements of enterprises.
[0064] In the present invention, after the backend server obtains the target request, it will verify whether the token and parameter of the target request are empty. When the verification passes and it is obtained that the token and parameter are not empty, the parameter is parsed to obtain the script content inside the parameter to ensure the legality and integrity of the request. Then, the backend server starts an independent script execution thread, using the child_process module of Node.js (used to create and manage child processes) or the subprocess module of Python (a standard library module that allows generating new processes, connecting to their input, output, and error pipes, and obtaining their return codes), to securely execute the script content transmitted from the front end in the server environment, and at the same time perform real-time monitoring and error capture on the execution process of the script to ensure that the script can run stably and accurately on the server side, avoiding system failures or data corruption caused by script errors, thereby ensuring the reliability and stability of the entire page modification process.
[0065] Step S30: Based on the target page information and the parsing library preset on the server side, perform a targeting operation on the target page to obtain a target page data environment, and based on the target page data environment, use built-in functions to parse the script content to obtain executable code snippets.
[0066] Specifically, in the present invention, after obtaining the target page information, the target page is JSONified, that is, the targeting operation, which facilitates parsing the script content through the JSONified target page and obtaining the corresponding executable code snippets.
[0067] Further, the performing a targeting operation on the target page based on the target page information and the parsing library preset on the server side to obtain a target page data environment specifically includes:
[0068] Parse the target page according to the parsing library on the server side and convert the page into a tree structure;
[0069] Recursively traverse the tree structure according to the target page information, and convert each node of the tree structure and its attribute and child node information into a data object in the target format. After the conversion is completed, a target page data environment is obtained.
[0070] Specifically, in the present invention, after receiving a script execution request, the corresponding page is JSONified, that is, using the HTML parsing library on the server side, such as the cheerio library of Node.js or the BeautifulSoup library of Python, to parse the selected page file, convert the HTML structure of the page into a tree-shaped data structure, and then combine the obtained target page information. By recursively traversing the tree structure, each node and its attribute and child node information are converted into a data object in JSON format, thereby realizing the JSONification process of the page and obtaining a target page data environment.
[0071] After that, in the JSONified page data environment, according to the script content transmitted from the front end, use the JSON.parse() method of JavaScript (a built-in function in JavaScript for parsing a JSON string into a corresponding JavaScript object or value. It takes a string that conforms to the JSON specification as input and converts it into a native data type in JavaScript, such as an object, an array, a string, a number, a boolean value, or null) to parse the operation logic in the script into executable code snippets, and the executable code snippets can achieve precise modification of page elements through operations of accessing and modifying the attributes of the JSON data object.
[0072] Step S40: According to the user requirements, use the executable code snippet to automatically modify the target elements in the target page data environment, and send the modified target page data environment to the front end for rendering as a visual web page.
[0073] It should be noted that after automatically modifying the target elements in the target page data environment, the present invention will use the database operation AP on the server side (such as the mongoose library of Node.js or the SQLAlchemy library of Python) to submit the modified data to the back-end database for persistent storage to ensure the security and consistency of the data.
[0074] Further, the automatically modifying the target elements in the target page data environment according to the user requirements specifically includes:
[0075] Obtain the target element operation requirements according to the user requirements;
[0076] According to the target element operation requirements, access the target page data environment according to the executable code snippet, and automatically modify the target elements in the target page data environment according to the target element operation requirements.
[0077] Specifically, in the present invention, after obtaining the corresponding executable snippet, the target element operation requirements are obtained from the user requirements, that is, modifying the attribute value or performing an insertion operation, etc. Through the target element operation requirements, the specific execution operations of the executable code snippet can be correspondingly set, so as to correspondingly access the target page data environment and modify the elements therein. For example, update the text content of the page element by modifying the textContent (used to obtain or set the text content of an element and its descendant elements) attribute of the corresponding element in the target page data environment, or add a new JSON sub-object to the children (sub-items or sub-elements in a certain object or structure, often used to represent a hierarchical structure) array to implement the insertion operation of a new element, ensuring the accuracy and integrity of the page modification. At the same time, utilize the high-performance computing power of the server side to achieve fast modification processing of a large number of page elements and improve the efficiency and speed of page modification.
[0078] Further, the sending the modified target page data environment to the front end for rendering as a visual web page specifically includes:
[0079] Send the modified page data environment to the front end through a real-time communication protocol;
[0080] The front end renders the modified page data environment into a visual web page according to the rendering mechanism. During the rendering process, the front end dynamically innovates and updates the corresponding interactive elements according to the element structure and attribute information in the modified page data environment.
[0081] Specifically, the back-end server sends the modified page data environment back to the front end through real-time communication protocols such as WebSocket. After receiving the data, the front end uses the rendering mechanism of the front-end framework (such as the render function of Vue.js or the ReactDOM.render() method of React.js) to re-render the modified page data environment into a visual web page, realizing the non-refresh update of the page. During the rendering process, the front-end framework dynamically creates and updates the corresponding DOM elements according to the element structure and attribute information in the JSON data, ensuring that the page can accurately display the modified content and style, while maintaining the interactivity and responsiveness of the page, enabling users to immediately see the latest changes to the page, thus realizing an efficient and real-time online batch modification technology for web page code, providing strong technical support for the business operations of enterprises, and effectively promoting the digital development process of enterprises.
[0082] In addition, as Figure 3 shown, in the present invention, after writing a script, select the corresponding page, and then execute the script to perform JSON serialization and operate on the elements therein, so as to transmit the obtained result to the front end for visualization. Through the above steps of technology-intensive and close cooperation, the online batch modification method of web page code in the present invention can provide an efficient, flexible, real-time and technologically advanced page modification solution, effectively solving many technical problems and efficiency bottlenecks existing in traditional page modification methods.
[0083] The present invention obtains user requirements, based on a pre-set page selection module, obtains a target request according to the user requirements; obtains target page information according to the target page in the target request, and performs a non-empty verification on the target request, and obtains the script content in the parameters when the verification passes; based on the target page information and a parsing library preset on the server side, performs a targeting operation on the target page to obtain a target page data environment, and based on the target page data environment, uses a built-in function to parse the script content to obtain an executable code segment; according to the user requirements, uses the executable code segment to automatically modify the target elements in the target page data environment, and sends the modified target page data environment to the front end for rendering into a visual web page. By introducing an advanced front-end and back-end technical architecture, the present invention can achieve accurate and rapid batch modification of web page code, support real-time online update, and thus save a large amount of human and time costs in practical applications for frequent page function fine-tuning requirements.
[0084] Further, as Figure 4 shown, based on the above online batch modification method of web page code, the present invention also correspondingly provides an online batch modification system for web page code. Among them, the online batch modification system for web page code includes:
[0085] A target request acquisition module 41, configured to obtain user requirements, and based on a preset page selection module, obtain a target request according to the user requirements;
[0086] A script content acquisition module 42, configured to obtain target page information according to the target page in the target request, perform a non-empty verification on the target request, and obtain the script content in the parameter when the verification passes;
[0087] An executable code segment generation module 43, configured to perform a targeting operation on the target page based on the target page information and a preset parsing library on the server side to obtain a target page data environment, and based on the target page data environment, parse the script content using a built-in function to obtain an executable code segment;
[0088] A visualization module 44, configured to automatically modify target elements in the target page data environment according to the user requirements using the executable code segment, and send the modified target page data environment to the front end for rendering into a visual web page.
[0089] Further, as Figure 5 shown, based on the above online batch modification method and system of web page code, the present invention also correspondingly provides a terminal, and the terminal includes a processor 10, a memory 20, and a display 30. Figure 5 Only some components of the terminal are shown, but it should be understood that it is not required to implement all the shown components, and more or fewer components can be alternatively implemented.
[0090] The memory 20 may be an internal storage unit of the terminal in some embodiments, such as the hard disk or memory of the terminal. The memory 20 may also be an external storage device of the terminal in some other embodiments, such as a plug-in hard disk equipped on the terminal, a Smart Media Card (SMC), a Secure Digital (SD) card, a Flash Card, etc. Further, the memory 20 may also include both the internal storage unit of the terminal and the external storage device. The memory 20 is used to store application software installed on the terminal and various types of data, such as the program code for installing the terminal, etc. The memory 20 may also be used to temporarily store data that has been output or will be output. In one embodiment, a web page code online batch modification program 40 is stored on the memory 20, and this web page code online batch modification program 40 can be executed by the processor 10, so as to implement the web page code online batch modification method in the present invention.
[0091] The processor 10 may be a central processing unit (CPU), a microprocessor or other data processing chips in some embodiments, and is used to run the program code stored in the memory 20 or process data, such as executing the web page code online batch modification method, etc.
[0092] The display 30 may be an LED display, a liquid crystal display, a touch liquid crystal display, and an OLED (Organic Light-Emitting Diode) toucher, etc. in some embodiments. The display 30 is used to display information on the terminal and to display a visual user interface.
[0093] In one embodiment, when the processor 10 executes the web page code online batch modification program 40 in the memory 20, the steps of the above web page code online batch modification method are implemented.
[0094] The present invention also provides a computer-readable storage medium, wherein the computer-readable storage medium stores a web page code online batch modification program, and when the web page code online batch modification program is executed by a processor, the following steps are implemented:
[0095] ]>Obtain user requirements, and based on a pre-set page selection module, obtain a target request according to the user requirements;
[0096] Obtain target page information according to the target page in the target request, and perform a non-empty verification on the target request. When the verification is passed, obtain the script content in the parameters;
[0097] Based on the target page information and the parsing library preset on the server side, perform targetization operations on the target page to obtain a target page data environment, and based on the target page data environment, use built-in functions to parse the script content to obtain executable code snippets;
[0098] According to the user requirements, use the executable code snippets to automatically modify the target elements in the target page data environment, and send the modified target page data environment to the front end for rendering as a visual web page.
[0099] Among them, before the steps of obtaining user requirements and obtaining the target page and target request according to the user requirements, the following steps are also included:
[0100] Pre-write the script content for operating on page elements;
[0101] According to the data binding mechanism, perform two-way binding of front-end data and back-end data.
[0102] Among them, the obtaining of user requirements, based on a pre-set page selection module, and obtaining a target request according to the user requirements specifically includes:
[0103] Obtain user requirements, where the user requirements include target page and target element operation requirements;
[0104] Based on a pre-set page selection module, select the target page from the page directory tree and generate a target request according to the target page.
[0105] Among them, the obtaining of the target page information according to the target page in the target request and performing a non-empty verification on the target request, and obtaining the script content in the parameters when the verification passes specifically includes:
[0106] According to the file system operation on the server side, read and preprocess the target page to obtain target page information, where the target page information includes the organization and metadata information of the target page;
[0107] Verify whether the token and parameters in the target request are empty. When they are not empty, the verification passes, and obtain the script content from the parameters.
[0108] Among them, the performing of targetization operations on the target page based on the target page information and the parsing library preset on the server side to obtain a target page data environment specifically includes:
[0109] Parse the target page according to the parsing library on the server side and convert the page into a tree structure;
[0110] Recursively traverse the tree structure according to the target page information, and convert each node of the tree structure, its attributes, and child node information into a data object in the target format. After the conversion is completed, a target page data environment is obtained.
[0111] Among them, according to the user requirements, using the executable code snippet to automatically modify the target element in the target page data environment specifically includes:
[0112] Obtain the operation requirements of the target element according to the user requirements;
[0113] According to the operation requirements of the target element, access the target page data environment according to the executable code snippet, and automatically modify the target element in the target page data environment according to the operation requirements of the target element.
[0114] Among them, sending the modified target page data environment to the front end for rendering as a visual web page specifically includes:
[0115] Send the modified page data environment to the front end through a real-time communication protocol;
[0116] The front end renders the modified page data environment as a visual web page according to the rendering mechanism. Among them, during the rendering process, the front end dynamically innovates and updates the corresponding interactive elements according to the element structure and attribute information in the modified page data environment.
[0117] It should be noted that in this article, the terms "including", "containing" or any other variant thereof are intended to cover non-exclusive inclusion, so that a process, method, article or terminal including a series of elements not only includes those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such a process, method, article or terminal. Without more limitations, the element defined by the statement "including one..." does not exclude the existence of another identical element in the process, method, article or terminal including the element.
[0118] Of course, those of ordinary skill in the art can understand that all or part of the processes of implementing the above method embodiments can be completed by instructing relevant hardware (such as a processor, a controller, etc.) through a computer program. The program can be stored in a computer-readable storage medium readable by a computer. When the program is executed, it can include the processes of the above method embodiments. Among them, the computer-readable storage medium can be a memory, a magnetic disk, an optical disk, etc.
[0119] It should be understood that the application of the present invention is not limited to the above examples. For those of ordinary skill in the art, improvements or transformations can be made according to the above description, and all such improvements and transformations should fall within the protection scope of the appended claims of the present invention.
Claims
1. An online batch modification method for web page code, characterized in that, The online batch modification method for the web page code includes: Obtain user requirements. Based on a pre-set page selection module, obtain a target request according to the user requirements. Obtain target page information according to the target page in the target request, and perform a non-empty verification on the target request. When the verification passes, obtain the script content in the parameters. Based on the target page information and a parsing library preset on the server side, perform a targeting operation on the target page to obtain a target page data environment. And based on the target page data environment, use built-in functions to parse the script content to obtain an executable code segment. According to the user requirements, use the executable code segment to automatically modify the target elements in the target page data environment, and send the modified target page data environment to the front end for rendering as a visual web page.
2. The online batch modification method for web page code according to claim 1, characterized in that Before the steps of obtaining user requirements and obtaining the target page and target request according to the user requirements, it further includes: Pre-write the script content for operating on page elements. According to the data binding mechanism, perform two-way binding of front-end data and back-end data.
3. The online batch modification method for web page code according to claim 1, characterized in that, The step of obtaining user requirements, based on a pre-set page selection module, obtaining a target request according to the user requirements specifically includes: Obtain user requirements, where the user requirements include a target page and target element operation requirements. Based on a pre-set page selection module, select the target page from the page directory tree and generate a target request according to the target page.
4. The online batch modification method for web page code according to claim 1, characterized in that, The step of obtaining target page information according to the target page in the target request, and performing a non-empty verification on the target request. When the verification passes, obtain the script content in the parameters specifically includes: According to the file system operation on the server side, read and preprocess the target page to obtain target page information, where the target page information includes the structure and metadata information of the target page. Verify whether the token and parameters in the target request are empty. When they are not empty, the verification passes, and obtain the script content from the parameters.
5. The online batch modification method for web page code according to claim 1, characterized in that, The step of performing a targeting operation on the target page based on the target page information and a parsing library preset on the server side to obtain a target page data environment specifically includes: Parse the target page according to the parsing library on the server side and convert the page into a tree structure. Recursively traverse the tree structure according to the target page information, and convert each node of the tree structure and its attribute and sub-node information into a data object in the target format. After the conversion is completed, obtain the target page data environment.
6. The online batch modification method of web page code according to claim 3, characterized in that The step of automatically modifying the target elements in the target page data environment according to the user requirements and using the executable code segment specifically includes: According to the user requirements, obtain the target element operation requirements. According to the target element operation requirements, access the target page data environment according to the executable code segment, and automatically modify the target elements in the target page data environment according to the target element operation requirements.
7. The method for online batch modification of web page code according to claim 1, characterized in that, The step of sending the modified target page data environment to the front end for rendering as a visual web page specifically includes: Send the modified page data environment to the front end through the real-time communication protocol; The front end renders the modified page data environment into a visual web page according to the rendering mechanism. During the rendering process, the front end dynamically innovates and updates the corresponding interactive elements according to the element structure and attribute information in the modified page data environment.
8. An online batch modification system for web page code, characterized in that, The online batch modification system for web page code includes: A target request acquisition module, configured to acquire user requirements, and based on a pre-set page selection module, acquire a target request according to the user requirements; A script content acquisition module, configured to acquire target page information according to the target page in the target request, perform a non-empty verification on the target request, and acquire the script content in the parameter when the verification is passed; An executable code segment generation module, configured to perform a targeting operation on the target page based on the target page information and a parsing library preset on the server side to obtain a target page data environment, and based on the target page data environment, parse the script content using a built-in function to obtain an executable code segment; A visualization module, configured to automatically modify the target elements in the target page data environment according to the user requirements using the executable code segment, and send the modified target page data environment to the front end for rendering into a visual web page.
9. A terminal, characterized in that, The terminal includes: a memory, a processor, and an online batch modification program for web page code stored on the memory and executable on the processor. When the online batch modification program for web page code is executed by the processor, the steps of the online batch modification method for web page code according to any one of claims 1-7 are implemented.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores an online batch modification program for web page code. When the online batch modification program for web page code is executed by a processor, the steps of the online batch modification method for web page code according to any one of claims 1-7 are implemented.