// ============ Home ============ function renderHome() { var regions = getSortedRegions(); var html = ''; // ====== 顶部欢迎语 ====== html += '
'; html += '
街头巷尾,都藏着生活的千百种答案
'; html += '
「SHANlife」把整座城的好...发现城市的美好
'; html += '
'; // ====== 快捷分类入口(类似图中"吃喝玩乐"板块) ====== html += '
'; html += '
'; html += ' 🍽️'; html += ' 美食餐饮'; html += '
'; html += '
'; html += ' 🏨'; html += ' 酒店民宿'; html += '
'; html += '
'; html += ' 🛍️'; html += ' 购物逛街'; html += '
'; html += '
'; html += ' 🎒'; html += ' 旅游玩乐'; html += '
'; html += '
'; // ====== 服务分类网格(第二行) ====== html += '
'; var services = [ { icon: '🍽️', label: '美食餐饮', desc: '发现身边好味道', cat: 'food' }, { icon: '🏨', label: '酒店民宿', desc: '舒适住宿精选', cat: 'hotel' }, { icon: '🛍️', label: '购物逛街', desc: '好店好物推荐', cat: 'shopping' }, { icon: '🎒', label: '旅游玩乐', desc: '景点活动攻略', cat: 'travel' }, { icon: '🚗', label: '交通出行', desc: '便捷出行服务', cat: 'transport' }, { icon: '🛠️', label: '生活服务', desc: '便民服务集合', cat: 'service' }, { icon: '🏥', label: '健康医疗', desc: '健康服务保障', cat: 'health' }, { icon: '📚', label: '教育培训', desc: '学习成长平台', cat: 'education' }, { icon: '🏠', label: '房产家居', desc: '房产家居服务', cat: 'realestate' } ]; services.forEach(function(s, index) { html += '
'; html += ' ' + s.icon + ''; html += '
'; html += ' ' + s.label + ''; html += ' ' + s.desc + ''; html += '
'; html += '
'; }); html += '
'; // ====== 精选程序(第三行) ====== html += '
'; html += ' 精选程序'; html += ' 更多程序 >'; html += '
'; var apps = [ { icon: '🍜', name: 'SHAN外卖', desc: '美食送到家', action: 'food' }, { icon: '🛒', name: 'SHAN优选', desc: '精选好物', action: 'shopping' }, { icon: '🚗', name: 'SHAN出行', desc: '便捷出行', action: 'transport' }, { icon: '🎉', name: 'SHAN活动', desc: '活动资讯', action: 'travel' }, { icon: '💬', name: 'SHAN客服', desc: '贴心服务', action: 'service' } ]; html += '
'; apps.forEach(function(app) { html += '
'; html += ' ' + app.icon + ''; html += ' ' + app.name + ''; html += ' ' + app.desc + ''; html += '
'; }); html += '
'; // ====== 地区列表(原有逻辑,保留但改为"城市列表"样式) ====== if (regions.length > 0) { html += '
'; html += ' 🏙️ 城市列表'; html += '
'; html += '
'; regions.forEach(function(item) { var id = item[0]; var r = item[1]; var imgHtml = r.coverPhoto ? '' + escapeHtml(r.name) + '' : '
🏙️
'; html += '\n
\n
' + imgHtml + '
\n
' + escapeHtml(r.name || '未命名') + '
\n
'; }); html += '
'; } mainContent.innerHTML = html; } // ============ 快捷分类筛选 ============ window._filterByQuickCat = function(cat) { // 如果有地区视图,应用筛选 if (window.currentView === 'region' && window.currentRegionId) { // 先找到对应的分类ID var targetCatId = null; Object.keys(window.allCategories).forEach(function(key) { var c = window.allCategories[key]; if (c.regionId === window.currentRegionId && c.quickCat === cat) { targetCatId = key; } }); if (targetCatId) { window._filterCategory(targetCatId); } else { window._showToast('该地区暂无此分类'); } } else { // 在首页点击,跳转到第一个有该分类的地区 var found = false; var sortedRegions = getSortedRegions(); for (var i = 0; i < sortedRegions.length; i++) { var regionId = sortedRegions[i][0]; var foundCat = null; Object.keys(window.allCategories).forEach(function(key) { var c = window.allCategories[key]; if (c.regionId === regionId && c.quickCat === cat) { foundCat = key; } }); if (foundCat) { window._goToRegion(regionId); setTimeout(function() { window._filterCategory(foundCat); }, 300); found = true; break; } } if (!found) { window._showToast('暂未找到相关分类'); } } };