WO2018228211A1 - Application conversion method, apparatus and device - Google Patents

Application conversion method, apparatus and device Download PDF

Info

Publication number
WO2018228211A1
WO2018228211A1 PCT/CN2018/089363 CN2018089363W WO2018228211A1 WO 2018228211 A1 WO2018228211 A1 WO 2018228211A1 CN 2018089363 W CN2018089363 W CN 2018089363W WO 2018228211 A1 WO2018228211 A1 WO 2018228211A1
Authority
WO
WIPO (PCT)
Prior art keywords
file
application
web
sub
code
Prior art date
Application number
PCT/CN2018/089363
Other languages
French (fr)
Chinese (zh)
Inventor
龚澄
Original Assignee
腾讯科技(深圳)有限公司
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 腾讯科技(深圳)有限公司 filed Critical 腾讯科技(深圳)有限公司
Publication of WO2018228211A1 publication Critical patent/WO2018228211A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • G06F8/44Encoding
    • G06F8/447Target code generation

Definitions

  • the embodiments of the present invention relate to the field of computer technologies, and in particular, to an application conversion method, apparatus, and device.
  • the embodiment of the present application provides an application conversion method, device, and device, which are used to solve the problem that the code reuse rate of the related art is low, and the manpower and time cost are large.
  • the technical solution is as follows:
  • an embodiment of the present application provides an application conversion method, where the method includes:
  • the sub-application is an application running by the parent application, the file of the sub-application includes: a first entry file, a global configuration file, and a logical code file of each page;
  • an embodiment of the present application provides an application conversion method, where the method includes:
  • the computer device acquires a file of the sub-application, the sub-application is an application that depends on the parent application, the file of the sub-application includes: a first entry file, a global configuration file, and a logical code file of each page ;
  • the computer device generates an executable file that is run on a webpage webpage according to a file of the sub-application
  • the computer device generates a file of the web application according to the executable file and a second entry file supported on the web end, and the executable file is referenced in the second entry file.
  • an embodiment of the present application provides an application conversion apparatus, where the apparatus includes:
  • a file obtaining module configured to acquire a file of a sub-application, the sub-application is an application that depends on the parent application, and the file of the sub-application includes: a first entry file, a global configuration file, and each page Logical code file;
  • a first generating module configured to support an executable file running on the web end according to the file of the sub-application
  • a second generating module configured to generate a file of the web application according to the executable file and a second import file that supports running on the web end, where the executable file is referenced in the second entry file.
  • an embodiment of the present application provides a computer device, where the computer device includes a processor and a memory, where the memory stores at least one instruction, at least one program, a code set, or a set of instructions, the at least one instruction, The at least one program, the set of codes, or a set of instructions is loaded and executed by the processor to implement an application conversion method as described in the first aspect.
  • an embodiment of the present application provides a computer readable storage medium, where the computer readable storage medium stores at least one instruction, at least one program, a code set, or a set of instructions, the at least one instruction, the at least one instruction A program, the set of codes, or a set of instructions is loaded and executed by a processor to implement the application conversion method as described in the first aspect.
  • an embodiment of the present application provides a computer program product for performing the application conversion method described in the above first aspect when the computer program product is executed.
  • the web application having the same function as the sub-application does not need to be separately developed, thereby saving the labor and time cost required for developing the above-mentioned web application.
  • FIG. 2 is a schematic diagram of a syntax structure provided by an embodiment of the present application.
  • FIG. 3 is a schematic diagram of generating an executable file supporting the running of a web terminal according to an embodiment of the present application
  • FIG. 4 is a schematic diagram of generating a second view file code provided by an embodiment of the present application.
  • FIG. 5A is a flowchart of an application conversion method according to another embodiment of the present application.
  • FIG. 5B is a flowchart of an application conversion method according to another embodiment of the present application.
  • FIG. 6 is a schematic diagram of multiple public interfaces provided by an embodiment of the present application.
  • FIG. 7 is a block diagram of an application conversion apparatus according to an embodiment of the present application.
  • FIG. 8 is a structural block diagram of an application conversion device according to an embodiment of the present application.
  • a sub-application is an application that depends on the parent application to run.
  • the sub-application may specifically be a social application, a file management application, a mail application, or a game application.
  • the above sub-applications can be called applets.
  • the user can directly open the sub-application by scanning the QR code corresponding to the sub-application or searching for the name of the sub-application.
  • Sub-applications can be easily accessed and propagated in the parent application.
  • the developer completes the development, debugging, previewing, and uploading of the sub-applications in the sub-application development tool.
  • the above sub-application development tool can be called WePY.
  • WePY is a componentized development framework. All the business and functions of a component are implemented in the component itself, and the components and components are isolated from each other.
  • the parent application can request the file of the sub-application from the server through an HTTP (HyperText Transfer Protocol) request or a WebSocket request, and then the parent application passes Load the above file to display the page of the sub-application.
  • HTTP HyperText Transfer Protocol
  • a parent application is an application that hosts a child application, providing an environment for the implementation of the child application.
  • the parent application is a native application.
  • Native applications are applications that run directly on the operating system.
  • the parent application can be a social application, a dedicated application that specifically supports the sub-application, a file management application, a mail application, or a game application.
  • Social applications include instant messaging applications, SNS (Social Network Service) applications, or live applications.
  • a web application is an application that can be accessed via the web. Its typical architecture is the browser/server architecture. The web application runs on the server, and the browser of the terminal can obtain the functions provided by the web application from the server through the HTTP request.
  • Web application development frameworks include the React framework, the Vue.js framework, and more.
  • sub-applications are implemented based on the client/server architecture, and the web applications are implemented based on the browser/server architecture. So the sub-application can't run directly on the web side.
  • a technical solution for converting a file of a sub-application into a file of a web application is provided, so that the web version of the application does not need to be separately developed, thereby saving the manpower required for developing the web version of the application.
  • the execution subject of each step is an application conversion device, which is also a computer device.
  • the application conversion device may be a computer, a server, or the like.
  • FIG. 1 is a flowchart of an application conversion method provided by an embodiment of the present application.
  • the method can include the following steps.
  • Step 101 Acquire a file of the sub-application.
  • a sub-application is an application that depends on the parent application to run.
  • the sub-application depends on the parent application running, which means that the sub-application cannot run directly in the operating system, but runs in the environment provided by the parent application. That is, the sub-application cannot run independently, but must rely on the parent application to run.
  • the parent application obtains the logical code file of the sub-application, parses the logical code file, and displays the page of the sub-application.
  • the sub-application files include: a first entry file, a global configuration file, and a logical code file for each page.
  • the first entry file is used to listen for and process the lifecycle functions of the sub-application and declare global variables.
  • the first entry file is a file with a suffix of .js.
  • the first entry file is app.js.
  • a global configuration file is a file that configures a sub-application as a whole. It can configure global configuration information such as the path of the sub-application page configuration file, the sub-application window representation, and the network timeout threshold of the sub-application.
  • the global configuration file is a file with a suffix of .json, and illustratively, the global configuration file is app.json.
  • the global profile supply is read by the conversion device so that the application conversion device can determine which pages of the sub-application need to be converted by the logical code files.
  • the above global configuration file is not needed, so there is no need to convert the global configuration file.
  • each page corresponds to a logical code file.
  • Logic code is recorded in the logic code file, and the logic code can be used to process events triggered in the corresponding sub-application page, and can also be used for other logic processing including data processing.
  • the logic code file can be a script file, such as a JavaScript script file.
  • the logical code file is a file with a suffix of .js.
  • the logical code file is page.js.
  • the sub-application's file also includes a global style file and a style file for each page.
  • the global style file includes the page's overall style data.
  • the page overall style data may include at least one of a page size of the corresponding sub-application page and an attribute such as a page background color.
  • the inline style corresponding to each page supports the style of the component using the style and class attributes.
  • the global style file is a file with a .wxss suffix, and illustratively, the global style file is app.wxss.
  • the style file for each page is used to configure the presentation of the page.
  • the style file includes component style data for the public components rendered by the page.
  • the component style data may include at least one of attributes such as position, size, color, font, and font size of the corresponding common component in the sub-application page to which it belongs.
  • attributes such as position, size, color, font, and font size of the corresponding common component in the sub-application page to which it belongs.
  • the style file is a file with a .wxss suffix.
  • the style file is page.wxss.
  • the sub-application's file also includes a view file for each page.
  • View files are used to configure the structure of common components in this page.
  • the view file is a file with a .wxml suffix.
  • the view file is page.wxml.
  • the sub-application's file also includes a configuration file for each page.
  • the configuration file is used to configure the file for the page, such as configuring the window behavior of the page.
  • the configuration file can be source code or a file obtained by compiling the source code.
  • the configuration file is a file with a .json suffix, and illustratively, the configuration file is page.json.
  • Step 102 Support an executable file running on the web side according to the file of the sub-application.
  • Executable files that support running on the web include script logic that supports execution on the web.
  • the executable file running on the web side is a file with a .js suffix.
  • the executable file is all.js.
  • the executable file supported on the web side is converted by the file of the sub-application, and the labor and time cost required for developing the web application having the same function as the sub-application is saved compared with the related technology.
  • the executable file running on the web side can directly implement the operation on the view, and the file of the sub-application realizes the operation on the view through data binding.
  • data binding refers to a method of binding the attributes of a user interface element (control) to an attribute on a type instance. Therefore, when generating an executable that supports running on the web, you need to simulate data binding.
  • data binding is simulated by introducing a view layer framework.
  • the above view layer framework may be a Vue.js framework.
  • the Vue.js framework provides efficient data binding and flexible component systems through a simple Application Programming Interface (API). Since the WePY framework is very similar to the syntax and functional features of the Vue.js framework, it is possible to make the sub-application files written in the WePY framework compatible with the Vue.js framework by simply encapsulating the WePY framework.
  • FIG. 2 a schematic diagram of a syntax architecture shown by an exemplary embodiment of the present application is shown.
  • the file of the sub-application is written by using the WePY framework.
  • the file of the above sub-application supports running on the server of the related application (such as the open platform server of the social application), and is also compatible by converting the file of the sub-application.
  • the file of the web application of the Vue.js framework and having the same function as the sub-application, the file support of the above web application is run on the web side.
  • step 102 includes the following sub-step 102a.
  • Step 102a Generate logic code supporting execution on the web end according to a logic code file of each page in the file of the sub-application;
  • logic code of the web application The above-mentioned logic code (hereinafter referred to as "logic code of the web application") supported on the web side is used to implement the function of the target application.
  • the difference between the logic code of the web application and the logic code of the sub-application is that the logic code of the sub-application supports the require function, and the logic code of the web application does not support the require function.
  • the require function refers to the function that can be called between each logic code module.
  • the logic code of the web application may be obtained by: obtaining, for each page, a plurality of logic code modules included in the logic code file of the page, and calling relationships between the respective logic code modules; The logic code modules are sequentially added to the executable file, and numbers are added to the respective logic code modules of the page; the entry code of the page is added to the executable file according to the calling relationship and number between the respective logic code modules of the page.
  • the entry code of the page is used to indicate the calling relationship between the various logical code modules of the page.
  • the calling relationship between the above various logic code modules can be called a dependency relationship, and the dependency relationship can be directly read from the logical code files of each page of the sub-application.
  • adding each logical code module of the page to the executable file in order refers to adding each logical code module of the page to the executable file in the form of a queue.
  • a logic code module needs to be called, it is only necessary to read the entry code of the page from the executable file to obtain the number of the logic code module, and call the above logic code module from the queue according to the number.
  • the require function is simulated on the web side.
  • Part (a) of Figure 3 illustrates the dependencies between the various logical code modules of a page in the sub-application's file. Among them, page.js depends on a.js and e.js, a.js depends on b.js, e.js depends on d.js and f.js, b.js depends on c.js, and c.js depends on d.js. Part (b) of Figure 3 is the logical code of the generated web side.
  • Step 102 can also include the following step 102b.
  • Step 102b generating a second style file code that supports recognition on the web end according to the global style file in the file of the sub-application and the style file of each page;
  • the second style file code is used to configure the presentation form of each page when the target application is running on the web side.
  • the difference between the style file code of a web application and the style file code of a sub-application is that the size units used are different. Therefore, the style file code of the web application can be obtained by converting the size unit used by the sub-application's style file code.
  • the second style file code is obtained by: obtaining a global style file and a first style file code included in a style file of each page; and the size unit in the first style file code is determined by the first unit Convert to the second unit and get the second style file code.
  • the first unit refers to the unit of size identified by the parent application
  • the second unit refers to the unit of size identified on the web side.
  • the size unit identified by the parent application is rpx.
  • the unit of size recognized by the web side is px.
  • an input box is 100 rpx in length, and after conversion, the input box is 50 px in the web application.
  • the file of the sub-application further includes a page view file of each page, and the executable file includes a second view file code that supports recognition on the web side.
  • Step 102 can also include the following step 102c.
  • Step 102c Generate, according to the view file of each page in the file of the sub-application, a second view file code that supports identification on the web end;
  • the second view file code is used to describe the structure of the common components of each page when the target application runs on the web side.
  • the difference between the view file code of a web application and the view file code of a sub-application is that the syntax for writing the view file code is different. Therefore, the view file code of the web application can be obtained by converting the writing syntax adopted by the view code file in the file of the sub-application.
  • the second view file code is obtained by: obtaining a first view file code included in a view file of each page and written according to a syntax of the sub-application; converting the first view file code into a web according to the web The second view file code written by the end-supported syntax.
  • the application conversion device pre-stores a mapping relationship between the syntax of the sub-application and the syntax supported by the web, and the application conversion device can search for the mapping relationship, thereby implementing the first view file code and the second view file code. Conversion between. Illustratively, the "view" in the first view file code is replaced with "div”.
  • FIG. 4 a schematic diagram of generating a second view file code, shown by an exemplary embodiment of the present application, is shown. Wherein (a) in FIG. 4 is the first view file code written in accordance with the syntax of the sub-application, and part (b) in FIG. 4 is the second view file code written in accordance with the syntax supported by the web-side.
  • step 102 further includes the following step 102d.
  • Step 102d the foregoing supporting the logic code executed on the web side, the second style file code supported on the web end, and the first item or the first item in the second view file code supported on the web end and any other one
  • a combination of items or multiples is added to a file in a preset format to generate an executable file that supports running on the web side.
  • the file in the preset format may be a file in the format of js (JavaScript).
  • Step 103 Generate a file of the web application according to the executable file and a second entry file that supports running in the web application, and reference the executable file in the second entry file.
  • the web application's files are all the files needed to support the application running on the web.
  • the sub-application has the same function as the web application, that is, the function implemented by the logic code of the sub-application is the same as the function implemented by the logic code of the web application.
  • both the sub-application and the web application have the function of refilling the mobile phone number.
  • the files of the sub-application and the files of the web application have the function of purchasing movie tickets online.
  • the files of the web application include: a second entry file and an executable file supported on the web side, and the executable file is referenced in the second entry file.
  • the second entry file in the web application's file is a file with a .html extension.
  • the explanation in step 101 mentions that the first entry file in the file of the sub-application is a file with a suffix of .js.
  • the file identifier of the executable file is written into the template file of the second entry file, thereby generating a second entry file.
  • the file identifier of the executable file may be a file name.
  • the method provided by the embodiment of the present application provides a technical solution for converting a file of a sub-application into a file of a web application, so that the web application having the same function as the sub-application does not need to be separately developed. It saves the manpower and time cost required to develop the above-mentioned web application, improves development efficiency, and enables a web application and a sub-application that implement the same function to share a basic source code and improve the code reuse rate.
  • the parent application provides a library of common component libraries and application programming interfaces.
  • the common component library includes a rich set of common components.
  • the application programming interface library includes a rich application programming interface (which can be called a public interface) for developers. Used when developing sub-applications. However, web applications are not able to invoke the above common components and public interfaces. Therefore, in addition to the conversion of the sub-application's files, the common components and public interfaces referenced by the sub-application's files need to be converted. The conversion method of the common component and the common interface will be described in detail below with reference to FIGS. 5A and 5B.
  • the application conversion method further includes the following steps.
  • Step 501 Select a Web component for implementing the first function from the Web component set for the common component referenced in the file of the sub-application for implementing the first function.
  • a common component is a component that can be shared by different sub-applications, has a visual form, and is a component of a sub-application page.
  • the common component can also be packaged with logic code for handling events triggered for the common component.
  • Different sub-applications share common components, which can be called the same common component at the same time or at different times.
  • Common components include, but are not limited to, a button component, a progress component, a text component, a form component, a slider component, and the like.
  • the web component set includes at least one component that is supported on the web side. There are no components on the web side, and the parent application provides a large number of components for developers to use when developing sub-applications.
  • a plurality of Web components for implementing different functions are written by using the Vue.js framework.
  • the above Web components may also be referred to as Vue components, and are added to the WePY framework, using Vue.
  • the component emulates the functionality of the common component so that the web application runtime with the same functionality as the sub-application can reference the Vue component to implement the functionality of the common component.
  • Step 502 changing the reference relationship from a common component for implementing the first function to a Web component for implementing the first function.
  • the web application cannot implement the first function when it runs. Therefore, it is necessary to change the reference relationship in the file of the sub-application so that the reference relationship in the file of the web application generated according to the file of the sub-application refers to the component in the set of the Web component, not the parent application.
  • the method provided by the embodiment of the present application can implement the common component of the web application by adding a web component in the sub-application development framework and modifying the reference relationship in the file of the sub-application.
  • the application conversion method further includes the following steps.
  • Step 503 Select, for the public interface for implementing the second function, in the file of the sub-application, select a web interface for implementing the second function from the web interface set.
  • the public interface is an interface that can be shared by different sub-applications.
  • the public interface can be used for network operations, data processing, media operations, operating terminal hardware, or operating sub-application pages.
  • the page logic code in the page logic code file may record the correspondence between the event type and the public interface, or the correspondence between the event type, the common component identifier, and the public interface, so that it may be recorded according to the page logic code in the page logic code file.
  • Correspondence select the public required to process the event in the public interface library. Referring to Figure 6, there is shown a plurality of common interfaces shown by embodiments of the present application.
  • the web interface set includes at least one interface supported on the web side. There is no interface on the web side, and the parent application or operating system provides a large number of public interfaces for developers to use when developing sub-applications.
  • a Web interface supported by the Web is used to write a plurality of Web interfaces for implementing different functions, and is added to the WePY framework, and the Web interface is used to simulate the functions of the public interface.
  • Step 504 changing the reference relationship from a public interface for implementing the second function to a web interface for implementing the second function.
  • the web application cannot implement the second function when it runs. Therefore, it is necessary to change the reference relationship in the file of the sub-application so that the reference relationship in the file of the web application generated according to the file of the sub-application refers to the interface in the set of the web interface, and is not provided by the parent application.
  • the method provided by the embodiment of the present application can implement a public interface by supporting a web application runtime by adding a web interface in a sub-application development framework and modifying a reference relationship in a sub-application file.
  • FIG. 7 shows a block diagram of an application conversion apparatus provided by an embodiment of the present application.
  • the apparatus has a function of implementing the above-described method examples, and the functions may be implemented by hardware or by hardware to execute corresponding software.
  • the apparatus may include a file obtaining module 701, a first generating module 702, and a second generating module 703.
  • the file obtaining module 701 is configured to acquire a file of the sub-application.
  • the sub-application is an application that depends on the parent application; the files of the sub-application include: a first entry file, a global configuration file, and a logical code file for each page.
  • the first generation module 702 is configured to support an executable file running on the web end according to the file of the sub-application.
  • the second generation module 703 is configured to generate a file of the web application according to the executable file and a second entry file that is supported to run on the web end, where the executable file is referenced in the second entry file.
  • the executable file includes logic code that supports execution on the web side
  • the first generating module 702 is specifically configured to:
  • the file of the sub-application further includes a global style file and a style file of each page, and the executable file further includes a second style file code that supports recognition on the web side;
  • the first generating module 702 is specifically configured to:
  • the second unit refers to a unit of size identified on the web side.
  • the file of the sub-application further includes a view file of each page, where the executable file further includes a second view file code that supports recognition on the web end;
  • the first generating module 702 is specifically configured to:
  • the device further includes: a component selection module and a first modification module (not shown).
  • a component selection module configured to select a web component for implementing the first function from a set of web components for a common component referenced in a file of the sub-application for implementing the first function, where the web component set includes At least one component that is supported on the web side.
  • a first change module for changing a reference relationship from a common component for implementing the first function to a web component for implementing the first function.
  • the device further includes: an interface selection module and a second modification module (not shown).
  • An interface selection module configured to select, from a web interface set, a web interface for implementing the second function, for the public interface referenced in the file of the sub-application for implementing the second function, where the web interface includes At least one interface supported on the web side.
  • a second change module configured to change the reference relationship from a public interface for implementing the second function to a web interface for implementing the second function.
  • the method provided by the embodiment of the present application provides a technical solution for converting a file of a sub-application into a file of a web application, so that the web application having the same function as the sub-application does not need to be separately developed, thereby It saves the manpower and time cost required for web applications, improves development efficiency, and enables web applications and sub-applications to share a basic set of source code to improve code reuse rate.
  • FIG. 8 is a structural block diagram of an application conversion device 800 (hereinafter referred to as “device 800 ”) provided by an embodiment of the present application.
  • the apparatus 800 includes a central processing unit (CPU) 801, a system memory 804 including a random access memory (RAM) 802 and a read only memory (ROM) 803, and a system bus 805 that connects the system memory 804 and the central processing unit 801.
  • the apparatus 800 also includes a basic input/output system (I/O system) 806 that facilitates transfer of information between various devices within the computer, and mass storage for storing the operating system 813, applications 814, and other program modules 815.
  • I/O system basic input/output system
  • the basic input/output system 806 includes a display 808 for displaying information and an input device 809 such as a mouse or keyboard for user input of information.
  • the display 808 and input device 809 are both connected to the central processing unit 801 via an input and output controller 810 that is coupled to the system bus 805.
  • the basic input/output system 806 can also include an input output controller 810 for receiving and processing input from a plurality of other devices, such as a keyboard, mouse, or electronic stylus.
  • input and output controller 810 also provides output to a display screen, printer, or other type of output device.
  • the mass storage device 807 is connected to the central processing unit 801 by a mass storage controller (not shown) connected to the system bus 805.
  • the mass storage device 807 and its associated computer readable medium provide non-volatile storage for the device 800. That is, the mass storage device 807 can include a computer readable medium (not shown) such as a hard disk or a CD-ROM drive.
  • the computer readable medium can include computer storage media and communication media.
  • Computer storage media includes volatile and nonvolatile, removable and non-removable media implemented in any method or technology for storage of information such as computer readable instructions, data structures, program modules or other data.
  • Computer storage media include RAM, ROM, EPROM, EEPROM, flash memory or other solid state storage technologies, CD-ROM, DVD or other optical storage, tape cartridges, magnetic tape, magnetic disk storage or other magnetic storage devices.
  • RAM random access memory
  • ROM read only memory
  • EPROM Erasable programmable read-only memory
  • EEPROM electrically erasable programmable read-only memory
  • the apparatus 800 can also be operated by a remote computer connected to the network via a network such as the Internet. That is, the device 800 can be connected to the network 812 through a network interface unit 811 connected to the system bus 805, or can be connected to other types of networks or remote computer systems (not shown) using the network interface unit 811. .
  • a computer readable storage medium having stored therein at least one instruction, at least one program, a code set or a set of instructions, the at least one instruction, the at least one program
  • the code set or instruction set is loaded and executed by a processor of the application conversion device to implement the various steps in the above method embodiments.
  • the computer readable storage medium described above may be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, and an optical data storage device.
  • a plurality as referred to herein means two or more.
  • "and/or” describing the association relationship of the associated objects, indicating that there may be three relationships, for example, A and/or B, which may indicate that there are three cases where A exists separately, A and B exist at the same time, and B exists separately.
  • the character “/” generally indicates that the contextual object is an “or” relationship.
  • the words “first,” “second,” and similar terms used herein do not denote any order, quantity, or importance, but are used to distinguish different components.

