help.vue 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. <template>
  2. <view>
  3. <uni-nav-bar :fixed="true" shadow left-icon="left" :title="title" :statusBar="true" @clickLeft="handleToBack" />
  4. <view class="content">
  5. <rich-text :nodes="content"></rich-text>
  6. <view class="footer">
  7. <image mode="widthFix" src="/static/common/footer.png" />
  8. </view>
  9. </view>
  10. </view>
  11. </template>
  12. <script setup>
  13. import { ref, reactive } from 'vue';
  14. import { onLoad, onShow } from '@dcloudio/uni-app';
  15. import request from '/common/request.js';
  16. const statusBarHeight = ref();
  17. const content = ref();
  18. const title = ref();
  19. const props = defineProps({
  20. id: Number | String
  21. });
  22. onLoad(() => {
  23. statusBarHeight.value = uni.getSystemInfoSync().statusBarHeight;
  24. getContent();
  25. });
  26. onShow(() => {
  27. uni.$emit('fastOrderNum', false);
  28. uni.$emit('receiveOrdernum', false);
  29. });
  30. const handleToBack = () => {
  31. const canNavBack = getCurrentPages();
  32. if (canNavBack && canNavBack.length > 1) uni.navigateBack();
  33. else history.back();
  34. };
  35. const getContent = () => {
  36. uni.showLoading();
  37. request({
  38. url: '/api/portal/getInfo',
  39. method: 'GET',
  40. data: {
  41. id: props.id
  42. },
  43. success: (res) => {
  44. if (res.data?.data?.post_content) {
  45. content.value = res.data?.data?.post_content;
  46. title.value = res.data?.data?.post_title;
  47. uni.setNavigationBarTitle({
  48. title: res.data?.data?.post_title
  49. });
  50. }
  51. },
  52. fail: () => {},
  53. complete: () => {
  54. uni.hideLoading();
  55. }
  56. });
  57. };
  58. </script>
  59. <style lang="scss" scoped>
  60. .content {
  61. padding: 60upx 20upx 20upx;
  62. p {
  63. margin: 20upx;
  64. }
  65. }
  66. </style>