Data interaction device and method

By introducing the first engine, jump component and page container into the data interaction device, the problem of data synchronization between different page types is solved, and the timely transmission and update of user input data and response data is realized.

CN113535417BActive Publication Date: 2025-02-07TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202010289882.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-04-14
Publication Date
2025-02-07
Estimated Expiration
2040-04-14

AI Technical Summary

Technical Problem

The prior art is difficult to realize data synchronization between multiple pages, especially data interaction between different page types.

Method used

By introducing a first engine, a jump component and a page container in the data interaction device, using the jump component as a communication medium between different engines, the data input by the user and the response data are stored in the storage space and passed through the first engine Get data from storage space to update the first page.

Benefits of technology

It realizes data synchronization between different page types, ensuring that the data input by users and response data can be transmitted and updated in a timely manner, and solves the problem of data inconsistency between multiple pages.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113535417B_ABST
    Figure CN113535417B_ABST
Patent Text Reader

Abstract

The present application provides a data interaction device and method, the first engine obtains the first jump information, the first jump information includes the first parameter and the page address of the second page to be jumped, the first engine can interact with the page container, so the first engine sends the first jump information to the page container, and the page container can display the second page based on the address of the second page. The embodiment of the present application establishes a communication medium between the second engine (corresponding to the second page) and the page container by creating a jump component, so that the jump component can obtain the first data based on the second page and transmit the first data to the page container. The embodiment of the present application uses the storage space as a storage space that can be accessed by both the page container and the first engine, that is, after the page container stores the first parameter and the first data correspondingly in the storage space, the first engine can obtain the first data from the storage space based on the first parameter, thereby achieving the purpose of data synchronization between the second page and the first page.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of Internet technology, and more specifically, to a data interaction device and method. Background Art

[0002] An application includes multiple pages, and data synchronization may be required between the multiple pages. For example, an application may include a news page and a comment page. Users can browse news and comments on the news on the news page, and users can enter comments on the news on the comment page. After the user enters comments on the comment page, the comments on the news page also need to be increased, and the number of comments should also be increased by 1.

[0003] Therefore, how to synchronize data between multiple pages included in an application is a difficult problem that those skilled in the art need to overcome. Summary of the invention

[0004] In view of this, the present application provides a data interaction device and method.

[0005] To achieve the above objectives, this application provides the following technical solutions:

[0006] A data interaction device, comprising:

[0007] The first engine is used to obtain first jump information from the first page to the second page and a second page type to which the second page belongs; if the page type to which the second page belongs is the second page type, send the first jump information to a page container containing the second page;

[0008] The first engine corresponds to the first page; the first page belongs to a first page type, which is different from the second page type; the first jump information includes the address of the second page and a first parameter; the first parameter is used to represent the number of the first data returned by the second page to the first page;

[0009] The page container is used to display the second page based on the address of the second page;

[0010] A jump component, used to transfer the first data obtained based on the second page to the page container; the first data includes one or more of user input data for the second page and response data of the user input operation for the second page;

[0011] The page container is further used to store the first data and the first parameter in a storage space correspondingly;

[0012] The first engine is further configured to obtain the first data corresponding to the first parameter from the storage space, and update the content included in the first page based on the first data.

[0013] A data interaction method, comprising:

[0014] Acquire first jump information from a first page to a second page and a second page type to which the second page belongs;

[0015] The first jump information includes the address of the second page and a first parameter; the first parameter is used to represent the number of the first data returned by the second page to the first page; the first page belongs to a first page type, and the first page type is different from the second page type to which the second page belongs;

[0016] If the second page is of the second page type, sending the first jump information to a page container corresponding to the second page;

[0017] Controlling the page container to display the second page based on the address of the second page;

[0018] The control jump component obtains the first data, where the first data includes one or more of user input data for the second page and response data of the user input operation for the second page;

[0019] Control the page container to store the first data obtained from the jump component and the first parameter in a storage space in correspondence with each other;

[0020] Control a first engine corresponding to the first page to obtain the first data corresponding to the first parameter from the storage space.

[0021] It can be known from the above technical solution that in the data interaction device provided by the present application, the first engine obtains the first jump information, the first jump information includes the first parameter and the address of the second page to be jumped, and the first engine can perform data interaction with the page container, so the first engine can send the first jump information to the page container, and the page container can display the second page based on the address of the second page. The embodiment of the present application establishes a communication medium between the second engine (corresponding to the second page) and the page container by creating a jump component, so that the jump component can obtain the first data based on the second page and transmit the first data to the page container. The embodiment of the present application uses the storage space as a storage space that can be accessed by both the page container and the first engine, that is, after the page container stores the first parameter and the first data correspondingly in the storage space, the first engine can obtain the first data from the storage space based on the first parameter, thereby achieving the purpose of transmitting data from the second page to the first page, that is, achieving the purpose of data synchronization between the second page and the first page. BRIEF DESCRIPTION OF THE DRAWINGS

[0022] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying any creative work.

[0023] Figure 1 A schematic diagram of a structure of an implementation method of a data interaction device provided in an embodiment of the present application;

[0024] Figure 2 A signaling diagram of an implementation method of the data interaction method provided in an embodiment of the present application;

[0025] Figure 3a to Figure 3d A schematic diagram of a display method of a page provided in an embodiment of the present application;

[0026] Figure 4 A data interaction signaling diagram between two pages belonging to the first page type provided in an embodiment of the present application;

[0027] Figure 5 A data interaction diagram of a data interaction device provided in an embodiment of the present application;

