切换导航条
此项目
正在载入...
登录
miniprogram
/
winebook
·
提交
转到一个项目
GitLab
转到群组
项目
活动
文件
提交
管道
0
构建
0
图表
里程碑
问题
0
合并请求
0
成员
标记
维基
派生
网络
创建新的问题
下载为
邮件补丁
差异文件
浏览文件
作者
lihongjuan
6 years ago
提交
d9699c3bc8e4529eb1234f7d4bc7ea7735fff077
1 个父辈
08a038e4
3233
隐藏空白字符变更
内嵌
并排对比
正在显示
4 个修改的文件
包含
268 行增加
和
16 行删除
app.json
pages/homapage/homepage.js
pages/homapage/homepage.wxml
pages/homapage/homepage.wxss
app.json
查看文件 @
d9699c3
...
...
@@ -63,5 +63,10 @@
}
]
},
"permission"
:
{
"scope.userLocation"
:
{
"desc"
:
"你的位置信息将用于小程序位置接口的效果展示"
}
},
"sitemapLocation"
:
"sitemap.json"
}
\ No newline at end of file
...
...
pages/homapage/homepage.js
查看文件 @
d9699c3
...
...
@@ -135,8 +135,10 @@ Page({
record
:
''
,
showcountry
:
false
,
showcity
:
false
,
showregin
:
false
,
countrylist
:
[],
citylist
:
[],
reginlist
:[],
sort_id
:
''
,
country
:
''
,
city
:
""
,
...
...
@@ -163,6 +165,8 @@ Page({
sle
:
false
}],
currentCity
:
''
},
...
...
@@ -176,8 +180,68 @@ Page({
})
console
.
log
(
this
.
data
.
url
)
this
.
getshailist
();
this
.
gethomeindex
()
this
.
gethomeindex
();
this
.
getcity
()
},
//获取用户当前位置
getcity
()
{
let
that
=
this
;
wx
.
getLocation
({
type
:
'gcj02'
,
success
:
function
(
res
)
{
// 经纬度
var
latitude
=
res
.
latitude
var
longitude
=
res
.
longitude
// that.setData({
// wd: latitude,
// jd: longitude
// })
// that.gethostipallist()
var
aK
=
that
.
data
.
aK
wx
.
request
({
url
:
'https://api.map.baidu.com/geocoder/v2/?ak=y8jPDTMIuAnaVscUztce1RKfNx8v5sok&location='
+
latitude
+
','
+
longitude
+
'&output=json'
,
data
:
{},
header
:
{
'content-type'
:
'application/json'
},
success
:
function
(
res
)
{
console
.
log
(
'1234567890'
,
res
)
var
province
=
res
.
data
.
result
.
addressComponent
.
province
;
let
district
=
res
.
data
.
result
.
addressComponent
.
district
that
.
setData
({
currentCity
:
province
})
wx
.
request
({
// url: 'xxx' + city,
// data: {},
// header: {
// 'content-type': 'application/json'
// },
// success: function (res) {
// that.setData({
// county: res.data,
// })
// },
})
}
})
},
fail
:
function
()
{
wx
.
showToast
({
title
:
'授权失败,请打开GPS重新进入页面授权'
,
icon
:
'none'
,
duration
:
2000
})
}
})
},
letterTap
(
e
)
{
console
.
log
(
e
)
const
Item
=
e
.
currentTarget
.
dataset
.
item
;
...
...
@@ -198,14 +262,15 @@ Page({
app
.
post
(
url
,
params
).
then
((
res
)
=>
{
that
.
setData
({
record
:
res
.
wine_count
.
dataset
,
citylist
:
res
.
region
record
:
res
.
wine_count
,
})
if
(
that
.
data
.
type
==
1
)
{
that
.
setData
({
shaikind
:
res
.
sort
shaikind
:
res
.
sort
,
})
}
else
if
(
that
.
data
.
type
==
2
)
{
that
.
setData
({
...
...
@@ -216,11 +281,31 @@ Page({
for
(
var
obj
of
newcountrylist
)
{
obj
.
sel
=
false
}
that
.
setData
({
countrylist
:
newcountrylist
})
}
else
if
(
that
.
data
.
type
==
3
)
{
if
(
that
.
data
.
kindlist
[
1
].
name
==
'中国'
){
that
.
setData
({
citylist
:
res
.
region
})
}
else
{
that
.
setData
({
citylist
:
[]
})
}
let
newcitylist
=
that
.
data
.
citylist
;
for
(
var
obj
of
newcitylist
)
{
obj
.
sel
=
false
}
that
.
setData
({
shaikind
:
res
.
region
citylist
:
newcitylist
})
}
else
if
(
that
.
data
.
type
==
4
)
{
that
.
setData
({
shaikind
:
res
.
odor
...
...
@@ -280,6 +365,19 @@ Page({
showcountry
:
true
})
}
else
if
(
type
==
3
){
that
.
setData
({
shai
:
false
,
showcity
:
true
})
}
else
{
that
.
setData
({
shai
:
true
,
showcity
:
false
,
showcountry
:
false
})
}
let
newkindlist
=
that
.
data
.
kindlist
;
...
...
@@ -326,7 +424,14 @@ Page({
if
(
this
.
data
.
type
==
1
)
{
if
(
obj
.
sel
==
true
)
{
this
.
setData
({
sort_id
:
obj
.
id
sort_id
:
obj
.
id
,
})
let
newkindlist
=
this
.
data
.
kindlist
;
newkindlist
[
0
].
name
=
obj
.
sort_name
;
this
.
setData
({
kindlist
:
newkindlist
})
}
}
else
if
(
this
.
data
.
type
==
4
)
{
...
...
@@ -334,6 +439,12 @@ Page({
this
.
setData
({
odor_id
:
obj
.
id
})
let
newkindlist
=
this
.
data
.
kindlist
;
newkindlist
[
3
].
name
=
obj
.
odor_name
;
this
.
setData
({
kindlist
:
newkindlist
})
}
}
...
...
@@ -362,6 +473,8 @@ Page({
this
.
setData
({
kindlist
:
newkindlist
})
this
.
gethomeindex
()
},
//筛选首页内容
...
...
@@ -389,7 +502,7 @@ Page({
})
},
// 选择
城市
// 选择
国家
selectcountry
(
e
)
{
let
countryid
=
e
.
currentTarget
.
dataset
.
id
;
...
...
@@ -403,9 +516,9 @@ Page({
newkindlist
[
1
].
name
=
obj
.
country_name
this
.
setData
({
kindlist
:
newkindlist
kindlist
:
newkindlist
,
country
:
obj
.
country_name
})
}
else
{
obj
.
sel
=
false
}
...
...
@@ -419,12 +532,107 @@ Page({
})
},
//选择城市
selectcity
(
e
){
let
cityindex
=
e
.
currentTarget
.
dataset
.
index
;
console
.
log
(
cityindex
)
let
newcitylist
=
this
.
data
.
citylist
;
for
(
var
i
=
0
;
i
<
newcitylist
.
length
;
i
++
)
{
if
(
i
==
cityindex
)
{
this
.
setData
({
reginlist
:
newcitylist
[
i
].
region_list
,
showregin
:
true
,
showcity
:
false
,
city
:
newcitylist
[
i
].
city
})
}
}
let
newreginlist
=
this
.
data
.
reginlist
;
for
(
var
obj
of
newreginlist
){
obj
.
sel
=
false
}
this
.
setData
({
reginlist
:
newreginlist
})
},
//选择区
selectregin
(
e
){
let
reginindex
=
e
.
currentTarget
.
dataset
.
index
;
let
newreginlist
=
this
.
data
.
reginlist
;
for
(
var
i
=
0
;
i
<
newreginlist
.
length
;
i
++
){
// newreginlist[i].sel = !newreginlist[i].sel
if
(
i
==
reginindex
){
console
.
log
(
243782347
)
newreginlist
[
i
].
sel
=
true
;
let
newkindlist
=
this
.
data
.
kindlist
;
newkindlist
[
2
].
name
=
newreginlist
[
i
].
name
;
this
.
setData
({
kindlist
:
newkindlist
,
region
:
newreginlist
[
i
].
name
})
console
.
log
(
this
.
data
.
kindlist
)
}
else
{
newreginlist
[
i
].
sel
=
false
}
}
this
.
setData
({
reginlist
:
newreginlist
})
console
.
log
(
this
.
data
.
reginlist
)
},
//确定选择国家
countrysure
()
{
this
.
setData
({
showcountry
:
false
,
shai
:
false
})
this
.
gethomeindex
()
},
//确定选择省
citysure
(){
this
.
setData
({
showregin
:
false
,
shai
:
false
,
showcity
:
false
})
this
.
gethomeindex
()
},
//选择区
sureregin
(){
this
.
setData
({
showregin
:
false
,
shai
:
false
,
showcity
:
false
})
this
.
gethomeindex
()
},
//筛选
shai
(){
this
.
gethomeindex
()
},
...
...
pages/homapage/homepage.wxml
查看文件 @
d9699c3
...
...
@@ -20,11 +20,11 @@
</view>
<view class="countryitem" wx:for="{{countrylist}}" wx:key="" data-name="{{item.country_name}}" bindtap="selectcountry" data-id="{{item.id}}">
<view class="selcounitem"
>{{item.country_name}}</view>
<view class="selcounitem">{{item.country_name}}</view>
<view class="gouimg" wx:if="{{item.sel==true}}">
<image src="{{url}}/aicon_18x.png"></image>
</view>
<image src="{{url}}/aicon_18x.png"></image>
</view>
</view>
...
...
@@ -37,15 +37,47 @@
<view class="quehead">
<view class="backrow"></view>
<view class="selcoun">选择城市</view>
<view class="cqueding">确定</view>
<view class="cqueding"
bindtap="citysure"
>确定</view>
</view>
<view class="selcounitem" wx:for="{{citylist}}" wx:key="" data-name="{{item.country_name}}" bindtap="selectcountry">{{item.city}}</view>
<view class="nodata" wx:if="{{citylist.length==0}}">暂无数据</view>
<block wx:else>
<view class="countryitem" wx:for="{{citylist}}" wx:key="" data-name="{{item.country_name}}" bindtap="selectcity" data-index="{{index}}" >
<view class="selcounitem" >{{item.city}}</view>
<!-- <view class="gouimg" wx:if="{{item.sel==true}}">
<image src="{{url}}/aicon_18x.png"></image>
</view> -->
</view>
</block>
</view>
<!-- 区域选择 -->
<view class="cregister" wx:if="{{showregin}}">
<view class="quehead">
<view class="backrow"></view>
<view class="selcoun">选择区</view>
<view class="cqueding" bindtap="sureregin">确定</view>
</view>
<view class="countryitem" wx:for="{{reginlist}}" wx:key="" data-name="{{item.name}}" bindtap="selectregin" data-index="{{index}}">
<view class="selcounitem" >{{item.name}}</view>
<view class="gouimg" wx:if="{{item.sel==true}}">
<image src="{{url}}/aicon_18x.png"></image>
</view>
</view>
</view>
<view class="heatop">
<view class="head">
<view class="address">
...
...
@@ -53,7 +85,7 @@
<image src='{{url}}bicon_01x.png'></image>
</view>
<view class="addressname">
天津
</view>
<view class="addressname">
{{currentCity}}
</view>
</view>
<view class="headmiddle">
...
...
@@ -70,7 +102,7 @@
</view>
</view>
<view class="address">
<view class="address"
bindtap="shai"
>
<view class="shaixuan">
<image src='{{url}}bicon_02@2x.png'></image>
</view>
...
...
pages/homapage/homepage.wxss
查看文件 @
d9699c3
...
...
@@ -332,4 +332,11 @@ page{
width:50rpx;
height:40rpx;
font-size: 0
}
.nodata{
color:#999;
font-size:30rpx;
text-align: center;
margin-top:30rpx;
}
\ No newline at end of file
...
...
请
注册
或
登录
后发表评论