diff --git a/images/common/line.png b/images/common/line.png new file mode 100644 index 0000000..ac1bac2 Binary files /dev/null and b/images/common/line.png differ diff --git a/models/billboard.js b/models/billboard.js index 2bff088..8e0b9a6 100644 --- a/models/billboard.js +++ b/models/billboard.js @@ -3,6 +3,7 @@ import {HTTP, Method} from '../utils/http.js' const BaillConst = { bail_list_url:'/api/content/getListByCode', bail_tag_url: '/api/apicategory/childList', // 获取子分类和标题 + category_artice_url: '/api/content/getOneListByCode' } class BillboardModel extends HTTP { constructor () { @@ -31,6 +32,17 @@ class BillboardModel extends HTTP { } this.request(params) } + fetchCategoryArtice(code, success) { + const params = { + url: BaillConst.category_artice_url, + success: success, + method: Method.POST, + data: { + typeCode: code + } + } + this.request(params) + } } export {BillboardModel} \ No newline at end of file diff --git a/pages/billboards/index.wxss b/pages/billboards/index.wxss index 9f814cb..cfdab7b 100644 --- a/pages/billboards/index.wxss +++ b/pages/billboards/index.wxss @@ -9,5 +9,5 @@ .billboard_item { margin-top: 25px; width: 90%; - height: 120px; + height: 130px; } \ No newline at end of file diff --git a/pages/billboards/park/index.js b/pages/billboards/park/index.js index db71e1e..0d403f3 100644 --- a/pages/billboards/park/index.js +++ b/pages/billboards/park/index.js @@ -16,10 +16,13 @@ Page({ }, onClickItem(e) { - const { code } = e.currentTarget.dataset + const { code, title } = e.currentTarget.dataset console.log(code) wx.navigateTo({ - url: '/pages/billboards/park/park-list/index?code=' + code, + url: '/pages/billboards/park/park-category/index?code=' + code + '&title=' + title, }) + // wx.navigateTo({ + // url: '/pages/billboards/park/park-list/index?code=' + code, + // }) }, }) \ No newline at end of file diff --git a/pages/billboards/park/index.wxml b/pages/billboards/park/index.wxml index 537b15f..89801ba 100644 --- a/pages/billboards/park/index.wxml +++ b/pages/billboards/park/index.wxml @@ -1,7 +1,7 @@ - - - - + + + + diff --git a/pages/billboards/park/park-category/index.js b/pages/billboards/park/park-category/index.js index 2198a57..779311b 100644 --- a/pages/billboards/park/park-category/index.js +++ b/pages/billboards/park/park-category/index.js @@ -10,19 +10,37 @@ Page({ * 页面的初始数据 */ data: { - list: [] + list: [], + curCode: '' // }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { - + const { code,title } = options + wx.setNavigationBarTitle({ + title: title, + }) + console.log(code) + this.setData({ + curCode: code, + }) + this.fetchTags() + }, + onTapMoreItem (e) { + const {code} = e.currentTarget.dataset + console.log(code) + }, + clickCardItem(e) { + console.log(e.detail) + const { id } = e.detail + wx.navigateTo({ + url: `/pages/article/index?id=${id}`, + }) }, - fetchList() { - const { curCode } = this.data - const page = this.data.currPage - billboard.fetchBailList(curCode, page, res => { + fetchList(code, index) { + billboard.fetchBailList(code, 1, res => { console.log(res) const datas = res.list let tempDatas = [] @@ -33,42 +51,27 @@ Page({ 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() + + this.setData({ + [`list[${index}].datas`]: tempDatas + }) }) }, // 获取分类Tags fetchTags() { - billboard.fetchTagsByCode('sc-zdqy', res => { + wx.showLoading({ + title: '加载中...', + }) + billboard.fetchTagsByCode(this.data.curCode, res => { console.log(res) - const tags = res.result.records - const navs = tags.map(item => item.name) + const categorys = res.result.records this.setData({ - navs: navs, - tags: tags, - curCode: tags.length > 0 ? tags[0].code : '' + list: categorys, + }) + categorys.forEach((item, index) => { + this.fetchList(item.code, index) }) - this.fetchList() + wx.hideLoading() }) }, }) \ No newline at end of file diff --git a/pages/billboards/park/park-category/index.json b/pages/billboards/park/park-category/index.json index 8835af0..b91cd77 100644 --- a/pages/billboards/park/park-category/index.json +++ b/pages/billboards/park/park-category/index.json @@ -1,3 +1,8 @@ { - "usingComponents": {} + "navigationBarTitleText": "平台载体", + "enablePullDownRefresh": false, + "usingComponents": { + "e-card": "/components/card/index", + "mp-cell": "/components/weui/cell/cell" + } } \ No newline at end of file diff --git a/pages/billboards/park/park-category/index.wxml b/pages/billboards/park/park-category/index.wxml index 43a67fc..b643f5e 100644 --- a/pages/billboards/park/park-category/index.wxml +++ b/pages/billboards/park/park-category/index.wxml @@ -1,2 +1,18 @@ - -pages/billboards/park/park-category/index.wxml + + + + + + {{item.name}} + + + + + + + + + 暂无数据 + \ No newline at end of file diff --git a/pages/billboards/park/park-category/index.wxss b/pages/billboards/park/park-category/index.wxss index 05e611d..2eade2f 100644 --- a/pages/billboards/park/park-category/index.wxss +++ b/pages/billboards/park/park-category/index.wxss @@ -1 +1,29 @@ -/* pages/billboards/park/park-category/index.wxss */ \ No newline at end of file +/* pages/billboards/park/index.wxss */ + +.categroy_card_wrapper .weui-cell__icon { + width: 14px; + height: 16px; + vertical-align: middle; +} +.categroy_card_wrapper .cell-item { + padding: 0 10px 10px 10px; +} +.card_list { + padding: 0 3vw; + display: flex; + flex-direction: row; + justify-content: space-between; + flex-wrap: wrap; +} +.e_card { + width: 45vw; + margin-bottom: 13px; +} +.page_empty { + width: 100%; + height: 100px; + margin-top: 20px; + font-size: 14px; + color: #aaa; + text-align: center; +} \ No newline at end of file