article-detail.vue 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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 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) {
  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. onShareAppMessage: function() {
  58. return this.$shareAppMessage({
  59. title: this.list.title,
  60. path: "/pages/article/article-detail/article-detail",
  61. params: {
  62. id: this.id
  63. }
  64. });
  65. },
  66. }
  67. </script>
  68. <style scoped lang="scss">
  69. .page {
  70. padding: 0 #{24rpx};
  71. }
  72. </style>