Card template generation method, content display card display method and terminal

文档序号:681916 发布日期:2021-04-30 浏览:3次 中文

阅读说明:本技术 卡片模板的生成方法、内容展示卡片的显示方法及终端 (Card template generation method, content display card display method and terminal ) 是由 李大伟 于 2021-01-06 设计创作,主要内容包括:本申请实施例公开了一种卡片模板的生成方法、内容展示卡片的显示方法及终端,属于计算机技术领域。该方法包括:基于模板生成指令所指示的组件样式,从卡片组件库中加载卡片组件;按照模板生成指令中包含的数据转化关系,设置卡片组件对应的卡片内容;按照模板生成指令组建设置完成的卡片组件,生成内容展示卡片的卡片模板。响应于卡片显示指令,按照当前应用场景下的卡片模板创建卡片组件;将接收到的待展示内容转换为卡片组件对应的卡片内容;按照卡片模板所指示的卡片格式组建卡片组件,生成并显示内容展示卡片。提高了应用程序的开发效率,降低了开发成本,并且实现了卡片显示数据和业务数据的解耦,提高了卡片组件的利用率。(The embodiment of the application discloses a card template generation method, a content display card display method and a terminal, and belongs to the technical field of computers. The method comprises the following steps: loading a card assembly from a card assembly library based on the assembly style indicated by the template generation instruction; setting card contents corresponding to the card components according to the data conversion relation contained in the template generation instruction; and establishing the set card assembly according to the template generating instruction to generate a card template of the content display card. Responding to a card display instruction, and creating a card assembly according to a card template in the current application scene; converting the received contents to be displayed into card contents corresponding to the card components; and (4) constructing a card assembly according to the card format indicated by the card template, and generating and displaying the content display card. The development efficiency of the application program is improved, the development cost is reduced, decoupling of card display data and business data is realized, and the utilization rate of the card assembly is improved.)

1. A method for generating a card template, the method comprising:

loading card assemblies from a card assembly library based on assembly styles indicated by the template generation instructions, wherein the card assemblies are used for forming content display cards, and different card assemblies are used for displaying card contents with different purposes;

setting card contents corresponding to the card assembly according to a data conversion relation contained in the template generation instruction, wherein the data conversion relation is a conversion relation between service data and card display data, the service data is data corresponding to the card contents, and the card display data is data required for displaying the card assembly;

and establishing the set card assembly according to the template generating instruction to generate a card template of the content display card.

2. The method according to claim 1, wherein the setting of the card content corresponding to the card assembly according to the data conversion relationship included in the template generation instruction comprises:

and converting the business data corresponding to the card component into the component display data through a data conversion interface based on a data conversion method contained in the template generation instruction.

3. The method of claim 2, wherein the converting the service data corresponding to the card component into the component display data through a data conversion interface based on a data conversion method included in the template generation instruction comprises:

acquiring conversion logic for converting the service data into the component display data through a data conversion function in the data conversion interface;

and converting the business data corresponding to the card component into the component display data according to the conversion logic by using the data conversion method.

4. The method according to any one of claims 1 to 3, wherein after the setting of the card content corresponding to the card assembly according to the data conversion relationship included in the template generation instruction, the method further includes:

and setting an updating mark for the card assembly based on the template generating instruction, wherein the updating mark is used for indicating an updating mode of the card content in the card assembly.

5. The method according to any one of claims 1 to 3, wherein after the setting of the card content corresponding to the card assembly according to the data conversion relationship included in the template generation instruction, the method further includes:

and setting a preset embedding point for the card assembly based on the template generation instruction, wherein the preset embedding point is used for indicating a trigger event corresponding to the trigger operation.

6. The method of any of claims 1 to 3, further comprising:

responding to a card component generation instruction, and generating a custom card component based on the coding format of the card component in the card component library;

setting a custom data class and a custom data conversion class for the custom card assembly, wherein base classes of the custom data class and the custom data conversion class are the same as base classes corresponding to the card assemblies in the card assembly library;

adding the custom card assembly to the card assembly library.

7. A method for displaying a content presentation card, the method comprising:

responding to a card display instruction, creating a card assembly according to a card template in a current application scene, wherein a content display card is composed of at least one card assembly, and different card assemblies are used for displaying card contents with different purposes;

converting the received content to be displayed into the card content corresponding to the card assembly;

and constructing the card assembly according to the card format indicated by the card template, and generating and displaying the content display card.

8. The method according to claim 7, wherein the converting the received content to be displayed into the card content corresponding to the card assembly comprises:

acquiring target service data corresponding to the target card assembly;

determining target contents to be displayed matched with the target service data;

and binding the target content to be displayed to the target card component.

9. The method of claim 8, wherein binding the target content-to-be-presented to the target card assembly comprises:

based on the data conversion method corresponding to the card assembly, the target content to be displayed is converted into card display data through a data conversion interface, the card display data are data required for displaying the card assembly, the data conversion interface comprises a data conversion function, and the data conversion function is used for indicating conversion logic for converting business data into the card display data.

