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)