From a1a08e62dcab449860dddee636a829151464f2ca Mon Sep 17 00:00:00 2001 From: meo <18801474720@163.com> Date: Mon, 15 Apr 2019 11:21:40 +0800 Subject: [PATCH] =?UTF-8?q?[=E4=B8=93=E9=A2=98][=E4=BF=AE=E6=94=B9]:[?= =?UTF-8?q?=E4=B8=93=E9=A2=98=E8=AF=A6=E6=83=85=E7=9A=84=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E4=BF=AE=E6=94=B9]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app.js | 5 +++++ config/config.js | 6 +++++- pages/main/index.js | 3 ++- pages/topicDetail/index.js | 17 +++++++++++------ 4 files changed, 23 insertions(+), 8 deletions(-) diff --git a/app.js b/app.js index 25c6969..2adb92c 100644 --- a/app.js +++ b/app.js @@ -51,6 +51,11 @@ App({ }, fail: error => { console.log(error); + wx.showModal({ + title:'提示', + content: error.errMsg, + showCancel:false + }) } }); }, diff --git a/config/config.js b/config/config.js index ec1acdb..cc5c795 100755 --- a/config/config.js +++ b/config/config.js @@ -267,7 +267,11 @@ var config = { /** * 专题 */ - topicShow:"/topic/show" + topicShow:"/topic/show", + /** + * 专题详情 + */ + topicFindById:"/topic/findById" }, weapp: { AppId: weappId diff --git a/pages/main/index.js b/pages/main/index.js index 547280b..7564eef 100644 --- a/pages/main/index.js +++ b/pages/main/index.js @@ -509,6 +509,7 @@ Page({ if (res&&res.data){ that.setData({ cover: res.data.cover, + id: res.data.id, showTopic: true }) } @@ -519,7 +520,7 @@ Page({ }, gotoTopic(){ wx.navigateTo({ - url: '/pages/topicDetail/index', + url: `/pages/topicDetail/index?id=${this.data.id}` }) }, /** diff --git a/pages/topicDetail/index.js b/pages/topicDetail/index.js index 5f118f0..e97e5c4 100644 --- a/pages/topicDetail/index.js +++ b/pages/topicDetail/index.js @@ -14,16 +14,21 @@ Page({ minute: "", nodes: '' }, - onShow() { - let that = this; - that.topicShow() + onLoad(options){ + console.log(options) + if(options&&options.id){ + this.setData({ + id:options.id + }) + this.topicShow(options.id) + } }, - topicShow(){ + topicShow(id){ let that = this; Http.get({ - url: config.api.topicShow, + url: config.api.topicFindById, data: { - token: app.globalData.token + id: id } }).then(res => { console.log(res)