10. The method of any of claims 7 to 9, wherein after said card assembly is assembled in a card format indicated by said card template, and said content presentation card is generated and displayed, said method comprises:

responding to a card updating instruction of the content display card, and acquiring an updating mark of each card assembly;

in response to the card assembly being provided with the update mark, updating the card content in the card assembly in an update manner indicated by the update mark;

in response to the card assembly not having the update flag set, maintaining the card contents in the card assembly unchanged.

11. The method of any of claims 7 to 9, wherein after said creating and displaying said content presentation card by said creating said card assembly in a card format indicated by said card template, said method further comprises:

responding to a triggering operation of a preset buried point in the card assembly, and determining a triggering event based on the preset buried point;

and responding to the trigger event according to a preset mode.

12. An apparatus for generating a card template, the apparatus comprising:

the loading module is used for loading card assemblies from the card assembly library based on the assembly styles indicated by the template generation instructions, the card assemblies are used for forming content display cards, and different card assemblies are used for displaying the card contents with different purposes;

the first setting module is used for setting the card content corresponding to the card assembly according to a data conversion relation contained in the template generation instruction, wherein the data conversion relation is a conversion relation between service data and card display data, the service data is data corresponding to the card content, and the card display data is data required for displaying the card assembly;

and the first generation module is used for constructing the card assembly which is finished in setting according to the template generation instruction and generating the card template of the content display card.

13. A display device for a content presentation card, the device comprising:

the second generation module is used for responding to a card display instruction and creating a card assembly according to a card template in the current application scene, the content display card is composed of at least one card assembly, and different card assemblies are used for displaying card contents with different purposes;

the conversion module is used for converting the received contents to be displayed into the card contents corresponding to the card assembly;

and the display module is used for constructing the card assembly according to the card format indicated by the card template, and generating and displaying the content display card.

14. A terminal, characterized in that the terminal comprises a processor and a memory, wherein the memory stores at least one instruction, at least one program, a set of codes or a set of instructions, and the at least one instruction, the at least one program, the set of codes or the set of instructions is loaded and executed by the processor to realize the method for generating the card template according to any one of claims 1 to 6, or the method for displaying the content presentation card according to any one of claims 7 to 11.

15. A computer-readable storage medium having stored therein at least one instruction, at least one program, a set of codes, or a set of instructions, which is loaded and executed by a processor to implement the method of generating a card template according to any one of claims 1 to 6, or the method of displaying a content presentation card according to any one of claims 7 to 11.

Technical Field

The embodiment of the application relates to the technical field of computers, in particular to a card template generation method, a content display card display method and a terminal.

Background

Currently, in most application programs with an information push function, such as social, question and answer, video and communication application programs, information is displayed on an interface in the form of information streams (Feed streams), a Feed stream is composed of message cards, usually one post or one message corresponds to one card, and the card contains message content, publisher information, operation controls and the like, so that a user can browse and approve, forward, comment and the like on the message content.

In the related art, different business scenes, such as a personal homepage, a dynamic contact page, a content recommendation page of an application program and the like, usually exist in the same application program, and cards corresponding to the business scenes are different, for example, each card in an album page only contains a picture and a video, and the card of the dynamic contact page contains message content, contact information, an operation control and the like, so that a developer can design and generate a single card respectively for different business scenes in the development process of the application program, thereby causing the problems of high development cost of the application program, single application scene of the card and low utilization rate.

Disclosure of Invention

The embodiment of the application provides a card template generation method, a content display card display method and a terminal. The technical scheme is as follows:

in one aspect, the present application provides a method for generating a card template, where the method includes:

loading card assemblies from a card assembly library based on assembly styles indicated by the template generation instructions, wherein the card assemblies are used for forming content display cards, and different card assemblies are used for displaying card contents with different purposes;

setting card contents corresponding to the card assembly according to a data conversion relation contained in the template generation instruction, wherein the data conversion relation is a conversion relation between service data and card display data, the service data is data corresponding to the card contents, and the card display data is data required for displaying the card assembly;

and establishing the set card assembly according to the template generating instruction to generate a card template of the content display card.

In another aspect, the present application provides a method for displaying a content display card, including:

responding to a card display instruction, creating a card assembly according to a card template in a current application scene, wherein a content display card is composed of at least one card assembly, and different card assemblies are used for displaying card contents with different purposes;

converting the received content to be displayed into the card content corresponding to the card assembly;

and constructing the card assembly according to the card format indicated by the card template, and generating and displaying the content display card.

In another aspect, an embodiment of the present application provides a device for generating a card template, where the method includes:

the loading module is used for loading card assemblies from the card assembly library based on the assembly styles indicated by the template generation instructions, the card assemblies are used for forming content display cards, and different card assemblies are used for displaying the card contents with different purposes;

