Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
X
xiaoshangaihuida
概览
Overview
详情
活动
周期分析
版本库
存储库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
Issues
0
列表
Board
标记
里程碑
合并请求
0
Merge Requests
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
Snippets
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
Issue Boards
Open sidebar
姚志忠
xiaoshangaihuida
Commits
cdb00d7a
提交
cdb00d7a
authored
3月 31, 2026
作者:
姚志忠
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
修改定位问题
父级
352458cc
显示空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
294 行增加
和
30 行删除
+294
-30
app.js
+284
-28
components/lang-btn/index.js
+1
-0
components/shop-addr/index.js
+5
-1
pages/index/index.js
+4
-1
没有找到文件。
app.js
查看文件 @
cdb00d7a
import
{
import
{
EventEmitter
,
get
,
post
,
...
...
@@ -77,7 +77,149 @@ const buildings = [
buildingId
:
"3307001301397"
,
latlng
:
{
lat
:
29.327742
,
lng
:
120.103138
},
floors
:
[
"1F"
,
"2F"
,
"3F"
,
"4F"
],
scale
:
18.2
,
scale
:
17
,
formats
:
[
{
"key"
:
"N_01_1_CQWJ"
,
"zone"
:
"01"
,
"floor"
:
1
,
"name"
:
"充气玩具"
,
"nameEn"
:
"充气玩具"
},
{
"key"
:
"N_01_1_DDWJ"
,
"zone"
:
"01"
,
"floor"
:
1
,
"name"
:
"电动玩具"
,
"nameEn"
:
"电动玩具"
},
{
"key"
:
"N_01_1_GYP"
,
"zone"
:
"01"
,
"floor"
:
1
,
"name"
:
"玩具/饰品"
,
"nameEn"
:
"玩具/饰品"
},
{
"key"
:
"N_01_1_HL"
,
"zone"
:
"01"
,
"floor"
:
1
,
"name"
:
"花类"
,
"nameEn"
:
"花类"
},
{
"key"
:
"N_01_1_HLPJ"
,
"zone"
:
"01"
,
"floor"
:
1
,
"name"
:
"花类配件"
,
"nameEn"
:
"花类配件"
},
{
"key"
:
"N_01_1_MBRWJ"
,
"zone"
:
"01"
,
"floor"
:
1
,
"name"
:
"毛绒玩具"
,
"nameEn"
:
"毛绒玩具"
},
{
"key"
:
"N_01_1_PTWJ"
,
"zone"
:
"01"
,
"floor"
:
1
,
"name"
:
"普通玩具"
,
"nameEn"
:
"普通玩具"
},
{
"key"
:
"N_01_1_SPPJ"
,
"zone"
:
"01"
,
"floor"
:
1
,
"name"
:
"饰品配件(东扩)"
,
"nameEn"
:
"饰品配件"
},
{
"key"
:
"N_01_2_SP"
,
"zone"
:
"01"
,
"floor"
:
2
,
"name"
:
"饰品/饰品配件(东扩)"
,
"nameEn"
:
"饰品/饰品配件"
},
{
"key"
:
"N_01_2_TS"
,
"zone"
:
"01"
,
"floor"
:
2
,
"name"
:
"头饰"
,
"nameEn"
:
"头饰"
},
{
"key"
:
"N_01_2_ZBSS"
,
"zone"
:
"01"
,
"floor"
:
2
,
"name"
:
"珠宝首饰"
,
"nameEn"
:
"珠宝首饰"
},
{
"key"
:
"N_01_3_CQSJ"
,
"zone"
:
"01"
,
"floor"
:
3
,
"name"
:
"瓷器水晶"
,
"nameEn"
:
"瓷器水晶"
},
{
"key"
:
"N_01_3_LYGY"
,
"zone"
:
"01"
,
"floor"
:
3
,
"name"
:
"旅游工艺"
,
"nameEn"
:
"旅游工艺"
},
{
"key"
:
"N_01_3_SP"
,
"zone"
:
"01"
,
"floor"
:
3
,
"name"
:
"饰品(东扩)"
,
"nameEn"
:
"饰品"
},
{
"key"
:
"N_01_3_SPPJ"
,
"zone"
:
"01"
,
"floor"
:
3
,
"name"
:
"饰品配件"
,
"nameEn"
:
"饰品配件"
},
{
"key"
:
"N_01_3_XQGY"
,
"zone"
:
"01"
,
"floor"
:
3
,
"name"
:
"喜庆工艺"
,
"nameEn"
:
"喜庆工艺"
},
{
"key"
:
"N_01_3_XK"
,
"zone"
:
"01"
,
"floor"
:
3
,
"name"
:
"相框"
,
"nameEn"
:
"相框"
},
{
"key"
:
"N_01_3_ZSGY"
,
"zone"
:
"01"
,
"floor"
:
3
,
"name"
:
"装饰工艺"
,
"nameEn"
:
"装饰工艺"
},
{
"key"
:
"N_01_4_GYP"
,
"zone"
:
"01"
,
"floor"
:
4
,
"name"
:
"生产企业直销中心"
,
"nameEn"
:
"生产企业直销中心"
},
{
"key"
:
"N_01_4_HLPJ"
,
"zone"
:
"01"
,
"floor"
:
4
,
"name"
:
"花类配件(东扩)"
,
"nameEn"
:
"花类配件(东扩)"
}
],
},
{
name
:
"二区"
,
...
...
@@ -88,7 +230,100 @@ const buildings = [
buildingId
:
"3307001732882"
,
latlng
:
{
lat
:
29.334626
,
lng
:
120.106744
},
floors
:
[
"1F"
,
"2F"
,
"3F"
],
scale
:
18.2
,
scale
:
17
,
formats
:[
{
"key"
:
"N_02_1_LPBZ"
,
"zone"
:
"02"
,
"floor"
:
1
,
"name"
:
"礼品包装"
,
"nameEn"
:
"礼品包装"
},
{
"key"
:
"N_02_1_SJ"
,
"zone"
:
"02"
,
"floor"
:
1
,
"name"
:
"伞具"
,
"nameEn"
:
"伞具"
},
{
"key"
:
"N_02_1_XB"
,
"zone"
:
"02"
,
"floor"
:
1
,
"name"
:
"箱包"
,
"nameEn"
:
"箱包"
},
{
"key"
:
"N_02_1_YPD"
,
"zone"
:
"02"
,
"floor"
:
1
,
"name"
:
"雨披-袋"
,
"nameEn"
:
"雨披-袋"
},
{
"key"
:
"N_02_2_CL"
,
"zone"
:
"02"
,
"floor"
:
2
,
"name"
:
"车类"
,
"nameEn"
:
"车类"
},
{
"key"
:
"N_02_2_DGCP"
,
"zone"
:
"02"
,
"floor"
:
2
,
"name"
:
"电工产品"
,
"nameEn"
:
"电工产品"
},
{
"key"
:
"N_02_2_SJ"
,
"zone"
:
"02"
,
"floor"
:
2
,
"name"
:
"锁具"
,
"nameEn"
:
"锁具"
},
{
"key"
:
"N_02_2_WJGJPJ"
,
"zone"
:
"02"
,
"floor"
:
2
,
"name"
:
"五金工具-配件"
,
"nameEn"
:
"五金工具-配件"
},
{
"key"
:
"N_02_3_DXQC"
,
"zone"
:
"02"
,
"floor"
:
3
,
"name"
:
"电讯器材"
,
"nameEn"
:
"电讯器材"
},
{
"key"
:
"N_02_3_DZYBQZXQC"
,
"zone"
:
"02"
,
"floor"
:
3
,
"name"
:
"电子仪表仪器-照相器材"
,
"nameEn"
:
"电子仪表仪器-照相器材"
},
{
"key"
:
"N_02_3_WJCW"
,
"zone"
:
"02"
,
"floor"
:
3
,
"name"
:
"五金厨卫"
,
"nameEn"
:
"五金厨卫"
},
{
"key"
:
"N_02_3_XJD"
,
"zone"
:
"02"
,
"floor"
:
3
,
"name"
:
"小家电"
,
"nameEn"
:
"小家电"
},
{
"key"
:
"N_02_3_ZB"
,
"zone"
:
"02"
,
"floor"
:
3
,
"name"
:
"钟表"
,
"nameEn"
:
"钟表"
}
]
},
{
name
:
"二区东"
,
...
...
@@ -122,20 +357,20 @@ const buildingNameNameEnMap = buildings.reduce(
);
const
isTest
=
false
;
export
const
qmurl
=
isTest
?
"https://
tencent.chinagoods
.com"
?
"https://
yiwutest.123.1000my
.com"
:
"https://tencent.chinagoods.com"
;
export
const
marketurl
=
isTest
?
"https://
testapiserver.chinagoods
.com"
?
"https://
yiwutest.123.1000my
.com"
:
"https://apiserver.chinagoods.com"
;
export
const
uploadurl
=
isTest
?
"https://
testkunapi.chinagoods
.com"
?
"https://
yiwutest.123.1000my
.com"
:
"https://kunapi.chinagoods.com"
;
export
const
salt
=
"chinagoods2024"
;
sensors
.
init
({
server_url
:
"https://event-tracking.chinagoods.com/sa.gif?project=market_navigation_t&remark=online"
,
show_log
:
false
,
//
是否开启日志
show_log
:
false
,
//
鏄惁寮€鍚棩蹇?
name
:
"sensors"
,
allow_amend_share_path
:
true
,
global_properties
:
{
...
...
@@ -186,10 +421,47 @@ App({
this
.
refreshCollection
();
this
.
refreshItinerary
();
this
.
checkUpdate
();
this
.
initBuildingByLocation
();
const
callback
=
(
res
)
=>
console
.
log
(
"userTriggerTranslation"
,
res
);
wx
.
onUserTriggerTranslation
(
callback
);
},
/**
* 首次启动时,根据 GPS 定位自动切换到用户所在的区
*/
initBuildingByLocation
()
{
wx
.
getLocation
({
type
:
'gcj02'
,
isHighAccuracy
:
false
,
success
:
({
latitude
,
longitude
})
=>
{
console
.
log
(
'定位成功'
,
latitude
,
longitude
);
let
nearest
=
null
;
let
minDist
=
Infinity
;
buildings
.
forEach
((
building
)
=>
{
const
dlat
=
building
.
latlng
.
lat
-
latitude
;
const
dlng
=
building
.
latlng
.
lng
-
longitude
;
const
dist
=
dlat
*
dlat
+
dlng
*
dlng
;
if
(
dist
<
minDist
)
{
minDist
=
dist
;
nearest
=
building
;
}
});
const
THRESHOLD
=
0.00008
;
if
(
nearest
&&
minDist
<
THRESHOLD
)
{
if
(
this
.
currentBuilding
.
name
!==
nearest
.
name
)
{
this
.
currentBuilding
=
nearest
;
console
.
log
(
'initBuildingByLocation 切换到:'
,
nearest
.
name
);
this
.
events
.
emit
(
'building'
,
nearest
);
}
}
else
{
console
.
log
(
'用户不在义乌市场范围内,保持默认区:'
,
this
.
currentBuilding
.
name
);
}
},
fail
:
(
e
)
=>
{
console
.
log
(
'定位失败,保持默认区'
,
e
);
},
});
},
checkUpdate
()
{
if
(
wx
.
canIUse
(
"getUpdateManager"
))
{
const
updateManager
=
wx
.
getUpdateManager
();
...
...
@@ -359,7 +631,6 @@ App({
.
filter
(
Boolean
),
);
}
catch
(
error
)
{}
this
.
events
.
emit
(
"globalData"
);
}
catch
(
error
)
{
console
.
error
(
error
);
...
...
@@ -390,11 +661,10 @@ App({
if
(
this
.
lastSetBuildingTime
&&
now
-
this
.
lastSetBuildingTime
<
1000
)
{
return
false
;
}
if
(
!
currentBuilding
)
return
false
;
if
(
this
.
currentBuilding
.
name
===
currentBuilding
.
name
)
return
false
;
this
.
currentBuilding
=
currentBuilding
;
console
.
log
(
this
.
currentBuilding
,
"setBuilding"
);
this
.
lastSetBuildingTime
=
now
;
this
.
events
.
emit
(
"building"
,
currentBuilding
);
return
true
;
...
...
@@ -436,7 +706,6 @@ App({
],
});
const
themeInstance
=
new
plugin
.
Theme
();
themeInstance
.
setGlobalThemeColor
({
colorPrimary
:
"#E32424"
,
lightColorPrimary
:
"#fef0eb"
,
...
...
@@ -466,24 +735,15 @@ App({
data
:
{
data
},
}
=
await
post
(
`
${
qmurl
}
/api/v1/applet/searchShopFacilityList`
,
{
keyword
,
zone
:
building
.
zone
,
},
{
keyword
,
zone
:
building
.
zone
},
{
lang
:
"zh"
},
);
// 提取需要查询的店铺信息
const
shopInfoList
=
data
.
map
(({
shopType
,
shopId
})
=>
({
shopType
,
shopId
,
boothNo
:
""
,
// 这里 boothNo 可能需要从其他地方获取,暂时设为空
boothNo
:
""
,
}));
// 批量获取店铺详情
const
shopDetails
=
await
poiApi
.
getListByIds
(
shopInfoList
);
// 创建临时映射,用于快速查找店铺详情
const
shopDetailMap
=
{};
if
(
shopDetails
)
{
shopDetails
.
forEach
((
detail
,
index
)
=>
{
...
...
@@ -491,10 +751,8 @@ App({
shopDetailMap
[
`
${
shopType
}
_
${
shopId
}
`
]
=
detail
;
});
}
const
list
=
data
.
map
(({
shopType
,
shopId
})
=>
{
// 从批量获取的详情中查找
const
detail
=
shopDetailMap
[
`
${
shopType
}
_
${
shopId
}
`
];
return
detail
;
})
...
...
@@ -508,7 +766,7 @@ App({
floorName
:
poi
.
tx
.
poi_fl_name
,
latitude
:
lat
,
longitude
:
lng
,
category
:
poi
.
facility
?
"周边"
:
poi
.
ywZh
.
front
Industry
Category
,
category
:
poi
.
facility
?
"周边"
:
poi
.
ywZh
.
front
name
Category
,
distance
:
getDistance
(
latitude
,
longitude
,
lat
,
lng
),
};
});
...
...
@@ -539,9 +797,7 @@ App({
if
(
this
.
globalData
.
user
)
{
return
true
;
}
else
{
wx
.
navigateTo
({
url
:
"/pages/login/index"
,
});
wx
.
navigateTo
({
url
:
"/pages/login/index"
});
return
false
;
}
},
...
...
components/lang-btn/index.js
查看文件 @
cdb00d7a
...
...
@@ -71,6 +71,7 @@ Component({
donothing
()
{},
changeBuilding
({
currentTarget
:
{
id
}
})
{
const
building
=
this
.
data
.
buildings
[
id
];
console
.
log
(
'changeBuilding'
,
this
.
data
.
buildings
[
id
])
getApp
().
setBuilding
(
building
);
getApp
().
blurPoi
();
this
.
setData
({
showBuildings
:
false
});
...
...
components/shop-addr/index.js
查看文件 @
cdb00d7a
...
...
@@ -29,7 +29,11 @@ Component({
setText
()
{
const
{
isEn
,
shop
}
=
this
.
data
;
const
{
enAddr
,
buildingFloor
,
street
}
=
getAddr
(
shop
,
isEn
);
this
.
setData
({
enAddr
,
buildingFloor
,
street
});
// 过滤掉"国际商贸城"字样
const
filteredBuildingFloor
=
buildingFloor
?
buildingFloor
.
replace
(
/国际商贸城/g
,
''
)
:
''
;
this
.
setData
({
enAddr
,
buildingFloor
:
filteredBuildingFloor
,
street
});
},
},
lifetimes
:
{
...
...
pages/index/index.js
查看文件 @
cdb00d7a
...
...
@@ -84,7 +84,9 @@ Page({
onCurrentBuildingChange
()
{
this
.
getActs
();
if
(
!
this
.
data
.
focusedPoi
)
{
this
.
setFloorName
(
getApp
().
currentBuilding
.
floors
[
0
]);
// 默认展示一楼
let
isFrisfloor
=
getApp
().
currentBuilding
.
floors
.
indexOf
(
'1F'
)
this
.
setFloorName
(
getApp
().
currentBuilding
.
floors
[
isFrisfloor
]);
}
if
(
!
this
.
data
.
isIndex
)
{
if
(
this
.
data
.
activeId
)
this
.
setFacilities
(
this
.
data
.
activeId
);
...
...
@@ -412,6 +414,7 @@ Page({
const
building
=
getApp
().
buildings
.
find
(
(
building
)
=>
building
.
buildingId
&&
building
.
buildingId
===
buildingId
,
);
if
(
building
)
{
getApp
().
setBuilding
(
building
);
this
.
setFloorName
(
floorName
);
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论