From 942143c6783979d9ca586ea1d75ec8f40511b693 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E5=BF=A0=E6=9E=97?= <170083662@qq.com> Date: Mon, 16 Jun 2025 01:49:22 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E6=88=90=EF=BC=9A=E5=85=AC=E4=BC=97?= =?UTF-8?q?=E5=8F=B7=E8=B6=85=E5=87=BA=E5=9B=B4=E6=A0=8F=E7=9A=84=E6=8F=90?= =?UTF-8?q?=E9=86=92=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/hjm/hjmCar/index.ts | 11 +++++++++ src/hjm/location.tsx | 46 +++++++++++++++++++++++++++++++++---- src/hjm/query.tsx | 14 +++++++++++ 3 files changed, 66 insertions(+), 5 deletions(-) diff --git a/src/api/hjm/hjmCar/index.ts b/src/api/hjm/hjmCar/index.ts index 704ea96..afd9d81 100644 --- a/src/api/hjm/hjmCar/index.ts +++ b/src/api/hjm/hjmCar/index.ts @@ -126,3 +126,14 @@ export async function pageByQQMap(params: HjmCarParam) { } return Promise.reject(new Error(res.message)); } + +export async function pushSubscriptionMessages(data: any) { + const res = await request.post>( + '/hjm/wx-subscription/send-template', + data + ); + if (res.code === 0) { + return res.message; + } + return Promise.reject(new Error(res.message)); +} diff --git a/src/hjm/location.tsx b/src/hjm/location.tsx index 7b62418..c32e29f 100644 --- a/src/hjm/location.tsx +++ b/src/hjm/location.tsx @@ -27,7 +27,7 @@ const Location = () => { // 通用的坐标字符串转数组函数 const parseCoordinateString = (coordStr: string) => { - if (!coordStr) return { points: [] }; + if (!coordStr) return {points: []}; try { // 分割坐标点 @@ -42,10 +42,10 @@ const Location = () => { } }); - return { points }; + return {points}; } catch (error) { console.error('解析坐标字符串失败:', error); - return { points: [] }; + return {points: []}; } } @@ -65,7 +65,7 @@ const Location = () => { const coordStr = data.fence.points || ''; // 使用通用函数解析坐标字符串 - const { points } = parseCoordinateString(coordStr); + const {points} = parseCoordinateString(coordStr); console.log('解析结果 - 多边形点:', points); setPoints(points); setShowCircles(true) @@ -85,11 +85,47 @@ const Location = () => { const coordStr = data.fence.points || ''; // 使用通用函数解析坐标字符串 - const { points } = parseCoordinateString(coordStr); + const {points} = parseCoordinateString(coordStr); console.log('解析结果 - 多边形点:', points); setPoints(points); setShowCircles(true) } + + // pushSubscriptionMessages({ + // toUser: 'ozH7Z7VioC3_-5m_z0DfD9Rd7kM4', + // templateId: 'oMckHaNgNT-ivInYF5DtCcqyd9O-i1hP_G0jQALsx54', + // url: '/pages/index/index', + // miniprogramState: 'trial', + // data: { + // phrase6: { + // value: data?.driver ?? '未知', + // color: '#333' + // }, + // time4: { + // value: data?.createTime ?? '未知', + // color: '#333' + // }, + // phrase7: { + // value: '离开围栏', + // color: '#333' + // }, + // thing11: { + // value: data?.fenceName ?? '未知', + // color: '#333' + // }, + // car_number12: { + // value: data.code, + // color: '#333' + // } + // } + // }) + // .then(res => { + // console.log('订阅消息发送成功', res) + // }) + // .catch(err => { + // console.error('订阅消息发送失败', err) + // }) + }) } } diff --git a/src/hjm/query.tsx b/src/hjm/query.tsx index c9cda8d..d078728 100644 --- a/src/hjm/query.tsx +++ b/src/hjm/query.tsx @@ -103,6 +103,20 @@ const Query = () => { // 提交表单 const submitSucceed = (values: any) => { console.log(values) + if(FormData.image == '[]' || !FormData.image){ + Taro.showToast({ + title: '请上传车辆图片', + icon: 'error' + }); + return false + } + if(!FormData.gpsNo){ + Taro.showToast({ + title: '请绑定GPS', + icon: 'error' + }); + return false + } updateHjmCar({...FormData, status: 1, driverId: adminId}).then(() => { Taro.showToast({title: `绑定成功`, icon: 'success'}) setTimeout(() => {