123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105 |
- // pages/chat-detail/chat-detail.js
- let disp = require("../../utils/broadcast");
- Page({
- /**
- * 页面的初始数据
- */
- data: {
- username: {
- your: "",
- },
- list: [{
- id: 1,
- photo: 'https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fup.enterdesk.com%2Fedpic_source%2Fc0%2F8e%2F28%2Fc08e28eb52da5a2b5b451ad6272a8197.jpg&refer=http%3A%2F%2Fup.enterdesk.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1652429449&t=63437c824c18680ecb5e5f27d06f941b',
- content: '你到了吗?'
- }, {
- id: 2,
- photo: 'https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fnimg.ws.126.net%2F%3Furl%3Dhttp%253A%252F%252Fdingyue.ws.126.net%252F2021%252F0314%252F94ad46dbj00qpy1do0021d200rs00rsg008t008t.jpg%26thumbnail%3D650x2147483647%26quality%3D80%26type%3Djpg&refer=http%3A%2F%2Fnimg.ws.126.net&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1652429449&t=3fd0174f597633f23248e79587f76513',
- content: '刚刚到达,已找到位置,谢谢!'
- }]
- },
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad: function (options) {
- console.info(options)
- let me = this
- let username = options && JSON.parse(options.username) || {};
- console.log('username *****', username)
- this.setData({ username: username });
- wx.setNavigationBarTitle({
- title: username.your
- });
- disp.on('em.megList.refresh', function () {
- const pages = getCurrentPages();
- const currentPage = pages[pages.length - 1];
- if (currentPage.route == "pages/chatroom/chatroom") {
- me.onLoad()
- }
- })
- if (username.action == 'join') {
- console.log('username', username)
- this.selectComponent('#chat').joinConf(username.data)
- }
- disp.on('emedia.confirmRing', function (event) {
- console.log('event', event)
- me.selectComponent('#chat').joinConf()
- });
- },
- /**
- * 生命周期函数--监听页面初次渲染完成
- */
- onReady: function () {
- },
- /**
- * 生命周期函数--监听页面显示
- */
- onShow: function () {
- },
- /**
- * 生命周期函数--监听页面隐藏
- */
- onHide: function () {
- },
- /**
- * 生命周期函数--监听页面卸载
- */
- onUnload: function () {
- disp.fire("em.chatroom.leave");
- },
- /**
- * 页面相关事件处理函数--监听用户下拉动作
- */
- onPullDownRefresh: function () {
- wx.showNavigationBarLoading();
- this.selectComponent('#chat').getMore()
- // 停止下拉动作
- wx.hideNavigationBarLoading();
- wx.stopPullDownRefresh();
- },
- /**
- * 页面上拉触底事件的处理函数
- */
- onReachBottom: function () {
- },
- /**
- * 用户点击右上角分享
- */
- onShareAppMessage: function () {
- }
- })
|