index.vue 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270
  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. // +----------------------------------------------------------------------
  40. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  41. // +----------------------------------------------------------------------
  42. // | Copyright (c) 2016~2021 https://www.crmeb.com All rights reserved.
  43. // +----------------------------------------------------------------------
  44. // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
  45. // +----------------------------------------------------------------------
  46. // | Author: CRMEB Team <admin@crmeb.com>
  47. // +----------------------------------------------------------------------
  48. import parser from "@/components/jyf-parser/jyf-parser";
  49. import {
  50. getArticleDetails
  51. } from '@/api/api.js';
  52. import shareInfo from '@/components/shareInfo';
  53. import home from '@/components/home';
  54. export default {
  55. components: {
  56. shareInfo,
  57. home,
  58. "jyf-parser": parser,
  59. },
  60. data() {
  61. return {
  62. id: 0,
  63. articleInfo: [],
  64. store_info: {},
  65. content: '',
  66. shareInfoStatus: false,
  67. tagStyle: {
  68. img: 'width:100%;display:block;'
  69. },
  70. };
  71. },
  72. /**
  73. * 生命周期函数--监听页面加载
  74. */
  75. onLoad: function(options) {
  76. if (options.hasOwnProperty('id')) {
  77. this.id = options.id;
  78. } else {
  79. // #ifndef H5
  80. uni.navigateBack({
  81. delta: 1
  82. });
  83. // #endif
  84. // #ifdef H5
  85. history.back();
  86. // #endif
  87. }
  88. },
  89. onShow: function() {
  90. this.getArticleOne();
  91. },
  92. methods: {
  93. getArticleOne: function() {
  94. let that = this;
  95. getArticleDetails(that.id).then(res => {
  96. uni.setNavigationBarTitle({
  97. title: res.data.title.substring(0, 7) + "..."
  98. });
  99. that.$set(that, 'articleInfo', res.data);
  100. that.$set(that, 'store_info', res.data.store_info ? res.data.store_info : {});
  101. that.content = res.data.content.content;
  102. // #ifdef H5
  103. if (this.$wechat.isWeixin()) {
  104. this.setShareInfo();
  105. }
  106. // #endif
  107. });
  108. },
  109. listenerActionSheet() {
  110. this.shareInfoStatus = true
  111. },
  112. setShareInfoStatus() {
  113. this.shareInfoStatus = false
  114. },
  115. setShareInfo: function() {
  116. let href = location.href;
  117. let configAppMessage = {
  118. desc: this.articleInfo.synopsis,
  119. title: this.articleInfo.title,
  120. link: href,
  121. imgUrl: this.articleInfo.image_input
  122. };
  123. this.$wechat.wechatEvevt(["updateAppMessageShareData", "updateTimelineShareData"], configAppMessage);
  124. }
  125. }
  126. }
  127. </script>
  128. <style lang="scss">
  129. page {
  130. background-color: #fff !important;
  131. }
  132. .newsDetail .title {
  133. padding: 0 30rpx;
  134. font-size: 34rpx;
  135. color: #282828;
  136. font-weight: bold;
  137. margin: 45rpx 0 23rpx 0;
  138. line-height: 1.5;
  139. }
  140. .newsDetail .list {
  141. margin: 0 30rpx;
  142. // border-bottom: 1rpx solid #eee;
  143. padding-bottom: 25rpx;
  144. }
  145. .newsDetail .list .label {
  146. font-size: 30rpx;
  147. color: #B1B2B3;
  148. // height: 38rpx;
  149. // border-radius: 3rpx;
  150. // text-align: center;
  151. // line-height: 38rpx;
  152. // padding: 0 10rpx;
  153. }
  154. .newsDetail .list .item {
  155. margin-left: 27rpx;
  156. font-size: 30rpx;
  157. color: #B1B2B3;
  158. }
  159. .newsDetail .list .item .iconfont {
  160. font-size: 28rpx;
  161. margin-right: 10rpx;
  162. }
  163. .newsDetail .list .item .iconfont.icon-shenhezhong {
  164. font-size: 26rpx;
  165. }
  166. .newsDetail .conters {
  167. padding: 0 30rpx;
  168. font-size: 32rpx;
  169. // color: #8A8B8C;
  170. line-height: 1.7;
  171. /deep/ img{
  172. max-width: 100%;
  173. }
  174. }
  175. .newsDetail .picTxt {
  176. width: 690rpx;
  177. height: 200rpx;
  178. border-radius: 20rpx;
  179. border: 1px solid #e1e1e1;
  180. position: relative;
  181. margin: 30rpx auto 0 auto;
  182. }
  183. .newsDetail .picTxt .pictrue {
  184. width: 200rpx;
  185. height: 200rpx;
  186. }
  187. .newsDetail .picTxt .pictrue image {
  188. width: 100%;
  189. height: 100%;
  190. border-radius: 20rpx 0 0 20rpx;
  191. display: block;
  192. }
  193. .newsDetail .picTxt .text {
  194. width: 460rpx;
  195. }
  196. .newsDetail .picTxt .text .name {
  197. font-size: 30rpx;
  198. color: #282828;
  199. }
  200. .newsDetail .picTxt .text .money {
  201. font-size: 24rpx;
  202. margin-top: 40rpx;
  203. font-weight: bold;
  204. }
  205. .newsDetail .picTxt .text .money .num {
  206. font-size: 36rpx;
  207. }
  208. .newsDetail .picTxt .text .y_money {
  209. font-size: 26rpx;
  210. color: #999;
  211. text-decoration: line-through;
  212. }
  213. .newsDetail .picTxt .label {
  214. position: absolute;
  215. background-color: #303131;
  216. width: 160rpx;
  217. height: 50rpx;
  218. right: -7rpx;
  219. border-radius: 25rpx 0 6rpx 25rpx;
  220. text-align: center;
  221. line-height: 50rpx;
  222. bottom: 24rpx;
  223. }
  224. .newsDetail .picTxt .label .span {
  225. background-image: linear-gradient(to right, #fff71e 0%, #f9b513 100%);
  226. -webkit-background-clip: text;
  227. -webkit-text-fill-color: transparent;
  228. }
  229. .newsDetail .picTxt .label:after {
  230. content: " ";
  231. position: absolute;
  232. width: 0;
  233. height: 0;
  234. border-bottom: 8rpx solid #303131;
  235. border-right: 8rpx solid transparent;
  236. top: -7rpx;
  237. right: 0;
  238. }
  239. .newsDetail .bnt {
  240. color: #fff;
  241. font-size: 30rpx;
  242. width: 690rpx;
  243. height: 90rpx;
  244. border-radius: 45rpx;
  245. margin: 48rpx auto;
  246. text-align: center;
  247. line-height: 90rpx;
  248. }
  249. </style>