const app = getApp()
var WechatSI = requirePlugin("WechatSI");
let WechatRecord = WechatSI.getRecordRecognitionManager();
Page({
data: {
isCarMode: false,
audioPlayer: false,
bgPlayer: false,
newsList: [],
isThisShow: false,
newsShow: true,
isPanelShow: false,
isMusicPlaying: true,
systemInfo: {},
message: "",
simplePlayer: true,
musicLrcObj: [],
lrcString: "",
showPasswordForm: false,
placeholderDefault: "说点什么吧...",
placeholderSearchImage: "关键词搜索表情",
messageButtonTitleSend: "send",
messageButtonTitleSearch: "search",
messagePlaceHolder: "",
messageConfirmHold: true,
messageFocus: false,
isScrollEnabled: true,
imageList: [],
emojiList: [],
messageSendButton: "send",
isEmojiBoxShow: false,
isSystemEmoji: true,
room_id: 0,
default_room: 888,
bottomHeight: 0,
room_password: "",
bbbug_view_id: "",
bbbug_view_scroll: "",
userInfo: {},
roomInfo: {},
songInfo: false,
atMessageObj: false,
websocket: {
url: "",
task: null,
connected: false,
forceStop: false,
reconnectTimer: false,
heartBeatTimer: false
},
messageList: [],
historyMax: 20,
touchStartTime: 0,
touchEndTime: 0,
touchStartPostion: false,
isDoubleClick: false,
isTouchMoved: false,
touchTimer: false,
clickTimer: false,
enableTouchEnd: false,
isRecording: false,
},
setSimplePlayer() {
wx.vibrateShort();
this.setData({
simplePlayer: !this.data.simplePlayer
});
},
enableScroll() {
this.setData({
isScrollEnabled: true,
});
this.autoScroll();
},
touchStarted(e) {
let that = this;
that.data.touchStartTime = e.timeStamp;
that.data.isTouchMoved = false;
that.data.touchStartPostion = e.touches ? e.touches[0] : false;
clearTimeout(that.data.touchTimer);
that.data.touchTimer = setTimeout(function () {
that.data.enableTouchEnd = false;
if (!that.data.isTouchMoved) {
that.longTapToAtUser(e.mark.user);
}
}, 500);
that.data.enableTouchEnd = true;
if (that.data.touchStartTime - that.data.touchEndTime < 300) {
that.data.isDoubleClick = true;
clearTimeout(that.data.clickTimer);
} else {
that.data.isDoubleClick = false;
}
},
footerTapedToFocus() {
if (this.data.systemInfo.platform != 'android') {
this.setData({
messageFocus: true
});
}
},
messageBlured(e) {
if (this.data.messageFocus) {
this.setData({
messageFocus: false,
});
wx.hideKeyboard();
}
},
messageChanged(e) {
// this.setData({
// message: e.detail.value,
// });
},
messageFocused(e) {
if (!this.data.messageFocus) {
if (this.data.isEmojiBoxShow) {
this.setData({
imageList: [],
});
}
}
},
touchMoving(e) {
let that = this;
if (e.touches && (e.touches[0].pageX != that.data.touchStartPostion.pageX || e.touches[0].pageY != that.data.touchStartPostion.pageY))
that.data.isTouchMoved = true;
},
touchEnded(e) {
let that = this;
that.data.touchEndTime = e.timeStamp;
clearTimeout(that.data.touchTimer);
if (that.data.isTouchMoved) {
return;
}
if (that.data.enableTouchEnd) {
this.data.clickTimer = setTimeout(function () {
if (that.data.isDoubleClick) {
that.doTouchUser(e.mark.user.user_id);
} else {
if (!that.data.isTouchMoved) {
that.userTap(e.mark.user);
}
}
that.data.isDoubleClick = false;
}, 300);
}
},
doTouchUser(user_id) {
let that = this;
app.request({
url: "message/touch",
data: {
at: user_id,
room_id: that.data.room_id
},
success(res) {
wx.vibrateLong();
}
});
},
messageListScrolling(e) {
let res = wx.getSystemInfoSync();
if (res.windowHeight + 50 < e.detail.scrollHeight - e.detail.scrollTop) {
this.setData({
isScrollEnabled: false
});
} else {
this.setData({
isScrollEnabled: true
});
}
},
onLoad: function (options) {
let that = this;
that.data.bgPlayer = wx.getBackgroundAudioManager();
const updateManager = wx.getUpdateManager()
updateManager.onUpdateReady(function () {
updateManager.applyUpdate()
});
updateManager.onUpdateFailed(function () {});
app.watchAccessToken(function () {
that.getMyInfo();
});
if (options.scene) {
wx.setStorageSync('room_id', options.scene);
} else if (options.room_id) {
wx.setStorageSync('room_id', options.room_id);
}
let emojiList = [];
for (let i = 1; i <= 30; i++) {
emojiList.push("/res/Emojis/" + i + ".png");
}
let systemInfo = wx.getSystemInfoSync();
this.setData({
bottomHeight: systemInfo.safeArea.bottom - systemInfo.safeArea.height + 40,
emojiList: emojiList,
imageList: emojiList,
systemInfo: systemInfo,
messagePlaceHolder: this.data.placeholderDefault,
});
let room_id = wx.getStorageSync('room_id') || this.data.default_room;
this.setData({
room_id: room_id
});
let access_token = wx.getStorageSync('access_token') || false;
if (!access_token) {
access_token = app.globalData.guestUserInfo.access_token;
this.setData({
userInfo: app.globalData.guestUserInfo
});
}
wx.setStorageSync('access_token', access_token);
if (app.globalData.systemVersion > 0) {
that.setData({
newsShow: false
});
let plat = systemInfo.platform.toLowerCase();
if (plat == 'windows' || plat == 'mac') {
wx.redirectTo({
url: '../pc/index?bbbug=' + app.globalData.systemVersion + '&url=' + encodeURIComponent('https://demo.bbbug.com'),
});
wx.hideHomeButton();
return;
}
that.getMyInfo();
} else {
app.request({
url: "",
success(res) {
that.setData({
newsList: res.data.data,
newsShow: true
});
wx.setNavigationBarTitle({
title: '每日推荐',
});
wx.showToast({
title: '已更新',
});
that.data.bgPlayer.src = 'http://img02.tuke88.com/newpreview_music/09/01/43/5c89e6ded0ebf83768.mp3';
that.data.bgPlayer.title = "背景音乐";
that.data.bgPlayer.play();
}
});
}
that.data.bgPlayer.onTimeUpdate(function (e) {
if (that.data.songInfo) {
if (that.data.musicLrcObj) {
for (let i = 0; i < that.data.musicLrcObj.length; i++) {
if (i == that.data.musicLrcObj.length - 1) {
that.setData({
lrcString: that.data.musicLrcObj[i].lineLyric
});
return;
} else {
if (that.data.bgPlayer.currentTime > that.data.musicLrcObj[i].time && that.data.bgPlayer.currentTime < that.data.musicLrcObj[i + 1].time) {
that.setData({
lrcString: that.data.musicLrcObj[i].lineLyric
});
return;
}
}
}
}
}
});
that.data.bgPlayer.onPrev(function () {
if (that.data.isCarMode) {
app.request({
url: "song/addMySong",
data: {
room_id: app.globalData.roomInfo.room_id,
mid: that.data.songInfo.song.mid,
},
loading: "收藏中",
success: function (res) {
that.say(res.msg);
},
error(res) {
that.say(res.msg);
return true;
}
});
}
});
that.data.bgPlayer.onNext(function () {
if (!that.data.isCarMode) {
return;
}
app.request({
url: "
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
bbbug-wechat-app-master.zip (117个子文件)
iconfont.eot 351KB
.gitignore 144B
nohead.jpg 3KB
index.js 38KB
motify.js 7KB
app.js 6KB
online.js 4KB
motify.js 4KB
playing.js 3KB
my.js 3KB
select.js 2KB
login.js 2KB
select.js 2KB
detail.js 2KB
index.js 1KB
profile.js 1KB
create.js 1KB
index.js 360B
project.config.json 2KB
app.json 1KB
theme.json 488B
project.private.config.json 394B
sitemap.json 209B
create.json 128B
index.json 128B
login.json 128B
index.json 125B
online.json 104B
playing.json 95B
my.json 95B
select.json 62B
motify.json 62B
select.json 62B
index.json 62B
motify.json 62B
profile.json 62B
detail.json 27B
LICENSE 34KB
more.png 47KB
add.png 44KB
logo.png 41KB
player_bg.png 32KB
player_bar.png 8KB
timeline.png 5KB
timeline_on.png 5KB
alert.png 4KB
16.png 4KB
8.png 4KB
14.png 4KB
24.png 4KB
11.png 4KB
index.png 4KB
25.png 4KB
6.png 3KB
20.png 3KB
23.png 3KB
28.png 3KB
22.png 3KB
4.png 3KB
5.png 3KB
30.png 3KB
19.png 3KB
26.png 3KB
10.png 3KB
1.png 3KB
29.png 3KB
17.png 3KB
27.png 3KB
2.png 3KB
21.png 3KB
7.png 3KB
18.png 3KB
index_on.png 3KB
15.png 3KB
9.png 3KB
3.png 3KB
12.png 3KB
message.png 3KB
message_on.png 3KB
13.png 3KB
user.png 3KB
user_on.png 3KB
iconfont.ttf 351KB
Roboto.ttf 155KB
iconfont.woff2 141KB
index.wxml 13KB
motify.wxml 5KB
profile.wxml 3KB
motify.wxml 3KB
select.wxml 2KB
online.wxml 2KB
select.wxml 2KB
login.wxml 2KB
create.wxml 1KB
my.wxml 1KB
playing.wxml 1004B
index.wxml 935B
detail.wxml 587B
index.wxml 35B
helper.wxs 2KB
共 117 条
- 1
- 2
资源评论
m0_72731342
- 粉丝: 2
- 资源: 1832
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功