index.vue 6.2 KB

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