// pages/live/room/room.ts Page({ /** * 页面的初始数据 */ data: { joinedGroupId: "", // 已加入的消息组id windowHeight: "100%", windowWidth: "100%", }, /** * 生命周期函数--监听页面加载 */ async onLoad(options) { const app = getApp(); wx.setStorageSync("joinedGroupId", options.groupId); const bool = await app.login("room"); if (!bool) return; this.setData({ joinedGroupId: options.groupId, }); }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady() {}, /** * 生命周期函数--监听页面显示 */ onShow() {}, /** * 生命周期函数--监听页面隐藏 */ onHide() {}, /** * 生命周期函数--监听页面卸载 */ onUnload() {}, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh() {}, /** * 页面上拉触底事件的处理函数 */ onReachBottom() {}, /** * 用户点击右上角分享 */ onShareAppMessage() { const groupId = this.data.joinedGroupId || wx.getStorageSync("joinedGroupId"); const path = groupId ? `/pages/live/room/room?groupId=${groupId}` : "/pages/live/room/room"; return { /* title: "邀请你进入直播间", */ title: "邀请你进入直播间", path, imageUrl: "/assets/img/600.jpg", }; }, });