knowledge.vue 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. <template>
  2. <view style="background-color: #fff;">
  3. <u-navbar title="详情"></u-navbar>
  4. <view class="main">
  5. <view style="font-size: 32rpx;margin: 18rpx 0;font-weight: bold; ">{{newsDetail.title}}</view>
  6. <view style="display: flex;justify-content: space-between; border-bottom: 1px solid #e6e3e3;color: #888;padding: 8rpx 0;" >
  7. <view>阅读量:{{newsDetail.readNum}}</view>
  8. <view style="margin-left: 40rpx;">{{newsDetail.createTime}}</view>
  9. </view >
  10. <view class="news-content" v-html="newsDetail.content">
  11. </view>
  12. </view>
  13. </view>
  14. </template>
  15. <script>
  16. import * as newsApi from '@/apis/pagejs/message.js'
  17. export default {
  18. data() {
  19. return {
  20. id: '',
  21. newsDetail: {
  22. },
  23. }
  24. },
  25. onLoad(op) {
  26. this.id =op.id;
  27. this.getNewsInfoDetail();
  28. },
  29. methods: {
  30. getNewsInfoDetail() {
  31. uni.showLoading({
  32. title: "加载中",
  33. mask: true,
  34. })
  35. newsApi.newsDetails({
  36. id:this.id
  37. }).then((res) => {
  38. uni.hideLoading()
  39. this.newsDetail = res.data.newsInfo;
  40. this.$nextTick(()=>{
  41. var list =document.getElementsByClassName("news-content")[0].getElementsByTagName("img");
  42. for(var i=0;i<list.length;i++){
  43. list[i].style='width: 100%;height: 100%;'
  44. }
  45. })
  46. }).catch(error => {
  47. uni.showToast({
  48. title: error,
  49. icon: "none"
  50. })
  51. })
  52. }
  53. }
  54. }
  55. </script>
  56. <style lang="scss" scoped>
  57. .main{
  58. margin: 0px 16px ;
  59. padding-bottom: 34px;
  60. .new-title{
  61. color: #101010;
  62. font-size: 18px;
  63. height: 48px;
  64. margin: 16px 0 35px;
  65. }
  66. .time{
  67. display: flex;
  68. justify-content: space-between;
  69. color: #888888;
  70. .num{
  71. margin-left: 4px;
  72. }
  73. }
  74. .news-content{
  75. margin-top: 13px;
  76. font-size: 14px;
  77. line-height: 28px;
  78. color: #101010;
  79. }
  80. }
  81. </style>