index.vue 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. <template>
  2. <view class="privacy-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="privacyNodes"></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. privacyNodes: ''
  21. }
  22. },
  23. computed: {
  24. scrollHeight() {
  25. return `calc(100vh - ${this.statusBarHeight + 44}px)`;
  26. }
  27. },
  28. async onLoad() {
  29. const winInfo = uni.getWindowInfo ? uni.getWindowInfo() : uni.getSystemInfoSync();
  30. this.statusBarHeight = winInfo.statusBarHeight || 20;
  31. try {
  32. const res = await getAgreement(2);
  33. this.title = res.data.title;
  34. this.privacyNodes = res.data.content;
  35. } catch (e) {
  36. console.error('[隐私政策] 加载失败', e);
  37. uni.showToast({ title: e || '加载隐私政策失败', icon: 'none' });
  38. }
  39. },
  40. methods: {
  41. goBack() { uni.navigateBack(); }
  42. }
  43. }
  44. </script>
  45. <style scoped>
  46. .privacy-page {
  47. width: 100vw;
  48. height: 100vh;
  49. background: #ffffff;
  50. display: flex;
  51. flex-direction: column;
  52. }
  53. .content-scroll {
  54. width: 100%;
  55. }
  56. .article-body {
  57. padding: 40rpx;
  58. padding-top: 20rpx;
  59. }
  60. .title {
  61. font-size: 40rpx;
  62. font-weight: bold;
  63. color: #1a1a1a;
  64. margin-bottom: 16rpx;
  65. text-align: center;
  66. }
  67. .update-time {
  68. font-size: 24rpx;
  69. color: #999;
  70. margin-bottom: 40rpx;
  71. text-align: center;
  72. }
  73. .safe-bottom-hint {
  74. margin-top: 80rpx;
  75. text-align: center;
  76. color: #52c41a;
  77. font-size: 24rpx;
  78. opacity: 0.6;
  79. }
  80. </style>