diff --git a/pages/article/detail/index.js b/pages/article/detail/index.js index b7ee3f6..7593e67 100644 --- a/pages/article/detail/index.js +++ b/pages/article/detail/index.js @@ -3,6 +3,8 @@ const util = require('../../../utils/util') const tdsdk = require('../../../libs/tdweapp') const event = require('../../../utils/event.js') const app = getApp() +const tip = '纸通宝免责声明:1、纸通宝所提供的信息及资料除原创外,部分资讯来源于网络等媒体,转载目的在于传递更多信息,并不代表纸通宝赞同其观点和对其真实性负责。如涉及作品内容、版权和其它问题,敬请原作者谅解,并立即通知纸通宝(投诉邮箱:zhitongbao@qniao.cn),我们将在第一时间删除内容!纸通宝拥有对此声明的最终解释权。2、以上所展示信息或资料,仅供参考!任何单位或个人因以上信息进行交易行为而导致财产损失等,纸通宝对此不承担任何法律责任。' +const maxLength = 42 Page({ data: { @@ -28,7 +30,9 @@ Page({ pageSize: 15 }, maskHidden: false, - visible: false + visible: false, + tipshow: '', + ellipsis: true }, onLoad: function (options) { this.data.keyboardHeight = wx.getStorageSync('keyboardHeight') @@ -47,7 +51,7 @@ Page({ this.data.visible = true } } - this.setData({ momentDetail: result.data, visible: this.data.visible }) + this.setData({ momentDetail: result.data, visible: this.data.visible, tipshow: tip.substring(0, maxLength - 3) + '...' }) this.fetchCommentList() wx.hideLoading() }).catch(err => { @@ -62,6 +66,12 @@ Page({ onImageClick: function(){ wx.navigateTo({ url: '/pages/ztbvip/index' }) }, + ellipsisText: function () { + var ellipsis = !this.data.ellipsis; + var tipshow = tip; + tipshow = (tipshow.length > maxLength && ellipsis) ? tipshow.substring(0, maxLength - 3) + '...' : tipshow; + this.setData({ tipshow: tipshow, ellipsis: ellipsis }) + }, onRefreshList: function () { if (this.data.requesting) { return diff --git a/pages/article/detail/index.json b/pages/article/detail/index.json index 770f6af..b149f8b 100644 --- a/pages/article/detail/index.json +++ b/pages/article/detail/index.json @@ -4,7 +4,7 @@ "wux-image": "/components/image/index", "sudoku-image": "/components/sudoku-image/index", "wux-divider": "/components/divider/index", - "refresh-view": "/components/refresher/index", + "fold-text": "/components/fold-text/index", "wux-tag": "/components/tag/index", "wux-popup": "/components/popup/index" } diff --git a/pages/article/detail/index.wxml b/pages/article/detail/index.wxml index 80662fb..15efbce 100644 --- a/pages/article/detail/index.wxml +++ b/pages/article/detail/index.wxml @@ -32,12 +32,16 @@ - # + # {{momentDetail.millPaperName}} + + {{tipshow}} + {{ellipsis? '展开':'收起'}} + + 评论 diff --git a/pages/article/detail/index.wxss b/pages/article/detail/index.wxss index aa60b89..47a657f 100644 --- a/pages/article/detail/index.wxss +++ b/pages/article/detail/index.wxss @@ -25,6 +25,15 @@ height: 40px; } +.pay-hint-content{ + text-overflow: ellipsis; + -webkit-box-orient:vertical; + overflow:hidden; + word-wrap: break-word; + word-break: break-all; + white-space: pre-line; +} + .share-btn { background-color: #fff; padding-left: 0px;