[0028] Figure 6 A signaling diagram of another implementation of the data interaction method provided in an embodiment of the present application;

[0029] Figure 7 A schematic diagram of a data interaction method between multiple pages belonging to the second page type provided in an embodiment of the present application;

[0030] Figure 8 A flowchart of another implementation of the data interaction method provided in an embodiment of the present application;

[0031] Fig. 9 A structural diagram of an implementation method of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0032] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0033] The application includes multiple pages, and the page types to which different pages belong may be different. The page types mentioned in the embodiments of the present application include but are not limited to the following: native page types, web page types (for example, weex page types, or HTML5 page types are all web page types), etc. Pages belonging to different page types correspond to different engines, and data cannot be exchanged between different engines, so that pages belonging to different page types cannot exchange data. In order to enable pages belonging to different page types to exchange data, the embodiments of the present application construct a jump component, which is a communication medium between different engines, that is, a communication medium between pages belonging to different page types.

[0034] The data interaction device provided in the embodiment of the present application is described below.

[0035] See also Figure 1 , which is a structural diagram of an implementation of a data interaction device provided in an embodiment of the present application. The data interaction device includes: a first engine 11, a jump component 12, a page container 13, a second engine 14 and a storage space 15.

[0036] The first engine corresponds to the first page 16. The second engine corresponds to the second page 17.

[0037] The first engine mentioned in the embodiment of the present application includes but is not limited to one or more of a rendering engine, an execution engine, and a loading engine. The second engine mentioned in the embodiment of the present application includes but is not limited to one or more of a rendering engine, an execution engine, and a loading engine.

[0038] Optionally, if the first page type is a native page type, the first engine may be a JAVA virtual machine; optionally, if the second page type is a weex page type, then the second engine may be a JScore engine.

[0039] If the first engine 11 obtains the first jump information for jumping from the first page 16 to the second page 17, the first jump information may be sent to the page container 13 to which the second page belongs. The first jump information includes the address of the second page and the first parameter.

[0040] The page container 13 may display the second page 17 based on the address of the second page.

[0041] The jump component 12 may transmit the first data obtained based on the second page to the page container 13 .

[0042] The first data includes one or more of user input data for the second page and response data of a user input operation for the second page.

[0043] In an optional embodiment, the page container can transmit data to the page carried in the page container, but the page carried in the page container cannot transmit data to the page container. In this regard, an embodiment of the present application creates a jump component so that the page carried in the page container can transmit data to the page container.

[0044] The page container 13 stores the first data and the first parameter in the storage space 15 correspondingly.

[0045] The first engine 11 obtains the first data corresponding to the first parameter from the storage space 15 .

[0046] Optionally, the storage space 15 may be a physical space, or a virtual space. Optionally, the storage space may be a memory space of an application, or a private directory of an application, or an SD memory card, etc.

[0047] The storage space is accessible to both the page container and the first engine, that is, the storage space is a shared storage space of the page container and the first engine. Optionally, the corresponding first parameter and first data stored in the storage space are global variables of the page container and the first engine.

[0048] In summary, the embodiment of the present application establishes a communication medium between the second engine and the page container by creating a jump component, uses the storage space as a storage space accessible to both the page container and the first engine, and uses the first parameter as the number corresponding to the first data negotiated by the page container and the first engine. After the page space stores the first data and the first parameter in the storage space accordingly, the first engine can obtain the first number from the storage space based on the first parameter, thereby achieving the purpose of transmitting data from the second page to the first page, that is, achieving the purpose of data synchronization between the second page and the first page.

[0049] Combine the following Figure 1 The data interaction method provided in the embodiment of the present application is described.

[0050] like Figure 2 As shown, it is a signaling diagram of an implementation method of the data interaction method provided in an embodiment of the present application, and the method includes:

[0051] Step S201: the first engine 11 obtains first jump information from a first page to a second page and a second page type to which the second page belongs.

[0052] The first page belongs to a first page type, which is different from the second page type; the first jump information includes the address of the second page and a first parameter; the first parameter is used to represent the number of the first data that the second page needs to return to the first page.

[0053] In the embodiment of the present application, the data returned from the second page to the first page is referred to as first data.

[0054] Optionally, the first page type is a native page type, and the first page is a native page; the second page type is a web page type (HTML5 page type or weex page type), and the second page is a web page (HTML5 page or weex page).

[0055] There are many ways for the first engine 11 to obtain the first jump information and the second page type to which the second page belongs. The embodiments of the present application provide but are not limited to the following ways.

[0056] The first implementation method includes:

[0057] Step 1: Obtain the address of the second page to be jumped to and associated with the clicked first object, and the second page type to which the second page belongs; the first object is located on the first page.

[0058] In an optional embodiment, the page (the page refers to any one of the first page and the second page) includes one or more objects of pictures, videos, audios, texts, graphics and buttons. Optionally, each object is associated with the address of the page to be jumped and the page type to which the page to be jumped belongs.

[0059] In order for those skilled in the art to better understand the embodiments of the present application, Figure 3a to Figure 3d The interface shown is described below.

[0060] It can be understood that the data interaction device provided in the embodiment of the present application can be applied to electronic devices, and the electronic device can be any device among smart phones, PADs, laptops, desktops and servers.

[0061] The following description will be made by taking a smart phone as an example. Figure 3a to Figure 3c The content of the displayed page and the display format of the content are limited.

[0062] like Figure 3a to Figure 3d The figure shows a schematic diagram of a display method of a page provided in an embodiment of the present application.

