index.vue 6.1 KB

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