Landscapes

  • Engineering & Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The present application provides an application conversion method, an apparatus and a device. The method comprises: acquiring a file of a sub-application program, the sub-application program being an application program relying on the running of a main application program; generating, according to the file of the sub-application program, an executable file that can be run on a Web terminal; and generating a file of the Web application according to the executable file and a second entry file that can be run on the Web terminal, the executable file being cited in the second entry file. The present application provides a technical solution of converting the file of a sub-application program into a file of a Web application, so that there is no need to independently develop a Web application having the same function as the sub-application program, thereby saving manual power and time costs required for developing the Web application, improving the development efficiency, enabling the Web application and the sub-application program which have the same function to share a set of basic source codes, improving the reusability of codes.

Description

应用转换方法、装置及设备Application conversion method, device and device
本申请要求于2017年6月13日提交中华人民共和国国家知识产权局、申请号为201710443627.8、发明名称为“应用转换方法、装置及设备”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application claims the priority of the Chinese Patent Application of the National Intellectual Property Office of the People's Republic of China, Application No. 201710443627.8, and the name of the application "Application Conversion Method, Apparatus and Equipment" on June 13, 2017, the entire contents of which are incorporated by reference. In this application.
技术领域Technical field
本申请实施例涉及计算机技术领域,特别涉及一种应用转换方法、装置及设备。The embodiments of the present invention relate to the field of computer technologies, and in particular, to an application conversion method, apparatus, and device.
背景技术Background technique
目前,有的应用程序(Application)依赖于其它应用程序运行,上述依赖其它应用程序运行的应用程序可以称之为“小程序(mini program)”。小程序不能独立运行,但无需下载安装即可使用。At present, some applications depend on other applications, and the applications that depend on other applications can be called "mini programs". Applets cannot run independently, but they do not need to be downloaded and installed.
由于小程序的实现原理与Web(网页)应用的实现原理并不相同,因此对于某一项功能,如果既要开发用于实现该项功能的小程序,又要开发用于实现该项功能的Web应用,则需要开发人员编写两套独立的代码文件。其中一套代码文件为小程序版本的文件,其适于在小程序的运行平台上运行,另一套代码文件为Web版本的文件,其适于在Web端运行。Since the implementation principle of the applet is not the same as the implementation principle of the Web (web) application, for a certain function, if it is necessary to develop a small program for implementing the function, it is also developed to implement the function. Web applications require developers to write two separate sets of code files. One set of code files is a small program version file, which is suitable for running on the running platform of the applet, and another set of code files is a Web version file, which is suitable for running on the web side.
因此,对于实现某一项功能的应用来说,分别编写两套独立的代码文件会导致代码复用率低,且开发过程消耗的人力和时间成本会增大。Therefore, for an application that implements a certain function, writing two separate sets of code files separately results in a low code reuse rate, and the labor and time cost of the development process increases.
发明内容Summary of the invention
本申请实施例提供了一种应用转换方法、装置及设备,用以解决相关技术所存在的代码复用率低,且人力和时间成本大的问题。所述技术方案如下:The embodiment of the present application provides an application conversion method, device, and device, which are used to solve the problem that the code reuse rate of the related art is low, and the manpower and time cost are large. The technical solution is as follows:
一方面,本申请实施例提供一种应用转换方法,所述方法包括:In one aspect, an embodiment of the present application provides an application conversion method, where the method includes:
获取子应用程序的文件,所述子应用程序是依赖母应用程序运行的应用程序,所述子应用程序的文件包括:第一入口文件、全局配置文件、以及每一个页面的逻辑代码文件;Obtaining a file of a sub-application, the sub-application is an application running by the parent application, the file of the sub-application includes: a first entry file, a global configuration file, and a logical code file of each page;
根据所述子应用程序的文件生成支持在Web端运行的可执行文件;Generating an executable file running on the web side according to the file of the sub-application;
根据所述可执行文件和支持在Web端运行的第二入口文件生成Web应用的文件,所述第二入口文件中引用所述可执行文件。Generating a file of the web application according to the executable file and a second entry file supported on the web side, the executable file being referenced in the second entry file.
另一方面,本申请实施例提供一种应用转换方法,所述方法包括:On the other hand, an embodiment of the present application provides an application conversion method, where the method includes:
计算机设备获取子应用程序的文件,所述子应用程序是依赖母应用程序运行的应用程序,所述子应用程序的文件包括:第一入口文件、全局配置文件、以及每一个页面的逻辑代码文件;The computer device acquires a file of the sub-application, the sub-application is an application that depends on the parent application, the file of the sub-application includes: a first entry file, a global configuration file, and a logical code file of each page ;
所述计算机设备根据所述子应用程序的文件生成支持在网页Web端运行的可执行文件;The computer device generates an executable file that is run on a webpage webpage according to a file of the sub-application;
所述计算机设备根据所述可执行文件和支持在Web端运行的第二入口文件,生成Web应用的文件,所述第二入口文件中引用所述可执行文件。The computer device generates a file of the web application according to the executable file and a second entry file supported on the web end, and the executable file is referenced in the second entry file.
又一方面,本申请实施例提供一种应用转换装置,所述装置包括:In another aspect, an embodiment of the present application provides an application conversion apparatus, where the apparatus includes:
文件获取模块,用于获取子应用程序的文件,所述子应用程序是依赖母应用程序的应用程序,所述子应用程序的文件包括:第一入口文件、全局配置文件、以及每一个页面的逻辑代码文件;a file obtaining module, configured to acquire a file of a sub-application, the sub-application is an application that depends on the parent application, and the file of the sub-application includes: a first entry file, a global configuration file, and each page Logical code file;
第一生成模块,用于根据所述子应用程序的文件生成支持在Web端运行的可执行文件;a first generating module, configured to support an executable file running on the web end according to the file of the sub-application;
第二生成模块,用于根据所述可执行文件和支持在Web端运行的第二入口文件生成Web应用的文件,所述第二入口文件中引用所述可执行文件。And a second generating module, configured to generate a file of the web application according to the executable file and a second import file that supports running on the web end, where the executable file is referenced in the second entry file.
再一方面,本申请实施例提供一种计算机设备,所述计算机设备包括处理器和存储器,所述存储器中存储有至少一条指令、至少一段程序、代码集或指令集,所述至少一条指令、所述至少一段程序、所述代码集或指令集由所述处理器加载并执行以实现如第一方面所述的应用转换方法。In still another aspect, an embodiment of the present application provides a computer device, where the computer device includes a processor and a memory, where the memory stores at least one instruction, at least one program, a code set, or a set of instructions, the at least one instruction, The at least one program, the set of codes, or a set of instructions is loaded and executed by the processor to implement an application conversion method as described in the first aspect.
再一方面,本申请实施例提供一种计算机可读存储介质,所述计算机可读存储介质中存储有至少一条指令、至少一段程序、代码集或指令集,所述至少一条指令、所述至少一段程序、所述代码集或指令集由处理器加载并执行以实现如第一方面所述的应用转换方法。In still another aspect, an embodiment of the present application provides a computer readable storage medium, where the computer readable storage medium stores at least one instruction, at least one program, a code set, or a set of instructions, the at least one instruction, the at least one instruction A program, the set of codes, or a set of instructions is loaded and executed by a processor to implement the application conversion method as described in the first aspect.
再一方面,本申请实施例提供一种计算机程序产品,当该计算机程序产品被执行时,其用于执行上述第一方面所述的应用转换方法。In still another aspect, an embodiment of the present application provides a computer program product for performing the application conversion method described in the above first aspect when the computer program product is executed.
本申请实施例提供的技术方案可以带来如下有益效果:The technical solution provided by the embodiment of the present application can bring the following beneficial effects:
通过提供一种将子应用程序的文件转换为Web应用的文件的技术方案,以 使得与子应用程序具有相同功能的Web应用无需单独开发,从而节省了开发上述Web应用所需的人力和时间成本,提升开发效率,且使得具有相同功能的Web应用和子应用程序共用一套基础的源代码,提升代码复用率。By providing a technical solution for converting a file of a sub-application into a file of a web application, the web application having the same function as the sub-application does not need to be separately developed, thereby saving the labor and time cost required for developing the above-mentioned web application. Improve development efficiency, and enable web applications and sub-applications with the same function to share a basic set of source code to improve code reuse rate.
附图说明DRAWINGS
为了更清楚地说明本申请实施例中的技术方案,下面将对实施例描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings used in the description of the embodiments will be briefly described below. It is obvious that the drawings in the following description are only some embodiments of the present application. Other drawings may also be obtained from those of ordinary skill in the art in light of the inventive work.
图1是本申请一个实施例提供的应用转换方法的流程图;1 is a flowchart of an application conversion method provided by an embodiment of the present application;
图2是本申请一个实施例提供的语法架构的示意图;2 is a schematic diagram of a syntax structure provided by an embodiment of the present application;
图3是本申请一个实施例提供的生成支持Web端运行的可执行文件的示意图;FIG. 3 is a schematic diagram of generating an executable file supporting the running of a web terminal according to an embodiment of the present application; FIG.
图4是本申请一个实施例提供的生成第二视图文件代码的示意图;4 is a schematic diagram of generating a second view file code provided by an embodiment of the present application;
图5A是本申请另一个实施例提供的应用转换方法的流程图;FIG. 5A is a flowchart of an application conversion method according to another embodiment of the present application; FIG.
图5B是本申请另一个实施例提供的应用转换方法的流程图;FIG. 5B is a flowchart of an application conversion method according to another embodiment of the present application; FIG.
图6是本申请一个实施例提供的多个公共接口的示意图;6 is a schematic diagram of multiple public interfaces provided by an embodiment of the present application;
图7是本申请一个实施例提供的应用转换装置的框图;FIG. 7 is a block diagram of an application conversion apparatus according to an embodiment of the present application; FIG.
图8是本申请一个实施例提供的应用转换设备的结构方框图。FIG. 8 is a structural block diagram of an application conversion device according to an embodiment of the present application.
具体实施方式detailed description
为使本申请的目的、技术方案和优点更加清楚,下面将结合附图对本申请实施方式作进一步地详细描述。In order to make the objects, technical solutions and advantages of the present application more clear, the embodiments of the present application will be further described in detail below with reference to the accompanying drawings.
对本申请实施例进行描述之前,先对本申请实施例涉及的相关名词进行介绍。Before describing the embodiments of the present application, related nouns related to the embodiments of the present application are introduced.
(1)子应用程序(1) sub-application
子应用程序是依赖母应用程序运行的应用程序。子应用程序具体可以是社交应用程序、文件管理应用程序、邮件应用程序或者游戏应用程序等。上述子应用程序可以称之为小程序。用户通过扫描子应用程序对应的二维码或者搜索子应用程序的名称,即可直接打开该子应用程序。子应用程序可以在母应用程 序中被便捷地获取和传播。A sub-application is an application that depends on the parent application to run. The sub-application may specifically be a social application, a file management application, a mail application, or a game application. The above sub-applications can be called applets. The user can directly open the sub-application by scanning the QR code corresponding to the sub-application or searching for the name of the sub-application. Sub-applications can be easily accessed and propagated in the parent application.
开发者在子应用程序开发工具内完成子应用程序的开发、调试、预览、上传代码等操作。上述子应用程序开发工具可以称为WePY。WePY是一个组件化开发框架,组件的所有业务与功能在组件本身实现,组件与组件之间彼此隔离。开发者将子应用程序的代码文件发布至服务器之后,上述母应用程序可以通过HTTP(HyperText Transfer Protocol,超文本传输协议)请求或者WebSocket请求从服务器请求获取子应用程序的文件,然后母应用程序通过加载上述文件显示子应用程序的页面。The developer completes the development, debugging, previewing, and uploading of the sub-applications in the sub-application development tool. The above sub-application development tool can be called WePY. WePY is a componentized development framework. All the business and functions of a component are implemented in the component itself, and the components and components are isolated from each other. After the developer releases the code file of the sub-application to the server, the parent application can request the file of the sub-application from the server through an HTTP (HyperText Transfer Protocol) request or a WebSocket request, and then the parent application passes Load the above file to display the page of the sub-application.
(2)母应用程序(2) parent application
母应用程序是用于承载子应用程序的应用程序,为子应用程序的实现提供环境。母应用程序是原生应用程序。原生应用程序是可直接运行于操作系统的应用程序。母应用程序可以是社交应用程序、专门支持子应用程序的专用应用程序、文件管理应用程序、邮件应用程序或者游戏应用程序等。社交应用程序包括即时通信应用、SNS(Social Network Service,社交网站)应用或者直播应用等。A parent application is an application that hosts a child application, providing an environment for the implementation of the child application. The parent application is a native application. Native applications are applications that run directly on the operating system. The parent application can be a social application, a dedicated application that specifically supports the sub-application, a file management application, a mail application, or a game application. Social applications include instant messaging applications, SNS (Social Network Service) applications, or live applications.
(3)Web应用(3) Web application
Web应用是指一种可以通过Web访问的应用程序。其典型架构为浏览器/服务器架构。Web应用运行于服务器中,终端的浏览器通过HTTP请求即可从服务器获取Web应用所提供的功能。Web应用的开发框架包括React框架、Vue.js框架等。A web application is an application that can be accessed via the web. Its typical architecture is the browser/server architecture. The web application runs on the server, and the browser of the terminal can obtain the functions provided by the web application from the server through the HTTP request. Web application development frameworks include the React framework, the Vue.js framework, and more.
由于子应用程序和Web应用的开发框架并不相同,且两者的实现原理也并不相同,子应用程序是基于客户端/服务器架构实现的,而Web应用是基于浏览器/服务器架构实现的,因此子应用程序无法直接在Web端运行。Since the development framework of sub-applications and web applications is not the same, and the implementation principles of the two are not the same, the sub-applications are implemented based on the client/server architecture, and the web applications are implemented based on the browser/server architecture. So the sub-application can't run directly on the web side.
在本申请实施例中,提供了一种将子应用程序的文件转换为Web应用的文件的技术方案,以使得应用的Web版本无需单独开发,从而节省了开发应用的Web版本所需的人力和时间成本,提升开发效率,且使得应用的Web应用的文件和子应用程序的文件共用一套基础的源代码,提升代码复用率。In the embodiment of the present application, a technical solution for converting a file of a sub-application into a file of a web application is provided, so that the web version of the application does not need to be separately developed, thereby saving the manpower required for developing the web version of the application. Time cost, improve development efficiency, and make the application web application file and sub-application file share a basic source code to improve the code reuse rate.
本申请实施例提供的方法,各步骤的执行主体为应用转换设备,该应用转换设备也即是计算机设备。可选地,应用转换设备可以是计算机,也可以是服务器等。The method provided by the embodiment of the present application, the execution subject of each step is an application conversion device, which is also a computer device. Alternatively, the application conversion device may be a computer, a server, or the like.
请参考图1,其示出了本申请一个实施例提供的应用转换方法的流程图。该方法可以包括如下几个步骤。Please refer to FIG. 1 , which is a flowchart of an application conversion method provided by an embodiment of the present application. The method can include the following steps.
步骤101,获取子应用程序的文件。Step 101: Acquire a file of the sub-application.
子应用程序是依赖母应用程序运行的应用程序。其中,子应用程序依赖母应用程序运行是指子应用程序不能直接运行于操作系统中,而是运行于母应用程序提供的环境中。也即,子应用程序不能独立运行,而必须依赖母应用程序运行。母应用程序获取子应用程序的逻辑代码文件,对上述逻辑代码文件进行解析,进而显示子应用程序的页面。A sub-application is an application that depends on the parent application to run. Among them, the sub-application depends on the parent application running, which means that the sub-application cannot run directly in the operating system, but runs in the environment provided by the parent application. That is, the sub-application cannot run independently, but must rely on the parent application to run. The parent application obtains the logical code file of the sub-application, parses the logical code file, and displays the page of the sub-application.
子应用程序的文件包括:第一入口文件、全局配置文件以及每一个页面的逻辑代码文件。The sub-application files include: a first entry file, a global configuration file, and a logical code file for each page.
第一入口文件用于监听并处理子应用程序的生命周期函数,并声明全局变量。可选地,第一入口文件是后缀名为.js的文件,示例性地,第一入口文件为app.js。The first entry file is used to listen for and process the lifecycle functions of the sub-application and declare global variables. Optionally, the first entry file is a file with a suffix of .js. Illustratively, the first entry file is app.js.
全局配置文件是对子应用程序整体进行配置的文件,具体可配置子应用程序页面配置文件的路径、子应用程序窗口表现形式以及子应用程序的网络超时阈值等全局配置信息。可选地,全局配置文件是后缀名为.json的文件,示例性地,全局配置文件为app.json。在应用转换的过程中,全局配置文件供应用转换设备读取,以便应用转换设备能确定出需要对子应用程序的哪些页面的逻辑代码文件进行转换。另外,需要说明的是,在转换得到的Web应用的文件的运行过程中,无需使用上述全局配置文件,因此不需要对全局配置文件进行转换。此外,每一个页面对应有逻辑代码文件。逻辑代码文件中记载了逻辑代码,逻辑代码可用于处理相应子应用程序页面中触发的事件,还可以用于进行包括数据处理在内的其它逻辑处理。逻辑代码文件可以是脚本文件,如JavaScript脚本文件。可选地,逻辑代码文件是后缀名为.js的文件,示例性地,逻辑代码文件为page.js。A global configuration file is a file that configures a sub-application as a whole. It can configure global configuration information such as the path of the sub-application page configuration file, the sub-application window representation, and the network timeout threshold of the sub-application. Optionally, the global configuration file is a file with a suffix of .json, and illustratively, the global configuration file is app.json. During the application conversion process, the global profile supply is read by the conversion device so that the application conversion device can determine which pages of the sub-application need to be converted by the logical code files. In addition, it should be noted that, in the running process of the converted web application file, the above global configuration file is not needed, so there is no need to convert the global configuration file. In addition, each page corresponds to a logical code file. Logic code is recorded in the logic code file, and the logic code can be used to process events triggered in the corresponding sub-application page, and can also be used for other logic processing including data processing. The logic code file can be a script file, such as a JavaScript script file. Optionally, the logical code file is a file with a suffix of .js. Illustratively, the logical code file is page.js.
可选地,子应用程序的文件还包括全局样式文件和每一个页面的样式文件。全局样式文件包括页面整体样式数据。页面整体样式数据可以包括相应子应用程序页面的页面尺寸以及页面背景颜色等属性中的至少一种。每一个页面对应的内联样式支持使用style、class属性控制组件的样式。可选地,全局样式文件是后缀名为.wxss的文件,示例性地,全局样式文件为app.wxss。每一个页面的样式文件用于配置该页面的展现形式。样式文件包括该页面呈现的公 共组件的组件样式数据。组件样式数据可以包括相应公共组件在所属子应用程序页面中的位置、尺寸、颜色、字体和字号等属性中的至少一种。关于公共组件的介绍,可以参见图5A提供的方法实施例。可选地,样式文件是后缀名为.wxss的文件,示例性地,样式文件为page.wxss。Optionally, the sub-application's file also includes a global style file and a style file for each page. The global style file includes the page's overall style data. The page overall style data may include at least one of a page size of the corresponding sub-application page and an attribute such as a page background color. The inline style corresponding to each page supports the style of the component using the style and class attributes. Optionally, the global style file is a file with a .wxss suffix, and illustratively, the global style file is app.wxss. The style file for each page is used to configure the presentation of the page. The style file includes component style data for the public components rendered by the page. The component style data may include at least one of attributes such as position, size, color, font, and font size of the corresponding common component in the sub-application page to which it belongs. For an introduction to common components, reference may be made to the method embodiment provided in FIG. 5A. Optionally, the style file is a file with a .wxss suffix. Illustratively, the style file is page.wxss.
可选地,子应用程序的文件还包括每一个页面的视图文件。视图文件用于配置该页面中的公共组件的结构。可选地,视图文件是后缀名为.wxml的文件,示例性地,视图文件为page.wxml。Optionally, the sub-application's file also includes a view file for each page. View files are used to configure the structure of common components in this page. Optionally, the view file is a file with a .wxml suffix. Illustratively, the view file is page.wxml.
可选地,子应用程序的文件还包括每一个页面的配置文件。配置文件用于对该页面进行配置的文件,例如对该页面的窗口表现进行配置。配置文件可以是源代码或者是将源代码编译后得到的文件。可选地,配置文件是后缀名为.json的文件,示例性地,配置文件为page.json。Optionally, the sub-application's file also includes a configuration file for each page. The configuration file is used to configure the file for the page, such as configuring the window behavior of the page. The configuration file can be source code or a file obtained by compiling the source code. Optionally, the configuration file is a file with a .json suffix, and illustratively, the configuration file is page.json.
步骤102,根据子应用程序的文件生成支持在Web端运行的可执行文件。Step 102: Support an executable file running on the web side according to the file of the sub-application.
支持在Web端运行的可执行文件包括支持在Web端执行的页面逻辑代码。可选地,支持在Web端运行的可执行文件为后缀名为.js的文件,示例性地,该可执行文件为all.js。Executable files that support running on the web include script logic that supports execution on the web. Optionally, the executable file running on the web side is a file with a .js suffix. For example, the executable file is all.js.
在本申请实施例中,支持在Web端运行的可执行文件由子应用程序的文件转换得到,相比于相关技术,节省了开发与子应用程序具有相同功能的Web应用所需的人力和时间成本,提升开发效率,且使得具有相同功能的Web应用和子应用程序共用一套基础的源代码,提升代码复用率。In the embodiment of the present application, the executable file supported on the web side is converted by the file of the sub-application, and the labor and time cost required for developing the web application having the same function as the sub-application is saved compared with the related technology. Improve development efficiency, and enable web applications and sub-applications with the same function to share a basic set of source code to improve code reuse rate.
支持在Web端运行的可执行文件能直接实现对视图的操作,而子应用程序的文件通过数据绑定实现对视图的操作。其中,数据绑定是指将一个用户界面元素(控件)的属性绑定到一个类型实例上的某个属性的方法。因此在生成支持在Web端运行的可执行文件时,需要模拟数据绑定功能。The executable file running on the web side can directly implement the operation on the view, and the file of the sub-application realizes the operation on the view through data binding. Among them, data binding refers to a method of binding the attributes of a user interface element (control) to an attribute on a type instance. Therefore, when generating an executable that supports running on the web, you need to simulate data binding.
本申请实施例中,通过引入视图层框架来模拟数据绑定。其中,上述视图层框架可以是Vue.js框架。Vue.js框架通过简单的应用程序编程接口(Application Programming Interface,API)提供高效的数据绑定和灵活的组件系统。由于WePY框架与Vue.js框架的语法及功能特性非常相似,因此,可以通过对WePY框架的简单封装,以使得采用WePY框架编写的子应用程序的文件也能兼容于Vue.js框架。In the embodiment of the present application, data binding is simulated by introducing a view layer framework. Wherein, the above view layer framework may be a Vue.js framework. The Vue.js framework provides efficient data binding and flexible component systems through a simple Application Programming Interface (API). Since the WePY framework is very similar to the syntax and functional features of the Vue.js framework, it is possible to make the sub-application files written in the WePY framework compatible with the Vue.js framework by simply encapsulating the WePY framework.
结合参考图2,其示出了本申请一个示例性实施例示出的语法架构的示意图。采用WePY框架编写子应用程序的文件,上述子应用程序的文件支持在相 关应用的服务器(如社交应用的开放平台服务器)端运行,此外,还通过对子应用程序的文件进行转换处理,得到兼容于Vue.js框架且与子应用程序具有相同功能的Web应用的文件,上述Web应用的文件支持在Web端运行。Referring to FIG. 2, a schematic diagram of a syntax architecture shown by an exemplary embodiment of the present application is shown. The file of the sub-application is written by using the WePY framework. The file of the above sub-application supports running on the server of the related application (such as the open platform server of the social application), and is also compatible by converting the file of the sub-application. The file of the web application of the Vue.js framework and having the same function as the sub-application, the file support of the above web application is run on the web side.
可选地,步骤102包括如下子步骤102a。Optionally, step 102 includes the following sub-step 102a.
步骤102a,根据子应用程序的文件中的各个页面的逻辑代码文件,生成支持在Web端执行的逻辑代码;Step 102a: Generate logic code supporting execution on the web end according to a logic code file of each page in the file of the sub-application;
上述支持在Web端执行的逻辑代码(以下称为“Web应用的逻辑代码”)用于实现目标应用的功能。Web应用的逻辑代码与子应用程序的逻辑代码的区别在于:子应用程序的逻辑代码支持require功能,而Web应用的逻辑代码并不支持require功能。其中,require功能是指各个逻辑代码模块之间能够调用的功能。The above-mentioned logic code (hereinafter referred to as "logic code of the web application") supported on the web side is used to implement the function of the target application. The difference between the logic code of the web application and the logic code of the sub-application is that the logic code of the sub-application supports the require function, and the logic code of the web application does not support the require function. Among them, the require function refers to the function that can be called between each logic code module.
将子应用程序的逻辑代码转化为Web应用的逻辑代码时,需要模拟require功能,以实现Web应用的各个逻辑代码模块之间的调用。可选地,Web应用的逻辑代码可通过如下步骤获取:对于每一个页面,获取页面的逻辑代码文件中包含的多个逻辑代码模块,以及各个逻辑代码模块之间的调用关系;将页面的各个逻辑代码模块按序添加至可执行文件中,并为页面的各个逻辑代码模块添加编号;根据页面的各个逻辑代码模块之间的调用关系及编号,在可执行文件中添加页面的入口代码。When converting the logic code of a sub-application into the logic code of a web application, it is necessary to simulate the require function to implement the call between the various logic code modules of the web application. Optionally, the logic code of the web application may be obtained by: obtaining, for each page, a plurality of logic code modules included in the logic code file of the page, and calling relationships between the respective logic code modules; The logic code modules are sequentially added to the executable file, and numbers are added to the respective logic code modules of the page; the entry code of the page is added to the executable file according to the calling relationship and number between the respective logic code modules of the page.
页面的入口代码用于指示页面的各个逻辑代码模块之间的调用关系。上述各个逻辑代码模块之间的调用关系可以称之为依赖关系,依赖关系可以直接从子应用程序的各个页面的逻辑代码文件中读取。The entry code of the page is used to indicate the calling relationship between the various logical code modules of the page. The calling relationship between the above various logic code modules can be called a dependency relationship, and the dependency relationship can be directly read from the logical code files of each page of the sub-application.
可选地,将页面的各个逻辑代码模块按序添加至可执行文件中,是指将页面的各个逻辑代码模块以队列的形式添加至可执行文件中。当需要调用某个逻辑代码模块,只需从可执行文件中读取页面的入口代码,以获得该逻辑代码模块的编号,并根据编号从队列中调用上述逻辑代码模块。通过上述方式,在Web端模拟require功能。Optionally, adding each logical code module of the page to the executable file in order refers to adding each logical code module of the page to the executable file in the form of a queue. When a logic code module needs to be called, it is only necessary to read the entry code of the page from the executable file to obtain the number of the logic code module, and call the above logic code module from the queue according to the number. In the above way, the require function is simulated on the web side.
结合参考图3,其示出了本申请一个示例性实施例示出的生成支持在Web端运行的可执行文件的示意图。图3中的(a)部分体现了子应用程序的文件中某个页面的各个逻辑代码模块之间的依赖关系。其中,page.js依赖a.js和e.js,a.js依赖b.js,e.js依赖d.js和f.js,b.js依赖c.js,c.js依赖d.js。图3中的(b)部分是生成的Web端的逻辑代码。将页面的入口代码、a.js、b.js、c.js、d.js、 e.js和f.js以队列的形式添加至可执行文件,其中,a.js、b.js、c.js、d.js、e.js和f.js的编号分别为1、2、3、4、5和6,并且页面的入口代码依赖a.js和e.js,a.js依赖b.js,e.js依赖d.js和f.js,b.js依赖c.js,c.js依赖d.js。Referring to FIG. 3, there is shown a schematic diagram of generating an executable file supported for execution on the web side, shown by an exemplary embodiment of the present application. Part (a) of Figure 3 illustrates the dependencies between the various logical code modules of a page in the sub-application's file. Among them, page.js depends on a.js and e.js, a.js depends on b.js, e.js depends on d.js and f.js, b.js depends on c.js, and c.js depends on d.js. Part (b) of Figure 3 is the logical code of the generated web side. Add the page entry code, a.js, b.js, c.js, d.js, e.js, and f.js to the executable as a queue, where a.js, b.js, c The numbers for .js, d.js, e.js, and f.js are 1, 2, 3, 4, 5, and 6, respectively, and the entry code for the page depends on a.js and e.js, and a.js depends on b. Js, e.js depends on d.js and f.js, b.js depends on c.js, and c.js depends on d.js.
可选地,若子应用程序的文件还包括全局样式文件和每一个页面的页面样式文件,则可执行文件中包括支持在Web端识别的第二样式文件代码。步骤102还可以包括如下步骤102b。Optionally, if the file of the sub-application further includes a global style file and a page style file of each page, the executable file includes a second style file code that supports recognition on the web side. Step 102 can also include the following step 102b.
步骤102b,根据子应用程序的文件中的全局样式文件和各个页面的样式文件,生成支持在Web端识别的第二样式文件代码;Step 102b, generating a second style file code that supports recognition on the web end according to the global style file in the file of the sub-application and the style file of each page;
第二样式文件代码用于配置目标应用在Web端运行时各个页面的展现形式。Web应用的样式文件代码与子应用程序的样式文件代码的区别在于:采用的尺寸单位不同。因此,可通过对子应用程序的样式文件代码所采用的尺寸单位进行转换,进而得到Web应用的样式文件代码。可选地,第二样式文件代码可通过如下步骤获取:获取全局样式文件和各个页面的样式文件中包含的第一样式文件代码;将第一样式文件代码中的尺寸单位由第一单位转换为第二单位,得到第二样式文件代码。其中,第一单位是指母应用程序识别的尺寸单位,第二单位是指在Web端识别的尺寸单位。The second style file code is used to configure the presentation form of each page when the target application is running on the web side. The difference between the style file code of a web application and the style file code of a sub-application is that the size units used are different. Therefore, the style file code of the web application can be obtained by converting the size unit used by the sub-application's style file code. Optionally, the second style file code is obtained by: obtaining a global style file and a first style file code included in a style file of each page; and the size unit in the first style file code is determined by the first unit Convert to the second unit and get the second style file code. The first unit refers to the unit of size identified by the parent application, and the second unit refers to the unit of size identified on the web side.
结合步骤101中的解释说明,母应用程序识别的尺寸单位为rpx。Web端识别的尺寸单位为px。可选地,第一单位和第二单位的换算关系采用如下方式得到:规定屏幕宽为750rpx,如在设备A上,屏幕宽度为375px,共有750个物理像素,则750rpx=375px=750物理像素,1rpx=0.5px=1物理像素。示例性地,在子应用程序中某一输入框长度为100rpx,经过换算后,在Web应用中该输入框长度为50px。In conjunction with the explanation in step 101, the size unit identified by the parent application is rpx. The unit of size recognized by the web side is px. Optionally, the conversion relationship between the first unit and the second unit is obtained by: specifying a screen width of 750 rpx, such as on device A, the screen width is 375 px, and there are 750 physical pixels, then 750 rpx=375px=750 physical pixels. , 1rpx = 0.5px = 1 physical pixel. Illustratively, in a sub-application, an input box is 100 rpx in length, and after conversion, the input box is 50 px in the web application.
可选地,子应用程序的文件还包括每一个页面的页面视图文件,则可执行文件中包括支持在Web端识别的第二视图文件代码。步骤102还可以包括如下步骤102c。Optionally, the file of the sub-application further includes a page view file of each page, and the executable file includes a second view file code that supports recognition on the web side. Step 102 can also include the following step 102c.
步骤102c,根据子应用程序的文件中的各个页面的视图文件,生成支持在Web端识别的第二视图文件代码;Step 102c: Generate, according to the view file of each page in the file of the sub-application, a second view file code that supports identification on the web end;
第二视图文件代码用于描述目标应用运行于Web端时各个页面的公共组件的结构。Web应用的视图文件代码与子应用程序的视图文件代码的区别在于:编写视图文件代码所采取的语法不同。因此,可通过对子应用程序的文件中的视图代码文件所采取的编写语法进行转换,进而获得Web应用的视图文件 代码。可选地,第二视图文件代码可通过如下步骤获取:获取各个页面的视图文件中包含的、且按照子应用程序的语法编写的第一视图文件代码;将第一视图文件代码转换成按照Web端支持的语法编写的第二视图文件代码。The second view file code is used to describe the structure of the common components of each page when the target application runs on the web side. The difference between the view file code of a web application and the view file code of a sub-application is that the syntax for writing the view file code is different. Therefore, the view file code of the web application can be obtained by converting the writing syntax adopted by the view code file in the file of the sub-application. Optionally, the second view file code is obtained by: obtaining a first view file code included in a view file of each page and written according to a syntax of the sub-application; converting the first view file code into a web according to the web The second view file code written by the end-supported syntax.
可选地,应用转换设备预先存储有子应用程序的语法与Web端支持的语法之间的映射关系,应用转换设备可以查找上述映射关系,进而实现第一视图文件代码与第二视图文件代码之间的转换。示例性地,第一视图文件代码中的“view”替换为“div”。结合参考图4,其示出了本申请一个示例性实施例示出的生成第二视图文件代码的示意图。其中,图4中的(a)部分是按照子应用程序的语法编写的第一视图文件代码,图4中的(b)部分是按照Web端支持的语法编写的第二视图文件代码。Optionally, the application conversion device pre-stores a mapping relationship between the syntax of the sub-application and the syntax supported by the web, and the application conversion device can search for the mapping relationship, thereby implementing the first view file code and the second view file code. Conversion between. Illustratively, the "view" in the first view file code is replaced with "div". Referring to FIG. 4, a schematic diagram of generating a second view file code, shown by an exemplary embodiment of the present application, is shown. Wherein (a) in FIG. 4 is the first view file code written in accordance with the syntax of the sub-application, and part (b) in FIG. 4 is the second view file code written in accordance with the syntax supported by the web-side.
可选地,步骤102还包括如下步骤102d。Optionally, step 102 further includes the following step 102d.
步骤102d,将上述支持在Web端执行的逻辑代码、支持在Web端识别的第二样式文件代码、支持在Web端识别的第二视图文件代码中的第一项或者第一项与其它任意一项或多项的组合,添加至预设格式的文件中,生成支持在Web端运行的可执行文件。Step 102d, the foregoing supporting the logic code executed on the web side, the second style file code supported on the web end, and the first item or the first item in the second view file code supported on the web end and any other one A combination of items or multiples is added to a file in a preset format to generate an executable file that supports running on the web side.
其中,预设格式的文件可以是js(JavaScript)格式的文件。The file in the preset format may be a file in the format of js (JavaScript).
步骤103,根据可执行文件和支持在Web应用运行的第二入口文件生成Web应用的文件,第二入口文件中引用可执行文件。Step 103: Generate a file of the web application according to the executable file and a second entry file that supports running in the web application, and reference the executable file in the second entry file.
Web应用的文件是支持应用在Web端运行所需的全部文件。在本申请实施例中,子应用程序与Web应用具有相同的功能,也即,子应用程序的逻辑代码所实现的功能与Web应用的逻辑代码所实现的功能相同。例如,子应用程序和Web应用均具有为手机号码充值的功能,再例如,子应用程序的文件和Web应用的文件均具有在线选购电影票的功能。The web application's files are all the files needed to support the application running on the web. In the embodiment of the present application, the sub-application has the same function as the web application, that is, the function implemented by the logic code of the sub-application is the same as the function implemented by the logic code of the web application. For example, both the sub-application and the web application have the function of refilling the mobile phone number. For example, the files of the sub-application and the files of the web application have the function of purchasing movie tickets online.
Web应用的文件包括:支持在Web端运行的第二入口文件和可执行文件,且第二入口文件中引用可执行文件。Web应用的文件中的第二入口文件为后缀名为.html的文件。然而在步骤101中的解释说明提到,子应用程序的文件中的第一入口文件为后缀名为.js的文件。在本申请实施例中,将可执行文件的文件标识写入第二入口文件的模板文件,进而生成第二入口文件。其中,可执行文件的文件标识可以是文件名。The files of the web application include: a second entry file and an executable file supported on the web side, and the executable file is referenced in the second entry file. The second entry file in the web application's file is a file with a .html extension. However, the explanation in step 101 mentions that the first entry file in the file of the sub-application is a file with a suffix of .js. In the embodiment of the present application, the file identifier of the executable file is written into the template file of the second entry file, thereby generating a second entry file. The file identifier of the executable file may be a file name.
综上所述,本申请实施例提供的方法,提供了一种将子应用程序的文件转换为Web应用的文件的技术方案,以使得与子应用程序具有相同功能的Web 应用无需单独开发,从而节省了开发上述Web应用所需的人力和时间成本,提升开发效率,且使得实现相同功能的Web应用和子应用程序共用一套基础的源代码,提升代码复用率。In summary, the method provided by the embodiment of the present application provides a technical solution for converting a file of a sub-application into a file of a web application, so that the web application having the same function as the sub-application does not need to be separately developed. It saves the manpower and time cost required to develop the above-mentioned web application, improves development efficiency, and enables a web application and a sub-application that implement the same function to share a basic source code and improve the code reuse rate.
母应用程序提供有公共组件库和应用程序编程接口库,该公共组件库包括丰富的公共组件,该应用程序编程接口库包括丰富的应用程序编程接口(可以称之为公共接口),供开发者在开发子应用程序时使用。然而,Web应用并不能够调用上述公共组件和公共接口。因此,在对子应用程序的文件进行转换之外,还需要对子应用程序的文件所引用的公共组件和公共接口进行转换。下面结合图5A和图5B,对公共组件和公共接口的转换方法进行详细描述。The parent application provides a library of common component libraries and application programming interfaces. The common component library includes a rich set of common components. The application programming interface library includes a rich application programming interface (which can be called a public interface) for developers. Used when developing sub-applications. However, web applications are not able to invoke the above common components and public interfaces. Therefore, in addition to the conversion of the sub-application's files, the common components and public interfaces referenced by the sub-application's files need to be converted. The conversion method of the common component and the common interface will be described in detail below with reference to FIGS. 5A and 5B.
在基于图1所示实施例提供的可选实施例中,请参考图5A,该应用转换方法还包括如下的步骤。In an alternative embodiment based on the embodiment shown in FIG. 1, please refer to FIG. 5A, the application conversion method further includes the following steps.
步骤501,对于子应用程序的文件中引用的用于实现第一功能的公共组件,从Web组件集中选取用于实现第一功能的Web组件。Step 501: Select a Web component for implementing the first function from the Web component set for the common component referenced in the file of the sub-application for implementing the first function.
公共组件是可供不同的子应用程序共用的组件,具有视觉形态,是子应用程序页面的组成单元。公共组件还可以封装有用于处理针对该公共组件所触发事件的逻辑代码。不同的子应用程序共用公共组件,具体可以是同时或者在不同时刻调用相同的公共组件。公共组件包括但不限于按钮(button)组件、进度条(progress)组件、文本(text)组件、表单(form)组件、滑动(slider)组件等等。A common component is a component that can be shared by different sub-applications, has a visual form, and is a component of a sub-application page. The common component can also be packaged with logic code for handling events triggered for the common component. Different sub-applications share common components, which can be called the same common component at the same time or at different times. Common components include, but are not limited to, a button component, a progress component, a text component, a form component, a slider component, and the like.
Web组件集中包括至少一个在Web端支持的组件。Web端并不存在组件,而母应用程序提供大量组件,以供开发者在开发子应用程序时使用。为克服上述问题,在本申请实施例中,采用Vue.js框架编写若干个用于实现不同功能的Web组件,上述Web组件也可称为Vue组件,并将其添加至WePY框架中,采用Vue组件模拟公共组件具备的功能,以使得与子应用程序具有相同功能的Web应用运行时能够引用Vue组件,进而实现公共组件具备的功能。The web component set includes at least one component that is supported on the web side. There are no components on the web side, and the parent application provides a large number of components for developers to use when developing sub-applications. In order to overcome the above problems, in the embodiment of the present application, a plurality of Web components for implementing different functions are written by using the Vue.js framework. The above Web components may also be referred to as Vue components, and are added to the WePY framework, using Vue. The component emulates the functionality of the common component so that the web application runtime with the same functionality as the sub-application can reference the Vue component to implement the functionality of the common component.
步骤502,将引用关系由用于实现第一功能的公共组件,更改为用于实现第一功能的Web组件。 Step 502, changing the reference relationship from a common component for implementing the first function to a Web component for implementing the first function.
若Web应用的文件中的引用关系还引用实现第一功能的公共组件,则Web应用运行时,其无法实现第一功能。因此,需要更改子应用程序的文件中的引用关系,以使得根据子应用程序的文件所生成的Web应用的文件中的引用关系 中所引用的是Web组件集中的组件,而并非母应用程序提供的公共组件库中的公共组件,从而使后续Web应用的文件运行时,能实现公共组件具备的功能。If the reference relationship in the file of the web application also refers to a common component that implements the first function, the web application cannot implement the first function when it runs. Therefore, it is necessary to change the reference relationship in the file of the sub-application so that the reference relationship in the file of the web application generated according to the file of the sub-application refers to the component in the set of the Web component, not the parent application. Common components in the common component library, so that the files of subsequent web applications can be implemented to achieve the functions of common components.
综上所述,本申请实施例提供的方法,通过预先在子应用程序开发框架中添加Web组件,并修改子应用程序的文件中的引用关系,以支持Web应用运行时能实现公共组件具备的功能。在基于图1所示实施例提供的可选实施例中,请参考图5B,该应用转换方法还包括如下的步骤。In summary, the method provided by the embodiment of the present application can implement the common component of the web application by adding a web component in the sub-application development framework and modifying the reference relationship in the file of the sub-application. Features. In an alternative embodiment based on the embodiment shown in FIG. 1, please refer to FIG. 5B, the application conversion method further includes the following steps.
步骤503,对于子应用程序的文件中引用的用于实现第二功能的公共接口,从Web接口集中选取用于实现第二功能的Web接口。Step 503: Select, for the public interface for implementing the second function, in the file of the sub-application, select a web interface for implementing the second function from the web interface set.
公共接口是可供不同的子应用程序共用的接口。公共接口可用于进行网络操作、数据处理、媒体操作、操作终端硬件或者操作子应用程序页面等。页面逻辑代码文件中的页面逻辑代码中可记录事件类型和公共接口的对应关系,或者是事件类型、公共组件标识和公共接口的对应关系,从而可以根据页面逻辑代码文件中的页面逻辑代码记载的对应关系,在公共接口库中选择处理事件所需的公共。结合参考图6,其示出了本申请实施例示出的多种公共接口。The public interface is an interface that can be shared by different sub-applications. The public interface can be used for network operations, data processing, media operations, operating terminal hardware, or operating sub-application pages. The page logic code in the page logic code file may record the correspondence between the event type and the public interface, or the correspondence between the event type, the common component identifier, and the public interface, so that it may be recorded according to the page logic code in the page logic code file. Correspondence, select the public required to process the event in the public interface library. Referring to Figure 6, there is shown a plurality of common interfaces shown by embodiments of the present application.
Web接口集中包括至少一个在Web端支持的接口。Web端并不存在接口,而母应用程序或操作系统提供大量公共接口,以供开发者在开发子应用程序时使用。为克服上述问题,在本申请实施例中,采用Web端支持的框架编写若干个用于实现不同功能的Web接口,并将其添加至WePY框架中,采用Web接口模拟公共接口具备的功能。The web interface set includes at least one interface supported on the web side. There is no interface on the web side, and the parent application or operating system provides a large number of public interfaces for developers to use when developing sub-applications. In order to overcome the above problem, in the embodiment of the present application, a Web interface supported by the Web is used to write a plurality of Web interfaces for implementing different functions, and is added to the WePY framework, and the Web interface is used to simulate the functions of the public interface.
需要说明的是,存在一部分公共接口是在Web端无法支持的,例如支付接口等。在本申请实施例中,只考虑Web端能支持的接口,对于Web端无法支持的接口,需要在开发过程中主动规避。It should be noted that some public interfaces are not supported on the web, such as payment interfaces. In the embodiment of the present application, only the interface supported by the web terminal is considered, and the interface that cannot be supported by the web end needs to be actively circumvented during the development process.
步骤504,将引用关系由用于实现第二功能的公共接口,更改为用于实现第二功能的Web接口。 Step 504, changing the reference relationship from a public interface for implementing the second function to a web interface for implementing the second function.
若Web应用的文件中的引用关系还引用实现第二功能的公共接口,则Web应用运行时,其无法实现第二功能。因此,需要更改子应用程序的文件中的引用关系,以使得根据子应用程序的文件所生成的Web应用的文件中的引用关系中所引用的是Web接口集中的接口,而并非母应用程序提供的公共接口库中的公共组件,从而使后续Web应用的文件运行时,能实现公共接口具备的功能。If the reference relationship in the file of the web application also refers to the public interface that implements the second function, the web application cannot implement the second function when it runs. Therefore, it is necessary to change the reference relationship in the file of the sub-application so that the reference relationship in the file of the web application generated according to the file of the sub-application refers to the interface in the set of the web interface, and is not provided by the parent application. Common components in the public interface library, so that the files of subsequent web applications can be implemented to implement the functions of the public interface.
综上所述,本申请实施例提供的方法,通过预先在子应用程序开发框架中添加Web接口,并修改子应用程序的文件中的引用关系,以支持Web应用运 行时能实现公共接口具备的功能。In summary, the method provided by the embodiment of the present application can implement a public interface by supporting a web application runtime by adding a web interface in a sub-application development framework and modifying a reference relationship in a sub-application file. Features.
下述为本申请装置实施例,可以用于执行本申请方法实施例。对于本申请装置实施例中未披露的细节,请参照本申请方法实施例。The following is an embodiment of the apparatus of the present application, which may be used to implement the method embodiments of the present application. For details not disclosed in the device embodiments of the present application, please refer to the method embodiments of the present application.
请参考图7,其示出了本申请一个实施例提供的应用转换装置的框图。该装置具有实现上述方法示例的功能,所述功能可以由硬件实现,也可以由硬件执行相应的软件实现。该装置可以包括:文件获取模块701、第一生成模块702和第二生成模块703。Please refer to FIG. 7, which shows a block diagram of an application conversion apparatus provided by an embodiment of the present application. The apparatus has a function of implementing the above-described method examples, and the functions may be implemented by hardware or by hardware to execute corresponding software. The apparatus may include a file obtaining module 701, a first generating module 702, and a second generating module 703.
文件获取模块701,用于获取子应用程序的文件。The file obtaining module 701 is configured to acquire a file of the sub-application.
所述子应用程序是依赖母应用程序运行的应用程序;所述子应用程序的文件包括:第一入口文件、全局配置文件、以及每一个页面的逻辑代码文件。The sub-application is an application that depends on the parent application; the files of the sub-application include: a first entry file, a global configuration file, and a logical code file for each page.
第一生成模块702,用于根据所述子应用程序的文件生成支持在Web端运行的可执行文件。The first generation module 702 is configured to support an executable file running on the web end according to the file of the sub-application.
第二生成模块703,用于根据所述可执行文件和支持在Web端运行的第二入口文件生成Web应用的文件,所述第二入口文件中引用所述可执行文件。The second generation module 703 is configured to generate a file of the web application according to the executable file and a second entry file that is supported to run on the web end, where the executable file is referenced in the second entry file.
可选地,所述可执行文件中包括支持在Web端执行的逻辑代码;Optionally, the executable file includes logic code that supports execution on the web side;
第一生成模块702具体用于:The first generating module 702 is specifically configured to:
对于每一个页面,获取所述页面的逻辑代码文件中包含的多个逻辑代码模块,以及各个逻辑代码模块之间的调用关系;For each page, acquiring a plurality of logic code modules included in the logic code file of the page, and calling relationships between the respective logic code modules;
将所述页面的各个逻辑代码模块按序添加至所述可执行文件中,并为所述页面的各个逻辑代码模块添加编号;Adding each logical code module of the page to the executable file in order, and adding a number to each logical code module of the page;
根据所述页面的各个逻辑代码模块之间的调用关系及编号,在所述可执行文件中添加所述页面的入口代码,所述页面的入口代码用于指示所述页面的各个逻辑代码模块之间的调用关系。Adding an entry code of the page to the executable file according to a call relationship and a number between each logical code module of the page, where an entry code of the page is used to indicate each logical code module of the page The calling relationship between.
可选地,所述子应用程序的文件还包括全局样式文件和每一个页面的样式文件,所述可执行文件中还包括支持在Web端识别的第二样式文件代码;Optionally, the file of the sub-application further includes a global style file and a style file of each page, and the executable file further includes a second style file code that supports recognition on the web side;
第一生成模块702具体用于:The first generating module 702 is specifically configured to:
获取所述全局样式文件和各个页面的样式文件中包含的第一样式文件代码;Obtaining the first style file code included in the global style file and the style file of each page;
将所述第一样式文件代码中的尺寸单位由第一单位转换为第二单位,得到所述第二样式文件代码;其中,所述第一单位是指所述母应用程序识别的尺寸 单位,所述第二单位是指在Web端识别的尺寸单位。Converting a size unit in the first style file code from a first unit to a second unit to obtain the second style file code; wherein the first unit is a size unit recognized by the parent application The second unit refers to a unit of size identified on the web side.
可选地,所述子应用程序的文件还包括每一个页面的视图文件,所述可执行文件中还包括支持在Web端识别的第二视图文件代码;Optionally, the file of the sub-application further includes a view file of each page, where the executable file further includes a second view file code that supports recognition on the web end;
第一生成模块702具体用于:The first generating module 702 is specifically configured to:
获取各个页面的视图文件中包含的、且按照所述子应用程序的语法编写的第一视图文件代码;Obtaining a first view file code included in a view file of each page and written according to a syntax of the sub-application;
将所述第一视图文件代码转换成按照Web端支持的语法编写的第二视图文件代码。Transcoding the first view file into a second view file code written in accordance with a syntax supported by the web.
可选地,所述装置还包括:组件选取模块和第一更改模块(图中未示出)。Optionally, the device further includes: a component selection module and a first modification module (not shown).
组件选取模块,用于对于所述子应用程序的文件中引用的用于实现第一功能的公共组件,从Web组件集中选取用于实现所述第一功能的Web组件,所述Web组件集中包括至少一个在Web端支持的组件。a component selection module, configured to select a web component for implementing the first function from a set of web components for a common component referenced in a file of the sub-application for implementing the first function, where the web component set includes At least one component that is supported on the web side.
第一更改模块,用于将引用关系由用于实现所述第一功能的公共组件,更改为用于实现所述第一功能的Web组件。a first change module for changing a reference relationship from a common component for implementing the first function to a web component for implementing the first function.
可选地,所述装置还包括:接口选取模块和第二更改模块(图中未示出)。Optionally, the device further includes: an interface selection module and a second modification module (not shown).
接口选取模块,用于对于所述子应用程序的文件中引用的用于实现第二功能的公共接口,从Web接口集中选取用于实现所述第二功能的Web接口,所述Web接口集中包括至少一个在Web端支持的接口。An interface selection module, configured to select, from a web interface set, a web interface for implementing the second function, for the public interface referenced in the file of the sub-application for implementing the second function, where the web interface includes At least one interface supported on the web side.
第二更改模块,用于将引用关系由用于实现所述第二功能的公共接口,更改为用于实现所述第二功能的Web接口。And a second change module, configured to change the reference relationship from a public interface for implementing the second function to a web interface for implementing the second function.
综上所述,本申请实施例提供的方法,提供了一种将子应用程序的文件转换为Web应用的文件的技术方案,以使得与子应用程序具有相同功能的Web应用无需单独开发,从而节省了Web应用所需的人力和时间成本,提升开发效率,且使得Web应用和子应用程序共用一套基础的源代码,提升代码复用率。In summary, the method provided by the embodiment of the present application provides a technical solution for converting a file of a sub-application into a file of a web application, so that the web application having the same function as the sub-application does not need to be separately developed, thereby It saves the manpower and time cost required for web applications, improves development efficiency, and enables web applications and sub-applications to share a basic set of source code to improve code reuse rate.
需要说明的是,上述实施例提供的装置,在实现其功能时,仅以上述各功能模块的划分进行举例说明,实际应用中,可以根据需要而将上述功能分配由不同的功能模块完成,即将设备的内部结构划分成不同的功能模块,以完成以上描述的全部或者部分功能。另外,上述实施例提供的装置与方法实施例属于同一构思,其具体实现过程详见方法实施例,这里不再赘述。It should be noted that, when the device provided by the foregoing embodiment implements its function, only the division of each functional module described above is illustrated. In actual applications, the function distribution may be completed by different functional modules as needed. The internal structure of the device is divided into different functional modules to perform all or part of the functions described above. In addition, the apparatus and method embodiments provided in the foregoing embodiments are in the same concept, and the specific implementation process is described in detail in the method embodiment, and details are not described herein again.
请参考图8,其示出了本申请一个实施例提供的应用转换设备800(以下简称“设备800”)的结构方框图。所述装置800包括中央处理单元(CPU)801、包括随机存取存储器(RAM)802和只读存储器(ROM)803的系统存储器804,以及连接系统存储器804和中央处理单元801的系统总线805。所述装置800还包括帮助计算机内的各个器件之间传输信息的基本输入/输出系统(I/O系统)806,和用于存储操作系统813、应用程序814和其他程序模块815的大容量存储设备807。Please refer to FIG. 8 , which is a structural block diagram of an application conversion device 800 (hereinafter referred to as “device 800 ”) provided by an embodiment of the present application. The apparatus 800 includes a central processing unit (CPU) 801, a system memory 804 including a random access memory (RAM) 802 and a read only memory (ROM) 803, and a system bus 805 that connects the system memory 804 and the central processing unit 801. The apparatus 800 also includes a basic input/output system (I/O system) 806 that facilitates transfer of information between various devices within the computer, and mass storage for storing the operating system 813, applications 814, and other program modules 815. Device 807.
所述基本输入/输出系统806包括有用于显示信息的显示器808和用于用户输入信息的诸如鼠标、键盘之类的输入设备809。其中所述显示器808和输入设备809都通过连接到系统总线805的输入输出控制器810连接到中央处理单元801。所述基本输入/输出系统806还可以包括输入输出控制器810以用于接收和处理来自键盘、鼠标、或电子触控笔等多个其他设备的输入。类似地,输入输出控制器810还提供输出到显示屏、打印机或其他类型的输出设备。The basic input/output system 806 includes a display 808 for displaying information and an input device 809 such as a mouse or keyboard for user input of information. The display 808 and input device 809 are both connected to the central processing unit 801 via an input and output controller 810 that is coupled to the system bus 805. The basic input/output system 806 can also include an input output controller 810 for receiving and processing input from a plurality of other devices, such as a keyboard, mouse, or electronic stylus. Similarly, input and output controller 810 also provides output to a display screen, printer, or other type of output device.
所述大容量存储设备807通过连接到系统总线805的大容量存储控制器(未示出)连接到中央处理单元801。所述大容量存储设备807及其相关联的计算机可读介质为装置800提供非易失性存储。也就是说,所述大容量存储设备807可以包括诸如硬盘或者CD-ROM驱动器之类的计算机可读介质(未示出)。The mass storage device 807 is connected to the central processing unit 801 by a mass storage controller (not shown) connected to the system bus 805. The mass storage device 807 and its associated computer readable medium provide non-volatile storage for the device 800. That is, the mass storage device 807 can include a computer readable medium (not shown) such as a hard disk or a CD-ROM drive.
不失一般性,所述计算机可读介质可以包括计算机存储介质和通信介质。计算机存储介质包括以用于存储诸如计算机可读指令、数据结构、程序模块或其他数据等信息的任何方法或技术实现的易失性和非易失性、可移动和不可移动介质。计算机存储介质包括RAM、ROM、EPROM、EEPROM、闪存或其他固态存储其技术,CD-ROM、DVD或其他光学存储、磁带盒、磁带、磁盘存储或其他磁性存储设备。当然,本领域技术人员可知所述计算机存储介质不局限于上述几种。上述的系统存储器804和大容量存储设备807可以统称为存储器。Without loss of generality, the computer readable medium can include computer storage media and communication media. Computer storage media includes volatile and nonvolatile, removable and non-removable media implemented in any method or technology for storage of information such as computer readable instructions, data structures, program modules or other data. Computer storage media include RAM, ROM, EPROM, EEPROM, flash memory or other solid state storage technologies, CD-ROM, DVD or other optical storage, tape cartridges, magnetic tape, magnetic disk storage or other magnetic storage devices. Of course, those skilled in the art will appreciate that the computer storage medium is not limited to the above. The system memory 804 and mass storage device 807 described above may be collectively referred to as a memory.
根据本申请的各种实施例,所述装置800还可以通过诸如因特网等网络连接到网络上的远程计算机运行。也即装置800可以通过连接在所述系统总线805上的网络接口单元811连接到网络812,或者说,也可以使用网络接口单元811来连接到其他类型的网络或远程计算机系统(未示出)。In accordance with various embodiments of the present application, the apparatus 800 can also be operated by a remote computer connected to the network via a network such as the Internet. That is, the device 800 can be connected to the network 812 through a network interface unit 811 connected to the system bus 805, or can be connected to other types of networks or remote computer systems (not shown) using the network interface unit 811. .
所述存储器中存储有至少一条指令、至少一段程序、代码集或指令集,所 述至少一条指令、所述至少一段程序、所述代码集或指令集由所述处理器加载并执行以实现上述应用转换方法。Storing at least one instruction, at least one program, code set or instruction set in the memory, the at least one instruction, the at least one program, the code set or the instruction set being loaded and executed by the processor to implement the above Apply the conversion method.
在示例性实施例中,还提供了一种计算机可读存储介质,所述存储介质中存储有至少一条指令、至少一段程序、代码集或指令集,所述至少一条指令、所述至少一段程序、所述代码集或指令集由应用转换设备的处理器加载并执行以实现上述方法实施例中的各个步骤。可选地,上述计算机可读存储介质可以是ROM、随机存取存储器(RAM)、CD-ROM、磁带、软盘和光数据存储设备等。In an exemplary embodiment, there is also provided a computer readable storage medium having stored therein at least one instruction, at least one program, a code set or a set of instructions, the at least one instruction, the at least one program The code set or instruction set is loaded and executed by a processor of the application conversion device to implement the various steps in the above method embodiments. Alternatively, the computer readable storage medium described above may be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, and an optical data storage device.
在示例性实施例中,还提供了一种计算机程序产品,当该计算机程序产品被执行时,其用于实现上述方法实施例中的各个步骤的功能。In an exemplary embodiment, there is also provided a computer program product for performing the functions of the various steps in the above method embodiments when the computer program product is executed.
应当理解的是,在本文中提及的“多个”是指两个或两个以上。“和/或”,描述关联对象的关联关系,表示可以存在三种关系,例如,A和/或B,可以表示:单独存在A,同时存在A和B,单独存在B这三种情况。字符“/”一般表示前后关联对象是一种“或”的关系。本文中使用的“第一”、“第二”以及类似的词语并不表示任何顺序、数量或者重要性,而只是用来区分不同的组成部分。It should be understood that "a plurality" as referred to herein means two or more. "and/or", describing the association relationship of the associated objects, indicating that there may be three relationships, for example, A and/or B, which may indicate that there are three cases where A exists separately, A and B exist at the same time, and B exists separately. The character "/" generally indicates that the contextual object is an "or" relationship. The words "first," "second," and similar terms used herein do not denote any order, quantity, or importance, but are used to distinguish different components.
上述本申请实施例序号仅仅为了描述,不代表实施例的优劣。The serial numbers of the embodiments of the present application are merely for the description, and do not represent the advantages and disadvantages of the embodiments.
以上所述仅为本申请的示例性实施例,并不用以限制本申请,凡在本申请的精神和原则之内,所作的任何修改、等同替换、改进等,均应包含在本申请的保护范围之内。The above description is only exemplary embodiments of the present application, and is not intended to limit the present application. Any modifications, equivalents, improvements, etc. made within the spirit and principles of the present application are included in the protection of the present application. Within the scope.

