diff --git a/pages/detail/index.js b/pages/detail/index.js index cacec68..52a3e88 100644 --- a/pages/detail/index.js +++ b/pages/detail/index.js @@ -17,7 +17,10 @@ Page({ dataList: [], //放置返回数据的数组 loadMore: false, //"上拉加载"的变量,默认false,隐藏 loadAll: false, //“没有数据”的变量,默认false,隐藏 - totalNum: 0 + totalNum: 0, + c1: "", + c2: "", + showMore: false }, onLoad() { wx.setNavigationBarTitle({ @@ -62,15 +65,19 @@ Page({ let arr = res || []; if (arr.length > 0) { let data = arr[0]; + let c1 = data._source.content; + let c2 = doStr(data._source.content, 700); this.setData({ source: data._source.source, user_author: data._source.user_author, sourcetime: data._source.sourcetime, title: doStr(data._source.title, 70), - content: doStr(data._source.content, 1000), + content: c2, affections: data._source.affections, crisis: data._source.crisis, - ssim: data._source.ssim + ssim: data._source.ssim, + c1: c1, + c2: c2 }) } resolve(true) @@ -132,5 +139,21 @@ Page({ }); } }) + }, + showMoreData() { + let sm = !this.data.showMore; + if(sm) { + this.setData({ + content: this.data.c1 + }) + } else { + this.setData({ + content: this.data.c2 + }) + } + this.setData({ + showMore: sm + }) + } }) \ No newline at end of file diff --git a/pages/detail/index.wxml b/pages/detail/index.wxml index 8ea2317..2c176c4 100644 --- a/pages/detail/index.wxml +++ b/pages/detail/index.wxml @@ -37,7 +37,7 @@ - + {{content}} diff --git a/pages/detail/index.wxss b/pages/detail/index.wxss index a7d4aec..99cf3a5 100644 --- a/pages/detail/index.wxss +++ b/pages/detail/index.wxss @@ -102,9 +102,10 @@ .bc-c-d1 { background-color: #fff; padding: 16px; - font-size: 12px; + font-size: 13px; color: #333333; line-height: 1.6; + letter-spacing: 1px; } .bc-c-d2 {