new
This commit is contained in:
parent
0987355b8b
commit
247cc43dc5
@ -586,56 +586,22 @@ def carinfo():
|
|||||||
traceback.print_exc()
|
traceback.print_exc()
|
||||||
return render_template("carinfo.html", car_info={"error": f"Error getting vehicle information: {str(e)}"})
|
return render_template("carinfo.html", car_info={"error": f"Error getting vehicle information: {str(e)}"})
|
||||||
|
|
||||||
@app.route("/amap_addr", methods=["GET", "POST"])
|
@app.route("/amap_nav")
|
||||||
def amap_addr():
|
def amap_nav():
|
||||||
# 直接使用硬编码的 key
|
"""高德地图导航页面"""
|
||||||
amap_key = "faf2f8ab406a8da1231ef7e10d501b65"
|
|
||||||
amap_key_2 = "fc2724b3c96a7f244b2211f05c5264be"
|
|
||||||
|
|
||||||
# 获取当前位置
|
|
||||||
try:
|
try:
|
||||||
|
# 获取当前位置
|
||||||
location = get_current_location() # 假设这个函数已存在
|
location = get_current_location() # 假设这个函数已存在
|
||||||
lat = location.get("lat", 31.2304) # 默认上海坐标
|
lat = location.get('lat', 39.9042) # 默认北京位置
|
||||||
lon = location.get("lon", 121.4737)
|
lon = location.get('lon', 116.4074)
|
||||||
except:
|
|
||||||
lat = 31.2304 # 默认上海坐标
|
|
||||||
lon = 121.4737
|
|
||||||
|
|
||||||
if request.method == "POST":
|
return render_template(
|
||||||
# 处理导航请求
|
"amap_addr_input.html",
|
||||||
lat = request.form.get("lat")
|
lat=lat,
|
||||||
lon = request.form.get("lon")
|
lon=lon
|
||||||
save_type = request.form.get("save_type", "recent")
|
)
|
||||||
name = request.form.get("name", "")
|
except Exception as e:
|
||||||
|
return render_template("error.html", error=str(e))
|
||||||
# 保存目的地
|
|
||||||
save_destination(save_type, name, lat, lon) # 假设这个函数已存在
|
|
||||||
|
|
||||||
# 生成导航路线
|
|
||||||
generate_route(lat, lon) # 假设这个函数已存在
|
|
||||||
|
|
||||||
# 重定向到导航页面
|
|
||||||
return redirect("/prime")
|
|
||||||
|
|
||||||
# 获取保存的地址
|
|
||||||
home = get_saved_location("home") # 假设这个函数已存在
|
|
||||||
work = get_saved_location("work")
|
|
||||||
fav1 = get_saved_location("fav1")
|
|
||||||
fav2 = get_saved_location("fav2")
|
|
||||||
fav3 = get_saved_location("fav3")
|
|
||||||
|
|
||||||
return render_template(
|
|
||||||
"amap_addr_input.html",
|
|
||||||
amap_key=amap_key,
|
|
||||||
amap_key_2=amap_key_2,
|
|
||||||
lat=lat,
|
|
||||||
lon=lon,
|
|
||||||
home=home,
|
|
||||||
work=work,
|
|
||||||
fav1=fav1,
|
|
||||||
fav2=fav2,
|
|
||||||
fav3=fav3
|
|
||||||
)
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
try:
|
try:
|
||||||
|
@ -14,13 +14,13 @@
|
|||||||
<!-- UIkit JS -->
|
<!-- UIkit JS -->
|
||||||
<script src="https://cdn.jsdelivr.net/npm/uikit@3.9.2/dist/js/uikit.min.js"></script>
|
<script src="https://cdn.jsdelivr.net/npm/uikit@3.9.2/dist/js/uikit.min.js"></script>
|
||||||
<script src="https://cdn.jsdelivr.net/npm/uikit@3.9.2/dist/js/uikit-icons.min.js"></script>
|
<script src="https://cdn.jsdelivr.net/npm/uikit@3.9.2/dist/js/uikit-icons.min.js"></script>
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
window._AMapSecurityConfig = {
|
window._AMapSecurityConfig = {
|
||||||
securityJsCode:'{{amap_key_2}}',
|
securityJsCode:'fc2724b3c96a7f244b2211f05c5264be',
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style type="text/css">
|
<style type="text/css">
|
||||||
body {
|
body {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
@ -28,7 +28,7 @@
|
|||||||
width: 100%;
|
width: 100%;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
}
|
}
|
||||||
|
|
||||||
#mapContainer {
|
#mapContainer {
|
||||||
top: 0;
|
top: 0;
|
||||||
left: 0;
|
left: 0;
|
||||||
@ -41,7 +41,7 @@
|
|||||||
#amap-container {
|
#amap-container {
|
||||||
height: 400px; /* Adjust height as needed */
|
height: 400px; /* Adjust height as needed */
|
||||||
}
|
}
|
||||||
|
|
||||||
.button-group {
|
.button-group {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
bottom: 20px;
|
bottom: 20px;
|
||||||
@ -49,7 +49,7 @@
|
|||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
padding: 10px;
|
padding: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.button-group .button {
|
.button-group .button {
|
||||||
height: 28px;
|
height: 28px;
|
||||||
line-height: 28px;
|
line-height: 28px;
|
||||||
@ -63,15 +63,15 @@
|
|||||||
margin-bottom: 4px;
|
margin-bottom: 4px;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
.amap-info-content {
|
.amap-info-content {
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<script type="text/javascript"
|
<script type="text/javascript"
|
||||||
src="https://webapi.amap.com/maps?v=1.4.2&key={{amap_key}}"></script>
|
src="https://webapi.amap.com/maps?v=1.4.2&key=faf2f8ab406a8da1231ef7e10d501b65"></script>
|
||||||
|
|
||||||
<!-- Rest of the HTML body content -->
|
<!-- Rest of the HTML body content -->
|
||||||
<div class="uk-grid-match uk-grid-small uk-text-center" uk-grid>
|
<div class="uk-grid-match uk-grid-small uk-text-center" uk-grid>
|
||||||
<div class="uk-width-1-3@m">
|
<div class="uk-width-1-3@m">
|
||||||
|
@ -13,6 +13,6 @@
|
|||||||
<br><a href='/preserved'>Access Preserved Footage</a><br>
|
<br><a href='/preserved'>Access Preserved Footage</a><br>
|
||||||
<br><a href='/screenrecords'>View Screen Recordings</a><br>
|
<br><a href='/screenrecords'>View Screen Recordings</a><br>
|
||||||
<br><a href='/error_logs'>Access Error Logs</a><br>
|
<br><a href='/error_logs'>Access Error Logs</a><br>
|
||||||
<br><a href='/amap_addr'>高德地图导航</a><br>
|
|
||||||
<br><a href='/about'>About Fleet Manager</a><br>
|
<br><a href='/about'>About Fleet Manager</a><br>
|
||||||
|
<br><a href='/amap_nav'>高德地图导航</a><br>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
@ -67,9 +67,6 @@
|
|||||||
<li class="nav-item active">
|
<li class="nav-item active">
|
||||||
<a href="/tools" class="nav-link">Tools</a>
|
<a href="/tools" class="nav-link">Tools</a>
|
||||||
</li>
|
</li>
|
||||||
<li class="nav-item active">
|
|
||||||
<a href="/amap_addr" class="nav-link">高德导航</a>
|
|
||||||
</li>
|
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user