Claims (20)

  1. 一种应用转换方法,其特征在于,所述方法包括:An application conversion method, characterized in that the method comprises:
    获取子应用程序的文件,所述子应用程序是依赖母应用程序运行的应用程序,所述子应用程序的文件包括:第一入口文件、全局配置文件、以及每一个页面的逻辑代码文件;Obtaining a file of a sub-application, the sub-application is an application running by the parent application, the file of the sub-application includes: a first entry file, a global configuration file, and a logical code file of each page;
    根据所述子应用程序的文件生成支持在网页Web端运行的可执行文件;Generating an executable file running on the web side of the webpage according to the file of the sub-application;
    根据所述可执行文件和支持在Web端运行的第二入口文件,生成Web应用的文件,所述第二入口文件中引用所述可执行文件。Generating a file of the web application according to the executable file and supporting a second entry file running on the web side, wherein the executable file is referenced in the second entry file.
  2. 根据权利要求1所述的方法,其特征在于,所述可执行文件中包括支持在Web端执行的逻辑代码;The method according to claim 1, wherein the executable file includes logic code supporting execution on the web side;
    所述根据所述子应用程序的文件生成支持在网页Web端运行的可执行文件,包括:The generating, according to the file of the sub-application, supports an executable file running on a webpage of the webpage, including:
    对于每一个页面,获取所述页面的逻辑代码文件中包含的多个逻辑代码模块,以及各个逻辑代码模块之间的调用关系;For each page, acquiring a plurality of logic code modules included in the logic code file of the page, and calling relationships between the respective logic code modules;
    将所述页面的各个逻辑代码模块按序添加至所述可执行文件中,并为所述页面的各个逻辑代码模块添加编号;Adding each logical code module of the page to the executable file in order, and adding a number to each logical code module of the page;
    根据所述页面的各个逻辑代码模块之间的调用关系及编号,在所述可执行文件中添加所述页面的入口代码,所述页面的入口代码用于指示所述页面的各个逻辑代码模块之间的调用关系。Adding an entry code of the page to the executable file according to a call relationship and a number between each logical code module of the page, where an entry code of the page is used to indicate each logical code module of the page The calling relationship between.
  3. 根据权利要求1所述的方法,其特征在于,所述子应用程序的文件还包括全局样式文件和每一个页面的样式文件,所述可执行文件中还包括支持在Web端识别的第二样式文件代码;The method according to claim 1, wherein the file of the sub-application further comprises a global style file and a style file for each page, and the executable file further includes a second style that supports recognition on the web side. File code
    所述根据所述子应用程序的文件生成支持在网页Web端运行的可执行文件,包括:The generating, according to the file of the sub-application, supports an executable file running on a webpage of the webpage, including:
    获取所述全局样式文件和各个页面的样式文件中包含的第一样式文件代码;Obtaining the first style file code included in the global style file and the style file of each page;
    将所述第一样式文件代码中的尺寸单位由第一单位转换为第二单位,得到所述第二样式文件代码;其中,所述第一单位是指所述母应用程序识别的尺寸单位,所述第二单位是指在Web端识别的尺寸单位。Converting a size unit in the first style file code from a first unit to a second unit to obtain the second style file code; wherein the first unit is a size unit recognized by the parent application The second unit refers to a unit of size identified on the web side.
  4. 根据权利要求1所述的方法,其特征在于,所述子应用程序的文件还包括每一个页面的视图文件,所述可执行文件中还包括支持在Web端识别的第二视图文件代码;The method according to claim 1, wherein the file of the sub-application further includes a view file of each page, and the executable file further includes a second view file code that supports recognition on the web side;
    所述根据所述子应用程序的文件生成支持在网页Web端运行的可执行文件,包括:The generating, according to the file of the sub-application, supports an executable file running on a webpage of the webpage, including:
    获取各个页面的视图文件中包含的、且按照所述子应用程序的语法编写的第一视图文件代码;Obtaining a first view file code included in a view file of each page and written according to a syntax of the sub-application;
    将所述第一视图文件代码转换成按照Web端支持的语法编写的第二视图文件代码。Transcoding the first view file into a second view file code written in accordance with a syntax supported by the web.
  5. 根据权利要求1至4任一项所述的方法,其特征在于,所述获取子应用程序的文件之后,还包括:The method according to any one of claims 1 to 4, wherein after the obtaining the file of the sub-application, the method further comprises:
    对于所述子应用程序的文件中引用的用于实现第一功能的公共组件,从Web组件集中选取用于实现所述第一功能的Web组件,所述Web组件集中包括至少一个在Web端支持的组件;For a common component referenced in the file of the sub-application for implementing the first function, a web component for implementing the first function is selected from a set of web components, the web component set including at least one supported on the web side s component;
    将引用关系由用于实现所述第一功能的公共组件,更改为用于实现所述第一功能的Web组件。The reference relationship is changed by a common component for implementing the first function to a web component for implementing the first function.
  6. 根据权利要求1至4任一项所述的方法,其特征在于,所述获取子应用程序的文件之后,还包括:The method according to any one of claims 1 to 4, wherein after the obtaining the file of the sub-application, the method further comprises:
    对于所述子应用程序的文件中引用的用于实现第二功能的公共接口,从Web接口集中选取用于实现所述第二功能的Web接口,所述Web接口集中包括至少一个在Web端支持的接口;For the public interface for implementing the second function referenced in the file of the sub-application, the web interface for implementing the second function is selected from the web interface set, and the web interface set includes at least one supported on the web end. Interface;
    将引用关系由用于实现所述第二功能的公共接口,更改为用于实现所述第二功能的Web接口。The reference relationship is changed from a public interface for implementing the second function to a web interface for implementing the second function.
  7. 一种应用转换方法,其特征在于,所述方法包括:An application conversion method, characterized in that the method comprises:
    计算机设备获取子应用程序的文件,所述子应用程序是依赖母应用程序运行的应用程序,所述子应用程序的文件包括:第一入口文件、全局配置文件、以及每一个页面的逻辑代码文件;The computer device acquires a file of the sub-application, the sub-application is an application that depends on the parent application, the file of the sub-application includes: a first entry file, a global configuration file, and a logical code file of each page ;
    所述计算机设备根据所述子应用程序的文件生成支持在网页Web端运行的可执行文件;The computer device generates an executable file that is run on a webpage webpage according to a file of the sub-application;
    所述计算机设备根据所述可执行文件和支持在Web端运行的第二入口文件,生成Web应用的文件,所述第二入口文件中引用所述可执行文件。The computer device generates a file of the web application according to the executable file and a second entry file supported on the web end, and the executable file is referenced in the second entry file.
  8. 根据权利要求7所述的方法,其特征在于,所述可执行文件中包括支持在Web端执行的逻辑代码;The method according to claim 7, wherein the executable file includes logic code supporting execution on the web side;
    所述计算机设备根据所述子应用程序的文件生成支持在网页Web端运行的可执行文件,包括:The computer device generates an executable file that is run on the webpage of the webpage according to the file of the sub-application, and includes:
    对于每一个页面,所述计算机设备获取所述页面的逻辑代码文件中包含的多个逻辑代码模块,以及各个逻辑代码模块之间的调用关系;For each page, the computer device acquires a plurality of logic code modules included in a logic code file of the page, and a call relationship between the respective logic code modules;
    所述计算机设备将所述页面的各个逻辑代码模块按序添加至所述可执行文件中,并为所述页面的各个逻辑代码模块添加编号;The computer device adds each logical code module of the page to the executable file in order, and adds a number to each logical code module of the page;
    所述计算机设备根据所述页面的各个逻辑代码模块之间的调用关系及编号,在所述可执行文件中添加所述页面的入口代码,所述页面的入口代码用于指示所述页面的各个逻辑代码模块之间的调用关系。The computer device adds an entry code of the page to the executable file according to a call relationship and a number between each logical code module of the page, where an entry code of the page is used to indicate each page of the page The calling relationship between logical code modules.
  9. 根据权利要求7所述的方法,其特征在于,所述子应用程序的文件还包括全局样式文件和每一个页面的样式文件,所述可执行文件中还包括支持在Web端识别的第二样式文件代码;The method according to claim 7, wherein the file of the sub-application further comprises a global style file and a style file for each page, and the executable file further includes a second style that supports recognition on the web side. File code
    所述计算机设备根据所述子应用程序的文件生成支持在网页Web端运行的可执行文件,包括:The computer device generates an executable file that is run on the webpage of the webpage according to the file of the sub-application, and includes:
    所述计算机设备获取所述全局样式文件和各个页面的样式文件中包含的第一样式文件代码;The computer device acquires the first style file code included in the global style file and the style file of each page;
    所述计算机设备将所述第一样式文件代码中的尺寸单位由第一单位转换为第二单位,得到所述第二样式文件代码;其中,所述第一单位是指所述母应用程序识别的尺寸单位,所述第二单位是指在Web端识别的尺寸单位。Converting, by the computer device, a unit of size in the first style file code from a first unit to a second unit to obtain the second style file code; wherein the first unit refers to the parent application The identified unit of size, the second unit being the unit of size identified on the web side.
  10. 根据权利要求7所述的方法,其特征在于,所述子应用程序的文件还包括每一个页面的视图文件,所述可执行文件中还包括支持在Web端识别的第二视图文件代码;The method according to claim 7, wherein the file of the sub-application further includes a view file of each page, and the executable file further includes a second view file code that supports recognition on the web side;
    所述计算机设备根据所述子应用程序的文件生成支持在网页Web端运行的可执行文件,包括:The computer device generates an executable file that is run on the webpage of the webpage according to the file of the sub-application, and includes:
    所述计算机设备获取各个页面的视图文件中包含的、且按照所述子应用程序的语法编写的第一视图文件代码;The computer device acquires a first view file code included in a view file of each page and written according to a syntax of the sub-application;
    所述计算机设备将所述第一视图文件代码转换成按照Web端支持的语法编写的第二视图文件代码。The computer device transcodes the first view file into a second view file code written in accordance with a syntax supported by the web.
  11. 根据权利要求7至10任一项所述的方法,其特征在于,所述计算机设备获取子应用程序的文件之后,还包括:The method according to any one of claims 7 to 10, wherein after the computer device acquires the file of the sub-application, the method further comprises:
    对于所述子应用程序的文件中引用的用于实现第一功能的公共组件,所述计算机设备从Web组件集中选取用于实现所述第一功能的Web组件,所述Web组件集中包括至少一个在Web端支持的组件;For a common component referenced in the file of the sub-application for implementing the first function, the computer device selects a web component for implementing the first function from a set of web components, the web component set including at least one Components supported on the web side;
    所述计算机设备将引用关系由用于实现所述第一功能的公共组件,更改为用于实现所述第一功能的Web组件。The computer device changes a reference relationship from a common component for implementing the first function to a web component for implementing the first function.
  12. 根据权利要求7至10任一项所述的方法,其特征在于,所述计算机设备获取子应用程序的文件之后,还包括:The method according to any one of claims 7 to 10, wherein after the computer device acquires the file of the sub-application, the method further comprises:
    对于所述子应用程序的文件中引用的用于实现第二功能的公共接口,所述计算机设备从Web接口集中选取用于实现所述第二功能的Web接口,所述Web接口集中包括至少一个在Web端支持的接口;For a public interface for implementing a second function referenced in a file of the sub-application, the computer device selects a web interface for implementing the second function from a set of web interfaces, the web interface set including at least one Interface supported on the web side;
    所述计算机设备将引用关系由用于实现所述第二功能的公共接口,更改为用于实现所述第二功能的Web接口。The computer device changes the reference relationship from a public interface for implementing the second function to a web interface for implementing the second function.
  13. 一种应用转换装置,其特征在于,所述装置包括:An application conversion device, characterized in that the device comprises:
    文件获取模块,用于获取子应用程序的文件,所述子应用程序是依赖母应用程序运行的应用程序,所述子应用程序的文件包括:第一入口文件、全局配置文件、以及每一个页面的逻辑代码文件;a file obtaining module, configured to acquire a file of a sub-application, where the sub-application is dependent on an application running by the parent application, where the file of the sub-application includes: a first entry file, a global configuration file, and each page Logic code file;
    第一生成模块,用于根据所述子应用程序的文件生成支持在Web端运行的可执行文件;a first generating module, configured to support an executable file running on the web end according to the file of the sub-application;
    第二生成模块,用于根据所述可执行文件和支持在Web端运行的第二入口文件生成Web应用的文件,所述第二入口文件中引用所述可执行文件。And a second generating module, configured to generate a file of the web application according to the executable file and a second import file that supports running on the web end, where the executable file is referenced in the second entry file.
  14. 根据权利要求13所述的装置,其特征在于,所述可执行文件中包括支持在Web端执行的逻辑代码;The apparatus according to claim 13, wherein said executable file includes logic code supporting execution on the web side;
    所述第一生成模块,具体用于:The first generating module is specifically configured to:
    对于每一个页面,获取所述页面的逻辑代码文件中包含的多个逻辑代码模块,以及各个逻辑代码模块之间的调用关系;For each page, acquiring a plurality of logic code modules included in the logic code file of the page, and calling relationships between the respective logic code modules;
    将所述页面的各个逻辑代码模块按序添加至所述可执行文件中,并为所述页面的各个逻辑代码模块添加编号;Adding each logical code module of the page to the executable file in order, and adding a number to each logical code module of the page;
    根据所述页面的各个逻辑代码模块之间的调用关系及编号,在所述可执行文件中添加所述页面的入口代码,所述页面的入口代码用于指示所述页面的各个逻辑代码模块之间的调用关系。Adding an entry code of the page to the executable file according to a call relationship and a number between each logical code module of the page, where an entry code of the page is used to indicate each logical code module of the page The calling relationship between.
  15. 根据权利要求13所述的装置,其特征在于,所述子应用程序的文件还包括全局样式文件和每一个页面的样式文件,所述可执行文件中还包括支持在Web端识别的第二样式文件代码;The device according to claim 13, wherein the file of the sub-application further comprises a global style file and a style file for each page, and the executable file further includes a second style that supports recognition on the web side. File code
    所述第一生成模块,具体用于:The first generating module is specifically configured to:
    获取所述全局样式文件和各个页面的样式文件中包含的第一样式文件代码;Obtaining the first style file code included in the global style file and the style file of each page;
    将所述第一样式文件代码中的尺寸单位由第一单位转换为第二单位,得到所述第二样式文件代码;其中,所述第一单位是指在所述母应用程序识别的尺寸单位,所述第二单位是指在Web端识别的尺寸单位。Converting a unit of size in the first style file code from a first unit to a second unit to obtain the second style file code; wherein the first unit refers to a size recognized by the parent application Unit, the second unit refers to the unit of size identified on the web side.
  16. 根据权利要求13所述的装置,其特征在于,所述子应用程序的文件还包括每一个页面的视图文件,所述可执行文件中还包括支持在Web端识别的第二视图文件代码;The device according to claim 13, wherein the file of the sub-application further includes a view file of each page, and the executable file further includes a second view file code that supports recognition on the web side;
    所述第一生成模块,具体用于:The first generating module is specifically configured to:
    获取各个页面的视图文件中包含的、且按照所述子应用程序的语法编写的第一视图文件代码;Obtaining a first view file code included in a view file of each page and written according to a syntax of the sub-application;
    将所述第一视图文件代码转换成按照Web端支持的语法编写的第二视图文件代码。Transcoding the first view file into a second view file code written in accordance with a syntax supported by the web.
  17. 根据权利要求13至16任一项所述的装置,其特征在于,所述装置还包括:The device according to any one of claims 13 to 16, wherein the device further comprises:
    组件选取模块,用于对于所述子应用程序的文件中引用的用于实现第一功能的公共组件,从Web组件集中选取用于实现所述第一功能的Web组件,所述Web组件集中包括至少一个在Web端支持的组件;a component selection module, configured to select a web component for implementing the first function from a set of web components for a common component referenced in a file of the sub-application for implementing the first function, where the web component set includes At least one component supported on the web;
    第一更改模块,用于将引用关系由用于实现所述第一功能的公共组件,更改为用于实现所述第一功能的Web组件。a first change module for changing a reference relationship from a common component for implementing the first function to a web component for implementing the first function.
  18. 根据权利要求13至16任一项所述的装置,其特征在于,所述装置还包括:The device according to any one of claims 13 to 16, wherein the device further comprises:
    接口选取模块,用于对于所述子应用程序的文件中引用的用于实现第二功能的公共接口,从Web接口集中选取用于实现所述第二功能的Web接口,所述Web接口集中包括至少一个在Web端支持的接口;An interface selection module, configured to select, from a web interface set, a web interface for implementing the second function, for the public interface referenced in the file of the sub-application for implementing the second function, where the web interface includes At least one interface supported on the web side;
    第二更改模块,用于将引用关系由用于实现所述第二功能的公共接口,更改为用于实现所述第二功能的Web接口。And a second change module, configured to change the reference relationship from a public interface for implementing the second function to a web interface for implementing the second function.
  19. 一种计算机设备,其特征在于,所述计算机设备包括处理器和存储器,所述存储器中存储有至少一条指令、至少一段程序、代码集或指令集,所述至少一条指令、所述至少一段程序、所述代码集或指令集由所述处理器加载并执行以实现如权利要求1至6任一项所述的应用转换方法。A computer device, comprising: a processor and a memory, wherein the memory stores at least one instruction, at least one program, a code set or a set of instructions, the at least one instruction, the at least one program The code set or instruction set is loaded and executed by the processor to implement the application conversion method according to any one of claims 1 to 6.
  20. 一种计算机可读存储介质,其特征在于,所述计算机可读存储介质中存储有至少一条指令、至少一段程序、代码集或指令集,所述至少一条指令、所述至少一段程序、所述代码集或指令集由处理器加载并执行以实现如权利要求1至6任一项所述的应用转换方法。A computer readable storage medium, wherein the computer readable storage medium stores at least one instruction, at least one program, a code set or a set of instructions, the at least one instruction, the at least one program, the The code set or instruction set is loaded and executed by the processor to implement the application conversion method according to any one of claims 1 to 6.
