11 changed files with 176 additions and 10 deletions
After Width: | Height: | Size: 4.2 KiB |
After Width: | Height: | Size: 4.2 KiB |
@ -0,0 +1,89 @@ |
|||||
|
const api = require('../../utils/mediateHypermarket') |
||||
|
Page({ |
||||
|
|
||||
|
/** |
||||
|
* 页面的初始数据 |
||||
|
*/ |
||||
|
data: { |
||||
|
pageIndex: 1, |
||||
|
pageSize: 10, |
||||
|
nodata: false, |
||||
|
loadMoreType: 'none', |
||||
|
loadMoreVisible: false, |
||||
|
isLoadMore: false, |
||||
|
modulelist: [], |
||||
|
pid: '1438320938730868737', |
||||
|
typeCode: 'MTCS' |
||||
|
}, |
||||
|
|
||||
|
/** |
||||
|
* 生命周期函数--监听页面加载 |
||||
|
*/ |
||||
|
onLoad: function (options) { |
||||
|
// this.modulelist()
|
||||
|
// wx.setNavigationBarTitle({
|
||||
|
// title: options.title
|
||||
|
// })
|
||||
|
this.getModuleList() |
||||
|
}, |
||||
|
// modulelist() {
|
||||
|
// let that = this;
|
||||
|
// api.modulelist(that.data.moduleCategory).then(function (res) {
|
||||
|
// that.setData({
|
||||
|
// modulelist: res.data,
|
||||
|
// })
|
||||
|
// console.log(that.data.modulelist)
|
||||
|
// })
|
||||
|
// },
|
||||
|
getModuleList() { |
||||
|
let params = { |
||||
|
pageIndex: this.data.pageIndex, |
||||
|
pageSize: this.data.pageSize, |
||||
|
// pid: this.data.pid
|
||||
|
typeCode: this.data.typeCode |
||||
|
} |
||||
|
api.getModuleList(params).then(res => { |
||||
|
console.log(res.data) |
||||
|
this.setData({ |
||||
|
modulelist: this.data.modulelist.concat(res.data), |
||||
|
loadMoreType: res.data.length === this.data.pageSize ? 'loading' : 'none', |
||||
|
loadMoreVisible: res.data.length === this.data.pageSize ? false : true |
||||
|
}) |
||||
|
if (this.data.modulelist.length == 0) {//没有值
|
||||
|
this.setData({ |
||||
|
nodata: true, |
||||
|
loadMoreType: 'none', |
||||
|
loadMoreVisible: false, |
||||
|
}) |
||||
|
} |
||||
|
}).catch(err => { |
||||
|
this.setData({ |
||||
|
modulelist: [], |
||||
|
nodata: true, |
||||
|
loadMoreType: 'none', |
||||
|
loadMoreVisible: false, |
||||
|
}) |
||||
|
console.log(err) |
||||
|
}) |
||||
|
}, |
||||
|
/** |
||||
|
* 页面上拉触底事件的处理函数 |
||||
|
*/ |
||||
|
onReachBottom: function () { |
||||
|
this.setData({ |
||||
|
loadMoreVisible: true |
||||
|
}) |
||||
|
if (this.data.loadMoreType === 'loading') { |
||||
|
this.setData({ |
||||
|
pageIndex: this.data.pageIndex + 1, |
||||
|
pageSize: this.data.pageSize, |
||||
|
}) |
||||
|
this.getModuleList() |
||||
|
} |
||||
|
}, |
||||
|
goDetails (e) { |
||||
|
wx.navigateTo({ |
||||
|
url: `/subpages/workTodo/pages/moduleList/moduleList?pid=${e.currentTarget.dataset.module.id}&typeCode=${e.currentTarget.dataset.module.typeCode}&name=${e.currentTarget.dataset.module.name}&style=${e.currentTarget.dataset.module.moduleStyle}`, |
||||
|
}) |
||||
|
} |
||||
|
}) |
@ -0,0 +1,9 @@ |
|||||
|
{ |
||||
|
"navigationBarTitleText": "矛调超市", |
||||
|
"navigationBarTextStyle": "white", |
||||
|
"navigationBarBackgroundColor": "#bb0300", |
||||
|
"usingComponents": { |
||||
|
"load-more": "/components/loadMore/loadMore", |
||||
|
"no-data":"/components/nodata/nodata" |
||||
|
} |
||||
|
} |
@ -0,0 +1,16 @@ |
|||||
|
<!--subpages/mediateHypermarket/page/index/index.wxml--> |
||||
|
<button class="index top" |
||||
|
hover-class="hover-btn" |
||||
|
bindtap="goDetails" |
||||
|
wx:for-item="item" |
||||
|
wx:key="index" |
||||
|
wx:for-index="index" |
||||
|
wx:for="{{modulelist}}" |
||||
|
data-module="{{item}}"> |
||||
|
<image class="img-bj" src="{{item.imgUrl}}"></image> |
||||
|
<!-- {{item.name}} --> |
||||
|
</button> |
||||
|
|
||||
|
<!-- <load-more loadMoreType="{{loadMoreType}}" loadMoreVisible="{{loadMoreVisible && isLoadMore}}"></load-more> --> |
||||
|
|
||||
|
<no-data isShow="{{nodata}}"></no-data> |
@ -0,0 +1,37 @@ |
|||||
|
/* subpages/mediateHypermarket/page/index/index.wxss */ |
||||
|
.index { |
||||
|
width: calc(100% - 60rpx); |
||||
|
/* margin-top: 28rpx; */ |
||||
|
height: 300rpx; |
||||
|
line-height: 300rpx; |
||||
|
margin-left: 30rpx; |
||||
|
border-radius: 10rpx; |
||||
|
position: relative; |
||||
|
margin-bottom: 28rpx; |
||||
|
padding: 0; |
||||
|
background: #fff; |
||||
|
box-shadow: 0rpx 4rpx 14rpx 0rpx rgba(5, 5, 5, 0.4); |
||||
|
} |
||||
|
|
||||
|
button::after { |
||||
|
border: none; |
||||
|
} |
||||
|
|
||||
|
.hover-btn { |
||||
|
box-shadow: 0 0 10rpx rgba(63, 63, 63, 0.1); |
||||
|
} |
||||
|
|
||||
|
.index.top { |
||||
|
margin-top: 28rpx; |
||||
|
} |
||||
|
|
||||
|
.index .img-bj { |
||||
|
border-radius: 10rpx; |
||||
|
width: 100%; |
||||
|
height: 100%; |
||||
|
position: absolute; |
||||
|
top: 0; |
||||
|
left: 0; |
||||
|
z-index: 10; |
||||
|
} |
||||
|
|
@ -0,0 +1,5 @@ |
|||||
|
var request = require('../../../utils/request') |
||||
|
|
||||
|
export function getModuleList(params) { |
||||
|
return request.get('news/getModuleList', params) |
||||
|
} |
Loading…
Reference in new issue