提交 c7d02181 作者: 姚志忠

1

父级 f280f663
...@@ -14,6 +14,8 @@ import { CollectionApi, PhotoApi, ItineraryApi, CardApi, PoiApi } from "./api"; ...@@ -14,6 +14,8 @@ import { CollectionApi, PhotoApi, ItineraryApi, CardApi, PoiApi } from "./api";
const plugin = requirePlugin("indoormap"); const plugin = requirePlugin("indoormap");
const mapKey = "QUIBZ-OTL6U-T2MVM-GMPIT-EON66-LGBCU"; const mapKey = "QUIBZ-OTL6U-T2MVM-GMPIT-EON66-LGBCU";
const SUPPORTED_CHINESE_LANGUAGES = ["zh_CN", "zh_TW", "zh_HK"];
const TRANSLATE_GUIDE_SHOWN_KEY = "TRANSLATE_GUIDE_SHOWN";
const buildings = [ const buildings = [
{ {
name: "六区", name: "六区",
...@@ -412,6 +414,15 @@ App({ ...@@ -412,6 +414,15 @@ App({
events: new EventEmitter(), events: new EventEmitter(),
isIOS: wx.getDeviceInfo().platform === "ios", isIOS: wx.getDeviceInfo().platform === "ios",
onLaunch() { onLaunch() {
const appBaseInfo = wx.getAppBaseInfo();
const language = appBaseInfo.language;
const hasShownTranslateGuide = wx.getStorageSync(TRANSLATE_GUIDE_SHOWN_KEY);
const needTranslateGuide =
!SUPPORTED_CHINESE_LANGUAGES.includes(language) && !hasShownTranslateGuide;
this.globalData.needTranslateGuide = needTranslateGuide;
this.globalData.userLang = this.getLangName(language);
this.collectionApi = new CollectionApi(this); this.collectionApi = new CollectionApi(this);
this.photoApi = new PhotoApi(this); this.photoApi = new PhotoApi(this);
this.itineraryApi = new ItineraryApi(this); this.itineraryApi = new ItineraryApi(this);
...@@ -431,6 +442,26 @@ App({ ...@@ -431,6 +442,26 @@ App({
const callback = (res) => console.log("userTriggerTranslation", res); const callback = (res) => console.log("userTriggerTranslation", res);
wx.onUserTriggerTranslation(callback); wx.onUserTriggerTranslation(callback);
}, },
getLangName(wechatLang) {
// 核心语言映射表(中文)
const langMap = {
'zh_CN': '简体中文',
'zh_TW': '繁体中文(台湾)',
'zh_HK': '繁体中文(香港)',
'en': '英语',
'ja': '日语',
'ko': '韩语',
'fr': '法语',
'de': '德语',
'es': '西班牙语',
'ru': '俄语',
'pt': '葡萄牙语',
'it': '意大利语',
'ar': '阿拉伯语'
};
// 找不到时默认返回简体中文
return langMap[wechatLang] || '简体中文';
},
/** /**
* 首次启动时,根据 GPS 定位自动切换到用户所在的区 * 首次启动时,根据 GPS 定位自动切换到用户所在的区
*/ */
...@@ -832,6 +863,18 @@ App({ ...@@ -832,6 +863,18 @@ App({
} }
this.userLocation = el; this.userLocation = el;
this.events.emit("userLocation", this.userLocation); this.events.emit("userLocation", this.userLocation);
if (el && el.buildingId) {
const targetBuilding = this.buildings.find(
(b) => b.buildingId === el.buildingId
);
// 如果找到了对应的楼栋配置,且与当前楼栋不同,则执行切换
if (targetBuilding && this.currentBuilding.buildingId !== el.buildingId) {
console.log('室内定位触发楼栋切换:', targetBuilding.name);
this.setBuilding(targetBuilding);
}
}
}, },
}); });
} }
...@@ -904,5 +947,12 @@ App({ ...@@ -904,5 +947,12 @@ App({
? wx.getStorageSync("user") ? wx.getStorageSync("user")
: null, : null,
isPluginInited: false, isPluginInited: false,
needTranslateGuide: false,
userLang: "zh_CN",
boothNo:null,
},
markTranslateGuideShown() {
this.globalData.needTranslateGuide = false;
wx.setStorageSync(TRANSLATE_GUIDE_SHOWN_KEY, true);
}, },
}); });
\ No newline at end of file
<view class="empty"> <view class="empty">
<image src="./empty.png" class="icon" mode="" /> <image src="./empty.png" class="icon" mode="" />
{{isEn?'No information available yet':'还没有任何信息'}} <text>{{isEn ? 'No shops found. Check out these featured merchants:' : '没有搜索到商铺,可查看以下实力商家'}}</text>
</view> </view>
\ No newline at end of file
...@@ -24,6 +24,7 @@ Component({ ...@@ -24,6 +24,7 @@ Component({
behaviors: [langBehavior, buildingBehavior], behaviors: [langBehavior, buildingBehavior],
properties: { properties: {
type: String, type: String,
}, },
/** /**
...@@ -42,7 +43,8 @@ Component({ ...@@ -42,7 +43,8 @@ Component({
*/ */
methods: { methods: {
handleLang() { handleLang() {
this.setData({ showOptions: true }); // this.setData({ showOptions: true });
this.setData({ showTip: true });
}, },
closeOptions() { closeOptions() {
this.setData({ showOptions: false }); this.setData({ showOptions: false });
...@@ -83,4 +85,5 @@ Component({ ...@@ -83,4 +85,5 @@ Component({
}); });
}, },
}, },
}); });
...@@ -37,7 +37,6 @@ ...@@ -37,7 +37,6 @@
</view> </view>
</view> </view>
<scroll-view wx:else scroll-x enhanced show-scrollbar="{{false}}" class="langs"> <scroll-view wx:else scroll-x enhanced show-scrollbar="{{false}}" class="langs">
<view class="grid"> <view class="grid">
<view class="item" wx:for="{{langs}}" wx:key="*this" bind:tap="chooseLang" id="{{item}}">{{item}} <view class="item" wx:for="{{langs}}" wx:key="*this" bind:tap="chooseLang" id="{{item}}">{{item}}
<image wx:if="{{item==='简体中文'&&!isEn||item==='English'&&isEn}}" src="./tick.png" class="tick" mode="" /> <image wx:if="{{item==='简体中文'&&!isEn||item==='English'&&isEn}}" src="./tick.png" class="tick" mode="" />
......
...@@ -49,6 +49,8 @@ Page({ ...@@ -49,6 +49,8 @@ Page({
getLocationSuccess: false, getLocationSuccess: false,
hasAuth: false, hasAuth: false,
cardId: null, cardId: null,
needTranslateGuide:false,
userLang:''
}, },
handleTab({ detail: tab }) { handleTab({ detail: tab }) {
if (tab.text === "我的" || tab.text === "探索") if (tab.text === "我的" || tab.text === "探索")
...@@ -194,32 +196,58 @@ Page({ ...@@ -194,32 +196,58 @@ Page({
this.setData({ banners, showBanner: banners.length > 0 }); this.setData({ banners, showBanner: banners.length > 0 });
getApp().bannerShowed = true; getApp().bannerShowed = true;
}, },
async closeBanner() {
this.setData({ showBanner: false });
},
handleBanner() { handleBanner() {
const ad = this.data.banners[0]; const ad = this.data.banners[0];
if ( if (!ad) return;
(ad.link_type === "app_web" || ad.link_type === "link") &&
ad.link_content // 埋点
) { getApp().sensors?.track("MLVajraAreaClick", {
menu_name: ad.name || "首页广告",
});
// 需要登录
if (ad.need_login == 1) {
if (!getApp().checkUser()) {
wx.setStorageSync('AFTER_LOGIN_REDIRECT_URL', ad.link_content);
wx.setStorageSync('AFTER_LOGIN_REDIRECT_TYPE', ad.link_type);
// 跳去登录页(你自己的登录路径)
wx.navigateTo({ url: "/pages/login/login" });
return;
}
}
// 已登录,直接跳转
this.doBannerJump(ad);
},
// 抽出来跳转方法
doBannerJump(ad) {
if (["app_web", "link"].includes(ad.link_type) && ad.link_content) {
wx.navigateTo({ wx.navigateTo({
url: `/pages/wap/index?url=${encodeURIComponent(ad.link_content)}`, url: `/pages/wap/index?url=${encodeURIComponent(ad.link_content)}`,
}); });
} else if ( } else if (ad.link_type === "mini_program" && ad.link_content && ad.link_path) {
ad.link_type === "mini_program" && wx.navigateToMiniProgram({
ad.link_content && appId: ad.link_content,
ad.link_path path: ad.link_path,
) { });
wx.navigateToMiniProgram({ appId: ad.link_content, path: ad.link_path });
} }
}, },
async closeBanner() {
this.setData({ showBanner: false });
},
handleBannerIndex({ detail: { current } }) { handleBannerIndex({ detail: { current } }) {
this.setData({ bannerIndex: current }); this.setData({ bannerIndex: current });
}, },
async onLoad(options) { async onLoad(options) {
const app = getApp(); const app = getApp();
this.setData({ needTranslateGuide: getApp().globalData.needTranslateGuide,userLang:getApp().globalData.userLang });
console.log(this.data.needTranslateGuide,'globalData');
// ================= 1. 参数预处理 ================= // ================= 1. 参数预处理 =================
let { shopId, facilityId, actId, q, fromshare, mode, scene } = options; let { shopId, facilityId, actId, q, fromshare, mode, scene } = options;
...@@ -286,6 +314,7 @@ Page({ ...@@ -286,6 +314,7 @@ Page({
this.getFloor(); this.getFloor();
} }
}, },
onUnload() { onUnload() {
app.events.off("userLocation", this._onLocationChange); app.events.off("userLocation", this._onLocationChange);
app.events.off("building", this._onBuildingChange); app.events.off("building", this._onBuildingChange);
......
...@@ -47,14 +47,79 @@ ...@@ -47,14 +47,79 @@
} }
} }
} }
.go { .translate-guide {
position: absolute; position: absolute;
top: 0; top: 12px;
left: 0; right: 14px;
right: 0; z-index: 3;
height: 200px; display: flex;
z-index: 2; flex-direction: column;
background: #fff; align-items: flex-end;
animation: translateGuideEnter 260ms ease-out;
.translate-guide__bubble {
width: 240px;
padding: 14px 14px 12px;
border-radius: 18px;
background: linear-gradient(180deg, rgba(31, 41, 55, 0.96) 0%, rgba(17, 24, 39, 0.96) 100%);
box-shadow: 0 14px 36px rgba(15, 23, 42, 0.28);
color: #fff;
}
.translate-guide__eyebrow {
font-size: 11px;
line-height: 16px;
letter-spacing: 0.8px;
text-transform: uppercase;
color: #93c5fd;
}
.translate-guide__title {
margin-top: 4px;
font-size: 15px;
line-height: 21px;
font-weight: 600;
}
.translate-guide__desc {
margin-top: 6px;
font-size: 12px;
line-height: 18px;
color: rgba(255, 255, 255, 0.82);
}
.translate-guide__lang {
margin-top: 10px;
font-size: 11px;
line-height: 16px;
color: rgba(191, 219, 254, 0.95);
}
.translate-guide__action {
margin-top: 12px;
margin-left: auto;
padding: 6px 12px;
border-radius: 999px;
background: rgba(255, 255, 255, 0.14);
font-size: 12px;
line-height: 16px;
font-weight: 600;
color: #fff;
}
.translate-guide__tail {
width: 0;
height: 0;
margin-top: -2px;
margin-right: 18px;
border-left: 10px solid transparent;
border-right: 4px solid transparent;
border-top: 14px solid rgba(17, 24, 39, 0.96);
transform: rotate(-10deg);
}
}
@keyframes translateGuideEnter {
from {
opacity: 0;
transform: translateY(-8px) scale(0.96);
}
to {
opacity: 1;
transform: translateY(0) scale(1);
}
} }
.banner { .banner {
position: fixed; position: fixed;
...@@ -221,4 +286,11 @@ ...@@ -221,4 +286,11 @@
height: 56px; height: 56px;
z-index: 2; z-index: 2;
} }
.translate-guide {
color: #333;
padding: 8px 16px;
text-align: center;
font-size: 14px;
border-bottom: 1px solid #eee;
}
} }
<view class="index"> <view class="index">
<map-wrapper type="{{isIndex?'index':'surroundings'}}" viewstate="{{viewstate}}" user-location="{{userLocation}}" acts="{{acts}}" reset-count="{{resetCount}}" floor-name="{{floorName}}" facilities="{{currentFloorFacilities}}" bind:poi="handlePoi" bind:act="handleAct" bind:buildchange="handleMapBuildChange"></map-wrapper> <map-wrapper type="{{isIndex?'index':'surroundings'}}" viewstate="{{viewstate}}" user-location="{{userLocation}}" acts="{{acts}}" reset-count="{{resetCount}}" floor-name="{{floorName}}" facilities="{{currentFloorFacilities}}" bind:poi="handlePoi" bind:act="handleAct" bind:buildchange="handleMapBuildChange"></map-wrapper>
<lang-btn wx:if="{{!(isIndex&&viewstate==='fullscreen')}}" type="index"></lang-btn> <lang-btn wx:if="{{!(isIndex&&viewstate==='fullscreen')}}" type="index"></lang-btn>
<bottom-hud-index wx:if="{{isIndex}}" bind:viewstate="handleBottomHudViewstate" bind:search="handleSearch" bind:ai="handleAi" bind:poi="handlePoi"> <bottom-hud-index wx:if="{{isIndex}}" bind:viewstate="handleBottomHudViewstate" bind:search="handleSearch" bind:ai="handleAi" bind:poi="handlePoi">
<floors never-authed="{{neverAuthed}}" show-success="{{getLocationSuccess}}" refreshing="{{gettingLocation}}" wx:if="{{viewstate!=='fullscreen'&&!focusedPoi}}" floors="{{currentBuilding.floors}}" floor-name="{{floorName}}" bind:floorname="handleFloor" bind:resetmap="handleReset"></floors> <floors never-authed="{{neverAuthed}}" show-success="{{getLocationSuccess}}" refreshing="{{gettingLocation}}" wx:if="{{viewstate!=='fullscreen'&&!focusedPoi}}" floors="{{currentBuilding.floors}}" floor-name="{{floorName}}" bind:floorname="handleFloor" bind:resetmap="handleReset"></floors>
</bottom-hud-index> </bottom-hud-index>
......
...@@ -11,7 +11,7 @@ Page({ ...@@ -11,7 +11,7 @@ Page({
/** /**
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad(options) {}, onLoad(options) { },
checkPrivacy() { checkPrivacy() {
this.setData({ checked: !this.data.checked }); this.setData({ checked: !this.data.checked });
}, },
...@@ -57,27 +57,23 @@ Page({ ...@@ -57,27 +57,23 @@ Page({
async getRedPocketOpenid() { async getRedPocketOpenid() {
try { try {
const { marketurl, post, globalData } = getApp(); const { marketurl, post, globalData } = getApp();
const { const { data: { code, message } } = await post(
data: { code, message },
} = await post(
`${marketurl}/rpt/user/openId`, `${marketurl}/rpt/user/openId`,
{ {
returnUrl: `https://h5.chinagoods.com/verify-openid/?targetPath=${encodeURIComponent( returnUrl: `https://h5.chinqgoods.com/verify-openid/...`,
"/pages/verify-openId/index"
)}`,
}, },
{ {
Authorization: `Bearer ${globalData.user.access_token}`, Authorization: `Bearer ${globalData.user.access_token}`,
} }
); );
if (code === 20000) { if (code === 20000) {
wx.redirectTo({
url: `/pages/wap/index?url=${encodeURIComponent(message)}`,
});
return false; return false;
} else return true; } else {
return true;
}
} catch (error) { } catch (error) {
console.log(error); console.log(error);
return true;
} }
}, },
...@@ -87,29 +83,40 @@ Page({ ...@@ -87,29 +83,40 @@ Page({
closeModal() { closeModal() {
this.setData({ showModal: false }); this.setData({ showModal: false });
}, },
async handleGetPhone({ detail: { code } }) { async handleGetPhone({ detail: { code } }) {
this.setData({ phoneLock: true }); this.setData({ phoneLock: true });
try { try {
if (code) { if (code) {
const response = await getApp().login(code); const response = await getApp().login(code);
if (!response) if (!response) {
return wx.showToast({ wx.showToast({ title: "登录失败", icon: "none" });
title: "登录失败", return;
icon: "none", }
});
if (response.code === 20000) { if (response.code === 20000) {
const redirectUrl = wx.getStorageSync('AFTER_LOGIN_REDIRECT_URL');
const redirectType = wx.getStorageSync('AFTER_LOGIN_REDIRECT_TYPE');
if (redirectUrl) {
// 有广告跳转 → 执行广告跳转
this.afterLoginGoBanner();
return;
}
// 无广告跳转 → 按原有逻辑处理
const hasOpenid = await this.checkRedPocketOpenid(); const hasOpenid = await this.checkRedPocketOpenid();
if (hasOpenid) this.back(); if (hasOpenid) {
else { this.back();
} else {
await this.getRedPocketOpenid(); await this.getRedPocketOpenid();
this.afterLoginGoBanner();
} }
} else if (response.code === 88051) { } else if (response.code === 88051) {
return this.setData({ bindingModalData: response.data }); this.setData({ bindingModalData: response.data });
} else { } else {
return wx.showToast({ wx.showToast({ title: response.message, icon: "none" });
title: response.message,
icon: "none",
});
} }
} }
} catch (error) { } catch (error) {
...@@ -118,41 +125,61 @@ Page({ ...@@ -118,41 +125,61 @@ Page({
this.setData({ phoneLock: false }); this.setData({ phoneLock: false });
} }
}, },
afterLoginGoBanner() {
// 取出广告跳转信息
const url = wx.getStorageSync('AFTER_LOGIN_REDIRECT_URL');
const type = wx.getStorageSync('AFTER_LOGIN_REDIRECT_TYPE');
if (!url) {
// 没有记录 → 返回上一页
wx.navigateBack();
return;
}
// 清除缓存(避免重复跳转)
wx.removeStorageSync('AFTER_LOGIN_REDIRECT_URL');
wx.removeStorageSync('AFTER_LOGIN_REDIRECT_TYPE');
// 直接跳转到广告链接
wx.redirectTo({
url: `/pages/wap/index?url=${encodeURIComponent(url)}`,
});
},
closeBindingModal() { closeBindingModal() {
this.setData({ bindingModalData: null }); this.setData({ bindingModalData: null });
}, },
/** /**
* 生命周期函数--监听页面初次渲染完成 * 生命周期函数--监听页面初次渲染完成
*/ */
onReady() {}, onReady() { },
/** /**
* 生命周期函数--监听页面显示 * 生命周期函数--监听页面显示
*/ */
onShow() {}, onShow() { },
/** /**
* 生命周期函数--监听页面隐藏 * 生命周期函数--监听页面隐藏
*/ */
onHide() {}, onHide() { },
/** /**
* 生命周期函数--监听页面卸载 * 生命周期函数--监听页面卸载
*/ */
onUnload() {}, onUnload() { },
/** /**
* 页面相关事件处理函数--监听用户下拉动作 * 页面相关事件处理函数--监听用户下拉动作
*/ */
onPullDownRefresh() {}, onPullDownRefresh() { },
/** /**
* 页面上拉触底事件的处理函数 * 页面上拉触底事件的处理函数
*/ */
onReachBottom() {}, onReachBottom() { },
/** /**
* 用户点击右上角分享 * 用户点击右上角分享
*/ */
onShareAppMessage() {}, onShareAppMessage() { },
}); });
...@@ -16,12 +16,16 @@ Page({ ...@@ -16,12 +16,16 @@ Page({
poi: null, poi: null,
lastNav: null, lastNav: null,
kcal: null, kcal: null,
boothNo: '',
}, },
/** /**
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
async onLoad(options) { async onLoad(options) {
// 从 options 中获取商位号
this.setData({ boothNo: options.boothNo || '' });
console.log(this.data.boothNo, "boothNo");
const { lastNav } = getApp().globalData; const { lastNav } = getApp().globalData;
if (!lastNav) return this.toIndex(); if (!lastNav) return this.toIndex();
this.setData({ lastNav }); this.setData({ lastNav });
......
...@@ -43,6 +43,11 @@ ...@@ -43,6 +43,11 @@
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: space-between; justify-content: space-between;
&.booth-row {
.left {
padding-left: 12px;
}
}
.left { .left {
display: inline-flex; display: inline-flex;
flex-shrink: 0; flex-shrink: 0;
......
...@@ -25,6 +25,13 @@ ...@@ -25,6 +25,13 @@
<view>{{lastNav.endPoint.floorName}}</view> <view>{{lastNav.endPoint.floorName}}</view>
</view> </view>
</view> </view>
<view class="border" wx:if="{{boothNo}}"></view>
<view class="row booth-row" wx:if="{{boothNo}}">
<view class="left">商位号</view>
<view class="right end">
<view>{{boothNo}}</view>
</view>
</view>
</view> </view>
<view class="r3"> <view class="r3">
<view class="col"> <view class="col">
......
...@@ -43,6 +43,7 @@ Page({ ...@@ -43,6 +43,7 @@ Page({
url: "/pages/aisearch/index", url: "/pages/aisearch/index",
}); });
}, },
/** /**
* 生命周期函数--监听页面初次渲染完成 * 生命周期函数--监听页面初次渲染完成
*/ */
......
<view class="search"> <view class="search">
<search-bar q="{{q}}" bind:q="handleQ" bind:ai="handleAi"></search-bar> <search-bar q="{{q}}" bind:q="handleQ" bind:ai="handleAi"></search-bar>
<search-default wx:if="{{!q}}" fac-types="{{facTypes}}" bind:q="handleQ" bind:showbluetoothmodal="openBluetoothModal" bind:showlocationmodal="openLocationModal" bind:showauthmodal="openAuthModal"></search-default> <search-default wx:if="{{!q}}" fac-types="{{facTypes}}" bind:q="handleQ" bind:showbluetoothmodal="openBluetoothModal" bind:showlocationmodal="openLocationModal" bind:showauthmodal="openAuthModal"></search-default>
<search-result wx:if="{{q}}" q="{{q}}" user-location="{{userLocation}}" bind:showbluetoothmodal="openBluetoothModal" bind:showlocationmodal="openLocationModal" bind:showauthmodal="openAuthModal"></search-result> <search-result wx:if="{{q}}" q="{{q}}" user-location="{{userLocation}}" bind:showbluetoothmodal="openBluetoothModal" bind:showlocationmodal="openLocationModal" bind:showauthmodal="openAuthModal" ></search-result>
<bluetooth-modal wx:if="{{showBluetoothModal}}" bind:close="closeBluetoothModal"></bluetooth-modal> <bluetooth-modal wx:if="{{showBluetoothModal}}" bind:close="closeBluetoothModal"></bluetooth-modal>
<location-modal wx:if="{{showLocationModal}}" bind:close="closeLocationModal"></location-modal> <location-modal wx:if="{{showLocationModal}}" bind:close="closeLocationModal"></location-modal>
<auth-modal wx:if="{{showAuthModal}}" bind:close="closeAuthModal"></auth-modal> <auth-modal wx:if="{{showAuthModal}}" bind:close="closeAuthModal"></auth-modal>
......
.search-result { .search-result {
width: 100vw;
flex: 1; flex: 1;
height: calc(100vh - 68px); height: calc(100vh - 68px);
.list { .list {
...@@ -88,7 +89,7 @@ ...@@ -88,7 +89,7 @@
} }
} }
.empty { .empty {
padding-top: calc(50vh - 88px - 68px); padding-top: calc(13vh - 88px - 8px);
} }
.size-16 { .size-16 {
width: 16px; width: 16px;
...@@ -98,4 +99,93 @@ ...@@ -98,4 +99,93 @@
width: 32px; width: 32px;
height: 32px; height: 32px;
} }
.empty-container {
padding: 20px;
display: flex;
flex-direction: column;
align-items: center;
}
.empty-tip {
font-size: 14px;
color: #666;
margin-bottom: 20px;
text-align: center;
line-height: 1.5;
}
.featured-list {
width: 100%;
background: #fff;
border-radius: 8px;
overflow: hidden;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05); // 添加轻微阴影,增加立体感
margin-top: 12px; // 增加与提示语的距离
border-top-left-radius: 32rpx;
border-top-right-radius: 32rpx;
}
.featured-item {
display: flex;
align-items: center;
padding: 12px;
border-bottom: 1px solid #f5f5f5;
}
.featured-item {
display: flex;
align-items: center;
padding: 12px;
border-bottom: 1px solid #f5f5f5;
&:first-child {
margin-top: 16rpx;
}
&:last-child {
border-bottom: none;
}
}
.featured-avatar {
width: 50px;
height: 50px;
border-radius: 4px;
margin-right: 12px;
background-color: #eee;
// 可选:添加圆角边框
border: 1px solid #eee;
}
.featured-info {
flex: 1;
display: flex;
flex-direction: column;
justify-content: center;
}
.featured-name {
font-size: 15px;
color: #333;
font-weight: 500;
margin-bottom: 4px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.featured-addr {
font-size: 12px;
color: #999;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.arrow-icon {
width: 16px;
height: 16px;
margin-left: 8px;
opacity: 0.5;
}
} }
<scroll-view scroll-y class="search-result" bindscrolltolower="handleScrollToLower" lower-threshold="200"> <scroll-view scroll-y class="search-result" bindscrolltolower="handleScrollToLower" lower-threshold="200">
<loading wx:if="{{isLoading}}"></loading> <loading wx:if="{{isLoading}}"></loading>
<!-- 有搜索结果:展示结果列表 -->
<view class="list" wx:if="{{list.length}}"> <view class="list" wx:if="{{list.length}}">
<block wx:for="{{list}}" wx:key="index"> <block wx:for="{{list}}" wx:key="index">
<view class="border" wx:if="{{index>0}}"></view> <view class="border" wx:if="{{index>0}}"></view>
...@@ -51,7 +53,27 @@ ...@@ -51,7 +53,27 @@
</block> </block>
<end wx:if="{{!isLoading&&list.length}}"></end> <end wx:if="{{!isLoading&&list.length}}"></end>
</view> </view>
<!-- 无搜索结果:展示实力商家(有则展示,无则展示 empty) -->
<view class="empty" wx:if="{{!isLoading&&list.length===0}}"> <view class="empty" wx:if="{{!isLoading&&list.length===0}}">
<empty></empty> <empty></empty>
<!-- 实力商家列表 -->
<view class="featured-list" wx:if="{{featuredShops.length > 0}}">
<block wx:for="{{featuredShops}}" wx:key="shopId">
<view class="featured-item" bind:tap="handleFeaturedShopTap" data-shopid="{{item.shopId}}">
<image class="featured-avatar" src="{{item.ywZh.cover}}" mode="aspectFill" />
<view class="featured-info">
<view class="featured-name">
<text>{{isEn && item.ywEn ? item.ywEn.name : item.ywZh.name}}</text>
</view>
<view class="featured-addr">
<text>{{item.ywZh.marketNameDtl}} {{item.ywZh.addrFloor}}F {{item.ywZh.boothNo}}</text>
</view>
</view>
<image class="arrow-icon" src="./arrowright.png" mode="aspectFit" />
</view>
</block>
</view>
</view> </view>
</scroll-view> </scroll-view>
\ No newline at end of file
...@@ -40,6 +40,23 @@ Page({ ...@@ -40,6 +40,23 @@ Page({
const { isEn } = this.data; const { isEn } = this.data;
const shop = await app.poiApi.getOne({ shopType: "1", shopId }); const shop = await app.poiApi.getOne({ shopType: "1", shopId });
if (!shop) return this.back(); if (!shop) return this.back();
const fixCoverUrl = (url) => {
if (!url) return '';
// 将 200x 替换为 空
return url.replace('/200x', '');
};
// 处理中文信息中的 cover
if (shop.ywZh && shop.ywZh.cover) {
shop.ywZh.cover = fixCoverUrl(shop.ywZh.cover);
}
// 处理英文信息中的 cover
if (shop.ywEn && shop.ywEn.cover) {
shop.ywEn.cover = fixCoverUrl(shop.ywEn.cover);
}
const boothNo = shop.ywZh?.boothNo; const boothNo = shop.ywZh?.boothNo;
try { try {
let { let {
......
...@@ -242,6 +242,9 @@ export const toRoutePlan = async (poi, isEn) => { ...@@ -242,6 +242,9 @@ export const toRoutePlan = async (poi, isEn) => {
poi_fl_name: floorName, poi_fl_name: floorName,
bld_id, bld_id,
} = poi.tx; } = poi.tx;
console.log(poi,"poi");
// 1. 【新增】获取商位号
const boothNo = poi.ywZh?.boothNo || poi.ywEn?.boothNo || '';
const destPoint = encodeURIComponent( const destPoint = encodeURIComponent(
JSON.stringify({ JSON.stringify({
...@@ -253,8 +256,11 @@ export const toRoutePlan = async (poi, isEn) => { ...@@ -253,8 +256,11 @@ export const toRoutePlan = async (poi, isEn) => {
buildingName: "义乌国际商贸城", buildingName: "义乌国际商贸城",
}), }),
); );
// 2. 【关键修改】构建带参数的 navEndPageUrl
const navEndPageUrl = `/pages/nav-end/index?boothNo=${encodeURIComponent(boothNo)}`;
wx.navigateTo({ wx.navigateTo({
url: `plugin://indoormap/routeplan?banNav=false&transitDisable=true&buildingId=${bld_id}&buildingName=义乌国际商贸城&destPoint=${destPoint}`, url: `plugin://indoormap/routeplan?banNav=false&transitDisable=true&buildingId=${bld_id}&buildingName=义乌国际商贸城&destPoint=${destPoint}&navEndPageUrl=${encodeURIComponent(navEndPageUrl)}`,
}); });
} catch (error) { } catch (error) {
console.error(error); console.error(error);
...@@ -290,6 +296,19 @@ export const actToRoutePlan = async (act) => { ...@@ -290,6 +296,19 @@ export const actToRoutePlan = async (act) => {
return "showLocationModal"; return "showLocationModal";
if (!getApp().checkUser()) return "login needed"; if (!getApp().checkUser()) return "login needed";
getApp().ensurePluginInit(); getApp().ensurePluginInit();
// 1. 【新增】从 act 对象中获取 shopId 并查询完整 POI 以获取商位号
let boothNo = '';
if (act.shopId) {
try {
const poi = await getApp().poiApi.getOne({ shopType: "1", shopId: act.shopId });
boothNo = poi?.ywZh?.boothNo || poi?.ywEn?.boothNo || '';
} catch (error) {
console.warn('获取活动商铺详情失败,无法传递商位号', error);
}
}
const { name, latitude, longitude, floor_name, building_id } = act; const { name, latitude, longitude, floor_name, building_id } = act;
const destPoint = encodeURIComponent( const destPoint = encodeURIComponent(
...@@ -302,8 +321,11 @@ export const actToRoutePlan = async (act) => { ...@@ -302,8 +321,11 @@ export const actToRoutePlan = async (act) => {
buildingName: "义乌国际商贸城", buildingName: "义乌国际商贸城",
}), }),
); );
// 2. 【关键修改】构建带参数的 navEndPageUrl
const navEndPageUrl = `/pages/nav-end/index?boothNo=${encodeURIComponent(boothNo)}`;
wx.navigateTo({ wx.navigateTo({
url: `plugin://indoormap/routeplan?banNav=false&transitDisable=true&buildingId=${building_id}&buildingName=义乌国际商贸城&destPoint=${destPoint}`, url: `plugin://indoormap/routeplan?banNav=false&transitDisable=true&buildingId=${building_id}&buildingName=义乌国际商贸城&destPoint=${destPoint}&navEndPageUrl=${encodeURIComponent(navEndPageUrl)}`,
}); });
} catch (error) { } catch (error) {
console.error(error); console.error(error);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论