diff --git a/README.md b/README.md index 68ac43e..22f7047 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,13 @@ #### 引言: 最近微信小程序爆火,顺势写了一个小demo,用了半天编码。结论是开发门槛降低,小程序更注重让开发者关注前端UI和交互。欢迎交流与提交~ +### 贡献者名单 +--- +| 时间 | 贡献者 | 贡献内容 | +|--------|------------|---------------| +| 2016.09.25 | JohnWang | 优化wx:for的使用,创建复用模板 | +| 2016.09.24 | JohnWang | 优化结构目录 | + ### 目录结构: --- 为了方便其他开发者学习和使用,拓展目录结构: @@ -21,4 +28,4 @@ ### 项目地址: --- -https://github.com/aidenzou/SmallApp \ No newline at end of file +https://github.com/aidenzou/SmallApp diff --git a/app.js b/app.js index d177875..af01e9c 100755 --- a/app.js +++ b/app.js @@ -2,16 +2,16 @@ App({ onLaunch: function () { console.log('App Launch') - //调用API从本地缓存中获取数据 + //调用API从本地缓存中获取数据 var logs = wx.getStorageSync('logs') || [] logs.unshift(Date.now()) wx.setStorageSync('logs', logs) }, - getUserInfo:function(cb){ + getUserInfo: function (cb) { var that = this - if(this.globalData.userInfo){ + if (this.globalData.userInfo) { typeof cb == "function" && cb(this.globalData.userInfo) - }else{ + } else { //调用登录接口 wx.login({ success: function () { @@ -31,7 +31,7 @@ App({ onHide: function () { console.log('App Hide') }, - globalData:{ - userInfo:null + globalData: { + userInfo: null } }) \ No newline at end of file diff --git a/app.json b/app.json index f26b49f..e418b0f 100755 --- a/app.json +++ b/app.json @@ -41,5 +41,11 @@ "text": "我的" }] }, + "networkTimeout": { + "request": 10000, + "connectSocket": 10000, + "uploadFile": 10000, + "downloadFile": 10000 + }, "debug": true } diff --git a/pages/i/index.js b/pages/i/index.js index 742395f..de94ff7 100755 --- a/pages/i/index.js +++ b/pages/i/index.js @@ -22,4 +22,4 @@ Page( { }) }) } -}) +}) \ No newline at end of file diff --git a/pages/i/index.wxml b/pages/i/index.wxml index 89f7e7c..796b50d 100755 --- a/pages/i/index.wxml +++ b/pages/i/index.wxml @@ -7,4 +7,4 @@ {{source}} - + \ No newline at end of file diff --git a/pages/index/index.js b/pages/index/index.js index c4ce5b4..670ed2f 100755 --- a/pages/index/index.js +++ b/pages/index/index.js @@ -3,48 +3,57 @@ var app = getApp() Page( { data: { + //向模板传入数据 // 轮播 - images: [ - 'https://hamlet.b0.upaiyun.com/1609/19171/2788065f96c04ad38c8db50ad723bc37.jpg!/fwfh/640x352/quality/80', - 'https://hamlet.b0.upaiyun.com/1609/23150/4cc74e62833e4cdaaec79f3a2ef256e5.jpg!/fwfh/640x352/quality/80', - 'https://hamlet.b0.upaiyun.com/1609/23150/4cc74e62833e4cdaaec79f3a2ef256e5.jpg!/fwfh/640x352/quality/80', - 'https://hamlet.b0.upaiyun.com/1609/20180/934270f1be264c63bfaf85b37e545928.jpg!/fwfh/640x352/quality/80', - 'https://hamlet.b0.upaiyun.com/1609/20171/77f7a3c93fd641bf95150501ef9a7cad.jpg!/fwfh/640x352/quality/80', - 'https://hamlet.b0.upaiyun.com/1609/19171/2788065f96c04ad38c8db50ad723bc37.jpg!/fwfh/640x352/quality/80', - 'https://hamlet.b0.upaiyun.com/1609/23171/70065cf9e45d46729ca51dec55d5f650.jpg!/fwfh/640x352/quality/80' - ], - indicatorDots: true, - vertical: false, - autoplay: true, - interval: 3000, - duration: 1200, + index_index_scroll_tmpl: { + images: [ + 'https://hamlet.b0.upaiyun.com/1609/19171/2788065f96c04ad38c8db50ad723bc37.jpg!/fwfh/640x352/quality/80', + 'https://hamlet.b0.upaiyun.com/1609/23150/4cc74e62833e4cdaaec79f3a2ef256e5.jpg!/fwfh/640x352/quality/80', + 'https://hamlet.b0.upaiyun.com/1609/23150/4cc74e62833e4cdaaec79f3a2ef256e5.jpg!/fwfh/640x352/quality/80', + 'https://hamlet.b0.upaiyun.com/1609/20180/934270f1be264c63bfaf85b37e545928.jpg!/fwfh/640x352/quality/80', + 'https://hamlet.b0.upaiyun.com/1609/20171/77f7a3c93fd641bf95150501ef9a7cad.jpg!/fwfh/640x352/quality/80', + 'https://hamlet.b0.upaiyun.com/1609/19171/2788065f96c04ad38c8db50ad723bc37.jpg!/fwfh/640x352/quality/80', + 'https://hamlet.b0.upaiyun.com/1609/23171/70065cf9e45d46729ca51dec55d5f650.jpg!/fwfh/640x352/quality/80' + ], + indicatorDots: true, + vertical: false, + autoplay: true, + interval: 3000, + duration: 1200 + }, // nav - navs: [ - { - image: 'https://m.youcai.xin/static/img/gravida.png', - text: '孕妇' - }, { - image: 'https://m.youcai.xin/static/img/confinement.png', - text: '月子' - }, { - image: 'https://m.youcai.xin/static/img/baby.png', - text: '幼儿' - }, { - image: 'https://m.youcai.xin/static/img/old.png', - text: '老人' - } - ], + index_index_navs_tmpl: { + navs: [ + { + image: 'https://m.youcai.xin/static/img/gravida.png', + text: '孕妇' + }, { + image: 'https://m.youcai.xin/static/img/confinement.png', + text: '月子' + }, { + image: 'https://m.youcai.xin/static/img/baby.png', + text: '幼儿' + }, { + image: 'https://m.youcai.xin/static/img/old.png', + text: '老人' + } + ] + }, + // item - items: [ - {image: 'https://hamlet.b0.upaiyun.com/1609/22111/fe8765fa7f2f48cd87760c10ddd20ae6.jpg'}, - {image: 'https://hamlet.b0.upaiyun.com/1609/22111/84439174cad04497beda3a076663beb4.jpg'}, - {image: 'https://hamlet.b0.upaiyun.com/1609/22111/1987d8eb8b1748368b7f2382332c9718.jpg'}, - {image: 'https://hamlet.b0.upaiyun.com/1609/22111/fe8765fa7f2f48cd87760c10ddd20ae6.jpg'}, - {image: 'https://hamlet.b0.upaiyun.com/1609/22111/fe8765fa7f2f48cd87760c10ddd20ae6.jpg'}, - {image: 'https://hamlet.b0.upaiyun.com/1609/22111/fe8765fa7f2f48cd87760c10ddd20ae6.jpg'}, - {image: 'https://hamlet.b0.upaiyun.com/1609/22111/fe8765fa7f2f48cd87760c10ddd20ae6.jpg'}, - {image: 'https://hamlet.b0.upaiyun.com/1609/22111/fe8765fa7f2f48cd87760c10ddd20ae6.jpg'} - ] + index_index_items_tmpl: { + items: [ + {image: 'https://hamlet.b0.upaiyun.com/1609/22111/fe8765fa7f2f48cd87760c10ddd20ae6.jpg'}, + {image: 'https://hamlet.b0.upaiyun.com/1609/22111/84439174cad04497beda3a076663beb4.jpg'}, + {image: 'https://hamlet.b0.upaiyun.com/1609/22111/1987d8eb8b1748368b7f2382332c9718.jpg'}, + {image: 'https://hamlet.b0.upaiyun.com/1609/22111/fe8765fa7f2f48cd87760c10ddd20ae6.jpg'}, + {image: 'https://hamlet.b0.upaiyun.com/1609/22111/fe8765fa7f2f48cd87760c10ddd20ae6.jpg'}, + {image: 'https://hamlet.b0.upaiyun.com/1609/22111/fe8765fa7f2f48cd87760c10ddd20ae6.jpg'}, + {image: 'https://hamlet.b0.upaiyun.com/1609/22111/fe8765fa7f2f48cd87760c10ddd20ae6.jpg'}, + {image: 'https://hamlet.b0.upaiyun.com/1609/22111/fe8765fa7f2f48cd87760c10ddd20ae6.jpg'} + ] + } + }, //事件处理函数 diff --git a/pages/index/index.wxml b/pages/index/index.wxml index 4ace76a..36bbf76 100755 --- a/pages/index/index.wxml +++ b/pages/index/index.wxml @@ -1,33 +1,20 @@ + + - - - - - - - +