diff --git a/pages/qr-code/qr-code.js b/pages/qr-code/qr-code.js
index 1fc046e..f7eabaf 100644
--- a/pages/qr-code/qr-code.js
+++ b/pages/qr-code/qr-code.js
@@ -207,8 +207,17 @@ Page({
// Show menu
showMenu: function() {
+ // Different menu options based on whether user is logged in or using test data
+ const menuItems = ['Save Image', 'Share QR Code', 'Refresh Data'];
+
+ if (this.data.isTestData) {
+ menuItems.push('Go to Login');
+ }
+
+ menuItems.push('Settings');
+
wx.showActionSheet({
- itemList: ['Save Image', 'Share QR Code', 'Refresh Data', 'Use Test Data', 'Settings'],
+ itemList: menuItems,
success: (res) => {
switch (res.tapIndex) {
case 0:
@@ -221,20 +230,50 @@ Page({
this.refreshUserInfo();
break;
case 3:
- this.forceTestData();
+ if (this.data.isTestData) {
+ this.goToLogin();
+ } else {
+ this.goToSettings();
+ }
break;
case 4:
- wx.navigateTo({
- url: '/pages/settings/settings'
- });
+ if (!this.data.isTestData) {
+ this.goToSettings();
+ }
break;
}
}
});
},
- // Force test data (for debugging)
+ // Navigate to login page
+ goToLogin: function() {
+ wx.navigateTo({
+ url: '/pages/login/login'
+ });
+ },
+
+ // Navigate to settings page
+ goToSettings: function() {
+ wx.navigateTo({
+ url: '/pages/settings/settings'
+ });
+ },
+
+ // Force test data (for debugging) - only works when not logged in
forceTestData: function() {
+ // Check if user is actually logged in
+ const userInfo = wx.getStorageSync('userInfo');
+ if (userInfo && userInfo.user && userInfo.token) {
+ wx.showModal({
+ title: 'Cannot Use Test Data',
+ content: 'You are currently logged in. Please log out first to use test data.',
+ showCancel: false,
+ confirmText: 'OK'
+ });
+ return;
+ }
+
console.log('Forcing test data...');
const testUserData = this.getTestUserData();
@@ -264,7 +303,7 @@ Page({
qrCodeUrl: ''
});
- // Always start with test data, then try real data
+ // Try to reload user info (will use real data if available, test data if not)
this.loadUserInfo();
},
diff --git a/pages/qr-code/qr-code.wxml b/pages/qr-code/qr-code.wxml
index bec17c4..463ff4e 100644
--- a/pages/qr-code/qr-code.wxml
+++ b/pages/qr-code/qr-code.wxml
@@ -66,12 +66,14 @@
{{userInfo.user.nickname || 'No nickname'}}{{userInfo.user.customId || 'No custom ID'}}
-
- 🧪 Test Data
+
+
+ 🧪 Demo Mode - Please Log In
+
+
-
@@ -89,4 +91,11 @@
-
\ No newline at end of file
+
+
+
+
+
+
+
+