PCT/CN2018/089363 2017-06-13 2018-05-31 Application conversion method, apparatus and device WO2018228211A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201710443627.8A CN107239318B (en) 2017-06-13 2017-06-13 Using conversion method, device and equipment
CN201710443627.8 2017-06-13

Publications (1)

Publication Number Publication Date
WO2018228211A1 true WO2018228211A1 (en) 2018-12-20

Family

ID=59986267

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2018/089363 WO2018228211A1 (en) 2017-06-13 2018-05-31 Application conversion method, apparatus and device

Country Status (2)

Country Link
CN (1) CN107239318B (en)
WO (1) WO2018228211A1 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP3955107A4 (en) * 2019-04-09 2022-06-15 Tencent Technology (Shenzhen) Company Limited Sub-application development method, apparatus, computer device, and storage medium

Families Citing this family (25)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107239318B (en) * 2017-06-13 2018-09-04 腾讯科技(深圳)有限公司 Using conversion method, device and equipment
CN107911482B (en) * 2017-12-11 2021-07-23 北京小米移动软件有限公司 Target application opening method and device
CN108268262A (en) * 2017-12-27 2018-07-10 广东耐思尼克信息技术有限公司 Realize the method, apparatus and system that HTML is converted to wechat small routine
CN110347562B (en) * 2018-04-08 2022-02-25 腾讯科技(深圳)有限公司 Data acquisition method and device, computer readable medium and intelligent terminal equipment
CN110362317B (en) * 2018-04-09 2021-07-06 腾讯科技(深圳)有限公司 Code conversion method, device and storage medium
CN108664248A (en) * 2018-05-14 2018-10-16 北京汉能光伏投资有限公司 A kind of generation method and device of wechat small routine
CN109542460A (en) * 2018-10-15 2019-03-29 深圳点猫科技有限公司 A kind of method and electronic equipment based on access typescript in the vue for educating operating system
CN109597950A (en) * 2018-10-25 2019-04-09 北京辰森世纪科技股份有限公司 Web Page Processing, web page data providing method and the device of application program
CN110032358B (en) * 2019-01-03 2022-08-09 创新先进技术有限公司 Application program generation method, device, equipment and system
CN111427569B (en) * 2019-01-10 2024-01-23 北京嘀嘀无限科技发展有限公司 Method and device for adapting installation-free program, electronic equipment and storage medium
CN109918073A (en) * 2019-01-29 2019-06-21 维沃移动通信有限公司 A kind of generation method of sound code file, device and terminal
CN109800020B (en) * 2019-02-02 2023-02-10 北京字节跳动网络技术有限公司 Automatic code adjusting method, device, equipment and medium for program development
CN111625830B (en) * 2019-02-27 2023-04-14 阿里巴巴集团控股有限公司 Data processing method, data display method, system and equipment
CN109918166B (en) * 2019-03-12 2022-04-01 天津字节跳动科技有限公司 Applet processing method and device and electronic equipment
CN110362792B (en) * 2019-07-05 2023-05-23 五八有限公司 Method and device for converting RN file into applet file and conversion equipment
CN110704053B (en) * 2019-09-03 2023-05-23 五八有限公司 Style information processing method and device
CN112579048B (en) * 2019-09-30 2023-09-08 腾讯科技(深圳)有限公司 Applet integration method, device, electronic equipment and storage medium
CN110888645A (en) * 2019-10-12 2020-03-17 贝壳技术有限公司 Method, device and storage medium for converting into small program
CN113220374A (en) * 2020-01-21 2021-08-06 腾讯科技(深圳)有限公司 Software processing method and device
CN111381825B (en) * 2020-03-06 2021-04-09 北京五八信息技术有限公司 Method and device for generating small program
CN112860255A (en) * 2021-02-08 2021-05-28 无线生活(杭州)信息科技有限公司 Page adaptation method and device
CN113010207A (en) * 2021-03-18 2021-06-22 挂号网(杭州)科技有限公司 Resource allocation method and device, electronic equipment and storage medium
CN113296841A (en) * 2021-04-13 2021-08-24 京东数字科技控股股份有限公司 Application program processing method, device, equipment and medium
CN113127361B (en) * 2021-04-23 2024-02-23 中国工商银行股份有限公司 Application development method and device, electronic equipment and storage medium
CN114185551B (en) * 2022-02-17 2022-06-21 浙江口碑网络技术有限公司 Applet compiling method, applet running method and device and storage medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101996093A (en) * 2009-08-10 2011-03-30 日电(中国)有限公司 Method and system for converting desktop application to network application
CN102591647A (en) * 2010-12-27 2012-07-18 微软公司 Converting desktop applications to web applications
US20150058831A1 (en) * 2013-08-22 2015-02-26 Peter Warren Web application development platform with relationship modeling
CN107239318A (en) * 2017-06-13 2017-10-10 腾讯科技(深圳)有限公司 Using conversion method, device and equipment

