poster.html 4.31 KB
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="format-detection" content="telephone=no" />
    <meta name="msapplication-tap-highlight" content="no" />
    <!-- WARNING: for iOS 7, remove the width=device-width and height=device-height attributes. See https://issues.apache.org/jira/browse/CB-4323 -->
    <!-- <meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width, height=device-height, target-densitydpi=device-dpi" /> -->
    <meta content="width=device-width, initial-scale=1.0, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0" name="viewport" />
    <title>农丰网--专题</title>
    <link rel="stylesheet" href="../css/common.css">
    <link rel="stylesheet" href="../css/topic.css">
</head>

<body class="topicPage">
    <div class="m-page"></div>
    <script src="../js/jquery-2.1.3.min.js"></script>
    <script src="../js/underscore-min.js"></script>

    <script type="text/template" id="topicPageTmpl">
        <%if(wap){%>
            <header class="m-header header-light">
                <div class="head">
                    <a href="javascript:history.go(-1);" class="lt-bar m-icon icon-back">返回</a>
                    <h1><%=title%></h1>
                </div>
            </header>
        <%}%>
        <section class="m-content">
            <a href="http://mobapi.nong12.com/topic/html/index.html?source=wap&banner=<%=banner%>&modelCode=<%=modelCode%>" title="">
                <img src="<%=fullScreenBanner%>" alt="<%=title%>" class="full-banner">
            </a>
        </section>
        <a href="#" class="m-to-top"></a>
    </script>

    <script>
        $(function(){
            var Topic = {
				wap:false,
                initialize:function(){
                    this.render();
                },
                bindEvents:function(){
                    $(document).on('touchstart', '.back-to-top', function(e){
                        e.preventDefault();
                        $('body').animate({
                            scrollTop: 0
                        }, 300);
                    });
                },
                getParameterByName: function(name) {
                    name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
                    var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"),
                        results = regex.exec(location.search);
                    return results === null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));
                },
                render:function(){
                    var _this = this,
                        response = {},
                        source = this.getParameterByName('source'),
                        banner = this.getParameterByName('banner'),
                        fullScreenBanner = this.getParameterByName('fullScreenBanner'),
                        title = this.getParameterByName('title'),
                        modelCode =  this.getParameterByName('modelCode');

						if(source != '' && source.length > 0){
							if(source && source.toLowerCase() == 'wap'){
								this.wap = true;
							}
						}

                        if(title == '' && title.length <= 0){
                           title = '活动专题';
                        }

                        if(modelCode == '' || modelCode.length <= 0){
                            alert('模块id不能为空!');
                            return;
                        }

                        if(banner == '' || banner.length <= 0){
                            alert('专题banner图不能为空!');
                            return;
                        }

                        if(fullScreenBanner == '' || fullScreenBanner.length <= 0){
                            alert('专题全屏banner图不能为空!');
                            return;
                        }

                        response.wap = this.wap;
                        response.banner = banner;
                        response.title = title;
                        response.modelCode = modelCode;
                        response.fullScreenBanner = fullScreenBanner;
                        $('.m-page').html(_.template($('#topicPageTmpl').html())(response));
                }
            };
            Topic.initialize();
        });
    </script>
</body>

</html>