From c4176e46d8820fd649352f510c6e44156b5c9fe7 Mon Sep 17 00:00:00 2001 From: zhuzhenchao Date: Sat, 12 Nov 2016 14:26:32 +0800 Subject: [PATCH] add file --- .gitignore | 3 + handlers/__init__.py | 0 handlers/index.py | 24 ++ log.py | 46 +++ server.py | 46 +++ settings.py | 4 + static/img/banner.png | Bin 0 -> 20656 bytes static/js/tpl.js | 486 +++++++++++++++++++++++++++++++ templates/index.html | 551 +++++++++++++++++++++++++++++++++++ templates/webapp.html | 788 ++++++++++++++++++++++++++++++++++++++++++++++++++ url.py | 10 + 11 files changed, 1958 insertions(+) create mode 100644 .gitignore create mode 100644 handlers/__init__.py create mode 100644 handlers/index.py create mode 100644 log.py create mode 100644 server.py create mode 100644 settings.py create mode 100644 static/img/banner.png create mode 100644 static/js/tpl.js create mode 100644 templates/index.html create mode 100644 templates/webapp.html create mode 100644 url.py diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..5a46e5b --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +.idea/ +run/ +*.pyc diff --git a/handlers/__init__.py b/handlers/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/handlers/index.py b/handlers/index.py new file mode 100644 index 0000000..99e3b1d --- /dev/null +++ b/handlers/index.py @@ -0,0 +1,24 @@ +# coding: utf-8 + +import tornado.web + +class BaseHandler(tornado.web.RequestHandler): + + def __init__(self, *args, **kwargs): + super(BaseHandler, self).__init__(*args, **kwargs) + x_real_ip = self.request.headers.get("X-Real-IP") + self.remote_ip = self.request.remote_ip if not x_real_ip else x_real_ip + + def render(self, template_name, **kwargs): + super(BaseHandler, self).render(template_name, **kwargs) + +class IndexHandler(BaseHandler): + + def get(self): + return self.render('index.html') + + +class WebAppHandler(BaseHandler): + + def get(self): + return self.render('webapp.html') diff --git a/log.py b/log.py new file mode 100644 index 0000000..11aa4cd --- /dev/null +++ b/log.py @@ -0,0 +1,46 @@ +# coding: utf-8 + +from os import path +import logging.config + +def init_log(log_dir, debug=False): + if not path.exists(log_dir): + print 'log path is not exist:%s' % log_dir + exit(-1) + + config = { + 'version': 1, + 'disable_existing_loggers': False, + 'formatters': { + 'default': { + 'format': '%(levelname)s %(asctime)s %(module)s:%(funcName)s:%(lineno)d %(message)s' + }, + 'simple': { + 'format': '%(level)s %(message)s' + } + }, + 'handlers': { + 'console': { + 'level': 'DEBUG', + 'class': 'logging.StreamHandler', + 'formatter': 'default', + }, + 'file': { + 'level': 'DEBUG', + 'class': 'logging.handlers.RotatingFileHandler', + 'filename': path.join(log_dir, 'webapp.log'), + 'maxBytes': 1024 * 1024 * 50, + 'backupCount': 5, + 'formatter': 'default', + }, + }, + 'loggers': { + 'starmachine': { + 'handlers': ['console', 'file'], + 'level': 'DEBUG', + 'propagate': False, + }, + } + } + + logging.config.dictConfig(config) diff --git a/server.py b/server.py new file mode 100644 index 0000000..8012e14 --- /dev/null +++ b/server.py @@ -0,0 +1,46 @@ +# coding: utf-8 + +import os +import tornado.ioloop +import tornado.autoreload +import tornado.web +from tornado.options import define, options, parse_command_line +import settings +from log import init_log + + +def init_settings(): + # 加载环境配置项 + define('port', default=8080, type=int, help=u'监听端口') + define("log_dir", default='run', type=str, help=u'日志目录') + define('profile', default='local', type=str, help=u'运行配置') + + parse_command_line() + init_log(options.log_dir) + return options + +def start_application(): + from url import urls + log_dir = os.path.join(os.path.dirname(__file__), 'run') + application_settings = { + 'handlers': urls, + 'debug': settings.DEBUG, + 'template_path': os.path.join(os.path.dirname(__file__), 'templates'), + 'static_path': os.path.join(os.path.dirname(__file__), 'static'), + } + application = tornado.web.Application(**application_settings) + + print 'server on port %s' % settings.PORT + print 'server log on %s' % log_dir + + application.listen(settings.PORT) + io_loop = tornado.ioloop.IOLoop.instance() + + io_loop.start() + +def run(): + init_settings() + start_application() + +if __name__ == '__main__': + run() \ No newline at end of file diff --git a/settings.py b/settings.py new file mode 100644 index 0000000..b02cf8c --- /dev/null +++ b/settings.py @@ -0,0 +1,4 @@ +# coding: utf-8 + +DEBUG = True +PORT = 8080 \ No newline at end of file diff --git a/static/img/banner.png b/static/img/banner.png new file mode 100644 index 0000000000000000000000000000000000000000..5afdd0dd1a6f4080a8a41bde454f8f461344d265 GIT binary patch literal 20656 zcmeHuWn7f)5;q_z5{h(7Nq5JBL3fvgbVy1pwS<65ce5zn2+}PgNG**tNarH4rhs*IYCInfdchQ(b}JF4bK$G&BMw#b?@RXm{YKYZxvz z>hlfpmJAvi#bbx3Pc@aEK4sAKaJ6-Cwn0NP3{L^#8LBPMAZ4}|KDeB`&axX0+XUur z0hwQCxz^3+eSE}z_x`x7!>D3{trjEW$7hdph3?;V(1kjzT>E!Ik(Zs2R`6E#iNitt z3}U~1noge_&4p0g*OzYyS60!Uxwm^#wre;r5-o^g1)YrV4v<0hI2L!Nv91oo{_+G4 z-I!59s|0}uE9S4jXUOF*>uc1j1ZdWgFL}YZP~wL(=)tSUgvHM=f&(K4!q1;aRIh;_ z+ZN_wqIYRkS|Qbj>SEhPJ}pGVCWSG+k3q}($dd3Ffi_w_PyQALQ#crn%=a4lAhWKi zD@@rdv4qY{kJfbfL1LVd(Q?lhyZ5IV(y|ZPIeU8Ll=SQv8710Rt5p)+e}A>R;0JQ; z^$nDTS!`E>{>k=JYFU0yLwZ38*9|$#)V*}F-pUVVA`Opi<$v9&g+w4Ef@q0tHromT z2eg)NM<^LE(C*MDCa}C8Yku=iOK#-K#4zO9tbNpOkI1^BXEFEwb3D%)@nWTa&NDqF;u0iE!x6nby<@ z-^RI?oREoP#_-&UtZZOk?e;dgQtWW8Dec*mVw!pMkrw&+AnMs2XHUBLG1F55QPm-!3)&+d`OcR&8X zG}gEM(Mm_Y5c!>Nm$wnLdAtm-tV2M4Ie*__*-2?M^o5^AubNkaO!#l&#E<1VQ<2lp zVjqdd^Ay|xzWw|tMi$NCX=Z$1f2G%r=mQy-XJ5ceG$Kt{AH4fPuh+}gi`MlK3eW;> z>|_E^nBsDJ{~4Ag1sRkXoMjT;|bM6JQ>Iz2EWuKtO_+A#Wj}0 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i}Baf|*Tf#H8D|A$HcXXSsR>Hj&#{~Y80?}&lK5h(G9 V46b$JM??K6Jy(BL^~56d{{YfD6KDVc literal 0 HcmV?d00001 diff --git a/static/js/tpl.js b/static/js/tpl.js new file mode 100644 index 0000000..17b87fd --- /dev/null +++ b/static/js/tpl.js @@ -0,0 +1,486 @@ +$(function(){ + // 轮播图 +var mySwiper = new Swiper ('.swiper-container', { + direction: 'horizontal', + loop: true, + // 如果需要分页器 + pagination: '.swiper-pagination', + // 如果需要前进后退按钮 + nextButton: '.swiper-button-next', + prevButton: '.swiper-button-prev' +}); +$(".banner-wrap").height(window.innerWidth * 430 / 2732); + var pages = [1], + col = parseInt((+$('body').width() * 0.8 < 750 ? 750 : +$('body').width() * 0.8) / 227), + _template = '
  • ${app_name}' + + '

    ' + + '预览${copy}
  • ', + _cataData = {}, + _appData = {}, + cdnUrl="http://1251027630.cdn.myqcloud.com/1251027630/zhichi_frontend"; + getCategory(); + $('body').on('click', '#first-navs span', function(event) { + if($(this).hasClass('active')){ + return; + } + var cate = $(this).attr("data-cate"), + index = $(this).index(); + + $(this).addClass('active').siblings('.active').removeClass('active'); + $(".tpl-content").eq(index).addClass('active').siblings('.active').removeClass('active'); + if($(this).hasClass('js-uninitial')){ + $(this).removeClass('js-uninitial'); + if ($('.tpl-content.active .tpl-container').hasClass('js-requesting')) { + return; + }; + $('.tpl-content.active .tpl-container').addClass('js-requesting'); + getTpls(cate, index); + } + }).on('click','.tpl-sec-navs span' ,function(event) { + if($(this).hasClass('active')){ + return; + } + var cate = $(this).attr("data-cate"), + index = $("#first-navs .active").index(); + + $(this).addClass('active').siblings('.active').removeClass('active'); + pages[index] = 1; + $(".tpl-container").removeClass('js-no-more').eq(index).find('.js-tpl').remove(); + getTpls(cate, index); + }).on('click', '.choose-btn', function(event) { + // var appId = $(this).parent().parent().attr('data-id'); + // if($(this).hasClass('js-preview-btn')){ + // initialPreview(appId); + // $('#preview-tpl-dialog').show('slow'); + // $('#add-app-dialog').attr('data-id', appId).attr('data-color', ''); + // }else{ + // $('#add-app-dialog').attr('data-id', appId).attr('data-color', '').show('slow'); + // } + + var $li = $(this).closest('li'), + param = { + app_name : $li.children('.name').text(), + description: '' , + logo : cdnUrl + '/static/invitation/images/logo.png', + cover: cdnUrl + '/static/webapp/images/share_feng.jpg' , + f_app_id : $li.attr("data-id") + }; + addApp($(this) , param); + event.stopPropagation(); + }).on('click', '.code-mask', function(event) { + var appId = $(this).closest('li').attr('data-id'); + window.open('/webapp/?r=pc/Webapp/preview&id=' + appId +'&f_tpl=1'); + }).on('click', '.empty-tpl', function(event) { + // var appId = $(this).attr('data-id'); + // $('#add-app-dialog').attr('data-id', appId).attr('data-color', '').show('slow'); + var $li = $(this).closest('li'), + param = { + app_name : '我的应用', + description: '', + logo : cdnUrl + '/static/invitation/images/logo.png', + cover: cdnUrl + '/static/webapp/images/share_feng.jpg' + }; + addApp($(this) , param); + }) + + + function getCategory(){ + $ajax('/index.php?r=pc/AppData/AppCategoryList','get',{type : 0},'json', + function(data){ + if (data.status === 0) { + var categorys = data.data, + contentsStr = '', + firstCateStr = ''; + if(categorys.length){ + $(categorys).each(function(index, item) { + var secCates = item.cate, + contentStr = '
    ', + secCatesStr = ''; + + if(secCates.length > 0){ + secCatesStr += '全部'; + $(secCates).each(function(index, el) { + secCatesStr += ''+el.name+''; + }); + } + + firstCateStr += ''+item.name+'' + contentStr += secCatesStr + '
    • 空白模板

    '; + contentsStr += contentStr; + pages.push(1); + }); + + $('#first-navs').append(firstCateStr); + $('body').append(contentsStr); + if (window.location.hash == '#single') { + // 线上data-cate = 12 + $('#first-navs span[data-cate="12"]').trigger('click'); + }; + getTpls(categorys[0].id , 0); + }else{ + // 没有分类时 + $('#first-navs span').eq(0).trigger('click'); + } + }else{ + alertTip(data.data); + } + },function(data){ + alertTip(data.data); + }); + } + + function getTpls(cate, index){ + var $container = $('.tpl-container').eq(index), + param = {type: 0, page: pages[index], page_size: 20}; + + if(cate == -1){ + param.user = 1; + }else{ + param.cate_id = cate; + } + $ajax('/index.php?r=pc/AppData/AppTplList','get',param,'json', + function(data){ + if (data.status === 0) { + var tpls = data.data; + tpls.length && dealData(tpls, $container, index); + + pages[index]++; + if(data.is_more == 0){ + $container.addClass('js-no-more'); + } + }else{ + alertTip(data.data); + } + $container.removeClass('js-requesting'); + }, + function(data){ + alertTip(data.tpls); + $container.removeClass('js-requesting') + }); + } + + function dealData(tpls, $container, index){ + $container.find('.filler').remove(); + + var content = '', + addAmount = tpls.length, + curAmount = $container.find('.js-tpl').length, + temp = (addAmount+curAmount)%col, + fillerAmount = ( temp ? col : 0 ), // 需要增加的filler个数 + shadowLis = ''; + + $.each(tpls, function(i, item){ + content += ' ' + parseTemplate(item, index); + }); + for(var i=0; i复制'; + // }else{ + return '选择'; + // } + + default : + return data[$1]; + } + }); + return html; + } + + + // .on('click', '#group-page-container .group-nav', function(event) { + // // 组折叠 + // event.preventDefault(); + // var target = $(this).parent(); + // target.toggleClass('active'); + // }).on('click', '#group-page-container .page-nav', function(event) { + // if($(this).hasClass('active')){ + // return; + // } + // $('.page-nav.active').removeClass('active'); + // $(this).addClass('active'); + + // var router = $(this).attr('data-router'), + // $preview = $('#preview-iframe'), + // url = '/app?_app_id='+$('#add-app-dialog').attr('data-id')+'&router='+router, + // customFeature = _appData[router].customFeature; + + // if(customFeature.form){ + // url += '&detail=-1'; + // } + // $preview.attr('src',url); + // }).on('click', '.style-color-wrap li', function(event) { + // $(this).addClass('selected').siblings('.selected').removeClass('selected'); + // setColor($(this).attr('data-color')); + // }).on('click', '.zhichi-dialog .js-btn', function(event) { + // var type = $(this).attr('data-type'); + // switch (type){ + // case 'next': + // // $('#preview-tpl-dialog').hide(); + // $('#add-app-dialog').show(); + // break; + // case 'add': + // addApp($(this)); + // break; + // case 'cancel': + // $('#add-app-dialog').hide('slow'); + // break; + // } + // }).on('click', '.change-img-wrap', function(event) { + // // 初始化 打开我的图片 + // showImgResourceBox($(this).find('img')); + // }).on('click', '.style-palette li', function(event) { + // if(confirm('您确定要更换应用的风格颜色吗?此操作会影响该应用所有的顶部导航/底部导航/按钮/分类/标题/分割线。')){ + // color = $(this).attr('data-color'); + // me.savePage(); + // me.setStyleColor(); + // me.parsePage($('#group-page-container .page-nav.active').attr('data-router')); + // me.sthChange(); + // }else{ + // return false; + // } + // }); + // + $(window).scroll(function(event) { + var $content = $('.tpl-content.active'), + $container = $content.find('.tpl-container'); + if ($container.hasClass('js-requesting') || $container.hasClass('js-no-more')) { + return; + } + var scTop = $(this).scrollTop() + 50, + scheight = $(document).height() - $(this).height(); + if(scTop >= scheight){ + var index = $('#first-navs > .active').index(), + cate = $content.find('.tpl-sec-navs .active').attr('data-cate') || $('#first-navs > .active').attr('data-cate'); + $container.addClass('js-requesting'); + getTpls(cate, index); + } + }); + + // $('#preview-tpl-dialog').zDialog({ + // width: 720, + // height: 620, + // title: 'APP模板预览' + // }); + + // $('#add-app-dialog').zDialog({ + // width: 400, + // height: 403, + // title: '创建APP' + // }); + + $('#select-color-control').spectrum({ + chooseText: '确定', + cancelText: '取消', + showInput: true, + allowEmpty:false, + containerClassName: 'full-spectrum', + showInitial: true, + showPalette: false, + showSelectionPalette: false, + showAlpha: true, + maxPaletteSize: 10, + preferredFormat: 'hex', + localStorageKey: 'spectrum.demo', + change: function(color){ + setColor(color); + } + }); + + function setColor(color){ + var _color = new String(color), + appId = $('#add-app-dialog').attr('data-id'); + $('#add-app-dialog').attr('data-color', _color); + $('#preview-iframe').attr('src', '/app?_app_id='+appId+'&style_color='+encodeURIComponent(_color)); + } + + function initialPreview(appId){ + // 预览时 + var $preview = $('#preview-iframe'); + $preview.attr('src', '/app?_app_id='+appId); + + $ajax('/index.php?r=pc/AppData/detail','get',{app_id: appId},'json',function(data){ + if (data.status === 0) { + var info = data.data; + + _cataData = typeof info.cata_data === 'string' ? JSON.parse(info.cata_data) : info.cata_data; + _appData = typeof info.app_data === 'string' ? JSON.parse(info.app_data) : info.app_data; + + parseCata(); + }else{ + alertTip(data.data); + } + + }); + } + function parseCata(router){ + var cataStr = '', + targetRouter = router || 'page00', + cataDataContent = _cataData.data; + for(var cata in cataDataContent) { + if(cataDataContent[cata]){ + var pages = cataDataContent[cata].pages, + i = 0; + cataStr += '
  • '+cataDataContent[cata].group+'

  • '; + } + }; + $('#group-page-container').empty().append(cataStr); + $('#group-page-container .page-nav[data-router="'+targetRouter+'"]').addClass('active'); + } + function parsePageNavStr (router, title, name){ + var str = ''; + return str; + } + + function addApp($btn , param){ + if($btn.hasClass('requesting')){ + return; + } + // var name = $('#app-name').val(), + // description = $('#app-description').val(), + // logo = $('#app-logo').attr('src'), + // cover = $('#app-cover').attr('src'); + + // if(name.length<=0){ + // alertTip('请输入应用名'); + // $('#app-name').focus(); + // return; + // } + + // if(description.length<=0){ + // alertTip('请输入应用描述'); + // $('#app-description').focus(); + // return; + // } + // if(logo===cdnUrl+'/static/invitation/images/logo.png'){ + // alertTip('请上传logo'); + // return; + // } + // if(cover===cdnUrl+'/static/webapp/images/share_feng.jpg'){ + // alertTip('请上传封面'); + // return; + // } + + // var appId = $('#add-app-dialog').attr('data-id'), + // color = $('#add-app-dialog').attr('data-color'), + // param = { + // app_name : name, + // description: description, + // logo : logo, + // cover: cover, + // style_color: color + // }; + + // if(appId!='-1'){ + // // appId=='-1'的话 表示没有选择模版 + // param.f_app_id = appId; + // } + // if(color){ + // // 预览模版,有选择风格颜色并确定使用该模版时,需要把app里相关的组件变化做处理,并把修改后的app_data发给后台保存 + // setAppData(color); + // param.app_data = JSON.stringify(_appData); + // } + + $btn.addClass('requesting'); + $ajax('/index.php?r=pc/AppData/add','post', param,'json',function(data){ + $btn.removeClass('requesting'); + if (data.status === 0) { + window.location.href = '/index.php?r=pc/Webapp/edit&id='+data.data; + }else if (data.status === 2) { + loginFunc(); + $('.lr-mask').show('slow'); + } else if (data.status === 3){ + confirmTip({ + text : data.data, + ConfirmText:'立即升级', + CancelText: '暂不升级', + ConfirmFunction : function(){ + window.open('/index.php?r=pc/Index/appVipPacket'); + }, + CancelFunction : function(){ + + }, + CloseFunction : function(){ + + } + }) + } else { + alertTip(data.data); + } + }, + function(data){ + $btn.removeClass('requesting'); + alertTip(data.data); + }); + } + + function setAppData(color){ + for(var router in _appData){ + var eles = _appData[router].eles; + setAppEles(eles, color); + } + } + function setAppEles(eles, color){ + $(eles).each(function(index, ele) { + switch(ele.type){ + case 'top-nav': + case 'bottom-nav': + case 'button': + ele.style = ele.style || {}; + ele.style['background-color'] = color; + break; + case 'classify': + ele.customFeature = ele.customFeature || {}; + ele.customFeature['selectedColor'] = color; + break; + case 'breakline': + ele.style = ele.style || {}; + ele.style['border-color'] = color; + break; + case 'title-ele': + ele.customFeature = ele.customFeature || {}; + ele.customFeature['markColor'] = color; + break; + case 'static-vessel': + case 'free-vessel': + case 'list-vessel': + case 'dynamic-vessel': + case 'form-vessel': + setAppEles(ele.content, color); + break; + case 'layout-vessel': + setAppEles(ele.content.leftEles, color); + setAppEles(ele.content.rightEles, color); + break; + } + }); + } + + $("#add-label-span").on('click', function(event) { + $("#add-label").show(); + }); + $("#add-label").on('click', '.labelClose', function(event) { + $("#add-label").hide(); + }); + +}); \ No newline at end of file diff --git a/templates/index.html b/templates/index.html new file mode 100644 index 0000000..cc427eb --- /dev/null +++ b/templates/index.html @@ -0,0 +1,551 @@ + + + + + 小程序开发联盟 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    +
      +
    • + +

      影视小程序(微信标准)

      +
      + + 预览 + 选择 +
      +
    • +
    • + +

      商品售卖(可支付)

      +
      + + 预览 + 选择 +
      +
    • +
    • + +

      好新闻

      +
      + + 预览 + 选择 +
      +
    • +
    • + +

      旅游

      +
      + + 预览 + 选择 +
      +
    • +
    • + +

      双十一模板

      +
      + + 预览 + 选择 +
      +
    • +
    +
    + + \ No newline at end of file diff --git a/templates/webapp.html b/templates/webapp.html new file mode 100644 index 0000000..4d688b7 --- /dev/null +++ b/templates/webapp.html @@ -0,0 +1,788 @@ + + + + + 即速应用-预览 + + + + + + + + + + + + + + +
    + +
    +
    返回
    +
    + +
    +
    +
    +
    目录
    +
    机型
    +
    + 定制 + 客服 +
    +
    + + +
    + + + + + + +
    +
    +
    +
    + +
    注册
    +
    + +
    + + +
    +
    个人注册企业注册
    +
    + +

    微信扫码注册

    + +
    + + + + 获取验证码 + + +
    +
    +
    + + + + + 获取验证码 + +
    +
    注册
    +
    +
    +
    +
    手机找回通过邮箱找回
    +
    + + 获取验证码 + + + + +
    +
    +
    +
    +
    + + + + + + \ No newline at end of file diff --git a/url.py b/url.py new file mode 100644 index 0000000..bb2d12b --- /dev/null +++ b/url.py @@ -0,0 +1,10 @@ +# coding: utf-8 + +from handlers.index import IndexHandler, WebAppHandler + + +urls = [ + # 首页链接 + (r'/', IndexHandler), + (r'/webapp/$', WebAppHandler), +] \ No newline at end of file -- 2.0.0