超碰中文网,91久久精品日日躁夜夜躁欧美,一区二区三区精品道,一区二区国产在线观看,亚洲精品中文字幕乱码一区二区,天天看片高清影视在线观看,久久99精品久久久久蜜桃,久久成人影视

VPS參考測評推薦
專注分享VPS主機優(yōu)惠信息
衡天云優(yōu)惠活動
熱網(wǎng)互聯(lián)2026年促銷活動
hostkvm優(yōu)惠促銷活動
zji優(yōu)惠促銷活動
QQGNET優(yōu)惠促銷活動
QQGNET優(yōu)惠促銷活動

引入小程序聊天群,發(fā)送語音、文字和圖片。

主機參考:VPS測評參考推薦/專注分享VPS服務器優(yōu)惠信息!若您是商家可以在本站進行投稿,查看詳情!此外我們還提供軟文收錄、PayPal代付、廣告贊助等服務,查看詳情!
我們發(fā)布的部分優(yōu)惠活動文章可能存在時效性,購買時建議在本站搜索商家名稱可查看相關文章充分了解該商家!若非中文頁面可使用Edge瀏覽器同步翻譯!PayPal代付/收錄合作

引入小程序聊天群,發(fā)送語音、文字和圖片。

您可以創(chuàng)建一個群,邀請群成員,顯示群成員列表,發(fā)送圖片,設置群公告,踢人,使所有人靜音,使個人靜音,發(fā)送語音消息等功能。

渲染:

實施代碼:

wxml

& lt視圖& gt& lt視圖& gt& lt視圖& gt群成員({ { {用戶編號} })& lt })《/view & gt;& lt視圖& gt發(fā)送圖片

