index.vue 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. <template>
  2. <view class="agreement-page">
  3. <erp-nav-bar :title="title" />
  4. <scroll-view scroll-y class="content-scroll" :style="{ height: scrollHeight }">
  5. <view class="article-body">
  6. <rich-text :nodes="agreementNodes"></rich-text>
  7. </view>
  8. </scroll-view>
  9. </view>
  10. </template>
  11. <script>
  12. import { getAgreement } from '@/api/system/agreement.js';
  13. import ErpNavBar from '@/components/erp-nav-bar.vue';
  14. export default {
  15. components: { ErpNavBar },
  16. data() {
  17. return {
  18. statusBarHeight: 20,
  19. title: '',
  20. agreementNodes: ''
  21. }
  22. },
  23. computed: {
  24. scrollHeight() {
  25. return `calc(100vh - ${this.statusBarHeight + 44}px)`;
  26. }
  27. },
  28. async onLoad() {
  29. this.statusBarHeight = uni.getSystemInfoSync().statusBarHeight || 20;
  30. try {
  31. const res = await getAgreement(1);
  32. this.title = res.data.title;
  33. this.agreementNodes = res.data.content;
  34. } catch (e) {
  35. console.error('[用户协议] 加载失败', e);
  36. uni.showToast({ title: e || '加载用户协议失败', icon: 'none' });
  37. }
  38. },
  39. methods: {
  40. goBack() { uni.navigateBack(); }
  41. }
  42. }
  43. </script>
  44. <style scoped>
  45. .agreement-page {
  46. width: 100vw;
  47. height: 100vh;
  48. background: #ffffff;
  49. display: flex;
  50. flex-direction: column;
  51. }
  52. .content-scroll {
  53. width: 100%;
  54. }
  55. .article-body {
  56. padding: 40rpx;
  57. padding-top: 20rpx;
  58. }
  59. .title {
  60. font-size: 40rpx;
  61. font-weight: bold;
  62. color: #1a1a1a;
  63. margin-bottom: 16rpx;
  64. text-align: center;
  65. }
  66. .update-time {
  67. font-size: 24rpx;
  68. color: #999;
  69. margin-bottom: 40rpx;
  70. text-align: center;
  71. }
  72. .footer-tip {
  73. margin-top: 60rpx;
  74. padding: 30rpx;
  75. background: #f8fafc;
  76. font-size: 24rpx;
  77. color: #888;
  78. text-align: center;
  79. }
  80. </style>