数据库: - 新增 odf_checkin/odf_cables/odf_cable_faults/odf_cable_fault_images/odf_user_modules 5张表 - 新增菜单权限和角色分配 SQL 脚本 后台 API (.NET/SqlSugar): - 新增实体模型、DTO、Service、Controller (签到/光缆/故障/图片/用户模块) 前端 APP (UniApp): - 新增 portal/checkin/trunk/cable/fault-list/fault-detail/fault-add/trunk-search/route-plan 9个页面 - 新增 permission/checkin/trunk 服务层 - 新增 navigation/watermark 工具函数 后台管理前端 (ZR.Vue): - 新增光缆管理/干线故障管理/签到记录管理/用户模块权限 4个管理页面 - 新增对应 API 模块和表单组件
55 lines
1.5 KiB
JavaScript
55 lines
1.5 KiB
JavaScript
/**
|
|
* 打开导航 APP
|
|
* @param {number} lat - 纬度
|
|
* @param {number} lng - 经度
|
|
* @param {string} name - 地点名称
|
|
*/
|
|
export function openNavigation(lat, lng, name) {
|
|
// #ifdef APP-PLUS
|
|
const apps = []
|
|
|
|
// 检测高德地图
|
|
if (plus.runtime.isApplicationExist({ pname: 'com.autonavi.minimap', action: '' })) {
|
|
apps.push({
|
|
title: '高德地图',
|
|
scheme: `androidamap://navi?sourceApplication=odf&lat=${lat}&lon=${lng}&dev=0&style=2`
|
|
})
|
|
}
|
|
|
|
// 检测百度地图
|
|
if (plus.runtime.isApplicationExist({ pname: 'com.baidu.BaiduMap', action: '' })) {
|
|
apps.push({
|
|
title: '百度地图',
|
|
scheme: `baidumap://map/navi?location=${lat},${lng}&src=odf&coord_type=gcj02`
|
|
})
|
|
}
|
|
|
|
// 检测腾讯地图
|
|
if (plus.runtime.isApplicationExist({ pname: 'com.tencent.map', action: '' })) {
|
|
apps.push({
|
|
title: '腾讯地图',
|
|
scheme: `qqmap://map/routeplan?type=drive&to=${encodeURIComponent(name)}&tocoord=${lat},${lng}&referer=odf`
|
|
})
|
|
}
|
|
|
|
if (apps.length === 0) {
|
|
uni.showToast({ title: '未检测到导航应用', icon: 'none' })
|
|
return
|
|
}
|
|
|
|
uni.showActionSheet({
|
|
itemList: apps.map(a => a.title),
|
|
success(res) {
|
|
const selected = apps[res.tapIndex]
|
|
plus.runtime.openURL(selected.scheme, (err) => {
|
|
uni.showToast({ title: '打开导航失败', icon: 'none' })
|
|
})
|
|
}
|
|
})
|
|
// #endif
|
|
|
|
// #ifdef H5
|
|
window.open(`https://uri.amap.com/navigation?to=${lng},${lat},${encodeURIComponent(name)}&mode=car&src=odf`)
|
|
// #endif
|
|
}
|