index.vue 5.6 KB

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