details.vue 1.4 KB

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