index.vue 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226
  1. <template>
  2. <view class="agreement-page">
  3. <!-- 自定义头部 -->
  4. <view class="custom-header" :style="{ paddingTop: statusBarHeight + 'px' }">
  5. <view class="header-content">
  6. <view class="back-btn" @click="handleBack">
  7. <text class="back-icon">‹</text>
  8. </view>
  9. <text class="header-title">{{ t('pagesContent.my.agreement.title') }}</text>
  10. <view class="placeholder"></view>
  11. </view>
  12. </view>
  13. <!-- 页面内容 -->
  14. <view class="page-body" :style="{ paddingTop: headerHeight + 'px' }">
  15. <!-- 协议列表 -->
  16. <view class="agreement-list">
  17. <!-- 用户协议 -->
  18. <view class="list-item" @click="handleUserAgreement">
  19. <view class="item-content">
  20. <view class="item-icon-wrapper">
  21. <image class="item-icon" src="/static/pages-content/my/agreement/user.png" mode="aspectFit" />
  22. </view>
  23. <view class="item-info">
  24. <text class="item-title">{{ t('pagesContent.my.agreement.userAgreement') }}</text>
  25. <text class="item-desc">{{ t('pagesContent.my.agreement.userAgreementDesc') }}</text>
  26. </view>
  27. </view>
  28. <text class="item-arrow">›</text>
  29. </view>
  30. <!-- 隐私协议 -->
  31. <view class="list-item" @click="handlePrivacyPolicy">
  32. <view class="item-content">
  33. <view class="item-icon-wrapper">
  34. <image class="item-icon" src="/static/pages-content/my/agreement/privacy.png" mode="aspectFit" />
  35. </view>
  36. <view class="item-info">
  37. <text class="item-title">{{ t('pagesContent.my.agreement.privacyPolicy') }}</text>
  38. <text class="item-desc">{{ t('pagesContent.my.agreement.privacyPolicyDesc') }}</text>
  39. </view>
  40. </view>
  41. <text class="item-arrow">›</text>
  42. </view>
  43. </view>
  44. </view>
  45. </view>
  46. </template>
  47. <script setup>
  48. import { ref, computed, onMounted } from 'vue'
  49. import { useI18n } from 'vue-i18n'
  50. const { t } = useI18n()
  51. // 状态栏高度
  52. const statusBarHeight = ref(0)
  53. // 头部总高度(状态栏 + 导航栏 + 额外间距)
  54. const headerHeight = computed(() => {
  55. return statusBarHeight.value + 44 + 10 // 44px是导航栏高度,100px是额外间距
  56. })
  57. onMounted(() => {
  58. // 获取系统信息
  59. const systemInfo = uni.getSystemInfoSync()
  60. statusBarHeight.value = systemInfo.statusBarHeight || 0
  61. console.log('协议说明页面已加载')
  62. })
  63. // 返回上一页
  64. const handleBack = () => {
  65. const pages = getCurrentPages()
  66. if (pages.length > 1) {
  67. uni.navigateBack()
  68. } else {
  69. uni.reLaunch({
  70. url: '/pages/index'
  71. })
  72. }
  73. }
  74. // 用户协议
  75. const handleUserAgreement = () => {
  76. // TODO: 跳转到用户协议详情页
  77. uni.navigateTo({
  78. url: '/pages-content/my/aggreement/detail?type=user'
  79. })
  80. }
  81. // 隐私协议
  82. const handlePrivacyPolicy = () => {
  83. // TODO: 跳转到隐私协议详情页
  84. uni.navigateTo({
  85. url: '/pages-content/my/aggreement/detail?type=privacy'
  86. })
  87. }
  88. </script>
  89. <style lang="scss" scoped>
  90. .agreement-page {
  91. width: 100%;
  92. min-height: 100vh;
  93. display: flex;
  94. flex-direction: column;
  95. background: linear-gradient(180deg, #f0f4ff 0%, #f8f9fa 100%);
  96. // 自定义头部
  97. .custom-header {
  98. position: fixed;
  99. top: 0;
  100. left: 0;
  101. right: 0;
  102. background-color: #ffffff;
  103. border-bottom: 1rpx solid #e5e5e5;
  104. z-index: 100;
  105. .header-content {
  106. height: 88rpx;
  107. display: flex;
  108. align-items: center;
  109. justify-content: space-between;
  110. padding: 0 32rpx;
  111. .back-btn {
  112. width: 60rpx;
  113. height: 60rpx;
  114. display: flex;
  115. align-items: center;
  116. justify-content: center;
  117. .back-icon {
  118. font-size: 56rpx;
  119. color: #333333;
  120. font-weight: 300;
  121. }
  122. }
  123. .header-title {
  124. flex: 1;
  125. text-align: center;
  126. font-size: 32rpx;
  127. font-weight: 500;
  128. color: #000000;
  129. }
  130. .placeholder {
  131. width: 60rpx;
  132. }
  133. }
  134. }
  135. // 页面内容
  136. .page-body {
  137. flex: 1;
  138. padding: 40rpx;
  139. // 协议列表
  140. .agreement-list {
  141. .list-item {
  142. background-color: #ffffff;
  143. border-radius: 20rpx;
  144. padding: 40rpx;
  145. margin-bottom: 24rpx;
  146. display: flex;
  147. align-items: center;
  148. justify-content: space-between;
  149. box-shadow: 0 4rpx 20rpx rgba(0, 0, 0, 0.08);
  150. transition: all 0.3s ease;
  151. position: relative;
  152. overflow: hidden;
  153. &:active {
  154. transform: translateY(-4rpx);
  155. box-shadow: 0 8rpx 24rpx rgba(0, 0, 0, 0.12);
  156. }
  157. .item-content {
  158. flex: 1;
  159. display: flex;
  160. align-items: center;
  161. .item-icon-wrapper {
  162. display: flex;
  163. align-items: center;
  164. justify-content: center;
  165. margin-right: 32rpx;
  166. .item-icon {
  167. width: 48rpx;
  168. height: 48rpx;
  169. }
  170. }
  171. .item-info {
  172. flex: 1;
  173. display: flex;
  174. flex-direction: column;
  175. .item-title {
  176. font-size: 32rpx;
  177. color: #333333;
  178. font-weight: 600;
  179. margin-bottom: 8rpx;
  180. }
  181. .item-desc {
  182. font-size: 24rpx;
  183. color: #999999;
  184. line-height: 1.5;
  185. }
  186. }
  187. }
  188. .item-arrow {
  189. font-size: 48rpx;
  190. color: #d0d0d0;
  191. font-weight: 300;
  192. margin-left: 20rpx;
  193. }
  194. }
  195. }
  196. }
  197. }
  198. </style>