Initial Commit

This commit is contained in:
Rajuahamedkst 2025-09-12 16:08:17 +08:00
commit 1d71a02738
237 changed files with 64293 additions and 0 deletions

View file

@ -0,0 +1,266 @@
// pages/settingss/settingss.js
const app = getApp();
Page({
data: {
currentTheme: '浅色',
notificationStatus: '已开启',
currentLanguage: '中文',
isDarkMode: false,
// 初始化默认值避免null导致的错误
menuButtonInfo: {
height: 32, // 默认高度
width: 32, // 默认宽度
top: 0
},
statusBarHeight: 0,
// 聊天设置数据
chatSettings: {
fontSize: 'medium',
backgroundName: '默认背景',
showPreview: true
}
},
onLoad() {
try {
// 1. 获取系统信息(含状态栏高度)
const systemInfo = wx.getSystemInfoSync();
// 2. 获取胶囊按钮位置信息(用于导航栏对齐)
const menuButtonInfo = wx.getMenuButtonBoundingClientRect();
// 初始化全局设置对象
if (!app.globalData.settings) {
app.globalData.settings = {};
}
// 更新数据
this.setData({
isDarkMode: systemInfo.theme === 'dark',
statusBarHeight: systemInfo.statusBarHeight,
menuButtonInfo: menuButtonInfo || this.data.menuButtonInfo,
currentTheme: app.globalData.settings.theme || '浅色',
notificationStatus: app.globalData.settings.notification || '已开启',
currentLanguage: app.globalData.settings.language || '中文'
});
} catch (e) {
console.error('获取系统信息失败:', e);
}
},
// 返回上一页
navigateBack() {
wx.navigateBack();
},
// 切换主题
toggleTheme(e) {
const isDark = e.detail.value;
const newTheme = isDark ? '深色' : '浅色';
this.setData({
currentTheme: newTheme,
isDarkMode: isDark
});
app.globalData.settings.theme = newTheme;
wx.showToast({
title: `已切换到${newTheme}主题`,
icon: 'success'
});
},
// 跳转到账号安全
openAccountSecurity() {
wx.navigateTo({
url: '/pages/settings/account-security/account-security'
});
},
// 跳转到隐私设置
openPrivacySettings() {
wx.navigateTo({
url: '/pages/settings/privacy/privacy'
});
},
// 主题设置
openThemeSettings() {
const themes = ['浅色', '深色', '自动'];
wx.showActionSheet({
itemList: themes,
success: (res) => {
const selectedTheme = themes[res.tapIndex];
this.setData({ currentTheme: selectedTheme });
app.globalData.settings.theme = selectedTheme;
wx.showToast({
title: `已切换到${selectedTheme}主题`,
icon: 'success'
});
}
});
},
// 通知设置
openNotificationSettings() {
const options = ['已开启', '已关闭', '勿扰模式'];
wx.showActionSheet({
itemList: options,
success: (res) => {
const selectedStatus = options[res.tapIndex];
this.setData({ notificationStatus: selectedStatus });
app.globalData.settings.notification = selectedStatus;
wx.showToast({
title: `通知已${selectedStatus === '已开启' ? '开启' : selectedStatus === '已关闭' ? '关闭' : '设为勿扰'}`,
icon: 'success'
});
}
});
},
// 语言设置
openLanguageSettings() {
const languages = ['中文', 'English'];
wx.showActionSheet({
itemList: languages,
success: (res) => {
const selectedLanguage = languages[res.tapIndex];
this.setData({ currentLanguage: selectedLanguage });
app.globalData.settings.language = selectedLanguage;
wx.showToast({
title: `已切换到${selectedLanguage}`,
icon: 'success'
});
}
});
},
// 聊天设置
openChatSettings() {
const options = ['字体大小', '聊天背景', '信息预览'];
wx.showActionSheet({
itemList: options,
success: (res) => {
switch(res.tapIndex) {
case 0: // 字体大小
this.selectFontSize();
break;
case 1: // 聊天背景
this.selectChatBackground();
break;
case 2: // 信息预览
this.toggleMessagePreview();
break;
}
}
});
},
// 选择字体大小
selectFontSize() {
const fontSizeOptions = ['小', '中', '大'];
wx.showActionSheet({
itemList: fontSizeOptions,
success: (res) => {
const fontSize = ['small', 'medium', 'large'][res.tapIndex];
const chatSettings = this.data.chatSettings;
chatSettings.fontSize = fontSize;
this.setData({
chatSettings: chatSettings
});
// 保存设置
wx.setStorageSync('chatSettings', this.data.chatSettings);
wx.showToast({
title: `字体大小已设为${fontSizeOptions[res.tapIndex]}`,
icon: 'success'
});
}
});
},
// 选择聊天背景
selectChatBackground() {
const options = ['默认背景', '渐变蓝', '渐变紫', '自然风光', '抽象艺术'];
wx.showActionSheet({
itemList: options,
success: (res) => {
const backgroundName = options[res.tapIndex];
const chatSettings = this.data.chatSettings;
chatSettings.backgroundName = backgroundName;
this.setData({
chatSettings: chatSettings
});
// 保存设置
wx.setStorageSync('chatSettings', this.data.chatSettings);
wx.showToast({
title: `已切换到${backgroundName}`,
icon: 'success'
});
}
});
},
// 切换消息预览
toggleMessagePreview() {
const showPreview = !this.data.chatSettings.showPreview;
const chatSettings = this.data.chatSettings;
chatSettings.showPreview = showPreview;
this.setData({
chatSettings: chatSettings
});
// 保存设置
wx.setStorageSync('chatSettings', this.data.chatSettings);
wx.showToast({
title: `消息预览已${showPreview ? '开启' : '关闭'}`,
icon: 'success'
});
},
// 意见反馈
openFeedback() {
wx.navigateTo({
url: '/pages/settings/feedback/feedback'
});
},
// 关于
openAbout() {
wx.navigateTo({
url: '/pages/settings/about/about'
});
},
// 退出登录
logout() {
wx.showModal({
title: '退出登录',
content: '确定要退出登录吗?',
success: (res) => {
if (res.confirm) {
// 模拟退出登录
wx.showLoading({
title: '退出中...',
});
// 模拟网络请求延迟
setTimeout(() => {
wx.hideLoading();
wx.reLaunch({
url: '/pages/login/login'
});
}, 1000);
}
}
});
}
});

