index.vue 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299
  1. <template>
  2. <view class="settings-page">
  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="settings-list">
  14. <view class="setting-item" @click="goToPage('bindPhone')">
  15. <view class="item-left">
  16. <text class="item-icon">📱</text>
  17. <text class="item-text">绑定手机号</text>
  18. </view>
  19. <view class="item-right">
  20. <text class="item-value">{{ phoneNumber }}</text>
  21. <text class="item-arrow">›</text>
  22. </view>
  23. </view>
  24. <view class="setting-item" @click="goToPage('bindIdCard')">
  25. <view class="item-left">
  26. <text class="item-icon">🪪</text>
  27. <text class="item-text">绑定身份证号</text>
  28. </view>
  29. <view class="item-right">
  30. <text class="item-value">{{ idCardNumber }}</text>
  31. <text class="item-arrow">›</text>
  32. </view>
  33. </view>
  34. <view class="setting-item" @click="goToPage('educationVerify')">
  35. <view class="item-left">
  36. <text class="item-icon">🎓</text>
  37. <text class="item-text">学历认证</text>
  38. </view>
  39. <view class="item-right">
  40. <text class="item-value">{{ educationStatus }}</text>
  41. <text class="item-arrow">›</text>
  42. </view>
  43. </view>
  44. <view class="setting-item" @click="goToPage('accountSecurity')">
  45. <view class="item-left">
  46. <text class="item-icon">🛡️</text>
  47. <text class="item-text">账号与安全</text>
  48. </view>
  49. <view class="item-right">
  50. <text class="item-value">已保护</text>
  51. <text class="item-arrow">›</text>
  52. </view>
  53. </view>
  54. <view class="setting-item" @click="goToPage('privacy')">
  55. <view class="item-left">
  56. <text class="item-icon">🔒</text>
  57. <text class="item-text">隐私设置</text>
  58. </view>
  59. <text class="item-arrow">›</text>
  60. </view>
  61. <view class="setting-item" @click="goToPage('about')">
  62. <view class="item-left">
  63. <text class="item-icon">ℹ️</text>
  64. <text class="item-text">关于我们</text>
  65. </view>
  66. <text class="item-arrow">›</text>
  67. </view>
  68. <view class="setting-item logout-item" @click="handleLogout">
  69. <view class="item-left">
  70. <text class="item-icon">🚪</text>
  71. <text class="item-text">退出登录</text>
  72. </view>
  73. <text class="item-arrow">›</text>
  74. </view>
  75. </view>
  76. </scroll-view>
  77. </view>
  78. </template>
  79. <script>
  80. export default {
  81. data() {
  82. return {
  83. phoneNumber: '未绑定',
  84. idCardNumber: '未绑定',
  85. educationStatus: '未认证'
  86. }
  87. },
  88. onLoad() {
  89. this.loadUserInfo()
  90. },
  91. methods: {
  92. goBack() {
  93. uni.navigateBack()
  94. },
  95. loadUserInfo() {
  96. // 获取用户信息
  97. const userInfo = uni.getStorageSync('userInfo')
  98. // 加载手机号
  99. if (userInfo && userInfo.phone) {
  100. this.phoneNumber = this.maskPhone(userInfo.phone)
  101. } else {
  102. this.phoneNumber = '未绑定'
  103. }
  104. // 加载身份证号
  105. if (userInfo && userInfo.idCard) {
  106. this.idCardNumber = this.maskIdCard(userInfo.idCard)
  107. } else {
  108. this.idCardNumber = '未绑定'
  109. }
  110. // 加载学历认证状态
  111. if (userInfo && userInfo.isEducationVerified) {
  112. this.educationStatus = '已认证'
  113. } else {
  114. this.educationStatus = '未认证'
  115. }
  116. },
  117. maskPhone(phone) {
  118. if (!phone || phone.length < 11) return phone
  119. return phone.substring(0, 3) + '****' + phone.substring(7)
  120. },
  121. maskIdCard(idCard) {
  122. if (!idCard || idCard.length < 8) return idCard
  123. return idCard.substring(0, 6) + '********' + idCard.substring(idCard.length - 4)
  124. },
  125. goToPage(page) {
  126. console.log('跳转页面:', page)
  127. if (page === 'bindIdCard') {
  128. // 跳转到身份证绑定页面
  129. uni.navigateTo({
  130. url: '/pages/settings/id-verification'
  131. })
  132. } else if (page === 'bindPhone') {
  133. // 跳转到手机号绑定页面
  134. uni.showToast({
  135. title: '功能开发中',
  136. icon: 'none'
  137. })
  138. } else {
  139. // 其他功能
  140. uni.showToast({
  141. title: '功能开发中',
  142. icon: 'none'
  143. })
  144. }
  145. },
  146. handleLogout() {
  147. uni.showModal({
  148. title: '退出登录',
  149. content: '确定要退出登录吗?',
  150. success: (res) => {
  151. if (res.confirm) {
  152. // 清除登录信息
  153. uni.clearStorageSync()
  154. // 跳转到登录页
  155. uni.reLaunch({
  156. url: '/pages/page3/page3'
  157. })
  158. }
  159. }
  160. })
  161. }
  162. }
  163. }
  164. </script>
  165. <style lang="scss" scoped>
  166. .settings-page {
  167. min-height: 100vh;
  168. background: #F5F5F5;
  169. display: flex;
  170. flex-direction: column;
  171. }
  172. /* 顶部导航栏 */
  173. .header {
  174. display: flex;
  175. align-items: center;
  176. justify-content: space-between;
  177. padding: 25rpx 30rpx;
  178. padding-top: calc(25rpx + env(safe-area-inset-top));
  179. background: #FFFFFF;
  180. border-bottom: 1rpx solid #F0F0F0;
  181. .back-btn {
  182. width: 60rpx;
  183. height: 60rpx;
  184. display: flex;
  185. align-items: center;
  186. justify-content: center;
  187. .back-icon {
  188. font-size: 40rpx;
  189. color: #333333;
  190. font-weight: bold;
  191. }
  192. }
  193. .header-title {
  194. font-size: 36rpx;
  195. font-weight: bold;
  196. color: #333333;
  197. }
  198. .placeholder {
  199. width: 60rpx;
  200. }
  201. }
  202. .content {
  203. flex: 1;
  204. background: #F5F5F5;
  205. }
  206. /* 分组标题 */
  207. .group-title {
  208. padding: 30rpx 30rpx 20rpx;
  209. font-size: 28rpx;
  210. color: #999999;
  211. }
  212. /* 设置列表 */
  213. .settings-list {
  214. background: #FFFFFF;
  215. .setting-item {
  216. display: flex;
  217. align-items: center;
  218. justify-content: space-between;
  219. padding: 35rpx 30rpx;
  220. border-bottom: 1rpx solid #F5F5F5;
  221. transition: background-color 0.2s;
  222. &:active {
  223. background-color: #F8F8F8;
  224. }
  225. &:last-child {
  226. border-bottom: none;
  227. }
  228. .item-left {
  229. display: flex;
  230. align-items: center;
  231. flex: 1;
  232. .item-icon {
  233. font-size: 40rpx;
  234. margin-right: 20rpx;
  235. }
  236. .item-text {
  237. font-size: 32rpx;
  238. color: #333333;
  239. }
  240. }
  241. .item-right {
  242. display: flex;
  243. align-items: center;
  244. .item-value {
  245. font-size: 28rpx;
  246. color: #999999;
  247. margin-right: 15rpx;
  248. }
  249. .item-arrow {
  250. font-size: 40rpx;
  251. color: #CCCCCC;
  252. font-weight: 300;
  253. }
  254. }
  255. .item-arrow {
  256. font-size: 40rpx;
  257. color: #CCCCCC;
  258. font-weight: 300;
  259. }
  260. }
  261. }
  262. </style>