12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970 |
- ;
- layui.define(['form','carousel','flow','laytpl'], function (e) {
- var s = layui.$,
- form = layui.form,
- flow = layui.flow,
- laytpl = layui.laytpl,
- carousel = layui.carousel;
- carousel.render({
- elem: '#index'
- ,width: '100%'
- ,height:s('body').width() *0.5
- ,arrow: 'none'
- });
- flow.load({
- elem: '.goods-list-recommend'
- ,done: function(page, next){
- s.post('/index/goods/load.html',{page:page,category:0},function(r){
- if (!r.code) {
- var tpl = s('#goods-list-recommend').html();
- laytpl(tpl).render(r.data, function(html){
- next(html, page < r.pages);
- })
- }else{
- layer.msg(r.msg)
- }
- });
- }
- });
- var home = function(){
- s('.layui-fluid').css('height',document.body.clientHeight+'px');
- if (s('.scroll').length > 0) {
- var head = document.getElementsByTagName('head')[0];
- var script = document.createElement('script');
- script.type = 'text/javascript';
- script.src = '/static/plugins/scroll/scroll.js';
- script.onload = script.onreadystatechange = function () {
- if (!this.readyState || this.readyState === "loaded" || this.readyState === "complete"){
- s('.scroll').myScroll({
- speed: 40,
- rowHeight: 32
- });
- script.onload = script.onreadystatechange = null;
- }
- };
- head.appendChild(script);
- }
- // home.prototype.dialognotice();
- }
- home.prototype.dialognotice = function() {
- layer.open({
- type: 1
- ,title: false
- ,closeBtn: false
- ,skin:'dialog-box'
- ,area: '300px;'
- ,shade: 0.8
- ,moveType: 1
- ,content: s('#dialognotice').html()
- ,success: function(layero){
- s('.layui-btn-confirm').on('click',function(){
- layer.closeAll()
- })
- }
- });
- };
- e('home',new home());
- })
|