[0063] Figure 3a to Figure 3b The first page shown contains the content of news 1 and multiple comments on the content of news 1; Figure 3b Display for electronic devices Figure 3a When the user slides up the screen of the electronic device, the electronic device displays the subsequent content of the first page, for example, the user can see the following Figure 3b All comments shown.

[0064] If the user clicks Figure 3a or Figure 3b The first page shown contains an object 21 (here referred to as the first object). Since the first object is associated with the address of the second page and the second page type to which the second page belongs, the first engine 11 can obtain the address of the second page and the second page type to which the second page belongs.

[0065] Step 2: If the event associated with the first object indicates that the second page needs to transmit data to the first page, create a first parameter.

[0066] Optionally, you can bind events to objects contained in the page. Figure 3a to Figure 3d Take this as an example to illustrate.

[0067] Optionally, the event associated with the first object is an event in which the second page needs to transmit data to the first page, and the first engine may create a first parameter.

[0068] Optionally, the first parameter can be any character or string. Different objects have different first parameters.

[0069] If the event bound to the first object is an event that does not require data transmission, the first engine may not create the first parameter. In this case, the first page is simply jumped to the second page.

[0070] The second implementation method includes: obtaining the address of the second page to be jumped to and associated with the clicked first object, the second page type to which the second page belongs, and the first parameter; the first object is located on the first page.

[0071] Optionally, if the second page needs to transfer data to the first page, the first parameter associated with the first object may be set; if the second page does not need to transfer data to the first page, the first object is not associated with the corresponding first parameter.

[0072] In summary, after detecting that the first object is clicked, the first engine may create a first parameter based on the event bound to the first object; or, pre-set an association relationship between the object and the first parameter.

[0073] Step S202: if the page type to which the second page belongs is the second page type, the first engine 11 sends the first jump information to the page container 13 including the second page.

[0074] Optionally, the page type includes but is not limited to: native page type, web page type; wherein, the development of native pages corresponding to the native page types is targeted at the operating systems of different electronic devices, such as the IOS operating system or Android operating system or Windows operating system of mobile phones, and different languages ​​and frameworks can be used for development.

[0075] Step S203: the page container 13 displays the second page based on the address of the second page.

[0076] A page container refers to a container that can carry a page (eg, a web page). Optionally, the page container can be a web View component or other browser kernel components.

[0077] In an optional embodiment, the page container can be implemented by a native system programming language (eg, Native). If the first page type of the first page is a native page, the first page is also implemented by a native system programming language, and therefore, the first page can communicate with the page container.

[0078] Optionally, the page container and the first page are developed using the same programming language, and therefore the page container is a special page of the first page type.

[0079] Optionally, a page container with empty content may be created, and then one or more second pages may be added to the page container.

[0080] Optionally, the page container 13 may load and render the second page based on the address of the second page. Optionally, the address of the second page may include a file address corresponding to the second page.

[0081] In an optional embodiment, the second page type is a weex page type, and the page container is a weex page container.

[0082] Weex is a framework for developing high-performance native applications using the web development experience. Use the same set of code to build Android, iOS, and web applications. Specifically, after integrating the Weex SDK (Software Development Kit), you can use JavaScript and modern popular front-end frameworks to develop applications.

[0083] The main function of the Weex page container is to render the js (JavaScript) code of the weex page and return the corresponding view, while managing the life cycle, etc. Optionally, the second engine provided in the embodiment of the present application includes the function of the js code.

[0084] Optionally, the Weex page container can render the second page based on the js code of the second page.

[0085] In an optional embodiment, after the page container displays the second page, it will block the first page so that the user cannot see the first page. Figure 3c As shown, the second page obscures the first page.

[0086] Step S204 : the jump component 12 transmits the first data obtained based on the second page to the page container 13 .

[0087] The first data includes one or more of user input data for the second page and response data of a user input operation for the second page.

[0088] Optionally, the jump component 12 obtains the first data from the second engine 14 corresponding to the second page.

[0089] Combine the following Figure 3a to Figure 3d The first data will be described.

[0090] like Figure 3c As mentioned above, users can Figure 3c Enter the comment content in the editing window 22 shown in the figure, and click Send. The user input data for the second page can be as follows: Figure 3c The comment content input by the user; the response data for the user input operation on the second page can be the number after the total number of all comments is changed after the user enters the comment content.

[0091] In different application scenarios, the user input data for the second page may be different; the response data for the user input operation on the second page may be different, which will not be described in detail here.

[0092] Step S205: the page container 13 stores the first data and the first parameter in the storage space 15 accordingly.

[0093] Optionally, the page container 13 stores the first data and the first parameter as a set of key-value pairs in the storage space 15. The key refers to the first parameter, that is, the number of the stored data; the value refers to the first data to be stored.

[0094] Optionally, if the first page is a native page, the second page is a weex page, and the page container is implemented in a native system programming language (ie, Native), then the storage space may be a storage space accessible to the engine corresponding to the native page.

[0095] If the first page is a native page and the second page is a weex page, optionally, the page container can store the first parameter and the first data correspondingly into the storage space through the PutweexCache (first parameter, first data) function.

[0096] Step S206: the first engine 11 obtains the first data corresponding to the first parameter from the storage space.

[0097] If the first page is a native page and the second page is a weex page, optionally, the first engine can obtain the first data from the storage space through a Getweexcache (first parameter) function.

[0098] Optionally, the method further includes: Step S206: the first engine 11 updates the content of the first page based on the first data.

