Browse Source

地图

feature/v1.1.0
shuiqing 7 years ago
parent
commit
9037ff1365
7 changed files with 107 additions and 5 deletions
  1. 4
      app.js
  2. 2
      app.json
  3. 42
      pages/at_present/at_present.js
  4. 3
      pages/at_present/at_present.json
  5. 15
      pages/at_present/at_present.wxml
  6. 44
      pages/at_present/at_present.wxss
  7. 2
      project.config.json

4
app.js

@ -1,12 +1,8 @@
//app.js
App({
gw: {
<<<<<<< HEAD
hostUrl: 'https://test.1hjz.cn',
=======
// hostUrl: 'https://www.1hjz.cn',
hostUrl: 'https://test.1hjz.cn/',
>>>>>>> 66bdd2a78217c5b94b59c7561723555bd2cd5ee7
mapUrl:'https://api.map.baidu.com',
systemInfo : null,//系统信息
},

2
app.json

@ -1,5 +1,6 @@
{
"pages": [
"pages/at_present/at_present",
"pages/index/index",
"pages/mall/mall",
"pages/jz/jz",
@ -21,6 +22,7 @@
"pages/two_code/two_code",
"pages/out/out",
"pages/agreement/agreement"
],
"window": {
"backgroundTextStyle": "light",

42
pages/at_present/at_present.js

@ -0,0 +1,42 @@
// pages/demo/demo.js
Page({
/**
* 页面的初始数据
*/
data: {},
// 引入腾讯地图文件js
// var QQMapWX = require('../../libs/qqmap-wx-jssdk.js'),
// var qqmapsdk
onLoad: function (options) {
this.getLocation();
},
getLocation() {
var that = this;
wx.getLocation({
type: "wgs84",
success: function (res) {
var locationString = res.latitude + "," + res.longitude;
wx.request({
url: "https://apis.map.qq.com/ws/geocoder/v1/",
data: {
key: "C5KBZ-RISKD-INW4P-PWYQJ-QC6C7-BQBGC",
location: locationString
},
method: "GET",
success: function (res) {
console.log("用户位置信息", res.data, that);
var district = res.data.result.ad_info.district;
var city = res.data.result.ad_info.city
console.log(city);
console.log(district);
that.setData({
city,
district
});
}
});
}
});
}
});

3
pages/at_present/at_present.json

@ -0,0 +1,3 @@
{
}

15
pages/at_present/at_present.wxml

@ -0,0 +1,15 @@
<view class="base">
<view class="base_center">
<view class="base_top">当前定位地址:</view>
<view class="base_district"><text>{{city}}{{district}}</text></view>
<view class="base_hint">此区/县暂未开放,敬请期待</view>
<view class="choice_switchover">手动切换地址</view>
<view class="confirm">
<view class="choice">
<text class="confirm_left">确定</text>
<text class="confirm_right">切换</text>
</view>
</view>
</view>
</view>

44
pages/at_present/at_present.wxss

@ -0,0 +1,44 @@
page{
background-color: #ccc;
}
.base{
background-color: #fff;
width: 600rpx;
/* height: 400rpx; */
text-align: center;
margin: 300rpx auto;
border-radius: 20rpx
}
.base_center{
margin-top: 20rpx;
margin-bottom: 20rpx;
}
.base_top{
padding-top: 30rpx;
padding-bottom: 30rpx;
}
.base_district{
color: #1E90FF;
padding-bottom: 30rpx;
}
.base_hint{
padding-bottom: 30rpx;
border-bottom: 1px solid #ccc;
}
.choice_switchover{
color: #1E90FF;
padding-top: 30rpx;
padding-bottom: 30rpx;
}
.choice{
width: 100%;
}
.confirm_left{
width: 50%;
display: inline-block;
}
.confirm_right{
width: 50%;
display: inline-block;
padding-bottom: 30rpx;
}

2
project.config.json

@ -1,7 +1,7 @@
{
"description": "项目配置文件。",
"setting": {
"urlCheck": true,
"urlCheck": false,
"es6": true,
"postcss": true,
"minified": true,

Loading…
Cancel
Save