page { background:# f2f2f 2;}.top _ bo { display:flex;背景:白色;flex -方向:排;}.top_bo視圖{ flex:1;font -大小:28rpxtext-align:居中;邊框:1rpx實心# cccline -高度:80rpx} scroll -view { height:82vh;/* padding -bottom:30 rpx;*/}.noList {背景:白色;margin -top:30 rpx;/*高度:230rpx*/寬度:100%;劃水-top:25%;}.noMsg { text -align:center;顏色:# 999;font -大小:28rpx}.inp {位置:絕對;底部:0;寬度:100%;背景:白色;高度:100rpx}.inp輸入{ background:# d0d0d 0;邊界-半徑:15rpxpadding -left:20 rpx;高度:84rpxmargin -top:10 rpx;寬度:94%;margin -left:2%;}.禁止{ background:# d0d0d 0;邊界-半徑:15rpxpadding -left:20 rpx;高度:84rpxmargin -top:10 rpx;寬度:94%;margin -left:2%;text-align:居中;line -高度:84rpx顏色:RGB(34,34,34);}.plaCC { margin -left:5r px;}.p_r { display: flexflex -方向:排;}.flex roe { display:flex;flex -方向:排;}.正文{寬度:100%;位置:相對;/*邊框:1rpx solid # ccc*//*高度:200rpx */}。right _ body { width:100%;/*邊框:1rpx純紅;*/padding:20 rpx;margin -top:50 rpx;}.left _ body { margin -top:50 rpx;}.posRit { right:20 rpx;}.text bo { width:620 rpx;text -align:right;}.lfBo { margin -left:10 rpx;}.ritxt { background:# 44426 a;填充:10 rpx 20 rpx 10 rpx 20 rpx;顏色:白色;邊框-半徑:15rpx 0 15rpx 15rpxmargin -top:20 rpx;浮動:對;max -寬度:500rpxword -wrap:break -word;text -align:left;}。ritt XT 2 {背景:白色;顏色:白色;邊框-半徑:15rpx 0 15rpx 15rpx填充:0 rpx 20 rpx 10 rpx 20 rpx;margin -top:20 rpx;浮動:對;max -寬度:500rpxword -wrap:break -word;text -align:left;}.lft txt { background:# 44426 a;填充:10 rpx 20 rpx 10 rpx 20 rpx;顏色:白色;邊框-半徑:0 rpx 15 rpx 15 rpx 15 rpx;margin -top:20 rpx;浮動:左;max -寬度:500rpxword -wrap:break -word;text -align:left;}。lfttxt 2 { background:# fff;填充:0 rpx 20 rpx 10 rpx 20 rpx;顏色:白色;邊框-半徑:0 rpx 15 rpx 15 rpx 15 rpx;margin -top:20 rpx;浮動:左;max -寬度:500rpxword -wrap:break -word;text -align:left;}.my _ audio { height:60 rpx;寬度:60rpxz-指數(shù):2;位置:相對;頂部:10rpx左:20rpxmargin -right:30 rpx;}.data time { font -size:28 rpx;}.text img { width:200 rpx;margin -top:5 rpx;}.頭部{寬度:80rpx高度:80rpx}._ {身高:130rpx寬度:100%;背景:# ccc}.inbo { display:flex;flex -方向:排;}.余音{ flex:1;line -高度:104rpxtext-align:居中;}.input { flex:5;}js

const DB = wx . cloud . database()var util = require(‘../../utils/util . js’);var recorder = wx . getrecordermanager();const inner audio context = wx . createinneraudio context()//獲取播放對象var qunId,thatPage(第{/* * *頁*/data頁的初始數(shù)據(jù):{列表:【】,用戶編號:“0”,用戶列表:【】,c:“& quot;,禁止:‘‘,},//單擊錄音開始播放事件my _ audio _ Click:function(e){ var src = e . current target . dataset . src;console . log(‘URL地址’,src);inner audio context . src = src inner audio context . seek(0);inner audio context . play();},//主頁gohome(){ wx . switch tab({ URL:‘.../group/group‘})},//組成員號(){ let userlist = JSON . stringify(this . data . userlist)wx . navigate to({ URL:‘../會員/會員?qunId =‘+qunId,})},bottom:function(){ var that = this;這個。setdata({ scroll top:100000 })},//動態(tài)監(jiān)視禁止狀態(tài){ console . log(‘888888888‘,qunId)const watcher = db . collection(‘qunList‘)。where({ _ id:qu NID })。watch({ onChange:function(RES){ let arr = RES . docs【0】console . log(‘動態(tài)監(jiān)視靜默狀態(tài)‘,arr。_ openId+‘:‘+wx . getstoragesync(‘openId‘)let opid = arr。_ openId if(arr . prohibit = =‘1‘){ if(arr。_ openId = = wx . getstoragesync(‘openId‘){ that . setdata({ prohibit:‘0‘})} else { that . setdata({ prohibit:‘1‘})} } else { const watcher = db . collection(‘qunUserList‘)。where({ qunId:qunId,_ openId:wx . getstoragesync(‘openId‘)})。watch({ onChange:function(RES){ let arrr = RES . docs【0】console . log(‘動態(tài)監(jiān)視靜默狀態(tài)’,arrr。_ openId+‘:‘+wx . getstoragesync(‘openId‘)if(arrr . prohibit = =‘1‘){ if(arrr。_ openId = = opid){ that . setdata({禁止:“0“})} else { that . setdata({禁止:“1“})} } else { that . setdata({禁止:“0“})} },onError: function(err){//console . error(‘-----------err‘,err)})} },on error:function,icon:‘none‘})},//按進度降序獲取msg(Qunid){ console . log(‘222222,Qunid)const watcher = db . collection(‘news‘)//上的成員消息。order by(‘progress’,desc)//取前10名。限制(10)。其中({_ qunid: qunid})按orderBy排序。。watch({ onChange:function(snapshot){ console . log(‘snapshot‘,snapshot)var listArr = snapshot . docs;console . log(‘---‘,list arr)list arr . foreach((item,idx)= & gt;{ console . log(‘---‘,item)console . log(wx . getstoragesync(‘openId‘)+‘:‘+item。_ openId)item . type = wx . getstoragesync(‘openId‘)= = item。_openId?1 : 2;item . send outname = wx . getstoragesync(‘openId‘)= = item。_openId?我“:”;})that . setdata({ list:listArr })setTimeout(()= & gt;{ that . bottom()},500)console . log(‘-----------------s‘,listArr)},on error:function(err){ console . error(‘---------------error‘,err)})} 652tempfile paths【0】,//成功回調(diào)成功:res = & gt{ console . log(‘上傳成功‘,RES)let imgur = RES . fileidwx . cloud . call function({ name:“news & quot;,// data: { // imgUrl: imgUrl // },data: { _qunId: qunId,_ OpenID:wx . getstoragesync(‘OpenID‘),//Message text:‘‘,// Message img: imgUrl,//time dataTime: util.nowTime(),//avatar send outhand:wx . getstoragesync(‘userinfo‘)。頭像URL,//昵稱send outname:wx . getstoragesync(‘userinfo‘)。昵稱},Success(RES){ console . log(‘圖片發(fā)送成功’,RES)},fail(RES){ console . log(‘返回失敗’,RES)} })},})},onLoad:function(options){ console . log(options)that = this qunId = options . qunId this . onmsg(options . qunId)that . user fun()that . prohibit()},//獲取組成員user fun(){ db . collection(‘qun userlist‘)。where({ qunid:qunid })。get({ success:function(RES))。{ console . log(66666666,RES)that . setdata({ user number:RES . data . length,Userlist:RES . data })}),//群公告notice(){ wx . show modal({ title:‘群公告’,content:this . data . Userlist【0】。qunTitle,showCancel: false,Success(RES){ if(RES . confirm){//console . log(‘用戶單擊確定‘)} },//發(fā)送消息Send out(E){ console . log(1111,E)let title = E . detail . value if(title = =‘){ wx . show toast({ title:‘請輸入聊天內(nèi)容‘,icon:‘頭像URL,//昵稱send outname:wx . getstoragesync(‘userinfo‘)。昵稱} console . log(data)wx . cloud . call function({ name:“news & quot;,data: data,success(RES){ console . log(‘消息發(fā)送’,RES)that . setdata({ title:‘}),F(xiàn)ail(RES){ console . log(‘登錄失敗’,RES)} } },/* *用戶點擊右上角分享*/onshareappmessage:function(){ },//手指點擊錄音voice _ ing _ start:function(){ console . loggetTime(),//記錄點擊開始的時間})const options = { duration:10000,//以ms為單位指定錄制持續(xù)時間sampleRate: 8000,//采樣率:numberOfChannels: 1,//錄制通道數(shù)為編碼比特率:24000,//編碼速率格式:‘MP3’,//音頻格式,有效值AAC/MP3音頻源:‘a(chǎn)uto’,幀大小:12,//指定幀大小,單位KB } recorder . Start(options)//開始錄制this.animation = wx .//Restore that . setdata({ spreading:that . animation . export()})},on ready:function(){ this . on _ recorder();},//記錄監(jiān)控事件on _ recorder:function(){ console . log(‘記錄監(jiān)控事件‘);recorder . onstar((RES)= & gt;{ console . log(‘開始錄制‘);})recorder . onstop((RES)= & gt;{ let { tempFilePath } = resconsole . log(‘停止記錄,臨時路徑‘,tempfile path);var x =新日期()getTime()-this . data . voice _ ing _ start _ date if(x & gt;1000){ let timestamp =新日期()。getTime();wx . cloud . uploadfile({ cloud path:& quot;聲音/& quot;+timestamp+“。MP3“,filePath: tempFilePath,success:RES = & gt;{ console . log(‘upload succeeded‘,RES)that . setdata({ soundurl:RES . fileid,})var data = { _ qunId:‘fb16f 7905 E4 BFA 24009098 DC 34 b 910 c8‘,_ openId:wx . getstoragesync(‘openId‘),//消息文本:‘‘,voice: res.fileID,img:‘‘‘,//time數(shù)據(jù)時間:util . now time(65頭像URL,//昵稱send outname:wx . getstoragesync(‘userinfo‘)。昵稱} console . log(data)wx . cloud . call function({ name:“news & quot;,data: data,success(RES){ console . log(‘發(fā)送語音進行發(fā)送,RES)},F(xiàn)ail(RES){ console . log(‘發(fā)送語音失敗,RES)} })recorder。onFrameRecorded((RES)=》{ return console . log(‘onFrameRecorded RES . frame buffer‘,RES . frame buffer);string _ base 64 = wx . arraybuffertobase 64(RES . frame buffer)console . log(‘string _ base 64--‘,string _ base 64)})},//手指釋放的錄音voice _ ing _ end:function(){ console . log(‘手指釋放的錄音‘)that . setdata({ voice _ icon _ click:false,動畫數(shù)據(jù):{ })this。動畫=“& quot;;var x =新日期()getTime()-this . data . voice _ ing _ start _ date if(x & lt;blockquote & gt& ltp & gt& ltstrong & gt相關免費學習推薦:

這幾篇文章你可能也喜歡:

本文由主機參考刊發(fā),轉載請注明:引入小程序聊天群,發(fā)送語音、文字和圖片。 http://www.k2270.com/114158.html

【騰訊云】領8888元采購禮包,搶爆款云服務器 每月 9元起,個人開發(fā)者加享折上折!
打賞
轉載請注明原文鏈接:主機參考 » 引入小程序聊天群,發(fā)送語音、文字和圖片。
主機參考僅做資料收集,不對商家任何信息及交易做信用擔保,購買前請注意風險,有交易糾紛請自行解決!請查閱:特別聲明

評論 搶沙發(fā)

評論前必須登錄!