Browse Source

修改大椎穴展示规则

jiapu 3 months ago
parent
commit
fed1b6c03a
1 changed files with 18 additions and 6 deletions
  1. 18 6
      code/frontend/src/views/simulation/index.vue

+ 18 - 6
code/frontend/src/views/simulation/index.vue

@@ -339,8 +339,8 @@
               </text>
               <text :x="SVG_C7_X + 28" :y="currentSpineEndY + 6" font-size="10" fill="#0369a1" font-family="system-ui, sans-serif">脊柱终点</text>
 
-              <!-- C7 大椎穴常驻标记:方案中包含大椎穴时,由步骤序号标记覆盖 -->
-              <g v-if="!hasDazhuiMarker" :transform="`translate(${SVG_C7_X}, ${SVG_C7_Y})`">
+              <!-- C7 大椎穴常驻标记 -->
+              <g :transform="`translate(${SVG_C7_X}, ${SVG_C7_Y})`">
                 <circle r="14" fill="none" stroke="#e85d5d" stroke-width="1" opacity="0.3">
                   <animate attributeName="r" values="8;16;8" dur="2.5s" repeatCount="indefinite" />
                   <animate attributeName="opacity" values="0.5;0;0.5" dur="2.5s" repeatCount="indefinite" />
@@ -351,6 +351,12 @@
                 <line x1="0" y1="-11" x2="0" y2="-5" stroke="#e85d5d" stroke-width="1.8" stroke-linecap="round" />
                 <line x1="0" y1="5" x2="0" y2="11" stroke="#e85d5d" stroke-width="1.8" stroke-linecap="round" />
                 <text x="16" y="4" font-size="11" fill="#c24141" font-weight="700" font-family="system-ui, sans-serif">C7 大椎穴</text>
+                <g v-if="dazhuiMarker">
+                  <circle r="9" :fill="dazhuiMarker.color" stroke="#fff" stroke-width="2" />
+                  <text y="3" text-anchor="middle" font-size="8" font-weight="800" fill="#fff" font-family="system-ui, sans-serif" style="pointer-events:none">
+                    {{ dazhuiMarker.num }}
+                  </text>
+                </g>
               </g>
 
               <text x="208" y="24" font-size="10" fill="#94a3b8" font-family="system-ui, sans-serif">&uarr; 头侧</text>
@@ -359,7 +365,7 @@
               <text x="386" text-anchor="end" :y="SVG_C7_Y - 8" font-size="10" fill="#94a3b8" font-family="system-ui, sans-serif">右 (+X)</text>
 
               <!-- 穴位标记 -->
-              <g v-for="(m, idx) in markers" :key="idx">
+              <g v-for="(m, idx) in visualMarkers" :key="idx">
                 <circle :cx="m.x" :cy="m.y" r="12" :fill="m.color" opacity="0.18" />
                 <circle :cx="m.x" :cy="m.y" r="6" :fill="m.color" stroke="#fff" stroke-width="2" />
                 <text :x="m.x" :y="m.y + 4" text-anchor="middle" font-size="8" font-weight="800" fill="#fff" font-family="system-ui, sans-serif" style="pointer-events:none">
@@ -368,7 +374,7 @@
                 <!-- 步骤连接线 -->
                 <line
                   v-if="idx > 0"
-                  :x1="markers[idx-1].x" :y1="markers[idx-1].y"
+                  :x1="visualMarkers[idx-1].x" :y1="visualMarkers[idx-1].y"
                   :x2="m.x" :y2="m.y"
                   stroke="rgba(16,185,129,0.25)" stroke-width="1.5" stroke-dasharray="4 4"
                 />
@@ -566,8 +572,12 @@ function bodyToSvgY(offsetYmm) {
   return SVG_C7_Y + Number(offsetYmm) * visualScale
 }
 
+function isDazhuiName(name) {
+  return String(name || '').includes('大椎')
+}
+
 function isDazhuiStep(step) {
-  return String(step?.acupointName || '').includes('大椎')
+  return isDazhuiName(step?.acupointName)
 }
 
 function isBackVisualStep(step) {
@@ -612,7 +622,9 @@ const markers = computed(() => {
     })
 })
 
-const hasDazhuiMarker = computed(() => markers.value.some((m) => String(m.name || '').includes('大椎')))
+const dazhuiMarker = computed(() => markers.value.find((m) => isDazhuiName(m.name)) || null)
+
+const visualMarkers = computed(() => markers.value.filter((m) => !isDazhuiName(m.name)))
 
 const unmappedSteps = computed(() => {
   const steps = pushData.value?.scheme?.steps || []