View file

@ -0,0 +1,9 @@
{
"navigationBarTitleText": "设置",
"navigationBarBackgroundColor": "#000000",
"navigationBarTextStyle": "white",
"backgroundColor": "#000000",
"disableScroll": false,
"navigationStyle": "custom",
"pageOrientation": "portrait"
}

View file

@ -0,0 +1,136 @@
<!-- pages/settingss/settingss.wxml -->
<view class="settings-container">
<!-- 顶部导航栏 - 使用动态高度 -->
<view class="navbar" style="height: {{navbarHeight}}px; padding-top: {{statusBarHeight}}px;">
<view class="back-btn" bindtap="navigateBack" style="height: {{menuButtonInfo.height}}px; line-height: {{menuButtonInfo.height}}px;">
<text class="icon">↩</text>
</view>
<view class="title" style="line-height: {{menuButtonInfo.height}}px;">设置</view>
<view class="back-btn" style="line-height: {{menuButtonInfo.height}}px;"></view>
</view>
<!-- 页面内容 -->
<scroll-view class="settings-content"
scroll-y
style="padding-top: {{statusBarHeight + menuButtonInfo.height + 30}}px; height: calc(100vh - {{statusBarHeight + menuButtonInfo.height + 30}}px);">
<!-- 账户与安全卡片 -->
<view class="menu-group">
<view class="group-header">
<view class="group-icon"></view>
<text class="group-title">账户与安全</text>
</view>
<view class="menu-item" bindtap="openAccountSecurity">
<view class="menu-icon security">🛡️</view>
<view class="menu-content">
<text class="menu-title">账号与安全</text>
<text class="menu-subtitle">手机号、邮箱管理</text>
</view>
<view class="menu-status">
<text class="status-text safe">安全</text>
</view>
<view class="menu-arrow"></view>
</view>
<view class="menu-item" bindtap="openPrivacySettings">
<view class="menu-icon privacy">👁️</view>
<view class="menu-content">
<text class="menu-title">隐私设置</text>
<text class="menu-subtitle">朋友权限、位置服务</text>
</view>
<view class="menu-arrow"></view>
</view>
</view>
<!-- 个性化设置卡片 -->
<view class="menu-group">
<view class="group-header">
<view class="group-icon"></view>
<text class="group-title">个性化</text>
</view>
<view class="menu-item" bindtap="openThemeSettings">
<view class="menu-icon theme">🌙</view>
<view class="menu-content">
<text class="menu-title">主题设置</text>
<text class="menu-subtitle">深色模式、主题颜色</text>
</view>
<view class="menu-status">
<text class="status-text">{{currentTheme || '浅色'}}</text>
</view>
<view class="menu-arrow"></view>
</view>
<view class="menu-item" bindtap="openNotificationSettings">
<view class="menu-icon notification">🔔</view>
<view class="menu-content">
<text class="menu-title">消息通知</text>
<text class="menu-subtitle">声音、震动、勿扰模式</text>
</view>
<view class="menu-status">
<text class="status-text">{{notificationStatus || '已开启'}}</text>
</view>
<view class="menu-arrow"></view>
</view>
<view class="menu-item" bindtap="openLanguageSettings">
<view class="menu-icon language">🌐</view>
<view class="menu-content">
<text class="menu-title">语言设置</text>
<text class="menu-subtitle">界面语言</text>
</view>
<view class="menu-status">
<text class="status-text">{{currentLanguage || '中文'}}</text>
</view>
<view class="menu-arrow"></view>
</view>
<view class="menu-item" bindtap="openChatSettings">
<view class="menu-icon chat">💬</view>
<view class="menu-content">
<text class="menu-title">聊天设置</text>
<text class="menu-subtitle">聊天背景、字体大小</text>
</view>
<view class="menu-arrow"></view>
</view>
</view>
<!-- 帮助与反馈卡片 -->
<view class="menu-group">
<view class="group-header">
<view class="group-icon"></view>
<text class="group-title">帮助与反馈</text>
</view>
<view class="menu-item" bindtap="openFeedback">
<view class="menu-icon feedback">💬</view>
<view class="menu-content">
<text class="menu-title">意见反馈</text>
<text class="menu-subtitle">提交故障、建议,及联系客服</text>
</view>
<view class="menu-arrow"></view>
</view>
<view class="menu-item" bindtap="openAbout">
<view class="menu-icon about"></view>
<view class="menu-content">
<text class="menu-title">关于我们</text>
<text class="menu-subtitle">版本信息、使用条款</text>
</view>
<view class="menu-arrow"></view>
</view>
</view>
<!-- 退出登录按钮 -->
<view class="logout-section">
<button class="logout-btn" bindtap="logout">
退出登录
</button>
</view>
<!-- 底部安全区域 -->
<view class="bottom-space"></view>
</scroll-view>
</view>

