index.vue 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261
  1. <template>
  2. <view>
  3. <view class='newsDetail'>
  4. <view class='title'>{{articleInfo.title}}</view>
  5. <view class='list acea-row row-middle'>
  6. <view class='label'>{{articleInfo.author}}</view>
  7. <view class='item'></text>{{articleInfo.create_time}}</view>
  8. <!-- <view class='item'><text class='iconfont icon-liulan'></text>{{articleInfo.visit}}</view> -->
  9. </view>
  10. <view class='conters'>
  11. <!-- <rich-text :nodes="content" class="conter"></rich-text> -->
  12. <jyf-parser :html="content.replace(/<br\/>/ig, '')" ref="article" :tag-style="tagStyle"></jyf-parser>
  13. </view>
  14. <view class="picTxt acea-row row-between-wrapper" v-if="store_info.id">
  15. <view class="pictrue">
  16. <image :src="store_info.image"></image>
  17. </view>
  18. <view class="text">
  19. <view class="name line1">{{store_info.store_name}}</view>
  20. <view class="money font-color">
  21. ¥<text class="num">{{store_info.price}}</text>
  22. </view>
  23. <view class="y_money">¥{{store_info.ot_price}}</view>
  24. </view>
  25. <navigator :url="'/pages/goods_details/index?id='+store_info.id" hover-class="none" class="label"><text class="span">查看商品</text></navigator>
  26. </view>
  27. <!-- #ifdef H5 -->
  28. <button class="bnt bg-color" hover-class='none' @click="listenerActionSheet" v-if="this.$wechat.isWeixin()">和好友一起分享</button>
  29. <!-- #endif -->
  30. <!-- #ifdef MP -->
  31. <button class="bnt bg-color" open-type="share" hover-class='none'>和好友一起分享</button>
  32. <!-- #endif -->
  33. </view>
  34. <shareInfo @setShareInfoStatus="setShareInfoStatus" :shareInfoStatus="shareInfoStatus"></shareInfo>
  35. <home></home>
  36. </view>
  37. </template>
  38. <script>
  39. import parser from "@/components/jyf-parser/jyf-parser";
  40. import {
  41. getArticleDetails
  42. } from '@/api/api.js';
  43. import shareInfo from '@/components/shareInfo';
  44. import home from '@/components/home';
  45. export default {
  46. components: {
  47. shareInfo,
  48. home,
  49. "jyf-parser": parser,
  50. },
  51. data() {
  52. return {
  53. id: 0,
  54. articleInfo: [],
  55. store_info: {},
  56. content: '',
  57. shareInfoStatus: false,
  58. tagStyle: {
  59. img: 'width:100%;display:block;'
  60. },
  61. };
  62. },
  63. /**
  64. * 生命周期函数--监听页面加载
  65. */
  66. onLoad: function(options) {
  67. if (options.hasOwnProperty('id')) {
  68. this.id = options.id;
  69. } else {
  70. // #ifndef H5
  71. uni.navigateBack({
  72. delta: 1
  73. });
  74. // #endif
  75. // #ifdef H5
  76. history.back();
  77. // #endif
  78. }
  79. },
  80. onShow: function() {
  81. this.getArticleOne();
  82. },
  83. methods: {
  84. getArticleOne: function() {
  85. let that = this;
  86. getArticleDetails(that.id).then(res => {
  87. uni.setNavigationBarTitle({
  88. title: res.data.title.substring(0, 7) + "..."
  89. });
  90. that.$set(that, 'articleInfo', res.data);
  91. that.$set(that, 'store_info', res.data.store_info ? res.data.store_info : {});
  92. that.content = res.data.content.content;
  93. // #ifdef H5
  94. if (this.$wechat.isWeixin()) {
  95. this.setShareInfo();
  96. }
  97. // #endif
  98. });
  99. },
  100. listenerActionSheet() {
  101. this.shareInfoStatus = true
  102. },
  103. setShareInfoStatus() {
  104. this.shareInfoStatus = false
  105. },
  106. setShareInfo: function() {
  107. let href = location.href;
  108. let configAppMessage = {
  109. desc: this.articleInfo.synopsis,
  110. title: this.articleInfo.title,
  111. link: href,
  112. imgUrl: this.articleInfo.image_input
  113. };
  114. this.$wechat.wechatEvevt(["updateAppMessageShareData", "updateTimelineShareData"], configAppMessage);
  115. }
  116. }
  117. }
  118. </script>
  119. <style lang="scss">
  120. page {
  121. background-color: #fff !important;
  122. }
  123. .newsDetail .title {
  124. padding: 0 30rpx;
  125. font-size: 34rpx;
  126. color: #282828;
  127. font-weight: bold;
  128. margin: 45rpx 0 23rpx 0;
  129. line-height: 1.5;
  130. }
  131. .newsDetail .list {
  132. margin: 0 30rpx;
  133. // border-bottom: 1rpx solid #eee;
  134. padding-bottom: 25rpx;
  135. }
  136. .newsDetail .list .label {
  137. font-size: 30rpx;
  138. color: #B1B2B3;
  139. // height: 38rpx;
  140. // border-radius: 3rpx;
  141. // text-align: center;
  142. // line-height: 38rpx;
  143. // padding: 0 10rpx;
  144. }
  145. .newsDetail .list .item {
  146. margin-left: 27rpx;
  147. font-size: 30rpx;
  148. color: #B1B2B3;
  149. }
  150. .newsDetail .list .item .iconfont {
  151. font-size: 28rpx;
  152. margin-right: 10rpx;
  153. }
  154. .newsDetail .list .item .iconfont.icon-shenhezhong {
  155. font-size: 26rpx;
  156. }
  157. .newsDetail .conters {
  158. padding: 0 30rpx;
  159. font-size: 32rpx;
  160. color: #8A8B8C;
  161. line-height: 1.7;
  162. /deep/ img{
  163. max-width: 100%;
  164. }
  165. }
  166. .newsDetail .picTxt {
  167. width: 690rpx;
  168. height: 200rpx;
  169. border-radius: 20rpx;
  170. border: 1px solid #e1e1e1;
  171. position: relative;
  172. margin: 30rpx auto 0 auto;
  173. }
  174. .newsDetail .picTxt .pictrue {
  175. width: 200rpx;
  176. height: 200rpx;
  177. }
  178. .newsDetail .picTxt .pictrue image {
  179. width: 100%;
  180. height: 100%;
  181. border-radius: 20rpx 0 0 20rpx;
  182. display: block;
  183. }
  184. .newsDetail .picTxt .text {
  185. width: 460rpx;
  186. }
  187. .newsDetail .picTxt .text .name {
  188. font-size: 30rpx;
  189. color: #282828;
  190. }
  191. .newsDetail .picTxt .text .money {
  192. font-size: 24rpx;
  193. margin-top: 40rpx;
  194. font-weight: bold;
  195. }
  196. .newsDetail .picTxt .text .money .num {
  197. font-size: 36rpx;
  198. }
  199. .newsDetail .picTxt .text .y_money {
  200. font-size: 26rpx;
  201. color: #999;
  202. text-decoration: line-through;
  203. }
  204. .newsDetail .picTxt .label {
  205. position: absolute;
  206. background-color: #303131;
  207. width: 160rpx;
  208. height: 50rpx;
  209. right: -7rpx;
  210. border-radius: 25rpx 0 6rpx 25rpx;
  211. text-align: center;
  212. line-height: 50rpx;
  213. bottom: 24rpx;
  214. }
  215. .newsDetail .picTxt .label .span {
  216. background-image: linear-gradient(to right, #fff71e 0%, #f9b513 100%);
  217. -webkit-background-clip: text;
  218. -webkit-text-fill-color: transparent;
  219. }
  220. .newsDetail .picTxt .label:after {
  221. content: " ";
  222. position: absolute;
  223. width: 0;
  224. height: 0;
  225. border-bottom: 8rpx solid #303131;
  226. border-right: 8rpx solid transparent;
  227. top: -7rpx;
  228. right: 0;
  229. }
  230. .newsDetail .bnt {
  231. color: #fff;
  232. font-size: 30rpx;
  233. width: 690rpx;
  234. height: 90rpx;
  235. border-radius: 45rpx;
  236. margin: 48rpx auto;
  237. text-align: center;
  238. line-height: 90rpx;
  239. }
  240. </style>