article-detail.vue 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. <template>
  2. <app-layout>
  3. <view class="page">
  4. <app-rich-text background="#ffffff" :loading="loading" :content="list.content"></app-rich-text>
  5. </view>
  6. </app-layout>
  7. </template>
  8. <script>
  9. import appRichText from "../../../components/basic-component/app-rich/parse.vue";
  10. import { mapState } from "vuex";
  11. export default {
  12. data() {
  13. return {
  14. page: 2,
  15. loading: true,
  16. list: {
  17. content: ' '
  18. }
  19. }
  20. },
  21. components: {
  22. appRichText,
  23. },
  24. methods: {
  25. getList() {
  26. let that = this;
  27. this.$request({
  28. url: that.$api.article.detail,
  29. data: {
  30. article_id: that.id
  31. },
  32. }).then(response=>{
  33. that.$hideLoading();
  34. if(response.code == 0) {
  35. that.loading = false;
  36. that.list = response.data.article;
  37. setTimeout(function(){
  38. uni.setNavigationBarTitle({
  39. title: that.list.title
  40. });
  41. },0)
  42. }
  43. }).catch(e => {
  44. that.$hideLoading();
  45. });
  46. },
  47. },
  48. onLoad(option) { this.$commonLoad.onload(option);
  49. this.$showLoading({
  50. type: 'global',
  51. text: '加载中...'
  52. });
  53. this.id = option.id;
  54. this.getList();
  55. this.$store.dispatch('gConfig/setImageWidth', 48);
  56. },
  57. // #ifdef MP
  58. onShareAppMessage() {
  59. return this.$shareAppMessage({
  60. title: this.list.title,
  61. path: "/pages/article/article-detail/article-detail",
  62. params: {
  63. id: this.id
  64. }
  65. });
  66. }
  67. // #endif
  68. }
  69. </script>
  70. <style scoped lang="scss">
  71. .page {
  72. padding: 0 #{24rpx};
  73. position: absolute;
  74. top: 0;
  75. left: 0;
  76. min-height: 100%;
  77. width: 100%;
  78. background-color: #ffffff;
  79. }
  80. </style>