12 files modified
1 files added
| | |
| | | data() { |
| | | return { |
| | | login: '', |
| | | |
| | | show: true, |
| | | name: 'a', |
| | | list: [{ |
| | | "name": 'tip', |
| | | "msg": 'The first content!' |
| | | }], |
| | | content: '123456' |
| | | } |
| | | }, |
| | | methods: { |
| | |
| | | url: 'pages/loging/loging?id=1', |
| | | }) |
| | | } |
| | | } |
| | | }, |
| | | //发送消息 |
| | | send: function() { |
| | | if (this.content) { |
| | | this.list.push({ |
| | | "name": this.name, |
| | | "msg": this.content |
| | | }) |
| | | console.log(this.list) |
| | | this.socket.emit('sendMessage', { |
| | | "name": this.name, |
| | | "msg": this.content |
| | | }); |
| | | this.content = '' |
| | | uni.pageScrollTo({ |
| | | duration: 0, |
| | | scrollTop: this.list.length * 100 |
| | | }) |
| | | } else { |
| | | uni.showToast({ |
| | | title: '请输入内容', |
| | | icon: 'none' |
| | | }) |
| | | } |
| | | }, |
| | | //提交姓名 |
| | | onSubmitName: function() { |
| | | console.log(this.name) |
| | | if (this.name) { |
| | | this.show = false |
| | | this.socket.emit('newPeople', this.name); |
| | | } |
| | | }, |
| | | }, |
| | | watch: {}, |
| | | mounted() {}, |
| | | mounted() { |
| | | // 加载长连接服务器 |
| | | // this.socket.on('connect', () => { |
| | | // console.log('connection created.'); |
| | | // // that.onSubmitName(); |
| | | // }); |
| | | |
| | | |
| | | |
| | | }, |
| | | onLaunch: function() { //初始化完成时触发(全局只触发一次) |
| | | var that = this; |
| | | if (WxStorage.get("init") == '') { |
| | | WxStorage.set("init", 'false'); |
| | | console.log('第一次进入') |
| | | console.log('第一次进入'); |
| | | |
| | | // uni.connectSocket({ |
| | | // url: 'ws://192.168.0.111:9034/websocket' |
| | | // }); |
| | | |
| | | // uni.onSocketOpen(function(res) { |
| | | // socketOpen = true; |
| | | // sendSocketMessage(); |
| | | // }); |
| | | |
| | | // function sendSocketMessage() { |
| | | // var data = { |
| | | // type: that.$store.state.puserName, |
| | | // id: that.$store.state.puserID |
| | | // } |
| | | // if (socketOpen) { |
| | | // uni.sendSocketMessage({ |
| | | // data: JSON.stringify(data) |
| | | // }); |
| | | // } |
| | | // } |
| | | |
| | | // 加载长连接服务器 |
| | | // this.socket.on('connect', () => { |
| | | // console.log('connection created.'); |
| | | // that.onSubmitName(); |
| | | // }); |
| | | |
| | | } |
| | | // this.judgeAdmin(); |
| | | }, |
| | |
| | | var datas = this.Pdata; |
| | | //alert(datas.name) |
| | | uni.navigateTo({ |
| | | url: '/pages/groupChat/chating?chatID=' + datas.id.toString() |
| | | url: '/pages/groupChat/chating?chatID=' + datas.id.toString() + '&data=' + JSON.stringify(datas) |
| | | }); |
| | | }, |
| | | onClose() { //触摸遮罩事件 |
| | |
| | | <view class="submit"> |
| | | <view class="submit-chat"> |
| | | <view class="bt-img"> |
| | | <image src="../../static/images/chatroom/voice.png" |
| | | mode="" |
| | | @tap="records"/> |
| | | <image src="../../static/images/chatroom/voice.png" mode="" @tap="records" /> |
| | | </view> |
| | | <textarea auto-height="true" |
| | | class="chat-send btn" |
| | | :class="{displaynone: isrecord}" |
| | | @input="inputs" |
| | | v-model="msg" |
| | | @focus="focus"/> |
| | | <view class="record btn" |
| | | :class="{displaynone: !isrecord}" |
| | | @touchstart="touchstart" |
| | | @touchend="touchend" |
| | | @touchmove="touchmove" |
| | | > |
| | | <textarea auto-height="true" class="chat-send btn" :class="{displaynone: isrecord}" @input="inputs" |
| | | v-model="msg" @focus="focus" /> |
| | | <view class="record btn" :class="{displaynone: !isrecord}" @touchstart="touchstart" @touchend="touchend" |
| | | @touchmove="touchmove"> |
| | | 按住说话 |
| | | </view> |
| | | <view class="bt-img"> |
| | | <image src="../../static/images/chatroom/emoji.png" |
| | | mode="" |
| | | @tap="emoji"/> |
| | | <image src="../../static/images/chatroom/emoji.png" mode="" @tap="emoji" /> |
| | | </view> |
| | | <view class="bt-img"> |
| | | <image src="../../static/images/chatroom/add.png" |
| | | mode="" |
| | | @tap="more"/> |
| | | <image src="../../static/images/chatroom/add.png" mode="" @tap="more" /> |
| | | </view> |
| | | </view> |
| | | <view class="emoji" |
| | | :class="{ displaynone: !isemoji }"> |
| | | <view class="emoji" :class="{ displaynone: !isemoji }"> |
| | | <view class="emoji-send"> |
| | | <view class="emoji-send-del" |
| | | @tap="emojiBack"> |
| | | 删除 |
| | | <view class="emoji-send-del" @tap="emojiBack"> |
| | | 删除 |
| | | </view> |
| | | <view class="emoji-send-bt" |
| | | @tap="emojiSend"> |
| | | 发送 |
| | | <view class="emoji-send-bt" @tap="emojiSend"> |
| | | 发送 |
| | | </view> |
| | | </view> |
| | | <emoji @emotion="emotion" |
| | | :height="260" /> |
| | | <emoji @emotion="emotion" :height="260" /> |
| | | </view> |
| | | |
| | | <view class="more" |
| | | :class="{ displaynone: !ismore }"> |
| | | <view class="more-list" |
| | | @tap="sendImg('album')"> |
| | | <image src="../../static/images/chatroom/photo.png"/> |
| | | |
| | | <view class="more" :class="{ displaynone: !ismore }"> |
| | | <view class="more-list" @tap="sendImg('album')"> |
| | | <image src="../../static/images/chatroom/photo.png" /> |
| | | <text class="more-list-title">图片</text> |
| | | </view> |
| | | <view class="more-list" |
| | | @tap="sendImg('camera')"> |
| | | <image src="../../static/images/chatroom/camera.png"/> |
| | | <view class="more-list" @tap="sendImg('camera')"> |
| | | <image src="../../static/images/chatroom/camera.png" /> |
| | | <text class="more-list-title">拍照</text> |
| | | </view> |
| | | <view class="more-list"> |
| | | <image src="../../static/images/chatroom/file.png"/> |
| | | <image src="../../static/images/chatroom/file.png" /> |
| | | <text class="more-list-title">文件</text> |
| | | </view> |
| | | <view class="more-list" |
| | | @tap="chooseLocation()"> |
| | | <image src="../../static/images/chatroom/location.png"/> |
| | | <view class="more-list" @tap="chooseLocation()"> |
| | | <image src="../../static/images/chatroom/location.png" /> |
| | | <text class="more-list-title">位置</text> |
| | | </view> |
| | | <view class="more-list"> |
| | | <image src="../../static/images/chatroom/vedio.png"/> |
| | | <view class="more-list" @click="openAudio('Mains')"> |
| | | <image src="../../static/images/chatroom/phone.png" /> |
| | | <text class="more-list-title">语音</text> |
| | | </view> |
| | | <view class="more-list" @click="openVideo('Mains')"> |
| | | <image src="../../static/images/chatroom/vedio.png" /> |
| | | <text class="more-list-title">视频</text> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | |
| | | |
| | | <!-- 录制语音遮罩 --> |
| | | <view class="voice-bg" |
| | | :class="{displaynone: !voicebg}"> |
| | | <view class="voice-bg" :class="{displaynone: !voicebg}"> |
| | | <view class="voice-bg-len"> |
| | | <view class="voice-bg-time" |
| | | :style="{width:vlength/0.6 + '%'}"> |
| | | <view class="voice-bg-time" :style="{width:vlength/0.6 + '%'}"> |
| | | {{ vlength }} " |
| | | </view> |
| | | </view> |
| | |
| | | |
| | | <script> |
| | | import emoji from './emoji/emoji.vue' |
| | | |
| | | |
| | | const recorderManager = uni.getRecorderManager() |
| | | |
| | | |
| | | export default { |
| | | props: ['names'], |
| | | data() { |
| | | return { |
| | | isrecord: false, |
| | |
| | | pageY: 0, |
| | | }; |
| | | }, |
| | | components:{ |
| | | components: { |
| | | emoji, |
| | | }, |
| | | methods:{ |
| | | methods: { |
| | | // 获取高度 |
| | | _getElementHeight() { |
| | | const query = uni.createSelectorQuery().in(this); |
| | |
| | | inputs(e) { |
| | | let chatm = e.detail.value |
| | | let pos = chatm.indexOf('\n') |
| | | if(pos != -1 && chatm.length > 1) { |
| | | this.send(this.msg,0) |
| | | } |
| | | setTimeout(() => { |
| | | this._getElementHeight() |
| | | },10) |
| | | }, |
| | | // 输入框聚焦 |
| | | focus(){ |
| | | this.isemoji = false; |
| | | this.ismore = false; |
| | | setTimeout(() => { |
| | | this._getElementHeight() |
| | | },10) |
| | | }, |
| | | // 表情内发送 |
| | | emojiSend() { |
| | | if(this.msg.length > 0) { |
| | | if (pos != -1 && chatm.length > 1) { |
| | | this.send(this.msg, 0) |
| | | } |
| | | setTimeout(() => { |
| | | this._getElementHeight() |
| | | },10) |
| | | }, 10) |
| | | }, |
| | | // 输入框聚焦 |
| | | focus() { |
| | | this.isemoji = false; |
| | | this.ismore = false; |
| | | setTimeout(() => { |
| | | this._getElementHeight() |
| | | }, 10) |
| | | }, |
| | | // 表情内发送 |
| | | emojiSend() { |
| | | if (this.msg.length > 0) { |
| | | this.send(this.msg, 0) |
| | | } |
| | | setTimeout(() => { |
| | | this._getElementHeight() |
| | | }, 10) |
| | | }, |
| | | // 表情退格 |
| | | emojiBack() { |
| | | if(this.msg.length > 0){ |
| | | this.msg = this.msg.substring(0, this.msg.length-1) |
| | | if (this.msg.length > 0) { |
| | | this.msg = this.msg.substring(0, this.msg.length - 1) |
| | | } |
| | | }, |
| | | // 发送消息 |
| | |
| | | }, 0) |
| | | setTimeout(() => { |
| | | this._getElementHeight() |
| | | },10) |
| | | }, 10) |
| | | }, |
| | | // 发送图片 |
| | | sendImg(e) { |
| | | let count = 9; |
| | | if(e == 'album') { |
| | | if (e == 'album') { |
| | | count = 9 |
| | | }else { |
| | | } else { |
| | | count = 1 |
| | | } |
| | | uni.chooseImage({ |
| | |
| | | sourceType: [e], |
| | | success: (res) => { |
| | | const filePath = res.tempFilePaths |
| | | for (let i in filePath){ |
| | | for (let i in filePath) { |
| | | this.send(filePath[i], 1) |
| | | } |
| | | } |
| | | }) |
| | | setTimeout(() => { |
| | | this._getElementHeight() |
| | | },10) |
| | | }, 10) |
| | | }, |
| | | // 音频处理 |
| | | touchstart(e) { |
| | |
| | | this.timer = setInterval(() => { |
| | | this.vlength = startIndex |
| | | startIndex++ |
| | | if(startIndex > 60) { |
| | | if (startIndex > 60) { |
| | | clearInterval(this.timer) |
| | | this.touchend(); |
| | | } |
| | |
| | | voice: res.tempFilePath, |
| | | time: this.vlength |
| | | } |
| | | if(this.voicebg){ |
| | | if (this.voicebg) { |
| | | this.send(data, 2); |
| | | } |
| | | } |
| | | this.vlength = 0 |
| | | this.voicebg = false |
| | | }) |
| | | }, |
| | | touchmove(e) { |
| | | if(this.pageY - e.changedTouches[0].pageY > 200) { |
| | | if (this.pageY - e.changedTouches[0].pageY > 200) { |
| | | this.voicebg = false |
| | | } |
| | | }, |
| | |
| | | console.log('经度' + res.longitude) |
| | | } |
| | | }) |
| | | }, |
| | | //开始音频 |
| | | openAudio(val) { //Mains |
| | | // console.log(this.names) |
| | | uni.navigateTo({ |
| | | url: '../videoCall/videoCall?state=' + val + '&type=audio' |
| | | }); |
| | | }, |
| | | //接收音频 |
| | | receiveAudio(val) { //Receiver |
| | | uni.navigateTo({ |
| | | url: '../videoCall/videoCall?state=' + val + '&type=audio' |
| | | }); |
| | | }, |
| | | //开始视频 |
| | | openVideo(val) { //Mains |
| | | uni.navigateTo({ |
| | | url: '../videoCall/videoCall?state=' + val + '&type=video' + '&myname=' + this.names[0] + |
| | | '&toname=' + this.names[1] |
| | | }); |
| | | }, |
| | | //接收视频 |
| | | receiveVideo(val, room) { //Receiver |
| | | uni.navigateTo({ |
| | | url: '../videoCall/videoCall?state=' + val + '&type=video' + '&room=' + room |
| | | }); |
| | | } |
| | | }, |
| | | mounted() { |
| | | // uni.onSocketMessage(function(res) { |
| | | // console.log(res.data) |
| | | // if (res.data.type == 'video') { |
| | | // this.receiveVideo('Receiver', ); |
| | | // } |
| | | // // console.log('收到服务器内容:' + res.data); |
| | | // }); |
| | | } |
| | | } |
| | | </script> |
| | |
| | | z-index: 1002; |
| | | padding-bottom: env(safe-area-inset-bottom); |
| | | } |
| | | |
| | | |
| | | .submit-chat { |
| | | width: 100%; |
| | | display: flex; |
| | | align-items: flex-end; |
| | | box-sizing: border-box; |
| | | padding: 14rpx 10rpx; |
| | | |
| | | |
| | | image { |
| | | width: 56rpx; |
| | | height: 56rpx; |
| | | margin: 0 10rpx; |
| | | flex: auto; |
| | | } |
| | | |
| | | |
| | | .btn { |
| | | flex: auto; |
| | | background-color: #fff; |
| | |
| | | max-height: 160rpx; |
| | | margin: 0 10rpx; |
| | | } |
| | | |
| | | |
| | | .chat-send { |
| | | line-height: 44rpx !important; |
| | | } |
| | | |
| | | |
| | | .record { |
| | | text-align: center; |
| | | font-size: $uni-font-size-lg; |
| | | color: $uni-text-color-grey; |
| | | font-weight: bold; |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | .displaynone { |
| | | display: none; |
| | | } |
| | | |
| | | |
| | | .emoji { |
| | | width: 100%; |
| | | height: 460rpx; |
| | | background: rgba(236, 237, 238, 1); |
| | | box-shadow: 0 -1rpx 0 0 rgba(0, 0, 0, 1); |
| | | |
| | | |
| | | .emoji-send { |
| | | width: 260rpx; |
| | | height: 104rpx; |
| | |
| | | right: 0; |
| | | padding-top: 24rpx; |
| | | display: flex; |
| | | |
| | | |
| | | .emoji-send-bt { |
| | | flex: 1; |
| | | height: 80rpx; |
| | | margin: 0 32rpx 0 20rpx; |
| | | background: rgba(255, 228, 49 ,1); |
| | | background: rgba(255, 228, 49, 1); |
| | | border-radius: 240rpx; |
| | | font-size: 32rpx; |
| | | text-align: center; |
| | | line-height: 80rpx; |
| | | border-radius: 12rpx; |
| | | } |
| | | |
| | | |
| | | .emoji-send-del { |
| | | flex: 1; |
| | | height: 80rpx; |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | .more { |
| | | width: 100%; |
| | | height: 436rpx; |
| | |
| | | bottom: env(safe-area-inset-bottom); |
| | | padding: 0 20rpx; |
| | | box-sizing: border-box; |
| | | |
| | | |
| | | .more-list { |
| | | width: 25%; |
| | | text-align: center; |
| | |
| | | background: rgba(255, 255, 255, 1); |
| | | border-radius: 24rpx; |
| | | } |
| | | |
| | | |
| | | .more-list-title { |
| | | color: rgba(30, 40, 50, .5); |
| | | line-height: 34rpx; |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | .voice-bg { |
| | | height: 100%; |
| | | width: 100%; |
| | |
| | | bottom: 0; |
| | | z-index: 1001; |
| | | // position: relative; |
| | | |
| | | |
| | | .voice-bg-len { |
| | | height: 84rpx; |
| | | width: 600rpx; |
| | |
| | | background: rgba(255, 255, 255, .2); |
| | | border-radius: 42rpx; |
| | | text-align: center; |
| | | |
| | | .voice-bg-time { |
| | | display: inline-block; |
| | | line-height: 84rpx; |
| | |
| | | min-width: 120rpx; |
| | | } |
| | | } |
| | | |
| | | |
| | | .voice-del { |
| | | position: absolute; |
| | | bottom: 148rpx; |
| | | margin-bottom: env(safe-area-inset-bottom); |
| | | width: 100%; |
| | | text-align: center; |
| | | color: #fff; |
| | | font-size: $uni-font-size-base; |
| | | color: #fff; |
| | | font-size: $uni-font-size-base; |
| | | } |
| | | } |
| | | </style> |
| | |
| | | import httpInstall from '@/http/install.js' |
| | | Vue.use(httpInstall, app) |
| | | |
| | | |
| | | |
| | | // 公共函数 |
| | | import globalFunc from '@/utils/func.js' |
| | | Vue.use(globalFunc, app); |
| | |
| | | "^u-(.*)": "@/uview-ui/components/u-$1/u-$1.vue" |
| | | }, |
| | | "pages": [ |
| | | { |
| | | "path": "pages/home/home", |
| | | "style": { |
| | | "navigationBarTitleText": "首页", |
| | | "enablePullDownRefresh": false, |
| | | "navigationStyle": "custom" |
| | | } |
| | | }, |
| | | // { |
| | | // "path": "pages/login/login-account", |
| | | // "path": "pages/home/home", |
| | | // "style": { |
| | | // "navigationBarTitleText": "登录", |
| | | // "navigationBarTitleText": "首页", |
| | | // "enablePullDownRefresh": false, |
| | | // "navigationStyle": "custom" |
| | | // } |
| | | // }, |
| | | { |
| | | "path": "pages/login/login-account", |
| | | "style": { |
| | | "navigationBarTitleText": "登录", |
| | | "enablePullDownRefresh": false, |
| | | "navigationStyle": "custom" |
| | | } |
| | | }, |
| | | { |
| | | "path": "pages/registerUser/registerUser", |
| | | "name": "loging", |
| | |
| | | // } |
| | | } |
| | | }, |
| | | // { |
| | | // "path": "pages/home/home", |
| | | // "style": { |
| | | // "navigationBarTitleText": "首页", |
| | | // "enablePullDownRefresh": false, |
| | | // "navigationStyle": "custom" |
| | | // } |
| | | // }, |
| | | { |
| | | "path": "pages/home/home", |
| | | "style": { |
| | | "navigationBarTitleText": "首页", |
| | | "enablePullDownRefresh": false, |
| | | "navigationStyle": "custom" |
| | | } |
| | | }, |
| | | { |
| | | "path": "pages/service/service", |
| | | "style": { |
| | |
| | | </view> |
| | | <!-- <view class="padbt"></view> --> |
| | | </scroll-view> |
| | | <submit @inputs="inputs" |
| | | <submit @inputs="inputs" :names="name" |
| | | @heights="heights"/> |
| | | </view> |
| | | </template> |
| | |
| | | loading: '', // 滚动事件 |
| | | isload: true, |
| | | isanimation: true, |
| | | begainloading: true |
| | | begainloading: true, |
| | | |
| | | name: []//视频 双方id |
| | | }; |
| | | }, |
| | | components:{ |
| | |
| | | this.recipientId = option.chatID; |
| | | this._getMsg(this.nowpage) |
| | | // this.nextPage() |
| | | var data = JSON.parse(option.data) |
| | | console.log(data,55555555555555555555555) |
| | | this.name = ['wo',data.id]; |
| | | }, |
| | | methods:{ |
| | | // 返回键 |
| | |
| | | var that = this; |
| | | that.senId = WxStorage.get("ids"); |
| | | uni.request({ |
| | | url:"http://s16s652780.51mypc.cn/api/chat-records/getSingleMessagePage", |
| | | url:"http://223.82.109.183:2082/api/chat-records/getSingleMessagePage", |
| | | method:"get", |
| | | data:{ |
| | | senderId: that.senId, |
| | |
| | | } |
| | | |
| | | uni.request({ |
| | | url:"http://s16s652780.51mypc.cn/api/chat-records/insertSingleChat", |
| | | url:"http://223.82.109.183:2082/api/chat-records/insertSingleChat", |
| | | method:"post", |
| | | data:{ |
| | | senderId: that.senId, |
| | |
| | | var that = this; |
| | | if(this.current == 0){ |
| | | uni.request({ |
| | | url:"http://s16s652780.51mypc.cn/api/chat-records/getChatListPage", |
| | | url:"http://223.82.109.183:2082/api/chat-records/getChatListPage", |
| | | method:"get", |
| | | data:{ |
| | | senderId: WxStorage.get("ids") |
| | |
| | | }); |
| | | }else if(this.current == 1){ |
| | | uni.request({ |
| | | url:"http://s16s652780.51mypc.cn/api/chatgroup/selectList", |
| | | url:"http://223.82.109.183:2082/api/chatgroup/selectList", |
| | | method:"POST", |
| | | data:{ |
| | | senderId: WxStorage.get("ids") |
| | |
| | | }) |
| | | }else if(this.current == 2){ |
| | | uni.request({ |
| | | url:"http://s16s652780.51mypc.cn/api//blade-user/pages?current=1&size=9999", |
| | | url:"http://223.82.109.183:2082/api/blade-user/pages?current=1&size=9999", |
| | | method:"get", |
| | | data:{ |
| | | senderId: WxStorage.get("ids") |
| | |
| | | serviceButton: [] |
| | | }; |
| | | }, |
| | | mounted() { |
| | | var socketOpen = false; |
| | | //websocket连接 |
| | | // uni.connectSocket({ |
| | | // url: 'ws://192.168.0.111:9034/websocket' |
| | | // }); |
| | | |
| | | // uni.onSocketOpen(function(res) { |
| | | // socketOpen = true; |
| | | // sendSocketMessage(); |
| | | // }); |
| | | |
| | | // function sendSocketMessage() { |
| | | // var data = { |
| | | // type: 'my', |
| | | // id: '1415922341221867522' |
| | | // } |
| | | // if (socketOpen) { |
| | | // uni.sendSocketMessage({ |
| | | // data: JSON.stringify(data) |
| | | // }); |
| | | // } |
| | | // } |
| | | |
| | | // uni.onSocketMessage(function(res) { |
| | | // console.log('收到服务器内容:' + res.data); |
| | | // }); |
| | | |
| | | }, |
| | | onLoad() { |
| | | |
| | | // 后续将改为与后端联动 |
| | | // 加载banner数据 |
| | | fakePosition().then(data => { |
| | |
| | | methods: { |
| | | openVideo(val){ |
| | | uni.navigateTo({ |
| | | url: '../videoCall/videoCall?state=' + val |
| | | url: '../videoCall/videoCall?state=' + val + '&type=video' |
| | | }); |
| | | }, |
| | | changePicker(e) { |
| | |
| | | <view class="index" v-if="!videoShow"> |
| | | <view class="Mains" v-if="isMain"> |
| | | <view class="Mains-t"> |
| | | <text class="activetext">正在呼叫{{MainName}}</text> |
| | | <text class="activetext">正在呼叫{{toName}}</text> |
| | | <u-loading size="36" mode="flower"></u-loading> |
| | | </view> |
| | | <!-- 挂断 --> |
| | |
| | | </view> |
| | | <view class="Receiver" v-if="!isMain"> |
| | | <view class="Mains-t"> |
| | | <text class="activetext">是否接收来自{{userName}}的视频请求</text> |
| | | <text class="activetext">是否接收来自{{formName}}的{{Otype}}请求</text> |
| | | <text class="activetext">接受进入{{channel}}</text> |
| | | <u-loading size="36" mode="flower"></u-loading> |
| | | </view> |
| | | <view class="i-control"> |
| | |
| | | </view> |
| | | |
| | | <!-- 视频 --> |
| | | <view class="vedioWatch" v-else> |
| | | <view class="vedioWatch" v-if="videoShow && Otype == 'video'"> |
| | | |
| | | <view class="video_bg"> |
| | | <image class="video_bg_img" src="../../static/BG.png" mode=""></image> |
| | |
| | | <!-- </view> --> |
| | | </view> |
| | | </view> |
| | | |
| | | <!-- 音频 --> |
| | | <view class="vedioWatch" v-if="videoShow && Otype == 'audio'"> |
| | | <view class="video_bg"> |
| | | <image class="video_bg_img" src="../../static/BG.png" mode=""></image> |
| | | <!-- <text class="activetext" v-if="videoShowBg"></text> --> |
| | | <!-- <view class="video_bg video_bg_text"> |
| | | |
| | | <text class="activetext">{{promptText}}</text> |
| | | </view> --> |
| | | </view> |
| | | <!-- 文字提示 --> |
| | | <view class="Mains-t"> |
| | | <text class="activetext">语音通话中</text> |
| | | <u-loading size="36" mode="flower"></u-loading> |
| | | </view> |
| | | |
| | | |
| | | <!-- 音视频基本开关 --> |
| | | <view class="videoshow_control position"> |
| | | <!-- 音频开关 --> |
| | | <view class="open" @click="audioSwitchFn" v-if="role == 1"> |
| | | <image class="video_bg_img" src="../../static/au_in.png" mode="" v-if="audioSwitch == 'open'"> |
| | | </image> |
| | | <image class="video_bg_img" src="../../static/au_on.png" mode="" v-else></image> |
| | | <text class="open_text">音频</text> |
| | | </view> |
| | | |
| | | <!-- 挂断 --> |
| | | <view class="open" @click="phoneFn"> |
| | | <image class="video_bg_img" src="../../static/over.png" mode=""></image> |
| | | <text class="open_text">挂断</text> |
| | | |
| | | </view> |
| | | |
| | | <!-- 视频开关 --> |
| | | <!-- <view class="open" @click="vedioSwitchFn" v-if="role == 1"> |
| | | <image class="video_bg_img" src="../../static/vi_on.png" mode="" v-if="vedioSwitch == 'open'"> |
| | | </image> |
| | | <image class="video_bg_img" src="../../static/vi_in.png" mode="" v-else></image> |
| | | <text class="open_text">视频</text> |
| | | </view> --> |
| | | |
| | | <!-- <scroll-view scroll-y="true" style="height: 500px;padding: 20px;"> |
| | | <view v-for="(item,value) in closeArray" :key='item+value'>{{item}}</view> |
| | | </scroll-view> --> |
| | | </view> |
| | | <!-- 提示文字 --> |
| | | <view class="video_bg video_bg_text" v-if="promptText"> |
| | | <!-- <view class="video_bg video_bg_text"> --> |
| | | <text class="activetext">{{promptText}}</text> |
| | | <!-- </view> --> |
| | | </view> |
| | | |
| | | </view> |
| | | <uni-popup ref="popup" type="center"> |
| | | <uni-popup-message :type="popupType" :message="popupMessage" :duration="2000"></uni-popup-message> |
| | | </uni-popup> |
| | |
| | | |
| | | |
| | | isMain: true, |
| | | userName: '111' |
| | | userName: '111', |
| | | toName: '', |
| | | Otype: '', |
| | | |
| | | formName:'' |
| | | } |
| | | }, |
| | | // 页面初始加载(仅执行一次) |
| | | onReady() { |
| | | // 初始化 |
| | | this.channel = 2554; |
| | | // this.channel = 2554; |
| | | this.init(); |
| | | }, |
| | | onLoad(option) { |
| | | console.log(option) |
| | | if (option.type) { |
| | | this.Otype = option.type; |
| | | } else { |
| | | return |
| | | } |
| | | console.log(option.state); |
| | | if (option.state == "Mains") { |
| | | this.isMain = true; |
| | | this.userName = 'faqiren'; |
| | | // this.userName = 'faqiren'; |
| | | this.userName = option.myname; |
| | | this.toName = option.toname; |
| | | setTimeout(res => { |
| | | // this.join(); |
| | | //发起请求 给后端双方姓名 |
| | | |
| | | |
| | | //得到返回值 开始视频 或者拒绝视频 |
| | | |
| | | |
| | | }, 2000) |
| | | this.join(); |
| | | |
| | | |
| | | }, 5000) |
| | | } else if (option.state == "Receiver") { |
| | | this.userName = 'jieshouren'; |
| | | this.formName = 'wo'; |
| | | this.channel = option.room; |
| | | this.isMain = false; |
| | | } |
| | | }, |
| | |
| | | phoneFnMain() { |
| | | // RtcModule.leaveChannel((res) => {}); |
| | | console.log("等待时候挂断"); |
| | | uni.navigateBack(); |
| | | // uni.navigateBack(); |
| | | this.closeAll(); |
| | | }, |
| | | joinit(){//接受进入视频 |
| | | joinit() { //接受进入视频 |
| | | // 传输接受的值 |
| | | |
| | | |
| | | // 开始进入视频通话 |
| | | }, |
| | | this.join(); |
| | | }, |
| | | //拒绝进入视频 |
| | | comeBack() { |
| | | |
| | | |
| | | |
| | | |
| | | // 传输拒绝的值 |
| | | |
| | | |
| | | |
| | | |
| | | console.log("拒绝进入视频"); |
| | | uni.navigateBack(); |
| | | |
| | | |
| | | // RtcModule.leaveChannel((res) => {}); |
| | | // this.closeAll(); |
| | | }, |
| | |
| | | // console.log('成功关闭') |
| | | // uni.navigateBack(); |
| | | RtcModule.destroyRtc((res) => { |
| | | console.log("页面销毁", res.code); |
| | | console.log("页面销毁", res.code); |
| | | console.log('成功关闭') |
| | | uni.navigateBack(); |
| | | // uni.navigateBack(); |
| | | }); |
| | | // } |
| | | // }); |
| | |
| | | ], |
| | | pasw = md5(data.pass), |
| | | // url = 'http://223.82.109.183:2080/api/blade-auth/oauth/token?tenantId=000000&username=' + data.name + |
| | | url = 'http://192.168.0.108:81/blade-auth/oauth/token?tenantId=000000&username=' + data.name + |
| | | url = store.state.piAPI + '/blade-auth/oauth/token?tenantId=000000&username=' + data.name + |
| | | ' &password=' + pasw + '&grant_type=password&scope=all&type=account'; |
| | | // url ='http://192.168.0.109:82/blade-auth/oauth/token'; |
| | | // url ='http://192.168.0.109:82/blade-auth/oauth/token?tenantId=000000&username=admin&password=93369e86dc5fa854a0eaf75558c4039d&grant_type=password'; |
| | | // url ='http://web.byisf.com/api/blade-auth/oauth/token?tenantId=000000&username=admin&password=93369e86dc5fa854a0eaf75558c4039d&grant_type=password&scope=all'; |
| | | // console.log(url); |
| | | console.log(store.state.piAPI); |
| | | wx.request({ //uniapp 自带axios |
| | | url: url, //仅为示例,并非真实接口地址。 |
| | | // data: d, |
| | |
| | | // // dataType: 'JSON', |
| | | success: (res) => { |
| | | if (res.statusCode == 200) { |
| | | console.log(res) |
| | | if (res.data.error_code == "400") { |
| | | uni.showToast({ |
| | | title: '密码错误,请重试', |
| | |
| | | const store = new Vuex.Store({ |
| | | // 下面这些值仅为示例,使用过程中请删除 |
| | | state: { |
| | | |
| | | // 如果上面从本地获取的lifeData对象下有对应的属性,就赋值给state中对应的变量 |
| | | userInfo: lifeData.userInfo ? lifeData.userInfo : { |
| | | avatar: '', |
| | |
| | | }, |
| | | logPath: '', |
| | | // piAPI: 'http://223.82.109.183:2080/api', |
| | | piAPI: 'http://223.82.109.183:2082/api', |
| | | // piAPI: 'http://localhost:82/', |
| | | piAPI: 'http://192.168.0.108:81', |
| | | // piAPI: 'http://192.168.0.108:81', |
| | | puserName: '', |
| | | puserID: '', |
| | | puserIphone:'', |
| | |
| | | state.puserID = data.userID; |
| | | state.avatar = data.avatar; |
| | | } |
| | | |
| | | uni.connectSocket({ |
| | | url: 'ws://192.168.0.111:9034/websocket' |
| | | }); |
| | | var socketOpen = false; |
| | | uni.onSocketOpen(function(res) { |
| | | socketOpen = true; |
| | | console.log('持续连接成功') |
| | | sendSocketMessage(); |
| | | }); |
| | | |
| | | function sendSocketMessage() { |
| | | var data = { |
| | | // type: state.puserName, |
| | | id: state.puserID, |
| | | type: 'login' |
| | | } |
| | | if (socketOpen) { |
| | | uni.sendSocketMessage({ |
| | | data: JSON.stringify(data) |
| | | }); |
| | | } |
| | | } |
| | | |
| | | 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 |
| | | }); |
| | | // } |
| | | // console.log('收到服务器内容:' + res.data); |
| | | }); |
| | | |
| | | //储存用户 |
| | | WxStorage.set("init", "true"); |
| | | WxStorage.set("name", data.userName); |