CN115145545A - Method and device for generating small program code, computer equipment and storage medium - Google Patents

Method and device for generating small program code, computer equipment and storage medium Download PDF

Info

Publication number
CN115145545A
CN115145545A CN202210538829.1A CN202210538829A CN115145545A CN 115145545 A CN115145545 A CN 115145545A CN 202210538829 A CN202210538829 A CN 202210538829A CN 115145545 A CN115145545 A CN 115145545A
Authority
CN
China
Prior art keywords
data item
applet
processing control
value
value processing
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202210538829.1A
Other languages
Chinese (zh)
Inventor
吴荣华
陈彦涛
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Guangzhou Fengwang Information Technology Co ltd
Original Assignee
Guangzhou Fengwang Information Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Guangzhou Fengwang Information Technology Co ltd filed Critical Guangzhou Fengwang Information Technology Co ltd
Priority to CN202210538829.1A priority Critical patent/CN115145545A/en
Publication of CN115145545A publication Critical patent/CN115145545A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/20Software design
    • G06F8/24Object-oriented
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/38Creation or generation of source code for implementing user interfaces

Landscapes

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

Abstract

The application relates to a method and a device for generating an applet code, a computer device and a storage medium. According to the method for generating the applet codes, in the development stage of the applet (the generation stage of the applet codes), the data items can be obtained through the data item storage path, the data items and the value processing control fed back by the target server are displayed on the applet editing interface, after the data items and the value processing control are associated through operation on the applet editing interface, the applet codes are automatically generated according to the association and the data item storage path, development of the applet is completed, developers can operate on the applet editing interface according to needs to achieve association of the data items and the value processing control, the applet codes carrying association relations among the data items, the value processing control and the data item storage path can be obtained, and the developers do not need to have related programming knowledge.

Description

