完成:公众号超出围栏的提醒功能

This commit is contained in:
2025-06-16 01:49:22 +08:00
parent 6a700e9d4b
commit 942143c678
3 changed files with 66 additions and 5 deletions

View File

@@ -126,3 +126,14 @@ export async function pageByQQMap(params: HjmCarParam) {
} }
return Promise.reject(new Error(res.message)); return Promise.reject(new Error(res.message));
} }
export async function pushSubscriptionMessages(data: any) {
const res = await request.post<ApiResult<unknown>>(
'/hjm/wx-subscription/send-template',
data
);
if (res.code === 0) {
return res.message;
}
return Promise.reject(new Error(res.message));
}

View File

@@ -90,6 +90,42 @@ const Location = () => {
setPoints(points); setPoints(points);
setShowCircles(true) 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)
// })
}) })
} }
} }

View File

@@ -103,6 +103,20 @@ const Query = () => {
// 提交表单 // 提交表单
const submitSucceed = (values: any) => { const submitSucceed = (values: any) => {
console.log(values) 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(() => { updateHjmCar({...FormData, status: 1, driverId: adminId}).then(() => {
Taro.showToast({title: `绑定成功`, icon: 'success'}) Taro.showToast({title: `绑定成功`, icon: 'success'})
setTimeout(() => { setTimeout(() => {