account-settings.vue 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229
  1. <template>
  2. <view class="account-settings" :class="{ 'dark-mode': darkMode }">
  3. <!-- 顶部导航栏 -->
  4. <view class="header">
  5. <view class="back-btn" @click="goBack">
  6. <text class="back-icon">←</text>
  7. </view>
  8. <text class="header-title">账户设置</text>
  9. <view class="placeholder"></view>
  10. </view>
  11. <scroll-view scroll-y class="content">
  12. <!-- 账号安全 -->
  13. <view class="group-block">
  14. <text class="group-title">账户安全</text>
  15. <view class="card">
  16. <view class="setting-item" @click="goTo('changePassword')">
  17. <view class="item-left">
  18. <text class="item-icon shield">🛡️</text>
  19. <text class="item-text">修改密码</text>
  20. </view>
  21. <text class="item-arrow">›</text>
  22. </view>
  23. <view class="setting-item" @click="goTo('phone')">
  24. <view class="item-left">
  25. <text class="item-icon phone">📱</text>
  26. <text class="item-text">手机号码</text>
  27. </view>
  28. <view class="item-right">
  29. <text class="item-value">{{ phoneNumber }}</text>
  30. <text class="item-arrow">›</text>
  31. </view>
  32. </view>
  33. </view>
  34. </view>
  35. <!-- 功能设置 -->
  36. <view class="group-block">
  37. <text class="group-title">功能设置</text>
  38. <view class="card">
  39. <view class="setting-item">
  40. <view class="item-left">
  41. <text class="item-icon bell">🔔</text>
  42. <text class="item-text">新消息通知</text>
  43. </view>
  44. <switch :checked="notifyNewMessage" @change="e => notifyNewMessage = e.detail.value" color="#9C27B0" />
  45. </view>
  46. <view class="setting-item">
  47. <view class="item-left">
  48. <text class="item-icon heart">💜</text>
  49. <text class="item-text">匹配成功通知</text>
  50. </view>
  51. <switch :checked="notifyMatchSuccess" @change="e => notifyMatchSuccess = e.detail.value" color="#9C27B0" />
  52. </view>
  53. <view class="setting-item">
  54. <view class="item-left">
  55. <text class="item-icon horn">📣</text>
  56. <text class="item-text">系统公告通知</text>
  57. </view>
  58. <switch :checked="notifySystem" @change="e => notifySystem = e.detail.value" color="#9C27B0" />
  59. </view>
  60. </view>
  61. </view>
  62. <!-- 显示设置 -->
  63. <view class="group-block">
  64. <text class="group-title">显示设置</text>
  65. <view class="card">
  66. <view class="setting-item">
  67. <view class="item-left">
  68. <text class="item-icon moon">🌙</text>
  69. <text class="item-text">深色模式</text>
  70. </view>
  71. <switch :checked="darkMode" @change="onToggleDarkMode" color="#9C27B0" />
  72. </view>
  73. </view>
  74. </view>
  75. </scroll-view>
  76. </view>
  77. </template>
  78. <script>
  79. export default {
  80. name: 'matchmaker-account-settings',
  81. data() {
  82. return {
  83. phoneNumber: '138****5678',
  84. notifyNewMessage: true,
  85. notifyMatchSuccess: true,
  86. notifySystem: true,
  87. darkMode: false
  88. }
  89. },
  90. onLoad() {
  91. // 读取本地存储的深色模式状态
  92. const stored = uni.getStorageSync('matchmakerDarkMode')
  93. if (stored === true || stored === false) {
  94. this.darkMode = stored
  95. }
  96. },
  97. methods: {
  98. goBack() {
  99. uni.navigateBack()
  100. },
  101. goTo(type) {
  102. // 这里预留具体跳转逻辑
  103. uni.showToast({
  104. title: '功能开发中',
  105. icon: 'none'
  106. })
  107. },
  108. onToggleDarkMode(e) {
  109. const value = e.detail.value
  110. this.darkMode = value
  111. uni.setStorageSync('matchmakerDarkMode', value)
  112. }
  113. }
  114. }
  115. </script>
  116. <style lang="scss" scoped>
  117. .account-settings {
  118. min-height: 100vh;
  119. background: #F5F5F5;
  120. display: flex;
  121. flex-direction: column;
  122. color: #333;
  123. }
  124. .header {
  125. display: flex;
  126. align-items: center;
  127. justify-content: space-between;
  128. padding: 25rpx 30rpx;
  129. padding-top: calc(25rpx + env(safe-area-inset-top));
  130. background: #E9D7F5;
  131. .back-btn {
  132. width: 60rpx;
  133. height: 60rpx;
  134. display: flex;
  135. align-items: center;
  136. justify-content: center;
  137. .back-icon {
  138. font-size: 40rpx;
  139. color: #333;
  140. font-weight: bold;
  141. }
  142. }
  143. .header-title {
  144. font-size: 36rpx;
  145. font-weight: bold;
  146. color: #333;
  147. }
  148. .placeholder {
  149. width: 60rpx;
  150. }
  151. }
  152. .content {
  153. flex: 1;
  154. background: #F5F5F5;
  155. }
  156. .group-block {
  157. margin-top: 20rpx;
  158. .group-title {
  159. padding: 30rpx 30rpx 10rpx;
  160. font-size: 26rpx;
  161. color: #999;
  162. }
  163. .card {
  164. margin: 0 20rpx;
  165. background: #FFFFFF;
  166. border-radius: 20rpx;
  167. box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.04);
  168. overflow: hidden;
  169. }
  170. }
  171. .setting-item {
  172. display: flex;
  173. align-items: center;
  174. justify-content: space-between;
  175. padding: 28rpx 26rpx;
  176. border-bottom: 1rpx solid #F5F5F5;
  177. &:last-child {
  178. border-bottom: none;
  179. }
  180. .item-left {
  181. display: flex;
  182. align-items: center;
  183. flex: 1;
  184. .item-icon {
  185. font-size: 34rpx;
  186. margin-right: 18rpx;
  187. }
  188. .item-text {
  189. font-size: 30rpx;
  190. color: #333;
  191. }
  192. }
  193. .item-right {
  194. display: flex;
  195. align-items: center;
  196. .item-value {
  197. font-size: 26rpx;
  198. color: #999;
  199. margin-right: 10rpx;
  200. }
  201. }
  202. .item-arrow {
  203. font-size: 34rpx;
  204. color: #CCC;
  205. }
  206. }
  207. </style>