serviceAgreement.vue 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. <template>
  2. <view class="container">
  3. <!-- 导航栏 -->
  4. <view class="navbar">
  5. <view class="nav-left" @click="goBack">
  6. <text class="back-icon"><</text>
  7. </view>
  8. <view class="nav-title">服务协议</view>
  9. <view class="nav-right">
  10. <text class="more-icon">...</text>
  11. <text class="eye-icon">O</text>
  12. </view>
  13. </view>
  14. <!-- 内容区域 -->
  15. <scroll-view class="content" scroll-y>
  16. <view class="agreement-list">
  17. <view class="agreement-item" v-for="(item, index) in agreementList" :key="index" @click="goToDetail(item)">
  18. <text class="agreement-name">{{ item.name }}</text>
  19. <text class="arrow-right">></text>
  20. </view>
  21. </view>
  22. </scroll-view>
  23. </view>
  24. </template>
  25. <script>
  26. import { getServiceAgreementList } from '@/api-js/serviceAgreement'
  27. export default {
  28. data() {
  29. return {
  30. agreementList: [
  31. { id: 1, name: '用户服务协议', type: 'userService' },
  32. { id: 2, name: '用户注册协议', type: 'userRegister' },
  33. { id: 3, name: '隐私政策保护', type: 'privacy' }
  34. ]
  35. }
  36. },
  37. onLoad() {
  38. this.loadAgreementList()
  39. },
  40. methods: {
  41. async loadAgreementList() {
  42. try {
  43. const res = await getServiceAgreementList()
  44. if (res.code === 200 && res.data) {
  45. this.agreementList = res.data
  46. }
  47. } catch (e) {
  48. console.error('加载服务协议列表失败', e)
  49. }
  50. },
  51. goBack() {
  52. uni.navigateBack()
  53. },
  54. goToDetail(item) {
  55. uni.navigateTo({
  56. url: `/pages_user/serviceAgreementDetail?type=${item.type}&id=${item.id}`
  57. })
  58. }
  59. }
  60. }
  61. </script>
  62. <style lang="scss" scoped>
  63. .container {
  64. min-height: 100vh;
  65. background: #f5f5f5;
  66. display: flex;
  67. flex-direction: column;
  68. }
  69. .navbar {
  70. display: flex;
  71. align-items: center;
  72. justify-content: space-between;
  73. padding: 20rpx 24rpx;
  74. background: #fff;
  75. border-bottom: 1rpx solid #f0f0f0;
  76. .nav-left {
  77. width: 60rpx;
  78. .back-icon {
  79. font-size: 36rpx;
  80. color: #333;
  81. font-weight: bold;
  82. }
  83. }
  84. .nav-title {
  85. flex: 1;
  86. text-align: center;
  87. font-size: 36rpx;
  88. font-weight: bold;
  89. color: #333;
  90. }
  91. .nav-right {
  92. display: flex;
  93. align-items: center;
  94. gap: 24rpx;
  95. width: 60rpx;
  96. justify-content: flex-end;
  97. .more-icon {
  98. font-size: 32rpx;
  99. color: #333;
  100. }
  101. .eye-icon {
  102. font-size: 32rpx;
  103. color: #333;
  104. }
  105. }
  106. }
  107. .content {
  108. flex: 1;
  109. }
  110. .agreement-list {
  111. background: #fff;
  112. margin: 24rpx;
  113. border-radius: 16rpx;
  114. overflow: hidden;
  115. .agreement-item {
  116. display: flex;
  117. align-items: center;
  118. justify-content: space-between;
  119. padding: 32rpx 24rpx;
  120. border-bottom: 1rpx solid #f0f0f0;
  121. &:last-child {
  122. border-bottom: none;
  123. }
  124. .agreement-name {
  125. font-size: 28rpx;
  126. color: #333;
  127. }
  128. .arrow-right {
  129. font-size: 32rpx;
  130. color: #999;
  131. }
  132. }
  133. }
  134. </style>