[0099] Still Figure 3a to Figure 3d For example, after the first engine 11 obtains the first data and updates the content contained in the first page, the total number of all comments corresponding to the first page will change, such as Figure 3d As shown, the number of comments increases from 2 to 3, and the user can see 3 comments on the first page.

[0100] In summary, the embodiment of the present application establishes a communication medium between the second engine and the page container by creating a jump component, uses the storage space as a storage space accessible to both the page container and the first engine, and uses the first parameter as the number corresponding to the first data negotiated by the page container and the first engine. After the page space stores the first data and the first parameter in the storage space accordingly, the first engine can obtain the first number from the storage space based on the first parameter, thereby achieving the purpose of transmitting data from the second page to the first page, that is, achieving the purpose of data synchronization between the second page and the first page.

[0101] The embodiment of the present application also provides a data interaction method between multiple first pages belonging to the first page type. Figure 4 As shown, a data interaction signaling diagram between two first pages of the first page type (here, first page A and first page B represent two different first pages) provided in an embodiment of the present application is provided. The data interaction process between two first pages of the first page type includes:

[0102] Step S400: the engine of the first page A obtains third jump information from the first page A to the first page B and the first page type to which the first page B belongs.

[0103] The third jump information includes the address of the first page B. Optionally, the third jump information may carry a third parameter, where the third parameter is used to represent the serial number corresponding to the third data sent by the first page B to the first page A.

[0104] In the embodiment of the present application, data returned from one first page to another first page is referred to as third data.

[0105] Step S401: If the first page B belongs to the first page type, the engine of the first page A sends the first jump information to the engine of the first page B.

[0106] Assume that both the first page A and the first page B are native pages. Since the first page B needs to transfer data to the first page A, the engine of the first page B can be jumped to by calling the startActivityForResult function. The startActivityForResult function can carry the address of the first page B.

[0107] Optionally, startActivityForResult can carry a request code requestCode, and the type of the request code can be an integer int.

[0108] Step S402: the engine of the first page B obtains the third data.

[0109] The third data may include one or more of user input data for the first page B and response data of the user input operation for the first page B.

[0110] Step S403: Feedback the third data to the engine of the first page A.

[0111] Still taking the first page type as a native page type as an example, the engine of the first page B can feed back the first data to the first page A through the setResult function. Optionally, setResult carries a processing result code resultCode (optionally, the type of the processing result code can be an integer type int).

[0112] It can be understood that the request code is the same as the processing result code, indicating that the first data is for the first jump information.

[0113] Optionally, the engine of the first page B may store the third data and the third parameter in the storage space in correspondence, so that the engine of the first page A obtains the third data corresponding to the third parameter from the storage space.

[0114] Step S404: the engine of the first page A obtains the third data to update the content of the first page A.

[0115] Still taking the first page type as the native page type as an example, the third data and the processing result code can be obtained from the setResult function through the onActivityResult function, and the request code can be obtained from the startActivityForResult function, that is, onActivityResult(resultCode: int, requestCode: int, third data).

[0116] In an optional embodiment, the jump module transmits the first data to the page container in the following ways, including but not limited to.

[0117] The first implementation method includes:

[0118] Step 1: If a page closing event for the second page is detected, first data is obtained from a second engine; the second engine corresponds to the second page.

[0119] Step 2: Transmit the first data and the page closing event to the page container.

[0120] Correspondingly, the page container stores the first data and the first parameter in the storage space accordingly and then closes itself.

[0121] If the first page is a native page and the second page is a weex page, the jump component 12 can optionally call the close event pop(parameter), and the close event pop can obtain the first data from the js (JavaScript) code of the second page and pass the second data into the parameter. Optionally, the jump component 12 can initiate a broadcast, which carries the page close event and the first data. Optionally, the broadcast can be initiated through the Sendbroadcast(first data, page close event) function.

[0122] Optionally, a monitor is registered with the page container, and the page closing event is monitored through the monitor.

[0123] A monitor is a broadcast receiver that can register to monitor a certain type of event.

[0124] In an alternative embodiment, if Figures 3a to 3c As shown, after the page container displays the second page, it will block the first page. The user can only see the first page after the second page and the page container are closed. It is understandable that before the second page is closed, the user may also input data or input operations for the second page. Therefore, after the second page is closed, the user's operation on the second page is completed, and the first data obtained is more complete. Optionally, after the second page is closed, the page container stores the first data and the first parameter in the storage space accordingly.

[0125] In an optional embodiment, data is obtained from the second engine in real time, and the obtained data is transmitted to the page container in real time, and all data obtained by the page container from the second engine is called first data. Optionally, the page container can store the data obtained from the second engine to the storage space in real time.

[0126] In an optional embodiment, the first parameter may be obtained in a variety of ways, and the embodiments of the present application provide but are not limited to the following:

[0127] The first method: Set any character or string as the first parameter.

[0128] Still Figure 3a to Figure 3d For example, suppose that the electronic device displays Figure 3a On the first page shown, after the user clicks on object 21, the electronic device displays Figure 3c In the second page shown, the user enters the comment content and clicks send, then the first data can be obtained.

[0129] In this embodiment, the first page and the second page may belong to the same or different page types.

[0130] like Figure 3c As shown, if the user clicks on the "Hot News" object in the second page, the electronic device may display a third page (the third page is different from the first page and the second page, but the page type of the third page may be the first page type or the second page type); if the third page needs to return data to the second page, the third data can be obtained based on the third page, wherein the third data may be: user input data for the third page, and response data for the user input operation on the third page. One or more.

