Parcourir la source

添加扫一扫加入群聊功能

xyg il y a 3 ans
Parent
commit
aed295f79e

+ 35 - 0
light-application-wx/pages/chat-room/chat-room.js

@@ -455,5 +455,40 @@ Page({
         } else {
             return `${dateArr[0]}/${dateArr[1]}/${dateArr[2]}`;
         }
+    },
+
+    /**
+     * 扫一扫加入群聊
+     */
+    scanJoinGroup: function () {
+        wx.scanCode({
+            onlyFromCamera: true,
+            success: (res) => {
+                console.info('scanCode', res);
+                if (res.result) {
+                    util.post({
+                        url: '/api/easemob/addGroupUser',
+                        data: {
+                            chatgroupid: res.result,
+                            usernames: [wx.getStorageSync('myUsername')]
+                        },
+                        success: (res) => {
+                            wx.hideLoading();
+                            console.info('addGroupUser', res);
+                            if (res.data.code != 200) {
+                                util.toast(res.data.msg);
+                            } else {
+                                util.toast(res.data.msg);
+                            }
+                        }
+                    });
+                }
+
+            },
+            fail: (err) => {
+                console.info('scanCode', err);
+            }
+        });
     }
+
 })

+ 6 - 1
light-application-wx/pages/chat-room/chat-room.wxml

@@ -64,4 +64,9 @@
 <!-- bug: margin-bottom 不生效 需要加一个空标签-->
 <view style="height: 1px;"></view>
 
-<view class="mask" bindtap="close_mask" wx:if="{{show_mask}}"></view>
+<view class="mask" bindtap="close_mask" wx:if="{{show_mask}}"></view>
+
+<view class="scan-jion-group" bindtap="scanJoinGroup">
+    <text>扫一扫</text>
+    <text>加入群聊</text>
+</view>

+ 16 - 0
light-application-wx/pages/chat-room/chat-room.wxss

@@ -256,4 +256,20 @@
 .goback {
     top: 128rpx;
     transition: top 0.5s;
+}
+
+.scan-jion-group {
+    background-color: #516C9C;
+    width: 130rpx;
+    height: 130rpx;
+    border-radius: 65rpx;
+    position: absolute;
+    right: 19rpx;
+    bottom: 92rpx;
+    color: #FEFEFE;
+    font-size: 22rpx;
+    display: flex;
+    flex-direction: column;
+    align-items: center;
+    justify-content: center;
 }

+ 0 - 66
light-application-wx/pages/index-admin/index-admin.js

@@ -1,66 +0,0 @@
-// pages/index-admin/index-admin.js
-Page({
-
-    /**
-     * 页面的初始数据
-     */
-    data: {
-
-    },
-
-    /**
-     * 生命周期函数--监听页面加载
-     */
-    onLoad(options) {
-
-    },
-
-    /**
-     * 生命周期函数--监听页面初次渲染完成
-     */
-    onReady() {
-
-    },
-
-    /**
-     * 生命周期函数--监听页面显示
-     */
-    onShow() {
-
-    },
-
-    /**
-     * 生命周期函数--监听页面隐藏
-     */
-    onHide() {
-
-    },
-
-    /**
-     * 生命周期函数--监听页面卸载
-     */
-    onUnload() {
-
-    },
-
-    /**
-     * 页面相关事件处理函数--监听用户下拉动作
-     */
-    onPullDownRefresh() {
-
-    },
-
-    /**
-     * 页面上拉触底事件的处理函数
-     */
-    onReachBottom() {
-
-    },
-
-    /**
-     * 用户点击右上角分享
-     */
-    onShareAppMessage() {
-
-    }
-})

+ 0 - 2
light-application-wx/pages/index-admin/index-admin.wxml

@@ -1,2 +0,0 @@
-<!--pages/index-admin/index-admin.wxml-->
-<text>pages/index-admin/index-admin.wxml</text>

+ 0 - 66
light-application-wx/pages/index-guest/index-guest.js

@@ -1,66 +0,0 @@
-// pages/index-guest/index-guest.js
-Page({
-
-    /**
-     * 页面的初始数据
-     */
-    data: {
-
-    },
-
-    /**
-     * 生命周期函数--监听页面加载
-     */
-    onLoad(options) {
-
-    },
-
-    /**
-     * 生命周期函数--监听页面初次渲染完成
-     */
-    onReady() {
-
-    },
-
-    /**
-     * 生命周期函数--监听页面显示
-     */
-    onShow() {
-
-    },
-
-    /**
-     * 生命周期函数--监听页面隐藏
-     */
-    onHide() {
-
-    },
-
-    /**
-     * 生命周期函数--监听页面卸载
-     */
-    onUnload() {
-
-    },
-
-    /**
-     * 页面相关事件处理函数--监听用户下拉动作
-     */
-    onPullDownRefresh() {
-
-    },
-
-    /**
-     * 页面上拉触底事件的处理函数
-     */
-    onReachBottom() {
-
-    },
-
-    /**
-     * 用户点击右上角分享
-     */
-    onShareAppMessage() {
-
-    }
-})

+ 0 - 2
light-application-wx/pages/index-guest/index-guest.wxml

@@ -1,2 +0,0 @@
-<!--pages/index-guest/index-guest.wxml-->
-<text>pages/index-guest/index-guest.wxml</text>

+ 0 - 66
light-application-wx/pages/index-work/index-work.js

@@ -1,66 +0,0 @@
-// pages/index-work/index-work.js
-Page({
-
-    /**
-     * 页面的初始数据
-     */
-    data: {
-
-    },
-
-    /**
-     * 生命周期函数--监听页面加载
-     */
-    onLoad(options) {
-
-    },
-
-    /**
-     * 生命周期函数--监听页面初次渲染完成
-     */
-    onReady() {
-
-    },
-
-    /**
-     * 生命周期函数--监听页面显示
-     */
-    onShow() {
-
-    },
-
-    /**
-     * 生命周期函数--监听页面隐藏
-     */
-    onHide() {
-
-    },
-
-    /**
-     * 生命周期函数--监听页面卸载
-     */
-    onUnload() {
-
-    },
-
-    /**
-     * 页面相关事件处理函数--监听用户下拉动作
-     */
-    onPullDownRefresh() {
-
-    },
-
-    /**
-     * 页面上拉触底事件的处理函数
-     */
-    onReachBottom() {
-
-    },
-
-    /**
-     * 用户点击右上角分享
-     */
-    onShareAppMessage() {
-
-    }
-})

+ 0 - 2
light-application-wx/pages/index-work/index-work.wxml

@@ -1,2 +0,0 @@
-<!--pages/index-work/index-work.wxml-->
-<text>pages/index-work/index-work.wxml</text>

+ 14 - 14
light-application-wx/pages/index/index.js

@@ -74,6 +74,20 @@ Page({
                 role_name: app.globalData.roleInfo.name
             });
         }
+    },
+
+    /**
+     * 生命周期函数--监听页面初次渲染完成
+     */
+    onReady: function () {
+
+    },
+
+    /**
+     * 生命周期函数--监听页面显示
+     */
+    onShow: function () {
+        let that = this;
         // 下一场会议
         util.get({
             url: '/api/meeting/info/getNextMeeting',
@@ -100,20 +114,6 @@ Page({
     },
 
     /**
-     * 生命周期函数--监听页面初次渲染完成
-     */
-    onReady: function () {
-
-    },
-
-    /**
-     * 生命周期函数--监听页面显示
-     */
-    onShow: function () {
-        this.onLoad();
-    },
-
-    /**
      * 生命周期函数--监听页面隐藏
      */
     onHide: function () {