richTextPage.vue 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. <template>
  2. <view class="content">
  3. <view class="main">
  4. <u-parse :html="richContent.content"></u-parse>
  5. </view>
  6. </view>
  7. </template>
  8. <script>
  9. export default {
  10. data() {
  11. return {
  12. title: '',
  13. richContent: {},
  14. option: {},
  15. /**
  16. * url,title,param,
  17. * */
  18. }
  19. },
  20. onLoad(options) {
  21. console.log(options);
  22. // if (options.id) {
  23. // this.$http.post(options.url, {
  24. // id: options.id
  25. // }).then(res => {
  26. // if (res.code == 1) {
  27. // this.title = '激活流程'
  28. // this.richContent = {
  29. // content: res.data.content
  30. // }
  31. // }
  32. // })
  33. // return
  34. // }
  35. if (options.option) {
  36. this.option = JSON.parse(decodeURIComponent(options.option));
  37. this.getContent();
  38. }
  39. },
  40. methods: {
  41. getContent() {
  42. console.log(this.option.param)
  43. this.title = this.option.title;
  44. uni.setNavigationBarTitle({
  45. title:this.option.title
  46. })
  47. // this.$http.post(this.option.url, this.option.param).then(res => {
  48. // if (res.code == 1 && res.data) {
  49. // this.title = res.data.title || this.option.title
  50. // this.richContent = {
  51. // content: res.data.content
  52. // }
  53. // }
  54. // })
  55. this.$u.api.getArticleListAjax(this.option.param).then(({code,data})=>{
  56. if (code == 1 && data) {
  57. console.log(code,data)
  58. // this.title = data.title || this.option.title
  59. this.richContent = {
  60. content: data.content
  61. }
  62. }
  63. })
  64. }
  65. }
  66. }
  67. </script>
  68. <style lang="scss" scoped>
  69. .content {
  70. background-color: #fff;
  71. min-height: 100vh;
  72. border-top: 1rpx solid $app-theme-border-color;
  73. .main {
  74. padding: 29rpx 30rpx;
  75. }
  76. }
  77. </style>