the first setting module is used for setting the card content corresponding to the card assembly according to a data conversion relation contained in the template generation instruction, wherein the data conversion relation is a conversion relation between service data and card display data, the service data is data corresponding to the card content, and the card display data is data required for displaying the card assembly;

and the first generation module is used for constructing the card assembly which is finished in setting according to the template generation instruction and generating the card template of the content display card.

In another aspect, an embodiment of the present application provides a display device for a content display card, where the device includes:

the second generation module is used for responding to a card display instruction and creating a card assembly according to a card template in the current application scene, the content display card is composed of at least one card assembly, and different card assemblies are used for displaying card contents with different purposes;

the conversion module is used for converting the received contents to be displayed into the card contents corresponding to the card assembly;

and the display module is used for constructing the card assembly according to the card format indicated by the card template, and generating and displaying the content display card.

On the other hand, the embodiment of the present application discloses a terminal, which includes a processor and a memory, where the memory stores at least one instruction, at least one program, a code set, or an instruction set, and the at least one instruction, the at least one program, the code set, or the instruction set is loaded and executed by the processor to implement the method for generating a card template according to the above aspect, or the method for displaying a content display card.

In another aspect, an embodiment of the present application discloses a computer-readable storage medium, in which at least one instruction, at least one program, a code set, or an instruction set is stored, and the at least one instruction, the at least one program, the code set, or the instruction set is loaded and executed by a processor to implement the method for generating a card template according to the above aspect, or the method for displaying a content display card.

According to an aspect of the application, a computer program product or computer program is provided, comprising computer instructions, the computer instructions being stored in a computer readable storage medium. The processor of the terminal reads the computer instructions from the computer-readable storage medium, and executes the computer instructions, so that the terminal executes the method for generating the card template or the method for displaying the content presentation card provided in the various optional implementation modes of the above aspects.

The technical scheme provided by the embodiment of the application has the beneficial effects that at least:

in the embodiment of the application, the cards of the content display cards are designed in an elemental manner, so that the content display cards are composed of card assemblies, required card assemblies are loaded from a card assembly library when card templates are generated, corresponding card contents are set according to the card display data of each card assembly, for application programs containing different application scenes, the content display cards do not need to be developed and designed independently for each application scene, the development efficiency of the application programs is improved, the development cost is reduced, the card display data and the service data are separated, decoupling of the card display data and the service data is realized while decoupling of the data and the content display cards is realized, and the utilization rate of the card assemblies is improved.

In the application stage, each card assembly is created based on the card template corresponding to the current application scene and corresponding card content is displayed, so that the content display card is generated and displayed.

Drawings

FIG. 1 is a diagram of a content presentation card in two application scenarios provided by an exemplary embodiment of the present application;

FIG. 2 is a flow chart of a method for generating a card template provided by an exemplary embodiment of the present application;

FIG. 3 is a schematic view of a card assembly provided by an exemplary embodiment of the present application;

FIG. 4 is a flowchart of a method for generating a card template provided by another exemplary embodiment of the present application;

FIG. 5 is a flowchart of a method for generating a card template provided by another exemplary embodiment of the present application;

FIG. 6 is a diagram illustrating the relationship of a card component to classes in program code provided in an exemplary embodiment of the present application;

FIG. 7 is a flowchart of a method for displaying a content presentation card provided by an exemplary embodiment of the present application;

FIG. 8 is a flowchart of a method for displaying a content presentation card provided in another exemplary embodiment of the present application;

fig. 9 is a block diagram of a card template generation apparatus according to an exemplary embodiment of the present application;

fig. 10 is a block diagram of a display device of a content presentation card according to an exemplary embodiment of the present application.

Detailed Description

To make the objects, technical solutions and advantages of the present application more clear, embodiments of the present application will be described in further detail below with reference to the accompanying drawings.

Reference herein to "a plurality" means two or more. "and/or" describes the association relationship of the associated objects, meaning that there may be three relationships, e.g., a and/or B, which may mean: a exists alone, A and B exist simultaneously, and B exists alone. The character "/" generally indicates that the former and latter associated objects are in an "or" relationship.

At present, information in most application programs is displayed on an interface in the form of an information stream Feed stream, the Feed stream is composed of message cards, and the cards contain message content, publisher information, operation controls and the like, so that a user can browse the message contents and perform operations such as approval, forwarding, comment and the like on the message contents. In the related art, different service scenarios may generally exist in the same application, for example, a personal home page, a contact dynamic page, a content recommendation page of the application, and the like, as shown in fig. 1, for the same video content, when a content sender belongs to a contact of a user, the terminal displays the video content on a left content display card 101 on the contact page, and meanwhile, the terminal may also display the video content on a right content display card 102 on the content recommendation page, and the content display card 101 displays the video content, related text content, user information of the content sender, and corresponding interaction controls and the like. And the content display card 102 only displays the video content and the associated text content, the number of viewers, and other information. Developers can design and generate separate cards respectively aiming at different business scenes in the development process of the application program, so that the problems that the development cost of the application program is high, the application scene of the card is single and the utilization rate is low are caused.

