detail.vue 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. <template>
  2. <view class="cmain">
  3. <view class="title">{{ item.title }}</view>
  4. <view class="desc">
  5. <view>{{ item.source }}<text class="source" style="margin-left: 10px;" v-if="item.url" @click="toSource(item.url)">原文连接</text></view>
  6. <view>{{ item.createTime.substring(0,16) }}</view>
  7. <!-- <view class="read">
  8. <text class="icon">&#xe639;</text>
  9. <text>{{ item.readCount }}</text>
  10. </view> -->
  11. </view>
  12. <u-divider :dot="true"></u-divider>
  13. <view v-html="item.content"></view>
  14. <!-- <u-parse :content="item.content"></u-parse> -->
  15. </view>
  16. </template>
  17. <script>
  18. export default {
  19. data() {
  20. return {
  21. item: {createTime:''}
  22. };
  23. },
  24. onLoad(e) {
  25. if (e.id) {
  26. this.http.request({
  27. url: '/level-one-server/app/TbPortNews/getById?id=' + e.id,
  28. success: res => {
  29. this.item = res.data.data;
  30. this.item.content = this.item.content.replace(/\<img/gi,
  31. '<img style="border-radius: 5px;"');
  32. }
  33. });
  34. }
  35. },
  36. methods: {
  37. toSource(url) {
  38. // #ifdef APP-PLUS
  39. plus.runtime.openURL(url) //这里默认使用外部浏览器打开而不是内部web-view组件打开
  40. // #endif
  41. // #ifdef H5
  42. window.open(url)
  43. // #endif
  44. }
  45. }
  46. };
  47. </script>
  48. <style lang="scss">
  49. .cmain {
  50. padding: 20px 16px 15px 16px;
  51. .title {
  52. font-weight: bold;
  53. color: #192b20;
  54. line-height: 32px;
  55. font-size: 22px;
  56. }
  57. .desc {
  58. margin-top: 10px;
  59. overflow: hidden;
  60. color: #a0a2a6;
  61. text {
  62. // float: left;
  63. }
  64. .source {
  65. color: #0081ff;
  66. margin-right: 10px;
  67. }
  68. margin-right: 10px;
  69. .read {
  70. float: right;
  71. margin-top: -2px;
  72. .icon {
  73. padding-right: 3px;
  74. float: left;
  75. margin-top: 2px;
  76. }
  77. }
  78. }
  79. }
  80. </style>