This commit is contained in:
mzltMpfqGS
2026-04-15 19:45:16 +08:00
commit e4a087e67e
301 changed files with 35048 additions and 0 deletions

View File

@@ -0,0 +1,147 @@
// pages/settings/settings.js
// 系统设置逻辑处理
const app = getApp()
Page({
data: {
version: '1.0.0',
notificationEnabled: true,
locationEnabled: false,
autoPlayVideo: true,
cacheSize: '0KB'
},
onLoad() {
this.calculateCacheSize()
},
onShow() {
this.checkLoginStatus()
},
// 检查登录状态
checkLoginStatus() {
const userInfo = wx.getStorageSync('userInfo')
this.setData({ hasLogin: !!userInfo })
},
// 计算缓存大小
calculateCacheSize() {
wx.getStorageInfo({
success: res => {
const { currentSize, limitSize } = res
let size = ''
if (currentSize < 1024) {
size = currentSize + 'KB'
} else if (currentSize < 1024 * 1024) {
size = (currentSize / 1024).toFixed(2) + 'MB'
} else {
size = (currentSize / (1024 * 1024)).toFixed(2) + 'GB'
}
this.setData({ cacheSize: size })
}
})
},
// 清除缓存
onClearCache() {
wx.showModal({
title: '提示',
content: '确定要清除缓存吗?',
success: res => {
if (res.confirm) {
wx.showLoading({ title: '清除中...' })
wx.clearStorage({
success: () => {
wx.hideLoading()
wx.showToast({ title: '清除成功', icon: 'success' })
this.setData({ cacheSize: '0KB' })
},
fail: () => {
wx.hideLoading()
wx.showToast({ title: '清除失败', icon: 'none' })
}
})
}
}
})
},
// 切换通知
onNotificationChange(e) {
const enabled = e.detail.value
this.setData({ notificationEnabled: enabled })
if (enabled) {
wx.requestSubscribeMessage({
tmplIds: ['notification_template_id'],
success: () => {},
fail: () => {}
})
}
},
// 切换位置
onLocationChange(e) {
const enabled = e.detail.value
this.setData({ locationEnabled: enabled })
if (enabled) {
wx.getLocation({
type: 'gcj02',
success: () => {},
fail: () => {
wx.showToast({ title: '获取定位失败', icon: 'none' })
}
})
}
},
// 切换自动播放视频
onAutoPlayVideoChange(e) {
this.setData({ autoPlayVideo: e.detail.value })
},
// 用户协议
onUserAgreement() {
wx.navigateTo({
url: '/pages/web-view/web-view?url=https://www.notmaker.com/detail/8326a897119d4542896c863a69d7bbe7/gtt20260415/agreement'
})
},
// 隐私政策
onPrivacyPolicy() {
wx.navigateTo({
url: '/pages/web-view/web-view?url=https://www.notmaker.com/detail/8326a897119d4542896c863a69d7bbe7/gtt20260415/privacy'
})
},
// 关于我们
onAboutUs() {
wx.navigateTo({
url: '/pages/web-view/web-view?url=https://www.notmaker.com/detail/8326a897119d4542896c863a69d7bbe7/gtt20260415/about'
})
},
// 退出登录
onLogout() {
wx.showModal({
title: '提示',
content: '确定要退出登录吗?',
success: res => {
if (res.confirm) {
wx.removeStorageSync('userInfo')
wx.removeStorageSync('token')
wx.reLaunch({ url: '/pages/home/home' })
}
}
})
}
})
/**
* @联系作者16768118056
* @描述:(此项目非免费分享)源码百分百可用,搞定毕设不发愁,支持远程调试安装、二次开发、定制、讲解、文档类。
* @访问https://www.notmaker.com/detail/8326a897119d4542896c863a69d7bbe7/gtt20260415查看完整运行演示。
*/

View File

@@ -0,0 +1,10 @@
{
"usingComponents": {},
"navigationBarTitleText": "系统设置"
}
/**
* @16768118056
* @
* @访https://www.notmaker.com/detail/8326a897119d4542896c863a69d7bbe7/gtt20260415查看完整运行演示。
*/

