Просмотр исходного кода

fix(frontend): 修复打卡页 @select 原生事件失效(餐次选择/图片语音上传无响应)

- TagChip 内部根节点 @select->@click,恢复 $emit('select'),修复所有页面餐次/运动类型/强度芯片点击
- diet-checkin/exercise-checkin/diet-index/exercise-index 原生 view/text 的 @select->@click(提交、拍照、录音、删除、返回等)
- 修正模板 getItemKey->getPhotoKey 与 methods 不一致
- article-detail 听文章按钮移至右下角(本会话UI调整)
zxyj-web 2 недель назад
Родитель
Сommit
d36fb5828b

+ 1 - 1
cfc-frontend/components/TagChip.vue

@@ -2,7 +2,7 @@
   <view
     class="tag-chip"
     :class="['tag-chip--' + variant, { 'is-active': active }]"
-    @select="onTap"
+    @click="onTap"
   >
     <text class="tag-chip__label">{{ label }}</text>
   </view>

+ 5 - 5
cfc-frontend/pages/article-center/article-detail.vue

@@ -48,16 +48,16 @@
         <view style="height: 200rpx;"></view>
       </scroll-view>
 
-      <!-- 底部 -->
+      <!-- 底部(听文章在右下角、生成海报在左下角) -->
       <view class="detail-footer">
-        <view v-if="isLogin" class="listen-btn" :class="{ playing: audioPlaying }" @click="toggleArticleAudio">
-          <text class="listen-btn-icon">{{ audioLoading ? '⏳' : (audioPlaying ? '⏸' : '🔊') }}</text>
-          <text class="listen-btn-text">{{ audioLoading ? '生成中' : (audioPlaying ? '停止' : '听文章') }}</text>
-        </view>
         <view class="share-btn" @click="generatePoster">
           <text class="share-btn-icon">🖼</text>
           <text class="share-btn-text">生成海报</text>
         </view>
+        <view v-if="isLogin" class="listen-btn" :class="{ playing: audioPlaying }" @click="toggleArticleAudio">
+          <text class="listen-btn-icon">{{ audioLoading ? '⏳' : (audioPlaying ? '⏸' : '🔊') }}</text>
+          <text class="listen-btn-text">{{ audioLoading ? '生成中' : (audioPlaying ? '停止' : '听文章') }}</text>
+        </view>
       </view>
     </template>
 

+ 12 - 12
cfc-frontend/pages/growth/diet-checkin.vue

@@ -2,7 +2,7 @@
   <view class="page" :style="{ '--font-scale': fontScale }">
     <!-- 顶部导航栏 -->
     <view class="nav-bar">
-      <view class="nav-left" @select="goBack">
+      <view class="nav-left" @click="goBack">
         <text class="nav-icon">‹</text>
         <text class="nav-title">{{ todayText }}</text>
       </view>
@@ -56,13 +56,13 @@
         </view>
         <view class="card-body">
           <view class="media-toolbar">
-            <view class="tool-btn" @select="choosePhoto">
+            <view class="tool-btn" @click="choosePhoto">
               <text class="tool-icon">📷</text>
               <text class="tool-label">照片</text>
               <text class="tool-count" v-if="form.photos.length > 0">{{ form.photos.length }}/9</text>
             </view>
             <view class="tool-divider"></view>
-            <view class="tool-btn" @select="toggleRecord">
+            <view class="tool-btn" @click="toggleRecord">
               <text class="tool-icon">🎙</text>
               <text class="tool-label">{{ isRecording ? '录音中…' : (form.voicePath ? '已录制' : '录音') }}</text>
               <text class="tool-count" v-if="isRecording">{{ recordSeconds }}s</text>
@@ -70,7 +70,7 @@
           </view>
           <!-- 照片缩略图 -->
           <view class="photo-strip" v-if="form.photos.length > 0">
