diff --git a/xuan-deduct-uniapp/src/pages/mine/settings.vue b/xuan-deduct-uniapp/src/pages/mine/settings.vue index 0675a3f..79f65a8 100644 --- a/xuan-deduct-uniapp/src/pages/mine/settings.vue +++ b/xuan-deduct-uniapp/src/pages/mine/settings.vue @@ -11,6 +11,51 @@ + + + 个人信息 + + 昵称 + {{ userInfo.nickName || '未授权' }} + + + 头像 + + 未授权 + + + 地区 + {{ userInfo.city || '未授权' }} + + + + + 已获取权限 + + 用户信息 + + {{ permissions.userInfo ? '已授权' : '未授权' }} + + + + 位置信息 + + {{ permissions.location ? '已授权' : '未授权' }} + + + + 相机 + + {{ permissions.camera ? '已授权' : '未授权' }} + + + + 相册 + + {{ permissions.album ? '已授权' : '未授权' }} + + + @@ -20,22 +65,47 @@ export default { return { menus: [ { name: '我的账号', icon: '👤', path: '/pages/mine/account' }, - { name: '清理缓存', icon: '🗑️', action: 'clearCache' }, - { name: '用户协议', icon: '📄', action: 'userAgreement' }, - { name: '隐私政策', icon: '🔒', action: 'privacyPolicy' } - ] + { name: '清理缓存', icon: '🗑️', action: 'clearCache' } + ], + userInfo: { + nickName: '', + avatarUrl: '', + city: '' + }, + permissions: { + userInfo: false, + location: false, + camera: false, + album: false + } } }, + onShow() { + this.loadUserInfo() + this.checkPermissions() + }, methods: { + loadUserInfo() { + const userInfo = uni.getStorageSync('userInfo') + if (userInfo) { + this.userInfo = JSON.parse(userInfo) + } + }, + checkPermissions() { + uni.getSetting({ + success: (res) => { + this.permissions.userInfo = res.authSetting['scope.userInfo'] || false + this.permissions.location = res.authSetting['scope.userLocation'] || false + this.permissions.camera = res.authSetting['scope.camera'] || false + this.permissions.album = res.authSetting['scope.writePhotosAlbum'] || false + } + }) + }, openMenu(item) { if (item.path) { uni.navigateTo({ url: item.path }) } else if (item.action === 'clearCache') { this.clearCache() - } else if (item.action === 'userAgreement') { - uni.navigateTo({ url: '/pages/mine/agreement?type=user' }) - } else if (item.action === 'privacyPolicy') { - uni.navigateTo({ url: '/pages/mine/agreement?type=privacy' }) } }, clearCache() { @@ -75,6 +145,7 @@ page { display: flex; flex-direction: column; gap: 24rpx; + margin-bottom: 32rpx; } .menu-item { @@ -122,4 +193,95 @@ page { color: #6EE7B7; font-weight: 300; } + +.info-card { + background: rgba(255, 255, 255, 0.95); + border-radius: 24rpx; + padding: 32rpx; + margin-bottom: 24rpx; + box-shadow: 0 8rpx 32rpx rgba(16, 185, 129, 0.1); + border: 2rpx solid rgba(16, 185, 129, 0.1); +} + +.info-title { + font-size: 30rpx; + font-weight: 600; + color: #065F46; + display: block; + margin-bottom: 24rpx; +} + +.info-item { + display: flex; + align-items: center; + justify-content: space-between; + padding: 16rpx 0; + border-bottom: 2rpx solid #ECFDF5; +} + +.info-item:last-child { + border-bottom: none; +} + +.info-label { + font-size: 28rpx; + color: #6B7280; +} + +.info-value { + font-size: 28rpx; + color: #065F46; +} + +.info-avatar { + width: 60rpx; + height: 60rpx; + border-radius: 30rpx; +} + +.permission-card { + background: rgba(255, 255, 255, 0.95); + border-radius: 24rpx; + padding: 32rpx; + box-shadow: 0 8rpx 32rpx rgba(16, 185, 129, 0.1); + border: 2rpx solid rgba(16, 185, 129, 0.1); +} + +.permission-title { + font-size: 30rpx; + font-weight: 600; + color: #065F46; + display: block; + margin-bottom: 24rpx; +} + +.permission-item { + display: flex; + align-items: center; + justify-content: space-between; + padding: 16rpx 0; + border-bottom: 2rpx solid #ECFDF5; +} + +.permission-item:last-child { + border-bottom: none; +} + +.permission-label { + font-size: 28rpx; + color: #6B7280; +} + +.permission-status { + font-size: 26rpx; + color: #EF4444; + padding: 4rpx 16rpx; + background: #FEE2E2; + border-radius: 16rpx; +} + +.permission-status.granted { + color: #10B981; + background: #D1FAE5; +}