Browse Source

feat: 导航时指路机展示内容匹配后台目标管理的配置

ShangHai_LongXiang
jiannibang 2 years ago
parent
commit
856c936e69
  1. 18
      src/composables/useShockman.js

18
src/composables/useShockman.js

@ -7,6 +7,7 @@ import MD5 from 'crypto-js/md5'
const useShockmanStore = defineStore('shockman', { const useShockmanStore = defineStore('shockman', {
state: () => ({ state: () => ({
list: [], list: [],
endMap: {},
intervalTimer: 0, intervalTimer: 0,
playTimer: 0, playTimer: 0,
index: 0 index: 0
@ -15,6 +16,9 @@ const useShockmanStore = defineStore('shockman', {
SET_LIST(list) { SET_LIST(list) {
this.list = list this.list = list
}, },
SET_END_MAP(endMap) {
this.endMap = endMap
},
SET_INTERVAL_TIMER(intervalTimer) { SET_INTERVAL_TIMER(intervalTimer) {
this.intervalTimer = intervalTimer this.intervalTimer = intervalTimer
}, },
@ -96,8 +100,9 @@ export const useShockman = () => {
} }
const shockmanStore = useShockmanStore() const shockmanStore = useShockmanStore()
const { list, index } = storeToRefs(shockmanStore) const { list, index } = storeToRefs(shockmanStore)
window.Map_QM.getObjectAngle &&
shockmanStore.SET_LIST(window.Map_QM.getObjectAngle(device.value.targetInfoList.filter(({ status }) => status === 1)).filter(({ cost }) => cost))
const { targetInfoList } = device.value
shockmanStore.SET_END_MAP(targetInfoList.reduce((acc, nxt) => ({ ...acc, [nxt.name]: nxt }), {}))
window.Map_QM.getObjectAngle && shockmanStore.SET_LIST(window.Map_QM.getObjectAngle(targetInfoList.filter(({ status }) => status === 1)).filter(({ cost }) => cost))
shockmanStore.SET_INTERVAL_TIMER(getIntervalTimer()) shockmanStore.SET_INTERVAL_TIMER(getIntervalTimer())
if (list.value.length) { if (list.value.length) {
@ -113,7 +118,7 @@ export const playShockmanByNav = ({ progText1, progDist, progAngel }) => {
return return
} }
const shockmanStore = useShockmanStore() const shockmanStore = useShockmanStore()
const { intervalTimer, playTimer } = storeToRefs(shockmanStore)
const { intervalTimer, playTimer, endMap } = storeToRefs(shockmanStore)
if (intervalTimer.value) { if (intervalTimer.value) {
clearInterval(intervalTimer.value) clearInterval(intervalTimer.value)
shockmanStore.SET_INTERVAL_TIMER(0) shockmanStore.SET_INTERVAL_TIMER(0)
@ -126,7 +131,12 @@ export const playShockmanByNav = ({ progText1, progDist, progAngel }) => {
shockmanStore.SET_INTERVAL_TIMER(getIntervalTimer()) shockmanStore.SET_INTERVAL_TIMER(getIntervalTimer())
}, 60000) }, 60000)
) )
sendMsg2Shockman({ progMode: '1', progText1, progText2: '由此方向向前', progDist, progAngel })
const info = endMap.value[progText1]
if (info) console.log('匹配到指路机目标', info)
const progMode = info ? String(info.playWay) : '1'
const progText2 = info ? (info.playWay === 1 || info.playWay === 4 ? info.twoText : ' ') : '由此方向向前'
sendMsg2Shockman({ progMode, progText1, progText2, progDist, progAngel })
} catch (error) { } catch (error) {
console.log('指路机播放导航信息失败', error) console.log('指路机播放导航信息失败', error)
} }

Loading…
Cancel
Save