In order to solve the above technical problems, embodiments of the present application provide a method for generating a card template and a method for displaying a content display card, where the content display card is composed of a card assembly, a business party may select a required card assembly according to actual requirements to generate the card template, and a complete content display card does not need to be separately designed and developed for each business scene, so that development efficiency of an application program can be improved, and development cost can be reduced.

Fig. 2 is a flowchart illustrating a method for generating a card template according to an exemplary embodiment of the present application. The embodiment is described by taking the method as an example for a terminal with an application program development function, and the method comprises the following steps:

step 201, based on the module style indicated by the template generation instruction, loading card modules from a card module library, wherein the card modules are used for forming content display cards, and different card modules are used for displaying card contents with different purposes.

The card component library comprises card components which are designed and developed in advance. In one possible implementation, developers design and develop card assemblies for displaying different purposes of card contents based on the characteristics of the content display cards in various application scenarios, so that the card assemblies can be combined to obtain the content display cards. The card component library can be provided for a business side, namely application program developers, and is used for developing an application program for displaying contents by using a Feed stream in a card form.

Optionally, each card assembly in the card assembly library is stored separately, or stored according to the type of the card assembly in a classified manner, or stored in a set of cards according to preset contents.

For example, as shown in fig. 3, the card component library includes five card components, where a header area component 301 is used to display related information (such as head portrait, nickname, etc.) of a content sender, a text area component 302 is used to display text content of a post, that is, text content input by the content sender, a video area component 303 is used to display video content sent by the content sender, an additional information area component 304 is used to display a subject of the post shown in the figure, and an interaction area component 305 is used to display a User Interface (UI) control attached to the post, such as a thumbing control, a comment control, a forwarding control, etc. And when the terminal receives a template generation instruction for generating the card template consisting of the five card assemblies, the terminal loads the five card assemblies from the card assembly library.

Illustratively, the terminal runs a computer code file for developing an application program and acquires a template generation instruction in the running process.

Step 202, setting card contents corresponding to the card assembly according to a data conversion relation contained in the template generation instruction, wherein the data conversion relation is a conversion relation between service data and card display data, the service data is data corresponding to the card contents, and the card display data is data required by the display card assembly.

Because the card assembly in the card assembly library is a template capable of being repeatedly used and can be applied to development of different application scenes and application programs, developers need to decouple card display data of the card assembly and business data corresponding to the application programs, so that when the terminal generates the card template, the business data corresponding to the application scenes are converted into the card display data only on the basis of the data conversion relation indicated by the template generation instruction, and the utilization rate of the card assembly is improved.

For example, after the terminal creates a card component for displaying the post content, it is determined from the template generation instruction that the card component is used for displaying the video uploaded by the content sender in the target application scene, so that the video uploaded by the content sender is determined as the card content corresponding to the card component.

And step 203, constructing the set card assembly according to the template generation instruction, and generating the card template of the content display card.

Optionally, for the development of the card template in a certain application scenario, the terminal may sequentially generate and add card assemblies based on the card format indicated by the template generation instruction, and when the creation and data conversion of the last card assembly are completed, the terminal generates the card template of the content display card in the application scenario; or, the terminal may create a plurality of card assemblies indicated by the template generation instruction simultaneously and in parallel, and after all the card assemblies are created, create the card assemblies that are completely set based on information such as the assembly size and the arrangement order indicated by the template generation instruction, and generate the card template of the content display card, which is not limited in the embodiment of the present application.

Illustratively, the terminal sorts the components in the order of the header area component 301, the text area component 302, the video area component 303, the additional information area component 304 and the interaction area component 305 from top to bottom, and determines the size of each component, thereby generating a card template of the content presentation card shown in fig. 3.

To sum up, in the embodiment of the present application, carry out the elemental design to the card of content show card, make content show card constitute by card subassembly, load required card subassembly from the card subassembly storehouse when generating the card template, and the card content that corresponds is set up according to the card display data of each card subassembly, to the application program that contains different application scenes, need not to develop design content show card alone to every application scene, the development efficiency of application program has been improved, development cost is reduced, and with card display data and service data separation, the decoupling zero of card display data and service data has been realized when realizing data and content show card decoupling zero, the utilization ratio of card subassembly has been improved.

Fig. 4 shows a flowchart of a method for generating a card template according to another exemplary embodiment of the present application. The embodiment is described by taking the method as an example for a terminal with an application program development function, and the method comprises the following steps:

step 401, based on the module style indicated by the template generation instruction, loading card modules from a card module library, where the card modules are used to form content display cards, and different card modules are used to display card contents of different purposes.

The specific implementation of step 401 may refer to step 201 in the foregoing embodiments, and details of the embodiments of the present application are not described herein again.

Step 402, based on the data conversion method included in the template generation instruction, converting the service data corresponding to the card component into component display data through the data conversion interface.

Because the card components in the card component library are used for card design and development in various application scenes, business data are not set, and a business party can select the card components according to actual requirements and set specific business data for the card components when developing content display cards.

