exercise-checkin.vue 24 KB

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