10 changed files with 109 additions and 12 deletions
@ -1,5 +1,5 @@ |
|||||
<!--components/card/index.wxml--> |
<!--components/card/index.wxml--> |
||||
<view class="card tag-class" bindtap="onTap"> |
<view class="card tag-class" bindtap="onTap"> |
||||
<image class="card_logo" src="{{image.length > 0 ? image : '/images/temp_1.png'}}"/> |
<image class="card_logo" mode="aspectFill" src="{{image.length > 0 ? image : '/images/temp_1.png'}}"/> |
||||
<view class="card_title">{{title}}</view> |
<view class="card_title">{{title}}</view> |
||||
</view> |
</view> |
||||
|
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 45 KiB |
@ -0,0 +1,74 @@ |
|||||
|
// pages/billboards/park/park-category/index.js
|
||||
|
|
||||
|
import { BillboardModel } from '../../../../models/billboard.js' |
||||
|
|
||||
|
let billboard = new BillboardModel() |
||||
|
|
||||
|
Page({ |
||||
|
|
||||
|
/** |
||||
|
* 页面的初始数据 |
||||
|
*/ |
||||
|
data: { |
||||
|
list: [] |
||||
|
}, |
||||
|
|
||||
|
/** |
||||
|
* 生命周期函数--监听页面加载 |
||||
|
*/ |
||||
|
onLoad: function (options) { |
||||
|
|
||||
|
}, |
||||
|
fetchList() { |
||||
|
const { curCode } = this.data |
||||
|
const page = this.data.currPage |
||||
|
billboard.fetchBailList(curCode, page, res => { |
||||
|
console.log(res) |
||||
|
const datas = res.list |
||||
|
let tempDatas = [] |
||||
|
datas.forEach(item => { |
||||
|
tempDatas.push({ |
||||
|
id: item.id, |
||||
|
title: item.title, |
||||
|
image: item.titlePic |
||||
|
}) |
||||
|
}) |
||||
|
if (page == 1) { |
||||
|
this.setData({ |
||||
|
list: tempDatas |
||||
|
}) |
||||
|
} else { |
||||
|
if (tempDatas.length > 0) { |
||||
|
const list = [...this.data.list, ...tempDatas] |
||||
|
this.setData({ |
||||
|
list: list |
||||
|
}) |
||||
|
} else { |
||||
|
const page = this.data.currPage - 1 |
||||
|
this.setData({ |
||||
|
currPage: page |
||||
|
}) |
||||
|
wx.showToast({ |
||||
|
title: '已加载全部', |
||||
|
icon: 'none' |
||||
|
}) |
||||
|
} |
||||
|
} |
||||
|
wx.stopPullDownRefresh() |
||||
|
}) |
||||
|
}, |
||||
|
// 获取分类Tags
|
||||
|
fetchTags() { |
||||
|
billboard.fetchTagsByCode('sc-zdqy', res => { |
||||
|
console.log(res) |
||||
|
const tags = res.result.records |
||||
|
const navs = tags.map(item => item.name) |
||||
|
this.setData({ |
||||
|
navs: navs, |
||||
|
tags: tags, |
||||
|
curCode: tags.length > 0 ? tags[0].code : '' |
||||
|
}) |
||||
|
this.fetchList() |
||||
|
}) |
||||
|
}, |
||||
|
}) |
@ -0,0 +1,3 @@ |
|||||
|
{ |
||||
|
"usingComponents": {} |
||||
|
} |
@ -0,0 +1,2 @@ |
|||||
|
<!--pages/billboards/park/park-category/index.wxml--> |
||||
|
<text>pages/billboards/park/park-category/index.wxml</text> |
@ -0,0 +1 @@ |
|||||
|
/* pages/billboards/park/park-category/index.wxss */ |
Loading…
Reference in new issue