Illustratively, the card assembly in the program code belongs to a card display class (CardView), which includes a header display class (headterview), a bottom display class (BottomView), and the like, and both the CardView and each UI element to be displayed in the card assembly belong to a common display base class (basecomonview). The Base CommonView contains a parameter indicating service data, i.e., original data (originData), and the terminal converts the originData into component display data, wherein the component display data belongs to a common display data Base class (basecomonviewdata) in the program code.

In a possible embodiment, the data conversion interface (cardviewdatacovertpprocessor) includes a data conversion function (Convert), a developer writes conversion logic for converting service data into component display data in the data conversion function in advance according to a requirement, and when the terminal executes a template generation instruction, the terminal converts the service data into the component display data according to the conversion logic, and step 402 includes the following steps:

step 402a, obtaining a conversion logic for converting the service data into the component display data through a data conversion function in the data conversion interface.

In a possible implementation, the Convert includes conversion logic of service data to a data class required by the card component, and each card component corresponds to the Convert. For example, the Convert of the service data containing the head portrait and the nickname of the content sender into the component display data is specified in the Convert of the head component, and the Convert of the UI control service data containing the like, forward, comment into the component display data is specified in the Convert of the bottom component.

And 402b, converting the business data corresponding to the card component into component display data according to the conversion logic by using a data conversion method.

After the terminal determines the conversion logic, the data conversion is completed by using a data conversion method (register converterprocessor) corresponding to the card assembly, that is, the service data corresponding to the card assembly is converted into the assembly display data according to the conversion logic.

And step 403, setting an update flag (updateFlag) for the card component based on the template generation instruction, wherein the update flag is used for indicating an update mode of the card content in the card component.

In a possible implementation mode, the terminal sets updateFlag for the card component based on the template generation instruction, so that in a subsequent application stage, the user terminal can determine whether each component is updated, an updating mode and the like according to the updateFlag.

Illustratively, the terminal sets updateFlag for the card component by using a data updating and converting method (updateDataWithConvert) corresponding to the card component, so as to update the UI content.

And step 404, setting a preset embedding point for the card assembly based on the template generation instruction, wherein the preset embedding point is used for indicating a trigger event corresponding to the trigger operation.

Because the card content or the control in the card assembly belongs to the triggerable UI element when the content display card is actually displayed, the user can trigger a corresponding event through the triggering operation on the control in the card assembly or the card assembly, for example, when the terminal receives the triggering operation on the comment control, the comment area of the content display card is displayed, and when the terminal receives the triggering operation on the video content assembly, the video uploaded by the content sender is played. In a possible implementation mode, a developer sets a buried point for a card assembly according to actual requirements, and a terminal sets a preset buried point for the card assembly based on a template generation instruction in the process of generating a card template so as to realize triggering operation of a user.

Illustratively, the terminal sets a preset buried point for the card component through a card component callback interface (CardViewCallback).

It should be noted that the above steps 403 and 404 are in parallel, and in the template generation instruction, each card assembly is not necessarily provided with an update mark or a preset buried point, and a developer can select the card assembly according to actual requirements.

And 405, building a card assembly with completed settings according to the template generation instruction, and generating a card template of the content display card.

For a specific implementation of step 405, refer to step 203 in the foregoing embodiments, and details of the embodiments of the present application are not described herein.

In the embodiment of the application, the business data is converted into the component display data through the data conversion interface, and compared with a mode that the business data is directly bound to the card component in the related technology, the separation of the business data and the component display data is realized, so that the card component can be provided for different application scenes; the updating marks are respectively arranged for the card assemblies, so that the terminal in the application stage can be updated conveniently based on the updating marks, the complete content display card does not need to be updated, and the card updating efficiency can be improved.

In a possible implementation, the terminal may further create a new card assembly and add the new card assembly to the card assembly library, that is, the business party may design the card assembly according to the requirement and use the card assembly for developing the content display card. Fig. 5 is a flowchart illustrating a method for generating a card template according to another exemplary embodiment of the present application, where the present embodiment is described by taking the method as an example for a terminal with an application development function, and the method includes the following steps:

step 501, responding to a card component generation instruction, and generating a custom card component based on the coding format of the card components in the card component library.

In a possible implementation, the card components in the card component library may not fully meet the requirements of the business party, so the business party can design and develop the card components on its own based on the card components contained in the card component library and encode the card components according to the same encoding format. And when the terminal executes the card assembly generating instruction, creating a new card assembly according to the coding format, namely a user-defined card assembly.

Step 502, setting a custom data class and a custom data conversion class for the custom card assembly, wherein the base classes of the custom data class and the custom data conversion class are the same as the base classes corresponding to the card assemblies in the card assembly library.

In a possible implementation manner, the terminal executes a card component generation instruction based on a base class corresponding to a card component in a card component library, and sets a custom data class and a custom data conversion class for a custom card component.

