details.vue 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  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="newsDetailValue">
  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. },
  20. onLoad(op) {
  21. this.id =op.code;
  22. this.getNewsInfoDetail();
  23. },
  24. computed:{
  25. newsDetailValue(){
  26. if(process.car.branchParameter=="youdian"){
  27. return this.newsDetail.valueUd
  28. }else{
  29. return this.newsDetail.value
  30. }
  31. }
  32. },
  33. methods: {
  34. getNewsInfoDetail() {
  35. uni.showLoading({
  36. title: "加载中",
  37. mask: true,
  38. })
  39. newsApi.findConfigureByKey({
  40. key:this.id
  41. }).then((res) => {
  42. uni.hideLoading()
  43. this.newsDetail = res.data;
  44. this.$nextTick(()=>{
  45. var list =document.getElementsByClassName("news-content")[0].getElementsByTagName("img");
  46. for(var i=0;i<list.length;i++){
  47. list[i].style='width: 100%;height: 100%;'
  48. }
  49. })
  50. }).catch(error => {
  51. uni.showToast({
  52. title: error,
  53. icon: "none"
  54. })
  55. })
  56. }
  57. }
  58. }
  59. </script>
  60. <style lang="scss" scoped>
  61. .main{
  62. margin: 0px 16px ;
  63. padding-bottom: 34px;
  64. .new-title{
  65. color: #101010;
  66. font-size: 18px;
  67. height: 48px;
  68. margin: 16px 0 35px;
  69. }
  70. .time{
  71. display: flex;
  72. justify-content: space-between;
  73. color: #888888;
  74. .num{
  75. margin-left: 4px;
  76. }
  77. }
  78. .news-content{
  79. margin-top: 13px;
  80. font-size: 14px;
  81. line-height: 28px;
  82. color: #101010;
  83. }
  84. }
  85. </style>