newsdetails.vue 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. <template>
  2. <view class="pages">
  3. <view class="" :style="{height: navHeight+'px' }"></view>
  4. <view class="navbar-box">
  5. <u-navbar title="资讯详情" :safeAreaInsetTop="true" @leftClick="leftClick" :titleStyle="{color:'#000'}" leftIconColor="#000" bgColor="transparent"></u-navbar>
  6. </view>
  7. <view class="banner">
  8. <image class="img" :src="details.mainImg||staticUrl+'/img/newsdetails-banner.png'" alt="">
  9. </view>
  10. <view class="content-wrap">
  11. <view class="title">{{details.title}}</view>
  12. <view class="time">{{ $u.timeFormat(details.onlineTime, 'yyyy-mm-dd') }}</view>
  13. <view class="centent">
  14. <u-parse :content="details.centent"></u-parse>
  15. </view>
  16. </view>
  17. </view>
  18. </template>
  19. <script>
  20. import { systemInfo } from "@/mixin.js";
  21. export default {
  22. mixins:[systemInfo],
  23. data() {
  24. return {
  25. staticUrl:this.$commonConfig.staticUrl,
  26. id:'',
  27. details:{},
  28. }
  29. },
  30. onShow() {
  31. },
  32. onLoad(page) {
  33. this.getSystemInfo();
  34. this.id = page.id;
  35. this.getDetails();
  36. },
  37. methods: {
  38. leftClick(e){
  39. let pages = getCurrentPages();
  40. if(pages.length==1){
  41. uni.$u.route('/pages/index/index')
  42. }else{
  43. uni.navigateBack()
  44. };
  45. },
  46. getDetails(){
  47. this.$u.api.newsdetails({id:this.id}).then(res=>{
  48. this.details = res.data;
  49. // console.log('res',res.data);
  50. }).catch(err=>{
  51. console.log('getDetails',err);
  52. })
  53. }
  54. }
  55. }
  56. </script>
  57. <style lang="scss" scoped>
  58. .banner{
  59. .img{
  60. display: block;
  61. width: 100%;
  62. height: 400rpx;
  63. }
  64. }
  65. .content-wrap{
  66. padding: 65rpx 32rpx;
  67. background: #FFFFFF;
  68. border-radius: 20rpx 20rpx 0rpx 0rpx;
  69. transform: translateY(-20rpx);
  70. .title{
  71. font-size: 32rpx;
  72. font-weight: bold;
  73. color: #333333;
  74. line-height: 22rpx;
  75. margin-bottom: 30rpx;
  76. }
  77. .time{
  78. font-size: 24rpx;
  79. font-weight: 400;
  80. color: #C0C0C0;
  81. line-height: 22rpx;
  82. margin-bottom: 40rpx;
  83. }
  84. .centent{
  85. font-size: 28rpx;
  86. font-weight: 400;
  87. color: #6B6B6B;
  88. line-height: 44rpx;
  89. img,image{
  90. width: 100%;
  91. display: block;
  92. margin: 10rpx auto;
  93. }
  94. }
  95. }
  96. </style>