...
|
...
|
@@ -12,13 +12,14 @@ |
|
|
<!-- <img src="../../../assets/sharebtn.png" alt /> -->
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
<div class="nodata" v-if="recordlist.length == 0">暂无聊天记录</div>
|
|
|
<div class="listboxbox">
|
|
|
<div class="middlecontent">
|
|
|
<div class="nodata nodatatext" v-if="recordlist.length == 0">暂无聊天记录</div>
|
|
|
<van-pull-refresh
|
|
|
v-model="isLoading"
|
|
|
@refresh="onRefresh"
|
|
|
class="messagelist"
|
|
|
style="height:100%"
|
|
|
style="height: 100%"
|
|
|
id="messagebox"
|
|
|
v-else
|
|
|
>
|
...
|
...
|
@@ -106,7 +107,7 @@ |
|
|
class="messageitem messageitemk flex"
|
|
|
v-if="item.user_id == user_id"
|
|
|
:id="item.idkk"
|
|
|
@touchstart="gotouchstart(item)"
|
|
|
@touchstart.stop="gotouchstart(item)"
|
|
|
@touchmove="gotouchmove"
|
|
|
@touchend="gotouchend(item)"
|
|
|
>
|
...
|
...
|
@@ -180,19 +181,12 @@ |
|
|
</div>
|
|
|
</van-pull-refresh>
|
|
|
|
|
|
<!-- 底部导航 -->
|
|
|
|
|
|
<!-- <div class="messagebot messagebotkk flexone" v-if="is_self == 0 && isbot == true">
|
|
|
<div class="messagebotleft">
|
|
|
<img src="../../../assets/yuyin.png" alt />
|
|
|
</div>
|
|
|
<div class="writermessage">
|
|
|
<input type="text" placeholder="写留言" @input="entertext" :value="text" />
|
|
|
</div>
|
|
|
<div class="sendk" @click="send">发送</div>
|
|
|
</div>-->
|
|
|
<div v-if="is_self == 1">
|
|
|
<div class="messagebot messagebotkk flexone" v-if="sendword">
|
|
|
|
|
|
|
|
|
<!-- 底部导航 -->
|
|
|
<div v-if="is_self == 1" style="width:100%">
|
|
|
<div class="messagebotkk flexone" v-if="sendword" style="padding-bottom:0.12rem;box-sizing:border-box">
|
|
|
<div class="messagebotleft" @click="changeword">
|
|
|
<img src="../../../assets/yuyin.png" alt />
|
|
|
</div>
|
...
|
...
|
@@ -206,7 +200,7 @@ |
|
|
</div>
|
|
|
<div class="sendk" @click="send">发送</div>
|
|
|
</div>
|
|
|
<div class="messagebot messagebotk flextwo" v-else>
|
|
|
<div class="messagebotk flextwo" v-else>
|
|
|
<img
|
|
|
src="../../../assets/yuyin.png"
|
|
|
alt
|
...
|
...
|
@@ -225,7 +219,7 @@ |
|
|
class="yuyinbtn"
|
|
|
@click="yuyin"
|
|
|
/>
|
|
|
<div class style="position:relative">
|
|
|
<div class style="position: relative">
|
|
|
<input
|
|
|
type="file"
|
|
|
accept="audio/*"
|
...
|
...
|
@@ -242,6 +236,11 @@ |
|
|
/>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<!-- <div class="manypeople">
|
|
|
<img src="../../../assets/manypeople.png" alt class="manypeopleimg" />
|
|
|
{{ group_count }}
|
...
|
...
|
@@ -272,7 +271,7 @@ |
|
|
</div>
|
|
|
</div>
|
|
|
<!-- 开始录制 -->
|
|
|
<div class="register" style="z-index:999" v-if="beginlushow" @click="hide">
|
|
|
<div class="register" style="z-index: 999" v-if="beginlushow" @click="hide">
|
|
|
<div class="luwrap" @click.stop="beginluyin">
|
|
|
<div class="beginlu">开始录制</div>
|
|
|
<div>
|
...
|
...
|
@@ -282,7 +281,7 @@ |
|
|
</div>
|
|
|
|
|
|
<!-- 正在录制 -->
|
|
|
<div class="register" style="z-index:999" v-if="zhengzailu" @click="hide">
|
|
|
<div class="register" style="z-index: 999" v-if="zhengzailu" @click="hide">
|
|
|
<div class="luwrap" @click.stop="finishluyin">
|
|
|
<div class="beginlu">正在录音:{{ time }}'</div>
|
|
|
<div>
|
...
|
...
|
@@ -292,7 +291,7 @@ |
|
|
</div>
|
|
|
|
|
|
<!-- 录制完成 -->
|
|
|
<div class="register" style="z-index:999" v-if="luprocess" @click="hide">
|
|
|
<div class="register" style="z-index: 999" v-if="luprocess" @click="hide">
|
|
|
<div class="luwrap">
|
|
|
<div class="beginlu">录音时长:{{ time }}'</div>
|
|
|
<div class="flextwo chonglu">
|
...
|
...
|
@@ -304,7 +303,7 @@ |
|
|
</div>
|
|
|
|
|
|
<!-- 温馨提示 -->
|
|
|
<div class="register" style="z-index:999" v-if="chonglushow">
|
|
|
<div class="register" style="z-index: 999" v-if="chonglushow">
|
|
|
<div class="wentipswrap">
|
|
|
<div class="tipsname">温馨提示</div>
|
|
|
<div class="waittips">您确认舍弃该录音重新录制吗</div>
|
...
|
...
|
@@ -316,7 +315,7 @@ |
|
|
</div>
|
|
|
<!-- 本次录音是否上传 -->
|
|
|
|
|
|
<div class="register" style="z-index:999" v-if="shanghcuanshow">
|
|
|
<div class="register" style="z-index: 999" v-if="shanghcuanshow">
|
|
|
<div class="wentipswrap">
|
|
|
<div class="waittips benci">本次录音是否上传</div>
|
|
|
<div class="waitbot flexone">
|
...
|
...
|
@@ -327,7 +326,7 @@ |
|
|
</div>
|
|
|
<van-loading type="spinner" color="#1989fa" v-if="cardzheng" />
|
|
|
<!-- 是否结束录播 -->
|
|
|
<div class="register" style="z-index:999" v-if="overzhibo">
|
|
|
<div class="register" style="z-index: 999" v-if="overzhibo">
|
|
|
<div class="wentipswrap">
|
|
|
<div class="waittips benci">是否结束录播</div>
|
|
|
<div class="waitbot flexone">
|
...
|
...
|
@@ -340,9 +339,11 @@ |
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
var timeOutEvent = "";
|
|
|
import wx from "jweixin-1.6.0";
|
|
|
import Vue from "vue";
|
|
|
import { PullRefresh, Toast, Dialog, Loading } from "vant";
|
|
|
import { pushHistory } from '../../../utils/back.js';//监听返回上一页的判断
|
|
|
Vue.use(PullRefresh);
|
|
|
Vue.use(Toast);
|
|
|
Vue.use(Loading);
|
...
|
...
|
@@ -385,10 +386,12 @@ export default { |
|
|
stopindex: 0,
|
|
|
playlocalid: "",
|
|
|
cardzheng: false,
|
|
|
coursename: ""
|
|
|
coursename: "",
|
|
|
shitingshow:false
|
|
|
};
|
|
|
},
|
|
|
created() {
|
|
|
|
|
|
// 获取个人中心
|
|
|
this.getuserinfo();
|
|
|
// alert(location.host)
|
...
|
...
|
@@ -400,7 +403,7 @@ export default { |
|
|
// "/redirect.html?shareRedirect=" +
|
|
|
// encodeURIComponent(window.location.href))
|
|
|
this.coursename = this.$route.query.name;
|
|
|
document.title = "唐元集公众号";
|
|
|
document.title = "唐元集";
|
|
|
this.id = this.$route.query.id;
|
|
|
// 获取appid
|
|
|
this.getappid();
|
...
|
...
|
@@ -409,10 +412,10 @@ export default { |
|
|
// 获取直播列表
|
|
|
this.getzhibolist();
|
|
|
},
|
|
|
|
|
|
mounted() {
|
|
|
let that = this;
|
|
|
|
|
|
console.log(that.target, "99997878666");
|
|
|
this.onpopstate()
|
|
|
},
|
|
|
|
|
|
watch: {},
|
...
|
...
|
@@ -427,7 +430,36 @@ export default { |
|
|
next();
|
|
|
}
|
|
|
},
|
|
|
destroyed () {
|
|
|
// 当页面销毁必须要移除这个事件,vue不刷新页面,不移除会重复执行这个事件
|
|
|
window.removeEventListener("popstate", this.closeViews, false);
|
|
|
},
|
|
|
methods: {
|
|
|
// 监听页面卸载
|
|
|
// 监听历史记录点, 添加返回事件监听
|
|
|
onpopstate () {
|
|
|
pushHistory()
|
|
|
// 给window添加一个popstate事件,拦截返回键,执行this.closeViews事件,addEventListener需要指向一个方法
|
|
|
window.addEventListener("popstate", this.closeViews, false);
|
|
|
},
|
|
|
// 返回上一页
|
|
|
closeViews () {
|
|
|
console.log(4373474378)
|
|
|
this.$router.go(-1)
|
|
|
|
|
|
this.recordlist.forEach(function(value,index,array){
|
|
|
value.sel=false
|
|
|
})
|
|
|
this.recordlist=this.recordlist;
|
|
|
wx.stopVoice({
|
|
|
localId: this.playlocalid // 需要暂停的音频的本地ID,由stopRecord接口获得
|
|
|
});
|
|
|
wx.stopVoice({
|
|
|
localId: this.localId // 需要暂停的音频的本地ID,由stopRecord接口获得
|
|
|
});
|
|
|
this.$forceUpdate();
|
|
|
},
|
|
|
|
|
|
// 上传音频
|
|
|
afterRead(e) {
|
|
|
console.log(e);
|
...
|
...
|
@@ -437,12 +469,10 @@ export default { |
|
|
|
|
|
var formdata = new FormData();
|
|
|
formdata.append("file", file);
|
|
|
|
|
|
var url = "/api/common/upload";
|
|
|
|
|
|
that.$uploadFile
|
|
|
.post(url, formdata)
|
|
|
.then(function(res) {
|
|
|
.then(function (res) {
|
|
|
that.cardzheng = false;
|
|
|
console.log(res);
|
|
|
let objdata = {
|
...
|
...
|
@@ -453,7 +483,6 @@ export default { |
|
|
data: res.data.media
|
|
|
};
|
|
|
objdata = JSON.stringify(objdata);
|
|
|
|
|
|
that.websocketsend(objdata);
|
|
|
})
|
|
|
.catch(err => {
|
...
|
...
|
@@ -465,17 +494,16 @@ export default { |
|
|
//获取个人中心
|
|
|
getuserinfo() {
|
|
|
let that = this;
|
|
|
|
|
|
var url = "/api/user/index";
|
|
|
let param = {};
|
|
|
|
|
|
that.$axios
|
|
|
.post(url, param)
|
|
|
.then(function(res) {
|
|
|
.then(function (res) {
|
|
|
console.log(res);
|
|
|
that.user_id = res.data.id;
|
|
|
})
|
|
|
.catch(function(err) {});
|
|
|
.catch(function (err) { });
|
|
|
},
|
|
|
|
|
|
// 列表自动滚到到底部
|
...
|
...
|
@@ -484,9 +512,7 @@ export default { |
|
|
let div = this.$refs["message-list"];
|
|
|
console.log(div.scrollHeight, 8887766543);
|
|
|
console.log(div.style.height, 9999);
|
|
|
|
|
|
this.height = div.clientHeight;
|
|
|
|
|
|
div.scrollTop = div.scrollHeight;
|
|
|
// let height = div.offsetHeight
|
|
|
// console.log(height, 9999888888)
|
...
|
...
|
@@ -545,7 +571,7 @@ export default { |
|
|
|
|
|
that.$axios
|
|
|
.post(url, param)
|
|
|
.then(function(res) {
|
|
|
.then(function (res) {
|
|
|
console.log(res);
|
|
|
wx.config({
|
|
|
debug: false,
|
...
|
...
|
@@ -559,7 +585,6 @@ export default { |
|
|
"stopRecord",
|
|
|
"playVoice",
|
|
|
"uploadVoice",
|
|
|
"playVoice",
|
|
|
"downloadVoice",
|
|
|
"stopVoice",
|
|
|
"chooseImage",
|
...
|
...
|
@@ -572,7 +597,7 @@ export default { |
|
|
|
|
|
that.sharetofriend();
|
|
|
})
|
|
|
.catch(function(err) {
|
|
|
.catch(function (err) {
|
|
|
console.log(err);
|
|
|
});
|
|
|
},
|
...
|
...
|
@@ -581,11 +606,11 @@ export default { |
|
|
sharetofriend() {
|
|
|
var that = this;
|
|
|
// 处理验证失败的信息
|
|
|
wx.error(function(res) {
|
|
|
logUtil.printLog("验证失败返回的信息:", res);
|
|
|
wx.error(function (res) {
|
|
|
// logUtil.printLog("验证失败返回的信息:", res);
|
|
|
});
|
|
|
// 处理验证成功的信息
|
|
|
wx.ready(function() {
|
|
|
wx.ready(function () {
|
|
|
// alert(window.location.href.split('#')[0]);
|
|
|
// var share_title = that.sharemsg.title;
|
|
|
// if (share_title.indexOf("${title}") >= 0) {
|
...
|
...
|
@@ -620,16 +645,16 @@ export default { |
|
|
|
|
|
// 分享图标
|
|
|
// desc: that.sharemsg.content,
|
|
|
success: function(res) {
|
|
|
success: function (res) {
|
|
|
// 用户确认分享后执行的回调函数
|
|
|
console.log("suss");
|
|
|
logUtil.printLog("分享到朋友圈成功返回的信息为:", res);
|
|
|
that.showMsg("分享成功!");
|
|
|
// logUtil.printLog("分享到朋友圈成功返回的信息为:", res);
|
|
|
// that.showMsg("分享成功!");
|
|
|
},
|
|
|
cancel: function(res) {
|
|
|
cancel: function (res) {
|
|
|
// 用户取消分享后执行的回调函数
|
|
|
console.log("err");
|
|
|
logUtil.printLog("取消分享到朋友圈返回的信息为:", res);
|
|
|
// logUtil.printLog("取消分享到朋友圈返回的信息为:", res);
|
|
|
}
|
|
|
}),
|
|
|
// 分享给朋友
|
...
|
...
|
@@ -649,13 +674,13 @@ export default { |
|
|
// 分享图标
|
|
|
type: "", // 分享类型,music、video或link,不填默认为link
|
|
|
dataUrl: "", // 如果type是music或video,则要提供数据链接,默认为空
|
|
|
success: function(res) {
|
|
|
success: function (res) {
|
|
|
// 用户确认分享后执行的回调函数
|
|
|
logUtil.printLog("分享给朋友成功返回的信息为:", res);
|
|
|
// logUtil.printLog("分享给朋友成功返回的信息为:", res);
|
|
|
},
|
|
|
cancel: function(res) {
|
|
|
cancel: function (res) {
|
|
|
// 用户取消分享后执行的回调函数
|
|
|
logUtil.printLog("取消分享给朋友返回的信息为:", res);
|
|
|
// logUtil.printLog("取消分享给朋友返回的信息为:", res);
|
|
|
}
|
|
|
});
|
|
|
});
|
...
|
...
|
@@ -668,13 +693,13 @@ export default { |
|
|
count: 1, // 默认9
|
|
|
sizeType: ["original", "compressed"], // 可以指定是原图还是压缩图,默认二者都有
|
|
|
sourceType: ["album", "camera"], // 可以指定来源是相册还是相机,默认二者都有
|
|
|
success: function(res) {
|
|
|
success: function (res) {
|
|
|
var localIds = res.localIds; // 返回选定照片的本地ID列表,localId可以作为img标签的src属性显示图片
|
|
|
|
|
|
wx.uploadImage({
|
|
|
localId: localIds[0], // 需要上传的图片的本地ID,由chooseImage接口获得
|
|
|
isShowProgressTips: 1, // 默认为1,显示进度提示
|
|
|
success: function(res) {
|
|
|
success: function (res) {
|
|
|
var serverId = res.serverId; // 返回图片的服务器端ID
|
|
|
that.serverId = res.serverId;
|
|
|
that.upload();
|
...
|
...
|
@@ -686,8 +711,7 @@ export default { |
|
|
|
|
|
upload() {
|
|
|
let that = this;
|
|
|
console.log(34734894890);
|
|
|
alert(that.serverId);
|
|
|
|
|
|
var url = "/api/user/upload_media";
|
|
|
let param = {
|
|
|
type: 1,
|
...
|
...
|
@@ -696,7 +720,7 @@ export default { |
|
|
|
|
|
that.$axios
|
|
|
.post(url, param)
|
|
|
.then(function(res) {
|
|
|
.then(function (res) {
|
|
|
console.log(res);
|
|
|
that.videourl = res.data.media;
|
|
|
let objdata = {
|
...
|
...
|
@@ -711,8 +735,8 @@ export default { |
|
|
that.websocketsend(objdata);
|
|
|
// alert(that.videourl)
|
|
|
})
|
|
|
.catch(function(err) {
|
|
|
alert(err);
|
|
|
.catch(function (err) {
|
|
|
|
|
|
console.log(err);
|
|
|
});
|
|
|
},
|
...
|
...
|
@@ -731,9 +755,14 @@ export default { |
|
|
this.beginlushow = false;
|
|
|
this.zhengzailu = false;
|
|
|
this.luprocess = false;
|
|
|
clearInterval(timer)
|
|
|
this.time = 1
|
|
|
wx.pauseVoice({
|
|
|
localId: that.localId // 需要暂停的音频的本地ID,由stopRecord接口获得
|
|
|
});
|
|
|
wx.stopVoice({
|
|
|
localId: that.localId // 需要暂停的音频的本地ID,由stopRecord接口获得
|
|
|
});
|
|
|
},
|
|
|
// 返回上一页
|
|
|
back() {
|
...
|
...
|
@@ -764,8 +793,16 @@ export default { |
|
|
yuyin() {
|
|
|
this.beginlushow = true;
|
|
|
this.yuyintype = 1;
|
|
|
this.recordlist.forEach(function(value,index,array){
|
|
|
value.sel=false
|
|
|
})
|
|
|
this.recordlist=this.recordlist;
|
|
|
this.$forceUpdate();
|
|
|
wx.stopVoice({
|
|
|
localId: this.playlocalid // 需要暂停的音频的本地ID,由stopRecord接口获得
|
|
|
});
|
|
|
},
|
|
|
// 开始录制
|
|
|
|
|
|
// 开始录音
|
|
|
beginluyin() {
|
|
|
console.log(83434898989);
|
...
|
...
|
@@ -775,13 +812,25 @@ export default { |
|
|
let time = 0;
|
|
|
timer = setInterval(() => {
|
|
|
time++;
|
|
|
console.log(time,'计时')
|
|
|
that.time = time;
|
|
|
console.log(that.time);
|
|
|
if (that.time == 60) {
|
|
|
clearInterval(timer);
|
|
|
this.zhengzailu = false;
|
|
|
this.luprocess = true;
|
|
|
wx.stopRecord({
|
|
|
success: function (res) {
|
|
|
var localId = res.localId;
|
|
|
that.localId = res.localId;
|
|
|
that.upyuyin();
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
}, 1000);
|
|
|
wx.startRecord({
|
|
|
success: function(res) {
|
|
|
success: function (res) {
|
|
|
// alert(JSON.stringify(res))
|
|
|
consoel.log(res, 99977775655);
|
|
|
|
|
|
// alert('成功调起录音')
|
|
|
// that.timer = setInterval(() => {
|
|
|
// time++;
|
...
|
...
|
@@ -789,7 +838,7 @@ export default { |
|
|
// }, 1000)
|
|
|
// that.vicoeEnd()
|
|
|
},
|
|
|
cancel: function() {
|
|
|
cancel: function () {
|
|
|
// alert("用户拒绝授权录音");
|
|
|
}
|
|
|
});
|
...
|
...
|
@@ -804,7 +853,7 @@ export default { |
|
|
clearInterval(timer);
|
|
|
|
|
|
wx.stopRecord({
|
|
|
success: function(res) {
|
|
|
success: function (res) {
|
|
|
var localId = res.localId;
|
|
|
that.localId = res.localId;
|
|
|
that.upyuyin();
|
...
|
...
|
@@ -813,9 +862,17 @@ export default { |
|
|
},
|
|
|
// 试听录音
|
|
|
shiting() {
|
|
|
wx.playVoice({
|
|
|
localId: this.localId // 需要播放的音频的本地ID,由stopRecord接口获得
|
|
|
this.shitingshow=!this.shitingshow;
|
|
|
if(this.shitingshow==true){
|
|
|
wx.playVoice({
|
|
|
localId: this.localId // 需要播放的音频的本地ID,由stopRecord接口获得
|
|
|
});
|
|
|
}else{
|
|
|
wx.stopVoice({
|
|
|
localId: this.localId // 需要暂停的音频的本地ID,由stopRecord接口获得
|
|
|
});
|
|
|
}
|
|
|
|
|
|
},
|
|
|
// 结束本次上传
|
|
|
hideshangchuan() {
|
...
|
...
|
@@ -824,9 +881,7 @@ export default { |
|
|
// 发送语音
|
|
|
sendyuyin() {
|
|
|
// 发送语音
|
|
|
|
|
|
let that = this;
|
|
|
|
|
|
this.shanghcuanshow = false;
|
|
|
that.luprocess = false;
|
|
|
// this.issuccess = true
|
...
|
...
|
@@ -838,6 +893,11 @@ export default { |
|
|
data: that.serverId
|
|
|
};
|
|
|
objdata = JSON.stringify(objdata);
|
|
|
that.time = 1
|
|
|
wx.stopVoice({
|
|
|
localId: that.localId // 需要暂停的音频的本地ID,由stopRecord接口获得
|
|
|
});
|
|
|
// alert("发送的语音")
|
|
|
// alert(objdata);
|
|
|
that.websocketsend(objdata);
|
|
|
// this.shanghcuanshow = true
|
...
|
...
|
@@ -846,7 +906,6 @@ export default { |
|
|
},
|
|
|
shangyuyin() {
|
|
|
let that = this;
|
|
|
|
|
|
this.shanghcuanshow = false;
|
|
|
that.luprocess = false;
|
|
|
this.issuccess = true;
|
...
|
...
|
@@ -867,7 +926,7 @@ export default { |
|
|
wx.uploadVoice({
|
|
|
localId: that.localId, // 需要上传的音频的本地ID,由stopRecord接口获得
|
|
|
isShowProgressTips: 1, // 默认为1,显示进度提示
|
|
|
success: function(res) {
|
|
|
success: function (res) {
|
|
|
var serverId = res.serverId; // 返回音频的服务器端ID
|
|
|
that.serverId = res.serverId;
|
|
|
// alert(that.serverId);
|
...
|
...
|
@@ -882,6 +941,9 @@ export default { |
|
|
this.luprocess = false;
|
|
|
this.beginlushow = true;
|
|
|
clearInterval(this.timer);
|
|
|
wx.stopVoice({
|
|
|
localId: this.localId // 需要暂停的音频的本地ID,由stopRecord接口获得
|
|
|
});
|
|
|
},
|
|
|
// 停止直播
|
|
|
stopbtn() {
|
...
|
...
|
@@ -917,11 +979,11 @@ export default { |
|
|
|
|
|
that.$axios
|
|
|
.post(url, param)
|
|
|
.then(function(res) {
|
|
|
.then(function (res) {
|
|
|
console.log(res);
|
|
|
that.is_self = res.data.lesson.is_self;
|
|
|
})
|
|
|
.catch(function(err) {
|
|
|
.catch(function (err) {
|
|
|
console.log(err);
|
|
|
});
|
|
|
},
|
...
|
...
|
@@ -939,15 +1001,17 @@ export default { |
|
|
websocketonopen() {
|
|
|
//连接建立之后执行send方法发送数据
|
|
|
console.log("连接成功");
|
|
|
this.cardzheng=false
|
|
|
},
|
|
|
websocketonerror() {
|
|
|
//连接建立失败重连
|
|
|
this.initWebSocket();
|
|
|
},
|
|
|
websocketonmessage(e) {
|
|
|
// alert('接收数据')
|
|
|
|
|
|
//数据接收
|
|
|
let that = this;
|
|
|
|
|
|
if (this.number == 0) {
|
|
|
let obj = {
|
|
|
lesson_id: this.id,
|
...
|
...
|
@@ -958,27 +1022,28 @@ export default { |
|
|
obj = JSON.stringify(obj);
|
|
|
console.log(obj);
|
|
|
this.websocketsend(obj);
|
|
|
|
|
|
// let data=e.
|
|
|
}
|
|
|
this.number = this.number + 1;
|
|
|
this.number = this.number;
|
|
|
let datak = e.data;
|
|
|
console.log(e, 88890999);
|
|
|
console.log(e.data);
|
|
|
// alert(e.data)
|
|
|
// alert(e.data.first)
|
|
|
let data = JSON.parse(e.data);
|
|
|
// alert(data)
|
|
|
console.log(data);
|
|
|
that.group_count = data.group_count;
|
|
|
|
|
|
|
|
|
if (data.group_count) {
|
|
|
that.group_count = data.group_count;
|
|
|
}
|
|
|
|
|
|
// 接收数据重新渲染列表
|
|
|
if (data.lesson_id != undefined) {
|
|
|
const redata = JSON.parse(e.data);
|
|
|
|
|
|
console.log(redata,'返回的数据返回的数据');
|
|
|
console.log(redata);
|
|
|
that.group_count = redata.group_count;
|
|
|
if (redata.code == 9) {
|
|
|
that.recordlist.forEach(function(value, index, array) {
|
|
|
that.recordlist.forEach(function (value, index, array) {
|
|
|
if (value.id == redata.id) {
|
|
|
that.recordlist.splice(index, 1);
|
|
|
that.recordlist = that.recordlist;
|
...
|
...
|
@@ -988,9 +1053,12 @@ export default { |
|
|
} else if (redata.code == 0) {
|
|
|
Toast(redata.msg);
|
|
|
} else if (redata.code == 1) {
|
|
|
// alert('push 进去了')
|
|
|
|
|
|
that.recordlist.push(redata);
|
|
|
that.recordlist = that.recordlist;
|
|
|
that.$forceUpdate();
|
|
|
console.log(that.recordlist);
|
|
|
that.$nextTick(() => {
|
|
|
var div = document.getElementById("messagebox");
|
|
|
var div = document.getElementsByClassName("messageitem");
|
...
|
...
|
@@ -999,8 +1067,10 @@ export default { |
|
|
div[len].scrollIntoView();
|
|
|
});
|
|
|
} else if (redata.code == 2) {
|
|
|
console.log('返回上一页')
|
|
|
that.$router.go(-1);
|
|
|
}
|
|
|
|
|
|
}
|
|
|
},
|
|
|
websocketsend(Data) {
|
...
|
...
|
@@ -1009,8 +1079,11 @@ export default { |
|
|
this.websock.send(Data);
|
|
|
},
|
|
|
websocketclose(e) {
|
|
|
this.number = 0
|
|
|
this.initWebSocket();
|
|
|
//关闭
|
|
|
console.log("断开连接", e);
|
|
|
this.cardzheng=true
|
|
|
},
|
|
|
// 获取直播列表
|
|
|
getzhibolist() {
|
...
|
...
|
@@ -1024,13 +1097,13 @@ export default { |
|
|
|
|
|
that.$axios
|
|
|
.post(url, param)
|
|
|
.then(function(res) {
|
|
|
.then(function (res) {
|
|
|
console.log(res, "直播列表");
|
|
|
if (that.page == 1) {
|
|
|
// 页面滚动到某一个位置
|
|
|
let len = res.data.record.length;
|
|
|
len = len - 1;
|
|
|
res.data.record.forEach(function(value, index, array) {
|
|
|
res.data.record.forEach(function (value, index, array) {
|
|
|
if (index == len) {
|
|
|
value.idkk = "targetboxk";
|
|
|
that.$nextTick(() => {
|
...
|
...
|
@@ -1049,25 +1122,29 @@ export default { |
|
|
// 拼接数组倒叙
|
|
|
var arr = [...res.data.record, ...that.recordlist];
|
|
|
that.recordlist = arr;
|
|
|
that.recordlist.forEach(function(value, index, array) {
|
|
|
that.recordlist.forEach(function (value, index, array) {
|
|
|
value.sel = false;
|
|
|
});
|
|
|
that.recordlist = that.recordlist;
|
|
|
that.this_page = res.data.this_page;
|
|
|
that.total_page = res.data.total_page;
|
|
|
})
|
|
|
.catch(function(err) {
|
|
|
.catch(function (err) {
|
|
|
console.log(err);
|
|
|
});
|
|
|
},
|
|
|
audioplay(item, index) {
|
|
|
let that = this;
|
|
|
console.log(item);
|
|
|
var botime=0
|
|
|
var intervl=setInterval(function(){
|
|
|
botime++;
|
|
|
},1000)
|
|
|
// 播放某一个语音
|
|
|
|
|
|
// that.recordlist[index].sel = !that.recordlist[index].sel;
|
|
|
|
|
|
that.recordlist.forEach(function(value, indexk, array) {
|
|
|
that.recordlist.forEach(function (value, indexk, array) {
|
|
|
if (index == indexk) {
|
|
|
that.recordlist[indexk].sel = !that.recordlist[indexk].sel;
|
|
|
} else {
|
...
|
...
|
@@ -1083,37 +1160,24 @@ export default { |
|
|
if (this.recordlist[index].sel == true) {
|
|
|
// 开始播放
|
|
|
let localId = "";
|
|
|
// alert(JSON.stringify(item.data))
|
|
|
wx.downloadVoice({
|
|
|
serverId: item.data, // 需要下载的音频的服务器端ID,由uploadVoice接口获得
|
|
|
isShowProgressTips: 1, // 默认为1,显示进度提示
|
|
|
success: function(res) {
|
|
|
success: function (res) {
|
|
|
// alert(JSON.stringify(res))
|
|
|
localId = res.localId; // 返回音频的本地ID
|
|
|
that.playlocalid = localId;
|
|
|
that.recordlist[index].localId = localId;
|
|
|
that.recordlist = that.recordlist;
|
|
|
that.$forceUpdate();
|
|
|
|
|
|
wx.playVoice({
|
|
|
localId: localId // 需要播放的音频的本地ID,由stopRecord接口获得
|
|
|
});
|
|
|
},fail: function(err) {
|
|
|
alert(JSON.stringify(err))
|
|
|
}
|
|
|
});
|
|
|
|
|
|
// if (this.recordlist[index].data != that.stopurl) {
|
|
|
// wx.downloadVoice({
|
|
|
// serverId: this.recordlist[index].data, // 需要下载的音频的服务器端ID,由uploadVoice接口获得
|
|
|
// isShowProgressTips: 1, // 默认为1,显示进度提示
|
|
|
// success: function (res) {
|
|
|
|
|
|
// wx.stopVoice({
|
|
|
// localId: res.localId // 需要停止的音频的本地ID,由stopRecord接口获得
|
|
|
// });
|
|
|
|
|
|
// }
|
|
|
|
|
|
// });
|
|
|
|
|
|
// }
|
|
|
} else if (this.recordlist[index].sel == false) {
|
|
|
// 停止播放
|
|
|
wx.stopVoice({
|
...
|
...
|
@@ -1122,10 +1186,10 @@ export default { |
|
|
}
|
|
|
// 监听播放停止播放下一个
|
|
|
wx.onVoicePlayEnd({
|
|
|
success: function(res) {
|
|
|
success: function (res) {
|
|
|
var localId = res.localId; // 返回音频的本地ID
|
|
|
|
|
|
that.recordlist.forEach(function(value, index, array) {
|
|
|
that.recordlist.forEach(function (value, index, array) {
|
|
|
if (localId == value.localId) {
|
|
|
value.sel = false;
|
|
|
}
|
...
|
...
|
@@ -1135,26 +1199,29 @@ export default { |
|
|
that.$forceUpdate();
|
|
|
|
|
|
index = index + 1;
|
|
|
|
|
|
if (that.recordlist[index].data != undefined) {
|
|
|
if (that.recordlist[index].type == 3) {
|
|
|
that.recordlist[index].sel = true;
|
|
|
wx.downloadVoice({
|
|
|
serverId: that.recordlist[index].data, // 需要下载的音频的服务器端ID,由uploadVoice接口获得
|
|
|
isShowProgressTips: 1, // 默认为1,显示进度提示
|
|
|
success: function(res) {
|
|
|
let localId = res.localId; // 返回音频的本地ID
|
|
|
that.recordlist[index].localId = localId;
|
|
|
that.recordlist[index].sel = true;
|
|
|
that.recordlist = that.recordlist;
|
|
|
that.$forceUpdate();
|
|
|
wx.playVoice({
|
|
|
localId: localId // 需要暂停的音频的本地ID,由stopRecord接口获得
|
|
|
});
|
|
|
}
|
|
|
});
|
|
|
if(botime>=Number(item.times.split(".")[0])){
|
|
|
for (var i = index; i < that.recordlist.length; i++) {
|
|
|
if (that.recordlist[i].type == 3) {
|
|
|
index = i;
|
|
|
that.recordlist[i].sel = true;
|
|
|
wx.downloadVoice({
|
|
|
serverId: that.recordlist[i].data, // 需要下载的音频的服务器端ID,由uploadVoice接口获得
|
|
|
isShowProgressTips: 1, // 默认为1,显示进度提示
|
|
|
success: function (res) {
|
|
|
let localId = res.localId; // 返回音频的本地ID
|
|
|
that.recordlist[i].localId = localId;
|
|
|
that.recordlist[i].sel = true;
|
|
|
that.recordlist = that.recordlist;
|
|
|
that.$forceUpdate();
|
|
|
wx.playVoice({
|
|
|
localId: localId // 需要暂停的音频的本地ID,由stopRecord接口获得
|
|
|
});
|
|
|
}
|
|
|
});
|
|
|
return;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
that.recordlist = that.recordlist;
|
|
|
that.$forceUpdate();
|
|
|
}
|
...
|
...
|
@@ -1163,6 +1230,10 @@ export default { |
|
|
// 发送文字
|
|
|
send() {
|
|
|
// var ws = new WebSocket("ws://tangyuanji.t.brotop.cn:11001");
|
|
|
if(this.text==''){
|
|
|
Toast("请写留言")
|
|
|
return false
|
|
|
}
|
|
|
let objdata = {
|
|
|
lesson_id: this.id,
|
|
|
type: 1,
|
...
|
...
|
@@ -1178,12 +1249,14 @@ export default { |
|
|
// ws.send(objdata);
|
|
|
},
|
|
|
gotouchstart(item) {
|
|
|
// event.preventDefault();
|
|
|
window.event.stopPropagation()
|
|
|
let that = this;
|
|
|
clearTimeout(timeOutEvent); //清除定时器
|
|
|
timeOutEvent = 0;
|
|
|
timeOutEvent = setTimeout(function() {
|
|
|
timeOutEvent = setTimeout(function () {
|
|
|
Dialog.confirm({
|
|
|
title: "是否删除帖子"
|
|
|
title: "是否撤销帖子"
|
|
|
})
|
|
|
.then(res => {
|
|
|
console.log(item.id);
|
...
|
...
|
@@ -1200,7 +1273,7 @@ export default { |
|
|
objdata = JSON.stringify(objdata);
|
|
|
// alert(objdata)
|
|
|
that.websocketsend(objdata);
|
|
|
that.recordlist.forEach(function(value, index, array) {
|
|
|
that.recordlist.forEach(function (value, index, array) {
|
|
|
if (value.id == item.id) {
|
|
|
that.recordlist.splice(index, 1);
|
|
|
that.recordlist = that.recordlist;
|
...
|
...
|
@@ -1231,6 +1304,14 @@ export default { |
|
|
</script>
|
|
|
|
|
|
<style scoped>
|
|
|
.middlecontent{
|
|
|
width:100%;
|
|
|
flex:1;
|
|
|
overflow-y: scroll;
|
|
|
}
|
|
|
.nodatatext{
|
|
|
margin-top:4rem
|
|
|
}
|
|
|
.van-loading {
|
|
|
position: absolute;
|
|
|
top: 50%;
|
...
|
...
|
@@ -1407,7 +1488,7 @@ export default { |
|
|
box-sizing: border-box;
|
|
|
}
|
|
|
.messagebotk {
|
|
|
padding: 0.16rem 0.72rem;
|
|
|
padding:0 0.72rem;
|
|
|
box-sizing: border-box;
|
|
|
}
|
|
|
.messagebotkk {
|
...
|
...
|
@@ -1434,7 +1515,7 @@ export default { |
|
|
border-radius: 0.4rem;
|
|
|
box-shadow: 0 0.16rem 0.3rem 0 rgba(142, 190, 142, 0.33);
|
|
|
position: fixed;
|
|
|
bottom: 1.2rem;
|
|
|
bottom: 1.5rem;
|
|
|
right: 0.32rem;
|
|
|
z-index: 9;
|
|
|
}
|
...
|
...
|
@@ -1446,6 +1527,9 @@ export default { |
|
|
.messagelist {
|
|
|
/* height: 15rem; */
|
|
|
/* padding-bottom: 1.5rem; */
|
|
|
padding-top:1.4rem;
|
|
|
box-sizing: border-box;
|
|
|
overflow-y: scroll;
|
|
|
}
|
|
|
.contentimg {
|
|
|
width: 4.15rem;
|
...
|
...
|
@@ -1716,4 +1800,11 @@ export default { |
|
|
opacity: 1;
|
|
|
}
|
|
|
} */
|
|
|
.listboxbox{
|
|
|
display:flex;
|
|
|
flex-direction: column;
|
|
|
align-items: center;
|
|
|
justify-content: center;
|
|
|
height: 100vh;
|
|
|
}
|
|
|
</style> |
...
|
...
|
|