{"id":33953,"date":"2024-11-25T09:22:23","date_gmt":"2024-11-25T01:22:23","guid":{"rendered":"https:\/\/fwq.ai\/blog\/33953\/"},"modified":"2024-11-25T09:22:23","modified_gmt":"2024-11-25T01:22:23","slug":"%e4%bb%8b%e7%bb%8d%e5%b0%8f%e7%a8%8b%e5%ba%8f%e8%81%8a%e5%a4%a9%e7%be%a4%ef%bc%8c%e5%8f%91%e9%80%81%e8%af%ad%e9%9f%b3%ef%bc%8c%e6%96%87%e5%ad%97%ef%bc%8c%e5%9b%be%e7%89%87","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/33953\/","title":{"rendered":"\u4ecb\u7ecd\u5c0f\u7a0b\u5e8f\u804a\u5929\u7fa4\uff0c\u53d1\u9001\u8bed\u97f3\uff0c\u6587\u5b57\uff0c\u56fe\u7247"},"content":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/000\/000\/052\/606681e328dc9243.jpg\" class=\"aligncenter\" title=\"\u4ecb\u7ecd\u5c0f\u7a0b\u5e8f\u804a\u5929\u7fa4\uff0c\u53d1\u9001\u8bed\u97f3\uff0c\u6587\u5b57\uff0c\u56fe\u7247\u63d2\u56fe\" alt=\"\u4ecb\u7ecd\u5c0f\u7a0b\u5e8f\u804a\u5929\u7fa4\uff0c\u53d1\u9001\u8bed\u97f3\uff0c\u6587\u5b57\uff0c\u56fe\u7247\u63d2\u56fe\" \/><\/p>\n<p>\u53ef\u4ee5\u521b\u5efa\u7fa4\uff0c\u9080\u8bf7\u7fa4\u6210\u5458\uff0c\u7fa4\u6210\u5458\u5217\u8868\u5c55\u793a\uff0c\u56fe\u7247\u53d1\u9001\uff0c\u8bbe\u7f6e\u7fa4\u516c\u544a\uff0c\u8e22\u4eba\uff0c\u5168\u4f53\u7981\u8a00\uff0c\u4e2a\u4eba\u7981\u8a00\uff0c\u53d1\u9001\u8bed\u97f3\u4fe1\u606f\u7b49\u529f\u80fd\u3002<\/p>\n<p>\u6548\u679c\u56fe\uff1a<\/p>\n<p><img decoding=\"async\" style=\"max-width:90%\" src=\"https:\/\/img.php.cn\/upload\/article\/000\/000\/052\/1adaf6e4d601464ff5455f82f04412bd-0.png\" class=\"aligncenter\" title=\"\u4ecb\u7ecd\u5c0f\u7a0b\u5e8f\u804a\u5929\u7fa4\uff0c\u53d1\u9001\u8bed\u97f3\uff0c\u6587\u5b57\uff0c\u56fe\u7247\u63d2\u56fe1\" alt=\"\u4ecb\u7ecd\u5c0f\u7a0b\u5e8f\u804a\u5929\u7fa4\uff0c\u53d1\u9001\u8bed\u97f3\uff0c\u6587\u5b57\uff0c\u56fe\u7247\u63d2\u56fe1\" \/><img decoding=\"async\" style=\"max-width:90%\" src=\"https:\/\/img.php.cn\/upload\/article\/000\/000\/052\/8a8ba38a36b178b25501b94581ef3556-1.png\" class=\"aligncenter\" title=\"\u4ecb\u7ecd\u5c0f\u7a0b\u5e8f\u804a\u5929\u7fa4\uff0c\u53d1\u9001\u8bed\u97f3\uff0c\u6587\u5b57\uff0c\u56fe\u7247\u63d2\u56fe2\" alt=\"\u4ecb\u7ecd\u5c0f\u7a0b\u5e8f\u804a\u5929\u7fa4\uff0c\u53d1\u9001\u8bed\u97f3\uff0c\u6587\u5b57\uff0c\u56fe\u7247\u63d2\u56fe2\" \/><\/p>\n<p><img decoding=\"async\" style=\"max-width:90%\" src=\"https:\/\/img.php.cn\/upload\/article\/000\/000\/052\/df9930fb8143a781b6f9008345971618-2.png\" class=\"aligncenter\" title=\"\u4ecb\u7ecd\u5c0f\u7a0b\u5e8f\u804a\u5929\u7fa4\uff0c\u53d1\u9001\u8bed\u97f3\uff0c\u6587\u5b57\uff0c\u56fe\u7247\u63d2\u56fe3\" alt=\"\u4ecb\u7ecd\u5c0f\u7a0b\u5e8f\u804a\u5929\u7fa4\uff0c\u53d1\u9001\u8bed\u97f3\uff0c\u6587\u5b57\uff0c\u56fe\u7247\u63d2\u56fe3\" \/><img decoding=\"async\" style=\"max-width:90%\" src=\"https:\/\/img.php.cn\/upload\/article\/000\/000\/052\/73318f03a9a8f6128d89657b8c44ff93-3.png\" class=\"aligncenter\" title=\"\u4ecb\u7ecd\u5c0f\u7a0b\u5e8f\u804a\u5929\u7fa4\uff0c\u53d1\u9001\u8bed\u97f3\uff0c\u6587\u5b57\uff0c\u56fe\u7247\u63d2\u56fe4\" alt=\"\u4ecb\u7ecd\u5c0f\u7a0b\u5e8f\u804a\u5929\u7fa4\uff0c\u53d1\u9001\u8bed\u97f3\uff0c\u6587\u5b57\uff0c\u56fe\u7247\u63d2\u56fe4\" \/><\/p>\n<p>\u5b9e\u73b0\u4ee3\u7801\uff1a<\/p>\n<p>wxml<\/p>\n<pre>&lt;view class=\"bo\"&gt;\n  &lt;view class=\"top_bo\"&gt;\n    &lt;view bindtap=\"number\"&gt;\u7fa4\u6210\u5458({{userNumber}})&lt;\/view&gt;\n    &lt;view bindtap=\"upLoad\" wx:if=\"{{prohibit=='0'}}\"&gt;\u53d1\u56fe\u7247&lt;\/view&gt;\n    &lt;view bindtap=\"prohibitTis\" wx:if=\"{{prohibit=='1'}}\"&gt;\u53d1\u56fe\u7247&lt;\/view&gt;\n    &lt;view bindtap=\"notice\"&gt;\u7fa4\u516c\u544a&lt;\/view&gt;\n    &lt;view bindtap=\"goHome\"&gt;\u53bb\u9996\u9875&lt;\/view&gt;\n  &lt;\/view&gt;\n  &lt;scroll-view scroll-y=\"true\" scroll-with-animation scroll-top=\"{{scrollTop}}\"&gt;\n    &lt;block wx:if='{{!list}}'&gt;\n      &lt;view class=\"noList\"&gt;\n        &lt;view class=\"noMsg\"&gt;\u6682\u65e0\u804a\u5929\u6570\u636e&lt;\/view&gt;\n      &lt;\/view&gt;\n    &lt;\/block&gt;\n    &lt;block wx:else&gt;\n      &lt;view class=\"body\" wx:for='{{list}}' wx:key='index'&gt;\n\n        &lt;view wx:if='{{item.type==1}}' class=\"right_body\"&gt;\n          &lt;view class=\"flexRoe posRit\"&gt;\n            &lt;view class=\"textBo\"&gt;\n              &lt;view class=\"dataTime\"&gt;{{item.sendOutname}} {{item.dataTime}}&lt;\/view&gt;\n              &lt;view wx:if=\"{{item.text!=''}}\" class=\"ritTxt\"&gt;{{item.text}}&lt;\/view&gt;\n              &lt;image wx:if=\"{{item.img!=''}}\" mode='widthFix' src=\"{{item.img}}\" class=\"textImg\"&gt;&lt;\/image&gt;\n              &lt;view wx:if=\"{{item.voice}}\" class=\"ritTxt2\" bindtap='my_audio_click' src='{{item.voice}}'&gt;\n                &lt;image class='my_audio' src='\/img\/play.png'&gt;&lt;\/image&gt;\n              &lt;\/view&gt;\n            &lt;\/view&gt;\n            &lt;image class=\"head\" style=\" margin-left:20rpx \" src=\"{{item.sendOutHand}}\"&gt;&lt;\/image&gt;\n          &lt;\/view&gt;\n        &lt;\/view&gt;\n        &lt;view wx:if='{{item.type==2}}' class=\"p_r left_body\"&gt;\n          &lt;view class=\"flexRoe \"&gt;\n            &lt;image class=\"head\" style=\" margin-left:20rpx \" src=\"{{item.sendOutHand}}\"&gt;&lt;\/image&gt;\n            &lt;view class=\"lfBo\"&gt;\n              &lt;view class=\"dataTime\"&gt;{{item.sendOutname}} {{item.dataTime}}&lt;\/view&gt;\n              &lt;view wx:if=\"{{item.text!=''}}\" class=\"lftTxt\"&gt;{{item.text}}&lt;\/view&gt;\n              &lt;image wx:if=\"{{item.img!=''}}\" mode='widthFix' src=\"{{item.img}}\" class=\"textImg\"&gt;&lt;\/image&gt;\n              &lt;view wx:if=\"{{item.voice}}\" class=\"lftTxt2\" bindtap='my_audio_click' src='{{item.voice}}'&gt;\n                &lt;image class='my_audio' src='\/img\/play.png'&gt;&lt;\/image&gt;\n              &lt;\/view&gt;\n            &lt;\/view&gt;\n          &lt;\/view&gt;\n        &lt;\/view&gt;\n      &lt;\/view&gt;\n    &lt;\/block&gt;\n\n  &lt;\/scroll-view&gt;\n\n  &lt;view class=\"inp\"&gt;\n    &lt;view&gt;\n      &lt;view class=\"p_r\" wx:if=\"{{prohibit=='0'}}\"&gt;\n        &lt;input class=\"input\" placeholder-class='plaCC' confirm-type=\"send\" bindconfirm='sendOut' placeholder='\u804a\u5929\uff0c\u5728\u8fd9\u91cc' value=\"{{title}}\"&gt;&lt;\/input&gt;\n        &lt;view class=\"yuyin\" catchtouchstart='voice_ing_start' catchtouchend=\"voice_ing_end\"&gt;\u8bed\u97f3&lt;\/view&gt;\n      &lt;\/view&gt;\n      &lt;view wx:if=\"{{prohibit=='1'}}\" bindtap=\"prohibitTis\" class=\"prohibit\"&gt;\u7981\u8a00\u4e2d&lt;\/view&gt;\n    &lt;\/view&gt;\n  &lt;\/view&gt;\n&lt;\/view&gt;<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>wxss<\/p>\n<pre>page {\n  background: #f2f2f2;\n}\n\n.top_bo {\n  display: flex;\n  background: white;\n  flex-direction: row;\n}\n\n.top_bo view {\n  flex: 1;\n  font-size: 28rpx;\n  text-align: center;\n  border: 1rpx solid #ccc;\n  line-height: 80rpx;\n}\n\nscroll-view {\n  height: 82vh;\n  \/* padding-bottom: 30rpx; *\/\n}\n\n.noList {\n  background: white;\n  margin-top: 30rpx;\n  \/* height: 230rpx; *\/\n  width: 100%;\n  padding-top: 25%;\n}\n\n.noMsg {\n  text-align: center;\n  color: #999;\n  font-size: 28rpx;\n}\n\n.inp {\n  position: absolute;\n  bottom: 0;\n  width: 100%;\n  background: white;\n  height: 100rpx;\n}\n\n.inp input {\n  background: #d0d0d0;\n  border-radius: 15rpx;\n  padding-left: 20rpx;\n  height: 84rpx;\n  margin-top: 10rpx;\n  width: 94%;\n  margin-left: 2%;\n}\n\n.prohibit {\n  background: #d0d0d0;\n  border-radius: 15rpx;\n  padding-left: 20rpx;\n  height: 84rpx;\n  margin-top: 10rpx;\n  width: 94%;\n  margin-left: 2%;\n  text-align: center;\n  line-height: 84rpx;\n  color: rgb(34, 34, 34);\n}\n\n.plaCC {\n  margin-left: 5rpx;\n}\n\n.p_r {\n  display: flex;\n  flex-direction: row;\n}\n\n.flexRoe {\n  display: flex;\n  flex-direction: row;\n}\n\n.body {\n  width: 100%;\n  position: relative;\n  \/* border: 1rpx solid #ccc; *\/\/* height: 200rpx *\/\n}\n\n.right_body {\n  width: 100%;\n  \/* border: 1rpx solid red; *\/\n  padding: 20rpx;\n  margin-top: 50rpx;\n}\n\n.left_body {\n  margin-top: 50rpx;\n}\n\n.posRit {\n  right: 20rpx;\n}\n\n.textBo {\n  width: 620rpx;\n  text-align: right;\n}\n\n.lfBo {\n  margin-left: 10rpx;\n}\n\n.ritTxt {\n  background: #44426a;\n  padding: 10rpx 20rpx 10rpx 20rpx;\n  color: white;\n  border-radius: 15rpx 0 15rpx 15rpx;\n  margin-top: 20rpx;\n  float: right;\n  max-width: 500rpx;\n  word-wrap: break-word;\n  text-align: left;\n}\n\n.ritTxt2 {\n  background: white;\n  color: white;\n  border-radius: 15rpx 0 15rpx 15rpx;\n  padding: 0rpx 20rpx 10rpx 20rpx;\n  margin-top: 20rpx;\n  float: right;\n  max-width: 500rpx;\n  word-wrap: break-word;\n  text-align: left;\n}\n\n.lftTxt {\n  background: #44426a;\n  padding: 10rpx 20rpx 10rpx 20rpx;\n  color: white;\n  border-radius: 0rpx 15rpx 15rpx 15rpx;\n  margin-top: 20rpx;\n  float: left;\n  max-width: 500rpx;\n  word-wrap: break-word;\n  text-align: left;\n}\n.lftTxt2 {\n  background: #fff;\n  padding: 0rpx 20rpx 10rpx 20rpx;\n  color: white;\n  border-radius: 0rpx 15rpx 15rpx 15rpx;\n  margin-top: 20rpx;\n  float: left;\n  max-width: 500rpx;\n  word-wrap: break-word;\n  text-align: left;\n}\n.my_audio {\n  height: 60rpx;\n  width: 60rpx;\n  z-index: 2;\n  position: relative;\n  top: 10rpx;\n  left: 20rpx;\n  margin-right: 30rpx;\n}\n\n\n.dataTime {\n  font-size: 28rpx;\n}\n\n.textImg {\n  width: 200rpx;\n  margin-top: 5rpx;\n}\n\n.head {\n  width: 80rpx;\n  height: 80rpx;\n}\n\n._ {\n  height: 130rpx;\n  width: 100%;\n  background: #ccc;\n}\n\n.inpBo {\n  display: flex;\n  flex-direction: row;\n}\n\n.yuyin {\n  flex: 1;\n  line-height: 104rpx;\n  text-align: center;\n}\n\n.input {\n  flex: 5;\n}<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>js<\/p>\n<pre>const DB = wx.cloud.database()\nvar util = require('..\/..\/utils\/util.js');\nvar recorder = wx.getRecorderManager();\nconst innerAudioContext = wx.createInnerAudioContext() \/\/\u83b7\u53d6\u64ad\u653e\u5bf9\u8c61\nvar qunId, that;\nPage({\n\n  \/**\n   * \u9875\u9762\u7684\u521d\u59cb\u6570\u636e\n   *\/\n  data: {\n    list: [],\n    userNumber: '0',\n    userList: [],\n    c: \"\",\n    prohibit: '',\n  },\n\n  \/\/ \u70b9\u51fb\u5f55\u97f3\u5f00\u59cb\u64ad\u653e\u4e8b\u4ef6\n  my_audio_click: function (e) {\n    var src = e.currentTarget.dataset.src;\n      console.log('url\u5730\u5740', src);\n      innerAudioContext.src = src\n      innerAudioContext.seek(0);\n      innerAudioContext.play();\n  },\n  \/\/ \u9996\u9875\n  goHome() {\n    wx.switchTab({\n      url: '..\/group\/group'\n    })\n\n  },\n  \n  \/\/ \u7fa4\u6210\u5458\n  number() {\n    let userList = JSON.stringify(this.data.userList)\n    wx.navigateTo({\n      url: '..\/member\/member?qunId=' + qunId,\n    })\n  },\n  bottom: function() {\n    var that = this;\n    this.setData({\n      scrollTop: 100000\n    })\n  },\n  \/\/ \u52a8\u6001\u76d1\u542c\u7981\u8a00\u72b6\u6001\n  prohibit() {\n    console.log('8888888888888', qunId)\n    const watcher = DB.collection('qunList')\n      .where({\n        _id: qunId\n      })\n      .watch({\n        onChange: function(res) {\n\n          let arr = res.docs[0]\n          console.log('\u52a8\u6001\u76d1\u542c\u7981\u8a00\u72b6\u6001', arr._openId + ':' + wx.getStorageSync('openId'))\n          let opid = arr._openId\n          if (arr.prohibit == '1') {\n            if (arr._openId == wx.getStorageSync('openId')) {\n              that.setData({\n                prohibit: '0'\n              })\n            } else {\n              that.setData({\n                prohibit: '1'\n              })\n            }\n          } else {\n            const watcher = DB.collection('qunUserList')\n              .where({\n                qunId: qunId,\n                _openId: wx.getStorageSync('openId')\n              })\n              .watch({\n                onChange: function(res) {\n\n                  let arrr = res.docs[0]\n                  console.log('\u52a8\u6001\u76d1\u542c\u7981\u8a00\u72b6\u6001', arrr._openId + ':' + wx.getStorageSync('openId'))\n                  if (arrr.prohibit == '1') {\n                    if (arrr._openId == opid) {\n                      that.setData({\n                        prohibit: '0'\n                      })\n                    } else {\n                      that.setData({\n                        prohibit: '1'\n                      })\n                    }\n                  } else {\n                    that.setData({\n                      prohibit: '0'\n                    })\n                  }\n\n\n                },\n                onError: function(err) {\n                  \/\/ console.error('----------------error', err)\n                }\n              })\n          }\n\n\n        },\n        onError: function(err) {\n          \/\/ console.error('----------------error', err)\n        }\n      })\n  },\n\n  \/\/ \u7981\u8a00\u63d0\u793a\n  prohibitTis() {\n    wx.showToast({\n      title: '\u7981\u8a00\u4e2d......',\n      icon: 'none'\n    })\n  },\n  \/\/ \u83b7\u53d6\u6210\u5458\u6d88\u606f\n  onMsg(qunId) {\n    console.log('2222222', qunId)\n    const watcher = DB.collection('news')\n      \/\/ \u6309 progress \u964d\u5e8f\n      \/\/ .orderBy('progress', 'desc')\n      \/\/ \u53d6\u6309 orderBy \u6392\u5e8f\u4e4b\u540e\u7684\u524d 10 \u4e2a\n      \/\/ .limit(10)\n      .where({\n        _qunId: qunId\n      })\n      .watch({\n        onChange: function(snapshot) {\n          console.log('snapshot', snapshot)\n          var listArr = snapshot.docs;\n          console.log('---', listArr)\n          listArr.forEach((item, idx) =&gt; {\n            console.log('---', item)\n            console.log(wx.getStorageSync('openId') + ':' + item._openId)\n            item.type = wx.getStorageSync('openId') == item._openId ? 1 : 2;\n            item.sendOutname = wx.getStorageSync('openId') == item._openId ? '\u6211' : '';\n          })\n\n          that.setData({\n            list: listArr\n          })\n          setTimeout(() =&gt; {\n            that.bottom()\n          }, 500)\n          console.log('-----------------------s', listArr)\n        },\n        onError: function(err) {\n          console.error('----------------error', err)\n        }\n      })\n  },\n  \/\/ \u53d1\u9001\u56fe\u7247\n  upLoad() {\n    var that = this\n    \/\/ \u8ba9\u7528\u6237\u9009\u62e9\u4e00\u5f20\u56fe\u7247\n    wx.chooseImage({\n      success: chooseResult =&gt; {\n        \/\/ \u5c06\u56fe\u7247\u4e0a\u4f20\u81f3\u4e91\u5b58\u50a8\u7a7a\u95f4\n        wx.cloud.uploadFile({\n          \/\/ \u6307\u5b9a\u4e0a\u4f20\u5230\u7684\u4e91\u8def\u5f84\n          cloudPath: util.imgName() + 'textImg.png',\n          \/\/ \u6307\u5b9a\u8981\u4e0a\u4f20\u7684\u6587\u4ef6\u7684\u5c0f\u7a0b\u5e8f\u4e34\u65f6\u6587\u4ef6\u8def\u5f84\n          filePath: chooseResult.tempFilePaths[0],\n          \/\/ \u6210\u529f\u56de\u8c03\n          success: res =&gt; {\n            console.log('\u4e0a\u4f20\u6210\u529f', res)\n            let imgUrl = res.fileID\n            wx.cloud.callFunction({\n              name: \"news\",\n              \/\/ data: {\n              \/\/   imgUrl: imgUrl\n              \/\/ },\n              data: {\n                _qunId: qunId,\n                _openId: wx.getStorageSync('openId'),\n                \/\/ \u6d88\u606f\n                text: '',\n                \/\/ \u6d88\u606f\n                img: imgUrl,\n                \/\/ \u65f6\u95f4\n                dataTime: util.nowTime(),\n                \/\/ \u5934\u50cf\n                sendOutHand: wx.getStorageSync('userInfo').avatarUrl,\n                \/\/ \u6635\u79f0\n                sendOutname: wx.getStorageSync('userInfo').nickName\n              },\n              success(res) {\n                console.log('\u56fe\u7247\u53d1\u9001\u6210\u529f', res)\n              },\n              fail(res) {\n                console.log('\u8fd4\u56de\u5931\u8d25', res)\n              }\n            })\n          },\n        })\n      },\n    })\n  },\n  onLoad: function(options) {\n    console.log(options)\n    that = this\n    qunId = options.qunId\n    this.onMsg(options.qunId);\n    that.userFun()\n    that.prohibit()\n\n  },\n  \/\/ \u83b7\u53d6\u7fa4\u6210\u5458\n  userFun() {\n    DB.collection('qunUserList').where({\n        qunId: qunId\n      })\n      .get({\n        success: function(res) {\n          console.log(666666666, res)\n          that.setData({\n            userNumber: res.data.length,\n            userList: res.data\n          })\n\n        }\n      })\n  },\n\n  \/\/ \u7fa4\u516c\u544a\n  notice() {\n    wx.showModal({\n      title: '\u7fa4\u516c\u544a',\n      content: this.data.userList[0].qunTitle,\n      showCancel: false,\n      success(res) {\n        if (res.confirm) {\n          \/\/ console.log('\u7528\u6237\u70b9\u51fb\u786e\u5b9a')\n        }\n      }\n    })\n  },\n  \/\/ \u53d1\u9001\u6d88\u606f\n  sendOut(e) {\n    console.log(1111, e)\n    let title = e.detail.value\n    if (title == '') {\n      wx.showToast({\n        title: '\u8bf7\u8f93\u5165\u804a\u5929\u5185\u5bb9',\n        icon: 'none',\n      })\n    } else {\n      var data = {\n        _qunId: qunId,\n        _openId: wx.getStorageSync('openId'),\n        \/\/ \u6d88\u606f\n        text: title,\n        \/\/ \u6d88\u606f\n        img: '',\n        \/\/ \u65f6\u95f4\n        dataTime: util.nowTime(),\n        \/\/ \u5934\u50cf\n        sendOutHand: wx.getStorageSync('userInfo').avatarUrl,\n        \/\/ \u6635\u79f0\n        sendOutname: wx.getStorageSync('userInfo').nickName\n      }\n      console.log(data)\n      wx.cloud.callFunction({\n        name: \"news\",\n        data: data,\n        success(res) {\n          console.log('\u6d88\u606f\u53d1\u9001', res)\n          that.setData({\n            title: ''\n          })\n\n        },\n        fail(res) {\n          console.log('\u767b\u5f55\u5931\u8d25', res)\n        }\n      })\n    }\n  },\n\n  \/**\n   * \u7528\u6237\u70b9\u51fb\u53f3\u4e0a\u89d2\u5206\u4eab\n   *\/\n  onShareAppMessage: function() {\n\n  },\n\n  \/\/ \u624b\u6307\u70b9\u51fb\u5f55\u97f3\n  voice_ing_start: function () {\n    console.log('\u624b\u6307\u70b9\u51fb\u5f55\u97f3')\n    wx.showToast({\n      title: '\u6309\u4f4f\u5f55\u97f3\uff0c\u677e\u5f00\u53d1\u9001',\n      icon: 'none'\n    })\n    this.setData({\n      voice_ing_start_date: new Date().getTime(), \/\/\u8bb0\u5f55\u5f00\u59cb\u70b9\u51fb\u7684\u65f6\u95f4\n    })\n    const options = {\n      duration: 10000, \/\/\u6307\u5b9a\u5f55\u97f3\u7684\u65f6\u957f\uff0c\u5355\u4f4d ms\n      sampleRate: 8000, \/\/\u91c7\u6837\u7387\n      numberOfChannels: 1, \/\/\u5f55\u97f3\u901a\u9053\u6570\n      encodeBitRate: 24000, \/\/\u7f16\u7801\u7801\u7387\n      format: 'mp3', \/\/\u97f3\u9891\u683c\u5f0f\uff0c\u6709\u6548\u503c aac\/mp3\n      audioSource: 'auto',\n      frameSize: 12, \/\/\u6307\u5b9a\u5e27\u5927\u5c0f\uff0c\u5355\u4f4d KB\n    }\n    recorder.start(options) \/\/\u5f00\u59cb\u5f55\u97f3\n\n    this.animation = wx.createAnimation({\n      duration: 1200,\n    }) \/\/\u64ad\u653e\u6309\u94ae\u52a8\u753b\n    that.animation.scale(0.8, 0.8); \/\/\u8fd8\u539f\n    that.setData({\n\n      spreakingAnimation: that.animation.export()\n    })\n  },\n  onReady: function () {\n    this.on_recorder();\n  },\n\n  \/\/ \u5f55\u97f3\u76d1\u542c\u4e8b\u4ef6\n  on_recorder: function () {\n    console.log('\u5f55\u97f3\u76d1\u542c\u4e8b\u4ef6');\n    recorder.onStart((res) =&gt; {\n      console.log('\u5f00\u59cb\u5f55\u97f3');\n    })\n    recorder.onStop((res) =&gt; {\n      let {\n        tempFilePath\n      } = res;\n      console.log('\u505c\u6b62\u5f55\u97f3,\u4e34\u65f6\u8def\u5f84', tempFilePath);\n      var x = new Date().getTime() - this.data.voice_ing_start_date\n      if (x &gt; 1000) {\n        let timestamp = new Date().getTime();\n        wx.cloud.uploadFile({\n          cloudPath: \"sounds\/\" + timestamp + '.mp3',\n          filePath: tempFilePath,\n          success: res =&gt; {\n            console.log('\u4e0a\u4f20\u6210\u529f', res)\n            that.setData({\n              soundUrl: res.fileID,\n            })\n\n            var data = {\n              _qunId: 'fb16f7905e4bfa24009098dc34b910c8',\n              _openId: wx.getStorageSync('openId'),\n              \/\/ \u6d88\u606f\n              text: '',\n              voice: res.fileID,\n              img: '',\n              \/\/ \u65f6\u95f4\n              dataTime: util.nowTime(),\n              \/\/ \u5934\u50cf\n              sendOutHand: wx.getStorageSync('userInfo').avatarUrl,\n              \/\/ \u6635\u79f0\n              sendOutname: wx.getStorageSync('userInfo').nickName\n            }\n            console.log(data)\n            wx.cloud.callFunction({\n              name: \"news\",\n              data: data,\n              success(res) {\n                console.log('\u53d1\u9001\u8bed\u97f3\u53d1\u9001', res)\n              },\n              fail(res) {\n                console.log('\u53d1\u9001\u8bed\u97f3\u5931\u8d25', res)\n              }\n            })\n          },\n        })\n      }\n    })\n    recorder.onFrameRecorded((res) =&gt; {\n      return\n      console.log('onFrameRecorded  res.frameBuffer', res.frameBuffer);\n      string_base64 = wx.arrayBufferToBase64(res.frameBuffer)\n\n      console.log('string_base64--', string_base64)\n    })\n  },\n  \/\/ \u624b\u6307\u677e\u5f00\u5f55\u97f3\n  voice_ing_end: function () {\n    console.log('\u624b\u6307\u677e\u5f00\u5f55\u97f3')\n\n    that.setData({\n      voice_icon_click: false,\n      animationData: {}\n    })\n    this.animation = \"\";\n    var x = new Date().getTime() - this.data.voice_ing_start_date\n    if (x &lt; 1000) {\n      console.log('\u5f55\u97f3\u505c\u6b62\uff0c\u8bf4\u8bdd\u5c0f\u4e8e1\u79d2\uff01')\n      wx.showModal({\n        title: '\u63d0\u793a',\n        content: '\u8bf4\u8bdd\u8981\u5927\u4e8e1\u79d2\uff01',\n      })\n      recorder.stop();\n    } else {\n      \/\/ \u5f55\u97f3\u505c\u6b62\uff0c\u5f00\u59cb\u4e0a\u4f20\n      recorder.stop();\n    }\n  },\n  \/\/ \u70b9\u51fb\u8bed\u97f3\u56fe\u7247\n  voice_icon_click: function () {\n    this.setData({\n      voice_icon_click: !this.data.voice_icon_click\n    })\n  },\n})<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<blockquote><p>\n  \u76f8\u5173\u514d\u8d39\u5b66\u4e60\u63a8\u8350\uff1a\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u5f00\u53d1\u6559\u7a0b\n<\/p><\/blockquote>\n<p>\u4ee5\u4e0a\u5c31\u662f\u4ecb\u7ecd\u5c0f\u7a0b\u5e8f\u804a\u5929\u7fa4\uff0c\u53d1\u9001\u8bed\u97f3\uff0c\u6587\u5b57\uff0c\u56fe\u7247\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8\u7c73\u4e91\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u53ef\u4ee5\u521b\u5efa\u7fa4\uff0c\u9080\u8bf7\u7fa4\u6210\u5458\uff0c\u7fa4\u6210\u5458\u5217\u8868\u5c55\u793a\uff0c\u56fe\u7247\u53d1\u9001\uff0c\u8bbe\u7f6e\u7fa4\u516c\u544a\uff0c\u8e22\u4eba\uff0c\u5168\u4f53\u7981\u8a00\uff0c\u4e2a\u4eba\u7981\u8a00\uff0c\u53d1\u9001\u8bed\u97f3\u4fe1\u606f\u7b49\u529f\u80fd\u3002 \u6548\u679c\u56fe\uff1a \u5b9e\u73b0\u4ee3\u7801\uff1a wxml &lt;view class=&#8221;bo&#8221;&gt; &lt;view class=&#8221;top_bo&#8221;&gt; &lt;view bindtap=&#8221;number&#8221;&gt;\u7fa4\u6210\u5458({{userNumber}})&lt;\/view&gt; &lt;view bindtap=&#8221;upLoad&#8221; wx:if=&#8221;{{prohibit==&#8217;0&#8242;}}&#8221;&gt;\u53d1\u56fe\u7247&lt;\/view&gt; &lt;view bindtap=&#8221;prohibitTis&#8221; wx:if=&#8221;{{prohibit==&#8217;1&#8242;}}&#8221;&gt;\u53d1\u56fe\u7247&lt;\/view&gt; &lt;view bindtap=&#8221;notice&#8221;&gt;\u7fa4\u516c\u544a&lt;\/view&gt; &lt;view bindtap=&#8221;goHome&#8221;&gt;\u53bb\u9996\u9875&lt;\/view&gt; &lt;\/view&gt; &lt;scroll-view scroll-y=&#8221;true&#8221; scroll-with-animation scroll-top=&#8221;{{scrollTop}}&#8221;&gt; &lt;block wx:if='{{!list}}&#8217;&gt; &lt;view class=&#8221;noList&#8221;&gt; &lt;view class=&#8221;noMsg&#8221;&gt;\u6682\u65e0\u804a\u5929\u6570\u636e&lt;\/view&gt; &lt;\/view&gt; &lt;\/block&gt; &lt;block wx:else&gt; &lt;view class=&#8221;body&#8221; wx:for='{{list}}&#8217; wx:key=&#8217;index&#8217;&gt; &lt;view wx:if='{{item.type==1}}&#8217; class=&#8221;right_body&#8221;&gt; &lt;view class=&#8221;flexRoe posRit&#8221;&gt; &lt;view class=&#8221;textBo&#8221;&gt; &lt;view class=&#8221;dataTime&#8221;&gt;{{item.sendOutname}} {{item.dataTime}}&lt;\/view&gt; &lt;view wx:if=&#8221;{{item.text!=&#8221;}}&#8221; class=&#8221;ritTxt&#8221;&gt;{{item.text}}&lt;\/view&gt; &lt;image wx:if=&#8221;{{item.img!=&#8221;}}&#8221; [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[19],"tags":[],"class_list":["post-33953","post","type-post","status-publish","format-standard","hentry","category-19"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/33953","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/comments?post=33953"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/33953\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=33953"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=33953"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=33953"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}