Family Cites Families (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
TW501043B (en) * 2000-10-19 2002-09-01 Shinewave Int Inc Method to implant Java program to embedded system
WO2005114401A1 (en) * 2004-05-21 2005-12-01 Computer Associates Think, Inc. Automated creation of web gui for xml servers
US20140143761A1 (en) * 2012-04-18 2014-05-22 Natalio Fridman Method and system for database conversion
US8883646B2 (en) * 2012-08-06 2014-11-11 Taiwan Semiconductor Manufacturing Co., Ltd. Self-assembled monolayer for pattern formation
CN103051864B (en) * 2012-12-26 2016-08-17 浙江元亨通信技术股份有限公司 Mobile video session method
CN106502736B (en) * 2016-10-18 2018-04-06 腾讯科技(深圳)有限公司 Applied program processing method and device
CN106569900B (en) * 2016-10-28 2019-08-23 腾讯科技(深圳)有限公司 Applied program processing method and device

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101996093A (en) * 2009-08-10 2011-03-30 日电(中国)有限公司 Method and system for converting desktop application to network application
CN102591647A (en) * 2010-12-27 2012-07-18 微软公司 Converting desktop applications to web applications
US20150058831A1 (en) * 2013-08-22 2015-02-26 Peter Warren Web application development platform with relationship modeling
CN107239318A (en) * 2017-06-13 2017-10-10 腾讯科技(深圳)有限公司 Using conversion method, device and equipment

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP3955107A4 (en) * 2019-04-09 2022-06-15 Tencent Technology (Shenzhen) Company Limited Sub-application development method, apparatus, computer device, and storage medium

Also Published As

Publication number Publication date
CN107239318B (en) 2018-09-04
CN107239318A (en) 2017-10-10

Similar Documents

Publication Publication Date Title
WO2018228211A1 (en) Application conversion method, apparatus and device
US11422778B2 (en) Development environment for real-time dataflow programming language
US10705942B1 (en) Simulated testing of API
US11561846B2 (en) API notebook tool
EP3605324B1 (en) Application development method and tool, and storage medium thereof
US11797273B2 (en) System and method for enhancing component based development models with auto-wiring
Meier et al. Professional Android
US10419568B2 (en) Manipulation of browser DOM on server
Hansson et al. Effects on performance and usability for cross-platform application development using React Native
US9645814B1 (en) Generating and publishing applications for multiple platforms
CN101965561A (en) Declarative support for asynchronous methods
US20110072371A1 (en) Application programming interface for user interface creation
EP2951678B1 (en) Remotely executing operations of an application using a schema that provides for executable scripts in a nodal hierarchy
US11604662B2 (en) System and method for accelerating modernization of user interfaces in a computing environment
WO2021129812A1 (en) Method and system for running artificial intelligence application, and device
KR101907660B1 (en) Terminal apparatus having operating system based on web and method for providing service using thereof
Khanna et al. Ionic: Hybrid Mobile App Development
CN111880775A (en) Multi-module layered architecture implementation method and device, electronic equipment and storage medium
CN112882698A (en) Development environment generation method and device, computer storage medium and electronic device
Dokuka et al. Hands-on reactive programming in Spring 5: build cloud-ready, reactive systems with Spring 5 and Project Reactor
Khanna Getting Started with Ionic
Egwim A cloud-based C/C++ compiler for smart devices
US20220413813A1 (en) Method and system for automating development of white labeled measurement application
Martini Using Django and JavaScript to implement Model-Based Performance Testing as a Service with the MBPeT tool
Levar Web-based platform for dataflow processing

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 18818020

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 18818020

Country of ref document: EP

Kind code of ref document: A1