-            <view class="photo-item" v-for="(img, idx) in form.photos" :key="getItemKey(img, idx)" @select="removePhoto(idx)">
+            <view class="photo-item" v-for="(img, idx) in form.photos" :key="getPhotoKey(img, idx)" @click="removePhoto(idx)">
               <image :src="img" mode="aspectFill" class="photo-img" lazy-load />
               <view class="photo-delete-overlay">
                 <text class="delete-icon">×</text>
@@ -84,8 +84,8 @@
               <view class="wave-bar" v-for="n in 7" :key="n" :style="{animationDelay: (n * 0.1) + 's'}"></view>
             </view>
             <view class="voice-controls">
-              <view class="mini-btn cancel-mini" @select="cancelRecord"><text>取消</text></view>
-              <view class="mini-btn done-mini" @select="finishRecord"><text>完成</text></view>
+              <view class="mini-btn cancel-mini" @click="cancelRecord"><text>取消</text></view>
+              <view class="mini-btn done-mini" @click="finishRecord"><text>完成</text></view>
             </view>
           </view>
           <view class="voice-strip" v-else-if="form.voicePath">
@@ -93,14 +93,14 @@
               <text class="play-icon">▶</text>
               <text class="voice-duration">{{ recordDurationText }}</text>
             </view>
-            <view class="delete-voice" @select="deleteVoice"><text>×</text></view>
+            <view class="delete-voice" @click="deleteVoice"><text>×</text></view>
           </view>
         </view>
       </view>
 
       <!-- 提交按钮 -->
       <view class="submit-wrap">
-        <view class="submit-btn" :class="{ 'submitting': submitting }" @select="doCheckin">
+        <view class="submit-btn" :class="{ 'submitting': submitting }" @click="doCheckin">
           <text>{{ submitting ? '提交中...' : '✓ 完成打卡' }}</text>
         </view>
       </view>
@@ -131,7 +131,7 @@
     </scroll-view>
 
     <!-- 图片识别结果确认弹窗 -->
-    <view class="recognize-overlay" v-if="showRecognizeModal" @select="cancelRecognize">
+    <view class="recognize-overlay" v-if="showRecognizeModal" @click="cancelRecognize">
       <view class="recognize-modal" @tap.stop>
         <view class="recognize-header">
           <text class="recognize-title">🍽️ 识别结果</text>
@@ -141,15 +141,15 @@
           <view class="food-chip" v-for="(f, idx) in recognizedFoods" :key="getFoodsKey(f, idx)">
             <text class="food-chip-name">{{ f.name }}</text>
             <text class="food-chip-cat" v-if="f.category && f.category !== 'unknown'">{{ f.category }}</text>
-            <text class="food-chip-del" @select="removeRecognizedFood(idx)">×</text>
+            <text class="food-chip-del" @click="removeRecognizedFood(idx)">×</text>
           </view>
           <view class="recognize-hint">
             <text>可手动删除不需要的食材,确认后自动填入食物清单</text>
           </view>
         </view>
         <view class="recognize-footer">
-          <view class="btn-cancel" @select="cancelRecognize"><text>取消</text></view>
-          <view class="btn-confirm" @select="confirmRecognize"><text>✓ 确认填入</text></view>
+          <view class="btn-cancel" @click="cancelRecognize"><text>取消</text></view>
+          <view class="btn-confirm" @click="confirmRecognize"><text>✓ 确认填入</text></view>
         </view>
       </view>
     </view>

+ 9 - 9
cfc-frontend/pages/growth/exercise-checkin.vue

@@ -2,7 +2,7 @@
   <view class="page" :style="{ '--font-scale': fontScale }">
     <!-- 顶部导航栏 -->
     <view class="nav-bar">
-      <view class="nav-left" @select="goBack">
+      <view class="nav-left" @click="goBack">
         <text class="nav-icon">‹</text>
         <text class="nav-title">{{ todayText }}</text>
       </view>
@@ -51,7 +51,7 @@
             <text class="form-label">微信步数(选填)</text>
             <view class="step-sync-row">
               <input class="form-input step-input" type="number" v-model="form.stepCount" placeholder="手动填写步数" />
