From 554f8096e1f384f14b9424f5142d63f90c72a3eb Mon Sep 17 00:00:00 2001 From: hejianhao <15708179461@qq.com> Date: 星期一, 19 五月 2025 22:57:46 +0800 Subject: [PATCH] H5接口对接 --- H5/pages/work-detail/work-detail.vue | 20 ++++++++++++++++++-- 1 files changed, 18 insertions(+), 2 deletions(-) diff --git a/H5/pages/work-detail/work-detail.vue b/H5/pages/work-detail/work-detail.vue index f0d15bd..a3bdef8 100644 --- a/H5/pages/work-detail/work-detail.vue +++ b/H5/pages/work-detail/work-detail.vue @@ -165,9 +165,9 @@ <!-- 问题描述 --> <view class="problem"> <view class="title">问题描述</view> - <view v-for="(item,index) in 2" :key="index" + <view v-for="(item,index) in getVoiceFile(orderInfo.voiceFile)" :key="index" class="flex a-center j-between py-17 px-19 br-8 bgcolor1 mb-19"> - <view class="fs-27 lh-38">语音名字</view> + <view class="fs-27 lh-38">语音名字{{(index + 1) | numToWords}}</view> <image v-if="!playFlag" @click.stop="playRecording(item)" src="../../static/24gf-playCircle@2x.png" class="w-27 h-27 shrink0" /> <image v-else @click.stop="pausePlaying" src="../../static/pausePlaying.png" @@ -432,6 +432,18 @@ formatTime(val) { if (!val) return '' return dayjs(val).format('YYYY-MM-DD HH:mm:ss') + }, + numToWords(val) { + const words = ['零', '一', '二', '三', '四', '五', '六', '七', '八', '九', '十'] + // 处理 0-10 + if (val >= 0 && val <= 10) return words[val]; + // 处理 11-99 + if (val > 10 && val < 100) { + const ten = Math.floor(val / 10); + const unit = val % 10; + return `${ten > 1 ? words[ten] : ''}十${unit > 0 ? words[unit] : ''}`; + } + return val; // 超过99返回原数字 } }, onShow() { @@ -454,6 +466,10 @@ }, methods: { ...mapActions(["playRecording", "pausePlaying"]), + getVoiceFile(voiceFile) { + if (!voiceFile || voiceFile.length == 0) return [] + return voiceFile.split(',') + }, callPhone(phoneNumber) { uni.makePhoneCall({ phoneNumber -- Gitblit v1.7.1