From 386a66a3247c528777add8531b03fc1c2a5e07a0 Mon Sep 17 00:00:00 2001 From: zhangjing Date: Sat, 12 Aug 2023 14:42:34 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=B7=E6=A0=BC=E9=9A=90=E8=97=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app.json | 1 + pages/article/articleList/index.js | 92 ++++++++++++++++++++++++++++ pages/article/articleList/index.json | 3 + pages/article/articleList/index.wxml | 25 ++++++++ pages/article/articleList/index.wxss | 66 ++++++++++++++++++++ pages/mall/goods/index.wxml | 3 +- project.private.config.json | 2 +- 7 files changed, 190 insertions(+), 2 deletions(-) create mode 100644 pages/article/articleList/index.js create mode 100644 pages/article/articleList/index.json create mode 100644 pages/article/articleList/index.wxml create mode 100644 pages/article/articleList/index.wxss diff --git a/app.json b/app.json index bc85933..63f4b60 100644 --- a/app.json +++ b/app.json @@ -6,6 +6,7 @@ "pages/login/index", "pages/article/index", "pages/article/info/info", + "pages/article/articleList/index", "pages/member/open/open", "pages/login/agreement/agreement", "pages/stock/index", diff --git a/pages/article/articleList/index.js b/pages/article/articleList/index.js new file mode 100644 index 0000000..71a2032 --- /dev/null +++ b/pages/article/articleList/index.js @@ -0,0 +1,92 @@ + /* + * 手太欠 + * 愿这世界都如故事里一样 美好而动人~ + */ +Page({ + + /** + * 页面的初始数据 + */ + data: { + articlesArr : [] , //列表 + page : {}, //分页信息 + type : '', //类型 + name : '', //名称 + lodingStats : false, //加载状态 + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad(options) { + console.log(options) + this.setData({ + type: options.type + }) + if (options.type == '1') { + wx.setNavigationBarTitle({ + title: '锶源昆仑·记忆' + }) + this.setData({ + name: 'memory' + }) + } else if (options.type == '2') { + wx.setNavigationBarTitle({ + title: '锶源昆仑·健康百科' + }) + this.setData({ + name: 'wiki' + }) + } + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow() { + // 获取列表 + this.articlesInfo(); + }, + + // 列表 + articlesInfo(page){ + wx.$api.mall.articlesList({ + category_id : this.data.type, + page : page || 1 + }).then(res => { + let listArr = this.data.articlesArr, + newData = [] + if(page == 1 || page == undefined) listArr = [] + newData = listArr.concat(res.data.data) + this.setData({ + articlesArr : newData, + page : res.data.page, + lodingStats : false + }) + wx.stopPullDownRefresh() + }).catch(err => {}) + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh() { + // 获取列表 + this.articlesInfo(); + }, + + /** + * 上拉加载 + */ + onReachBottom(){ + this.setData({ + lodingStats: true + }) + let pageNumber = this.data.page.current + if(this.data.page.has_more){ + pageNumber++ + // 获取列表 + this.articlesInfo(pageNumber); + } + } +}) \ No newline at end of file diff --git a/pages/article/articleList/index.json b/pages/article/articleList/index.json new file mode 100644 index 0000000..3928faa --- /dev/null +++ b/pages/article/articleList/index.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/pages/article/articleList/index.wxml b/pages/article/articleList/index.wxml new file mode 100644 index 0000000..59702ee --- /dev/null +++ b/pages/article/articleList/index.wxml @@ -0,0 +1,25 @@ + + + + {{item.categories[0].slug}} | {{item.title}} + {{item.description}} + + {{item.clicks}} + {{item.subscribes}} + + + + + + + 加载中... + + + 没有更多了~ + + + + + + 暂无数据 + \ No newline at end of file diff --git a/pages/article/articleList/index.wxss b/pages/article/articleList/index.wxss new file mode 100644 index 0000000..4d5cdc1 --- /dev/null +++ b/pages/article/articleList/index.wxss @@ -0,0 +1,66 @@ +page { + padding: 30rpx; + box-sizing: border-box; + background-color: #f6f6f6; +} + +.item { + position: relative; + background-color: #ffffff; + border-radius: 10rpx; + height: 200rpx; + margin-bottom: 30rpx; +} + +.itemImg { + position: absolute; + right: 0; + top: 0; + width: 200rpx; + height: 200rpx; + border-radius: 10rpx; + overflow: hidden; +} + +.itemCont { + position: absolute; + left: 0; + top: 0; + padding: 25rpx 230rpx 0 30rpx; + box-sizing: border-box; + width: 100%; +} + +.itemCont-name { + font-size: 30rpx; +} + +.itemCont-name text { + text-transform: uppercase; +} + +.itemCont-text { + color: #999; + font-size: 26rpx; + margin: 15rpx 0 30rpx; + font-weight: 200; +} + +.itemCont-see { + color: #999; + display: flex; + font-size: 26rpx; + font-weight: 200; +} + +.itemCont-icon { + display: flex; + margin-right: 50rpx; + line-height: 26rpx; +} + +.itemCont-icon image { + width: 26rpx; + height: 26rpx; + margin-right: 10rpx; +} \ No newline at end of file diff --git a/pages/mall/goods/index.wxml b/pages/mall/goods/index.wxml index b1d4574..2707fa3 100644 --- a/pages/mall/goods/index.wxml +++ b/pages/mall/goods/index.wxml @@ -11,7 +11,8 @@ {{item.name}} {{item.description}} - ¥{{item.price.price_max}} + + diff --git a/project.private.config.json b/project.private.config.json index dbd17a1..9652704 100644 --- a/project.private.config.json +++ b/project.private.config.json @@ -1,6 +1,6 @@ { "description": "项目私有配置文件。此文件中的内容将覆盖 project.config.json 中的相同字段。项目的改动优先同步到此文件中。详见文档:https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html", - "projectname": "%E9%94%B6%E6%BA%90%E6%98%86%E4%BB%91", + "projectname": "sykl-mall", "setting": { "compileHotReLoad": true, "urlCheck": true