diff --git a/packages/mobile/src/views/Equipment/EquipmentManagement.vue b/packages/mobile/src/views/Equipment/EquipmentManagement.vue index f95f8bc..0ec8dd2 100644 --- a/packages/mobile/src/views/Equipment/EquipmentManagement.vue +++ b/packages/mobile/src/views/Equipment/EquipmentManagement.vue @@ -516,6 +516,7 @@ const getEquipmentList = async (sbmc) => { sbmc: sbmc, pageNum: 1, pageSize: 9999, + requestSource: 'app', // web: Web端请求,app:移动端请求 }; const res = await request({ url: "/snow-ops-platform/yjsb/list", diff --git a/packages/mobile/src/views/Material/MaterialManagement.vue b/packages/mobile/src/views/Material/MaterialManagement.vue index d3ccc7b..21a3def 100644 --- a/packages/mobile/src/views/Material/MaterialManagement.vue +++ b/packages/mobile/src/views/Material/MaterialManagement.vue @@ -298,6 +298,7 @@ const getMaterialList = async (wzmc) => { wzmc, paageNum: 1, paageSize: 9999, + requestSource: 'app', // web: Web端请求,app:移动端请求 }; const res = await request({ url: "/snow-ops-platform/yjwz/list", @@ -461,37 +462,47 @@ const afterRead = async (file) => { // 获取经纬度 const handleGetLocation = async () => { - // 确保AMap完成加载 - if (!window.AMap) { - await loadAMap(); - } - const loadingToast = showLoadingToast({ - message: "正在获取位置", - forbidClick: true, - duration: 0, // 设置为0表示不会自动关闭 - zIndex: 9999, + const location = await request({ + url: "/v3/ip", + method: "get", + params:{ + key: 'c30e9ebd414fd6a4dfcc1ba8c2060dbb' + }, + isThirdPartyAPI: true // 添加标识 }); + console.log("location", toRaw(location)); - AMap.plugin("AMap.Geolocation", () => { - const geolocation = new AMap.Geolocation({ - enableHighAccuracy: true, - timeout: 5000, - showMarker: false, - zoomToAccuracy: true, - }); + // // 确保AMap完成加载 + // if (!window.AMap) { + // await loadAMap(); + // } + // const loadingToast = showLoadingToast({ + // message: "正在获取位置", + // forbidClick: true, + // duration: 0, // 设置为0表示不会自动关闭 + // zIndex: 9999, + // }); - geolocation.getCurrentPosition((status, result) => { - if (status === "complete") { - form.material.jd = result.position.lng.toFixed(6); - form.material.wd = result.position.lat.toFixed(6); - loadingToast.close(); - } else { - loadingToast.close(); - showToast("定位失败 请检查网络情况后重试"); - console.log("result", result); - } - }); - }); + // AMap.plugin("AMap.Geolocation", () => { + // const geolocation = new AMap.Geolocation({ + // enableHighAccuracy: true, + // timeout: 5000, + // showMarker: false, + // zoomToAccuracy: true, + // }); + + // geolocation.getCurrentPosition((status, result) => { + // if (status === "complete") { + // form.material.jd = result.position.lng.toFixed(6); + // form.material.wd = result.position.lat.toFixed(6); + // loadingToast.close(); + // } else { + // loadingToast.close(); + // showToast("定位失败 请检查网络情况后重试"); + // console.log("result", result); + // } + // }); + // }); }; watch( diff --git a/packages/mobile/vite.config.js b/packages/mobile/vite.config.js index 3043b4f..6017874 100644 --- a/packages/mobile/vite.config.js +++ b/packages/mobile/vite.config.js @@ -75,7 +75,12 @@ export default defineConfig(({ command, mode }) => { target: 'http://8.137.54.85:8661/', changeOrigin: true, }, - } + '/v3':{ + target: 'https://restapi.amap.com/', + changeOrigin: true, + rewrite: (path) => path.replace(/^\/v3/, '/v3') // 显式声明路径 + } + }, }, build: { outDir: 'dist', diff --git a/packages/screen/src/views/EquipmentManagement/index.js b/packages/screen/src/views/EquipmentManagement/index.js index 197895a..69a5cb5 100644 --- a/packages/screen/src/views/EquipmentManagement/index.js +++ b/packages/screen/src/views/EquipmentManagement/index.js @@ -185,6 +185,7 @@ const getyhzsbList = async (qxmc, yhzid, filterData) => { sbzt: filterData?.sbzt || '', pageNum: pagination.current, pageSize: pagination.pageSize, + requestSource: 'web', // web: Web端请求,app:移动端请求 } const res = await request({ url: '/snow-ops-platform/yjsb/list', @@ -247,6 +248,10 @@ const columns = [ prop: 'qxmc', label: '所属区县', }, + { + prop: 'yhzmc', + label: '所属服务站', + }, { label: '上传时间', width: 160, diff --git a/packages/screen/src/views/MaterialManagement/index.js b/packages/screen/src/views/MaterialManagement/index.js index edeeeaa..143cd84 100644 --- a/packages/screen/src/views/MaterialManagement/index.js +++ b/packages/screen/src/views/MaterialManagement/index.js @@ -200,6 +200,7 @@ const getyhzwzList = async (qxmc, yhzid, filterData) => { wzmc: filterData?.wzmc || '', pageNum: pagination.current, pageSize: pagination.pageSize, + requestSource: 'web', // web: Web端请求,app:移动端请求 } const res = await request({ url: '/snow-ops-platform/yjwz/list', diff --git a/packages/screen/src/views/SnowEventManagement/index.js b/packages/screen/src/views/SnowEventManagement/index.js index 94b1c4d..d23ff7f 100644 --- a/packages/screen/src/views/SnowEventManagement/index.js +++ b/packages/screen/src/views/SnowEventManagement/index.js @@ -174,7 +174,7 @@ const formatDate = (date) => { const getyhzeventList = async (qxmc, yhzid, filterData) => { try { const data = { - qxmc: qxmc, + district: qxmc, serviceStationId: yhzid, routeNo: filterData?.routeNo || '', stakeNo: filterData?.stakeNo || '', diff --git a/packages/shared/utils/request.js b/packages/shared/utils/request.js index c857a76..a0672a2 100644 --- a/packages/shared/utils/request.js +++ b/packages/shared/utils/request.js @@ -17,16 +17,16 @@ service.interceptors.request.use(config => { }); export async function request(config) { - try { - const res = await service(config) - if (res === null || res === undefined) { - return res - } - if (Object.prototype.hasOwnProperty.call(res, 'data')) { - return res.data - } - } catch (error) { - console.log(error) - return null + try { + const res = await service(config) + if (config.isThirdPartyAPI) { // 添加第三方API标识 + return res // 直接返回完整响应 } + if (Object.prototype.hasOwnProperty.call(res, 'data')) { + return res.data + } + } catch (error) { + console.log(error) + return null + } } \ No newline at end of file