View file

@ -0,0 +1,190 @@
/* 修复标题位置的关键样式 */
/* 页面容器 */
.settings-container {
width: 100%;
height: 100vh;
background: #000000;
display: flex;
flex-direction: column;
/* color: #ffffff; */
}
/* 导航栏样式 - 移除固定高度设置由JS动态控制 */
.navbar {
position: fixed;
top: 0;
left: 0;
right: 0;
display: flex;
align-items: center;
/* background-color: #1a1a1a; */
/* border-bottom: 1px solid #333333; */
z-index: 10;
box-sizing: content-box; /* 确保padding不会影响总高度计算 */
}
.back-btn {
width: 48px;
display: flex;
align-items: center;
justify-content: center;
}
.icon {
font-size: 20px;
color: #ffffff;
}
.title {
flex: 1;
text-align: center;
font-size: 34rpx;
font-weight: 500;
color: #ffffff;
}
/* 滚动内容区 */
.settings-content {
flex: 1;
width: 100%;
box-sizing: border-box;
padding-left: 30rpx;
padding-right: 30rpx;
overflow-y: auto;
-webkit-overflow-scrolling: touch;
}
/* 菜单组样式 */
.menu-group {
background-color: #1a1a1a; /* 深色卡片背景,与黑色区分 */
border-radius: 20rpx;
margin-bottom: 30rpx;
overflow: hidden;
}
/* 组标题 */
.group-header {
display: flex;
align-items: center;
padding: 30rpx 30rpx 20rpx;
}
.group-icon {
font-size: 36rpx;
margin-right: 20rpx;
color: #ffffff;
}
.group-title {
color: #ffffff;
font-size: 30rpx;
font-weight: 500;
}
/* 菜单项 */
.menu-item {
display: flex;
align-items: center;
justify-content: space-between;
padding: 25rpx 30rpx;
border-top: 1px solid #333333; /* 浅色边框,区分菜单项 */
}
.menu-item:first-child {
border-top: none; /* 第一个菜单项去掉上边框 */
}
/* 菜单图标 */
.menu-icon {
font-size: 36rpx;
margin-right: 25rpx;
width: 40rpx; /* 固定宽度,避免图标大小不一导致错位 */
text-align: center;
}
.security { color: #4CAF50; }
.privacy { color: #2196F3; }
.theme { color: #FFC107; }
.notification { color: #FF9800; }
.language { color: #9C27B0; }
.chat { color: #E91E63; }
.feedback { color: #00BCD4; }
.about { color: #673AB7; }
/* 菜单内容 */
.menu-content {
flex: 1; /* 占满剩余空间 */
min-width: 0; /* 解决文字过长溢出问题 */
}
.menu-title {
color: #ffffff;
font-size: 30rpx;
display: block; /* 标题单独一行 */
margin-bottom: 5rpx;
}
.menu-subtitle {
color: #aaaaaa; /* 浅色副标题 */
font-size: 24rpx;
}
/* 菜单状态文本 */
.menu-status {
margin-right: 20rpx;
color: rgb(255, 255, 255);
}
.status-text {
font-size: 26rpx;
padding: 5rpx 15rpx;
border-radius: 20rpx;
}
.safe {
color: #dadada;
background-color: rgba(76, 175, 80, 0.1); /* 浅色背景 */
}
/* 菜单箭头 */
.menu-arrow {
color: #666666;
font-size: 30rpx;
}
/* 退出登录按钮 */
.logout-section {
padding: 40rpx 30rpx;
}
.logout-btn {
width: 100%;
height: 90rpx;
line-height: 90rpx;
/* 深蓝色到深灰色的渐变背景 */
background: linear-gradient(135deg, #044db4 0%, #156301 100%);
color: #ffffff;
font-size: 32rpx;
border-radius: 45rpx;
text-align: center;
padding: 0;
border: none;
outline: none;
/* 沙粒纹理效果 */
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='4' height='4' viewBox='0 0 4 4'%3E%3Cpath fill='%23ffffff' fill-opacity='0.05' d='M1 3h1v1H1V3zm2-2h1v1H3V1z'%3E%3C/path%3E%3C/svg%3E");
/* 增加质感和深度的阴影 */
box-shadow: 0 4px 6px -1px rgb(48, 51, 238),
inset 0 1px 0 rgb(255, 0, 0);
/* 过渡动画效果 */
transition: all 0.2s ease;
}
/* 点击效果 */
.logout-btn:active {
/* 点击时略微缩小 */
transform: scale(0.98);
/* 加深背景色 */
background: linear-gradient(135deg, #1d69d3 0%, #273140 100%);
/* 增强阴影 */
box-shadow: 0 2px 4px -1px rgba(250, 0, 0, 0.3),
inset 0 1px 0 rgba(255, 255, 255, 0.05);
}
/* 底部安全区域(适配全面屏底部) */
.bottom-space {
height: 60rpx;
}