Schematically, fig. 6 shows a relationship diagram of each class in the original card component corresponding code in a card component library, which includes three base classes, i.e., basecomonview viewdata, and a data conversion base class (iviewdataconcovertprocessor), card components in the card component library, which correspond to a data class (CardData) inherited from basecomonview data, a component class (CardView) inherited from basecomonview, and a Callback function (Callback), and data conversion interfaces Process01, Process02, Process03, Process01, Process02, and Process03, which are inherited from iviewdataconcovertprocessor, which are used to convert corresponding service data (business data), i.e., business data01, business data02, business data03, into business data. When the terminal executes the card component generation instruction, under the logic, a custom data class (XXXDATA) and a custom data conversion class (xxxViewDataConvertProcessor) are set for a custom component class (xxxView) of a custom card component, wherein xxxView is inherited from BaseCommonView, XXXDATA is inherited from BaseCommonView, and xxxViewDataConvertProcessor is inherited from IViewDataConvertProcessor.

Step 503, add the custom card assembly to the card assembly library.

In one possible implementation, the terminal adds the custom card assembly to the card assembly library so that the custom card assembly is loaded through the card assembly library when the card template is subsequently generated. And when the card template indicated by the template generation instruction contains the custom template, the terminal loads the custom card assembly and other card assemblies from the card assembly library so as to generate the card template.

In the embodiment of the application, the terminal can generate the card template by utilizing the existing card assembly in the card assembly library, and can add the self-defined card assembly on the basis of the card assembly library, so that different application scene requirements are met, a business party can conveniently perform personalized customization on the card template, and the utilization rate of the card assembly is improved.

The embodiments described above illustrate a process in which the terminal generates a card template of a content presentation card in an application development phase, and in an application phase, the terminal generates and updates the content presentation card based on the card template. Fig. 7 is a flowchart illustrating a display method for a content display card according to an exemplary embodiment of the present application, where the present application is described by taking as an example that the method is used in a terminal having a function of displaying a content display card, and the method includes the following steps:

step 701, in response to a card display instruction, creating a card assembly according to a card template in a current application scene, wherein the content display card is composed of at least one card assembly, and different card assemblies are used for displaying card contents with different purposes.

In a possible implementation manner, in the application phase, after receiving the card display instruction, the terminal displays a content display card, where the content display card displays content and related information and the like sent by a content sender, and the content sender may be a user of the application program or a background server of the application program. For example, when the terminal receives an opening instruction for an application program, the terminal determines to receive a card display instruction before the terminal displays a default page for displaying content in the form of a content display card; when the terminal receives refreshing operation of a content page displayed in the form of a content display card, the terminal determines that a card display instruction is received. The application program may include a plurality of application scenarios, and the content presentation cards in different application scenarios are in different forms, for example, the content presentation card in the content recommendation page does not include user information (head portrait, nickname, etc.) of the content sender, while the content presentation card in the attention page or the content detail page includes user information of the content sender.

Step 702, converting the received content to be displayed into card content corresponding to the card component.

After the terminal creates the card assemblies, the contents to be displayed by each card assembly are bound to the corresponding card assembly, for example, the user information of a content sender is bound to the head area assembly, the contents sent by the content sender are bound to the content display area assembly, and the UI controls such as forwarding, approval, comment and the like are bound to the interaction area assembly.

Step 703, building a card assembly according to the card format indicated by the card template, and generating and displaying a content display card.

After converting the content to be displayed into the card content corresponding to the card assembly, the terminal generates and displays the content display card according to the card format (for example, the arrangement mode of the card assembly, the display size of the card assembly, and the like) indicated by the card template.

In summary, in the application stage, each card assembly is created based on the card template corresponding to the current application scene and corresponding card content is displayed, so that the content display card is generated and displayed.

Fig. 8 is a flowchart illustrating a display method for a content display card according to another exemplary embodiment of the present application, where the present embodiment is described by taking as an example that the method is used in a terminal having a function of displaying a content display card, and the method includes the following steps:

step 801, responding to a card display instruction, creating a card assembly according to a card template in a current application scene, wherein a content display card is composed of at least one card assembly, and different card assemblies are used for displaying card contents with different purposes.

The specific implementation of step 801 may refer to step 701 in the foregoing embodiments, and details of the embodiments of the present application are not repeated herein.

And step 802, acquiring target service data corresponding to the target card assembly.

In a possible implementation manner, the service data required to be displayed by different card assemblies are different, and the terminal acquires the target display content from the content to be displayed or acquires the target display content from preset data based on the target service data of the target card assembly. For example, for the head area component 301 in fig. 3, the target service data is the head portrait and nickname of the content sender, for the additional information area component 304, the target service data is the subject of the post, and for the interaction area component 305, the target service data is the control therein and the number of interaction persons corresponding to each control.

Step 803, determining the target content to be displayed matched with the target business data.

