智慧保安互联网APP
shuishen
2021-08-13 a20be9f645f5403cd9976308d90db6991a95ad20
Merge branch 'master' of http://s16s652780.51mypc.cn:49896/r/zhba_app
6 files modified
139 ■■■■ changed files
components/submit/submit.vue 4 ●●●● patch | view | raw | blame | history
pages/groupChat/chating.vue 4 ●●● patch | view | raw | blame | history
pages/groupChat/groupChat.vue 4 ●●●● patch | view | raw | blame | history
pages/videoCall/videoCall.nvue 109 ●●●● patch | view | raw | blame | history
store/actions.js 1 ●●●● patch | view | raw | blame | history
store/mutations.js 17 ●●●●● patch | view | raw | blame | history
components/submit/submit.vue
@@ -76,7 +76,7 @@
    const recorderManager = uni.getRecorderManager()
    export default {
        props: ['names'],
        props: ['names','callname'],
        data() {
            return {
                isrecord: false,
@@ -294,7 +294,7 @@
                //     // }
                // }
                var url = '../videoCall/videoCall?state=' + val + '&type=video' + '&myname=' + this.names[0] +
                        '&toname=' + this.names[1]
                        '&toname=' + this.names[1] + '&callname=' + this.callname
            console.log(url)
                uni.navigateTo({
                    url: url
pages/groupChat/chating.vue
@@ -125,7 +125,7 @@
        </view>
        <!-- <view class="padbt"></view> -->
    </scroll-view>
    <submit @inputs="inputs"  :names="name"
    <submit @inputs="inputs"  :names="name" :callname="callName"
                    @heights="heights"/>
    </view>
</template>
@@ -171,6 +171,8 @@
            var data = JSON.parse(option.data)
            console.log(data,55555555555555555555555)
            this.name = ['wo',data.id];
            // console.log(data)
            this.callName = data.name;
        },
        methods:{
            // 返回键
pages/groupChat/groupChat.vue
@@ -72,7 +72,7 @@
                        name: '群组'
                    },
                    {
                        name: '通讯录'
                        name: '好友'
                    }
                ],
                swiperHeight: 0,
@@ -175,7 +175,7 @@
                    })
                }else if(this.current == 2){
                    uni.request({
                        url:"http://223.82.109.183:2080/api/blade-user/pages?current=1&size=9999",
                        url:"http://223.82.109.183:2080/api/blade-user/page?current=1&size=9999",
                        method:"get",
                        data:{
                            senderId: WxStorage.get("ids")
pages/videoCall/videoCall.nvue
@@ -4,7 +4,7 @@
        <view class="index" v-if="!videoShow">
            <view class="Mains" v-if="isMain">
                <view class="Mains-t">
                    <text class="activetext">正在呼叫{{toName}}</text>
                    <text class="activetext">正在呼叫{{callname}}</text>
                    <u-loading size="36" mode="flower"></u-loading>
                </view>
                <!-- 挂断 -->
@@ -15,8 +15,8 @@
            </view>
            <view class="Receiver" v-if="!isMain">
                <view class="Mains-t">
                    <text class="activetext">是否接收来自{{formName}}的{{Otype}}请求</text>
                    <text class="activetext">接受进入{{channel}}</text>
                    <text class="activetext">是否接收来自{{callname}}的{{Otype == 'video'? '视频': '音频'}}邀请</text>
                    <!-- <text class="activetext">接受进入{{channel}}</text> -->
                    <u-loading size="36" mode="flower"></u-loading>
                </view>
                <view class="i-control">
@@ -209,6 +209,10 @@
                formName: '',
                callname: '',
                faqiid: '',
                jieshouid: ''
@@ -223,6 +227,7 @@
        onLoad(option) {
            var that = this;
            that.toName = option.toname;
            that.callname = option.callname;
            console.log(option)
            if (option.type) {
                that.Otype = option.type;
@@ -290,10 +295,48 @@
                    // if (call && ) {
                    // }
                    // console.log(that,1111111111111)
                    if (data.type == 'close') {
                        console.log('对方已挂断');
                        RtcModule.leaveChannel((res) => {});
                        that.closeAll();
                        // RtcModule.leaveChannel((res) => {});
                        // that.closeAll();
                        RtcModule.leaveChannel((res) => {
                            console.log('成功退出房间');
                            // uni.navigateBack();
                        })
                        // await RtcModule.destroyRtc((res) => {});
                        that.videoShow = false; //视频展示
                        // this.videoShowBg = true; //背景展示
                        that.promptText = "loading...";
                        that.PeerVideoUser = []; //远端用户加入存储
                        // 本地
                        that.audioSwitch = "open"; //音频开关
                        that.vedioSwitch = "open"; //视频开关
                        // 重新创建实例
                        that.init();
                        // 如果需要跳转其它页面请按下边步骤
                        // await uni.redirectTo({
                        // url: '..',
                        // uni.showToast({
                        //     title: '正在退出视频',
                        //     duration: 2000,
                        //     icon: 'none'
                        // });
                        // success: () => {
                        // uni.navigateBack();
                        RtcModule.destroyRtc((res) => {
                            console.log("页面销毁", res.code);
                            console.log('成功销毁')
                            // uni.navigateBack();
                        });
                            uni.navigateBack();
                    }
                });
@@ -302,6 +345,7 @@
            } else if (option.state == "Receiver") {
                that.userName = 'jieshouren';
                // that.formName = 'wo';
                that.callname = option.name;
                that.channel = option.room;
                that.faqiid = option.faqiid;
                that.jieshouid = that.$store.state.puserID;
@@ -350,11 +394,11 @@
                console.log('开始初始化')
                this.uid = this.userName;
                console.log('初始化完成’', this.uid, '当前id码');
                uni.showToast({
                    title: this.uid,
                    duration: 2000,
                    // icon: 'none'
                });
                // uni.showToast({
                //     title: this.uid,
                //     duration: 2000,
                //     // icon: 'none'
                // });
                if (uni.getSystemInfoSync().platform == 'ios') {
                    //查看相机权限
                    await this.requestAndroidPermission("camera", 'ios');
@@ -645,7 +689,10 @@
            // 离开清空
            async closeAll() {
                // 销毁实例
                await RtcModule.leaveChannel((res) => {})
                // uni.navigateBack();
                await RtcModule.leaveChannel((res) => {
                    // uni.navigateBack();
                })
                // await RtcModule.destroyRtc((res) => {});
                this.videoShow = false; //视频展示
                // this.videoShowBg = true; //背景展示
@@ -660,13 +707,18 @@
                // 如果需要跳转其它页面请按下边步骤
                // await uni.redirectTo({
                // url: '..',
                // uni.showToast({
                //     title: '正在退出视频',
                //     duration: 2000,
                //     icon: 'none'
                // });
                // success: () => {
                // console.log('成功关闭')
                // uni.navigateBack();
                RtcModule.destroyRtc((res) => {
                    console.log("页面销毁", res.code);
                    console.log('成功关闭')
                    uni.navigateBack();
                    // uni.navigateBack();
                });
                // }
                // });
@@ -690,9 +742,36 @@
        },
        destroyed() {
            console.log('this.closeAll();');
            this.closeAll();
            // console.log('this.closeAll();');
            // this.closeAll();
            var that = this;
            uni.hideLoading();
            // uni.onSocketMessage(function(res) {
            //     console.log(res.data);
            //     var data = JSON.parse(res.data)
            //     // if (call && ) {
            //     // }
            //     if (data.type == 'close') {
            //         console.log('对方已挂断');
            //         // RtcModule.leaveChannel((res) => {});
            //         that.closeAll();
            //     }
            // });
            uni.onSocketMessage(function(res) {
                console.log(res.data);
                var data = JSON.parse(res.data)
                if (data.type == 'video') {
                    // this.receiveVideo('Receiver', );
                    console.log('进入接受 跳转', data.type)
                    uni.navigateTo({
                        url: '../videoCall/videoCall?state=Receiver&type=' + data.type + '&room=' + data
                            .roomId + '&name=' + data.name + '&faqiid=' + data.faqiid
                    });
                }
                // console.log('收到服务器内容:' + res.data);
            });
        }
    }
store/actions.js
@@ -145,6 +145,7 @@
        // }, 2000)
    }
}
export default actions
store/mutations.js
@@ -49,7 +49,8 @@
        console.log('登入数据传输成功  开始进入连接')
        
        uni.connectSocket({
            url: 'ws://http://223.82.109.183:2086/websocket'
            url: 'ws://223.82.109.183:2086/websocket'
            // url: 'ws://192.168.0.111:2086/websocket'
        });
        var socketOpen = false;
        uni.onSocketOpen(function(res) {
@@ -91,6 +92,20 @@
        WxStorage.set("accounts", data.accounts);
        WxStorage.set("pass", data.pass);
    },
    // useWebSocket(state){
    //     uni.onSocketMessage(function(res) {
    //         console.log(res.data);
    //         var data  = JSON.parse(res.data)
    //         if (data.type == 'video') {
    //             // this.receiveVideo('Receiver', );
    //             console.log('进入接受 跳转',data.type)
    //             uni.navigateTo({
    //                 url: '../videoCall/videoCall?state=Receiver&type=' + data.type +'&room=' + data.roomId + '&name=' + data.name + '&faqiid=' + data.faqiid
    //             });
    //         }
    //         // console.log('收到服务器内容:' + res.data);
    //     });
    // }
    loginReset(state) { //重置
        state.loging = false;
        state.message.useName = '过客 ';