[0131] Assume that the first parameter contained in the jump information from the second page to the third page is the same as the first parameter contained in the first jump information from the first page to the second page. If the page container does not store the first parameter and the first data corresponding to the storage space, then the page container obtains the first data and the third data corresponding to the same first parameter. Optionally, the page container will discard any one of the first data and the third data. If the first data is discarded, then the first page cannot obtain the first data. If the third data is discarded, then the second page cannot obtain the third data.

[0132] If the page container has stored the first parameter and the first data in the storage space in correspondence, when the page container then stores the first parameter and the third data in the storage space in correspondence, the first parameter and the first data may be replaced, that is, the storage space no longer stores the first parameter and the first data in correspondence, but stores the first parameter and the third data in correspondence, so that the first page may obtain the third data based on the first parameter, resulting in an error.

[0133] In order to avoid the above situation, optionally, different objects on different pages correspond to different first parameters; different objects on the same page correspond to different first parameters.

[0134] The second type: a first parameter is obtained based on at least one of the address of the second page and the address of the first page.

[0135] It can be understood that, if the first parameter contained in the first jump information is obtained from the address of the second page, then the first parameter contained in the jump information from the second page to the third page is obtained from the address of the third page; if the first parameter contained in the first jump information is obtained from the address of the first page, then the first parameter contained in the jump information from the second page to the third page is obtained from the address of the second page; if the first parameter contained in the first jump information is obtained from the address of the first page and the address of the second page, then the first parameter contained in the jump information from the second page to the third page is obtained from the address of the second page and the address of the third page; therefore, the situation where the first parameter contained in the first jump information is the same as the first parameter contained in the jump information from the second page to the third page will not occur.

[0136] The above embodiment mentions the process in which after the first page jumps to the second page, the second page transmits data to the first page. It is understandable that the second page can also jump to the first page.

[0137] The first page in “jumping from the second page to the first page” mentioned in the embodiment of the present application and the first page in “jumping from the first page to the second page” are the same page, or different pages belonging to the first page type.

[0138] The second page in “jumping from the second page to the first page” mentioned in the embodiment of the present application and the second page in “jumping from the first page to the second page” are the same page, or are different pages belonging to the second page type.

[0139] like Figure 5 , which is a data interaction schematic diagram of the data interaction device provided in an embodiment of the present application.

[0140] The jump component 12 is a data transmission medium between the second engine 14 corresponding to the second page and the first engine 11 corresponding to the first page. The jump component 12 can transmit the second jump information from the second page to the first page to the first engine 11, thereby opening the first page.

[0141] In an optional embodiment, the page container 13 is a special page of the first page type, so the first engine 11 can communicate with the page container 13. The second data obtained by the first engine (the second data includes one or more of the user input data for the first page and the response data of the user input operation for the first page) can be transmitted to the page container 13.

[0142] The page container 13 may send the second data to the second engine 14 , so that the second engine 14 may update the content included in the second page based on the second data.

[0143] Combination Figure 5 , the process of transmitting data from the second page to the first page provided in an embodiment of the present application is described.

[0144] like Figure 6 As shown, it is a signaling diagram of another implementation of the data interaction method provided in an embodiment of the present application, and the method includes:

[0145] Step S601: the second engine 14 obtains second jump information from the second page to the first page and a first page type to which the first page belongs.

[0146] The second engine corresponds to the second page; the second jump information includes the address of the first page and a second parameter, and the second parameter is used to indicate whether the first page needs to transmit second data to the second page.

[0147] In the embodiment of the present application, the data returned from the first page to the second page is referred to as second data.

[0148] There are many ways for the second engine 14 to obtain the second jump information and the first page type to which the first page belongs. The embodiments of the present application provide but are not limited to the following ways.

[0149] The first implementation method includes:

[0150] Step 1: Obtain the address of the first page to be jumped to and associated with the clicked second object and the first page type to which the first page belongs; the second object is located on the second page.

[0151] In an optional embodiment, the page (the page refers to any one of the first page and the second page) includes one or more objects of pictures, videos, audios, texts, graphics and buttons. Optionally, each object is associated with the address of the page to be jumped and the page type to which the page to be jumped belongs.

[0152] In order for those skilled in the art to better understand the embodiments of the present application, Figure 3a to Figure 3d The interface shown is described below.

[0153] Assume that Figure 3a and Figure 3b is the second page, where Figure 3a and Figure 3b The second page displayed includes the content of news 1 and multiple comments on the content of news 1; Figure 3b Display for electronic devices Figure 3a When the user slides up the screen of the electronic device, the second page displayed by the electronic device contains subsequent content, and the user can see the following content: Figure 3b All comments shown.

[0154] If the user clicks Figure 3a or Figure 3b The second page shown contains an object 21 (here referred to as the second object). Since the second object is associated with the address of the first page and the first page type to which the first page belongs, the second engine 14 can obtain the address of the first page and the first page type to which the first page belongs.

[0155] Step 2: If the event associated with the second object indicates that the first page needs to transmit second data to the second page, assign a first value to the second parameter. If the event associated with the second object indicates that the first page does not need to transmit second data to the second page, assign a second value to the second parameter.

[0156] In an optional embodiment, the first value and the second value are different. The first value and the second value can be any character or string. Optionally, assuming that the first parameter is needBackInfo, the first value can be True; the second value can be False.

[0157] The second implementation method includes: obtaining the address of the first page to be jumped to and associated with the clicked second object, the first page type to which the first page belongs, and the value of a second parameter; the second object is located on the second page.

