index.vue 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195
  1. <template>
  2. <view class="agreement-page">
  3. <!-- 顶部渐变背景区域 -->
  4. <view class="header-bg" :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('aggreement.title') }}</text>
  10. <view class="placeholder"></view>
  11. </view>
  12. </view>
  13. <!-- 页面内容 -->
  14. <view class="page-content">
  15. <!-- 协议列表 -->
  16. <view class="agreement-list">
  17. <!-- 用户协议 -->
  18. <view class="list-item" @click="handleUserAgreement">
  19. <view class="item-left">
  20. <image class="item-icon" src="/static/pages/my/agreement/user.png" mode="aspectFit" />
  21. <view class="item-info">
  22. <text class="item-title">{{ t('aggreement.userAgreement') }}</text>
  23. <text class="item-desc">{{ t('aggreement.userAgreementDesc') }}</text>
  24. </view>
  25. </view>
  26. <text class="arrow">›</text>
  27. </view>
  28. <!-- 隐私协议 -->
  29. <view class="list-item" @click="handlePrivacyPolicy">
  30. <view class="item-left">
  31. <image class="item-icon" src="/static/pages/my/agreement/privacy.png" mode="aspectFit" />
  32. <view class="item-info">
  33. <text class="item-title">{{ t('aggreement.privacyPolicy') }}</text>
  34. <text class="item-desc">{{ t('aggreement.privacyPolicyDesc') }}</text>
  35. </view>
  36. </view>
  37. <text class="arrow">›</text>
  38. </view>
  39. </view>
  40. </view>
  41. </view>
  42. </template>
  43. <script setup>
  44. import { ref, onMounted } from 'vue'
  45. import { useI18n } from 'vue-i18n'
  46. const { t } = useI18n()
  47. // 状态栏高度
  48. const statusBarHeight = ref(0)
  49. onMounted(() => {
  50. // 获取系统信息
  51. const windowInfo = uni.getWindowInfo()
  52. statusBarHeight.value = windowInfo.statusBarHeight || 0
  53. })
  54. // 返回上一页
  55. const handleBack = () => {
  56. const pages = getCurrentPages()
  57. if (pages.length > 1) {
  58. uni.navigateBack()
  59. } else {
  60. uni.reLaunch({
  61. url: '/pages/home/index'
  62. })
  63. }
  64. }
  65. // 用户协议
  66. const handleUserAgreement = () => {
  67. uni.navigateTo({
  68. url: '/pages/my/aggreement/detail?type=user'
  69. })
  70. }
  71. // 隐私协议
  72. const handlePrivacyPolicy = () => {
  73. uni.navigateTo({
  74. url: '/pages/my/aggreement/detail?type=privacy'
  75. })
  76. }
  77. </script>
  78. <style lang="scss" scoped>
  79. .agreement-page {
  80. width: 100%;
  81. min-height: 100vh;
  82. background-color: #f5f5f5;
  83. // 顶部渐变背景
  84. .header-bg {
  85. background: linear-gradient(180deg, #1ec9c9 0%, #1eb8b8 100%);
  86. .header-content {
  87. height: 88rpx;
  88. display: flex;
  89. align-items: center;
  90. justify-content: space-between;
  91. padding: 0 24rpx;
  92. .back-btn {
  93. width: 60rpx;
  94. height: 60rpx;
  95. display: flex;
  96. align-items: center;
  97. justify-content: flex-start;
  98. .back-icon {
  99. font-size: 56rpx;
  100. color: #ffffff;
  101. font-weight: 300;
  102. }
  103. }
  104. .header-title {
  105. flex: 1;
  106. text-align: center;
  107. font-size: 32rpx;
  108. font-weight: 600;
  109. color: #ffffff;
  110. }
  111. .placeholder {
  112. width: 60rpx;
  113. }
  114. }
  115. }
  116. // 页面内容
  117. .page-content {
  118. padding: 24rpx;
  119. // 协议列表
  120. .agreement-list {
  121. .list-item {
  122. background: #ffffff;
  123. border-radius: 16rpx;
  124. padding: 32rpx 24rpx;
  125. margin-bottom: 16rpx;
  126. display: flex;
  127. align-items: center;
  128. justify-content: space-between;
  129. box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.08);
  130. &:active {
  131. background-color: #f8f8f8;
  132. }
  133. .item-left {
  134. flex: 1;
  135. display: flex;
  136. align-items: center;
  137. .item-icon {
  138. width: 40rpx;
  139. height: 40rpx;
  140. margin-right: 24rpx;
  141. filter: brightness(0) saturate(100%) invert(68%) sepia(48%) saturate(1234%) hue-rotate(134deg) brightness(91%) contrast(92%);
  142. }
  143. .item-info {
  144. flex: 1;
  145. display: flex;
  146. flex-direction: column;
  147. gap: 8rpx;
  148. .item-title {
  149. font-size: 28rpx;
  150. color: #333333;
  151. font-weight: 500;
  152. }
  153. .item-desc {
  154. font-size: 24rpx;
  155. color: #999999;
  156. line-height: 1.4;
  157. }
  158. }
  159. }
  160. .arrow {
  161. font-size: 40rpx;
  162. color: #cccccc;
  163. font-weight: 300;
  164. margin-left: 16rpx;
  165. }
  166. }
  167. }
  168. }
  169. }
  170. </style>