Преглед изворни кода

修改大椎穴展示规则

jiapu пре 3 месеци
родитељ
комит
b7ac89683c
1 измењених фајлова са 16 додато и 6 уклоњено
  1. 16 6
      code/frontend/src/views/simulation/index.vue

+ 16 - 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 :transform="`translate(${SVG_C7_X}, ${SVG_C7_Y})`">
+              <!-- C7 大椎穴常驻标记:方案中包含大椎穴时,由步骤序号标记覆盖 -->
+              <g v-if="!hasDazhuiMarker" :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" />
@@ -566,10 +566,15 @@ function bodyToSvgY(offsetYmm) {
   return SVG_C7_Y + Number(offsetYmm) * visualScale
 }
 
+function isDazhuiStep(step) {
+  return String(step?.acupointName || '').includes('大椎')
+}
+
 function isBackVisualStep(step) {
+  if (isDazhuiStep(step)) return true
   if (step.offsetX == null || step.offsetY == null) return false
   if (FRONT_ACUPOINT_NAMES.has(step.acupointName)) return false
-  const isZeroFallback = Number(step.offsetX) === 0 && Number(step.offsetY) === 0 && step.acupointName !== '大椎穴'
+  const isZeroFallback = Number(step.offsetX) === 0 && Number(step.offsetY) === 0
   return !isZeroFallback
 }
 
@@ -578,7 +583,10 @@ const markers = computed(() => {
   return steps
     .filter(isBackVisualStep)
     .map((s, idx) => {
-      const { x, y } = bodyToSvg(s.offsetX, s.offsetY)
+      const isDazhui = isDazhuiStep(s)
+      const offsetX = isDazhui && s.offsetX == null ? 0 : s.offsetX
+      const offsetY = isDazhui && s.offsetY == null ? 0 : s.offsetY
+      const { x, y } = bodyToSvg(offsetX, offsetY)
       const techniqueColors = {
         '温和灸': '#10b981',
         '雀啄灸': '#f59e0b',
@@ -595,8 +603,8 @@ const markers = computed(() => {
         side: s.acupointSide,
         labelX: onRight ? x - 14 : x + 14,
         anchor: onRight ? 'end' : 'start',
-        rawOffsetX: s.offsetX,
-        rawOffsetY: s.offsetY,
+        rawOffsetX: offsetX,
+        rawOffsetY: offsetY,
         technique: s.techniqueName,
         temp: s.temperature,
         mins: s.duration || 0,
@@ -604,6 +612,8 @@ const markers = computed(() => {
     })
 })
 
+const hasDazhuiMarker = computed(() => markers.value.some((m) => String(m.name || '').includes('大椎')))
+
 const unmappedSteps = computed(() => {
   const steps = pushData.value?.scheme?.steps || []
   return steps.filter((s) => !isBackVisualStep(s))