diff --git a/littleApp_child/app.json b/littleApp_child/app.json index 2587721..fabbb32 100644 --- a/littleApp_child/app.json +++ b/littleApp_child/app.json @@ -1,5 +1,6 @@ { "pages": [ + "pages/childcare_knowledge/childcare_knowledge", "pages/login/login", "pages/home/home", "pages/aboutThePrenatal/aboutThePrenatal", diff --git a/littleApp_child/pages/childcare_knowledge/childcare_knowledge.js b/littleApp_child/pages/childcare_knowledge/childcare_knowledge.js new file mode 100644 index 0000000..264f04e --- /dev/null +++ b/littleApp_child/pages/childcare_knowledge/childcare_knowledge.js @@ -0,0 +1,101 @@ +//articleLists.js 文章列表 +// 网络请求工具类 +var networkUtil = require('../../utils/network_util.js') +var api = require('../../utils/apiFile.js') +// 事件监听 +var event = require('../../utils/event.js') +var page +// 是否有更多 +var hasMore +var isRefresh + + +Page({ + data: { + list:[], + images: [ + 'http://img02.tooopen.com/images/20150928/tooopen_sy_143912755726.jpg', + 'http://img06.tooopen.com/images/20160818/tooopen_sy_175866434296.jpg', + 'http://img06.tooopen.com/images/20160818/tooopen_sy_175833047715.jpg' + ], + titles: ["日常护理", "营养美食", "疾病护理", "亲子互动", "言传qq"], + id:0, + category:'' + }, + onLoad: function (e) { + this.data.id = e.id + this.data.category = e.category + // 数据初始化 + page = 1 + hasMore = true + isRefresh = false + + // this.requestData() + + + }, + onUnload: function() { + + }, + /*---------事件处理函数--------*/ + bindViewTap: function() { + wx.navigateTo({ + url: '../home/home' + }) + }, + // 加载更多 + loadMore:function(e){ + if(!hasMore || isRefresh == true){ + return + } + page ++ + + this.requestData() + + }, + // 下拉刷新回调接口 + onPullDownRefresh: function() { + page = 1; + hasMore = true + // 网络请求,重新请求一遍数据 + this.requestData(); + }, + myScroll:function(e){ + if(e.detail.scrollTop >= e.detail.scrollHeight-wx.getSystemInfoSync().windowHeight - 3){ + this.loadMore() + } + }, + titleClick:function(e){ + console.log(e) + var index = e.currentTarget.dataset.index + }, + /*---------自定义函数--------*/ + requestData(id){ + var self = this + isRefresh = true + networkUtil.showLoading() + var param = {page:page,limit:15,type:getApp().globalData.userInfo.status,categoryId:self.data.id} + networkUtil._get(api.articleList,param,function(res){ + + isRefresh = false + var arr = [] + if(page > 0) {// 加载更多模式 + arr = self.data.list + } + if(res.data.data.length < 15){ + hasMore = false + } + arr = arr.concat(res.data.data) + var temp = self.data.category + self.setData({ + list:arr, + hasMore : hasMore, + category : temp + }) + },function(res){ + isRefresh = false + }) + }, + + +}) diff --git a/littleApp_child/pages/childcare_knowledge/childcare_knowledge.json b/littleApp_child/pages/childcare_knowledge/childcare_knowledge.json new file mode 100644 index 0000000..da7faa0 --- /dev/null +++ b/littleApp_child/pages/childcare_knowledge/childcare_knowledge.json @@ -0,0 +1,6 @@ +{ + "navigationBarBackgroundColor": "#f4879b", + "navigationBarTitleText": "育儿知识", + "navigationBarTextStyle": "white", + "backgroundColor": "#d8dbd4" +} \ No newline at end of file diff --git a/littleApp_child/pages/childcare_knowledge/childcare_knowledge.wxml b/littleApp_child/pages/childcare_knowledge/childcare_knowledge.wxml new file mode 100644 index 0000000..1f56881 --- /dev/null +++ b/littleApp_child/pages/childcare_knowledge/childcare_knowledge.wxml @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + + + + + + + {{item.title}} + + + {{item.introduction}} + + + + 加载更多... + + \ No newline at end of file diff --git a/littleApp_child/pages/childcare_knowledge/childcare_knowledge.wxss b/littleApp_child/pages/childcare_knowledge/childcare_knowledge.wxss new file mode 100644 index 0000000..c821e04 --- /dev/null +++ b/littleApp_child/pages/childcare_knowledge/childcare_knowledge.wxss @@ -0,0 +1,120 @@ +.title_scroll { + width: 95%; + margin-left: 40px; + position: relative; + /*可以滚动 */ + white-space: nowrap; + display: inline-block; +} + +/*隐藏Scrollview滚动条 */ + +::-webkit-scrollbar { + width: 0; + height: 0; + color: transparent; +} + +.scroll_title_label { + height: 40px; + margin-right: 30px; + text-align: left; + line-height: 40px; +} + +.search_img { + width: 20px; + height: 20px; + position: absolute; + margin-top: 11px; + margin-left: 10px; +} + +.home__list-item { + position: relative; + background: white; +} + +/*首页列表文章 item 的文章图片*/ + +.home__list__img { + width: 80px; + height: 100%; + vertical-align: top; + /*垂直居中*/ + display: flex; + justify-content: center; + align-items: Center; +} + +.home__list-item-content { + margin-left: 15px; +} + +/*首页列表文章 item 外层布局 右侧*/ + +.home__list-item__right { + width: 100%; + height: 32px; + /*background: darkcyan;*/ + position: relative; +} + +/*首页列表文章 item 内的title 布局*/ + +.home__list-item__title { + position: absolute; + top: 0px; + left: 0px; + right: 60px; + font-size: 14px; + color: #5e5e5e; + font: normal; +} + +/*首页列表文章 item 内的的点赞 布局*/ + +.home__list-item__like { + position: absolute; + top: 0px; + right: 0px; + /*垂直居中 + display: flex; + justify-content:center; + align-items:Center;*/ +} + +/*首页列表文章 item 内的点赞手图标*/ + +.home__list-item__title-like-icon { + position: absolute; + width: 10px; + height: 10px; + right: 0px; + left: 0px; + top: 7px; +} + +/*首页列表文章 item 内的的点赞 数*/ + +.home__list-item__title-like-count { + /*这个宽度设置后可以变化点赞数整个布局的位置前移后移*/ + width: 30px; + margin-left: 15px; + font-size: 10px; + margin-top: 4px; + color: #c8c6c6; + overflow: hidden; + text-overflow: ellipsis; +} + +/*item 分割线*/ + +.home__list-item__bottom { + position: absolute; + height: 1rpx; + background: #d8dbd4; + top: 0px; + left: 15px; + right: 15px; +} diff --git a/littleApp_child/pages/login/login.js b/littleApp_child/pages/login/login.js index 5bf4bac..eeb6a15 100644 --- a/littleApp_child/pages/login/login.js +++ b/littleApp_child/pages/login/login.js @@ -8,7 +8,7 @@ var timeCount = 60; var timer; var phone; var name; -var isFirst=true +var isFirst = true Page({ data: { inputFocus: { codeInput: false }, @@ -36,7 +36,7 @@ Page({ this.keepTime() } // if (numberUtil.IsTelPhoneNumber(phone)) { - + // } else { // wx.showToast({ // title: '请输入正确手机号码', @@ -69,6 +69,9 @@ Page({ // 提交表单 formSubmit: function (e) { + // wx.navigateTo({ + // url: '../childcare_knowledge/childcare_knowledge' + // }) var self = this if (e.detail.value.code == "") { wx.showModal({