The target content to be displayed is the content to be displayed for the current content to be displayed and the target card assembly needs to be displayed, the terminal obtains the target content to be displayed from the content forwarded by the server and the related information based on the target service data, for example, for the head area assembly 301 in fig. 3, the terminal obtains the head portrait and the nickname of the content sender from the content to be displayed, for the additional information area assembly 304, the terminal determines the topic "# lovely pet" forwarded by the server as the target content to be displayed, and for the interaction area assembly 305, the terminal determines the display data corresponding to the control therein and the number of interaction persons under each interaction mode corresponding to the current content to be displayed sent by the server as the target service data.

And step 804, binding the target content to be displayed to the target card assembly.

In a possible implementation manner, since the UI data is decoupled from the component, the terminal needs to bind the target content to be displayed to the target card component, that is, convert the data related to the target content to be displayed into card display data, so as to display the target content to be displayed when the card component is displayed, where step 804 includes the following steps:

step 804a, based on a data conversion method corresponding to the card assembly, converting the target content to be displayed into card display data through a data conversion interface, where the card display data is data required by the display card assembly, and the data conversion interface includes a data conversion function used for indicating a conversion logic for converting the service data into the card display data.

In a possible implementation, the Convert includes conversion logic of service data to a data class required by the card component, and each card component corresponds to the Convert. For example, the Convert of the service data containing the head portrait and the nickname of the content sender into the component display data is specified in the Convert of the head component, and the Convert of the UI control service data containing the like, forward, comment into the component display data is specified in the Convert of the bottom component.

The terminal realizes conversion logic contained in the Convert by using the register ConvertProcessor, and binds the target content to be displayed corresponding to the target service data to the target card component.

Step 805, the card assembly is built according to the card format indicated by the card template, and the content display card is generated and displayed.

The specific implementation of step 805 may refer to step 703 in the above embodiments, and details of the embodiments of the present application are not described herein again.

In step 806, in response to the card update command for the content display card, update indicia for each card assembly is obtained.

Due to factors such as editing operation of a content sender, interactive operation of other users, and the like, the content displayed in the content display card may change, and therefore when a card update instruction for the content display card is received, the terminal needs to update the content in each card assembly in the content display card. However, in general, there is content that cannot be updated or does not need to be updated in the content display card, for example, for a content display card whose content is not editable after transmission, there is no updated content in the card component corresponding to the content display area. In order to reduce the resources consumed by the terminal when the content display card is updated and improve the updating efficiency, the terminal updates based on the updating mark in the card assembly.

In step 807, in response to the card assembly being provided with the update flag, the card content in the card assembly is updated in the update manner indicated by the update flag.

For the card assemblies provided with the update marks, the terminal updates the card contents in the card assemblies according to the update modes indicated by the update marks, for example, for the interaction area assemblies, the update marks are provided, and the update modes are that the number of interaction persons corresponding to each control is updated.

In response to the card assembly not setting the update flag, the contents of the cards in the card assembly are maintained unchanged, step 808.

For card assemblies not provided with the update flag, the terminal keeps the contents of the cards in the card assembly unchanged. Therefore, the terminal only needs to update part of the card assemblies needing to be updated in the updating content display card, so that the updating efficiency is improved, and the consumption of resources is reduced.

Step 809, in response to the triggering operation of the preset buried point in the card assembly, determining a triggering event based on the preset buried point.

When the terminal receives the trigger operation, the trigger event is determined based on the preset buried point corresponding to the trigger operation. For example, if a trigger operation for a like control is received, it is determined that the trigger event is like playing the content corresponding to the content display card, and if the trigger operation for the video content is received, it is determined that the trigger event is like playing the video.

Step 810, responding to the trigger event according to a preset mode.

And after determining the trigger event, the terminal responds according to a preset mode. For example, when the triggering event indicates that the content corresponding to the content display card is praised, the terminal changes the display mode of the praise control according to the preset mode and displays the praise effect animation, and when the triggering event indicates that the content corresponding to the content display card is commented, the terminal displays the comment area of the content display card.

In the embodiment of the application, the terminal creates the card assemblies according to the card templates in the current application scene and binds the contents to be displayed for each card assembly, so that the content display cards are generated and displayed, when the updating operation of the content display cards is received, the terminal only needs to update the card assemblies provided with the updating marks, other card assemblies do not need to be updated, the resource consumption in the card updating process is reduced, and the card updating efficiency is improved.

Fig. 9 is a block diagram of a card template generation apparatus according to an exemplary embodiment of the present application, where the apparatus includes:

a loading module 901, configured to load, based on the component style indicated by the template generation instruction, card components from the card component library, where the card components are used to form content display cards, and different card components are used to display card contents for different purposes;

a first setting module 902, configured to set card content corresponding to the card assembly according to a data conversion relationship included in the template generation instruction, where the data conversion relationship is a conversion relationship between service data and card display data, the service data is data corresponding to the card content, and the card display data is data required for displaying the card assembly;

the first generating module 903 is configured to create the card assembly with the completed settings according to the template generating instruction, and generate a card template of the content display card.

Optionally, the first setting module 902 includes:

