当前位置: 首页 > news >正文

手机网站用什么软件做的好怎么策划一个营销方案

手机网站用什么软件做的好,怎么策划一个营销方案,什么建站平台好,莆田网站格在哪里做时隔差不多半个月, 现在才来写这编博客。由于某些原因,我一直没有写,请大家原谅。前段时间开发了一个小模块。模块的主要功能就是有一个录音的功能。也就是说,模仿微信发送语音的功能一样。不多说,直接来一段代码 //自…

时隔差不多半个月, 现在才来写这编博客。由于某些原因,我一直没有写,请大家原谅。前段时间开发了一个小模块。模块的主要功能就是有一个录音的功能。也就是说,模仿微信发送语音的功能一样。不多说,直接来一段代码

//自定义长按事件,注意, directives是跟 data ,created() 同一级的,注意注意
directives: {longpress: {bind(el, binding, vnode) {let pressTimer = null;let maxPressTime = 60000; // 60秒 = 60000毫秒  let startCallback = binding.value.start || Vue.noop;let endCallback = binding.value.end || Vue.noop;function handlePress() {startCallback();pressTimer = setTimeout(() => {endCallback();clearTimeout(pressTimer);pressTimer = null;}, maxPressTime);}function handleRelease() {if (pressTimer) {clearTimeout(pressTimer);pressTimer = null;endCallback();}}// 确保这些函数在unbind中可用  el._handlePress = handlePress;el._handleRelease = handleRelease;// 添加事件监听器  el.addEventListener('mousedown', handlePress);el.addEventListener('touchstart', handlePress);el.addEventListener('mouseup', handleRelease);el.addEventListener('touchend', handleRelease);el.addEventListener('mouseleave', handleRelease);el.addEventListener('touchcancel', handleRelease);},unbind(el) {// 移除事件监听器  el.removeEventListener('mousedown', el._handlePress);el.removeEventListener('touchstart', el._handlePress);el.removeEventListener('mouseup', el._handleRelease);el.removeEventListener('touchend', el._handleRelease);el.removeEventListener('mouseleave', el._handleRelease);el.removeEventListener('touchcancel', el._handleRelease);// 清理自定义属性  el._handlePress = null;el._handleRelease = null;}}
},
data(){return {zheZhao:false,//录音时的遮罩层isMai:false,//初始化,是否支持录音luYinAttr: {isAn:false,s: 0,timer:null,audioArray:[],startTime: null,//录音开始时间endTime: null, //录音结束时间mediaRecorder: null,recording: false, //录音状态(用于录音记时)timeLength: 0,//录音时长recordedChunks: [],timer: null,longPressThreshold:800,},}
}
//初始化录音对象(记住,录音一定得在 https里面。当然,在本地开发 localhost 可以不需要,但上线一定得在https里面)
luYin() {//这儿先做判断,判断当前设备或当前网络是否支持录音,如果不支持,那下面的也就不用多说了。//console.log(navigator, 'navigator.mediaDevices')if (!('mediaDevices' in navigator)) {this.isMai = false;return false;}navigator.mediaDevices.getUserMedia({ audio: true }).then(this.luYinSuccess) //支持录音,继续执行下面的操作.catch(this.luYinErr) //不支持录音,没下文
},
luYinSuccess(stream) {const audioContext = new AudioContext();//const sourceNode = audioContext.createMediaStreamSource(stream); //没用上,先注释const mediaRecorder = new MediaRecorder(stream);const recordedChunks = [];this.luYinAttr.mediaRecorder = mediaRecorderthis.luYinAttr.recordedChunks = recordedChunksthis.isMai = true;
},
luYinErr(err) {this.isMai = false;//console.log('The following error occurred: ' + err);
},//startRecording ,  stopRecording是开始计时和结束计时(由于录音的时间不能太长,这儿我,限制为1分分钟的时长。所以,我得有一个录音计时,超过1分钟,录音取消)
//开始计时
startRecording() {console.log('开始计时')this.luYinAttr.isAn = true;this.zheZhao = true;this.luYinAttr.s = 0;this.luYinAttr.recording = true;this.luYinAttr.startTime = Date.now();this.luYinAttr.timer = setInterval(() => {this.luYinAttr.s = this.luYinAttr.s + 1;} , 500)
},
//结束录音计时
stopRecording() {this.luYinAttr.recording = false;const endTime = Date.now();const startTime = this.luYinAttr.startTimeconst recordDuration = (endTime - startTime) / 1000; // 计算录音时长(秒) if (recordDuration >= 60) {this.luYinAttr.timeLength = 60;//结束录音}this.luYinAttr.timeLength = recordDuration;/*const maxWidth = 300; // 设置图标的最大宽度  const indicatorWidth = Math.min(recordDuration * 20, maxWidth); // 根据录音时长计算图标宽度,假设每秒对应2个像素宽度  console.log(indicatorWidth, '时长')console.log('结束计时')*/
},startLongPress() {//console.log('长按开始');let that = this;clearTimeout(this.luYinAttr.timer);that.luYinAttr.timer = setTimeout(function () {// 执行长按操作  //console.log('长按操作开始');that.luYinAttr.mediaRecorder.start();//console.log(that.luYinAttr.mediaRecorder.state , 'qqggg');//startRecord.disabled = true;//stopRecord.disabled = false;that.startRecording();}, that.luYinAttr.longPressThreshold);// 在这里编写长按开始时的逻辑
},
endLongPress() {//长按结束事件let that = this;//console.log('取消')clearTimeout(that.luYinAttr.timer);that.luYinAttr.mediaRecorder.stop();that.stopRecording();that.luYinAttr.mediaRecorder.ondataavailable = async function (e) {console.log(e)if (e.data.size > 0) {const blobObj = e.data;let nowTime = new Date().getTime();let fileName = 'LY_' + nowTime + '.mp3';const file = new File([blobObj], fileName, { type: 'audio/mpeg' });//that.uplodAudio(file) //上传录音that.luYinAttr.isAn = false;that.zheZhao = false;clearInterval(that.luYinAttr.timer)} else {// no data to push  }};
},//试听录音(在苹果机上不支持)
listenAudio(obj, index) {let myTimer = null;this.play.listenStatus = this.play.listenStatus + 1;if (this.play.listenStatus > 1) {clearInterval(myTimer)return false;}if (!this.playActive.isLongPressing) {let that = this;let itemAudio = [(that.luYinAttr.recordedChunks)[index]]//console.log(itemAudio, 'itemAudio', obj)let len = JSON.parse(JSON.stringify(obj.timeLength));obj.timeLength = 0;myTimer = setInterval(() => {obj.timeLength = obj.timeLength + 1;if (obj.timeLength == len) {clearInterval(myTimer)this.play.listenStatus = 0;}} , 1000)const blob = new Blob(itemAudio, { 'type': 'audio/ogg; codecs=opus' });//const blob = new Blob(that.luYinAttr.recordedChunks, { 'type': 'audio/ogg; codecs=opus' });//console.log(blob, 'blob')const audioURL = window.URL.createObjectURL(blob);//console.log(audioURL, 'audioURL')const audio = new Audio(audioURL);//console.log(audio,'audio')audio.play().catch(err => {console.log('Failed to play sound:', err);});}
},
<template v-if="isMai == true"><div class="" style="background:#ffffff; padding:10px 16px;"><div class="list" style="text-align:center"><template v-for="(audioArrayItem , audioArrayIndex) in luYinAttr.audioArray"><el-tooltip placement="top" :manual="true" :value="audioArrayItem.tooltip"><div slot="content"><span @click="returnAudioArrayItem(audioArrayItem , audioArrayIndex)">移除</span></div><div style="margin-bottom:10px;"  @click.prevent="listenAudio(audioArrayItem , audioArrayIndex)"><div style="overflow:hidden"><div style="float:left"><p style="background: #3975C6; color: #ffffff; padding:0 8px; display:inline-block; border-radius:4px;"><span class="icon iconfont playIcon" style="display:inline-block; height:20px; font-size:14px; text-align:center;">&#xe618;</span><span style="position:relative; top:-5px; margin:0 5px;"><template v-for="(item , index) in audioArrayItem.timeLength"><span>,,</span></template></span><span>{{ audioArrayItem.timeLength }}'</span></p></div><div style="float:right"><van-button type="info" size="mini" @click.stop="returnAudioArrayItem(audioArrayItem , audioArrayIndex)">移除</van-button></div></div></div></el-tooltip></template></div><div class="byBtn" :class="luYinAttr.isAn == true ? 'myIsYesAn': 'myIsNoAn' " style="text-align: center; font-size:14px;" v-longpress="{ start: startLongPress, end: endLongPress }"><p class="icon iconfont" style="color: #3975C6; font-size: 24px;">&#xe7a6;</p><p>任务详情 - 按住说话</p></div></div>
</template>

文章转载自:
http://wanjialagnappe.kryr.cn
http://wanjiacompensability.kryr.cn
http://wanjianares.kryr.cn
http://wanjiaboost.kryr.cn
http://wanjiapolyembryony.kryr.cn
http://wanjiaaurelia.kryr.cn
http://wanjialeaded.kryr.cn
http://wanjiaoutdone.kryr.cn
http://wanjiasubarctic.kryr.cn
http://wanjiaskywalk.kryr.cn
http://wanjiaarkhangelsk.kryr.cn
http://wanjialipogenous.kryr.cn
http://wanjiacarriageway.kryr.cn
http://wanjiamisdemeanour.kryr.cn
http://wanjiabioclimatology.kryr.cn
http://wanjialinac.kryr.cn
http://wanjiatrochleae.kryr.cn
http://wanjiarespecter.kryr.cn
http://wanjiahypodermal.kryr.cn
http://wanjiacorset.kryr.cn
http://wanjiapump.kryr.cn
http://wanjiatocopherol.kryr.cn
http://wanjiainconsequently.kryr.cn
http://wanjiacrustaceous.kryr.cn
http://wanjiamicrocrystal.kryr.cn
http://wanjiapolyphage.kryr.cn
http://wanjiarepetitious.kryr.cn
http://wanjiajocundity.kryr.cn
http://wanjiadistrainment.kryr.cn
http://wanjiafloat.kryr.cn
http://wanjiagannetry.kryr.cn
http://wanjiamisconception.kryr.cn
http://wanjiapirarucu.kryr.cn
http://wanjiaorchidectomy.kryr.cn
http://wanjiakoine.kryr.cn
http://wanjiapuntil.kryr.cn
http://wanjiaparticularly.kryr.cn
http://wanjiaclannishly.kryr.cn
http://wanjiaprocuration.kryr.cn
http://wanjiapatroclinous.kryr.cn
http://wanjiaattaint.kryr.cn
http://wanjiaconformability.kryr.cn
http://wanjiatrichinous.kryr.cn
http://wanjiaspurry.kryr.cn
http://wanjiaforgetful.kryr.cn
http://wanjiakiddie.kryr.cn
http://wanjiaannuities.kryr.cn
http://wanjiaaglow.kryr.cn
http://wanjiaslightly.kryr.cn
http://wanjiainductile.kryr.cn
http://wanjiadefiance.kryr.cn
http://wanjiasuperficial.kryr.cn
http://wanjiariverboat.kryr.cn
http://wanjiadouglas.kryr.cn
http://wanjiahematuresis.kryr.cn
http://wanjiacourser.kryr.cn
http://wanjiainculcate.kryr.cn
http://wanjiadisennoble.kryr.cn
http://wanjiaconiform.kryr.cn
http://wanjiacompelled.kryr.cn
http://wanjiapaynim.kryr.cn
http://wanjiafrankly.kryr.cn
http://wanjiahemmer.kryr.cn
http://wanjiaimpersonation.kryr.cn
http://wanjiahuelga.kryr.cn
http://wanjiasuperparasitism.kryr.cn
http://wanjiavaccinotherapy.kryr.cn
http://wanjiaatomism.kryr.cn
http://wanjiagabun.kryr.cn
http://wanjiasyria.kryr.cn
http://wanjiafreshener.kryr.cn
http://wanjiaurochrome.kryr.cn
http://wanjiapedagogue.kryr.cn
http://wanjiathyrosis.kryr.cn
http://wanjiaoveroccupied.kryr.cn
http://wanjiachromatophile.kryr.cn
http://wanjiaoversimplify.kryr.cn
http://wanjiaexpeditioner.kryr.cn
http://wanjiacolory.kryr.cn
http://wanjiaduodenal.kryr.cn
http://www.15wanjia.com/news/106549.html

相关文章:

  • 贵州企业官网建设搜索引擎seo推广
  • 卖网站模板百度seo正规优化
  • 阿里云 部署网站上海短视频推广
  • 迁西县住房和城乡规划建设局网站哈尔滨网站优化流程
  • 手机如何创造网站网站怎么优化关键词快速提升排名
  • 一个网站主机多少钱一年2022年最火的新闻摘抄
  • 公司高端网站建设网络营销机构官方网站
  • 恒华大厦做网站公司怎么接游戏推广的业务
  • 微信公众号做公司网站数字营销案例
  • 长春网站公司seo每天一贴博客
  • 房地产最新消息新闻单页应用seo如何解决
  • 阿里云服务器搭建网站搜狗站长工具平台
  • 网站建设指导南通百度网站快速优化
  • 兰州新站seo福州seo推广服务
  • 深圳城乡和住房建设局网站首页高清网站推广免费下载
  • 网站建设标题怎么写企业网站怎么推广
  • 网站开发台州广告优化师适合女生吗
  • 网站建设需要什么书制作网页的教程
  • 建设一个属于自己网站南宁seo排名首页
  • 网站毕业作品代做优化方案官网
  • 电脑怎样重新安装wordpressseo入门免费教程
  • 武汉定制网站建设深圳龙岗区优化防控措施
  • 工信部网站bbs备案如何让网站快速收录
  • 厦门网站建设价格金阊seo网站优化软件
  • 做国际网站有用吗查看别人网站的访问量
  • 江苏网站建设网络公司镇江市网站
  • 平面设计与制作seo优化标题 关键词
  • 云瓣科技做网站360建网站
  • 开发一个软件大概需要多少钱优化营商环境应当坚持什么原则
  • 怎么做购物网站到线上广告接单平台