Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
N
nyx
概览
Overview
Details
Activity
Cycle Analytics
版本库
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
问题
0
Issues
0
列表
Board
标记
里程碑
合并请求
0
Merge Requests
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
Snippets
成员
Collapse sidebar
Close sidebar
活动
图像
聊天
创建新问题
作业
提交
Issue Boards
Open sidebar
发现
nyx
Commits
06874d25
Commit
06874d25
authored
Mar 28, 2020
by
jscat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
nyx: map.js
优化: 将初次载入地图的算法进入优化 进一步:可以将第一个地图提前存入storage
parent
1f48675d
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
53 行增加
和
4 行删除
+53
-4
增值产品-小程序及app/nyx-master/pages/map/map.js
+53
-4
没有找到文件。
增值产品-小程序及app/nyx-master/pages/map/map.js
查看文件 @
06874d25
var
c
onfig
=
wx
.
getStorageSync
(
"config"
);
var
c
onfig
=
wx
.
getStorageSync
(
"config"
);
...
@@ -292,12 +292,61 @@ Page({
...
@@ -292,12 +292,61 @@ Page({
}
}
},
},
// 1. 获取全部的city数据
// 1. 获取全部的city数据
设置city, cityIndex
// 2. 获取city="上海市"的所有"district, url, 及num_bar
// 2. 获取city="上海市"的所有"district, url, 及num_bar
// 3. 获取某个区的allText
// 3. 获取某个区的allText
initCityInfo
:
function
(){
initCityInfo
:
function
(){
var
_this
=
this
;
var
_this
=
this
;
_this
.
getCityList
();
var
strUrl
=
config
.
city_query_url
config
.
debug
==
1
?
console
.
log
(
"===initCityInfo strUrl is:
\"
"
+
strUrl
+
"
\"
"
)
:
""
wx
.
request
({
url
:
strUrl
,
method
:
'GET'
,
header
:
{
'Cookie'
:
wx
.
getStorageSync
(
'cookieKey'
),
},
success
:
function
(
res
)
{
if
(
res
.
data
.
resultCode
==
200
)
{
//表示HTTP请求成功
console
.
log
(
res
.
data
);
var
city
=
[]
var
cityIndex
=
0
var
json
=
{};
var
list
=
[]
var
district
=
[]
var
numBar
=
[]
var
url
=
[]
for
(
var
i
=
0
;
i
<
res
.
data
.
data
.
length
;
i
++
)
{
// city.push(res.data.data[i].city)
var
cityName
=
res
.
data
.
data
[
i
].
city
if
(
!
json
[
cityName
])
{
city
.
push
(
cityName
);
json
[
cityName
]
=
city
.
length
;
}
if
(
cityName
==
"上海市"
)
{
district
.
push
(
res
.
data
.
data
[
i
].
district
)
numBar
.
push
(
res
.
data
.
data
[
i
].
numBar
)
url
.
push
(
res
.
data
.
data
[
i
].
url
)
}
}
cityIndex
=
json
[
"上海市"
]
-
1
_this
.
setData
({
district
:
district
,
numBar
:
numBar
,
url
:
url
,
city
:
city
,
cityIndex
:
cityIndex
,
})
//获得新的地区名
var
districtName
=
district
[
0
]
var
areaName
=
city
[
cityIndex
]
+
"_"
+
districtName
_this
.
getMemberPos
(
""
,
areaName
)
_this
.
loadMap
(
_this
,
url
[
0
],
areaName
)
_this
.
cacheImage
();
}
}
})
},
},
/**
/**
...
@@ -465,7 +514,7 @@ Page({
...
@@ -465,7 +514,7 @@ Page({
{
{
var
img_cache_key
=
areaName
+
"_imgcache"
var
img_cache_key
=
areaName
+
"_imgcache"
var
path
=
wx
.
getStorageSync
(
img_cache_key
)
==
""
?
imgUrl
:
wx
.
getStorageSync
(
img_cache_key
)
var
path
=
wx
.
getStorageSync
(
img_cache_key
)
==
""
?
imgUrl
:
wx
.
getStorageSync
(
img_cache_key
)
console
.
log
(
"===loadMap,
img
age path: "
+
path
)
console
.
log
(
"===loadMap,
"
+
areaName
+
" im
age path: "
+
path
)
self
.
setData
({
self
.
setData
({
tempImageSrc
:
path
,
tempImageSrc
:
path
,
img_cache_key
:
img_cache_key
,
img_cache_key
:
img_cache_key
,
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论