Iosclient Summer "animation House" activity project summary

Source: Internet
Author: User

The company that entered the internship, assigned the task on the first day. Start writing a Web page from scratch. Before you know some front-end knowledge. But the beginning of writing or encountered a lot of problems, internet companies to emphasize efficiency, there are deadline or more than a sense of urgency, and in the laboratory sheep state has a sharp contrast. Mentor, the product manager, the boss in the group and the intern colleagues all offered me a lot of help. This article summarizes the project summary for the first project that is completed independently.

is the on-line active interface effect.

as the saying goes, the 3rd when the judges were impressed. When Yue Timor looked at the project in June from the December perspective, the code was so bitter and so confusing that the code could be written. So starting from December, once again the code, another review, refactoring once code, in order to have a restudying. Solid foundation for improvement.

After refactoring the project page code address: http://download.csdn.net/detail/yingyiledi/8255887


Project Introduction

(i). Iqiyi iosclient Discovery-Development of the start page of the animation house activity on the activity page

The main requirements for the development of the event start page are:

The structure and layout of the basic page are realized according to the prototype diagram provided by the product party.

1. Content:

The page is divided into three blocks based on the prototype diagram:

    • Campaign map area.
    • Post a comment area;
    • Comment on the presentation list area.

Based on the analysis of structural structure and layout.

2. Structure (HTML):

HTML structure based on the content of analysis: The general rules are based on the combination of chunking and semantics.

    • The above three pieces of content are divided into three div packaging.
    • The Activity map area uses the background graph to write the HTML, comments the display list area, the user avatar takes the background chart method realizes.

3. Style (CSS):

    • According to the structure of the semantic tag constructed above. Combined with the prototype map, we use PS to construct the style layout of each data.

    • Style writing is set according to the box model (from Inside Out), floating, positioning.

4. Interaction (Js/jquery):

Infer user behavior interactions that need to be implemented based on the prototype diagram.

  Refactoring Technology implementation:

Because the page structure did not have a very good separation from the behavior. This reconstruction mainly reconstructs the separation of behavior and structure. Here we use the template engine templates method of underscore.

(1) List page template

<%_.each (data, function (item) {%>            <li class= "Comment-item" >                <div class= "User-info" style= " Background:url (' <%=item.imgUrl%> ') no-repeat 0 0;background-size:30px 30px; ">                    <span class=" User-id "> <%= item.userid%> </span>                    <span class=" Comment-time "> <%=item.createtime%> </span>                </div>                <p class= "comment-content" >                    <%= Item.content%>                </p>            </li>            <%});%>

(2) list page to get back-end data processing

The data is processed to fit the requirements of the template variable. The handler functions such as the following:

function Modifydata (data) {                 var innerdata = data.data.comments;                 var newdata = [];                 for (var i = 0; i < innerdata.length; i++) {                     newdata[i] = {};                     Newdata[i].content = innerdata[i].content;                     Newdata[i].imgurl = Innerdata[i].userinfo.icon;                     Newdata[i].userid = Innerdata[i].userinfo.uname;                     Newdata[i].createtime = FormatDate (new Date (Innerdata[i].addtime));                 }                 return newdata;             }

(3) render the data to the template and add it to the page

The core code is as follows. The main use of the template method:

data = modifydata (data);                     var template1 = _.template ($ ("#list-item-template"). html ());                     var str1 = template1 ({                         data:data                     });                     $ (". Comment-list ul"). Append (STR1);



(4) The parameters of parsing URL passing are constructed into objects, and the data is accessed by Ajax method. You need to read the status of the parameters passed by the URL. And passed to the Ajax parameters.


