index.vue 6.1 KB

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