diff --git a/pages/index/index.js b/pages/index/index.js
index 0beb1bc..24caf5d 100644
--- a/pages/index/index.js
+++ b/pages/index/index.js
@@ -56,6 +56,7 @@ Page({
showAuthModal: false,
showOneKeyLoginModal: false,
showAddToHomeModal: false,
+ showUserAgreementModal: false, // 用户协议与隐私政策弹窗
userInfo: {},
needPhoneAuth: false,
testMode: true,
@@ -589,6 +590,10 @@ Page({
lastScrollTop: 0,
headerElementsHidden: false
});
+
+ // 检查用户是否已同意协议
+ this.checkUserAgreement();
+
this.checkAndRestoreLoginStatus()
this.loadCategories()
this.loadGoods()
@@ -889,6 +894,51 @@ Page({
return region;
},
+
+ // 检查用户是否已同意协议
+ checkUserAgreement: function() {
+ const hasAgreed = wx.getStorageSync('userAgreementAgreed');
+ if (!hasAgreed) {
+ this.setData({
+ showUserAgreementModal: true
+ });
+ }
+ },
+
+ // 同意用户协议
+ agreeUserAgreement: function() {
+ wx.setStorageSync('userAgreementAgreed', true);
+ this.setData({
+ showUserAgreementModal: false
+ });
+ },
+
+ // 不同意用户协议
+ disagreeUserAgreement: function() {
+ // 可以选择关闭小程序或继续显示弹窗
+ wx.showToast({
+ title: '您需要同意协议才能使用小程序',
+ icon: 'none'
+ });
+ },
+
+ // 跳转到用户服务协议页面
+ navigateToUserServiceAgreement: function() {
+ // 这里可以跳转到具体的协议页面,暂时使用提示
+ wx.showToast({
+ title: '跳转至用户服务协议',
+ icon: 'none'
+ });
+ },
+
+ // 跳转到隐私政策页面
+ navigateToPrivacyPolicy: function() {
+ // 这里可以跳转到具体的隐私政策页面,暂时使用提示
+ wx.showToast({
+ title: '跳转至隐私政策',
+ icon: 'none'
+ });
+ },
// 格式化商品规格显示 - 只显示前两个,后面加...
formatSpecification: function (spec, yolk) {
diff --git a/pages/index/index.wxml b/pages/index/index.wxml
index d60756d..dd07d02 100644
--- a/pages/index/index.wxml
+++ b/pages/index/index.wxml
@@ -151,6 +151,33 @@
+
+
+
+
+
+
+ 为更好保障您的个人权益,请您在使用本应用前,仔细阅读
+
+ 《用户服务协议》
+ 及
+ 《隐私政策》
+
+ ;我们同时提供
+
+ 《隐私政策摘要》
+
+ 帮助您快速了解本应用如何收集、使用、传输、存储、对外提供、保护您的个人信息及您的权利如何行使。
+ 点击"同意",视为您已经充分理解并同意《用户服务协议》、《隐私政策》及上述内容。
+
+
+
+
diff --git a/pages/index/index.wxss b/pages/index/index.wxss
index 32e243c..54d9d52 100644
--- a/pages/index/index.wxss
+++ b/pages/index/index.wxss
@@ -2423,3 +2423,97 @@ video.product-media {
.modal-button:active {
background-color: #40a9ff;
}
+
+/* 用户协议与隐私政策弹窗样式 */
+.user-agreement-overlay {
+ position: fixed;
+ top: 0;
+ left: 0;
+ right: 0;
+ bottom: 0;
+ background: rgba(0, 0, 0, 0.5);
+ z-index: 1000;
+ display: flex;
+ justify-content: center;
+ align-items: center;
+}
+
+.user-agreement-container {
+ background: white;
+ border-radius: 20rpx;
+ width: 90%;
+ max-height: 80vh;
+ overflow: hidden;
+ display: flex;
+ flex-direction: column;
+ box-shadow: 0 8rpx 32rpx rgba(0, 0, 0, 0.1);
+}
+
+.agreement-header {
+ padding: 32rpx;
+ text-align: center;
+ border-bottom: 2rpx solid #f5f5f5;
+}
+
+.agreement-title {
+ font-size: 36rpx;
+ font-weight: bold;
+ color: #333;
+}
+
+.agreement-content {
+ padding: 32rpx;
+ flex: 1;
+ overflow-y: auto;
+ line-height: 1.6;
+}
+
+.agreement-text {
+ font-size: 30rpx;
+ color: #666;
+ display: block;
+ margin-bottom: 20rpx;
+}
+
+.agreement-link {
+ color: #1890ff;
+ text-decoration: underline;
+ font-size: 30rpx;
+}
+
+.agreement-footer {
+ padding: 32rpx;
+ border-top: 2rpx solid #f5f5f5;
+ display: flex;
+ gap: 24rpx;
+}
+
+.disagree-btn {
+ flex: 1;
+ background: #f5f5f5;
+ color: #666;
+ border: none;
+ border-radius: 12rpx;
+ padding: 20rpx;
+ font-size: 32rpx;
+ font-weight: bold;
+}
+
+.agree-btn {
+ flex: 1;
+ background: #1890ff;
+ color: white;
+ border: none;
+ border-radius: 12rpx;
+ padding: 20rpx;
+ font-size: 32rpx;
+ font-weight: bold;
+}
+
+.disagree-btn:active {
+ background: #e0e0e0;
+}
+
+.agree-btn:active {
+ background: #096dd9;
+}