Small program poster generation method and device, electronic equipment, storage medium and computer program product
By converting the common format data of the web poster drawing page into preset poster data that can be recognized by the mini program, the problem of low efficiency of poster generation in the mini program is solved, unlimited poster generation and simplified debugging are achieved, and the generation efficiency is improved.
Patent Information
- Application Number
- CN202410882871.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-02
- Publication Date
- 2024-10-15
AI Technical Summary
Due to the tag and style support limitations of the existing mini program poster generation method using WXML language, the efficiency of generating poster images is low, the steps are complex, and debugging is difficult.
By converting the common format data in the web poster drawing page into preset poster data that can be recognized by the mini program, and sending it to the mini program page using the interactive component transmission interface, triggering a refresh to generate the target poster, thereby improving the efficiency of poster generation.
It realizes the unlimited generation of small program poster images, improves the generation efficiency, simplifies the debugging process, and avoids generation problems caused by label and style restrictions.
Smart Images

Figure CN118780246A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of front-end development technology, and in particular to a method, device, electronic device, storage medium and computer program product for generating a mini-program poster. Background Art
[0002] In the related art, using Hypertext Markup Language (HTML) to draw a poster on a web page, and then intercepting the content on the web page to generate a poster image, is a poster generation solution often used in the front-end development process. There is already a very mature and convenient solution for generating posters on the web page. However, this solution cannot be copied on the mini program side because the web page uses the HTML language, and the mini program uses the tag language (WeiXinMarkup Language, WXML) of the mini program framework, which are different. With the increase in the use of mini programs, the demand for generating pictures based on the screen content for dissemination is increasing. However, the existing mini program poster generation method leads to many restrictions on generating poster images based on the screen content through WXML, and the steps are relatively complicated, resulting in low efficiency in generating poster images. Summary of the invention
[0003] The embodiments of the present application provide a method, device, electronic device, storage medium and computer program product for generating a mini-program poster, which can improve the efficiency of generating mini-program posters.
[0004] The technical solution of this application is implemented as follows:
[0005] The present application embodiment provides a method for generating a mini-program poster, including:
[0006] When the mini program page meets the conditions for generating a poster, a target poster is rendered in the mini program page based on the preset poster data;
[0007] The preset poster data is general format data generated based on a web page version poster drawing page; the display content in the poster drawing page is consistent with the display content in the target poster.
[0008] In the above solution, when the mini program page meets the condition for generating a poster, before rendering the target poster in the mini program page based on the preset poster data, the method further includes:
[0009] If the mini program page does not meet the conditions for generating a poster, generating a canvas based on the loaded poster drawing page;
[0010] The canvas is processed into the preset poster data conforming to a universal format.
[0011] In the above solution, the poster drawing page introduces an interactive component for realizing the interaction between the web page and the applet; after processing the canvas into the preset poster data conforming to the universal format, the method further includes:
[0012] Sending the preset poster data to the mini-program page through the transmission interface in the interactive component, and triggering a refresh of the mini-program page;
[0013] The preset poster data is stored, and the flag of the mini-program page is set to a first flag; wherein the first flag is used to indicate that the corresponding preset poster data exists for the mini-program page.
[0014] In the above solution, when the mini program page does not meet the condition for generating a poster, generating a canvas based on the loaded poster drawing page includes:
[0015] When the flag is detected as the second flag after the mini program page is updated, the poster drawing page is loaded into the interface based on the preset browser component; wherein the second flag is used to indicate that there is no corresponding preset poster data for the mini program page;
[0016] The canvas is obtained by rendering and converting the poster drawing page in the interface of the preset browser component.
[0017] In the above solution, when the mini program page meets the condition for generating a poster, rendering a target poster in the mini program page based on preset poster data includes:
[0018] After the mini-program page is updated, when it is detected that the flag bit is the first flag, reading the preset poster data;
[0019] The target poster is rendered in the mini-program page based on the preset poster data.
[0020] In the above solution, when the mini program page meets the condition for generating a poster, after rendering the target poster in the mini program page based on the preset poster data, the method further includes:
[0021] The preset poster data is deleted, and the flag bit is set to the second flag.
[0022] The embodiment of the present application also provides a mini-program poster generation device, including:
[0023] A rendering unit, configured to render a target poster in the mini-program page based on preset poster data when the mini-program page satisfies the conditions for generating a poster;
[0024] The preset poster data is general format data generated based on a web page version poster drawing page; the display content in the poster drawing page is consistent with the display content in the target poster.
[0025] An embodiment of the present application further provides an electronic device, including a memory and a processor, wherein the memory stores a computer program that can be run on the processor, and the processor implements the steps in the above method when executing the computer program.
[0026] An embodiment of the present application further provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the steps in the above method are implemented.
[0027] An embodiment of the present application also provides a computer program product, including a computer program, which implements the steps in the above method when executed by a processor.
[0028] The embodiment of the present application provides that when the mini program page meets the conditions for generating a poster, a target poster is rendered in the mini program page based on preset poster data; wherein the preset poster data is general format data generated based on the web page poster drawing page; the display content in the poster drawing page is consistent with the display content in the target poster. In this way, it is only necessary to pre-generate a web page poster drawing page using the web page poster generation method according to the display content in the target poster, and the web page poster drawing page can be used to determine the preset poster data in a general format to generate the target poster. Since there are no restrictions on the scheme in the web page poster drawing page generation process, there are no restrictions on generating the target poster using the scheme in the present application, thereby improving the efficiency of mini program poster image generation. BRIEF DESCRIPTION OF THE DRAWINGS
[0029] Figure 1 An optional flowchart of a method for generating a mini-program poster provided in an embodiment of the present application;
[0030] Figure 2 An optional flowchart of a method for generating a mini-program poster provided in an embodiment of the present application;
[0031] Figure 3 An optional flowchart of a method for generating a mini-program poster provided in an embodiment of the present application;
[0032] Figure 4 An optional flowchart of a method for generating a mini-program poster provided in an embodiment of the present application;
[0033] Figure 5 An optional flowchart of a method for generating a mini-program poster provided in an embodiment of the present application;
[0034] Figure 6 An optional flowchart of a method for generating a mini-program poster provided in an embodiment of the present application;
[0035] Figure 7 A schematic diagram of the structure of a mini-program poster generation device provided in an embodiment of the present application;
[0036] Figure 8 A hardware entity schematic diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0037] In order to make the purpose, technical solutions and advantages of the present application clearer, the technical solutions of the present application are further elaborated in detail below in conjunction with the drawings and embodiments. The described embodiments should not be regarded as limiting the present application. All other embodiments obtained by ordinary technicians in the field without making creative work are within the scope of protection of the present application.
[0038] In the following description, reference is made to “some embodiments”, which describe a subset of all possible embodiments, but it will be understood that “some embodiments” may be the same subset or different subsets of all possible embodiments and may be combined with each other without conflict.
[0039] If similar descriptions of "first / second" appear in the application documents, the following instructions are added. In the following description, the terms "first\second\third" involved are merely used to distinguish similar objects and do not represent a specific ordering of the objects. It can be understood that "first\second\third" can be interchanged in a specific order or sequence where permitted, so that the embodiments of the present application described herein can be implemented in an order other than that illustrated or described herein.
[0040] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art to which this application belongs. The terms used herein are only for the purpose of describing the embodiments of this application and are not intended to limit this application.
[0041] The official mini program provides a solution for the mini program poster generation process. Use the wxml-to-canvas plug-in to arrange the content of the image to be generated in wxml, and then set the style through the wxml-to-canvas application programming interface (Application Programming Interface, API) to generate the image. However, there are many limitations to the solution of generating posters through the wxml-to-canvas API:
[0042] 1. wxml only supports three tags: view, text, and image. The style support is also limited. Even if some styles are supported, there are additional restrictions on the values that can be set.
[0043] 2. The width and height of each element must be set. The content of the poster is very diverse. Many times, there is no way to preset the width and height when drawing the poster, and this conflict point is difficult to resolve.
[0044] 3. Debugging is very difficult. Once a configuration error occurs during the poster image generation process, the interface becomes blank and there is no error message in the console, which makes it very difficult to locate the problem and the debugging efficiency is very low. In this way, since there are many restrictions on the solution of generating posters through the wxml-to-canvas API, the solution steps of generating posters through the wxml-to-canvas API are relatively complicated, which easily leads to low efficiency in generating images.
[0045] This application embodiment provides a method for generating a small program poster. Figure 1 , is an optional flowchart of the method for generating a small program poster provided in the embodiment of the present application, which will be combined with Figure 1 The steps shown are explained:
[0046] S101. When the mini-program page meets the conditions for generating a poster, a target poster is rendered in the mini-program page based on preset poster data; wherein the preset poster data is general format data generated based on a web version of the poster drawing page; and the display content in the poster drawing page is consistent with the display content in the target poster.
[0047] In the embodiment of the present application, after the mini-program page is refreshed, if the terminal can detect the corresponding preset poster data, the terminal renders and displays the corresponding target poster in the mini-program page through the preset poster data. The mini-program page is the page that needs to display the target poster.
[0048] The terminal can generate a poster drawing page in advance based on the display content of the target poster to be generated through a web page version of the poster generation method, and then convert the poster drawing page into preset poster data in a universal format that can be recognized and processed by both the mini program and the web page.
[0049] The terminal can also obtain the poster drawing page corresponding to the target poster from other terminals or servers. Other terminals or servers can also generate a drawing poster based on the display content of the target poster to be generated through the web version of the poster generation method, and then send it to the terminal. The terminal processes the poster drawing page sent by other terminals or servers into preset poster data in a universal format that can be recognized and processed by both the applet and the web page.
[0050] The terminal can also obtain preset poster data corresponding to the target poster from other terminals or servers. Other terminals or servers can also generate a drawn poster based on the display content of the target poster to be generated through the web version of the poster generation method, and then process the poster drawing page into preset poster data in a universal format that can be recognized and processed by both the applet and the web page and send it to the terminal.
[0051] Exemplarily, the terminal needs to prepare two pages for the mini program, one is the mini program page that needs to display the poster, and the other is the HTML page (poster drawing page) for drawing the poster data. Among them, the HTML page is used to process the preset poster data generated in a general format. After the mini program page is opened, read the cache first to check whether the preset poster data has been generated. If the mini program on the terminal can obtain the corresponding preset poster data, the src attribute of the img tag is used to display the target poster through the preset poster data. If the mini program on the terminal cannot obtain the corresponding preset poster data, the terminal mini program prompts the user that the acquisition failed.
[0052] The general format may be data in Base64 format. Base64 is one of the most common encoding methods used to transmit 8-bit bytecodes on the Internet. Base64 is a method of representing binary data based on 64 printable characters.
[0053] The embodiment of the present application provides that when the mini program page meets the conditions for generating a poster, a target poster is rendered in the mini program page based on preset poster data; wherein the preset poster data is general format data generated based on the web page poster drawing page; the display content in the poster drawing page is consistent with the display content in the target poster. In this way, it is only necessary to pre-generate a web page poster drawing page using the web page poster generation method according to the display content in the target poster, and the web page poster drawing page can be used to determine the preset poster data in a general format to generate the target poster. Since there are no restrictions on the scheme in the web page poster drawing page generation process, there are no restrictions on generating the target poster using the scheme in the present application, thereby improving the efficiency of mini program poster image generation.
[0054] See also Figure 2 , is an optional flowchart of the method for generating a mini-program poster provided in an embodiment of the present application, Figure 1 Before S101 in the above, the following steps may also be included: S201 to S202, which will be described in combination with the following steps:
[0055] S201. If the mini-program page does not meet the conditions for generating a poster, generate a canvas based on the loaded poster drawing page.
[0056] In the embodiment of the present application, after the mini-program is opened or updated, if the terminal cannot detect the corresponding preset poster data locally, it is determined that the mini-program page does not meet the conditions for generating a poster. The terminal can load the poster drawing page and convert the poster drawing page into a canvas.
[0057] For example, if the corresponding preset poster data cannot be detected locally, the terminal uses the poster drawing page embedded in the web-view to render the rendering elements in the poster drawing page in the web-view interface (the display content elements in the target poster). After the rendering is completed, the function of the html2canvas plug-in is used to convert the web-view interface elements into canvas. Among them, web-view is a web browser component that can be used to host a container for web pages and will automatically fill the entire page.
[0058] S202: Process the canvas into the preset poster data conforming to a universal format.
[0059] In an embodiment of the present application, the terminal may process the canvas into preset poster data conforming to a universal format.
[0060] Exemplarily, the terminal may process the canvas into data (character string) in base64 format.
[0061] In an embodiment of the present application, if the mini program page does not meet the conditions for generating a poster, a canvas is generated based on the loaded poster drawing page. The canvas is processed into the preset poster data that conforms to the general format. Since the preset poster data in the general format is generated, the mini program can use the poster-related data formed by the poster drawing page without restriction. Compared with the mini program poster generation method in the related art, there is no restriction, so the solution in the present application can improve the efficiency of mini program poster generation.
[0062] See also Figure 3 , is an optional flowchart of the method for generating a mini-program poster provided in an embodiment of the present application, Figure 2 After S202, the following steps may be included: S203 to S204, which will be described in combination with the steps:
[0063] S203. Send the preset poster data to the mini-program page through the transmission interface in the interactive component, and trigger a refresh of the mini-program page.
[0064] In the embodiment of the present application, the poster drawing page introduces an interactive component for realizing the interaction between the web page and the mini program. The terminal can send the preset poster data to the mini program page through the transmission interface in the interactive component introduced by the poster drawing page. After receiving the preset poster data, the mini program page automatically refreshes.
[0065] For example, the poster drawing page needs to introduce the translated script language (JavaScript, js) file (interactive component) corresponding to the mini program. Then the terminal sends the preset poster data to the mini program page through the method (wx.miniProgram.postMessage) provided by the js file.
[0066] S204. Store the preset poster data, and set the flag of the mini program page to a first flag; wherein the first flag is used to indicate that the corresponding preset poster data exists for the mini program page.
[0067] In an embodiment of the present application, the terminal may store the preset poster data in a cache corresponding to the mini program, and set the flag in the cache corresponding to the mini program to the first flag. The flag is used to indicate whether there is preset poster data corresponding to the mini program page in the cache, and the first flag is used to indicate that there is corresponding preset poster data for the mini program page.
[0068] For example, since wx.miniProgram.postMessage is designed to receive data only when the mini program page is backed, destroyed, shared, or the link is copied. Therefore, after the poster drawing page sends the preset poster data, it must use the wx.miniProgram.redirectTo method to refresh the mini program page once. Refreshing is equivalent to page destruction, so the mini program page can receive the preset poster data in the receiving function configured by the web-view. The terminal then writes the preset poster data into the corresponding cache of the mini program, and sets the flag that the preset poster data has been generated to true (the first flag).
[0069] Exemplarily, the code for storing the preset poster data in the terminal and setting the flag of the mini-program page to the first flag is as follows:
[0070] handleMessage(event){
[0071] setStorageSync(posterDataSignKey,true);
[0072] this.writePosterData(event.detail.data[event.detail.data.length-1]);
[0073] }
[0074] In an embodiment of the present application, the preset poster data is sent to the mini-program page through the transmission interface in the interactive component, and the mini-program page is refreshed. The preset poster data is stored, and the flag of the mini-program page is set to the first flag; wherein the first flag is used to characterize the existence of corresponding preset poster data for the mini-program page. In this way, the transmission of the preset poster in a universal format between the poster drawing page and the mini-program page can be completed, so that the corresponding preset poster data is stored in the cache of the mini-program page. The mini-program page can then generate the target poster without restriction through the preset poster data in a universal format, which improves the generation efficiency of the mini-program poster compared to the scheme of generating posters on the mini-program page in the related art.
[0075] See also Figure 4 , is an optional flowchart of the method for generating a mini-program poster provided in an embodiment of the present application, Figure 2 S201 in the embodiment can also be implemented through S301 to S302, which will be described in combination with the steps:
[0076] S301. After the mini-program page is updated, if it is detected that the flag is the second flag, the poster drawing page is loaded in the interface based on the preset browser component; wherein the second flag is used to indicate that there is no corresponding preset poster data for the mini-program page.
[0077] In an embodiment of the present application, after the mini program page is opened or updated, and the corresponding flag is detected as the second flag, the terminal can load the poster drawing page in the interface through a preset browser component, wherein the second flag is used to indicate that there is no corresponding preset poster data for the mini program page.
[0078] Exemplarily, the terminal detects that the corresponding flag is the second flag (false), and uses the preset browser component to load the poster drawing page code as follows:
[0079] / / The poster data has been read. The flag position is false. The poster needs to be regenerated next time you enter the page.
[0080] setStorageSync(posterDataSignKey,false);
[0081] / / Delete poster data
[0082] this.clearPosterData();
[0083] }else{
[0084] this.posterData = {};
[0085] showToast({title:"Poster generation failed"});
[0086] }
[0087] }else{
[0088] this.posterData = null;
[0089] showLoading({title:"Poster is being generated..."});
[0090] }
[0091] Use of web-view:
[0092] <web-view class="webView"v-if="posterData===null":src="posterUrl"@message="handleMessage" / >
[0093] S302: Rendering and converting the poster drawing page in the interface of the preset browser component to obtain the canvas
[0094] In the embodiment of the present application, the terminal can render the display content in the poster drawing page in the interface of the preset browser component, and after the rendering is completed, the elements in the interface can be converted into a canvas using html2canvas.
[0095] Exemplarily, the code for loading a poster drawing page in a preset browser component and converting it into a canvas page in a terminal is as follows:
[0096] async draw(){
[0097] await loadHtml2canvas();
[0098] this.$nextTick(()=>{
[0099] const el=document.getElementById("poster-container");
[0100] el&&
[0101] html2canvas(el,{useCORS:true}).then((canvas)=>{
[0102] const canvasImg=canvas.toDataURL("image / png");
[0103] wxBackup.miniProgram.postMessage({
[0104] data:{
[0105] result:true, / / Generate results
[0106] src:canvasImg, / / Generated image (base64 format)
[0107] height:el.offsetHeight, / / Generate image height
[0108] width:el.offsetWidth, / / Generate image width
[0109] msg:"", / / Error message
[0110] },
[0111] });
[0112] wxBackup.miniProgram.redirectTo({
[0113] url:" / otherPages / poster-sharing / index",
[0114] });
[0115] });
[0116] });
[0117] },
[0118] In an embodiment of the present application, when the flag is detected to be the second flag after the mini-program page is updated, the poster drawing page is loaded in the interface based on the preset browser component; wherein, the second flag is used to characterize that there is no corresponding preset poster data for the mini-program page. The canvas is obtained by rendering and transforming the poster drawing page in the interface of the preset browser component. In this way, the web version of the poster drawing page can be converted into a canvas, and then the canvas can be processed into preset poster data in a universal format and provided to the mini-program page for unlimited poster generation, thereby improving the poster generation efficiency of the mini-program page.
[0119] See also Figure 5 , is an optional flowchart of the method for generating a mini-program poster provided in an embodiment of the present application, Figure 1 S101 in the above can also be implemented through S401 to S403, which will be described in combination with the steps:
[0120] S401. After the mini-program page is updated, when it is detected that the flag bit is the first flag, read the preset poster data.
[0121] In an embodiment of the present application, after the mini-program page is updated or opened, the terminal detects that the flag bit in the cache corresponding to the mini-program is the first flag, and reads the preset poster data in the cache corresponding to the mini-program.
[0122] S402: Render the target poster in the mini program page based on the preset poster data.
[0123] In an embodiment of the present application, after reading the corresponding preset poster data, the terminal can use the preset poster data in a universal format to render a target poster in the mini-program page.
[0124] Exemplarily, the terminal can read the preset poster data in base64 format stored in the corresponding cache of the mini program, can use the img tag to display the poster image, or can use the API provided by the mini program to save the poster image locally.
[0125] S403: Delete the preset poster data and set the flag bit to the second flag.
[0126] In an embodiment of the present application, after completing the generation of the target poster, the terminal may delete the preset poster data in the mini-program cache and set the flag in the cache to the second flag (false).
[0127] In the embodiment of the present application, after the terminal reads the preset poster data, it sets the flag position corresponding to the mini program page to false. Then, the preset poster data in the mini program corresponding cache is deleted, so that the poster display page of the mini program can be triggered to be regenerated when it is reopened next time.
[0128] See also Figure 6 , which is an optional flowchart of the method for generating a small program poster provided in an embodiment of the present application, will be described in combination with the steps:
[0129] S11. Open the mini program interface.
[0130] In the embodiment of the present application, the terminal opens the applet page where the poster needs to be displayed / saved / shared. Before opening the applet page, the terminal needs to have the corresponding applet page and the poster drawing page of the web version.
[0131] S12: Read the flag bit from the cache to determine whether the preset poster data has been generated.
[0132] In the embodiment of the present application, the terminal reads the flag in the mini-program cache and determines whether the preset poster data has been generated based on whether the flag is the first flag or the second flag. If it is the second flag, it means that the preset poster data has not been generated and S13 is executed. If it is the first flag, it means that the preset poster data has been generated and S17 is executed.
[0133] S13, web-view embedded web version poster drawing page.
[0134] In an embodiment of the present application, if a poster drawing page corresponding to the mini-program page is not generated, the terminal uses web-view to embed and load the web version of the poster drawing page in the interface.
[0135] S14. After the poster drawing page is loaded, the preset poster data in base64 format is generated and sent to the mini program page.
[0136] In the embodiment of the present application, after the poster drawing page is loaded, the terminal can convert the elements in the web-view interface into a canvas. Then use canvas.toDataURL("image / png") to convert the canvas into the preset poster data in base64 format. After generating the preset poster data, send the preset poster data to the mini program page.
[0137] S15. Call the API to refresh the mini program page.
[0138] In the embodiment of the present application, after the preset poster data is sent to the mini-program page, the automatic refresh of the mini-program page is triggered, and the terminal calls the wx.miniProgram.redirectTo interface to refresh the mini-program page, that is, re-execute S11 to open the mini-program page.
[0139] S16. In the function of receiving preset poster data, write it locally and set the flag position of the generated preset poster data to true.
[0140] In an embodiment of the present application, after the refresh of the mini program page is completed, the mini program page receives the preset poster data and stores it in the local cache, and at the same time sets the flag position of the mini program page in the cache to true.
[0141] S17, determining whether there is preset poster data in the local file.
[0142] In the embodiment of the present application, if the flag is the first flag, the terminal detects whether the corresponding preset poster data exists in the cache of the applet, and executes S18 if the preset poster data exists, and executes S20 if the preset poster data does not exist.
[0143] S18. Read the preset poster data and display the target poster.
[0144] In an embodiment of the present application, if there is preset poster data in the cache of the mini program, the terminal reads the preset poster data and uses the preset poster data to render and display the target poster in the mini program page.
[0145] S19. Call the API for converting base64 to image file to generate the corresponding target poster image.
[0146] In the embodiment of the present application, when a target poster image is needed, the terminal calls an API for converting base64 to an image file to generate a corresponding target poster image.
[0147] S20, prompting the user that the target poster generation failed (the preset poster data writing failed).
[0148] In the embodiment of the present application, if the preset poster data does not exist in the mini-program cache, the terminal prompts the user that the target poster generation failed (the preset poster data writing failed).
[0149] In the embodiment of the present application, the preset poster data in base64 format is generated by the poster drawing page of the web version and provided to the mini program page. There is no restriction on the process of the terminal using the preset poster data in the general base64 format to generate the target poster on the mini program page. As long as the web version can draw it, it can be captured as a picture. And this scheme has no requirements for the width and height settings of the elements, and supports various adaptive schemes. Moreover, the debugging of the poster drawing page of the web version is very simple. As long as the poster drawing page is drawn correctly, the generated target poster is correct.
[0150] See also Figure 7 , which is a structural diagram of the mini-program poster generation device provided in an embodiment of the present application.
[0151] The embodiment of the present application also provides a mini-program poster generation device 800, including: a rendering unit 801.
[0152] A rendering unit 801 is used to render a target poster in the mini program page based on preset poster data when the mini program page meets the conditions for generating a poster;
[0153] The preset poster data is general format data generated based on a web page version poster drawing page; the display content in the poster drawing page is consistent with the display content in the target poster.
[0154] In an embodiment of the present application, the rendering unit 801 in the mini-program poster generation device 800 is used to generate a canvas based on the loaded poster drawing page when the mini-program page does not meet the conditions for generating a poster; and process the canvas into the preset poster data that conforms to the general format.
[0155] In an embodiment of the present application, the rendering unit 801 in the mini-program poster generation device 800 is used to send the preset poster data to the mini-program page through the transmission interface in the interactive component, and trigger the refresh of the mini-program page; store the preset poster data, and set the flag of the mini-program page to the first flag; wherein the first flag is used to represent the existence of the corresponding preset poster data for the mini-program page.
[0156] In the embodiment of the present application, the rendering unit 801 in the mini program poster generation device 800 is used to load the poster drawing page in the interface based on the preset browser component when the flag bit is detected as the second flag after the mini program page is updated; wherein the second flag is used to indicate that there is no corresponding preset poster data for the mini program page;
[0157] The canvas is obtained by rendering and converting the poster drawing page in the interface of the preset browser component.
[0158] In the embodiment of the present application, the rendering unit 801 in the mini program poster generation device 800 is used to read the preset poster data when the flag bit is detected to be the first flag after the mini program page is updated;
[0159] The target poster is rendered in the mini-program page based on the preset poster data.
[0160] In the embodiment of the present application, the rendering unit 801 in the mini-program poster generation device 800 is used to delete the preset poster data and set the flag bit to the second flag.
[0161] It should be noted that in the embodiments of the present application, if the above-mentioned small program poster generation method is implemented in the form of a software function module and sold or used as an independent product, it can also be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the embodiment of the present application can be essentially or partly reflected in the form of a software product that contributes to the relevant technology. The computer software product is stored in a storage medium, including a number of instructions to enable a small program poster generation device (which can be a personal computer, etc.) to execute all or part of the methods described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as a U disk, a mobile hard disk, a read-only memory (ROM), a disk or an optical disk. In this way, the embodiments of the present application are not limited to any specific combination of hardware and software.
[0162] Correspondingly, an embodiment of the present application provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the steps in the method on the side of the mini-program poster drawing device 800 are implemented.
[0163] It should be noted here that the description of the above storage medium and device embodiments is similar to the description of the above method embodiments, and has similar beneficial effects as the method embodiments. For technical details not disclosed in the storage medium and device embodiments of this application, please refer to the description of the method embodiments of this application for understanding.
[0164] It should be noted that Figure 8 A hardware entity diagram of an electronic device provided in an embodiment of the present application, such as Figure 8 As shown, an embodiment of the present application provides an electronic device 900, including a memory 902 and a processor 901, wherein the memory 902 stores a computer program that can be run on the processor 901, and the processor 901 implements the steps in the above method when executing the program, wherein;
[0165] The processor 901 generally controls the overall operation of the electronic device 900 .
[0166] The memory 902 is configured to store instructions and applications executable by the processor 901, and can also cache data to be processed or processed by the processor 901 and various modules in the electronic device 900 (for example, image data, audio data, voice communication data, and video communication data), which can be implemented through flash memory (FLASH) or random access memory (Random Access Memory, RAM).
[0167] Correspondingly, an embodiment of the present application also provides a computer program product, including a computer program, which can be executed by the processor 901 of the electronic device 900 to complete the steps in the method on the side of the mini-program poster drawing device 800.
[0168] It should be understood that "one embodiment" or "an embodiment" mentioned throughout the specification means that specific features, structures or characteristics related to the embodiment are included in at least one embodiment of the present application. Therefore, "in one embodiment" or "in an embodiment" appearing throughout the specification does not necessarily refer to the same embodiment. In addition, these specific features, structures or characteristics can be combined in one or more embodiments in any suitable manner. It should be understood that in various embodiments of the present application, the size of the sequence number of the above-mentioned processes does not mean the order of execution, and the execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application. The above-mentioned sequence numbers of the embodiments of the present application are only for description and do not represent the advantages and disadvantages of the embodiments.
[0169] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or device including the element.
[0170] In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. The device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as: multiple units or components can be combined, or can be integrated into another system, or some features can be ignored, or not executed. In addition, the coupling, direct coupling, or communication connection between the components shown or discussed can be through some interfaces, and the indirect coupling or communication connection of the device or unit can be electrical, mechanical or other forms.
[0171] The units described above as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units; 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 present embodiment.
[0172] In addition, all functional units in the embodiments of the present application may be integrated into one processing unit, or each unit may be a separate unit, or two or more units may be integrated into one unit; the above-mentioned integrated units may be implemented in the form of hardware or in the form of hardware plus software functional units.
[0173] A person skilled in the art can understand that all or part of the steps of implementing the above method embodiment can be completed by hardware related to program instructions, and the aforementioned program can be stored in a computer-readable storage medium. When the program is executed, it executes the steps of the above method embodiment; and the aforementioned storage medium includes: a mobile storage device, a read-only memory (ROM), a magnetic disk or an optical disk, and other media that can store program codes.
[0174] Alternatively, if the above-mentioned integrated unit of the present application is implemented in the form of a software function module and sold or used as an independent product, it can also be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the embodiment of the present application can be essentially or partly embodied in the form of a software product that contributes to the relevant technology. The computer software product is stored in a storage medium, including several instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the methods described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as a mobile storage device, a ROM, a magnetic disk, or an optical disk.
[0175] The above is only an implementation method of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
Claims
1. A method for generating a small program poster, characterized in that: include: When the mini program page meets the conditions for generating a poster, a target poster is rendered in the mini program page based on the preset poster data; The preset poster data is general format data generated based on a web page version poster drawing page; the display content in the poster drawing page is consistent with the display content in the target poster.
2. The method for generating a small program poster according to claim 1, characterized in that: When the mini program page meets the condition for generating a poster, before rendering the target poster in the mini program page based on the preset poster data, the method further includes: If the mini program page does not meet the conditions for generating a poster, generating a canvas based on the loaded poster drawing page; The canvas is processed into the preset poster data conforming to a universal format.
3. The method for generating a small program poster according to claim 2, characterized in that: The poster drawing page introduces an interactive component for realizing the interaction between the web page and the applet; after the canvas is processed into the preset poster data conforming to the universal format, the method further includes: Sending the preset poster data to the mini-program page through the transmission interface in the interactive component, and triggering a refresh of the mini-program page; The preset poster data is stored, and the flag of the mini-program page is set to a first flag; wherein the first flag is used to indicate that the corresponding preset poster data exists for the mini-program page.
4. The method for generating a small program poster according to claim 2, characterized in that: The step of generating a canvas based on the loaded poster drawing page when the mini program page does not meet the condition for generating a poster includes: When the flag is detected as the second flag after the mini program page is updated, the poster drawing page is loaded into the interface based on the preset browser component; wherein the second flag is used to indicate that there is no corresponding preset poster data for the mini program page; The canvas is obtained by rendering and converting the poster drawing page in the interface of the preset browser component.
5. The method for generating a mini program poster according to any one of claims 1 to 4, characterized in that: The step of rendering a target poster in the mini program page based on preset poster data when the mini program page meets the condition for generating a poster includes: After the mini-program page is updated, when it is detected that the flag bit is the first flag, reading the preset poster data; The target poster is rendered in the mini-program page based on the preset poster data.
6. The method for generating a mini program poster according to any one of claims 1 to 4, characterized in that: After rendering the target poster in the mini program page based on the preset poster data when the mini program page meets the condition for generating the poster, the method further includes: The preset poster data is deleted, and the flag bit is set to the second flag.
7. A small program poster generation device, characterized in that: include: A rendering unit, configured to render a target poster in the mini-program page based on preset poster data when the mini-program page satisfies the conditions for generating a poster; The preset poster data is general format data generated based on a web page version poster drawing page; the display content in the poster drawing page is consistent with the display content in the target poster.
8. An electronic device, characterized in that: The method comprises a memory and a processor, wherein the memory stores a computer program executable on the processor, and the processor implements the steps in the method according to any one of claims 1 to 6 when executing the computer program.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps in the method according to any one of claims 1 to 6 are implemented.
10. A computer program product, comprising a computer program, characterized in that The computer program implements the steps of the method according to any one of claims 1 to 6 when executed by a processor.