[0158] In summary, after detecting that the second object is clicked, the second engine may assign a value to the second parameter based on the event bound to the second object; or, pre-set an association relationship between the second object and the value of the second parameter.

[0159] Step S602 : if the page type to which the first page belongs is the first page type, the second engine 14 sends the second jump information to the jump component 12 .

[0160] Step S603: if the second parameter indicates that the first page needs to transmit second data to the second page, the jump component 12 jumps to the first engine 11 through a first preset function.

[0161] The first preset function carries the address of the first page.

[0162] Optionally, the first preset function is a function used when jumping between multiple first pages, and the first preset function is used to indicate that the second page needs to transfer data to the first page. That is, after the first page A jumps to the first page B (the first page A and the first page B are both pages of the first page type), if the first page B needs to transfer data to the first page A, then the first page A jumps to the first page B through the first preset function.

[0163] If the second page is a weex page and the first page is a native page, optionally, the first preset function may be a startActivityForResult function.

[0164] The Push (native page address) function in the jump component 12 may be called to open the first page.

[0165] Optionally, the method further includes: if the second parameter indicates that the first page does not need to transmit second data to the second page, the jump component 12 jumps to the first engine through a second preset function.

[0166] The second preset function carries the address of the first page.

[0167] Optionally, the second preset function is a function used when jumping between multiple first pages, and the second preset function is used to indicate that the second page does not need to transmit data to the first page. That is, after the first page A jumps to the first page B, if the first page B does not need to transmit data to the first page A, then the first page A jumps to the first page B through the second preset function.

[0168] If the first page type is a native page type, optionally, the second preset function is: startActivity function.

[0169] Step S604 : the first engine 11 displays the first page based on the address of the first page; obtains second data based on the first page, and sends the second data to the page container 13 .

[0170] The second data includes one or more of user input data for the second page and response data of a user input operation for the second page.

[0171] For the introduction to the second data, please refer to the introduction to the first data, which will not be repeated here.

[0172] Optionally, the first engine 11 may obtain relevant data of the first page based on the address of the first page, and render the first page.

[0173] If the second page is a weex page and the first page is a native page, optionally, based on the setResult (processing result code: int, second data) function, the second data can be returned to the page container 13. The page container 13 can receive the second data sent by the first engine 11 based on the OnActivityResult (request code: int, processing result code: int, second data) function.

[0174] For processing result codes and request codes, please refer to the description of the interaction process between multiple pages belonging to the native page type, which will not be repeated here.

[0175] Step S605 : the page container 13 sends the second data to the second engine 14 .

[0176] Optionally, the second page type is a weex page type, and the page container can initiate a global event by calling the fireGlobalEventCallback (second data) function in WXSDKinstance to transmit the second data to the JS code of the second page.

[0177] Step S606: the second engine 14 updates the content included in the second page based on the second data.

[0178] Optionally, the page container 13 includes one or more second pages, the JS code of the second page is registered with a monitoring data processing callback event, for example, addEventListener, for monitoring the second data, and the second engine 14 corresponds to the JS code of the second page, that is, the second engine 14 is registered with a monitoring data processing callback event. Optionally, step S606 specifically includes:

[0179] The second engine is further configured to update the content of the second page based on the second data if the second data is detected.

[0180] The embodiment of the present application also provides a data interaction method between multiple second pages of the second page type (here taking the second page A and the second page B as an example). The data interaction method includes:

[0181] Step 1: The second engine 14 obtains fourth jump information from the second page A to the second page B and the second page type to which the second page B belongs.

[0182] The fourth jump information includes the address of the second page B.

[0183] The way in which the second engine 14 obtains the fourth jump information and the second page type to which the second page B belongs is the same as the way in which the second engine 14 obtains the second jump information and the first page type to which the first page belongs, and is not repeated here.

[0184] Step 2: If the page type to which the second page B belongs is the second page type, the second engine 14 sends the fourth jump information to the page container.

[0185] Step 3: The page container displays the fourth page based on the address of the second page B.

[0186] Step 4: The engine of the second page B (for example, the JS code of the second page B) transmits the fourth data to the engine of the second page B (for example, the JS code of the second page) through the common communication channel of multiple second pages belonging to the second page type, so that the engine of the second page B updates the second page B based on the fourth data.

[0187] The fourth data is user input data for the fourth page and response data of the user input operation for the fourth page.

[0188] In the embodiment of the present application, data returned by a second page belonging to the second page type to another second page is referred to as fourth data.

[0189] For the description of the fourth data, please refer to the description of the first data, which will not be repeated here.

[0190] like Figure 7 As shown, it is a schematic diagram of the data interaction method between multiple pages belonging to the second page type provided in an embodiment of the present application.

[0191] Assume that the second page type is a weex page type. Data can be transmitted between JS codes of multiple weex pages. Figure 7 In the following, three weex pages are used as examples. Assume that the three weex pages are weex page A, weex page B, and weex page C. The JS code of weex page A is called A.JS; the JS code of weex page B is called B.JS; the JS code of weex page C is called C.JS.

[0192] If jumping from weex page A to weex page B, weex page A can send the fourth jump information from weex page A to weex page B to the page container, and the page container can display weex page B; weex page B needs to return the fourth data of weex page A, which can be transmitted to A.JS by B.JS through the common communication channel between multiple weex pages.

[0193] The common communication channel between multiple Weex pages refers to objects with the same name created by JS files of multiple Weex pages, for example, broadcastChannel objects.

[0194] Optionally, B.JS can send the fourth data by postMessage. A.JS and C.JS can receive the fourth data by onMessage. After receiving the fourth data, C.JS will discard the fourth data because the fourth data is not fed back to weex page C.

