...
|
...
|
@@ -13,7 +13,7 @@ |
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
<div class="nodata" v-if="recordlist.length==0">暂无聊天记录</div>
|
|
|
<div class="nodata" v-if="recordlist.length == 0">暂无聊天记录</div>
|
|
|
<van-pull-refresh
|
|
|
v-model="isLoading"
|
|
|
@refresh="onRefresh"
|
...
|
...
|
@@ -35,18 +35,18 @@ |
|
|
</div>-->
|
|
|
|
|
|
<div>
|
|
|
<div v-for="(item,index) in recordlist" :key="index">
|
|
|
<div class="messageitem flex" v-if="item.user_id!=user_id">
|
|
|
<div v-for="(item, index) in recordlist" :key="index">
|
|
|
<div class="messageitem flex" v-if="item.user_id != user_id">
|
|
|
<div class="messageitemleft">
|
|
|
<img :src="item.avatar" alt />
|
|
|
</div>
|
|
|
<div class="messageitemright" v-if="item.type==1">
|
|
|
<div class="messagecontent">{{item.data}}</div>
|
|
|
<div class="messageitemright" v-if="item.type == 1">
|
|
|
<div class="messagecontent">{{ item.data }}</div>
|
|
|
</div>
|
|
|
|
|
|
<div
|
|
|
class="messageitemright imgright"
|
|
|
v-if="item.type==2"
|
|
|
v-if="item.type == 2"
|
|
|
@click="previewimg(item.data)"
|
|
|
>
|
|
|
<div class="messagecontent">
|
...
|
...
|
@@ -56,38 +56,47 @@ |
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
<div class="messageitemright" v-if="item.type==3">
|
|
|
<div class="messageitemright" v-if="item.type == 3">
|
|
|
<div
|
|
|
class="messagecontent"
|
|
|
:style="{width:1.7+'rem'}"
|
|
|
v-if="item.times>0&&item.times<5"
|
|
|
@click="audioplay(item,index)"
|
|
|
:style="{ width: 1.7 + 'rem' }"
|
|
|
v-if="item.times > 0 && item.times < 5"
|
|
|
@click="audioplay(item, index)"
|
|
|
>
|
|
|
<div class="voice">
|
|
|
<div class="bg" :class="item.sel==true?'voicePlay':''"></div>
|
|
|
<div class="miaoshuk">{{item.times}}'</div>
|
|
|
<div
|
|
|
class="bg"
|
|
|
:class="item.sel == true ? 'voicePlay' : ''"
|
|
|
></div>
|
|
|
<div class="miaoshuk">{{ item.times }}'</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div
|
|
|
class="messagecontent"
|
|
|
:style="{width:2+'rem'}"
|
|
|
v-if="item.times>=5&&item.times<15"
|
|
|
@click="audioplay(item,index)"
|
|
|
:style="{ width: 2 + 'rem' }"
|
|
|
v-if="item.times >= 5 && item.times < 15"
|
|
|
@click="audioplay(item, index)"
|
|
|
>
|
|
|
<div class="voice">
|
|
|
<div class="bg" :class="item.sel==true?'voicePlay':''"></div>
|
|
|
<div class="miaoshuk">{{item.times}}'</div>
|
|
|
<div
|
|
|
class="bg"
|
|
|
:class="item.sel == true ? 'voicePlay' : ''"
|
|
|
></div>
|
|
|
<div class="miaoshuk">{{ item.times }}'</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div
|
|
|
class="messagecontent"
|
|
|
:style="{width:4.5+'rem'}"
|
|
|
v-if="item.times>=15"
|
|
|
@click="audioplay(item,index)"
|
|
|
:style="{ width: 4.5 + 'rem' }"
|
|
|
v-if="item.times >= 15"
|
|
|
@click="audioplay(item, index)"
|
|
|
>
|
|
|
<div class="voice">
|
|
|
<div class="bg" :class="item.sel==true?'voicePlay':''"></div>
|
|
|
<div class="miaoshuk">{{item.times}}'</div>
|
|
|
<div
|
|
|
class="bg"
|
|
|
:class="item.sel == true ? 'voicePlay' : ''"
|
|
|
></div>
|
|
|
<div class="miaoshuk">{{ item.times }}'</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
...
|
...
|
@@ -95,17 +104,21 @@ |
|
|
|
|
|
<div
|
|
|
class="messageitem messageitemk flex"
|
|
|
v-if="item.user_id==user_id"
|
|
|
v-if="item.user_id == user_id"
|
|
|
:id="item.idkk"
|
|
|
@touchstart="gotouchstart(item)"
|
|
|
@touchmove="gotouchmove"
|
|
|
@touchend="gotouchend(item)"
|
|
|
>
|
|
|
<div class="messageitemrightk" v-if="item.type==1">
|
|
|
<div class="messagecontentk">{{item.data}}</div>
|
|
|
<div class="messageitemrightk" v-if="item.type == 1">
|
|
|
<div class="messagecontentk">{{ item.data }}</div>
|
|
|
</div>
|
|
|
|
|
|
<div class="messageitemrightk" v-if="item.type==2" @click="previewimg(item.data)">
|
|
|
<div
|
|
|
class="messageitemrightk"
|
|
|
v-if="item.type == 2"
|
|
|
@click="previewimg(item.data)"
|
|
|
>
|
|
|
<div class="messagecontentk">
|
|
|
<div class="contentimg">
|
|
|
<img :src="item.data" alt />
|
...
|
...
|
@@ -114,38 +127,47 @@ |
|
|
</div>
|
|
|
<!-- v-clipboard:copy="that.serverId"
|
|
|
v-clipboard:success="onCopy"-->
|
|
|
<div class="messageitemrightk" v-if="item.type==3">
|
|
|
<div class="messageitemrightk" v-if="item.type == 3">
|
|
|
<div
|
|
|
class="messagecontentk yuyink"
|
|
|
:style="{width:1+'rem'}"
|
|
|
v-if="item.times>0&&item.times<5"
|
|
|
@click="audioplay(item,index)"
|
|
|
:style="{ width: 1 + 'rem' }"
|
|
|
v-if="item.times > 0 && item.times < 5"
|
|
|
@click="audioplay(item, index)"
|
|
|
>
|
|
|
<div class="voice voiceright">
|
|
|
<div class="bg" :class="item.sel==true?'voicePlay':''"></div>
|
|
|
<div class="miaoshu">{{item.times}}'</div>
|
|
|
<div
|
|
|
class="bg"
|
|
|
:class="item.sel == true ? 'voicePlay' : ''"
|
|
|
></div>
|
|
|
<div class="miaoshu">{{ item.times }}'</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div
|
|
|
class="messagecontentk yuyink"
|
|
|
:style="{width:2+'rem'}"
|
|
|
v-if="item.times>=5&&item.times<15"
|
|
|
@click="audioplay(item,index)"
|
|
|
:style="{ width: 2 + 'rem' }"
|
|
|
v-if="item.times >= 5 && item.times < 15"
|
|
|
@click="audioplay(item, index)"
|
|
|
>
|
|
|
<div class="voice voiceright">
|
|
|
<div class="bg" :class="item.sel==true?'voicePlay':''"></div>
|
|
|
<div class="miaoshu">{{item.times}}'</div>
|
|
|
<div
|
|
|
class="bg"
|
|
|
:class="item.sel == true ? 'voicePlay' : ''"
|
|
|
></div>
|
|
|
<div class="miaoshu">{{ item.times }}'</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div
|
|
|
class="messagecontentk yuyink"
|
|
|
:style="{width:4.5+'rem'}"
|
|
|
v-if="item.times>=15"
|
|
|
@click="audioplay(item,index)"
|
|
|
:style="{ width: 4.5 + 'rem' }"
|
|
|
v-if="item.times >= 15"
|
|
|
@click="audioplay(item, index)"
|
|
|
>
|
|
|
<div class="voice voiceright">
|
|
|
<div class="bg" :class="item.sel==true?'voicePlay':''"></div>
|
|
|
<div class="miaoshu">{{item.times}}'</div>
|
|
|
<div
|
|
|
class="bg"
|
|
|
:class="item.sel == true ? 'voicePlay' : ''"
|
|
|
></div>
|
|
|
<div class="miaoshu">{{ item.times }}'</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
...
|
...
|
@@ -175,19 +197,49 @@ |
|
|
<img src="../../../assets/yuyin.png" alt />
|
|
|
</div>
|
|
|
<div class="writermessage">
|
|
|
<input type="text" placeholder="写留言" @input="entertext" :value="text" />
|
|
|
<input
|
|
|
type="text"
|
|
|
placeholder="写留言"
|
|
|
@input="entertext"
|
|
|
:value="text"
|
|
|
/>
|
|
|
</div>
|
|
|
<div class="sendk" @click="send">发送</div>
|
|
|
</div>
|
|
|
<div class="messagebot messagebotk flextwo" v-else>
|
|
|
<img src="../../../assets/yuyin.png" alt class="zhibobtn" @click="changeword" />
|
|
|
<img src="../../../assets/pic.png" alt class="zhibobtn" @click="choseimg" />
|
|
|
<img src="../../../assets/luyin.png" alt class="yuyinbtn" @click="yuyin" />
|
|
|
<img
|
|
|
src="../../../assets/yuyin.png"
|
|
|
alt
|
|
|
class="zhibobtn"
|
|
|
@click="changeword"
|
|
|
/>
|
|
|
<img
|
|
|
src="../../../assets/pic.png"
|
|
|
alt
|
|
|
class="zhibobtn"
|
|
|
@click="choseimg"
|
|
|
/>
|
|
|
<img
|
|
|
src="../../../assets/luyin.png"
|
|
|
alt
|
|
|
class="yuyinbtn"
|
|
|
@click="yuyin"
|
|
|
/>
|
|
|
<div class style="position:relative">
|
|
|
<input type="file" accept="audio/*" @change="afterRead" class="upuinpin" />
|
|
|
<input
|
|
|
type="file"
|
|
|
accept="audio/*"
|
|
|
@change="afterRead"
|
|
|
class="upuinpin"
|
|
|
/>
|
|
|
<img src="../../../assets/shangchuan.png" alt class="zhibobtn" />
|
|
|
</div>
|
|
|
<img src="../../../assets/kaiguan.png" alt class="zhibobtn" @click="stopbtn" />
|
|
|
<img
|
|
|
src="../../../assets/kaiguan.png"
|
|
|
alt
|
|
|
class="zhibobtn"
|
|
|
@click="stopbtn"
|
|
|
/>
|
|
|
</div>
|
|
|
</div>
|
|
|
<!-- <div class="manypeople">
|
...
|
...
|
@@ -293,7 +345,7 @@ import Vue from "vue"; |
|
|
import { PullRefresh, Toast, Dialog, Loading } from "vant";
|
|
|
Vue.use(PullRefresh);
|
|
|
Vue.use(Toast);
|
|
|
Vue.use(Loading)
|
|
|
Vue.use(Loading);
|
|
|
var timer = null;
|
|
|
export default {
|
|
|
data() {
|
...
|
...
|
@@ -320,35 +372,34 @@ export default { |
|
|
group_count: "",
|
|
|
// 直播列表
|
|
|
page: 1,
|
|
|
this_page: '',
|
|
|
total_page: '',
|
|
|
this_page: "",
|
|
|
total_page: "",
|
|
|
isLoading: false,
|
|
|
recordlist: [],
|
|
|
baseurl: "",
|
|
|
height: '',
|
|
|
hei: '600px',
|
|
|
target: '',
|
|
|
yuyintype: '',
|
|
|
stopurl: '',
|
|
|
height: "",
|
|
|
hei: "600px",
|
|
|
target: "",
|
|
|
yuyintype: "",
|
|
|
stopurl: "",
|
|
|
stopindex: 0,
|
|
|
playlocalid: '',
|
|
|
playlocalid: "",
|
|
|
cardzheng: false,
|
|
|
coursename: ''
|
|
|
coursename: ""
|
|
|
};
|
|
|
},
|
|
|
created() {
|
|
|
|
|
|
// 获取个人中心
|
|
|
this.getuserinfo()
|
|
|
this.getuserinfo();
|
|
|
// alert(location.host)
|
|
|
this.baseurl = 'http://' + location.host
|
|
|
this.baseurl = "http://" + location.host;
|
|
|
let div = this.$refs["message-list"];
|
|
|
|
|
|
// alert(1111)
|
|
|
// alert(this.baseurl+
|
|
|
// "/redirect.html?shareRedirect=" +
|
|
|
// encodeURIComponent(window.location.href))
|
|
|
this.coursename = this.$route.query.name
|
|
|
this.coursename = this.$route.query.name;
|
|
|
document.title = "唐元集公众号";
|
|
|
this.id = this.$route.query.id;
|
|
|
// 获取appid
|
...
|
...
|
@@ -356,21 +407,15 @@ export default { |
|
|
this.getlubodetail();
|
|
|
this.initWebSocket();
|
|
|
// 获取直播列表
|
|
|
this.getzhibolist()
|
|
|
|
|
|
this.getzhibolist();
|
|
|
},
|
|
|
mounted() {
|
|
|
let that = this;
|
|
|
|
|
|
let that = this
|
|
|
|
|
|
|
|
|
console.log(that.target, '99997878666')
|
|
|
console.log(that.target, "99997878666");
|
|
|
},
|
|
|
|
|
|
|
|
|
watch: {
|
|
|
|
|
|
},
|
|
|
watch: {},
|
|
|
beforeRouteEnter(to, from, next) {
|
|
|
var u = navigator.userAgent;
|
|
|
var isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); //ios终端
|
...
|
...
|
@@ -385,24 +430,21 @@ export default { |
|
|
methods: {
|
|
|
// 上传音频
|
|
|
afterRead(e) {
|
|
|
console.log(e)
|
|
|
console.log(e);
|
|
|
let file = e.target.files[0];
|
|
|
let that = this;
|
|
|
that.cardzheng = true
|
|
|
|
|
|
|
|
|
that.cardzheng = true;
|
|
|
|
|
|
var formdata = new FormData();
|
|
|
formdata.append("file", file);
|
|
|
|
|
|
var url = "/api/common/upload";
|
|
|
|
|
|
|
|
|
that.$uploadFile
|
|
|
.post(url, formdata)
|
|
|
.then(function (res) {
|
|
|
that.cardzheng = false
|
|
|
console.log(res)
|
|
|
.then(function(res) {
|
|
|
that.cardzheng = false;
|
|
|
console.log(res);
|
|
|
let objdata = {
|
|
|
lesson_id: that.id,
|
|
|
type: 3,
|
...
|
...
|
@@ -413,14 +455,11 @@ export default { |
|
|
objdata = JSON.stringify(objdata);
|
|
|
|
|
|
that.websocketsend(objdata);
|
|
|
|
|
|
})
|
|
|
.catch(err => {
|
|
|
console.log(err);
|
|
|
Toast(err.msg)
|
|
|
Toast(err.msg);
|
|
|
});
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
//获取个人中心
|
...
|
...
|
@@ -428,34 +467,27 @@ export default { |
|
|
let that = this;
|
|
|
|
|
|
var url = "/api/user/index";
|
|
|
let param = {
|
|
|
|
|
|
};
|
|
|
let param = {};
|
|
|
|
|
|
that.$axios
|
|
|
.post(url, param)
|
|
|
.then(function (res) {
|
|
|
.then(function(res) {
|
|
|
console.log(res);
|
|
|
that.user_id = res.data.id
|
|
|
|
|
|
|
|
|
that.user_id = res.data.id;
|
|
|
})
|
|
|
.catch(function (err) {
|
|
|
|
|
|
|
|
|
});
|
|
|
.catch(function(err) {});
|
|
|
},
|
|
|
|
|
|
// 列表自动滚到到底部
|
|
|
toBottom() {
|
|
|
// let listContainer = document.getElementById('messagebox')
|
|
|
let div = this.$refs["message-list"];
|
|
|
console.log(div.scrollHeight, 8887766543)
|
|
|
console.log(div.style.height, 9999)
|
|
|
console.log(div.scrollHeight, 8887766543);
|
|
|
console.log(div.style.height, 9999);
|
|
|
|
|
|
this.height = div.clientHeight
|
|
|
this.height = div.clientHeight;
|
|
|
|
|
|
div.scrollTop = div.scrollHeight
|
|
|
div.scrollTop = div.scrollHeight;
|
|
|
// let height = div.offsetHeight
|
|
|
// console.log(height, 9999888888)
|
|
|
// const listContainer = this.$refs["message-list"];
|
...
|
...
|
@@ -497,7 +529,6 @@ export default { |
|
|
console.log(that.page);
|
|
|
that.getzhibolist();
|
|
|
}
|
|
|
|
|
|
}, 1000);
|
|
|
},
|
|
|
|
...
|
...
|
@@ -505,6 +536,7 @@ export default { |
|
|
getappid() {
|
|
|
let that = this;
|
|
|
console.log(34734894890);
|
|
|
// let urlk = window.location.href;
|
|
|
let urlk = window.location.href;
|
|
|
var url = "/api/user/wechat_jssdk";
|
|
|
let param = {
|
...
|
...
|
@@ -513,7 +545,7 @@ export default { |
|
|
|
|
|
that.$axios
|
|
|
.post(url, param)
|
|
|
.then(function (res) {
|
|
|
.then(function(res) {
|
|
|
console.log(res);
|
|
|
wx.config({
|
|
|
debug: false,
|
...
|
...
|
@@ -538,25 +570,22 @@ export default { |
|
|
]
|
|
|
});
|
|
|
|
|
|
that.sharetofriend()
|
|
|
that.sharetofriend();
|
|
|
})
|
|
|
.catch(function (err) {
|
|
|
.catch(function(err) {
|
|
|
console.log(err);
|
|
|
});
|
|
|
},
|
|
|
|
|
|
// 分享给朋友
|
|
|
sharetofriend() {
|
|
|
|
|
|
var that = this;
|
|
|
// 处理验证失败的信息
|
|
|
wx.error(function (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) {
|
...
|
...
|
@@ -577,11 +606,13 @@ export default { |
|
|
// }
|
|
|
// 分享到朋友圈
|
|
|
wx.updateTimelineShareData({
|
|
|
title: '分享', // 分享标题
|
|
|
link: that.baseurl +
|
|
|
title: "分享", // 分享标题
|
|
|
link:
|
|
|
that.baseurl +
|
|
|
"/redirect.html?shareRedirect=" +
|
|
|
encodeURIComponent(window.location.href), // 分享链接,该链接域名或路径必须与当前页面对应的公众号JS安全域名一致, // 分享链接,该链接域名或路径必须与当前页面对应的公众号JS安全域名一致
|
|
|
imgUrl: 'http://tangyuanji.t.brotop.cn/uploads/20200804/fcabfaf5aa3c856ced04703b0a78a467.png',
|
|
|
imgUrl:
|
|
|
"http://tangyuanji.t.brotop.cn/uploads/20200804/fcabfaf5aa3c856ced04703b0a78a467.png",
|
|
|
|
|
|
// imgUrl: that.details.details.img
|
|
|
// ? that.details.details.img
|
...
|
...
|
@@ -589,13 +620,13 @@ export default { |
|
|
|
|
|
// 分享图标
|
|
|
// desc: that.sharemsg.content,
|
|
|
success: function (res) {
|
|
|
success: function(res) {
|
|
|
// 用户确认分享后执行的回调函数
|
|
|
console.log("suss");
|
|
|
logUtil.printLog("分享到朋友圈成功返回的信息为:", res);
|
|
|
that.showMsg("分享成功!");
|
|
|
},
|
|
|
cancel: function (res) {
|
|
|
cancel: function(res) {
|
|
|
// 用户取消分享后执行的回调函数
|
|
|
console.log("err");
|
|
|
logUtil.printLog("取消分享到朋友圈返回的信息为:", res);
|
...
|
...
|
@@ -603,13 +634,14 @@ export default { |
|
|
}),
|
|
|
// 分享给朋友
|
|
|
wx.updateAppMessageShareData({
|
|
|
title: '分享', // 分享标题
|
|
|
desc: '分享', // 分享描述
|
|
|
title: "分享", // 分享标题
|
|
|
desc: "分享", // 分享描述
|
|
|
link:
|
|
|
that.baseurl +
|
|
|
"/redirect.html?shareRedirect=" +
|
|
|
encodeURIComponent(window.location.href), // 分享链接,该链接域名或路径必须与当前页面对应的公众号JS安全域名一致
|
|
|
imgUrl: 'http://tangyuanji.t.brotop.cn/uploads/20200804/fcabfaf5aa3c856ced04703b0a78a467.png',
|
|
|
imgUrl:
|
|
|
"http://tangyuanji.t.brotop.cn/uploads/20200804/fcabfaf5aa3c856ced04703b0a78a467.png",
|
|
|
|
|
|
// imgUrl: that.details.details.img
|
|
|
// ? that.details.details.img
|
...
|
...
|
@@ -617,11 +649,11 @@ export default { |
|
|
// 分享图标
|
|
|
type: "", // 分享类型,music、video或link,不填默认为link
|
|
|
dataUrl: "", // 如果type是music或video,则要提供数据链接,默认为空
|
|
|
success: function (res) {
|
|
|
success: function(res) {
|
|
|
// 用户确认分享后执行的回调函数
|
|
|
logUtil.printLog("分享给朋友成功返回的信息为:", res);
|
|
|
},
|
|
|
cancel: function (res) {
|
|
|
cancel: function(res) {
|
|
|
// 用户取消分享后执行的回调函数
|
|
|
logUtil.printLog("取消分享给朋友返回的信息为:", res);
|
|
|
}
|
...
|
...
|
@@ -631,21 +663,21 @@ export default { |
|
|
|
|
|
// 上传图片
|
|
|
choseimg() {
|
|
|
let that = this
|
|
|
let that = this;
|
|
|
wx.chooseImage({
|
|
|
count: 1, // 默认9
|
|
|
sizeType: ['original', 'compressed'], // 可以指定是原图还是压缩图,默认二者都有
|
|
|
sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机,默认二者都有
|
|
|
success: function (res) {
|
|
|
sizeType: ["original", "compressed"], // 可以指定是原图还是压缩图,默认二者都有
|
|
|
sourceType: ["album", "camera"], // 可以指定来源是相册还是相机,默认二者都有
|
|
|
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()
|
|
|
that.upload();
|
|
|
}
|
|
|
});
|
|
|
}
|
...
|
...
|
@@ -654,8 +686,8 @@ export default { |
|
|
|
|
|
upload() {
|
|
|
let that = this;
|
|
|
console.log(34734894890)
|
|
|
alert(that.serverId)
|
|
|
console.log(34734894890);
|
|
|
alert(that.serverId);
|
|
|
var url = "/api/user/upload_media";
|
|
|
let param = {
|
|
|
type: 1,
|
...
|
...
|
@@ -664,7 +696,7 @@ export default { |
|
|
|
|
|
that.$axios
|
|
|
.post(url, param)
|
|
|
.then(function (res) {
|
|
|
.then(function(res) {
|
|
|
console.log(res);
|
|
|
that.videourl = res.data.media;
|
|
|
let objdata = {
|
...
|
...
|
@@ -678,25 +710,24 @@ export default { |
|
|
// alert(objdata);
|
|
|
that.websocketsend(objdata);
|
|
|
// alert(that.videourl)
|
|
|
|
|
|
})
|
|
|
.catch(function (err) {
|
|
|
alert(err)
|
|
|
.catch(function(err) {
|
|
|
alert(err);
|
|
|
console.log(err);
|
|
|
});
|
|
|
},
|
|
|
// 预览图片
|
|
|
previewimg(url) {
|
|
|
let arr = [];
|
|
|
arr.push(url)
|
|
|
arr.push(url);
|
|
|
wx.previewImage({
|
|
|
current: url, // 当前显示图片的http链接
|
|
|
urls: arr// 需要预览的图片http链接列表
|
|
|
urls: arr // 需要预览的图片http链接列表
|
|
|
});
|
|
|
},
|
|
|
// 隐藏遮罩层
|
|
|
hide() {
|
|
|
let that = this
|
|
|
let that = this;
|
|
|
this.beginlushow = false;
|
|
|
this.zhengzailu = false;
|
|
|
this.luprocess = false;
|
...
|
...
|
@@ -732,7 +763,7 @@ export default { |
|
|
// 开始录制
|
|
|
yuyin() {
|
|
|
this.beginlushow = true;
|
|
|
this.yuyintype = 1
|
|
|
this.yuyintype = 1;
|
|
|
},
|
|
|
// 开始录制
|
|
|
// 开始录音
|
...
|
...
|
@@ -748,7 +779,7 @@ export default { |
|
|
console.log(that.time);
|
|
|
}, 1000);
|
|
|
wx.startRecord({
|
|
|
success: function (res) {
|
|
|
success: function(res) {
|
|
|
// alert(JSON.stringify(res))
|
|
|
consoel.log(res, 99977775655);
|
|
|
// alert('成功调起录音')
|
...
|
...
|
@@ -758,7 +789,7 @@ export default { |
|
|
// }, 1000)
|
|
|
// that.vicoeEnd()
|
|
|
},
|
|
|
cancel: function () {
|
|
|
cancel: function() {
|
|
|
// alert("用户拒绝授权录音");
|
|
|
}
|
|
|
});
|
...
|
...
|
@@ -773,7 +804,7 @@ export default { |
|
|
clearInterval(timer);
|
|
|
|
|
|
wx.stopRecord({
|
|
|
success: function (res) {
|
|
|
success: function(res) {
|
|
|
var localId = res.localId;
|
|
|
that.localId = res.localId;
|
|
|
that.upyuyin();
|
...
|
...
|
@@ -788,7 +819,7 @@ export default { |
|
|
},
|
|
|
// 结束本次上传
|
|
|
hideshangchuan() {
|
|
|
this.shanghcuanshow = false
|
|
|
this.shanghcuanshow = false;
|
|
|
},
|
|
|
// 发送语音
|
|
|
sendyuyin() {
|
...
|
...
|
@@ -796,8 +827,7 @@ export default { |
|
|
|
|
|
let that = this;
|
|
|
|
|
|
|
|
|
this.shanghcuanshow = false
|
|
|
this.shanghcuanshow = false;
|
|
|
that.luprocess = false;
|
|
|
// this.issuccess = true
|
|
|
let objdata = {
|
...
|
...
|
@@ -817,10 +847,9 @@ export default { |
|
|
shangyuyin() {
|
|
|
let that = this;
|
|
|
|
|
|
|
|
|
this.shanghcuanshow = false
|
|
|
this.shanghcuanshow = false;
|
|
|
that.luprocess = false;
|
|
|
this.issuccess = true
|
|
|
this.issuccess = true;
|
|
|
let objdata = {
|
|
|
lesson_id: this.id,
|
|
|
type: 3,
|
...
|
...
|
@@ -838,7 +867,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);
|
...
|
...
|
@@ -856,27 +885,25 @@ export default { |
|
|
},
|
|
|
// 停止直播
|
|
|
stopbtn() {
|
|
|
this.overzhibo = true
|
|
|
|
|
|
this.overzhibo = true;
|
|
|
},
|
|
|
canclesure() {
|
|
|
this.overzhibo = false
|
|
|
this.overzhibo = false;
|
|
|
},
|
|
|
surezhibo() {
|
|
|
let that = this;
|
|
|
that.overzhibo = false
|
|
|
that.overzhibo = false;
|
|
|
let objdata = {
|
|
|
lesson_id: this.id,
|
|
|
type: 3,
|
|
|
user_id: this.user_id,
|
|
|
times: that.time,
|
|
|
data: '', is_end: 1
|
|
|
data: "",
|
|
|
is_end: 1
|
|
|
};
|
|
|
objdata = JSON.stringify(objdata);
|
|
|
// alert(objdata);
|
|
|
this.websocketsend(objdata);
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
// 获取录播详情
|
...
|
...
|
@@ -890,12 +917,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);
|
|
|
});
|
|
|
},
|
...
|
...
|
@@ -919,12 +945,16 @@ export default { |
|
|
this.initWebSocket();
|
|
|
},
|
|
|
websocketonmessage(e) {
|
|
|
|
|
|
//数据接收
|
|
|
let that = this;
|
|
|
|
|
|
if (this.number == 0) {
|
|
|
let obj = { lesson_id: this.id, user_id: this.user_id, is_group: 1, first: 1 };
|
|
|
let obj = {
|
|
|
lesson_id: this.id,
|
|
|
user_id: this.user_id,
|
|
|
is_group: 1,
|
|
|
first: 1
|
|
|
};
|
|
|
obj = JSON.stringify(obj);
|
|
|
console.log(obj);
|
|
|
this.websocketsend(obj);
|
...
|
...
|
@@ -933,14 +963,14 @@ export default { |
|
|
}
|
|
|
this.number = this.number + 1;
|
|
|
this.number = this.number;
|
|
|
let datak = e.data
|
|
|
let datak = e.data;
|
|
|
console.log(e, 88890999);
|
|
|
console.log(e.data)
|
|
|
console.log(e.data);
|
|
|
// alert(e.data)
|
|
|
// alert(e.data.first)
|
|
|
let data = JSON.parse(e.data);
|
|
|
// alert(data)
|
|
|
console.log(data)
|
|
|
console.log(data);
|
|
|
that.group_count = data.group_count;
|
|
|
// 接收数据重新渲染列表
|
|
|
if (data.lesson_id != undefined) {
|
...
|
...
|
@@ -948,34 +978,29 @@ export default { |
|
|
|
|
|
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.splice(index, 1);
|
|
|
that.recordlist = that.recordlist;
|
|
|
that.$forceUpdate()
|
|
|
that.$forceUpdate();
|
|
|
}
|
|
|
})
|
|
|
});
|
|
|
} else if (redata.code == 0) {
|
|
|
Toast(redata.msg)
|
|
|
Toast(redata.msg);
|
|
|
} else if (redata.code == 1) {
|
|
|
that.recordlist.push(redata);
|
|
|
that.recordlist = that.recordlist;
|
|
|
that.$forceUpdate();
|
|
|
that.$nextTick(() => {
|
|
|
var div = document.getElementById('messagebox');
|
|
|
var div = document.getElementById("messagebox");
|
|
|
var div = document.getElementsByClassName("messageitem");
|
|
|
let len = div.length;
|
|
|
len = len - 1;
|
|
|
div[len].scrollIntoView()
|
|
|
|
|
|
})
|
|
|
|
|
|
div[len].scrollIntoView();
|
|
|
});
|
|
|
} else if (redata.code == 2) {
|
|
|
that.$router.go(-1)
|
|
|
that.$router.go(-1);
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
},
|
|
|
websocketsend(Data) {
|
...
|
...
|
@@ -990,7 +1015,7 @@ export default { |
|
|
// 获取直播列表
|
|
|
getzhibolist() {
|
|
|
let that = this;
|
|
|
console.log(34734894890)
|
|
|
console.log(34734894890);
|
|
|
var url = "/api/user/lesson_chat_record";
|
|
|
let param = {
|
|
|
lesson_id: that.id,
|
...
|
...
|
@@ -999,86 +1024,79 @@ export default { |
|
|
|
|
|
that.$axios
|
|
|
.post(url, param)
|
|
|
.then(function (res) {
|
|
|
console.log(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) {
|
|
|
len = len - 1;
|
|
|
res.data.record.forEach(function(value, index, array) {
|
|
|
if (index == len) {
|
|
|
value.idkk = 'targetboxk'
|
|
|
value.idkk = "targetboxk";
|
|
|
that.$nextTick(() => {
|
|
|
setTimeout(() => {
|
|
|
let targetbox = document.getElementById('targetboxk');
|
|
|
let targetbox = document.getElementById("targetboxk");
|
|
|
that.target = targetbox.offsetTop;
|
|
|
document.body.scrollTop = that.target;
|
|
|
// document.getElementById('targetbox').scrollTop = that.target
|
|
|
document.getElementById("targetboxk").scrollIntoView();
|
|
|
|
|
|
})
|
|
|
})
|
|
|
});
|
|
|
});
|
|
|
}
|
|
|
|
|
|
})
|
|
|
});
|
|
|
}
|
|
|
|
|
|
// 拼接数组倒叙
|
|
|
var arr = [...res.data.record, ...that.recordlist];
|
|
|
that.recordlist = arr
|
|
|
that.recordlist.forEach(function (value, index, array) {
|
|
|
value.sel = false
|
|
|
})
|
|
|
that.recordlist = that.recordlist
|
|
|
that.this_page = res.data.this_page
|
|
|
that.recordlist = arr;
|
|
|
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)
|
|
|
console.log(item);
|
|
|
// 播放某一个语音
|
|
|
|
|
|
// 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 {
|
|
|
that.recordlist[indexk].sel = false
|
|
|
that.recordlist[indexk].sel = false;
|
|
|
}
|
|
|
})
|
|
|
});
|
|
|
|
|
|
that.recordlist = that.recordlist;
|
|
|
|
|
|
that.$forceUpdate();
|
|
|
console.log(that.recordlist)
|
|
|
console.log(that.recordlist);
|
|
|
|
|
|
if (this.recordlist[index].sel == true) {
|
|
|
// 开始播放
|
|
|
let localId = ''
|
|
|
let localId = "";
|
|
|
wx.downloadVoice({
|
|
|
serverId: item.data, // 需要下载的音频的服务器端ID,由uploadVoice接口获得
|
|
|
isShowProgressTips: 1, // 默认为1,显示进度提示
|
|
|
success: function (res) {
|
|
|
|
|
|
success: function(res) {
|
|
|
localId = res.localId; // 返回音频的本地ID
|
|
|
that.playlocalid = localId;
|
|
|
that.recordlist[index].localId = localId;
|
|
|
that.recordlist = that.recordlist;
|
|
|
that.$forceUpdate()
|
|
|
that.$forceUpdate();
|
|
|
|
|
|
wx.playVoice({
|
|
|
localId: localId // 需要播放的音频的本地ID,由stopRecord接口获得
|
|
|
})
|
|
|
});
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
// if (this.recordlist[index].data != that.stopurl) {
|
...
|
...
|
@@ -1087,20 +1105,15 @@ export default { |
|
|
// isShowProgressTips: 1, // 默认为1,显示进度提示
|
|
|
// success: function (res) {
|
|
|
|
|
|
|
|
|
// wx.stopVoice({
|
|
|
// localId: res.localId // 需要停止的音频的本地ID,由stopRecord接口获得
|
|
|
// });
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
// });
|
|
|
|
|
|
// }
|
|
|
|
|
|
} else if (this.recordlist[index].sel == false) {
|
|
|
// 停止播放
|
|
|
wx.stopVoice({
|
...
|
...
|
@@ -1109,16 +1122,15 @@ 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
|
|
|
value.sel = false;
|
|
|
}
|
|
|
|
|
|
})
|
|
|
that.recordlist = that.recordlist
|
|
|
});
|
|
|
that.recordlist = that.recordlist;
|
|
|
|
|
|
that.$forceUpdate();
|
|
|
|
...
|
...
|
@@ -1126,31 +1138,27 @@ export default { |
|
|
|
|
|
if (that.recordlist[index].data != undefined) {
|
|
|
if (that.recordlist[index].type == 3) {
|
|
|
that.recordlist[index].sel = true
|
|
|
that.recordlist[index].sel = true;
|
|
|
wx.downloadVoice({
|
|
|
serverId: that.recordlist[index].data, // 需要下载的音频的服务器端ID,由uploadVoice接口获得
|
|
|
isShowProgressTips: 1, // 默认为1,显示进度提示
|
|
|
success: function (res) {
|
|
|
success: function(res) {
|
|
|
let localId = res.localId; // 返回音频的本地ID
|
|
|
that.recordlist[index].localId = localId;
|
|
|
that.recordlist[index].sel = true;
|
|
|
that.recordlist = that.recordlist;
|
|
|
that.$forceUpdate()
|
|
|
that.$forceUpdate();
|
|
|
wx.playVoice({
|
|
|
localId: localId // 需要暂停的音频的本地ID,由stopRecord接口获得
|
|
|
});
|
|
|
|
|
|
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
that.recordlist = that.recordlist;
|
|
|
that.$forceUpdate()
|
|
|
|
|
|
that.$forceUpdate();
|
|
|
}
|
|
|
});
|
|
|
|
|
|
},
|
|
|
// 发送文字
|
|
|
send() {
|
...
|
...
|
@@ -1162,24 +1170,23 @@ export default { |
|
|
times: 0,
|
|
|
data: this.text
|
|
|
};
|
|
|
console.log(objdata)
|
|
|
console.log(objdata);
|
|
|
objdata = JSON.stringify(objdata);
|
|
|
// alert(objdata)
|
|
|
this.websocketsend(objdata);
|
|
|
this.text = ''
|
|
|
this.text = "";
|
|
|
// ws.send(objdata);
|
|
|
},
|
|
|
gotouchstart(item) {
|
|
|
let that = this;
|
|
|
clearTimeout(timeOutEvent);//清除定时器
|
|
|
clearTimeout(timeOutEvent); //清除定时器
|
|
|
timeOutEvent = 0;
|
|
|
timeOutEvent = setTimeout(function () {
|
|
|
timeOutEvent = setTimeout(function() {
|
|
|
Dialog.confirm({
|
|
|
title: '是否删除帖子',
|
|
|
|
|
|
title: "是否删除帖子"
|
|
|
})
|
|
|
.then((res) => {
|
|
|
console.log(item.id)
|
|
|
.then(res => {
|
|
|
console.log(item.id);
|
|
|
let objdata = {
|
|
|
id: item.id,
|
|
|
lesson_id: item.lesson_id,
|
...
|
...
|
@@ -1189,40 +1196,36 @@ export default { |
|
|
data: item.data,
|
|
|
is_del: 1
|
|
|
};
|
|
|
console.log(objdata)
|
|
|
console.log(objdata);
|
|
|
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.splice(index, 1);
|
|
|
that.recordlist = that.recordlist;
|
|
|
that.$forceUpdate()
|
|
|
that.$forceUpdate();
|
|
|
}
|
|
|
});
|
|
|
})
|
|
|
})
|
|
|
.catch((res) => {
|
|
|
|
|
|
.catch(res => {
|
|
|
// on cancel
|
|
|
});
|
|
|
//执行长按要执行的内容,
|
|
|
|
|
|
|
|
|
}, 600);//这里设置定时
|
|
|
}, 600); //这里设置定时
|
|
|
},
|
|
|
//手释放,如果在500毫秒内就释放,则取消长按事件,此时可以执行onclick应该执行的事件
|
|
|
gotouchend() {
|
|
|
clearTimeout(timeOutEvent);
|
|
|
if (timeOutEvent != 0) {
|
|
|
//这里写要执行的内容(尤如onclick事件)
|
|
|
|
|
|
}
|
|
|
},
|
|
|
//如果手指有移动,则取消所有事件,此时说明用户只是要移动而不是长按
|
|
|
gotouchmove() {
|
|
|
clearTimeout(timeOutEvent);//清除定时器
|
|
|
clearTimeout(timeOutEvent); //清除定时器
|
|
|
timeOutEvent = 0;
|
|
|
},
|
|
|
}
|
|
|
}
|
|
|
};
|
|
|
</script>
|
...
|
...
|
|