var therequest = new Object ();(function getrequest () {   var url = location.search;//Get URL in "?" Character string      if (Url.indexof ("?

")! =-1) { var str = url.substr (1); STRs = Str.split ("&"); for (var i = 0; i < strs.length; i + +) { Therequest[strs[i].split ("=") [0]]=unescape (Strs[i].split ("=") [1]); } } return therequest;}) ()//extract each of the parameters of the URL into the various parameters of the Ajax method


(5) Use of the page plug-in
The page plug-in is essentially a method of the object, where the object is the tag element of the application plug-in, and the plug-in as a method requires a number of parameters to be passed inside the function. The two elements that are passed in by the paging plug-in is the total length of the page content required. The other is the introduction of the paged plug-in initialization object. This object contains: Paging callback function, pagination initial page, the number of content per page, the previous page, the next page of descriptive narrative and so on.

And can be changed according to the page plug-in file initial value.

The key is the writing of the callback function, this function is the current number of pages, determines where to show how to show the problem, can be changed as required.

var optinit = {Callback:pageselectcallback,current_page:0,items_per_page:50,num_display_entries:10,num_edge_ Entries:2,prev_text: "Prev", Next_text: "Next"}$ ("#pagination"). Pagination (length, optinit); function Pageselectcallback (Page_index, JQ) {//Gets the number of list items displayed per page from the form var Max_elem = Math.min ((page_index+1) * items_per_page, length) ;//Returns the current entry page content with a smaller value for the maximum page content. Prevent overflow $ ("#Searchresult"). HTML ("");//Empty display value contents//Get load element for (Var i=page_index*items_per_page;i<max_elem;i++) {$ ("# SearchResult "). Append ($ (" #comentShow. Comentlist:eq ("+i+"). Clone ());//Very strange I two sides with a plus sign, display the content to be traversed, and copy append to the result, Here the clone guarantees that the appended copy}//block Click event return false;} Apply a paging plug-in


(b). Iqiyi iosclient Discovery-development of the page in the "Animated house" event in the event page

The main requirements in the event lottery are:

1. According to the prototype analysis of the page has two blocks: App download button box background map, award results and other text content.

Based on the analysis of structural structure and layout.

(iii). Iqiyi iosclient Discovery-development of "animation House" activity end page in the event page

1. According to the prototype diagram analysis of the page has two blocks: App download button box background map. Award-winning username single list.

Based on the analysis of structural structure and layout.

2. Interaction of user behavior based on prototype diagram

Join the interaction: from the background to remove the award-winning user corresponding information display.

The second to third page is made, because the page is the same as the one used in the first page. But the improvement is in accordance with the content, structure, style, the Order of interaction, step-by-step deduction, deduction to determine the technical solution. and start again. There is a significant improvement in efficiency.

Think first and then write the code.

23rd page faces improvements to the first page:

    • . Writing the content, structure, CSS, and JS analysis methods of the lottery and the end-of-event pages greatly improves efficiency and control.

    • The name of the page element is also semantically based on the content, and the downloaded TXT file looks at the frequently used naming.
    • The understanding of the product was added by the suggestion to the product manager for the prototype.

Personal Summary of the process of making Web pages get the prototype. First, there is an understanding of the content, structure, style and interaction of the prototype, and it is necessary to communicate with the Product manager for the prototype diagram.

1. Understand what the content is: categorize the content. (1). Static Content (2). interacting with the server content 2. Constructs the HTML semantic tag structure according to the content nature of the semantic affiliation(1) According to the content coupling situation, block processing div(2) Select labels according to the classification of the content and some logical relations. can refer to Blog Park article . (3) The semantic tag is divided into semantic class and ID according to whether there is generality. Naming to be concise, clear expression of content3. Layout determined according to the relevant label of the content(1) first determine the outermost absolute position layout format and the inner div layout floating or vertical format(2) Determine the border of each div border, margin and inner HTML, margin content(3) Determine the format of the inner text, background, form, etc. 4.js interaction (1) analyze the required interaction requirements and determine the objectives to be achieved throughout the process. (2) Refine the interaction process based on the interaction requirements. (3) Determine the technology used and the algorithms that may be used, based on the interaction process. (4) write the interactive code. the direction of personal improvementmaking a Web page is like writing a text, first determining the content, then determining the chapter, then the format. Are things that practice makes perfect.

There's no technical content.

  • Technical content is the discipline of semantic labeling, by looking at the template code and theoretical knowledge. and the name of the property, class.
  • (1) The length and layout of the CSS layout diagram upstream. Especially from the prototype map to find out the unreasonable place. (2) You should not dwell on the various pixel data in the page. (3) Learn to use adapter that is the content of the Base.css file. (4) and accumulate a CSS library of their own.
  • (1) JS technology content is to write a standard, readable code. (2) At the same time, accumulate some functions that implement frequently used content.

    (3) Deep understanding of the framework and the mechanism of plug-ins.

  • Consider the optimization of front-end development from a variety of browser adaptation perspectives.
  • Consider it from the perspective of the user experience. The implementation of the function. and an increase in efficiency problems (speed) such as Ajax reading data.
  • From the entire front-end of the production page process, the entire planning, the production process of product development.
  • Learn back-end interaction with the front end, especially the use of network-side Linux and SVN tool commands and browser debugging.
Refactoring Ideas The previous code version number. No matter the structure, style or behavior are not intensive and standardized. Through this refactoring. The HTML structure has been streamlined, especially the use of background maps, making the entire page structure more reasonable.

Iosclient Summer "animation House" activity project summary

Style, the use of PS accurate measurement of each data, and the prototype is highly unified. The behavior of the use of template and function block programming. Make the structure and behavior completely separate, the behavior logic is more clear and understandable. Facilitates post-maintenance.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.