articleDetails.vue 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. <template>
  2. <view style="background-color: #fff;">
  3. <u-navbar title="文章详情"></u-navbar>
  4. <view class="main">
  5. <view class="new-title">
  6. {{newsDetail.title}}
  7. </view>
  8. <view class="time">
  9. <view class="time-left">
  10. {{newsDetail.createTime}}
  11. </view>
  12. <view class="time-tight">
  13. <text class="iconfont">&#xe612;</text><text class="num">{{newsDetail.readNum}}</text>
  14. </view>
  15. </view>
  16. <view class="news-content">
  17. {{newsDetail.content}}
  18. </view>
  19. </view>
  20. </view>
  21. </template>
  22. <script>
  23. import * as newsApi from '@/apis/news.js'
  24. export default {
  25. data() {
  26. return {
  27. id: '',
  28. newsDetail: '',
  29. }
  30. },
  31. onLoad(op) {
  32. this.id =op.id;
  33. this.getNewsInfoDetail();
  34. },
  35. methods: {
  36. getNewsInfoDetail() {
  37. uni.showLoading({
  38. title: "加载中",
  39. mask: true,
  40. })
  41. newsApi.newsInfoDetail(this.id).then((res) => {
  42. uni.hideLoading()
  43. this.newsDetail = res.data;
  44. }).catch(error => {
  45. uni.showToast({
  46. title: error,
  47. icon: "none"
  48. })
  49. })
  50. }
  51. }
  52. }
  53. </script>
  54. <style lang="scss" scoped>
  55. .main{
  56. margin: 0px 16px ;
  57. padding-bottom: 34px;
  58. .new-title{
  59. color: #101010;
  60. font-size: 18px;
  61. height: 48px;
  62. margin: 16px 0 35px;
  63. }
  64. .time{
  65. display: flex;
  66. justify-content: space-between;
  67. color: #888888;
  68. .num{
  69. margin-left: 4px;
  70. }
  71. }
  72. .news-content{
  73. margin-top: 13px;
  74. font-size: 14px;
  75. line-height: 28px;
  76. color: #101010;
  77. }
  78. }
  79. </style>