exercise-checkin.vue 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578
  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 TagChip from '../../components/TagChip.vue'
  150. import fontScaleMixin from '@/mixins/font-scale.js'
  151. export default {
  152. mixins: [fontScaleMixin],
  153. components: { TagChip },
  154. data() {
  155. return {
  156. memberId: null,
  157. taskId: null,
  158. isSelfCheckin: false,
  159. submitting: false,
  160. pendingSubmit: false,
  161. syncingSteps: false,
  162. syncedStepText: '',
  163. isRecording: false,
  164. recordSeconds: 0,
  165. recordTimer: null,
  166. recorderManager: null,
  167. history: [],
  168. todayText: '',
  169. exerciseTypes: [
  170. { label: '跑步', value: 'running' },
  171. { label: '游泳', value: 'swimming' },
  172. { label: '跳绳', value: 'jump_rope' },
  173. { label: '球类', value: 'ball' },
  174. { label: '骑行', value: 'cycling' },
  175. { label: '体操', value: 'gymnastics' },
  176. { label: '其他', value: 'other' }
  177. ],
  178. intensityOptions: [
  179. { label: '低', value: 'low' },
  180. { label: '中', value: 'medium' },
  181. { label: '高', value: 'high' }
  182. ],
  183. form: {
  184. exerciseType: '',
  185. durationMinutes: '',
  186. intensity: 'medium',
  187. caloriesBurned: '',
  188. stepCount: '',
  189. remark: '',
  190. photos: [],
  191. voicePath: '',
  192. voiceText: '',
  193. voiceDuration: 0
  194. }
  195. }
  196. },
  197. computed: {
  198. recordDurationText: function() {
  199. if (!this.form.voicePath) return ''
  200. return '录音 ' + this.recordSeconds + '秒'
  201. }
  202. },
  203. onLoad: function(options) {
  204. this.taskId = options.taskId || null
  205. this.todayText = this.getToday()
  206. this.memberId = resolveCheckinMemberId(options, {
  207. currentRole: uni.getStorageSync('currentRole') || uni.getStorageSync('role') || 'parent',
  208. currentChildId: uni.getStorageSync('currentChildId'),
  209. currentMemberId: uni.getStorageSync('currentMemberId'),
  210. userId: uni.getStorageSync('userId')
  211. })
  212. this.isSelfCheckin = uni.getStorageSync('currentView') !== 'member'
  213. this.recorderManager = uni.getRecorderManager()
  214. this.recorderManager.onStart(() => {
  215. this.isRecording = true
  216. this.recordSeconds = 0
  217. this.recordTimer = setInterval(() => { this.recordSeconds++ }, 1000)
  218. })
  219. this.recorderManager.onStop((res) => {
  220. this.isRecording = false
  221. if (this.recordTimer) { clearInterval(this.recordTimer); this.recordTimer = null }
  222. this.form.voicePath = res.tempFilePath
  223. this.form.voiceDuration = res.duration
  224. var self = this
  225. uni.showLoading({ title: '语音识别中...', mask: true })
  226. sttTranscribe(res.tempFilePath).then(function(text) {
  227. self.form.voiceText = text
  228. uni.hideLoading()
  229. // 保存时停止录音 → 语音已就绪,继续提交
  230. if (self.pendingSubmit) { self.pendingSubmit = false; self.doCheckin() }
  231. }).catch(function(err) {
  232. uni.hideLoading()
  233. console.warn('STT 转写失败:', err)
  234. if (self.pendingSubmit) { self.pendingSubmit = false; self.doCheckin() }
  235. })
  236. })
  237. this.recorderManager.onError(() => {
  238. this.isRecording = false
  239. if (this.recordTimer) { clearInterval(this.recordTimer); this.recordTimer = null }
  240. uni.showToast({ title: '录音失败', icon: 'none' })
  241. })
  242. this.loadHistory()
  243. },
  244. onUnload: function() {
  245. if (this.recordTimer) clearInterval(this.recordTimer)
  246. },
  247. methods: {
  248. getToday: function() {
  249. var d = new Date()
  250. var weekdays = ['日', '一', '二', '三', '四', '五', '六']
  251. return d.getFullYear() + '年' + (d.getMonth() + 1) + '月' + d.getDate() + '日 周' + weekdays[d.getDay()]
  252. },
  253. goBack: function() { uni.navigateBack() },
  254. exerciseTypeLabel: function(type) {
  255. var m = { running: '跑步', swimming: '游泳', jump_rope: '跳绳', ball: '球类', cycling: '骑行', gymnastics: '体操', other: '其他' }
  256. return m[type] || type || '运动'
  257. },
  258. formatDate: function(dateStr) {
  259. if (!dateStr) return ''
  260. var d = parseDate(dateStr)
  261. if (!d) return dateStr
  262. var m2 = (d.getMonth() + 1).toString().padStart(2, '0')
  263. var day = d.getDate().toString().padStart(2, '0')
  264. return m2 + '-' + day
  265. },
  266. loadHistory: function() {
  267. var self = this
  268. var token = uni.getStorageSync('token')
  269. if (!token || !self.memberId) return
  270. uni.request({
  271. url: config.API_BASE_URL + '/api/health/exercise/list',
  272. method: 'POST',
  273. data: { memberId: self.memberId },
  274. header: { 'Content-Type': 'application/json', 'Authorization': 'Bearer ' + token },
  275. success: function(res) {
  276. if (res.data && res.data.code === 200 && res.data.data) {
  277. self.history = res.data.data.slice(0, 5)
  278. }
  279. }
  280. })
  281. },
  282. choosePhoto: function() {
  283. var self = this
  284. pickImage({
  285. count: 9 - self.form.photos.length,
  286. sizeType: ['compressed'],
  287. sourceType: ['album', 'camera'],
  288. success: function(res) {
  289. res.tempFilePaths.forEach(function(path) {
  290. if (self.form.photos.length < 9) self.form.photos.push(path)
  291. })
  292. }
  293. })
  294. },
  295. getPhotoKey: function(img, idx) {
  296. return img ? img : ('p' + idx)
  297. },
  298. removePhoto: function(idx) {
  299. this.form.photos.splice(idx, 1)
  300. },
  301. toggleRecord: function() {
  302. if (this.isRecording) {
  303. this.recorderManager.stop()
  304. } else {
  305. this.recorderManager.start({ duration: 60000, format: 'mp3' })
  306. }
  307. },
  308. cancelRecord: function() {
  309. this.recorderManager.stop()
  310. this.form.voicePath = ''
  311. },
  312. finishRecord: function() {
  313. this.recorderManager.stop()
  314. },
  315. deleteVoice: function() {
  316. this.form.voicePath = ''
  317. },
  318. syncWechatSteps: function() {
  319. var self = this
  320. if (self.syncingSteps) return
  321. wx.getSetting({
  322. success: function(res) {
  323. var setting = res.authSetting
  324. if (setting && setting['scope.werun'] === false) {
  325. uni.showModal({
  326. title: '需要授权',
  327. content: '请去设置中开启「微信运动」授权后重试',
  328. confirmText: '去设置',
  329. success: function(m) {
  330. if (m.confirm) uni.openSetting()
  331. }
  332. })
  333. return
  334. }
  335. self.doGetWeRunData()
  336. },
  337. fail: function() {
  338. self.doGetWeRunData()
  339. }
  340. })
  341. },
  342. doGetWeRunData: function() {
  343. var self = this
  344. self.syncingSteps = true
  345. wx.getWeRunData({
  346. success: function(res) {
  347. var token = uni.getStorageSync('token')
  348. uni.request({
  349. url: config.API_BASE_URL + '/api/health/exercise/sync-wechat-steps',
  350. method: 'POST',
  351. data: { encryptedData: res.encryptedData, iv: res.iv },
  352. header: { 'Content-Type': 'application/json', 'Authorization': 'Bearer ' + token },
  353. success: function(r) {
  354. self.syncingSteps = false
  355. if (r.data && r.data.code === 200 && r.data.data) {
  356. var step = r.data.data.stepCount
  357. self.form.stepCount = step
  358. self.syncedStepText = '已同步今日步数:' + step + ' 步'
  359. uni.showToast({ title: '同步成功', icon: 'success' })
  360. } else {
  361. var msg = (r.data && r.data.message) || '同步失败'
  362. uni.showToast({ title: msg, icon: 'none' })
  363. }
  364. },
  365. fail: function() {
  366. self.syncingSteps = false
  367. uni.showToast({ title: '网络错误', icon: 'none' })
  368. }
  369. })
  370. },
  371. fail: function(err) {
  372. self.syncingSteps = false
  373. var errMsg = err && err.errMsg || ''
  374. if (errMsg.indexOf('auth') >= 0 || errMsg.indexOf('denied') >= 0) {
  375. uni.showModal({
  376. title: '需要授权',
  377. content: '请在微信「设置-隐私-授权管理」中开启微信运动权限',
  378. confirmText: '去设置',
  379. success: function(m) {
  380. if (m.confirm) uni.openSetting()
  381. }
  382. })
  383. } else {
  384. uni.showToast({ title: '获取微信步数失败,请先开启微信运动', icon: 'none' })
  385. }
  386. }
  387. })
  388. },
  389. uploadFile: function(filePath) {
  390. var self = this
  391. return new Promise(function(resolve, reject) {
  392. uni.uploadFile({
  393. url: config.API_BASE_URL + '/api/media/upload',
  394. filePath: filePath,
  395. name: 'file',
  396. header: { 'Authorization': 'Bearer ' + uni.getStorageSync('token') },
  397. success: function(res) {
  398. try {
  399. var data = JSON.parse(res.data)
  400. if (data && data.code === 200 && data.data && data.data.url) {
  401. resolve(data.data.url)
  402. } else if (data && data.url) {
  403. resolve(data.url)
  404. } else {
  405. resolve('')
  406. }
  407. } catch (e) {
  408. resolve('')
  409. }
  410. },
  411. fail: function() { reject() }
  412. })
  413. })
  414. },
  415. doCheckin: function() {
  416. var self = this
  417. if (self.submitting) return
  418. // 保存时正在录音 → 先停止录音,等待 onStop 完成语音后继续提交
  419. if (self.isRecording) {
  420. self.pendingSubmit = true
  421. self.recorderManager.stop()
  422. return
  423. }
  424. self.submitCheckin()
  425. },
  426. submitCheckin: async function() {
  427. var self = this
  428. if (!self.form.exerciseType) { uni.showToast({ title: '请选择运动类型', icon: 'none' }); return }
  429. // 内容校验:运动时长、图片、语音 至少有一项
  430. var durationNum = parseInt(self.form.durationMinutes)
  431. var hasDuration = self.form.durationMinutes && !isNaN(durationNum) && durationNum > 0
  432. var hasPhoto = self.form.photos && self.form.photos.length > 0
  433. var hasVoice = self.form.voicePath || (self.form.voiceText && self.form.voiceText.trim())
  434. if (!hasDuration && !hasPhoto && !hasVoice) { uni.showToast({ title: '请填写运动时长或添加图片/语音', icon: 'none' }); return }
  435. if (!self.memberId) { uni.showToast({ title: '成员ID无效', icon: 'none' }); return }
  436. self.submitting = true
  437. try {
  438. var photoUrls = []
  439. if (self.form.photos && self.form.photos.length > 0) {
  440. for (var i = 0; i < self.form.photos.length; i++) {
  441. try { var url = await self.uploadFile(self.form.photos[i]) } catch(e) { url = '' }
  442. if (url) photoUrls.push(url)
  443. }
  444. }
  445. var voiceUrl = ''
  446. if (self.form.voicePath) {
  447. try { voiceUrl = await self.uploadFile(self.form.voicePath) } catch(e) { voiceUrl = '' }
  448. }
  449. var token = uni.getStorageSync('token')
  450. uni.request({
  451. url: config.API_BASE_URL + '/api/health/exercise/create',
  452. method: 'POST',
  453. data: {
  454. memberId: self.memberId,
  455. taskId: self.taskId || undefined,
  456. exerciseType: self.form.exerciseType,
  457. durationMinutes: self.form.durationMinutes ? parseInt(self.form.durationMinutes) : null,
  458. intensity: self.form.intensity,
  459. caloriesBurned: self.form.caloriesBurned ? parseInt(self.form.caloriesBurned) : null,
  460. remark: self.form.remark || '',
  461. photoUrls: photoUrls.join(','),
  462. voiceUrl: voiceUrl,
  463. voiceText: self.form.voiceText || '',
  464. stepCount: self.form.stepCount ? parseInt(self.form.stepCount) : null
  465. },
  466. header: { 'Content-Type': 'application/json', 'Authorization': 'Bearer ' + token },
  467. success: function(res) {
  468. if (res.data && res.data.code === 200) {
  469. uni.showToast({ title: self.taskId ? '打卡成功,任务已完成' : '打卡成功', icon: 'success' })
  470. self.syncedStepText = ''
  471. // 打卡成功:任务已完成(后端 create 已按任务归属自动完成并自纠成员,
  472. // 无需再调 /api/tasks/{id}/complete——历史冗余调用在双身份/已完成时会触发 500)
  473. setTimeout(function() {
  474. uni.navigateBack()
  475. }, 800)
  476. } else {
  477. uni.showToast({ title: (res.data && res.data.message) || '打卡失败', icon: 'none' })
  478. }
  479. },
  480. fail: function() {
  481. self.submitting = false
  482. uni.showToast({ title: '网络错误', icon: 'none' })
  483. }
  484. })
  485. } catch (e) {
  486. self.submitting = false
  487. uni.showToast({ title: '提交失败', icon: 'none' })
  488. }
  489. }
  490. }
  491. }
  492. </script>
  493. <style scoped lang="scss">
  494. /* ===== 页面基础 ===== */
  495. .page { min-height: 100vh; background: $uni-primary-pale; }
  496. .nav-bar { height: 88rpx; padding: 24rpx 24rpx 0; display: flex; align-items: flex-end; }
  497. .nav-left { display: flex; align-items: center; gap: 10rpx; }
  498. .nav-icon { font-size: calc(48rpx * var(--font-scale, 1)); color: $facade-text-strong; line-height: 1; }
  499. .nav-title { font-size: calc(34rpx * var(--font-scale, 1)); font-weight: 600; color: $facade-text-strong; }
  500. .content { padding-bottom: 40rpx; }
  501. /* ===== 卡片通用 ===== */
  502. .card { margin: 16rpx 20rpx; background: $app-surface; border-radius: 24rpx; overflow: hidden; box-shadow: 0 4rpx 20rpx rgba(0,0,0,0.05); }
  503. .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); }
  504. .card-icon { font-size: calc(32rpx * var(--font-scale, 1)); }
  505. .card-title { font-size: calc(30rpx * var(--font-scale, 1)); font-weight: 600; color: $facade-text-strong; }
  506. .card-body { padding: 20rpx 24rpx 24rpx; }
  507. /* ===== 表单 ===== */
  508. .form-group { margin-bottom: 20rpx; }
  509. .form-label { font-size: calc(26rpx * var(--font-scale, 1)); color: $facade-text-strong; font-weight: 500; margin-bottom: 10rpx; display: block; }
  510. .tag-row { display: flex; flex-wrap: wrap; gap: 10rpx; }
  511. .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; }
  512. .step-sync-row { display: flex; align-items: center; gap: 12rpx; }
  513. .step-input { flex: 1; }
  514. .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; }
  515. .sync-btn text { font-size: calc(24rpx * var(--font-scale, 1)); color: $brand-primary; font-weight: 500; }
  516. .syncing { opacity: 0.5; }
  517. .step-hint { font-size: calc(22rpx * var(--font-scale, 1)); color: $status-success; margin-top: 6rpx; display: block; }
  518. /* ===== 媒体工具栏 ===== */
  519. .media-toolbar { display: flex; align-items: center; gap: 0; padding: 12rpx 0; }
  520. .tool-btn { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6rpx; padding: 16rpx 0; }
  521. .tool-icon { font-size: calc(40rpx * var(--font-scale, 1)); }
  522. .tool-label { font-size: calc(24rpx * var(--font-scale, 1)); color: $facade-text-body; }
  523. .tool-count { font-size: calc(20rpx * var(--font-scale, 1)); color: $brand-primary; font-weight: 600; }
  524. .tool-divider { width: 1rpx; height: 56rpx; background: linear-gradient(180deg, transparent, $facade-fill-4, transparent); }
  525. /* ===== 照片缩略图 ===== */
  526. .photo-strip { display: flex; flex-wrap: wrap; gap: 10rpx; padding: 12rpx 0 4rpx; }
  527. .photo-item { position: relative; width: 132rpx; height: 132rpx; border-radius: 16rpx; overflow: hidden; }
  528. .photo-img { width: 100%; height: 100%; object-fit: cover; }
  529. .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; }
  530. .delete-icon { color: $app-surface; font-size: calc(22rpx * var(--font-scale, 1)); font-weight: bold; line-height: 32rpx; }
  531. /* ===== 录音展开区 ===== */
  532. .voice-strip { display: flex; align-items: center; justify-content: space-between; padding: 12rpx 0 4rpx; gap: 16rpx; }
  533. .waveform { display: flex; align-items: center; gap: 5rpx; height: 40rpx; flex: 1; }
  534. .wave-bar { width: 5rpx; height: 8rpx; background: $brand-primary; border-radius: 8rpx; animation: wave-anim 0.8s ease-in-out infinite; }
  535. @keyframes wave-anim { 0%, 100% { height: 8rpx; } 50% { height: 32rpx; } }
  536. .voice-controls { display: flex; gap: 12rpx; }
  537. .mini-btn { padding: 10rpx 24rpx; border-radius: 24rpx; font-size: calc(24rpx * var(--font-scale, 1)); }
  538. .cancel-mini { background: $facade-fill; color: $facade-text-body; }
  539. .done-mini { background: $brand-primary; color: $app-surface; font-weight: 600; }
  540. .voice-player { display: flex; align-items: center; gap: 10rpx; flex: 1; background: $fortune-1-tint; padding: 10rpx 20rpx; border-radius: 24rpx; }
  541. .play-icon { font-size: calc(26rpx * var(--font-scale, 1)); color: $brand-primary; }
  542. .voice-duration { font-size: calc(24rpx * var(--font-scale, 1)); color: $facade-text-body; }
  543. .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)); }
  544. /* ===== 提交按钮 ===== */
  545. .submit-wrap { padding: 24rpx 20rpx 32rpx; }
  546. .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; }
  547. .submit-btn:active { transform: scale(0.98); }
  548. .submitting { opacity: 0.6; }
  549. /* ===== 历史记录 ===== */
  550. .history-list { display: flex; flex-direction: column; gap: 12rpx; }
  551. .history-item { display: flex; justify-content: space-between; align-items: center; padding: 14rpx 0; border-bottom: 1rpx solid $facade-fill-2; }
  552. .history-left { flex: 1; min-width: 0; }
  553. .history-type { font-size: calc(26rpx * var(--font-scale, 1)); font-weight: 500; color: $facade-text-strong; display: block; }
  554. .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; }
  555. .history-right { text-align: right; margin-left: 16rpx; flex-shrink: 0; }
  556. .history-date { font-size: calc(22rpx * var(--font-scale, 1)); color: $facade-text-muted; }
  557. /* ===== 底部留白 ===== */
  558. .bottom-spacer { height: 40rpx; }
  559. </style>