山东大学创新项目智研雅思先锋队 第八周

本周任务:完成历史记录功能(2)

播放功能

在每条信息下新增播放按钮

按钮调用函数

    async playAudio (blob) {
      // 将 Blob 转换为 URL
      console.log(blob)

      if (typeof blob === 'string') {
        const binary = atob(blob)
        const array = []
        for (let i = 0; i < binary.length; i++) {
          array.push(binary.charCodeAt(i))
        }
        blob = new Blob([new Uint8Array(array)], { type: 'audio/wav' })
      }

      if (!(blob instanceof Blob)) {
        console.error('The provided data is not a Blob')
        return
      }

      const url = URL.createObjectURL(blob)

      // 创建音频对象
      const audio = new Audio(url)

      console.log('begin')
      // 播放音频
      audio.play()

      // 处理音频播放结束后的清理工作
      audio.onended = () => {
        URL.revokeObjectURL(url) // 释放 URL 对象
      }
    },

查看详情功能

查看考试评价与成绩

在考试时间下新增查看详情按钮

点击后可查看考试评价与成绩

前端实现:

删除功能

通过返回当前记录的examid,从数据库中刷新该页面

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值