and the first conversion unit is used for converting the business data corresponding to the card component into the component display data through a data conversion interface based on a data conversion method contained in the template generation instruction.

Optionally, the first conversion unit is further configured to:

acquiring conversion logic for converting the service data into the component display data through a data conversion function in the data conversion interface;

and converting the business data corresponding to the card component into the component display data according to the conversion logic by using the data conversion method.

Optionally, the apparatus further comprises:

and the second setting module is used for setting an updating mark for the card assembly based on the template generation instruction, wherein the updating mark is used for indicating the updating mode of the card content in the card assembly.

Optionally, the apparatus further comprises:

and the third setting module is used for setting a preset embedding point for the card assembly based on the template generation instruction, wherein the preset embedding point is used for indicating a trigger event corresponding to the trigger operation.

Optionally, the apparatus further comprises:

the third generation module is used for responding to a card component generation instruction and generating a custom card component based on the coding format of the card component in the card component library;

a fourth setting module, configured to set a custom data class and a custom data conversion class for the custom card assembly, where base classes of the custom data class and the custom data conversion class are the same as base classes corresponding to the card assemblies in the card assembly library;

and the adding module is used for adding the custom card assembly to the card assembly library.

Fig. 10 is a block diagram of a display device of a content presentation card according to an exemplary embodiment of the present application, where the display device includes:

a second generating module 1001, configured to create, in response to a card display instruction, a card assembly according to a card template in a current application scenario, where a content display card is composed of at least one card assembly, and different card assemblies are used to display card contents of different purposes;

the conversion module 1002 is configured to convert the received content to be displayed into the card content corresponding to the card assembly;

the display module 1003 is configured to construct the card assembly according to the card format indicated by the card template, and generate and display the content display card.

Optionally, the conversion module 1002 includes:

the acquisition unit is used for acquiring target service data corresponding to the target card assembly;

the determining unit is used for determining the target content to be displayed matched with the target service data;

and the binding unit is used for binding the target content to be displayed to the target card assembly.

Optionally, the binding unit is further configured to:

based on the data conversion method corresponding to the card assembly, the target content to be displayed is converted into card display data through a data conversion interface, the card display data are data required for displaying the card assembly, the data conversion interface comprises a data conversion function, and the data conversion function is used for indicating conversion logic for converting business data into the card display data.

Optionally, the apparatus further comprises:

the acquisition module is used for responding to a card updating instruction of the content display card and acquiring an updating mark of each card assembly;

the first updating module is used for responding to the card assembly being provided with the updating mark, and updating the card content in the card assembly according to the updating mode indicated by the updating mark;

a second update module to maintain the card content in the card assembly unchanged in response to the card assembly not having the update flag set.

Optionally, the apparatus further comprises:

the determining module is used for responding to triggering operation of a preset buried point in the card assembly and determining a triggering event based on the preset buried point;

and the response module is used for responding to the trigger event according to a preset mode.

To sum up, in the embodiment of the present application, carry out the elemental design to the card of content show card, make content show card constitute by card subassembly, load required card subassembly from the card subassembly storehouse when generating the card template, and the card content that corresponds is set up according to the card display data of each card subassembly, to the application program that contains different application scenes, need not to develop design content show card alone to every application scene, the development efficiency of application program has been improved, development cost is reduced, and with card display data and service data separation, the decoupling zero of card display data and service data has been realized when realizing data and content show card decoupling zero, the utilization ratio of card subassembly has been improved.

In the application stage, each card assembly is created based on the card template corresponding to the current application scene and corresponding card content is displayed, so that the content display card is generated and displayed.

In an exemplary embodiment, there is also provided a terminal including a processor and a memory, in which a computer program is stored, the computer program being loaded and executed by the processor to implement the method for generating a card template or the method for displaying a content presentation card as provided in the above embodiments.

The embodiment of the present application further provides a computer-readable storage medium, where at least one instruction is stored, and the at least one instruction is loaded and executed by a processor to implement the method for generating a card template or the method for displaying a content display card according to the above embodiments.

According to an aspect of the application, a computer program product or computer program is provided, comprising computer instructions, the computer instructions being stored in a computer readable storage medium. The processor of the computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the method for generating the card template or the method for displaying the content presentation card provided in the various alternative implementations of the above-mentioned aspects.

Those skilled in the art will recognize that, in one or more of the examples described above, the functions described in the embodiments of the present application may be implemented in hardware, software, firmware, or any combination thereof. When implemented in software, the functions may be stored on or transmitted over as one or more instructions or code on a computer-readable storage medium. Computer-readable storage media includes both computer storage media and communication media including any medium that facilitates transfer of a computer program from one place to another. A storage media may be any available media that can be accessed by a general purpose or special purpose computer.

The above description is only exemplary of the present application and should not be taken as limiting, as any modification, equivalent replacement, or improvement made within the spirit and principle of the present application should be included in the protection scope of the present application.

21页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:一种信息处理方法和装置

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!

技术分类