Method and device for generating small program code, computer equipment and storage medium
Technical Field
The present application relates to the field of computer technologies, and in particular, to a method and an apparatus for generating an applet code, a computer device, a storage medium, and a computer program product.
Background
With the development of mobile internet technology, it has become an integral part of our life, work, business activities, etc. which cannot be thrown away. Therefore, the Internet big-head enterprise starts to lay out a future ecological circle and successively pushes out small programs. The method is a brand new mode for connecting the user and the service, and can conveniently acquire the user and spread information. Meanwhile, the method is a cross-platform solution, and can run on Android and iOS platforms only by realizing one set of codes. Compared with Android and iOS native development, the development of the applet is much simpler, and even more, the development of the applet still needs to have programming knowledge.
Disclosure of Invention
In view of the above, it is desirable to provide a method, an apparatus, a computer device, a storage medium, and a computer program product for generating an applet code that does not require a developer to have programming knowledge.
In a first aspect, a method for generating an applet code is provided, where the method includes: retrieving the data item via a data item storage path; displaying the data item and the value processing control on an applet editing interface; after the data item and the value processing control are associated through operation on the applet editing interface, generating an applet code according to the association and the data item storage path; the applet code carries an association relationship between the data item, the value processing control and the data item storage path; when the applet codes run, the values of the data items are acquired through the data item storage paths in the incidence relations carried by the applet codes, and the values of the data items are processed through the value processing control.
In one embodiment, the method further comprises: and if the data item is dragged on the applet editing interface, and the position of the data item after the dragging is finished corresponds to the position of the value processing control, determining that the data item is associated with the value processing control.
In one embodiment, after determining that the data item and the value handling control are associated, the method further comprises: judging whether the value corresponding to the data item is processable in the processing mode corresponding to the value processing control; if not, prompting the association error.
In one embodiment, the data item storage path is a link to a web server where the data item is stored; when the applet code runs, acquiring the value of the data item through the data item storage path in the incidence relation carried by the applet code to process the value of the data item through the value processing control, wherein the method comprises the following steps: when the small program code runs, requesting the value of the data item from the network server through the link in the incidence relation carried by the small program code; when the network server successfully feeds back the value of the data item, processing the value of the data item through the value processing control; the method further comprises the following steps: and when the network server fails to feed back the value of the data item, prompting that the request fails.
In one embodiment, the data item storage path is a link to a web server storing the data item; before generating the applet code from the associations and data item storage paths, the method further comprises: displaying the link on the applet editing interface; when the link is selected, setting a request trigger event for the link; generating an applet code based on the associations and data item storage paths, comprising: generating the applet code based on the association, the link, and a request trigger event set for the link.
In one embodiment, before displaying the data item and value handling control on an applet editing interface, the method further comprises: and acquiring a default control and user-defined control attributes, and assigning the control attributes to the default control to obtain the value processing control.
In one embodiment, the generating applet code based on the associations and data item storage paths comprises: determining a system for operating the applet editing interface; translating the code corresponding to the value processing control on the system into a code corresponding to the applet according to a preset mapping relation; and generating the applet codes according to the codes, the associations and the data item storage paths of the value processing controls on the applet, which are obtained through translation.
In a second aspect, an apparatus for generating an applet code is provided, the apparatus comprising: an acquisition module for acquiring the data item via the data item storage path; the display module is used for displaying the data item and the value processing control on an applet editing interface; the generating module is used for generating an applet code according to the association and the data item storage path after the data item and the value processing control are associated through operation on the applet editing interface; the applet code carries an association relationship among the data item, the value processing control, and the data item storage path; when the applet codes run, the values of the data items are acquired through the data item storage paths in the incidence relations carried by the applet codes, and the values of the data items are processed through the value processing control.
In a third aspect, a computer device is provided, comprising a memory storing a computer program and a processor implementing the steps of the method for generating an applet code according to any one of the above first aspects when the processor executes the computer program.
In a fourth aspect, there is provided a computer-readable storage medium having stored thereon a computer program which, when executed by a processor, carries out the steps of the method of generating applet code according to any one of the first aspects.
In a fifth aspect, a computer program product is provided, comprising a computer program which, when executed by a processor, carries out the steps of the method for generating applet code according to any one of the above first aspects.
According to the generation method of the applet code, in the development stage of the applet (generation stage of the applet code), the data item can be obtained through the data item storage path, the data item and the value processing control fed back by the target server are displayed on the applet editing interface, after the data item and the value processing control are associated through operation on the applet editing interface, the applet code is automatically generated according to the association and the data item storage path, development of the applet is completed, a developer can operate on the applet editing interface according to needs to achieve association of the data item and the value processing control, the applet code carrying association relations among the data item, the value processing control and the data item storage path can be obtained, and the developer does not need to have related programming knowledge.
Meanwhile, in the development stage of the applet, the data item can be acquired through the data item storage path, the data item and the value processing control are displayed on the applet editing interface, and a developer can directly associate the data item and the value processing control on the editing interface, so that the editing flexibility in the generation stage of the applet codes is improved.
Drawings
FIG. 1 is a diagram of an application environment of a method for generating applet code in one embodiment;
FIG. 2 is a flowchart illustrating a method for generating an applet code according to a first embodiment;
FIG. 3 is an interface diagram of an applet editing interface in one embodiment;
FIG. 4 is a flowchart illustrating a method for generating an applet code according to a second embodiment;
FIG. 5 is a flowchart illustrating a method for generating an applet code according to a third embodiment;
FIG. 6 is a flowchart illustrating a method for setting display effects according to an embodiment;
FIG. 7 is an interface diagram illustrating a display effect setting interface in accordance with an embodiment;
FIG. 8 is a flowchart illustrating a method for setting a request trigger event according to an embodiment;
FIG. 9 is a flowchart illustrating a method of generating an applet code in a fourth embodiment;
fig. 10 is a flowchart illustrating a method of generating applet codes in the fifth embodiment;
FIG. 11 is a flowchart showing a method of generating an applet code in the sixth embodiment;
FIG. 12 is a block diagram showing an arrangement of an applet code generating apparatus in one embodiment;
FIG. 13 is a diagram illustrating an internal structure of a computer device according to an embodiment.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the present application is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the present application and are not intended to limit the present application.
As described in the background, the development framework of the applet needs the developer to have the corresponding programming knowledge to develop the applet. Such as: MINA developed by wechat and UNI framework-based development. MINA is directed to developers with corresponding programming knowledge and is not friendly to developers without programming knowledge. Development of applets based on the UNI framework can adapt to each platform, but also requires corresponding programming knowledge. In view of this, an embodiment of the present application provides a method for generating an applet code, where in a development stage of an applet (generation stage of an applet code), a data item may be obtained via a data item storage path, a data item and a value processing control are displayed on an applet editing interface, after the data item and the value processing control are associated through an operation on the applet editing interface, the applet code is automatically generated according to the association and the data item storage path, so as to complete development of the applet, and a developer may operate on the applet editing interface as needed to implement association between the data item and the value processing control, so as to obtain the applet code carrying an association relationship between the data item, the value processing control, and the data item storage path. The applet described in the embodiment of the present application includes at least one page, that is, the applet corresponding to the applet code generated in the embodiment of the present application includes at least one page.
The method for generating the applet code provided by the embodiment of the application can be applied to the application environment shown in fig. 1. Wherein the terminal 102 communicates with the web server 104 via a network. The data storage system may store data that the web server 104 needs to process, such as: the value of the data item. The data storage system may be integrated on the network server 104, or may be placed on the cloud or other network server. The terminal 102 may be, but is not limited to, various personal computers, notebook computers, smart phones, and tablet computers. The web server 104 may be implemented as a stand-alone server or as a server cluster comprised of multiple servers.
Referring to fig. 2, a method for generating an applet code provided in a first embodiment of the present application is shown, and is described by taking the method as an example for being applied to the terminal 102 in fig. 1, as shown in fig. 2, the method for generating an applet code may include steps S202 to S206.
S202, the data item is acquired via the data item storage path.
The data item storage path refers to a data source address where the data item is stored, that is, the data source where the data item is stored can be accessed through the data storage path. Such as: the data item storage path may be a link to a web server storing the data item, through which the web server may be accessed to retrieve the data item. The data item storage path may also be a path of a local file storing the data item through which the local file may be accessed to retrieve the data item.
In one embodiment, retrieving the data item via the data item storage path may include: and sending a data item request to the network server through a link pointing to the network server, and acquiring the data item returned by the network server and corresponding to the data item request. The network server stores data items, and the data item request is used for requesting the return of the data items from the network server.
In one embodiment, sending a data item request to a web server via a link to the web server, and obtaining a data item returned by the web server and corresponding to the data item request includes: and sending a data item request to the network server through the link pointing to the network server and the parameter pointing to the target object stored by the network server, and acquiring the data item returned by the network server and corresponding to the data item request. Wherein the data item request carries information of the target object. In one embodiment, the parameters pointing to the target object stored by the web server may be in the form of key-value pairs. To briefly explain the following example, when a personal information applet page is made, a personal information interface is needed, and a developer can add a link, which is assumed to be https:// www.xxx.com/api/v1/getUserInfo, to the applet editing interface. If the input value is dynamically from other data models, the input value and the drag value can be associated in an input or drag mode, and the corresponding value is obtained and assigned during specific operation. And after the complete request is input, clicking to send the request to the network server.
In one embodiment, prior to retrieving the data item via the data item storage path, comprising: a data item storage path is obtained. In one embodiment, obtaining a data item storage path comprises: in response to a data item storage path input operation, a data item storage path is acquired. The developer may provide the data item storage path to the terminal through a keyboard and/or a handwriting touch screen so that the terminal may retrieve the data item storage path.
In one embodiment, obtaining a data item storage path comprises: and querying a data item storage path in a preset path library. By presetting the path library in the terminal to store the data item storage path (the data item storage path can be a used data item storage path), the stored data item storage path is obtained from the path library under the condition that the data item needs to be obtained, the input of a developer is not needed, and the accuracy and the efficiency of generating the small program code are improved.
And S204, displaying the data item and the value processing control fed back by the target server on the applet editing interface.
The value processing control is an element which bears content or functions and is displayed on the applet interface, and the value processing control can be used for processing the value of the data item. Value handling controls may include, but are not limited to, text controls, image controls, video controls, button controls. The value processing control is used as an image control for brief description, the image control is used for displaying a picture, the picture is a value for the image control, and the picture is processed for displaying.
S206, after the data item and the value processing control are associated through operation on the small program editing interface, generating a small program code according to the association and the data item storage path.
Wherein the applet codes carry the association relationship between the data items, the value processing control and the data item storage path. And when the small program code runs, acquiring the value of the data item through the data item storage path in the incidence relation carried by the small program code, and processing the value of the data item through the value processing control. Such as: when the value of the data item is text data and the value processing control is a text display control, the text display control can display the text data (the value of the data item) when the applet code runs, so that a user can obtain the text data. Another example is: and when the values of the data items are video data and the value processing control is a video control, the video control can play the video data when the applet code runs so that a user can watch the video data.
Wherein the data item and value handling control are associated refers to binding the data item and value handling control. In one embodiment, the data item and the value handling control are associated such that the value of the data item is associated with the value handling control. And when the small program code runs, after the value of the data item is acquired, the acquired value of the data item is processed through the value processing control. Such as: when the value processing control is a text display control, the value of the data item is text data, and after the text data is acquired when the small program code runs, the text data can be displayed through the text display control. It should be noted that, in the embodiment of the present application, the data item is associated with the value processing control, that is, after the data source storing the data item is updated (the value of the data item stored by the data source changes), the value processed by the value processing control is also updated.
In one embodiment, if a data item and a value handling control on an applet editing interface are clicked in sequence, it is determined that the data item and the value handling control are associated.
According to the method for generating the applet code, the data item can be requested from the data source in advance in the generation stage of the applet code (the development stage of the applet) and displayed, so that a developer can check the returned data item, the developer can directly associate the data item with the value processing control on the applet editing interface, and the editing flexibility in the generation stage of the applet code is improved.
In one embodiment, as shown in FIG. 3, the applet editing interface 300 may include a control selection area 320 and an applet editing area 340. The control selection area 320 has at least one default control 322. Default controls 322 may include, but are not limited to, text controls, image controls, video controls, button controls. The developer can move the default control 322 provided in the control selection area 320 to the applet editing area 340, operate in the applet editing area 340 to implement association of the data item with the default control, and the like. It should be noted that the default controls 322 each carry a control identifier, and the control identifier is used to indicate a control type.
Since the default control property is preset, the default control property includes, but is not limited to, the color, transparency, shape, etc. of the control. The embodiment of the application also provides an adjusting method of the control attribute, so as to change the attribute of the default control. Prior to displaying the value handling controls on the applet editing interface comprising: and responding to the style adjustment operation of the default control, adjusting the default control, and displaying the adjusted value processing control. Optionally, the developer may implement a style adjustment operation on the default control through an external input device, a touch gesture, or a voice instruction, so as to implement fine adjustment on a size parameter of the default control or set an animation effect on the default control. Wherein the size parameter of the default control may be one or more of width, height, and inside-outside margin. In one embodiment, in response to a default control for a user to set animation effects as desired, an animation setting mode selection bullet corresponding to the default control is displayed, and in response to a mode selection operation on the animation setting mode selection bullet, the animation effects of the default control are determined. Animation settings may include simulated gesture settings and parameter settings. The simulation gesture is set to be that a developer drags a default control in a translation, rotation and zooming mode on the small program editing interface so as to correspondingly set animation effects of translation, rotation and zooming for the default control. The parameter setting can be used as a supplement to the simulation gesture setting, and the animation effect of the default control can be finely adjusted through the parameter setting.
In one embodiment, the size of the default control displayed in the applet editing area satisfies the display principle that the width of the default control displayed when the applet code runs is used as the adaptive display. Examples are as follows: when the small program code runs, the page width of the small program is based on 750px, and assuming that the editing area width of the small program is 1500px, all default controls displayed in the editing area of the small program are displayed in a 2-fold magnification mode, so that the same effect can be displayed in devices with different resolutions.
Please refer to fig. 4, which illustrates a method for generating an applet code according to a second embodiment of the present application, and the method is applied to the terminal in fig. 1 as an example for description. As illustrated in fig. 4, the generation method of the applet code may include steps S402 to S408.
S402, acquiring the data item via the data item storage path.
And S404, displaying the data item and the value processing control on the small program editing interface.
S406, if the data item is dragged on the small program editing interface, and the position of the data item after the dragging is finished corresponds to the position of the value processing control, determining that the data item and the value processing control are associated.
S408, generating the small program code according to the association and the data item storage path.
The descriptions of step S402 to step S404 and step S408 refer to the above embodiments, and are not repeated herein.
In one embodiment, if the data item is dragged on the applet editing interface, and the position of the data item after the dragging is finished corresponds to the position of the value processing control, determining that the data item and the value processing control are associated comprises: in response to an association operation on the applet editing interface, it is determined that the data item and the value handling control are associated. And the association operation is to drag the data item on the applet editing interface, and after the dragging is finished, the end position of the data item corresponds to the position of the value processing control.
In one embodiment, if the data item is dragged on the applet editing interface, and the position of the data item after the end of the dragging corresponds to the position of the value processing control, determining that the data item and the value processing control are associated includes: and judging whether the data item is dragged on the small program editing interface, if so, judging whether the dragging ending position of the data item corresponds to the position of the value processing control, and if so, determining that the data item and the value processing control are associated. In one embodiment, the developer long-presses the data item on the applet editing interface to drag the data item, and the position where the developer releases the data item (no longer presses the data item) is the dragging end position of the data item.
In the embodiment, the data item and the value processing control are displayed on the applet editing interface, so that developers can realize association of the data item and the value processing control through dragging operation, visual editing operation is realized, and the operability is high.
Please refer to fig. 5, which illustrates a method for generating an applet code provided in a third embodiment of the present application, and takes the application of the method to the terminal in fig. 1 as an example for description, as shown in fig. 5, the method includes steps S502 to S512.
S502, a data item is acquired via the data item storage path.
And S504, displaying the data item and the value processing control on the small program editing interface.
S506, if the data item is dragged on the small program editing interface, and the position of the data item after the dragging is finished corresponds to the position of the value processing control, determining that the data item is associated with the value processing control.
S508, judging whether the value of the data item is processable in the processing mode corresponding to the value processing control; if not, go to step S510; if yes, go to step S512.
S510, prompting the association error.
S512, generating the small program code according to the association and the data item storage path.
The descriptions of step S502 to step S506 refer to the above embodiments, and are not repeated herein.
It can be understood that not all values of the value processing control can be processed, for example, the text display control can only display text data, but cannot play audio data. The method and the device for processing the small program code can detect whether the value of the data item is processable in the processing mode corresponding to the value processing control (whether the operation on the small program editing interface is correct), prompt the association error under the condition that the value of the data item is not processable in the processing mode corresponding to the value processing control, remind developers of carrying out corresponding processing, and can avoid modifying the small program code after the small program code is generated and cannot be realized only in the small program code running stage, so that the generation efficiency of the small program code is improved. Such as: when the fact that the video control is associated with the non-Http link or the non-local file path through operation on the applet editing interface is detected, association errors can be prompted, and therefore developers can conveniently conduct correct operation. In one embodiment, prompting for an association error includes: and displaying a mistake shooting box, wherein the mistake shooting box displays characters 'associated operation error'. In one embodiment, prompting for an association error includes: and playing prompt audio. It should be noted that, if the value corresponding to the data item is processable by the processing manner corresponding to the value processing control, the applet code is generated according to the association and the data item storage path.
In one embodiment, the data item storage path described in the above embodiments is a link of a web server storing the data item. When the small program code generated by the small program code generation method provided by the embodiment of the application runs, the link in the incidence relation carried by the small program code requests the value of the data item from the network server; when the network server successfully feeds back the value of the data item, processing the data item through the value processing control; when the network server fails to feed back the value of the data item, the request is prompted to fail.
In order to realize that the generated applet code can achieve the above-mentioned effect, the embodiment of the present application provides a setting method of a display effect, and as shown in fig. 6, generating the applet code according to the association and the data item storage path may include steps S602 to S604.
And S602, responding to the display effect setting operation on the small program editing interface, and determining the display effect of the link pointing to the network server.
In one embodiment, determining a display effect of a link to a web server in response to a display effect setting operation on an applet editing interface comprises: and displaying a display effect setting interface corresponding to the link in response to the link selection operation (the display effect setting interface is shown in fig. 7), and determining the corresponding relation between the identification information returned by the network server and the display effect in response to the corresponding operation on the display effect setting interface. Wherein, the corresponding operation is the operation of realizing the association of the identification information and the display effect. Optionally, the identification information may include a data field, and the data field may be a code field. It should be noted that the meaning represented by the identification information returned by the network server is known, and the specific identification information depends on the interface definition or the service scenario. The developer can set different display effects on different identification information on the display effect setting interface. Specifically, when the first identification information is returned, the display effect of processing the value of the data item through the value processing control is associated, and when the second identification information is returned, the display effect of failing to prompt the request is associated, so that the flexibility of visual programming is greatly improved. The first identification information is used for indicating that the network server successfully feeds back the value of the data item, and the second identification information is used for indicating that the network server unsuccessfully feeds back the value of the data item. In one embodiment, prompting for a request failure includes presenting a request failed box that presents "request failed".
The following examples are given for illustration: a code field is defined, and its value is agreed to be 0 or 1, assuming that 0 represents the value of the network server successfully feeding back the data item and 1 represents the value of the network server unsuccessfully feeding back the data item. Referring to fig. 7, a developer may fill in 0 in the first area 702, fill in the second area 704, process the value of the data item through the value processing control, fill in 1 in the third area 706, and fill in the fourth area 708 through an external input device, a touch gesture, or a voice instruction, to prompt that the request fails. And the small program code generated according to the display effect setting interface can realize corresponding display according to the identification information returned by the network server when the small program code runs.
And S604, generating the small program code according to the association, the display effect and the data item storage path.
When the small program code runs, requesting the value of the data item from the network server through a link in the incidence relation carried by the small program code; when the network server successfully feeds back the value of the data item, processing the data item through the value processing control; when the network server fails to feed back the value of the data item, the request is prompted to fail.
Please refer to fig. 8, which illustrates a method for setting a request trigger event according to an embodiment of the present application, and the method is applied to the terminal in fig. 1 as an example for description. As shown in fig. 8, before generating the applet code according to the association and data item storage path, the applet code generating method may further include steps S802 to S804.
And S802, displaying the link of the network server on the applet editing interface.
In one embodiment, continuing to refer to FIG. 3, the applet editing interface may include a control selection area 320, an applet editing area 340, and an interface settings area 360. The description of the control selection area 320 and the applet editing area 340 is detailed in the above embodiments and will not be repeated here. The interface settings area 360 includes a link text box 364, the link text box 364 being used to display a link to a web server. In one embodiment, the interface setting area 360 may further include a data source display sub-area 362, and the data source display sub-area 362 is located below the link text box 364 for displaying the data items returned by the web server.
S804, when the link is selected, a request trigger event is set for the link.
In one embodiment, when the link is selected, setting the request triggering event for the link is preceded by: and determining that the link is selected in response to clicking operation on the link. Optionally, the request triggering event may be entry into the target page, or may be that the button control is clicked. If the data item is triggered to be acquired through the link when the page is entered, the trigger time can be set and associated to the page opening time; if it is the trigger to retrieve a data item via a link after clicking a button, then a trigger timing setting may be associated with the button click event.
It should be noted that generating the applet code based on the association and data item storage paths includes: the applet code is generated based on the associations, links, and request triggering events set for the links.
Please refer to fig. 9, which illustrates a method for generating an applet code provided in a fourth embodiment of the present application, and the method is applied to the terminal in fig. 1 as an example for description. As shown in fig. 9, the method for generating the applet code may include steps S902 to S908.
S902, the data item is acquired via the data item storage path.
And S904, acquiring a default control and a user-defined control attribute, and assigning the control attribute to the default control to obtain a value processing control.
According to the above description, the default control is a control with preset properties, and the embodiment of the application can obtain the required value processing control by modifying the properties of the default control, that is, assigning the user-defined control properties to the default control, so that the flexibility of the generation method of the applet code is improved.
In one embodiment, the applet editing interface can also include a custom control drawing area that displays a brush and a canvas. Acquiring a default control and user-defined control attributes, assigning the control attributes to the default control to obtain a value processing control, and the method comprises the following steps: the method comprises the steps of responding to attribute setting operation of a painting brush, determining attribute parameters of the painting brush, responding to painting operation on the painting canvas, and displaying an image corresponding to the painting operation on the painting canvas to obtain a value processing control corresponding to the attribute setting operation and the painting operation. The property parameters of the brush include, but are not limited to, a color, a transparency, a width, and a drawing type of the brush. Drawing types include, but are not limited to, straight lines, rectangles, circles, paths, and pictures. Optionally, a brush and a canvas are provided in the user-defined UI control operation panel. The properties of the brush are set first and, such as: color, transparency, brush width and the like, and then selecting a drawing type, wherein the drawing type comprises the following steps: drawing straight lines, drawing rectangles, drawing circles, drawing paths, drawing pictures, and the like, and finally drawing a desired UI effect in the canvas.
In one embodiment, assigning the control property to a default control to obtain a value handling control, then comprises: and displaying the value processing control in the control selection area. Therefore, the aim of multiplexing is fulfilled, and the efficiency of developing the small programs is improved.
And S906, displaying the data item and the value processing control on the small program editing interface.
And S908, after the data item and the value processing control are associated through operation on the small program editing interface, generating small program codes according to the association and the data item storage path.
The descriptions of step S902 and steps S906 to S908 refer to the above embodiments, and are not repeated herein.
Referring to fig. 10, a method for generating an applet code according to a fifth embodiment of the present application is shown, and is described by taking the method as an example for being applied to the terminal in fig. 1. As shown in fig. 10, the generation method of the applet code may include steps S1002 to S1010.
S1002, a data item is acquired via a data item storage path.
And S1004, displaying the data item and the value processing control on the applet editing interface.
S1006, after the data item and the value processing control are associated by an operation on the applet editing interface, determining a system for running the applet editing interface.
And S1008, translating the code corresponding to the value processing control on the system into the code corresponding to the applet according to the preset mapping relation.
And S1010, processing the corresponding code, association and data item storage path of the control on the small program according to the translated value, and generating a small program code.
The descriptions of step S1002 to step S1004 are detailed in the above embodiments, and are not repeated herein.
The system described in this embodiment refers to an application supported by an applet editing interface, such as: android, iOS and H5 web pages. The preset mapping relation carries a corresponding relation between a code of the value processing control on the system and a code on the applet. It should be noted that there is a corresponding relationship between the applet control and the value processing control at each application end. Such as: the Text component of the small program corresponds to the textView of the Android, the UITextView of the iOS and the Text of the H5; the image component of the applet corresponds to ImageView of Android, UIImageView of iOS and img of H5; the Button component of the applet corresponds to the Button of Android, UIbutton of iOS, button of H5, and so on.
In one embodiment, processing the corresponding code, association and data item storage path of the control on the applet according to the translated value to generate the applet code, including: and generating small program WXML, WXSS and JS files. And then retrieving a value processing control in the applet editing area, translating the value processing control according to a preset mapping relation (for example, android view, iOS UITextView and H5 Text are mapped to an applet Text component), generating a corresponding label and writing the label into a WXML file. The method comprises the steps of converting a control identification of a value processing control of a current system into a WXML corresponding component ID, writing attributes of width, height, font color, alignment mode and the like of the value processing control of the current system into WXSS, and matching the attributes with the value processing control through the component ID. The content generated by the JS file contains a data item storage path (including links and parameters) and a trigger request event. The method comprises the following specific steps: the JS file generates a network request method and declares a returned data model, when a specific data item under the data model is associated with a value processing control, the corresponding data model field is associated with the WXML component and corresponding attributes are generated in the JS file, when a request trigger event is triggered, the data is directly assigned to the corresponding attributes after being returned, and the associated value processing component can process the value of the corresponding data item. It should be noted that the data model refers here to the encapsulation of data returned by the network interface. Such as: the personal information interface returns a personal information data model, which is a package of name, birthday and age.
In one embodiment, the developer can modify aiming at the JS file after outputting the applet codes, so that the flexibility of applet development is ensured.
In one embodiment, after all page translations are completed, the applet code is analyzed to check for compliance with applet syntax, semantics, specifications. If yes, outputting a corresponding small program code; if not, giving an error prompt.
Please refer to fig. 11, which illustrates a method for generating an applet code according to a sixth embodiment of the present application, and the method is applied to the terminal in fig. 1 as an example. As shown in fig. 11, the generation method of the applet code may include steps S1102 to S1116.
And S1102, responding to the starting operation, and displaying an applet editing interface.
The applet editing interface can comprise a control selection area, an applet editing area and an interface setting area.
And S1104, responding to the movement operation on the small program editing interface, and displaying the value processing control corresponding to the movement operation in the small program editing area.
The moving operation can be a dragging operation of a developer on an applet editing interface.
And S1106, responding to the style adjustment operation, and displaying the adjusted value processing control in the small program editing area.
After the developer moves the value processing control to the applet editing interface, the developer can finely adjust the size parameter of the value processing control or set an animation effect on the value processing control by selecting the corresponding value processing control.
S1108, in response to the link input operation, acquires a link, acquires a data item via the link, and displays the data item on the interface setting area.
The link is to a data source that stores the data item.
S1110, when the link is selected, setting a request trigger event for the link.
S1112, determining that the data item and the value processing control are associated in response to the associating operation on the applet editing interface.
And S1114, judging whether the value of the data item is processable by the processing mode corresponding to the value processing control.
And S1116, if yes, generating the applet codes according to the association, the link, the request trigger event and the style adjustment operation.
It should be understood that, although the steps in the flowcharts related to the embodiments as described above are sequentially displayed as indicated by arrows, the steps are not necessarily performed sequentially as indicated by the arrows. The steps are not performed in the exact order shown and described, and may be performed in other orders, unless explicitly stated otherwise. Moreover, at least a part of the steps in the flowcharts related to the embodiments described above may include multiple steps or multiple stages, which are not necessarily performed at the same time, but may be performed at different times, and the execution order of the steps or stages is not necessarily sequential, but may be performed alternately or alternately with other steps or at least a part of the steps or stages in other steps.
Based on the same inventive concept, the embodiment of the present application further provides an apparatus for generating an applet code, which is used for implementing the method for generating an applet code mentioned above. The implementation scheme for solving the problem provided by the apparatus is similar to the implementation scheme described in the method, so specific limitations in the following embodiments of one or more generation apparatuses for applet codes may refer to the limitations on the generation method for applet codes, and are not described herein again.
In one embodiment, as shown in FIG. 12, an apparatus 1200 for generating applet code is provided and includes an obtaining module 1202, a display module 1204, and a generating module 1206. Wherein the obtaining module 1202 is configured to obtain the data item via a data item storage path. The display module 1204 is configured to display the data item and the value processing control on the applet editing interface. The generating module 1206 is used for generating an applet code according to the association and the data item storage path after the data item and the value processing control are associated through the operation on the applet editing interface; the applet code carries an association between the data item, the value handling control, and the data item storage path. When the applet codes run, the values of the data items are acquired through the data item storage paths in the incidence relations carried by the applet codes, and the values of the data items are processed through the value processing control.
In one embodiment, the apparatus for generating applet code may further comprise a determination module. The determining module is used for determining that the data item and the value processing control are associated if the data item is dragged on the applet editing interface and the position of the data item after the dragging is finished corresponds to the position of the value processing control.
In one embodiment, the apparatus for generating applet code may also include a determining module. The judging module is used for judging whether the value corresponding to the data item is processable by the processing mode corresponding to the value processing control; if not, prompting the association error.
In one embodiment, the means for generating the applet code may further comprise a link display module. The link display module is used for displaying the link on the applet editing interface; when the link is selected, setting a request trigger event for the link; the generation module may be further to generate the applet code based on the association, the link, and a request trigger event set for the link.
In one embodiment, the means for generating the applet code may also include a custom module. The user-defined module is used for acquiring a default control and user-defined control attributes, and assigning the control attributes to the default control to obtain the value processing control.
In one embodiment, the generation module may be further operable to determine a system for running the applet editing interface; translating the code corresponding to the value processing control on the system into a code corresponding to the applet according to a preset mapping relation; and generating the applet codes according to the codes, the associations and the data item storage paths of the value processing controls on the applet, which are obtained through translation.
The respective modules in the above-described generation apparatus of the applet code may be entirely or partially implemented by software, hardware, and a combination thereof. The modules can be embedded in a hardware form or independent from a processor in the computer device, and can also be stored in a memory in the computer device in a software form, so that the processor can call and execute operations corresponding to the modules.
In one embodiment, a computer device is provided, which may be a terminal, and its internal structure diagram may be as shown in fig. 13. The computer device includes a processor, a memory, a communication interface, a display screen, and an input device connected by a system bus. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device comprises a nonvolatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of an operating system and computer programs in the non-volatile storage medium. The communication interface of the computer device is used for carrying out wired or wireless communication with an external terminal, and the wireless communication can be realized through WIFI, a mobile cellular network, NFC (near field communication) or other technologies. The computer program is executed by a processor to implement a method of generation of applet code. The display screen of the computer equipment can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer equipment can be a touch layer covered on the display screen, a key, a track ball or a touch pad arranged on the shell of the computer equipment, an external keyboard, a touch pad or a mouse and the like.
Those skilled in the art will appreciate that the architecture shown in fig. 13 is merely a block diagram of some of the structures associated with the disclosed aspects and is not intended to limit the computing devices to which the disclosed aspects apply, as particular computing devices may include more or less components than those shown, or may combine certain components, or have a different arrangement of components.
In one embodiment, a computer device is further provided, which includes a memory and a processor, the memory stores a computer program, and the processor implements the steps of the above method embodiments when executing the computer program.
In an embodiment, a computer-readable storage medium is provided, on which a computer program is stored which, when being executed by a processor, carries out the steps of the above-mentioned method embodiments.
In an embodiment, a computer program product is provided, comprising a computer program which, when being executed by a processor, carries out the steps of the above-mentioned method embodiments.
It should be noted that, the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data for analysis, stored data, presented data, etc.) referred to in the present application are information and data authorized by the user or sufficiently authorized by each party.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by hardware instructions of a computer program, which can be stored in a non-volatile computer-readable storage medium, and when executed, can include the processes of the embodiments of the methods described above. Any reference to memory, database, or other medium used in the embodiments provided herein may include at least one of non-volatile and volatile memory. The nonvolatile Memory may include a Read-Only Memory (ROM), a magnetic tape, a floppy disk, a flash Memory, an optical Memory, a high-density embedded nonvolatile Memory, a resistive Random Access Memory (ReRAM), a Magnetic Random Access Memory (MRAM), a Ferroelectric Random Access Memory (FRAM), a Phase Change Memory (PCM), a graphene Memory, and the like. Volatile Memory can include Random Access Memory (RAM), external cache Memory, and the like. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM), among others. The databases involved in the embodiments provided herein may include at least one of relational and non-relational databases. The processors referred to in the embodiments provided herein may be general purpose processors, central processing units, graphics processors, digital signal processors, programmable logic devices, quantum computing based data processing logic devices, etc., without limitation.
The technical features of the above embodiments can be arbitrarily combined, and for the sake of brevity, all possible combinations of the technical features in the above embodiments are not described, but should be considered as the scope of the present specification as long as there is no contradiction between the combinations of the technical features.
The above-mentioned embodiments only express several embodiments of the present application, and the description thereof is more specific and detailed, but not construed as limiting the scope of the present application. It should be noted that, for a person skilled in the art, several variations and modifications can be made without departing from the concept of the present application, and these are all within the scope of protection of the present application. Therefore, the protection scope of the present application shall be subject to the appended claims.

