| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812 |
- const Parse = getApp().Parse;
- const company = getApp().globalData.company;
- const login = require("../../../utils/login");
- Component({
- /**
- * 组件的属性列表
- */
- properties: {
- },
- data: {
- // 轮播图相关数据
- currentSwiperIndex: 0,
- },
- lifetimes: {
- created() {},
- attached: function () {
- // 页面加载时检查是否首次访问
- this.checkFirstVisit();
-
- // 在控制台显示当前登录用户信息
- this.showCurrentUser();
- },
- },
- pageLifetimes: {
- show: function() {
- // 页面显示时,检查并更新登录状态
- const currentUser = Parse.User.current();
- if (currentUser && currentUser.get('mobile')) {
- const userLogin = wx.getStorageSync('userLogin');
- if (!userLogin || userLogin !== currentUser.id) {
- wx.setStorageSync("userLogin", currentUser.id);
- console.log('✅ 页面显示时更新 userLogin:', currentUser.id);
- }
- }
-
- // 更新显示的用户信息
- this.showCurrentUser();
- }
- },
- /**
- * 组件的方法列表
- */
- methods: {
- /**
- * 在控制台显示当前登录用户信息
- */
- showCurrentUser() {
- const currentUser = Parse.User.current();
-
- console.log('===========================================');
- console.log('======= 当前登录用户信息 =======');
- console.log('===========================================');
-
- if (currentUser) {
- console.log('✅ 用户已登录');
- console.log('📱 用户ID:', currentUser.id);
- console.log('📞 手机号:', currentUser.get('mobile') || '未设置');
- console.log('👤 用户名:', currentUser.get('username') || '未设置');
- console.log('🔑 Session Token:', currentUser.getSessionToken());
- console.log('📧 邮箱:', currentUser.get('email') || '未设置');
- console.log('📦 完整用户对象:', currentUser);
- console.log('📋 所有属性:', currentUser.attributes);
- } else {
- console.log('❌ 当前没有登录用户');
- }
-
- console.log('===========================================');
- },
- /**
- * 检查是否首次访问
- */
- checkFirstVisit() {
- try {
- const hasVisited = wx.getStorageSync('hasVisitedWelcome');
- if (!hasVisited) {
- console.log('首次访问,显示引导页');
- } else {
- console.log('已访问过,可选择是否直接跳转');
- // 如果需要自动跳转到主页,可以在这里调用 this.navigateToHome()
- }
- } catch (e) {
- console.error('检查访问状态失败:', e);
- }
- },
- /**
- * 点击"立即开始探索"按钮
- */
- onStart() {
- console.log('===========================================');
- console.log('🚀 调用了 onStart 方法(立即开始探索)');
- console.log('===========================================');
-
- // 标记已访问
- wx.setStorageSync('hasVisitedWelcome', true);
-
- // 跳转到 H5 主页
- this.navigateToHome();
- },
- /**
- * 点击"跳过引导"按钮
- */
- onSkip() {
- // 标记已访问
- wx.setStorageSync('hasVisitedWelcome', true);
-
- // 跳转到 H5 主页
- this.navigateToHome();
- },
- /**
- * 点击"查看新手指南"
- */
- onGuide() {
- wx.showToast({
- title: '新手指南开发中',
- icon: 'none',
- duration: 2000
- });
-
- // TODO: 后续可以跳转到新手指南页面
- // wx.navigateTo({
- // url: '/pages/guide/index'
- // });
- },
- /**
- * 验证 token 是否有效
- */
- async validateToken(token) {
- try {
- console.log('🔍 开始验证 token 有效性...');
-
- // 使用 Parse.User.become() 验证 token
- const user = await Parse.User.become(token);
-
- if (user) {
- console.log('✅ Token 有效!用户:', user.id);
- return true;
- }
-
- console.log('⚠️ Token 验证返回空用户');
- return false;
- } catch (error) {
- console.error('❌ Token 验证失败:', error.message);
- return false;
- }
- },
- /**
- * 刷新用户 session token
- */
- async refreshToken() {
- try {
- console.log('🔄 开始刷新 token...');
-
- const currentUser = Parse.User.current();
- if (!currentUser) {
- console.error('❌ 当前没有登录用户,无法刷新 token');
- return null;
- }
-
- // 保存用户信息以触发 session token 刷新
- await currentUser.fetch();
- const newToken = currentUser.getSessionToken();
-
- console.log('✅ Token 刷新成功');
- console.log('🔑 新 Token (前20字符):', newToken.substring(0, 20));
-
- return newToken;
- } catch (error) {
- console.error('❌ Token 刷新失败:', error.message);
- return null;
- }
- },
- /**
- * 获取店铺 ID
- */
- async getStoreId() {
- try {
- console.log('🏪 开始获取店铺 ID...');
- const defaultStoreId = 'pkPdAnLAUZ'; // 超级门店ID
- const configuredStoreId =
- wx.getStorageSync('storeId') ||
- getApp().globalData.storeId ||
- defaultStoreId;
- console.log('✅ 使用店铺 ID:', configuredStoreId);
- return configuredStoreId;
- } catch (error) {
- console.error('❌ 获取店铺 ID 失败:', error);
- return null;
- }
- },
- /**
- * 获取店铺信息(id 与 名称)
- */
- async getStoreInfo() {
- try {
- const defaultStoreId = 'pkPdAnLAUZ'; // 超级门店ID
- const effectiveStoreId =
- wx.getStorageSync('storeId') ||
- getApp().globalData.storeId ||
- defaultStoreId;
- const query = new Parse.Query('ShopStore');
- query.equalTo('objectId', effectiveStoreId);
- const store = await query.first();
- if (store) {
- const name = store.get('storeName') || '';
- console.log('✅ 获取店铺信息:', { id: effectiveStoreId, name });
- return { id: effectiveStoreId, name };
- } else {
- console.log('⚠️ 未找到店铺,仅返回 ID');
- return { id: effectiveStoreId, name: '' };
- }
- } catch (e) {
- console.error('获取店铺信息失败:', e);
- return { id: wx.getStorageSync('storeId') || 'pkPdAnLAUZ', name: '' };
- }
- },
- /**
- * 跳转到 H5 主页
- */
- async navigateToHome() {
- console.log('===========================================');
- console.log('======= navigateToHome 被调用 =======');
- console.log('===========================================');
-
- const currentUser = Parse.User.current();
- let userInfo = wx.getStorageSync("userLogin");
-
- console.log('当前用户:', currentUser ? '已登录' : '未登录');
- console.log('userInfo:', userInfo);
-
- // 如果用户未登录,直接进入游客模式(简化流程)
- if (!currentUser || userInfo == '') {
- console.log('⚠️ 用户未登录,直接进入游客模式');
-
- // 直接进入游客模式,不显示提示框
- this.navigateToHomeAsGuest();
- return;
- }
-
- let token = currentUser.getSessionToken();
-
- if (!token) {
- console.error('❌ 无法获取 Session Token!');
- wx.showToast({
- title: '获取登录信息失败',
- icon: 'none'
- });
- return;
- }
-
- // 验证 token 是否有效
- const isValid = await this.validateToken(token);
-
- if (!isValid) {
- wx.showLoading({
- title: '正在刷新登录...'
- });
-
- // 尝试刷新 token
- const newToken = await this.refreshToken();
-
- wx.hideLoading();
-
- if (newToken) {
- token = newToken;
- } else {
- console.error('❌ Token 刷新失败,需要重新登录');
- wx.showModal({
- title: '提示',
- content: '登录已过期,请重新登录',
- showCancel: false,
- success: () => {
- wx.navigateTo({
- url: 'plugin://fm-plugin/fm-auth'
- });
- }
- });
- return;
- }
- } else {
- // token 验证通过
- }
-
- // 获取店铺信息
- const store = await this.getStoreInfo();
- const storeId = store && store.id ? store.id : null;
- const storeName = store && store.name ? store.name : '';
-
- // 构建 H5 URL(重要:storeId 和 token 作为查询参数)
- let h5Url = `https://app.fmode.cn/dev/pobingfeng/owner/nav/home?`;
-
- // 如果有 storeId,添加到 URL 中
- if (storeId) {
- h5Url += `storeId=${storeId}&`;
- }
-
- h5Url += `token=${token}`;
-
- console.log('🌐 H5 URL:', h5Url);
- console.log(' - URL 长度:', h5Url.length);
- if (storeId) {
- console.log(' - 店铺 ID:', storeId);
- }
-
- // 编码后的 URL
- const encodedUrl = encodeURIComponent(h5Url);
- console.log('📦 编码后的 URL:', encodedUrl.substring(0, 100) + '...');
-
- // 最终的小程序页面路径
- // 传递店铺信息给 web-view 页面,优先用于设置标题
- let webViewPath = `/common-page/pages/web-view/index?path=${encodedUrl}`;
- if (storeId) {
- webViewPath += `&storeId=${storeId}`;
- }
- if (storeName) {
- webViewPath += `&storeName=${encodeURIComponent(storeName)}`;
- }
- console.log('📄 web-view 页面路径:', webViewPath.substring(0, 100) + '...');
- console.log('===========================================');
-
- wx.navigateTo({
- url: webViewPath,
- success: () => {
- console.log('✅ 跳转成功');
- },
- fail: (err) => {
- console.error('❌ 跳转失败:', err);
- wx.showToast({
- title: '跳转失败,请重试',
- icon: 'none'
- });
- }
- });
- },
-
- /**
- * 游客模式跳转到主页
- */
- async navigateToHomeAsGuest() {
- try {
- console.log('===========================================');
- console.log('======= 游客模式访问 =======');
- console.log('===========================================');
-
- // 标记为游客模式
- wx.setStorageSync('isGuestMode', true);
-
- // ✅ 游客默认使用超级门店ID,确保有数据
- const superStoreId = 'pkPdAnLAUZ'; // 超级门店ID
-
- // 设置超级门店ID到存储
- wx.setStorageSync('storeId', superStoreId);
- getApp().globalData.storeId = superStoreId;
-
- console.log('✅ 游客使用超级门店ID:', superStoreId);
-
- // 获取店铺信息
- const store = await this.getStoreInfo();
- const storeId = store && store.id ? store.id : superStoreId;
- const storeName = store && store.name ? store.name : '超级门店';
-
- console.log('✅ 店铺信息:', { id: storeId, name: storeName });
-
- // 构建 H5 URL(游客模式,不传 token)
- let h5Url = `https://app.fmode.cn/dev/pobingfeng/owner/nav/home?`;
-
- h5Url += `storeId=${storeId}&`;
-
- // 添加游客模式标识
- h5Url += `guestMode=true`;
-
- console.log('🌐 游客模式 H5 URL:', h5Url);
- console.log('');
- console.log('⚠️⚠️⚠️ 重要提示 ⚠️⚠️⚠️');
- console.log('如果H5页面显示的不是超级门店,说明H5端没有正确使用URL中的storeId参数!');
- console.log('H5端需要确保:');
- console.log('1. 从URL中读取 storeId 参数');
- console.log('2. 优先使用URL传递的 storeId,不要被其他逻辑覆盖');
- console.log('3. 不要使用localStorage缓存的旧门店ID');
- console.log('');
- console.log('请复制以下URL在浏览器中测试:');
- console.log(h5Url);
- console.log('===========================================');
-
- // 编码后的 URL
- const encodedUrl = encodeURIComponent(h5Url);
-
- // 跳转
- let webViewPath = `/common-page/pages/web-view/index?path=${encodedUrl}`;
- webViewPath += `&storeId=${storeId}`;
- if (storeName) {
- webViewPath += `&storeName=${encodeURIComponent(storeName)}`;
- }
-
- console.log('📄 web-view 页面路径:', webViewPath.substring(0, 100) + '...');
- console.log('===========================================');
-
- wx.navigateTo({
- url: webViewPath,
- success: () => {
- console.log('✅ 游客模式跳转成功');
- },
- fail: (err) => {
- console.error('❌ 跳转失败:', err);
- wx.showToast({
- title: '跳转失败,请重试',
- icon: 'none'
- });
- }
- });
- } catch (error) {
- console.error('❌ 游客模式跳转失败:', error);
- wx.showToast({
- title: '加载失败,请重试',
- icon: 'none'
- });
- }
- },
- /**
- * 轮播图变化事件
- */
- onSwiperChange(e) {
- this.setData({
- currentSwiperIndex: e.detail.current
- });
- },
- /**
- * 跳转到案例展示页面
- */
- async navigateToCases() {
- console.log('===========================================');
- console.log('🏠 调用了 navigateToCases 方法(案例展示)');
- console.log('===========================================');
-
- // 案例展示允许游客访问,直接跳转
- const currentUser = Parse.User.current();
-
- if (!currentUser) {
- console.log('游客访问案例展示');
- wx.setStorageSync('isGuestMode', true);
- await this.navigateToH5PageAsGuest('owner/nav/cases');
- } else {
- await this.navigateToH5Page('owner/nav/cases');
- }
- },
- /**
- * 跳转到产品中心页面
- * @param {string} productId - 可选的产品ID,用于直接跳转到特定产品详情
- */
- async navigateToProducts(productId = null) {
- console.log('===========================================');
- console.log('📦 调用了 navigateToProducts 方法(产品中心)');
- console.log('===========================================');
-
- // 产品中心允许游客访问,直接跳转
- const currentUser = Parse.User.current();
- const params = productId ? { productId } : {};
-
- if (!currentUser) {
- console.log('游客访问产品中心');
- wx.setStorageSync('isGuestMode', true);
- await this.navigateToH5PageAsGuest('owner/nav/products', params);
- } else {
- await this.navigateToH5Page('owner/nav/products', params);
- }
- },
- /**
- * 跳转到方案定制/AI推荐页面
- */
- async navigateToConsultation() {
- console.log('===========================================');
- console.log('======= 点击咨询/方案定制 =======');
- console.log('===========================================');
-
- // 方案定制需要登录
- const currentUser = Parse.User.current();
- const isGuestMode = wx.getStorageSync('isGuestMode');
- const userLogin = wx.getStorageSync('userLogin');
-
- console.log('当前用户:', currentUser ? '已登录' : '未登录');
- console.log('用户手机号:', currentUser?.get('mobile'));
- console.log('游客模式:', isGuestMode);
- console.log('userLogin 存储:', userLogin);
-
- // 检查用户是否真正登录(有手机号且有 userLogin 存储)
- const isReallyLoggedIn = currentUser && currentUser.get('mobile') && userLogin;
-
- if (!isReallyLoggedIn || isGuestMode) {
- console.log('⚠️ 用户未完成登录或是游客,显示登录提示');
-
- // 如果是游客模式,清除游客标记
- if (isGuestMode) {
- wx.removeStorageSync('isGuestMode');
- wx.removeStorageSync('userLogin');
- }
-
- wx.showModal({
- title: '需要登录',
- content: '方案定制和咨询功能需要登录后使用,是否立即登录?',
- confirmText: '立即登录',
- cancelText: '取消',
- success: (res) => {
- if (res.confirm) {
- console.log('用户选择:立即登录');
- console.log('准备调用 login.loginNow()');
-
- // 直接调用登录方法,不需要延迟
- const loginResult = login.loginNow();
- console.log('login.loginNow() 返回值:', loginResult);
-
- // 如果返回 false,说明已经跳转到登录页面
- if (!loginResult) {
- console.log('✅ 已跳转到登录页面');
- }
- } else {
- console.log('用户选择:取消');
- }
- }
- });
- return;
- }
-
- console.log('✅ 用户已登录,跳转到咨询页面');
- await this.navigateToH5Page('owner/nav/consultation');
- },
- /**
- * 通用 H5 页面跳转方法
- * @param {string} pagePath - H5 页面路径(例如: 'owner/nav/cases')
- * @param {object} extraParams - 额外的URL参数对象(例如: { productId: 'xxx' })
- */
- async navigateToH5Page(pagePath, extraParams = {}) {
- console.log('===========================================');
- console.log(`======= 小程序跳转 H5: ${pagePath} =======`);
- console.log('===========================================');
-
- const currentUser = Parse.User.current();
- let userInfo = wx.getStorageSync("userLogin");
-
- // 检查是否是游客模式
- const isGuestMode = wx.getStorageSync('isGuestMode');
-
- // 定义允许游客访问的页面
- const guestAllowedPages = [
- 'owner/nav/home', // 首页
- 'owner/nav/products', // 产品中心
- 'owner/nav/cases' // 案例展示
- ];
-
- // 检查当前页面是否允许游客访问
- const isGuestAllowed = guestAllowedPages.some(page => pagePath.includes(page));
-
- if ((!currentUser || userInfo == '') && !isGuestMode) {
- // 未登录且不是游客模式,提示用户
- wx.showModal({
- title: '温馨提示',
- content: '登录后可以体验更多功能,是否立即登录?',
- confirmText: '立即登录',
- cancelText: '先随便看看',
- success: (res) => {
- if (res.confirm) {
- // 用户选择登录
- login.loginNow();
- } else {
- // 用户选择游客模式
- if (isGuestAllowed) {
- // 如果是允许游客访问的页面,继续访问
- wx.setStorageSync('isGuestMode', true);
- this.navigateToH5PageAsGuest(pagePath, extraParams);
- } else {
- // 如果不允许游客访问,提示需要登录
- wx.showToast({
- title: '此功能需要登录',
- icon: 'none'
- });
- }
- }
- }
- });
- return;
- }
-
- // 如果是游客模式,检查是否允许访问
- if (isGuestMode || !currentUser) {
- if (!isGuestAllowed) {
- // 游客不允许访问此页面
- wx.showModal({
- title: '需要登录',
- content: '此功能需要登录后使用,是否立即登录?',
- confirmText: '立即登录',
- cancelText: '取消',
- success: (res) => {
- if (res.confirm) {
- login.loginNow();
- }
- }
- });
- return;
- }
-
- // 游客访问允许的页面
- this.navigateToH5PageAsGuest(pagePath, extraParams);
- return;
- }
-
- let token = currentUser.getSessionToken();
- console.log('🔑 当前 Session Token:', token);
- console.log(' - Token 长度:', token ? token.length : 0);
- console.log(' - Token 前20个字符:', token ? token.substring(0, 20) : 'null');
-
- if (!token) {
- console.error('❌ 无法获取 Session Token!');
- wx.showToast({
- title: '获取登录信息失败',
- icon: 'none'
- });
- return;
- }
-
- // 验证 token 是否有效
- console.log('🔍 验证 token 有效性...');
- const isValid = await this.validateToken(token);
-
- if (!isValid) {
- console.log('⚠️ Token 已失效,尝试刷新...');
- wx.showLoading({
- title: '正在刷新登录...'
- });
-
- // 尝试刷新 token
- const newToken = await this.refreshToken();
-
- wx.hideLoading();
-
- if (newToken) {
- token = newToken;
- console.log('✅ 使用新的 token:', token.substring(0, 20));
- } else {
- console.error('❌ Token 刷新失败,需要重新登录');
- wx.showModal({
- title: '提示',
- content: '登录已过期,请重新登录',
- showCancel: false,
- success: () => {
- wx.navigateTo({
- url: 'plugin://fm-plugin/fm-auth'
- });
- }
- });
- return;
- }
- } else {
- console.log('✅ Token 验证通过');
- }
-
- // 获取店铺信息
- const store = await this.getStoreInfo();
- const storeId = store && store.id ? store.id : null;
- const storeName = store && store.name ? store.name : '';
-
- // 构建 H5 URL(重要:storeId 和 token 作为查询参数)
- let h5Url = `https://app.fmode.cn/dev/pobingfeng/${pagePath}?`;
-
- // 如果有 storeId,添加到 URL 中
- if (storeId) {
- h5Url += `storeId=${storeId}&`;
- }
-
- h5Url += `token=${token}`;
-
- // 添加额外的参数(如 productId)
- if (extraParams && Object.keys(extraParams).length > 0) {
- for (const [key, value] of Object.entries(extraParams)) {
- if (value) {
- h5Url += `&${key}=${encodeURIComponent(value)}`;
- console.log(` - 添加参数 ${key}:`, value);
- }
- }
- }
-
- // 编码后的 URL
- const encodedUrl = encodeURIComponent(h5Url);
-
- // 最终的小程序页面路径
- // 传递店铺信息给 web-view 页面,优先用于设置标题
- let webViewPath = `/common-page/pages/web-view/index?path=${encodedUrl}`;
- if (storeId) {
- webViewPath += `&storeId=${storeId}`;
- }
- if (storeName) {
- webViewPath += `&storeName=${encodeURIComponent(storeName)}`;
- }
-
- wx.navigateTo({
- url: webViewPath,
- success: () => {},
- fail: (err) => {
- console.error('❌ 跳转失败:', err);
- wx.showToast({
- title: '跳转失败,请重试',
- icon: 'none'
- });
- }
- });
- },
-
- /**
- * 游客模式跳转 H5 页面
- * @param {string} pagePath - H5 页面路径
- * @param {object} extraParams - 额外参数
- */
- async navigateToH5PageAsGuest(pagePath, extraParams = {}) {
- try {
- console.log('===========================================');
- console.log(`======= 游客模式跳转 H5: ${pagePath} =======`);
- console.log('===========================================');
-
- // ✅ 游客默认使用超级门店ID,确保有数据
- const superStoreId = 'pkPdAnLAUZ'; // 超级门店ID
-
- // 确保使用超级门店ID
- wx.setStorageSync('storeId', superStoreId);
- getApp().globalData.storeId = superStoreId;
-
- console.log('✅ 游客使用超级门店ID:', superStoreId);
-
- // 获取店铺信息
- const store = await this.getStoreInfo();
- const storeId = store && store.id ? store.id : superStoreId;
- const storeName = store && store.name ? store.name : '超级门店';
-
- console.log('✅ 店铺信息:', { id: storeId, name: storeName });
-
- // 构建 H5 URL(游客模式,不传 token)
- let h5Url = `https://app.fmode.cn/dev/pobingfeng/${pagePath}?`;
-
- h5Url += `storeId=${storeId}&`;
-
- // 添加游客模式标识
- h5Url += `guestMode=true`;
-
- // 添加额外的参数
- if (extraParams && Object.keys(extraParams).length > 0) {
- for (const [key, value] of Object.entries(extraParams)) {
- if (value) {
- h5Url += `&${key}=${encodeURIComponent(value)}`;
- console.log(` - 添加参数 ${key}:`, value);
- }
- }
- }
-
- console.log('🌐 游客模式 H5 URL:', h5Url);
- console.log('');
- console.log('⚠️ 如果H5显示的不是超级门店,请检查H5端是否正确读取了URL中的storeId参数');
- console.log('');
-
- // 编码后的 URL
- const encodedUrl = encodeURIComponent(h5Url);
-
- // 最终的小程序页面路径
- let webViewPath = `/common-page/pages/web-view/index?path=${encodedUrl}`;
- webViewPath += `&storeId=${storeId}`;
- if (storeName) {
- webViewPath += `&storeName=${encodeURIComponent(storeName)}`;
- }
-
- console.log('📄 web-view 页面路径:', webViewPath.substring(0, 100) + '...');
- console.log('===========================================');
-
- wx.navigateTo({
- url: webViewPath,
- success: () => {
- console.log('✅ 游客模式跳转成功');
- },
- fail: (err) => {
- console.error('❌ 跳转失败:', err);
- wx.showToast({
- title: '跳转失败,请重试',
- icon: 'none'
- });
- }
- });
- } catch (error) {
- console.error('❌ 游客模式跳转失败:', error);
- wx.showToast({
- title: '加载失败,请重试',
- icon: 'none'
- });
- }
- }
- }
- })
|