Social media platform homepage selector generation method and device
By processing and filtering social media platform homepage data on the client, the number of requests to the back-end server is reduced, and the problems of high latency, large network overhead and high server pressure in the existing technology are solved, thereby improving user experience and management efficiency.
Patent Information
- Application Number
- CN202411844933.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-16
- Publication Date
- 2025-04-11
- Estimated Expiration
- 2044-12-16
AI Technical Summary
The existing technology has problems such as high latency, large network overhead and high server pressure in the management of social media platforms, resulting in poor user experience and excessive server burden.
All homepage information is obtained by sending a request to the backend server and performing data processing on the client, including deduplication of the platform list, creating filtered data arrays and implementing platform selection event processing, avoiding frequent network requests.
It reduces user waiting time, reduces network bandwidth consumption and server burden, and improves user experience and management efficiency.
Smart Images

Figure CN119336437B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of data processing technology, and in particular to a method, device and electronic device for generating a homepage selector for a social media platform. Background Art
[0002] In modern web applications, data management and presentation is one of the core functions. Users often need to filter and view specific information from a large amount of data. For example, in a content management system (CMS), an administrator may need to manage multiple homepages, each of which may belong to a different platform (such as a social media platform, a blog platform, etc.). In order to improve user experience and management efficiency, there needs to be an efficient way to manage and present this data.
[0003] The traditional approach is to send a request to the backend to obtain the filtered data each time the user selects a different filtering condition. This approach has the following problems:
[0004] High latency: Each screening process requires waiting for a response from the backend, which increases the user's waiting time.
[0005] High network overhead: Frequent network requests consume a lot of bandwidth resources.
[0006] High server pressure: The backend server needs to process screening requests frequently, which increases the burden on the server.
[0007] The above problems become technical problems that need to be solved. Summary of the invention
[0008] In view of this, an embodiment of the present invention provides a method, device and electronic device for generating a homepage selector for a social media platform, which at least partially solve the problems existing in the prior art.
[0009] In a first aspect, an embodiment of the present invention provides a method for generating a social media platform homepage selector, comprising:
[0010] Get all home page information by sending a request to the backend server, and store all the obtained home page information in the array allPageArr;
[0011] Traverse the array allPageArr, extract the platform name corresponding to each homepage, and use the JavaScript Set object to remove duplicate platform names to form a platform list platformArr without duplicate items;
[0012] Create a variable listArr to store the homepage data to be displayed in the list. The variable listArr changes with the user's filtering operation.
[0013] Insert an all field at the beginning of platformArr, which represents all platforms by default. Use platformArr to render each platform at the top of the homepage selector drop-down box, add a click event for each platform, and set the value of listArr to allPageArr by default.
[0014] When the user clicks on a social media platform, the content of listArr is updated according to the user's selection. If the user selects "all", the value of allPageArr is assigned to listArr to display all homepages. If the user selects a specific platform, all homepages under that specific platform are filtered out from allPageArr and the result is assigned to listArr. The homepage list is displayed on the update page so that the homepage list reflects the latest listArr status.
[0015] According to a specific implementation of an embodiment of the present invention, the method of acquiring all homepage information by sending a request to a backend server and storing all acquired homepage information in an array allPageArr includes:
[0016] The client sends an HTTP request to the backend server to obtain all registered homepage information in the system;
[0017] After receiving the request, the backend queries the database and collects relevant information of all homepages. The backend organizes the relevant information into structured response data and returns it to the client through HTTP response.
[0018] According to a specific implementation of an embodiment of the present invention, the method of acquiring all homepage information by sending a request to a backend server and storing all acquired homepage information in an array allPageArr also includes:
[0019] The client parses the received response data. After parsing, the client verifies the integrity and correctness of the parsed data.
[0020] Store the parsed and validated data into the array of allPageArr.
[0021] According to a specific implementation of an embodiment of the present invention, the array allPageArr is traversed to extract the platform name corresponding to each homepage, and the platform names are deduplicated through the JavaScript Set object to form a platform list platformArr without duplicate items, including:
[0022] Define an empty Set object to store the platform name;
[0023] Use a loop statement to iterate over each element in the allPageArr array. In each iteration, extract the value of the platform attribute from the current home page object as the platform name.
[0024] Add the extracted platform name to the Set object.
[0025] According to a specific implementation of an embodiment of the present invention, the traversal of the array allPageArr, extracting the platform name corresponding to each homepage, and removing duplicates from these platform names through a JavaScript Set object to form a platform list platformArr without duplicates, further includes:
[0026] Convert the Set object to an array platformArr and insert a special option "all" at the beginning of the platformArr array to indicate all platforms.
[0027] According to a specific implementation of an embodiment of the present invention, the variable listArr is created to store the homepage data to be finally displayed in the list, including:
[0028] Define a variable listArr to store the home page data to be displayed in the list. When initializing, set listArr to allPageArr;
[0029] Use the listArr array to render the initial home page list on the user interface.
[0030] According to a specific implementation of an embodiment of the present invention, using platformArr to render each platform at the top of the homepage selector drop-down box and adding a click event for each platform includes:
[0031] Create one <select>Element, and set a unique one for it, traverse the platformArr array, and create one for each platform name <option>element, each< / option> <option> Elements added to< / option> < / select> in the elements;
[0032] Set the default selection in the drop-down box to "all", which means that all home pages are displayed in the initial state. <option> For items in the element whose value is "all", set the< / option> <option>The element's selected attribute is true;
[0033] Traverse the platformArr array and create a click event processing function for each platform name. In the click event processing function, get the platform name selected by the user, and filter out the corresponding homepage data from allPageArr based on the platform name selected by the user.
[0034] According to a specific implementation of an embodiment of the present invention, when a user clicks on a social media platform, updating the content of listArr according to the user's selection includes:
[0035] If the user selects "all", set listArr to allPageArr;
[0036] If the user selects a specific platform name, all homepages of the platform are filtered out from allPageArr and the result is assigned to listArr.
[0037] In a second aspect, an embodiment of the present invention provides a device for generating a social media platform homepage selector, comprising:
[0038] The acquisition module obtains all homepage information by sending a request to the backend server and stores all the obtained homepage information in the array allPageArr;
[0039] The extraction module traverses the array allPageArr, extracts the platform name corresponding to each homepage, and removes duplicates from these platform names through the JavaScript Set object to form a platform list platformArr without duplicates;
[0040] Create a module and a variable listArr to store the homepage data to be displayed in the list. The variable listArr changes with the user's filtering operation.
[0041] Insert the module, insert a field named all at the beginning of platformArr, which represents all platforms by default, use platformArr to render each platform at the top of the homepage selector drop-down box, add a click event for each platform, and set the value of listArr to allPageArr by default;
[0042] Display module, when the user clicks on a social media platform, the content of listArr is updated according to the user's selection. If the user selects "all", the value of allPageArr is assigned to listArr to display all homepages. If the user selects a specific platform, all homepages under the specific platform are filtered out from allPageArr and the result is assigned to listArr. The homepage list is displayed on the update page so that the homepage list reflects the latest listArr status.
[0043] In a third aspect, an embodiment of the present invention further provides an electronic device, the electronic device comprising:
[0044] at least one processor; and,
[0045] a memory communicatively connected to the at least one processor; wherein,
[0046] The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to execute the social media platform homepage selector generation method in any of the aforementioned first aspects or any of the implementations of the first aspect.
[0047] In a fourth aspect, an embodiment of the present invention further provides a non-transitory computer-readable storage medium, which stores computer instructions, and the computer instructions are used to enable the computer to execute the method for generating a social media platform homepage selector in the aforementioned first aspect or any implementation of the first aspect.
[0048] In a fifth aspect, an embodiment of the present invention further provides a computer program product, which includes a computer program stored on a non-transitory computer-readable storage medium, and the computer program includes program instructions. When the program instructions are executed by a computer, the computer executes the method for generating a social media platform homepage selector in the aforementioned first aspect or any implementation of the first aspect.
[0049] The social media platform homepage selector generation scheme in the embodiment of the present invention includes: obtaining all homepage information by sending a request to a backend server, and storing all the obtained homepage information in an array allPageArr; traversing the array allPageArr, extracting the platform name corresponding to each homepage, and removing the duplicates of these platform names through a JavaScript Set object to form a platform list platformArr without duplicates; creating a variable listArr for storing the homepage data to be finally displayed in the list, and the variable listArr changes with the user's filtering operation; inserting a default representing all platforms at the beginning position in platformArr. all field, use platformArr to render each platform at the top of the homepage selector drop-down box, add a click event for each platform, and set the value of listArr to allPageArr by default; when the user clicks on a social media platform, update the content of listArr according to the user's choice. If the user selects "all", assign the value of allPageArr to listArr to display all homepages. If the user selects a specific platform, filter all homepages under the specific platform from allPageArr, assign the result to listArr, and display the homepage list on the update page so that the homepage list reflects the latest listArr status. This solution can avoid requesting data from the backend again when switching platforms, and can submit response speed, thereby improving user experience. BRIEF DESCRIPTION OF THE DRAWINGS
[0050] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0051] Figure 1 A schematic diagram of a flow chart of a method for generating a homepage selector for a social media platform provided by an embodiment of the present invention;
[0052] Figure 2 A schematic flow chart of another method for generating a social media platform homepage selector provided by an embodiment of the present invention;
[0053] Figure 3 A schematic diagram of the structure of a device for generating a homepage selector for a social media platform provided by an embodiment of the present invention;
[0054] Figure 4 A schematic diagram of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0055] The embodiments of the present invention are described in detail below with reference to the accompanying drawings.
[0056] The following describes the embodiments of the present disclosure through specific examples, and those skilled in the art can easily understand other advantages and effects of the present disclosure from the contents disclosed in this specification. Obviously, the described embodiments are only a part of the embodiments of the present disclosure, rather than all of the embodiments. The present disclosure can also be implemented or applied through other different specific embodiments, and the details in this specification can also be modified or changed in various ways based on different viewpoints and applications without departing from the spirit of the present disclosure. It should be noted that the following embodiments and features in the embodiments can be combined with each other without conflict. Based on the embodiments in the present disclosure, all other embodiments obtained by ordinary technicians in the field without making creative work are within the scope of protection of the present disclosure.
[0057] It should be noted that various aspects of the embodiments within the scope of the appended claims are described below. It should be apparent that the aspects described herein may be embodied in a wide variety of forms, and any specific structure and / or function described herein is merely illustrative. Based on the present disclosure, it should be understood by those skilled in the art that an aspect described herein may be implemented independently of any other aspect, and two or more of these aspects may be combined in various ways. For example, any number of aspects described herein may be used to implement the device and / or practice the method. In addition, other structures and / or functionalities other than one or more of the aspects described herein may be used to implement this device and / or practice this method.
[0058] It should also be noted that the illustrations provided in the following embodiments are only schematic illustrations of the basic concept of the present disclosure. The drawings only show components related to the present disclosure rather than being drawn according to the number, shape and size of components in actual implementation. In actual implementation, the type, quantity and proportion of each component may be changed arbitrarily, and the component layout may also be more complicated.
[0059] Additionally, in the following description, specific details are provided to facilitate a thorough understanding of the examples. However, it will be understood by those skilled in the art that the aspects described may be practiced without these specific details.
[0060] The embodiment of the present disclosure provides a method for generating a homepage selector for a social media platform. The method for generating a homepage selector for a social media platform provided in this embodiment can be executed by a computing device, which can be implemented as software, or as a combination of software and hardware, and which can be integrated in a server, a terminal device, etc.
[0061] See also Figure 1 and Figure 2 , an embodiment of the present disclosure provides a method for generating a social media platform homepage selector, including:
[0062] S101, obtain all homepage information by sending a request to the backend server, and store all the obtained homepage information in the array allPageArr.
[0063] An HTTP request can be constructed to obtain all homepage information from the backend server. The URL of the request can be, for example, / api / pages. After sending the request, wait for the backend server to return a response, and the response data can be parsed from JSON format into a JavaScript object or array.
[0064] An empty array allPageArr can be defined to store the homepage information obtained from the backend, and the parsed homepage information data can be filled into allPageArr.
[0065] S102, traverse the array allPageArr, extract the platform name corresponding to each homepage, and remove duplicates from these platform names through the Set object of JavaScript to form a platform list platformArr without duplicate items.
[0066] An empty Set object can be created to store the platform name, for example: let platformSet = new Set().
[0067] Use a loop statement to traverse each element in the allPageArr array, for example: for (let i = 0; i < allPageArr.length; i++) {...}, and in each iteration, extract the value of the platform property from the current homepage object.
[0068] Next, add the extracted platform name to the Set object, and convert the Set object to an array platformArr, for example: let platformArr = Array.from(platformSet).
[0069] Insert a special option "all" at the beginning of the platformArr array, for example: platformArr.unshift("all");
[0070] Through the above steps, the array allPageArr can be traversed, the platform name corresponding to each homepage can be extracted, and duplicates can be removed from these platform names through the Set object of JavaScript to form a platform list platformArr without duplicate items. This list can be used for the platform filtering function on the user interface.
[0071] S103, creating a variable listArr for storing the homepage data to be finally displayed in the list, and the variable listArr changes with the user's screening operation.
[0072] You can create a variable listArr to store the home page data to be displayed in the list. When initializing, set listArr to allPageArr, which means that all home pages are displayed by default.
[0073] Create a drop-down selector in the user interface (e.g. <select>Element), used to display platform options, traverse the platformArr array, and create one for each platform name <option>element, and add it to the drop-down selector, setting the default selected item of the drop-down selector to "all".
[0074] S104, insert an all field that represents all platforms by default at the beginning of platformArr, use platformArr to render each platform at the top of the homepage selector drop-down box, add a click event for each platform, and set the value of listArr to allPageArr by default.
[0075] In the process of building a homepage selector, you first need to insert a special entry at the beginning of the platform list platformArr - the all field representing all platforms. This is done to ensure that users have an option to view the homepage information of all platforms, rather than being limited to a specific platform. Next, use this updated platformArr to render each item in the homepage selector drop-down box, and add a click event listener for each option.
[0076] In the initial state, listArr is set to allPageArr containing all homepage information. When the page is loaded for the first time, the user will see a list of homepages for all platforms. This design ensures that users can obtain the most comprehensive information from the beginning, while providing the possibility of further filtering.
[0077] Every time a user clicks on a platform option in the drop-down box, the triggered click event will check which platform the user has selected. If it is all, no filtering will be done, and listArr will remain allPageArr; if it is another specific platform, the homepage information that meets the platform conditions will be filtered out from allPageArr, and listArr will be updated. Finally, the homepage list component on the page will be re-rendered according to the new listArr content to display the latest homepage list.
[0078] In the process of rendering each platform (for example, a social media platform) at the top of the homepage selector drop-down box using platformArr, the user can enter keywords in the filter box to achieve simultaneous filtering of multiple social media platforms, thereby improving the efficiency of selecting multiple platforms under the homepage selector. Specifically, the following steps may be included:
[0079] S1041, obtain the original social media platform value list Ve={Ve1, Ve2,...,Ve2} of all social media platforms A={a1, a2,..., an} contained in the filter box at one time. em}, by constructing a ternary filtering function group Fs={H(Ve), P(Ve), R(Ve)}, the original social media platform value list Ve is sorted to obtain a standard social media platform value list Va={Va1, Va2, ..., Vam}, where H(Ve)=log(1+f(Ve)) represents the popularity score of the social media platform value Ve, f(Ve) is the usage frequency of Ve in the past preset time period, P(Ve) represents the user's preference score for the social media platform value Ve, and R(Ve) represents the relevance score of the social media platform value Ve.
[0080] S1042, monitor the input content S of the user in the input box in real time, and construct a matching vector Pt=[Sm(Va,S),M(Va,S),|S|,T0] to match the input content S with the standard social media platform value list Va to obtain a matching degree M(Va,S)=Fp(Pt), where Sm(Va) is the similarity score between Va and S, M(Va,S) represents the matching degree between the social media platform value Va and the input string S, |S| represents the length of the input string, T0 is a preset threshold, and Fp is a matching degree calculation function.
[0081] A calculation formula can be set to calculate the similarity score Sm(Va,S):
[0082]
[0083] TF-IDF represents term frequency-inverse document frequency, and the matching degree M(Va,S) is calculated based on the matching degree between the social media platform value Va and the input content S. Finally, a preset threshold T0 is set to determine whether the matching degree reaches an acceptable standard.
[0084] A matching degree calculation function Fp(Pt) can be defined to calculate the final matching degree M(Va,S) based on the matching vector Pt:
[0085]
[0086] α1, β2, γ2, δ2 are weight coefficients, Lmax is the maximum input length, I(|S|≥T0) is an indicator function, if |S|≥T0, it returns 1, otherwise it returns 0.
[0087] S1043, according to the calculated matching degree M(Va, S), the input content S is classified into the corresponding social media platform name, and the drop-down box list is updated in descending order according to the matching degree, and the matched social media platform values are aggregated and displayed in units of social media platform names, and a click event is bound to each social media platform value. The click event record format is E={aj,Vaj,t,W(Vaj)}, aj represents the jth social media platform, Vaj represents the social media platform value of the jth social media platform, t represents the click time, W(Vaj) represents the dynamic adjustment value of the jth social media platform value, W(Vaj)=λ*F(Vaj)+(1-λ)*C(Vaj), C(Vaj) is the impact value of the user's historical selection behavior on Vaj, F(Vaj) is the impact value of the jth social media platform calculated based on the ternary filter function group Fs, and λ is the adjustment coefficient.
[0088] S1044, when it is detected that the user clicks on the social media platform value, the user's click behavior E is recorded, and the user selection state set U is updated according to the clicked social media platform value Va and its corresponding social media platform name a. If Va is not in U, Va is added to U, U=U∪{(a,Va)}; if Va is already in U, Va is removed from U, U=U\{(a,Va)}, \ represents the removal operation;
[0089] S1045, after the user triggers the confirmation operation, all selected social media platform values are collected, and the comprehensive weight of the selected social media platform value under each social media platform is calculated using the multi-factor comprehensive evaluation model G(a), and the social media platform values selected by the user are aggregated in units of social media platform names, and the aggregated data P={(a1,G(a1)),(a2,G(a2)),...,(al,G(al))} is submitted to the back-end interface for search and filtering operations.
[0090] Among them, the multi-factor comprehensive evaluation model G(a) is expressed as:
[0091]
[0092] is the sum of the products of the weights of all selected social media platform values and the heat scores, is the sum of the weights of all selected social media platform values
[0093] In this way, the homepage selector quickly selects multiple social media platforms and dynamically responds to user operations to provide a personalized homepage browsing experience.
[0094] S105, when the user clicks on a social media platform, the content of listArr is updated according to the user's selection. If the user selects "all", the value of allPageArr is assigned to listArr to display all homepages. If the user selects a specific platform, all homepages under the specific platform are filtered out from allPageArr, and the result is assigned to listArr. The homepage list is displayed on the update page so that the homepage list reflects the latest listArr status.
[0095] When the user clicks on a social media platform, the system will update the homepage list according to the user's specific selection. If the user selects the "all" option, meaning they wish to view all available homepages, the system will assign all previously acquired homepage information (i.e. allPageArr) to the list variable listArr used for display. In this way, the homepage list on the page will display all available homepage information.
[0096] Conversely, if the user selects a specific platform, the system will filter out all homepage information belonging to this platform from allPageArr, and assign the filtered results to listArr. Afterwards, the homepage list on the page will be updated to only display the homepage information belonging to the platform selected by the user.
[0097] Regardless of whether the user selects "all" or a specific platform, the system will ensure that the homepage list can promptly reflect the latest listArr status, thereby providing the user with accurate and relevant homepage information.This method not only improves the user experience, but also makes the homepage selection process more intuitive and efficient.
[0098] According to a specific implementation method of an embodiment of the present invention, the method of obtaining all homepage information by sending a request to the backend server and storing all the obtained homepage information in the array allPageArr includes:
[0099] sending an HTTP request to the backend server through the client to obtain all registered homepage information in the system;
[0100] after receiving the request, the backend queries the database to collect relevant information of all homepages, and the backend organizes the relevant information into structured response data and returns it to the client through the HTTP response.
[0101] According to a specific implementation method of an embodiment of the present invention, the method of obtaining all homepage information by sending a request to the backend server and storing all the obtained homepage information in the array allPageArr also includes:
[0102] the client parses the received response data, and after the parsing is completed, the client verifies the integrity and correctness of the parsed data;
[0103] the parsed and verified data is stored in the array of allPageArr.
[0104] According to a specific implementation of an embodiment of the present invention, the method of traversing the array allPageArr, extracting the platform name corresponding to each homepage, and removing the duplicates of these platform names through the JavaScript Set object to form a platform list platformArr without duplicate items includes:
[0105] defining an empty Set object for storing platform names;
[0106] using a loop statement to traverse each element in the allPageArr array, and in each iteration, extracting the value of the platform attribute from the current homepage object as the platform name;
[0107] adding the extracted platform name to the Set object.
[0108] According to a specific implementation of an embodiment of the present invention, the method of traversing the array allPageArr, extracting the platform name corresponding to each homepage, and removing the duplicates of these platform names through the JavaScript Set object to form a platform list platformArr without duplicate items also includes:
[0109] converting the Set object into an array platformArr, and inserting a special option "all" at the beginning of the platformArr array to indicate all platforms.
[0110] According to a specific implementation method of an embodiment of the present invention, the creation of a variable listArr for storing the homepage data to be finally displayed in the list includes:
[0111] defining a variable listArr for storing the homepage data to be finally displayed in the list, and during initialization, setting listArr to allPageArr;
[0112] using the listArr array to render an initial homepage list on the user interface.
[0113] According to a specific implementation method of an embodiment of the present invention, using platformArr to render each platform at the top of the homepage selector drop-down box and adding a click event for each platform includes:
[0114] creating one.< / option> < / select> Element, and set a unique one for it, traverse the platformArr array, and create one for each platform name< / option> <option> element, each< / option> <option>Elements added to <select>
[0115] Set the default selected item in the drop-down box to "all", indicating that all homepages are displayed in the initial state. <option> For items in the element whose value is "all", set the< / option> <option>The selected attribute of the element is true;
[0116] Traverse the platformArr array and create a click event processing function for each platform name. In the click event processing function, obtain the platform name selected by the user, and filter the corresponding homepage data from allPageArr according to the platform name selected by the user.
[0117] According to a specific implementation method of an embodiment of the present invention, when the user clicks on a social media platform, the content of listArr is updated according to the user's selection, including:
[0118] If the user selects "all", listArr is set to allPageArr;
[0119] If the user selects a specific platform name, all homepages of the platform are filtered out from allPageArr, and the result is assigned to listArr.
[0120] Corresponding to the above method embodiment, referring to FIG3, the embodiment of the present invention further discloses a social media platform homepage selector generating device 30, including:
[0121] an acquisition module 301, which acquires all homepage information by sending a request to a backend server, and stores all acquired homepage information in an array allPageArr;
[0122] an extraction module 302, which traverses the array allPageArr, extracts the platform name corresponding to each homepage, and deduplicates these platform names through a JavaScript Set object to form a platform list platformArr without duplicate items;
[0123] a creation module 303, which creates a variable listArr for storing the homepage data to be finally displayed in the list, and the variable listArr changes with the user's screening operation;
[0124] an insertion module Block 304, inserts an all field which represents all platforms by default at the beginning of platformArr, uses platformArr to render each platform at the top of the homepage selector drop-down box, adds a click event for each platform, and sets the value of listArr to allPageArr by default;
[0125] Display module 305, when a user clicks on a social media platform, updates the content of listArr according to the user's selection. If the user selects "all", the value of allPageArr is assigned to listArr to display all homepages. If the user selects a specific platform, all homepages under the specific platform are filtered out from allPageArr, and the result is assigned to listArr. The homepage list is displayed on the update page so that the homepage list reflects the latest listArr status.
[0126] Referring to FIG. 4, an embodiment of the present invention further provides an electronic device 60, the electronic device comprising:
[0127] at least one processor; and,
[0128] a memory in communication with the at least one processor; wherein,
[0129] the memory stores instructions executable by the at least one processor, the instructions being executed by the at least one processor so that the at least one processor can execute the method for generating a social media platform homepage selector in the aforementioned method embodiment.
[0130] An embodiment of the present invention further provides a non-transitory computer-readable storage medium, the non-transitory computer-readable storage medium storing computer instructions, the computer instructions being used to enable the computer to execute the aforementioned method embodiment.
[0131] An embodiment of the present invention further provides a computer program product, the computer program product comprising a computer program stored on a non-transitory computer-readable storage medium, the computer program comprising program instructions, when the program instructions are executed by a computer, the computer is enabled to execute the method for generating a social media platform homepage selector in the aforementioned method embodiment.
[0132] Referring to FIG. 4 below, a schematic diagram of the structure of an electronic device 60 suitable for implementing an embodiment of the present disclosure is shown. The electronic device in the embodiment of the present disclosure may include but is not limited to mobile terminals such as mobile phones, laptop computers, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), vehicle-mounted terminals (such as vehicle-mounted navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc. The electronic device shown in FIG. 4 is only an example and should not impose any restrictions on the functions and scope of use of the embodiment of the present disclosure.
[0133] As shown in FIG. 4, the electronic device 60 may include a processing device (such as a central processing unit, a graphics processor, etc.) 601, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 602 or a program loaded from a storage device 608 to a random access memory (RAM) 603. In RAM 603, various programs and data required for the operation of the electronic device 60 are also stored. The processing device 601, ROM 602, and RAM 603 are connected to each other via a bus 604. An input / output (I / O) interface 605 is also connected to the bus 604.
[0134] Typically, the following devices may be connected to the I / O interface 605: input devices 606 including, for example, a touch screen, a touch pad, a keyboard, a mouse, an image sensor, a microphone, a response meter, a gyroscope, etc.; output devices 607 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; storage devices 608 including, for example, a magnetic tape, a hard disk, etc.; and communication devices 609. The communication device 609 may allow the electronic device 60 to communicate wirelessly or wired with other devices to exchange data. Although FIG. 4 shows an electronic device 60 with various devices, it should be understood that it is not required to implement or have all of the devices shown.More or fewer devices may be implemented or provided alternatively.
[0135] In particular, according to an embodiment of the present disclosure, the process described above with reference to the flowchart may be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication device 609, or installed from the storage device 608, or installed from the ROM 602. When the computer program is executed by the processing device 601, the above functions defined in the method of the embodiment of the present disclosure are executed.
[0136] The above description is only a specific embodiment of the present invention, but the protection scope of the present invention is not limited thereto. Any changes or substitutions that can be easily thought of by a technician familiar with the technical field within the technical scope disclosed by the present invention should be covered within the protection scope of the present invention. Therefore, the protection scope of the present invention should be based on the protection scope of the claims.< / option> < / select> < / option>
Claims
1. A method for generating a homepage selector for a social media platform, characterized in that: include: Get all home page information by sending a request to the backend server, and store all the obtained home page information in the array allPageArr; Traverse the array allPageArr, extract the platform name corresponding to each homepage, and use the JavaScript Set object to remove duplicate platform names to form a platform list platformArr without duplicate items; Create a variable listArr to store the homepage data to be displayed in the list. The variable listArr changes with the user's filtering operation. Insert an all field at the beginning of platformArr, which represents all platforms by default. Use platformArr to render each platform at the top of the homepage selector drop-down box, add a click event for each platform, and set the value of listArr to allPageArr by default. When the user clicks on a social media platform, the content of listArr is updated according to the user's selection. If the user selects "all", the value of allPageArr is assigned to listArr to display all homepages. If the user selects a specific platform, all homepages under that specific platform are filtered out from allPageArr and the result is assigned to listArr. The homepage list is displayed on the update page so that the homepage list reflects the latest listArr status.
2. The method according to claim 1, characterized in that: The method sends a request to the backend server to obtain all homepage information, and stores all the obtained homepage information in the array allPageArr, including: The client sends an HTTP request to the backend server to obtain all registered homepage information in the system; After receiving the request, the backend queries the database and collects relevant information of all homepages. The backend organizes the relevant information into structured response data and returns it to the client through HTTP response.
3. The method according to claim 2, characterized in that The method sends a request to the backend server to obtain all homepage information, and stores all the obtained homepage information in the array allPageArr, and also includes: The client parses the received response data. After parsing, the client verifies the integrity and correctness of the parsed data. Store the parsed and validated data into the array of allPageArr.
4. The method according to claim 3, characterized in that The array allPageArr is traversed to extract the platform name corresponding to each homepage, and the platform names are deduplicated through the JavaScript Set object to form a platform list platformArr without duplicate items, including: Define an empty Set object to store the platform name; Use a loop statement to iterate over each element in the allPageArr array. In each iteration, extract the value of the platform attribute from the current home page object as the platform name. Add the extracted platform name to the Set object.
5. The method according to claim 4, characterized in that The traversal of the array allPageArr, extracting the platform name corresponding to each homepage, removing duplicates from these platform names through the JavaScript Set object, and forming a platform list platformArr without duplicates, also includes: Convert the Set object to an array platformArr and insert a special option "all" at the beginning of the platformArr array to indicate all platforms.
6. The method according to claim 5, characterized in that The variable listArr is created to store the homepage data to be displayed in the list, including: Define a variable listArr to store the home page data to be displayed in the list. When initializing, set listArr to allPageArr; Use the listArr array to render the initial home page list on the user interface.
7. The method according to claim 6, characterized in that The platformArr is used to render each platform at the top of the home page selector drop-down box, and a click event is added for each platform, including: Create one <select>Elements, traverse the platformArr array, and create one for each platform name <option> element, each< / option> <option> Elements added to< / option> < / select> in the elements; Set the default selection in the drop-down box to "all", which means that all home pages are displayed in the initial state. <option> For items in the element whose value is "all", set the< / option> <option> The element's selected attribute is true;< / option> Traverse the platformArr array and create a click event processing function for each platform name. In the click event processing function, get the platform name selected by the user, and filter out the corresponding homepage data from allPageArr based on the platform name selected by the user.
8. The method according to claim 7, characterized in that When the user clicks on a social media platform, the content of listArr is updated according to the user's selection, including: If the user selects "all", set listArr to allPageArr; If the user selects a specific platform name, all homepages of the platform are filtered out from allPageArr and the result is assigned to listArr.
9. A device for generating a homepage selector for a social media platform, characterized in that: include: The acquisition module obtains all homepage information by sending a request to the backend server and stores all the obtained homepage information in the array allPageArr; The extraction module traverses the array allPageArr, extracts the platform name corresponding to each homepage, and removes duplicates from these platform names through the JavaScript Set object to form a platform list platformArr without duplicates; Create a module and a variable listArr to store the homepage data to be displayed in the list. The variable listArr changes with the user's filtering operation. Insert the module, insert a field named all at the beginning of platformArr, which represents all platforms by default, use platformArr to render each platform at the top of the homepage selector drop-down box, add a click event for each platform, and set the value of listArr to allPageArr by default; Display module, when the user clicks on a social media platform, the content of listArr is updated according to the user's selection. If the user selects "all", the value of allPageArr is assigned to listArr to display all homepages. If the user selects a specific platform, all homepages under the specific platform are filtered out from allPageArr and the result is assigned to listArr. The homepage list is displayed on the update page so that the homepage list reflects the latest listArr status.
10. An electronic device, characterized in that: The electronic device comprises: at least one processor; and, a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to execute the social media platform homepage selector generation method described in any one of claims 1 to 8.
Citation Information
Patent Citations
Page text content display method and device, equipment and storage medium
CN112765506A
Page management method and device, storage medium and equipment
CN114721648A