Browse Source

路口信号灯箭头颜色取反规则与测试参数调整

  - IntersectionMap和IntersectionMapVideos组件中dyeArm方法新增箭头颜色取反逻辑:灯带绿色时箭头红色,灯带红色时箭头绿色
  - mock/api.js中所有fixedNsGreen默认值改为false,测试环境默认南北红灯(箭头绿)、东西绿灯(箭头红)
画安 3 weeks ago
parent
commit
e2a4a452f8

+ 3 - 2
src/components/ui/IntersectionMap.vue

@@ -242,10 +242,11 @@ export default {
 
       const dyeArm = (armNode, color) => {
         armNode.lightGroup.getChildren().forEach(r => r.fill(color));
+        const arrowColor = (color === this.C.SIGNAL_GREEN) ? this.C.SIGNAL_RED : this.C.SIGNAL_GREEN;
         Object.values(armNode.arrowNodes).forEach(arr => {
           if (arr) {
-            arr.findOne('.colorFill').fill(color);
-            arr.findOne('.colorStroke').stroke(color);
+            arr.findOne('.colorFill').fill(arrowColor);
+            arr.findOne('.colorStroke').stroke(arrowColor);
           }
         });
       };

+ 3 - 2
src/components/ui/IntersectionMapVideos.vue

@@ -312,10 +312,11 @@ export default {
 
       const dyeArm = (armNode, color) => {
         armNode.lightGroup.getChildren().forEach(r => r.fill(color));
+        const arrowColor = (color === this.C.SIGNAL_GREEN) ? this.C.SIGNAL_RED : this.C.SIGNAL_GREEN;
         Object.values(armNode.arrowNodes).forEach(arr => {
           if (arr) {
-            arr.findOne('.colorFill').fill(color);
-            arr.findOne('.colorStroke').stroke(color);
+            arr.findOne('.colorFill').fill(arrowColor);
+            arr.findOne('.colorStroke').stroke(arrowColor);
           }
         });
       };

+ 5 - 5
src/mock/api.js

@@ -105,7 +105,7 @@ function _camerasToArmTypes(cameras) {
 
 function _makeIntersectionConfig(id, name, { fixedNsGreen } = {}) {
   const phases = ['南北直行', '东西直行', '北单放', '东单放']
-  const nsGreen = fixedNsGreen !== undefined ? fixedNsGreen : true
+  const nsGreen = fixedNsGreen !== undefined ? fixedNsGreen : false
   const countdown = 10 + Math.floor(Math.random() * 50)
   const seed = id ? Array.from(id).reduce((s, c, i) => s + c.charCodeAt(0) * (i + 1), 0) : 0
 
@@ -324,7 +324,7 @@ export async function apiGetIntersectionData(id, { fixedNsGreen } = {}) {
   const nowSec = Math.floor(Date.now() / 1000)
   const cycle = 140
   const elapsed = nowSec % cycle
-  const nsGreenVal = fixedNsGreen !== undefined ? fixedNsGreen : true
+  const nsGreenVal = fixedNsGreen !== undefined ? fixedNsGreen : false
   const nsGreen = nsGreenVal
 
   const config = base ? {
@@ -742,7 +742,7 @@ export async function apiGetSpecialTaskMonitorData(id, { fixedNsGreen } = {}) {
     const jncSeed = Array.from(jnc.id).reduce((s, c, idx) => s + c.charCodeAt(0) * (idx + 1), 0)
     const cycle = [100, 120, 130, 140, 150][jncSeed % 5]
     const elapsed = nowSec % cycle
-    const nsGreen = fixedNsGreen !== undefined ? fixedNsGreen : true
+    const nsGreen = fixedNsGreen !== undefined ? fixedNsGreen : false
     const countdown = Math.max(1, cycle - elapsed)
     const laneSet = lanePresets[jncSeed % lanePresets.length]
 
@@ -786,7 +786,7 @@ export async function apiGetSpecialTaskMonitorData(id, { fixedNsGreen } = {}) {
 export async function apiGetCrossingPanelData(id) {
   await delay(300)
   const point = DB.points.find(p => p.id === id)
-  const config = DB.intersectionConfigs[id] || _makeIntersectionConfig(id, null, { fixedNsGreen: true })
+  const config = DB.intersectionConfigs[id] || _makeIntersectionConfig(id, null, { fixedNsGreen: false })
   const seed = id ? id.charCodeAt(id.length - 1) : 0
 
   const preset = DB.signalTimings[id]
@@ -813,7 +813,7 @@ export async function apiGetCrossingPanelData(id) {
 export async function apiGetCrossingDetailData(id) {
   await delay(350)
   const point = DB.points.find(p => p.id === id)
-  const config = DB.intersectionConfigs[id] || _makeIntersectionConfig(id, null, { fixedNsGreen: true })
+  const config = DB.intersectionConfigs[id] || _makeIntersectionConfig(id, null, { fixedNsGreen: false })
 
   // 用 id 的全部字符生成稳定 seed(加权位置避免 charCode 总和碰撞)
   const seed = id ? Array.from(id).reduce((s, c, i) => s + c.charCodeAt(0) * (i + 1), 0) : 0