[0195] The data interaction device provided in the embodiment of the present application realizes the jump and data interaction between pages belonging to different page types. As applications with a large number of native pages gradually tend to include pages of multiple different page types, the cost of applications accessing non-native pages, such as weex pages, can be greatly reduced.

[0196] In the embodiment of the present application, the data communication method between multiple pages belonging to the native page type still adopts the original data communication method between native pages, and smooth degradation can be achieved. That is, after the native page is switched to the weex page, if a problem occurs, only the data communication between the native page and the weex page has a problem, and the data communication between the native pages is still normal.

[0197] It can be understood that the programs corresponding to the first engine, the second engine, the page container and the jump component are all running in the processor, and the embodiment of the present application also provides a data interaction method for the application processor.

[0198] See also Figure 8 , which is a flowchart of another implementation of the data interaction method provided in an embodiment of the present application, the method comprising:

[0199] Step S801: obtaining first jump information from a first page to a second page and a second page type to which the second page belongs.

[0200] Among them, the first jump information includes the address of the second page and a first parameter; the first parameter is used to represent the number of the first data returned by the second page to the first page; the first page belongs to a first page type, and the first page type is different from the second page type to which the second page belongs.

[0201] Step S802: If the second page is of the second page type, the first jump information is sent to a page container corresponding to the second page.

[0202] Step S803: Control the page container to display the second page based on the address of the second page.

[0203] Step S804: controlling the jump component to obtain the first data, where the first data includes one or more of user input data for the second page and response data of the user input operation for the second page.

[0204] Step S805: Control the page container to store the first data obtained from the jump component and the first parameter in a storage space in correspondence thereto.

[0205] Step S806: controlling the first engine corresponding to the first page to obtain the first data corresponding to the first parameter from the storage space.

[0206] against Figure 8 The description of the process shown can be found in the above Figure 2 The description of the data interaction process shown is not repeated here.

[0207] Optionally, the steps executed by the first engine, the steps executed by the second engine, the steps executed by the page container, and the steps executed by the jump component are all controlled by the processor. Figure 2 , Figure 4 , Figure 6 and Figure 7 The data interaction process shown may be controlled by a processor.

[0208] Optionally, the data interaction method applied to the processor also includes:

[0209] Obtaining second jump information from the second page to the first page and a first page type described in the first page;

[0210] The second jump information includes the address of the first page and a second parameter, and the second parameter is used to indicate whether the first page needs to transfer second data to the second page;

[0211] If the page type to which the first page belongs is the first page type, sending the second jump information to the jump component;

[0212] If the second parameter indicates that the first page needs to transmit second data to the second page, control the jump component to jump to the first engine through a first preset function; the first preset function carries the address of the first page, and the first preset function is a function corresponding to the data that needs to be transmitted when jumping between multiple first pages;

[0213] Controlling the first engine to display the first page based on the address of the first page and to obtain second data based on the first page;

[0214] The page container is controlled to send the second data obtained from the first engine to a second engine corresponding to the second page.

[0215] like Fig. 9 FIG. 1 is a structural diagram of an implementation method of an electronic device provided in an embodiment of the present application, and the electronic device includes:

[0216] A memory 91, used for storing programs;

[0217] The processor 92 is used to execute the program, and the program is specifically used to:

[0218] Acquire first jump information from a first page to a second page and a second page type to which the second page belongs;

[0219] The first jump information includes the address of the second page and a first parameter; the first parameter is used to represent the number of the first data returned by the second page to the first page; the first page belongs to a first page type, and the first page type is different from the second page type to which the second page belongs;

[0220] If the second page is of the second page type, sending the first jump information to a page container corresponding to the second page;

[0221] Controlling the page container to display the second page based on the address of the second page;

[0222] The control jump component obtains the first data, where the first data includes one or more of user input data for the second page and response data of the user input operation for the second page;

[0223] Control the page container to store the first data obtained from the jump component and the first parameter in a storage space in correspondence with each other;

[0224] Control a first engine corresponding to the first page to obtain the first data corresponding to the first parameter from the storage space.

[0225] The electronic device may further include: a communication interface 93 and a communication bus 94; in the embodiment of the present application, the number of the processor 91, the memory 92, the communication interface 93 and the communication bus 94 is at least one, and the processor 91, the communication interface 93 and the memory 92 communicate with each other through the communication bus 54;

[0226] The processor 91 may be a central processing unit (CPU), or an application-specific integrated circuit (ASIC), or one or more integrated circuits configured to implement the embodiments of the present invention;

[0227] The memory 92 may include a high-speed RAM memory, and may also include a non-volatile memory, such as at least one disk memory.

[0228] An embodiment of the present application further provides a readable storage medium on which a computer program is stored. When the computer program is executed by a processor, any of the data interaction methods described above is implemented.

[0229] It should be noted that the features described in the various embodiments in this specification can be replaced or combined with each other. For the device or system embodiments, since they are basically similar to the method embodiments, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiments.

[0230] It should also be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.

[0231] The steps of the method or algorithm described in conjunction with the embodiments disclosed herein may be implemented directly using hardware, a software module executed by a processor, or a combination of the two. The software module may be placed in a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.

