exercise-checkin.vue 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582
  1. <template>
  2. <view class="page" :style="{ '--font-scale': fontScale }">
  3. <!-- 顶部导航栏 -->
  4. <view class="nav-bar">
  5. <view class="nav-left" @click="goBack">
  6. <text class="nav-icon">‹</text>
  7. <text class="nav-title">{{ todayText }}</text>
  8. </view>
  9. </view>
  10. <scroll-view class="content" scroll-y>
  11. <!-- 运动类型 -->
  12. <view class="card">
  13. <view class="card-header">
  14. <text class="card-icon">🏃</text>
  15. <text class="card-title">运动类型</text>
  16. </view>
  17. <view class="card-body">
  18. <view class="tag-row">
  19. <TagChip v-for="t in exerciseTypes" :key="t.value" :label="t.label"
  20. :active="form.exerciseType === t.value"
  21. @select="form.exerciseType = t.value" />
  22. </view>
  23. </view>
  24. </view>
  25. <!-- 时长 & 强度 & 卡路里 -->
  26. <view class="card">
  27. <view class="card-header">
  28. <text class="card-icon">⏱️</text>
  29. <text class="card-title">运动详情</text>
  30. </view>
  31. <view class="card-body">
  32. <view class="form-group">
  33. <text class="form-label">时长(分钟)*</text>
  34. <input class="form-input" type="number" v-model="form.durationMinutes" placeholder="运动了多久?" />
  35. </view>
  36. <view class="form-group">
  37. <text class="form-label">强度</text>
  38. <view class="tag-row">
  39. <TagChip v-for="s in intensityOptions" :key="s.value" :label="s.label"
  40. :active="form.intensity === s.value"
  41. @select="form.intensity = s.value" />
  42. </view>
  43. </view>
  44. <view class="form-group">
  45. <text class="form-label">消耗卡路里(选填)</text>
  46. <input class="form-input" type="number" v-model="form.caloriesBurned" placeholder="估算卡路里" />
  47. </view>
  48. <view class="form-group" v-if="isSelfCheckin">
  49. <text class="form-label">微信步数(选填)</text>
  50. <view class="step-sync-row">
  51. <input class="form-input step-input" type="number" v-model="form.stepCount" placeholder="手动填写步数" />
  52. <view class="sync-btn" :class="{'syncing': syncingSteps}" @click="syncWechatSteps">
  53. <text>{{ syncingSteps ? '同步中…' : '同步微信步数' }}</text>
  54. </view>
  55. </view>
  56. <text class="step-hint" v-if="syncedStepText">{{ syncedStepText }}</text>
  57. </view>
  58. <view class="form-group">
  59. <text class="form-label">备注(选填)</text>
  60. <input class="form-input" v-model="form.remark" placeholder="运动感受..." />
  61. </view>
  62. </view>
  63. </view>
  64. <!-- 媒体工具栏 -->
  65. <view class="card">
  66. <view class="card-header">
  67. <text class="card-icon">📎</text>
  68. <text class="card-title">添加媒体</text>
  69. </view>
  70. <view class="card-body">
  71. <view class="media-toolbar">
  72. <view class="tool-btn" @click="choosePhoto">
  73. <text class="tool-icon">📷</text>
  74. <text class="tool-label">照片</text>
  75. <text class="tool-count" v-if="form.photos.length > 0">{{ form.photos.length }}/9</text>
  76. </view>
  77. <view class="tool-divider"></view>
  78. <view class="tool-btn" @click="toggleRecord">
  79. <text class="tool-icon">🎙</text>
  80. <text class="tool-label">{{ isRecording ? '录音中…' : (form.voicePath ? '已录制' : '录音') }}</text>
  81. <text class="tool-count" v-if="isRecording">{{ recordSeconds }}s</text>
  82. </view>
  83. </view>
  84. <!-- 照片缩略图 -->
  85. <view class="photo-strip" v-if="form.photos.length > 0">
  86. <view class="photo-item" v-for="(img, idx) in form.photos" :key="getPhotoKey(img, idx)" @click="removePhoto(idx)">
  87. <image :src="img" mode="aspectFill" class="photo-img" lazy-load />
  88. <view class="photo-delete-overlay">
  89. <text class="delete-icon">×</text>
  90. </view>
  91. </view>
  92. </view>
  93. <!-- 录音状态 -->
  94. <view class="voice-strip" v-if="isRecording">
  95. <view class="waveform">
  96. <view class="wave-bar" v-for="n in 7" :key="n" :style="{animationDelay: (n * 0.1) + 's'}"></view>
  97. </view>
  98. <view class="voice-controls">
  99. <view class="mini-btn cancel-mini" @click="cancelRecord"><text>取消</text></view>
  100. <view class="mini-btn done-mini" @click="finishRecord"><text>完成</text></view>
  101. </view>
  102. </view>
  103. <view class="voice-strip" v-else-if="form.voicePath">
  104. <view class="voice-player">
  105. <text class="play-icon">▶</text>
  106. <text class="voice-duration">{{ recordDurationText }}</text>
  107. </view>
  108. <view class="delete-voice" @click="deleteVoice"><text>×</text></view>
  109. </view>
  110. </view>
  111. </view>
  112. <!-- 提交按钮 -->
  113. <view class="submit-wrap">
  114. <view class="submit-btn" :class="{ 'submitting': submitting }" @click="doCheckin">
  115. <text>{{ submitting ? '提交中...' : '✓ 完成打卡' }}</text>
  116. </view>
  117. </view>
  118. <!-- 历史记录 -->
  119. <view class="card" v-if="history.length > 0">
  120. <view class="card-header">
  121. <text class="card-icon">📜</text>
  122. <text class="card-title">近期记录</text>
  123. </view>
  124. <view class="card-body">
  125. <view class="history-list">
  126. <view class="history-item" v-for="item in history" :key="item.id">
  127. <view class="history-left">
  128. <text class="history-type">{{ exerciseTypeLabel(item.exerciseType) }}</text>
  129. <text class="history-content">{{ item.durationMinutes }}分钟{{ item.caloriesBurned ? ' · ' + item.caloriesBurned + '千卡' : '' }}{{ item.stepCount ? ' · ' + item.stepCount + '步' : '' }}</text>
  130. </view>
  131. <view class="history-right">
  132. <text class="history-date">{{ formatDate(item.createdAt) }}</text>
  133. </view>
  134. </view>
  135. </view>
  136. </view>
  137. </view>
  138. <!-- 底部留白 -->
  139. <view class="bottom-spacer"></view>
  140. </scroll-view>
  141. </view>
  142. </template>
  143. <script>
  144. import config from '../../config'
  145. import { resolveCheckinMemberId } from '../../utils/memberNormalize.js'
  146. import { parseDate } from '../../utils/format.js'
  147. import { sttTranscribe } from '../../utils/api.js'
  148. import { pickImage } from '../../utils/image-picker.js'
  149. import { getPublicConfig } from '../../utils/api.js'
  150. import { DEFAULT_EXERCISE_TYPES, loadExerciseTypes, resolveExerciseTypeLabel } from '../../utils/exerciseTypes.js'
  151. import TagChip from '../../components/TagChip.vue'
  152. import fontScaleMixin from '@/mixins/font-scale.js'
  153. export default {
  154. mixins: [fontScaleMixin],
  155. components: { TagChip },
  156. data() {
  157. return {
  158. memberId: null,
  159. taskId: null,
  160. isSelfCheckin: false,
  161. submitting: false,
  162. pendingSubmit: false,
  163. syncingSteps: false,
  164. syncedStepText: '',
  165. isRecording: false,
  166. recordSeconds: 0,
  167. recordTimer: null,
  168. recorderManager: null,
  169. history: [],
  170. todayText: '',
  171. // 运动类型:首屏用统一默认(离线可用),onLoad 拉取后台配置覆盖
  172. exerciseTypes: DEFAULT_EXERCISE_TYPES.slice(),
  173. intensityOptions: [
  174. { label: '低', value: 'low' },
  175. { label: '中', value: 'medium' },
  176. { label: '高', value: 'high' }
  177. ],
  178. form: {
  179. exerciseType: '',
  180. durationMinutes: '',
  181. intensity: 'medium',
  182. caloriesBurned: '',
  183. stepCount: '',
  184. remark: '',
  185. photos: [],
  186. voicePath: '',
  187. voiceText: '',
  188. voiceDuration: 0
  189. }
  190. }
  191. },
  192. computed: {
  193. recordDurationText: function() {
  194. if (!this.form.voicePath) return ''
  195. return '录音 ' + this.recordSeconds + '秒'
  196. }
  197. },
  198. onLoad: function(options) {
  199. this.taskId = options.taskId || null
  200. this.todayText = this.getToday()
  201. this.memberId = resolveCheckinMemberId(options, {
  202. currentRole: uni.getStorageSync('currentRole') || uni.getStorageSync('role') || 'parent',
  203. currentChildId: uni.getStorageSync('currentChildId'),
  204. currentMemberId: uni.getStorageSync('currentMemberId'),
  205. userId: uni.getStorageSync('userId')
  206. })
  207. this.isSelfCheckin = uni.getStorageSync('currentView') !== 'member'
  208. this.recorderManager = uni.getRecorderManager()
  209. this.recorderManager.onStart(() => {
  210. this.isRecording = true
  211. this.recordSeconds = 0
  212. this.recordTimer = setInterval(() => { this.recordSeconds++ }, 1000)
  213. })
  214. this.recorderManager.onStop((res) => {
  215. this.isRecording = false
  216. if (this.recordTimer) { clearInterval(this.recordTimer); this.recordTimer = null }
  217. this.form.voicePath = res.tempFilePath
  218. this.form.voiceDuration = res.duration
  219. var self = this
  220. uni.showLoading({ title: '语音识别中...', mask: true })
  221. sttTranscribe(res.tempFilePath).then(function(text) {
  222. self.form.voiceText = text
  223. uni.hideLoading()
  224. // 保存时停止录音 → 语音已就绪,继续提交
  225. if (self.pendingSubmit) { self.pendingSubmit = false; self.doCheckin() }
  226. }).catch(function(err) {
  227. uni.hideLoading()
  228. console.warn('STT 转写失败:', err)
  229. if (self.pendingSubmit) { self.pendingSubmit = false; self.doCheckin() }
  230. })
  231. })
  232. this.recorderManager.onError(() => {
  233. this.isRecording = false
  234. if (this.recordTimer) { clearInterval(this.recordTimer); this.recordTimer = null }
  235. uni.showToast({ title: '录音失败', icon: 'none' })
  236. })
  237. this.loadHistory()
  238. this.loadExerciseTypes()
  239. },
  240. onUnload: function() {
  241. if (this.recordTimer) clearInterval(this.recordTimer)
  242. },
  243. methods: {
  244. getToday: function() {
  245. var d = new Date()
  246. var weekdays = ['日', '一', '二', '三', '四', '五', '六']
  247. return d.getFullYear() + '年' + (d.getMonth() + 1) + '月' + d.getDate() + '日 周' + weekdays[d.getDay()]
  248. },
  249. goBack: function() { uni.navigateBack() },
  250. // 拉取后台配置(sys_config.exercise_types),失败回退默认;缓存到 uni storage 供离线复用
  251. loadExerciseTypes: function() {
  252. var self = this
  253. loadExerciseTypes(function(key) { return getPublicConfig(key) }, {
  254. getItem: function(k) { return uni.getStorageSync(k) },
  255. setItem: function(k, v) { uni.setStorageSync(k, v) }
  256. }).then(function(types) { self.exerciseTypes = types })
  257. },
  258. exerciseTypeLabel: function(type) {
  259. // 历史 value(ball_game 等)经公共函数归一/映射,老记录 label 不丢
  260. return resolveExerciseTypeLabel(type, this.exerciseTypes)
  261. },
  262. formatDate: function(dateStr) {
  263. if (!dateStr) return ''
  264. var d = parseDate(dateStr)
  265. if (!d) return dateStr
  266. var m2 = (d.getMonth() + 1).toString().padStart(2, '0')
  267. var day = d.getDate().toString().padStart(2, '0')
  268. return m2 + '-' + day
  269. },
  270. loadHistory: function() {
  271. var self = this
  272. var token = uni.getStorageSync('token')
  273. if (!token || !self.memberId) return
  274. uni.request({
  275. url: config.API_BASE_URL + '/api/health/exercise/list',
  276. method: 'POST',
  277. data: { memberId: self.memberId },
  278. header: { 'Content-Type': 'application/json', 'Authorization': 'Bearer ' + token },
  279. success: function(res) {
  280. if (res.data && res.data.code === 200 && res.data.data) {
  281. self.history = res.data.data.slice(0, 5)
  282. }
  283. }
  284. })
  285. },
  286. choosePhoto: function() {
  287. var self = this
  288. pickImage({
  289. count: 9 - self.form.photos.length,
  290. sizeType: ['compressed'],
  291. sourceType: ['album', 'camera'],
  292. success: function(res) {
  293. res.tempFilePaths.forEach(function(path) {
  294. if (self.form.photos.length < 9) self.form.photos.push(path)
  295. })
  296. }
  297. })
  298. },
  299. getPhotoKey: function(img, idx) {
  300. return img ? img : ('p' + idx)
  301. },
  302. removePhoto: function(idx) {
  303. this.form.photos.splice(idx, 1)
  304. },
  305. toggleRecord: function() {
  306. if (this.isRecording) {
  307. this.recorderManager.stop()
  308. } else {
  309. this.recorderManager.start({ duration: 60000, format: 'mp3' })
  310. }
  311. },
  312. cancelRecord: function() {
  313. this.recorderManager.stop()
  314. this.form.voicePath = ''
  315. },
  316. finishRecord: function() {
  317. this.recorderManager.stop()
  318. },
  319. deleteVoice: function() {
  320. this.form.voicePath = ''
  321. },
  322. syncWechatSteps: function() {
  323. var self = this
  324. if (self.syncingSteps) return
  325. wx.getSetting({
  326. success: function(res) {
  327. var setting = res.authSetting
  328. if (setting && setting['scope.werun'] === false) {
  329. uni.showModal({
  330. title: '需要授权',
  331. content: '请去设置中开启「微信运动」授权后重试',
  332. confirmText: '去设置',
  333. success: function(m) {
  334. if (m.confirm) uni.openSetting()
  335. }
  336. })
  337. return
  338. }
  339. self.doGetWeRunData()
  340. },
  341. fail: function() {
  342. self.doGetWeRunData()
  343. }
  344. })
  345. },
  346. doGetWeRunData: function() {
  347. var self = this
  348. self.syncingSteps = true
  349. wx.getWeRunData({
  350. success: function(res) {
  351. var token = uni.getStorageSync('token')
  352. uni.request({
  353. url: config.API_BASE_URL + '/api/health/exercise/sync-wechat-steps',
  354. method: 'POST',
  355. data: { encryptedData: res.encryptedData, iv: res.iv },
  356. header: { 'Content-Type': 'application/json', 'Authorization': 'Bearer ' + token },
  357. success: function(r) {
  358. self.syncingSteps = false
  359. if (r.data && r.data.code === 200 && r.data.data) {
  360. var step = r.data.data.stepCount
  361. self.form.stepCount = step
  362. self.syncedStepText = '已同步今日步数:' + step + ' 步'
  363. uni.showToast({ title: '同步成功', icon: 'success' })
  364. } else {
  365. var msg = (r.data && r.data.message) || '同步失败'
  366. uni.showToast({ title: msg, icon: 'none' })
  367. }
  368. },
  369. fail: function() {
  370. self.syncingSteps = false
  371. uni.showToast({ title: '网络错误', icon: 'none' })
  372. }
  373. })
  374. },
  375. fail: function(err) {
  376. self.syncingSteps = false
  377. var errMsg = err && err.errMsg || ''
  378. if (errMsg.indexOf('auth') >= 0 || errMsg.indexOf('denied') >= 0) {
  379. uni.showModal({
  380. title: '需要授权',
  381. content: '请在微信「设置-隐私-授权管理」中开启微信运动权限',
  382. confirmText: '去设置',
  383. success: function(m) {
  384. if (m.confirm) uni.openSetting()
  385. }
  386. })
  387. } else {
  388. uni.showToast({ title: '获取微信步数失败,请先开启微信运动', icon: 'none' })
  389. }
  390. }
  391. })
  392. },
  393. uploadFile: function(filePath) {
  394. var self = this
  395. return new Promise(function(resolve, reject) {
  396. uni.uploadFile({
  397. url: config.API_BASE_URL + '/api/media/upload',
  398. filePath: filePath,
  399. name: 'file',
  400. header: { 'Authorization': 'Bearer ' + uni.getStorageSync('token') },
  401. success: function(res) {
  402. try {
  403. var data = JSON.parse(res.data)
  404. if (data && data.code === 200 && data.data && data.data.url) {
  405. resolve(data.data.url)
  406. } else if (data && data.url) {
  407. resolve(data.url)
  408. } else {
  409. resolve('')
  410. }
  411. } catch (e) {
  412. resolve('')
  413. }
  414. },
  415. fail: function() { reject() }
  416. })
  417. })
  418. },
  419. doCheckin: function() {
  420. var self = this
  421. if (self.submitting) return
  422. // 保存时正在录音 → 先停止录音,等待 onStop 完成语音后继续提交
  423. if (self.isRecording) {
  424. self.pendingSubmit = true
  425. self.recorderManager.stop()
  426. return
  427. }
  428. self.submitCheckin()
  429. },
  430. submitCheckin: async function() {
  431. var self = this
  432. if (!self.form.exerciseType) { uni.showToast({ title: '请选择运动类型', icon: 'none' }); return }
  433. // 内容校验:运动时长、图片、语音 至少有一项
  434. var durationNum = parseInt(self.form.durationMinutes)
  435. var hasDuration = self.form.durationMinutes && !isNaN(durationNum) && durationNum > 0
  436. var hasPhoto = self.form.photos && self.form.photos.length > 0
  437. var hasVoice = self.form.voicePath || (self.form.voiceText && self.form.voiceText.trim())
  438. if (!hasDuration && !hasPhoto && !hasVoice) { uni.showToast({ title: '请填写运动时长或添加图片/语音', icon: 'none' }); return }
  439. if (!self.memberId) { uni.showToast({ title: '成员ID无效', icon: 'none' }); return }
  440. self.submitting = true
  441. try {
  442. var photoUrls = []
  443. if (self.form.photos && self.form.photos.length > 0) {
  444. for (var i = 0; i < self.form.photos.length; i++) {
  445. try { var url = await self.uploadFile(self.form.photos[i]) } catch(e) { url = '' }
  446. if (url) photoUrls.push(url)
  447. }
  448. }
  449. var voiceUrl = ''
  450. if (self.form.voicePath) {
  451. try { voiceUrl = await self.uploadFile(self.form.voicePath) } catch(e) { voiceUrl = '' }
  452. }
  453. var token = uni.getStorageSync('token')
  454. uni.request({
  455. url: config.API_BASE_URL + '/api/health/exercise/create',
  456. method: 'POST',
  457. data: {
  458. memberId: self.memberId,
  459. taskId: self.taskId || undefined,
  460. exerciseType: self.form.exerciseType,
  461. durationMinutes: self.form.durationMinutes ? parseInt(self.form.durationMinutes) : null,
  462. intensity: self.form.intensity,
  463. caloriesBurned: self.form.caloriesBurned ? parseInt(self.form.caloriesBurned) : null,
  464. remark: self.form.remark || '',
  465. photoUrls: photoUrls.join(','),
  466. voiceUrl: voiceUrl,
  467. voiceText: self.form.voiceText || '',
  468. stepCount: self.form.stepCount ? parseInt(self.form.stepCount) : null
  469. },
  470. header: { 'Content-Type': 'application/json', 'Authorization': 'Bearer ' + token },
  471. success: function(res) {
  472. if (res.data && res.data.code === 200) {
  473. uni.showToast({ title: self.taskId ? '打卡成功,任务已完成' : '打卡成功', icon: 'success' })
  474. self.syncedStepText = ''
  475. // 打卡成功:任务已完成(后端 create 已按任务归属自动完成并自纠成员,
  476. // 无需再调 /api/tasks/{id}/complete——历史冗余调用在双身份/已完成时会触发 500)
  477. setTimeout(function() {
  478. uni.navigateBack()
  479. }, 800)
  480. } else {
  481. uni.showToast({ title: (res.data && res.data.message) || '打卡失败', icon: 'none' })
  482. }
  483. },
  484. fail: function() {
  485. self.submitting = false
  486. uni.showToast({ title: '网络错误', icon: 'none' })
  487. }
  488. })
  489. } catch (e) {
  490. self.submitting = false
  491. uni.showToast({ title: '提交失败', icon: 'none' })
  492. }
  493. }
  494. }
  495. }
  496. </script>
  497. <style scoped lang="scss">
  498. /* ===== 页面基础 ===== */
  499. .page { min-height: 100vh; background: $uni-primary-pale; }
  500. .nav-bar { height: 88rpx; padding: 24rpx 24rpx 0; display: flex; align-items: flex-end; }
  501. .nav-left { display: flex; align-items: center; gap: 10rpx; }
  502. .nav-icon { font-size: calc(48rpx * var(--font-scale, 1)); color: $facade-text-strong; line-height: 1; }
  503. .nav-title { font-size: calc(34rpx * var(--font-scale, 1)); font-weight: 600; color: $facade-text-strong; }
  504. .content { padding-bottom: 40rpx; }
  505. /* ===== 卡片通用 ===== */
  506. .card { margin: 16rpx 20rpx; background: $app-surface; border-radius: 24rpx; overflow: hidden; box-shadow: 0 4rpx 20rpx rgba(0,0,0,0.05); }
  507. .card-header { display: flex; align-items: center; gap: 10rpx; padding: 20rpx 24rpx 8rpx; border-bottom: 1rpx solid $facade-fill-2; background: linear-gradient(90deg, #FFFAF0, $app-surface); }
  508. .card-icon { font-size: calc(32rpx * var(--font-scale, 1)); }
  509. .card-title { font-size: calc(30rpx * var(--font-scale, 1)); font-weight: 600; color: $facade-text-strong; }
  510. .card-body { padding: 20rpx 24rpx 24rpx; }
  511. /* ===== 表单 ===== */
  512. .form-group { margin-bottom: 20rpx; }
  513. .form-label { font-size: calc(26rpx * var(--font-scale, 1)); color: $facade-text-strong; font-weight: 500; margin-bottom: 10rpx; display: block; }
  514. .tag-row { display: flex; flex-wrap: wrap; gap: 10rpx; }
  515. .form-input { width: 100%; height: 76rpx; border: 1rpx solid $facade-fill-4; border-radius: 16rpx; padding: 0 16rpx; font-size: calc(26rpx * var(--font-scale, 1)); background: $facade-fill-ghost; box-sizing: border-box; }
  516. .step-sync-row { display: flex; align-items: center; gap: 12rpx; }
  517. .step-input { flex: 1; }
  518. .sync-btn { padding: 12rpx 28rpx; border-radius: 24rpx; border: 2rpx solid $brand-primary; background: $fortune-1-tint; transition: opacity 0.2s ease; flex-shrink: 0; }
  519. .sync-btn text { font-size: calc(24rpx * var(--font-scale, 1)); color: $brand-primary; font-weight: 500; }
  520. .syncing { opacity: 0.5; }
  521. .step-hint { font-size: calc(22rpx * var(--font-scale, 1)); color: $status-success; margin-top: 6rpx; display: block; }
  522. /* ===== 媒体工具栏 ===== */
  523. .media-toolbar { display: flex; align-items: center; gap: 0; padding: 12rpx 0; }
  524. .tool-btn { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6rpx; padding: 16rpx 0; }
  525. .tool-icon { font-size: calc(40rpx * var(--font-scale, 1)); }
  526. .tool-label { font-size: calc(24rpx * var(--font-scale, 1)); color: $facade-text-body; }
  527. .tool-count { font-size: calc(20rpx * var(--font-scale, 1)); color: $brand-primary; font-weight: 600; }
  528. .tool-divider { width: 1rpx; height: 56rpx; background: linear-gradient(180deg, transparent, $facade-fill-4, transparent); }
  529. /* ===== 照片缩略图 ===== */
  530. .photo-strip { display: flex; flex-wrap: wrap; gap: 10rpx; padding: 12rpx 0 4rpx; }
  531. .photo-item { position: relative; width: 132rpx; height: 132rpx; border-radius: 16rpx; overflow: hidden; }
  532. .photo-img { width: 100%; height: 100%; object-fit: cover; }
  533. .photo-delete-overlay { position: absolute; top: -6rpx; right: -6rpx; width: 32rpx; height: 32rpx; background: $status-danger; border-radius: 50%; display: flex; align-items: center; justify-content: center; box-shadow: 0 2rpx 8rpx rgba(239,68,68,0.3); z-index: 2; }
  534. .delete-icon { color: $app-surface; font-size: calc(22rpx * var(--font-scale, 1)); font-weight: bold; line-height: 32rpx; }
  535. /* ===== 录音展开区 ===== */
  536. .voice-strip { display: flex; align-items: center; justify-content: space-between; padding: 12rpx 0 4rpx; gap: 16rpx; }
  537. .waveform { display: flex; align-items: center; gap: 5rpx; height: 40rpx; flex: 1; }
  538. .wave-bar { width: 5rpx; height: 8rpx; background: $brand-primary; border-radius: 8rpx; animation: wave-anim 0.8s ease-in-out infinite; }
  539. @keyframes wave-anim { 0%, 100% { height: 8rpx; } 50% { height: 32rpx; } }
  540. .voice-controls { display: flex; gap: 12rpx; }
  541. .mini-btn { padding: 10rpx 24rpx; border-radius: 24rpx; font-size: calc(24rpx * var(--font-scale, 1)); }
  542. .cancel-mini { background: $facade-fill; color: $facade-text-body; }
  543. .done-mini { background: $brand-primary; color: $app-surface; font-weight: 600; }
  544. .voice-player { display: flex; align-items: center; gap: 10rpx; flex: 1; background: $fortune-1-tint; padding: 10rpx 20rpx; border-radius: 24rpx; }
  545. .play-icon { font-size: calc(26rpx * var(--font-scale, 1)); color: $brand-primary; }
  546. .voice-duration { font-size: calc(24rpx * var(--font-scale, 1)); color: $facade-text-body; }
  547. .delete-voice { width: 40rpx; height: 40rpx; display: flex; align-items: center; justify-content: center; color: $facade-text-muted; font-size: calc(28rpx * var(--font-scale, 1)); }
  548. /* ===== 提交按钮 ===== */
  549. .submit-wrap { padding: 24rpx 20rpx 32rpx; }
  550. .submit-btn { background: linear-gradient(135deg, $dim-body, $brand-primary); color: $app-surface; text-align: center; padding: 22rpx 0; border-radius: 16rpx; font-size: calc(30rpx * var(--font-scale, 1)); font-weight: 600; box-shadow: 0 6rpx 20rpx rgba(249,115,22,0.3); transition: transform 0.2s ease; }
  551. .submit-btn:active { transform: scale(0.98); }
  552. .submitting { opacity: 0.6; }
  553. /* ===== 历史记录 ===== */
  554. .history-list { display: flex; flex-direction: column; gap: 12rpx; }
  555. .history-item { display: flex; justify-content: space-between; align-items: center; padding: 14rpx 0; border-bottom: 1rpx solid $facade-fill-2; }
  556. .history-left { flex: 1; min-width: 0; }
  557. .history-type { font-size: calc(26rpx * var(--font-scale, 1)); font-weight: 500; color: $facade-text-strong; display: block; }
  558. .history-content { font-size: calc(24rpx * var(--font-scale, 1)); color: $facade-text-faint; display: block; margin-top: 4rpx; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  559. .history-right { text-align: right; margin-left: 16rpx; flex-shrink: 0; }
  560. .history-date { font-size: calc(22rpx * var(--font-scale, 1)); color: $facade-text-muted; }
  561. /* ===== 底部留白 ===== */
  562. .bottom-spacer { height: 40rpx; }
  563. </style>