Claims (10)

1. A method of generating applet code, the method comprising:
retrieving the data item via a data item storage path;
displaying the data item and the value processing control on an applet editing interface;
after the data item and the value processing control are associated through operation on the applet editing interface, generating an applet code according to the association and a data item storage path; the applet code carries an association relationship between the data item, the value processing control and the data item storage path;
when the applet codes run, the values of the data items are acquired through the data item storage paths in the incidence relations carried by the applet codes, and the values of the data items are processed through the value processing control.
2. The method of generating applet code according to claim 1, characterized in that the method further comprises:
and if the data item is dragged on the applet editing interface, and the position of the data item after the dragging is finished corresponds to the position of the value processing control, determining that the data item and the value processing control are associated.
3. The applet code generation method according to claim 2, characterized in that after determining that the data item and the value handling control are associated, the method further comprises:
judging whether the value corresponding to the data item is processable in the processing mode corresponding to the value processing control;
if not, prompting the association error.
4. The generation method of an applet code according to claim 1, characterized in that the data item storage path is a link of a web server storing the data item;
when the applet code runs, acquiring the value of the data item through the data item storage path in the incidence relation carried by the applet code to process the value of the data item through the value processing control, wherein the method comprises the following steps:
when the small program code runs, requesting the value of the data item from the network server through the link in the incidence relation carried by the small program code;
when the network server successfully feeds back the value of the data item, processing the value of the data item through the value processing control;
the method further comprises the following steps:
and when the network server fails to feed back the value of the data item, prompting that the request fails.
5. The generation method of an applet code according to claim 1, characterized in that the data item storage path is a link of a web server storing data items;
before generating the applet code from the associations and data item storage paths, the method further comprises:
displaying the link on the applet editing interface;
when the link is selected, setting a request triggering event for the link;
generating an applet code based on the associations and data item storage paths, comprising:
generating the applet code based on the association, the link, and a request trigger event set for the link.
6. The applet code generation method according to claim 1, characterized in that before displaying the data items and value handling controls on the applet editing interface, the method further comprises:
and acquiring a default control and user-defined control attributes, and assigning the control attributes to the default control to obtain the value processing control.
7. The method for generating an applet code according to claim 1, wherein the generating an applet code based on the association and data item storage path comprises:
determining a system for operating the applet editing interface;
translating the code corresponding to the value processing control on the system into a code corresponding to the applet according to a preset mapping relation;
and generating the applet codes according to the codes, the associations and the data item storage paths of the value processing controls on the applet, which are obtained through translation.
8. An apparatus for generating an applet code, the apparatus comprising:
an acquisition module for acquiring the data item via the data item storage path;
the display module is used for displaying the data item and the value processing control on an applet editing interface;
the generating module is used for generating an applet code according to the association and the data item storage path after the data item and the value processing control are associated through operation on the applet editing interface; the applet code carries an association relationship among the data item, the value processing control, and the data item storage path;
when the applet codes run, the values of the data items are acquired through the data item storage paths in the incidence relations carried by the applet codes, and the values of the data items are processed through the value processing control.
9. A computer device comprising a memory and a processor, the memory storing a computer program, characterized in that the processor, when executing the computer program, implements the steps of the method of any of claims 1 to 7.
10. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the steps of the method of any one of claims 1 to 7.
CN202210538829.1A 2022-05-18 2022-05-18 Method and device for generating small program code, computer equipment and storage medium Pending CN115145545A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210538829.1A CN115145545A (en) 2022-05-18 2022-05-18 Method and device for generating small program code, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210538829.1A CN115145545A (en) 2022-05-18 2022-05-18 Method and device for generating small program code, computer equipment and storage medium

