完成:公众号超出围栏的提醒功能
This commit is contained in:
@@ -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));
|
||||||
|
}
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ const Location = () => {
|
|||||||
|
|
||||||
// 通用的坐标字符串转数组函数
|
// 通用的坐标字符串转数组函数
|
||||||
const parseCoordinateString = (coordStr: string) => {
|
const parseCoordinateString = (coordStr: string) => {
|
||||||
if (!coordStr) return { points: [] };
|
if (!coordStr) return {points: []};
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// 分割坐标点
|
// 分割坐标点
|
||||||
@@ -42,10 +42,10 @@ const Location = () => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
return { points };
|
return {points};
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('解析坐标字符串失败:', error);
|
console.error('解析坐标字符串失败:', error);
|
||||||
return { points: [] };
|
return {points: []};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -65,7 +65,7 @@ const Location = () => {
|
|||||||
const coordStr = data.fence.points || '';
|
const coordStr = data.fence.points || '';
|
||||||
|
|
||||||
// 使用通用函数解析坐标字符串
|
// 使用通用函数解析坐标字符串
|
||||||
const { points } = parseCoordinateString(coordStr);
|
const {points} = parseCoordinateString(coordStr);
|
||||||
console.log('解析结果 - 多边形点:', points);
|
console.log('解析结果 - 多边形点:', points);
|
||||||
setPoints(points);
|
setPoints(points);
|
||||||
setShowCircles(true)
|
setShowCircles(true)
|
||||||
@@ -85,11 +85,47 @@ const Location = () => {
|
|||||||
const coordStr = data.fence.points || '';
|
const coordStr = data.fence.points || '';
|
||||||
|
|
||||||
// 使用通用函数解析坐标字符串
|
// 使用通用函数解析坐标字符串
|
||||||
const { points } = parseCoordinateString(coordStr);
|
const {points} = parseCoordinateString(coordStr);
|
||||||
console.log('解析结果 - 多边形点:', points);
|
console.log('解析结果 - 多边形点:', points);
|
||||||
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)
|
||||||
|
// })
|
||||||
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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(() => {
|
||||||
|
|||||||
Reference in New Issue
Block a user