View File

@@ -0,0 +1,75 @@
<!-- pages/settings/settings.wxml -->
<!-- 系统设置视图 -->
<view class="settings-container">
<!-- 消息通知 -->
<view class="section">
<view class="section-title">消息通知</view>
<view class="setting-item">
<text class="setting-label">接收通知</text>
<switch checked="{{notificationEnabled}}" bindchange="onNotificationChange" color="#667eea" />
</view>
</view>
<!-- 通用设置 -->
<view class="section">
<view class="section-title">通用设置</view>
<view class="setting-item">
<text class="setting-label">自动播放视频</text>
<switch checked="{{autoPlayVideo}}" bindchange="onAutoPlayVideoChange" color="#667eea" />
</view>
<view class="setting-item">
<text class="setting-label">清除缓存</text>
<view class="setting-value" bindtap="onClearCache">
<text>{{cacheSize}}</text>
<text class="iconfont icon-arrow-right"></text>
</view>
</view>
</view>
<!-- 隐私设置 -->
<view class="section">
<view class="section-title">隐私设置</view>
<view class="setting-item">
<text class="setting-label">位置信息</text>
<switch checked="{{locationEnabled}}" bindchange="onLocationChange" color="#667eea" />
</view>
</view>
<!-- 法律声明 -->
<view class="section">
<view class="section-title">法律声明</view>
<view class="setting-item" bindtap="onUserAgreement">
<text class="setting-label">用户协议</text>
<text class="iconfont icon-arrow-right"></text>
</view>
<view class="setting-item" bindtap="onPrivacyPolicy">
<text class="setting-label">隐私政策</text>
<text class="iconfont icon-arrow-right"></text>
</view>
</view>
<!-- 关于我们 -->
<view class="section">
<view class="section-title">关于</view>
<view class="setting-item" bindtap="onAboutUs">
<text class="setting-label">关于我们</text>
<text class="iconfont icon-arrow-right"></text>
</view>
<view class="setting-item">
<text class="setting-label">版本号</text>
<view class="setting-value">
<text>V{{version}}</text>
</view>
</view>
</view>
<!-- 退出登录 -->
<button class="logout-btn" wx:if="{{hasLogin}}" bindtap="onLogout">退出登录</button>
</view>
/**
* @联系作者16768118056
* @描述:(此项目非免费分享)源码百分百可用,搞定毕设不发愁,支持远程调试安装、二次开发、定制、讲解、文档类。
* @访问https://www.notmaker.com/detail/8326a897119d4542896c863a69d7bbe7/gtt20260415查看完整运行演示。
*/

View File

@@ -0,0 +1,69 @@
/* pages/settings/settings.wxss */
/* 系统设置样式 */
.settings-container {
min-height: 100vh;
background-color: #f5f5f5;
padding-bottom: 60rpx;
}
.section {
background-color: #fff;
margin-top: 20rpx;
}
.section-title {
padding: 24rpx 30rpx;
font-size: 24rpx;
color: #999;
border-bottom: 1rpx solid #f0f0f0;
}
.setting-item {
display: flex;
justify-content: space-between;
align-items: center;
padding: 28rpx 30rpx;
border-bottom: 1rpx solid #f0f0f0;
}
.setting-item:last-child {
border-bottom: none;
}
.setting-label {
font-size: 28rpx;
color: #333;
}
.setting-value {
display: flex;
align-items: center;
}
.setting-value text {
font-size: 28rpx;
color: #999;
}
.setting-value .iconfont {
margin-left: 12rpx;
font-size: 28rpx;
color: #999;
}
.logout-btn {
margin: 60rpx 30rpx;
height: 88rpx;
line-height: 88rpx;
font-size: 32rpx;
color: #F56C6C;
background-color: #fff;
border-radius: 44rpx;
}
/**
* @联系作者16768118056
* @描述:(此项目非免费分享)源码百分百可用,搞定毕设不发愁,支持远程调试安装、二次开发、定制、讲解、文档类。
* @访问https://www.notmaker.com/detail/8326a897119d4542896c863a69d7bbe7/gtt20260415查看完整运行演示。
*/