[0232] The above description of the disclosed embodiments enables those skilled in the art to implement or use the present application. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application will not be limited to the embodiments shown herein, but will conform to the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. A data interaction device, characterized in that: include: A first engine is used to obtain first jump information from a first page to a second page and a second page type to which the second page belongs; If the page type to which the second page belongs is the second page type, sending the first jump information to a page container including the second page; The first engine corresponds to the first page; the first page belongs to a first page type, which is different from the second page type; the first jump information includes the address of the second page and a first parameter; the first parameter is used to represent the number of the first data returned by the second page to the first page; The page container is used to display the second page based on the address of the second page; A jump component, used to transfer the first data obtained based on the second page to the page container; the first data includes one or more of user input data for the second page and response data of the user input operation for the second page; The page container is further used to store the first data and the first parameter in a storage space correspondingly; the storage space is a shared storage space of the page container and the first engine; The first engine is further configured to obtain the first data corresponding to the first parameter from the storage space, and update the content included in the first page based on the first data; The first engine, when executing to obtain first jump information from a first page to a second page and a second page type to which the second page belongs, includes: The address of the second page to be jumped to and associated with the clicked first object and the second page type to which the second page belongs are obtained; the first object is located on the first page; if the event associated with the first object indicates that the second page needs to transmit data to the first page, the first parameter is created; or, Obtain the address of the second page to be jumped to and associated with the clicked first object, the second page type to which the second page belongs, and the first parameter; the first parameter is set for the first object when the second page needs to transfer data to the first page; the first object is located on the first page.

2. The data interaction device according to claim 1, characterized in that: The creating the first parameter comprises: The first parameter is obtained based on at least one of the address of the second page and the address of the first page.

3. The data interaction device according to any one of claims 1 to 2, characterized in that: When the jump component executes the transmission of the first data obtained based on the second page to the page container, the method specifically includes: If a page closing event for the second page is detected, obtaining first data from a second engine; the second engine corresponds to the second page; The first data and the page closing event are transmitted to the page container.

4. The data interaction device according to claim 3, characterized in that: The page container is also used to: If the page closing event is detected, the page container is closed.

5. The data interaction device according to any one of claims 1, 2 or 4, characterized in that: Also includes: A second engine is used to obtain second jump information from the second page to the first page and a first page type to which the first page belongs; If the page type to which the first page belongs is the first page type, sending the second jump information to the jump component; The second engine corresponds to the second page; the second jump information includes the address of the first page and a second parameter, and the second parameter is used to indicate whether the first page needs to transmit second data to the second page; The jump component is further configured to jump to the first engine through a first preset function if the second parameter indicates that the first page needs to transmit the second data to the second page; the first preset function carries the address of the first page; The first engine is further used to display the first page based on the address of the first page, obtain the second data based on the first page, and send the second data to the page container; the second data includes one or more of user input data for the second page and response data of the user input operation for the second page; The page container is further used to send the second data to the second engine.

6. The data interaction device according to claim 5, characterized in that: Also includes: The jump component is further configured to jump to the first engine through a second preset function if the second parameter indicates that the first page does not need to transmit the second data to the second page; The second preset function carries the address of the first page.

7. The data interaction device according to claim 5, characterized in that: When the page container executes sending the second data to the second engine, the steps specifically include: broadcasting and sending the second data; The second engine is further configured to update the content of the second page based on the second data if the second data is detected.

8. A data interaction method, characterized in that: include: Acquire first jump information from a first page to a second page and a second page type to which the second page belongs; The first jump information includes the address of the second page and a first parameter; the first parameter is used to represent the number of the first data returned by the second page to the first page; the first page belongs to a first page type, and the first page type is different from the second page type to which the second page belongs; If the second page is of the second page type, sending the first jump information to a page container corresponding to the second page; Controlling the page container to display the second page based on the address of the second page; The control jump component obtains the first data, where the first data includes one or more of user input data for the second page and response data of the user input operation for the second page; Control the page container to store the first data obtained from the jump component and the first parameter in a storage space corresponding to each other; the storage space is a shared storage space of the page container and the first engine; Controlling a first engine corresponding to the first page to obtain the first data corresponding to the first parameter from the storage space; The acquiring of first jump information from the first page to the second page and a second page type to which the second page belongs includes: The address of the second page to be jumped to and associated with the clicked first object and the second page type to which the second page belongs are obtained; the first object is located on the first page; if the event associated with the first object indicates that the second page needs to transmit data to the first page, the first parameter is created; or, Obtain the address of the second page to be jumped to and associated with the clicked first object, the second page type to which the second page belongs, and the first parameter; the first parameter is set for the first object when the second page needs to transfer data to the first page; the first object is located on the first page.

9. The data interaction method according to claim 8, characterized in that: Also includes: Obtaining second jump information from the second page to the first page and a first page type described in the first page; The second jump information includes the address of the first page and a second parameter, and the second parameter is used to indicate whether the first page needs to transfer second data to the second page; If the page type to which the first page belongs is the first page type, sending the second jump information to the jump component; If the second parameter indicates that the first page needs to transmit the second data to the second page, controlling the jump component to jump to the first engine through a first preset function; the first preset function carries the address of the first page; Controlling the first engine to display the first page based on the address of the first page and to obtain the second data based on the first page; The page container is controlled to send the second data obtained from the first engine to a second engine corresponding to the second page.

10. An electronic device, characterized in that: include: Memory, used to store programs; A processor, used to execute the program to perform the data interaction method as described in any one of claims 8-9.

11. A readable storage medium, characterized in that: A computer program is stored thereon, and when the computer program is executed by a processor, the data interaction method as described in any one of claims 8-9 is implemented.

Citation Information

Patent Citations

  • Multi-page management method and device

    CN105027120A

  • Method and device for controlling webpage redirection and user terminal

    CN107480148A