-              <view class="sync-btn" :class="{'syncing': syncingSteps}" @select="syncWechatSteps">
+              <view class="sync-btn" :class="{'syncing': syncingSteps}" @click="syncWechatSteps">
                 <text>{{ syncingSteps ? '同步中…' : '同步微信步数' }}</text>
               </view>
             </view>
@@ -72,13 +72,13 @@
         </view>
         <view class="card-body">
           <view class="media-toolbar">
-            <view class="tool-btn" @select="choosePhoto">
+            <view class="tool-btn" @click="choosePhoto">
               <text class="tool-icon">📷</text>
               <text class="tool-label">照片</text>
               <text class="tool-count" v-if="form.photos.length > 0">{{ form.photos.length }}/9</text>
             </view>
             <view class="tool-divider"></view>
-            <view class="tool-btn" @select="toggleRecord">
+            <view class="tool-btn" @click="toggleRecord">
               <text class="tool-icon">🎙</text>
               <text class="tool-label">{{ isRecording ? '录音中…' : (form.voicePath ? '已录制' : '录音') }}</text>
               <text class="tool-count" v-if="isRecording">{{ recordSeconds }}s</text>
@@ -86,7 +86,7 @@
           </view>
           <!-- 照片缩略图 -->
           <view class="photo-strip" v-if="form.photos.length > 0">
-            <view class="photo-item" v-for="(img, idx) in form.photos" :key="getItemKey(img, idx)" @select="removePhoto(idx)">
+            <view class="photo-item" v-for="(img, idx) in form.photos" :key="getPhotoKey(img, idx)" @click="removePhoto(idx)">
               <image :src="img" mode="aspectFill" class="photo-img" lazy-load />
               <view class="photo-delete-overlay">
                 <text class="delete-icon">×</text>
@@ -100,8 +100,8 @@
               <view class="wave-bar" v-for="n in 7" :key="n" :style="{animationDelay: (n * 0.1) + 's'}"></view>
             </view>
             <view class="voice-controls">
-              <view class="mini-btn cancel-mini" @select="cancelRecord"><text>取消</text></view>
-              <view class="mini-btn done-mini" @select="finishRecord"><text>完成</text></view>
+              <view class="mini-btn cancel-mini" @click="cancelRecord"><text>取消</text></view>
+              <view class="mini-btn done-mini" @click="finishRecord"><text>完成</text></view>
             </view>
           </view>
           <view class="voice-strip" v-else-if="form.voicePath">
@@ -109,14 +109,14 @@
               <text class="play-icon">▶</text>
               <text class="voice-duration">{{ recordDurationText }}</text>
             </view>
-            <view class="delete-voice" @select="deleteVoice"><text>×</text></view>
+            <view class="delete-voice" @click="deleteVoice"><text>×</text></view>
           </view>
         </view>
       </view>
 
       <!-- 提交按钮 -->
       <view class="submit-wrap">
-        <view class="submit-btn" :class="{ 'submitting': submitting }" @select="doCheckin">
+        <view class="submit-btn" :class="{ 'submitting': submitting }" @click="doCheckin">
           <text>{{ submitting ? '提交中...' : '✓ 完成打卡' }}</text>
         </view>
       </view>

+ 1 - 1
cfc-frontend/pages/health/diet-index.vue

@@ -96,7 +96,7 @@
             <text class="form-label">备注(选填)</text>
             <input class="form-input" v-model="form.remark" placeholder="记录饮食感受..." />
           </view>
-          <view class="submit-btn" @select="doCheckin">
+          <view class="submit-btn" @click="doCheckin">
             <text>{{ submitting ? '提交中...' : '提交打卡' }}</text>
           </view>
         </view>

+ 1 - 1
cfc-frontend/pages/health/exercise-index.vue

@@ -96,7 +96,7 @@
             <text class="form-label">备注(选填)</text>
             <input class="form-input" v-model="form.remark" placeholder="记录运动感受..." />
           </view>
-          <view class="submit-btn" @select="doCheckin">
+          <view class="submit-btn" @click="doCheckin">
             <text>{{ submitting ? '提交中...' : '提交打卡' }}</text>
           </view>
         </view>