article-detail.vue 2.2 KB

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