index.vue 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. <template>
  2. <view v-if="visible" class="agreement-mask" @touchmove.stop.prevent>
  3. <view class="agreement-container">
  4. <view class="agreement-header">
  5. <text class="agreement-title">{{ title || '协议详情' }}</text>
  6. </view>
  7. <scroll-view scroll-y class="agreement-body">
  8. <rich-text :nodes="content"></rich-text>
  9. </scroll-view>
  10. <view class="agreement-footer">
  11. <button class="confirm-btn" @click="handleClose">确 定</button>
  12. </view>
  13. </view>
  14. </view>
  15. </template>
  16. <script>
  17. /**
  18. * 协议详情组件 (纯 UI 组件)
  19. * @property {Boolean} visible 控制显示隐藏
  20. * @property {String} title 协议标题
  21. * @property {String} content 协议内容 (支持 HTML)
  22. * @event {Function} close 关闭回调
  23. */
  24. export default {
  25. name: 'Agreement',
  26. props: {
  27. visible: {
  28. type: Boolean,
  29. default: false
  30. },
  31. title: {
  32. type: String,
  33. default: ''
  34. },
  35. content: {
  36. type: String,
  37. default: ''
  38. }
  39. },
  40. methods: {
  41. /**
  42. * 关闭弹窗
  43. */
  44. handleClose() {
  45. this.$emit('close');
  46. }
  47. }
  48. };
  49. </script>
  50. <style scoped>
  51. .agreement-mask {
  52. position: fixed;
  53. top: 0;
  54. left: 0;
  55. width: 100%;
  56. height: 100%;
  57. background-color: rgba(0, 0, 0, 0.6);
  58. z-index: 1000;
  59. display: flex;
  60. align-items: center;
  61. justify-content: center;
  62. }
  63. .agreement-container {
  64. width: 600rpx;
  65. max-height: 80vh;
  66. background-color: #ffffff;
  67. border-radius: 20rpx;
  68. display: flex;
  69. flex-direction: column;
  70. overflow: hidden;
  71. animation: fadeIn 0.3s ease;
  72. }
  73. .agreement-header {
  74. padding: 30rpx;
  75. text-align: center;
  76. border-bottom: 2rpx solid #f5f5f5;
  77. }
  78. .agreement-title {
  79. font-size: 32rpx;
  80. font-weight: bold;
  81. color: #333333;
  82. }
  83. .agreement-body {
  84. flex: 1;
  85. padding: 30rpx;
  86. font-size: 28rpx;
  87. line-height: 1.6;
  88. color: #666666;
  89. max-height: 50vh;
  90. }
  91. .agreement-footer {
  92. padding: 30rpx;
  93. border-top: 2rpx solid #f5f5f5;
  94. }
  95. .confirm-btn {
  96. width: 100%;
  97. height: 80rpx;
  98. line-height: 80rpx;
  99. background-color: #ff5722;
  100. color: #ffffff;
  101. border-radius: 40rpx;
  102. font-size: 28rpx;
  103. }
  104. @keyframes fadeIn {
  105. from {
  106. opacity: 0;
  107. transform: scale(0.9);
  108. }
  109. to {
  110. opacity: 1;
  111. transform: scale(1);
  112. }
  113. }
  114. </style>