index_win.html
11.0 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
<meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
<title></title>
<script src="../../assets/js/fontsize.js"></script>
<link rel="stylesheet" href="../../assets/css/weui.min.css">
<link rel="stylesheet" href="../../assets/css/api.css"/>
<!--<link rel="stylesheet" href="http://at.alicdn.com/t/font_641470_jg64l6ijsg4lsor.css">-->
<link rel="stylesheet" href="../../assets/css/index.css">
<link rel="stylesheet" href="../../assets/icon/iconfont.css">
<style>
header {
width: 100%;
height: auto;
font-size: 20px;
/*background-color: #dbb25f;*/
}
.headers {
background-color: #dbb25f;
}
.app_name {
padding-right: 0.8rem;
font-family: "fzjt";
font-size: 20px;
}
.triangle_border_up span {
display: block;
width: 0;
height: 0;
border-width: 0 5px 5px;
border-style: solid;
border-color: transparent transparent #fff; /*透明 透明 黄*/
position: absolute;
bottom: 0;
right: 0.55rem;
}
.mold_index {
position: absolute;
}
#container {
width: 0;
height: 0;
}
</style>
</head>
<body>
<div id="app" v-cloak>
<div id="container"></div>
<header :class="index===0?'headers':''">
<div class="index_header" v-if="index==0">
<div class="index_left" @click="goToCity">
<div class="index_left_img">
<div class="iconfont icon-dizhi"></div>
</div>
<span>{{cityname?cityname:'定位中...'}}</span>
</div>
<span class="app_name">慈界医养</span>
<div class="index_right" @click="show_menu">
<img src="../../assets/image/plus.png" alt="" :class="[img_active?'img_transform':'img_transform1']">
</div>
</div>
<div class="triangle_border_up" v-show="img_active">
<span></span>
</div>
</header>
<footer>
<div class="footer_item" :class="{footer_item_active:index==0}" @click="changeTab(0)">
<i class="iconfont icon-yuanjiaojuxingkaobei"></i>
<span>严选</span>
</div>
<div class="footer_item" :class="{footer_item_active:index==1}" @click="changeTab(1)">
<i class="iconfont icon-xingzhuang"></i>
<span>投资</span>
</div>
<div class="footer_item" :class="{footer_item_active:index==2}" @click="changeTab(2)">
<i class="iconfont icon-wo"></i>
<span>我的</span>
</div>
<div class="mold_index" v-show="img_active" @click="hideMenu"></div>
</footer>
</div>
</body>
</html>
<script>
window.onLoad = function () {
var map = new AMap.Map('container');
}
var url = 'https://webapi.amap.com/maps?v=1.4.8&key=ef53760bd959a4df08b7d4587280e642&callback=onLoad';
var jsapi = document.createElement('script');
jsapi.charset = 'utf-8';
jsapi.src = url;
document.head.appendChild(jsapi);
</script>
<script type="text/javascript" src="../../assets/js/api.js"></script>
<script type="text/javascript" src="../../assets/js/weui.min.js"></script>
<script type="text/javascript" src="../../assets/js/public.js"></script>
<script type="text/javascript" src="../../assets/js/fastclick.js"></script>
<script>
new FastClick(document.body);
</script>
<script type="text/javascript" src="../../assets/js/vue.min.js"></script>
<script type="text/javascript" src="../../assets/icon/iconfont.js"></script>
<script type="text/javascript" src="../../assets/js/axios.min.js"></script>
<script>
var app = new Vue({
el: "#app",
data: {
index: 0,
headerH: '',
footerH: '',
getlng: '',
getlat: '',
cityindex: '',
cityname: '',
img_active: false,
map: {}
},
created: function () {
apiready = function () {
// 获取位置信息
app.get_city();
app.getUserType();
api.addEventListener({
name: 'city'
}, function (ret, err) {
app.cityname = ret.value.city;
});
api.openFrameGroup({
name: 'index_fm',
scrollEnabled: false,
index: app.index,
preload: 0,
reload: true,
rect: {
x: 0,
y: app.headerH,
w: 'auto',
h: api.winHeight - app.headerH - app.footerH
},
frames: [
{
name: 'index_f',
url: '../index/index_f.html',
bounces: true,
},
{
name: 'strict_f',
url: '../strict/strict_f.html',
bounces: false
},
{
name: 'my_f',
url: '../my/my_f.html',
bounces: false
}
],
});
api.addEventListener({
name: 'index0'
}, function (ret, err) {
api.setFrameGroupIndex({
name: 'index_fm',
index: ret.value.index
})
});
api.addEventListener({
name: 'index1'
}, function (ret, err) {
api.setFrameGroupIndex({
name: 'index_fm',
index: ret.value.index
})
});
api.addEventListener({
name: 'hide_menu'
}, function (ret, err) {
app.img_active = ret.value.img_active;
});
$api.fixStatusBar($api.dom('header'));
app.headerH = $api.offset($api.dom('header')).h;
app.footerH = $api.offset($api.dom('footer')).h;
api.setStatusBarStyle({
style: 'dark',
});
api.setWinAttr({
slidBackEnabled: false
});
}
},
methods: {
// 定位当前城市
get_city: function () {
app.map = new AMap.Map('container', {
resizeEnable: true
});
app.map.plugin('AMap.Geolocation', function () {
var geolocation = new AMap.Geolocation({
// 是否使用高精度定位,默认:true
enableHighAccuracy: true,
// 设置定位超时时间,默认:无穷大
timeout: 10000,
});
geolocation.getCurrentPosition();
AMap.event.addListener(geolocation, 'complete', onComplete)
AMap.event.addListener(geolocation, 'error', onError)
function onComplete(data) {
toastMsg(data.addressComponent.province);
app.cityname = data.addressComponent.province
// data是具体的定位信息
}
function onError(erro) {
// 定位出错
toastMsg('请开启定位功能')
}
})
},
// 切换底部导航
changeTab: function (res) {
setTimeout(function () {
app.index = res;
api.setFrameGroupIndex({
name: 'index_fm',
index: res
})
}, 300);
app.img_active = false;
api.sendEvent({
name: 'show_menu',
extra: {
img_active: app.img_active
}
});
},
// 切换当前城市
goToCity: function () {
if (app.cityname == '') {
toastMsg('定位中')
} else {
api.openWin({
name: 'city_win',
url: '../index/city_win.html',
pageParam: {
cityname: app.cityname
}
});
}
},
// 显示快捷菜单
show_menu: function () {
if (app.img_active == false) {
app.img_active = true
} else {
app.img_active = false
}
api.sendEvent({
name: 'show_menu',
extra: {
img_active: app.img_active
}
});
},
// 隐藏快捷菜单
hideMenu: function () {
app.img_active = !app.img_active;
api.sendEvent({
name: 'show_menu',
extra: {
img_active: app.img_active
}
});
},
// 判断登录用户
getUserType: function () {
if (getToken()) {
var header = {
'XX-Device-Type': getDevice(),
'XX-Token': getToken()
};
getRequest('post', 'home/index/getUserType', null, header).then(function (res) {
if (res.data.code == 1) {
if (res.data.data.user_type == 3) {
api.openWin({
name: 'doctor_win',
url: '../doctor/doctor_win.html',
});
api.sendEvent({
name: 'doctor_index0',
extra: {
index: 0
}
});
}
} else {
toastMsg(res.data.msg)
}
});
}
}
}
})
</script>