Publications (1)

Publication Number Publication Date
CN115145545A true CN115145545A (en) 2022-10-04

Family

ID=83406246

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210538829.1A Pending CN115145545A (en) 2022-05-18 2022-05-18 Method and device for generating small program code, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN115145545A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116541305A (en) * 2023-06-26 2023-08-04 京东方艺云(杭州)科技有限公司 Abnormality detection method and device, electronic equipment and storage medium
CN116627397A (en) * 2023-07-24 2023-08-22 腾讯科技(深圳)有限公司 Program development method and related device

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116541305A (en) * 2023-06-26 2023-08-04 京东方艺云(杭州)科技有限公司 Abnormality detection method and device, electronic equipment and storage medium
CN116541305B (en) * 2023-06-26 2023-12-15 京东方艺云(杭州)科技有限公司 Abnormality detection method and device, electronic equipment and storage medium
CN116627397A (en) * 2023-07-24 2023-08-22 腾讯科技(深圳)有限公司 Program development method and related device
CN116627397B (en) * 2023-07-24 2024-01-30 腾讯科技(深圳)有限公司 Program development method and related device

Similar Documents

Publication Publication Date Title
CN110377851B (en) Method and device for realizing multi-stage linkage drop-down frame and computer equipment
CN103853548B (en) For deep linking to the method and system in application situation
US9507480B1 (en) Interface optimization application
WO2020151333A1 (en) Page loading method, apparatus, computer device and storage medium
CN106572139B (en) Multi-terminal control method, terminal, server and system
CN115145545A (en) Method and device for generating small program code, computer equipment and storage medium
CN111522552B (en) Sub-application generation method and device, computer equipment and storage medium
CN111596911B (en) Method, device, computer equipment and storage medium for generating control
CN111459541B (en) Application program packaging method and device, computer equipment and storage medium
CN106257418A (en) For by using assistance application to evaluate the technology of application
CN114611481A (en) Template configuration method and device, computer equipment and storage medium
CN109213668B (en) Operation recording method and device and terminal
US10719488B2 (en) Configurable provider for layered repository
CN111597151A (en) File generation method and device, computer equipment and storage medium
CN110865943A (en) Interface testing method and device, computer equipment and storage medium
CN111078215B (en) Software product application method and device, storage medium and electronic equipment
US9960972B1 (en) Contextual backup and restore operations
WO2021164756A1 (en) Input method and apparatus for smart television, computer device, and storage medium
CN115934238A (en) Interface display method and device, computer equipment and storage medium
CN114296714A (en) Program code generation method, program code generation device, computer device, and storage medium
CN115407974A (en) Business pushing method, device, computer equipment, storage medium and program product
CN117632951A (en) Algorithm flow arranging method, device, computer equipment and storage medium
CN115630248A (en) Page determination method and device, computer equipment and storage medium
CN115113945A (en) Page loading method and device, computer equipment and storage medium
CN116049009A (en) Test method, test device, computer equipment and computer readable storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination