This commit is contained in:
2023-10-29 13:17:28 +08:00
parent dee9051652
commit 336bcc662b
29 changed files with 3077 additions and 169 deletions

View File

@@ -1,8 +1,9 @@
VUE_APP_MAP_URL='http://82.157.23.170:8600/geoserver' VUE_APP_MAP_URL='http://82.157.23.170:8600/geoserver'
VUE_APP_MAP_AUTHKEY='9b488ac6-5309-4ef4-ab99-2180d2da161d' VUE_APP_MAP_AUTHKEY='9b488ac6-5309-4ef4-ab99-2180d2da161d'
VUE_APP_API="http://work.ii999.live:19002/znzq" VUE_APP_API="http://work.ii999.live:19002/znzq"
VUE_APP_STATIC_FILE_Prefix='http://43.139.191.204:8908'
VUE_APP_STATIC_FILE_Prefix='https://119.45.242.222/static_file/'
VUE_APP_SRS_URL='webrtc://119.45.242.222/' VUE_APP_SRS_URL='webrtc://119.45.242.222/'
VUE_APP_IM_API_URL='https://119.45.242.222/im_api/v1' VUE_APP_IM_API_URL='https://dev.shudong.xyz/im_api/v1'

View File

@@ -1,7 +1,7 @@
VUE_APP_MAP_URL='http://172.16.2.2:8600/geoserver' VUE_APP_MAP_URL='http://172.16.2.2:8600/geoserver'
VUE_APP_MAP_AUTHKEY='30efbafe-d218-4d77-8200-0207246924be' VUE_APP_MAP_AUTHKEY='30efbafe-d218-4d77-8200-0207246924be'
VUE_APP_API="http://172.16.2.3:19000/znzq" VUE_APP_API="http://172.16.2.3:19000/znzq"
VUE_APP_STATIC_FILE_Prefix='http://43.139.191.204:8908' VUE_APP_STATIC_FILE_Prefix='https://172.16.3.19/static_file'
VUE_APP_SRS_URL='webrtc://172.16.3.19/' VUE_APP_SRS_URL='webrtc://172.16.3.19/'
VUE_APP_IM_API_URL='https://172.16.3.19/im_api/v1' VUE_APP_IM_API_URL='https://172.16.3.19/im_api/v1'

View File

@@ -3538,6 +3538,11 @@
"resolved": "https://registry.npmmirror.com/csstype/-/csstype-3.1.2.tgz", "resolved": "https://registry.npmmirror.com/csstype/-/csstype-3.1.2.tgz",
"integrity": "sha512-I7K1Uu0MBPzaFKg4nI5Q7Vs2t+3gWWW648spaF+Rg7pI9ds18Ugn+lvg4SHczUdKlHI5LWBXyqfS8+DufyBsgQ==" "integrity": "sha512-I7K1Uu0MBPzaFKg4nI5Q7Vs2t+3gWWW648spaF+Rg7pI9ds18Ugn+lvg4SHczUdKlHI5LWBXyqfS8+DufyBsgQ=="
}, },
"dayjs": {
"version": "1.11.10",
"resolved": "https://registry.npmmirror.com/dayjs/-/dayjs-1.11.10.tgz",
"integrity": "sha512-vjAczensTgRcqDERK0SR2XMwsF/tSvnvlv6VcF2GIhg6Sx4yOIt/irsr1RDJsKiIyBzJDpCoXiWWq28MqH2cnQ=="
},
"de-indent": { "de-indent": {
"version": "1.0.2", "version": "1.0.2",
"resolved": "https://registry.npmmirror.com/de-indent/-/de-indent-1.0.2.tgz", "resolved": "https://registry.npmmirror.com/de-indent/-/de-indent-1.0.2.tgz",

View File

@@ -14,6 +14,7 @@
"amfe-flexible": "^2.2.1", "amfe-flexible": "^2.2.1",
"axios": "^1.5.1", "axios": "^1.5.1",
"core-js": "^3.8.3", "core-js": "^3.8.3",
"dayjs": "^1.11.10",
"less": "^4.2.0", "less": "^4.2.0",
"less-loader": "^11.1.3", "less-loader": "^11.1.3",
"lib-flexible": "^0.3.2", "lib-flexible": "^0.3.2",

View File

@@ -3,7 +3,7 @@
<head> <head>
<script type="text/javascript" src="./vconsole.min.js"></script> <script type="text/javascript" src="./vconsole.min.js"></script>
<script> <script>
// var vConsole = new VConsole(); var vConsole = new VConsole();
console.log('Hello world'); console.log('Hello world');
</script> </script>
<meta charset="utf-8"> <meta charset="utf-8">

View File

@@ -1,4 +1,3 @@
/** /**
* The MIT License (MIT) * The MIT License (MIT)
* *
@@ -29,14 +28,66 @@
function SrsRtcPublisherAsync() { function SrsRtcPublisherAsync() {
var self = {}; var self = {};
self.cameraIndex=0
self.cameraDevices = []
self.url=""
// https://developer.mozilla.org/en-US/docs/Web/API/MediaDevices/getUserMedia // https://developer.mozilla.org/en-US/docs/Web/API/MediaDevices/getUserMedia
self.constraints = { self.constraints = {
audio: true, audio: true,
video: { video: {
deviceId:{
exact:"136e115ef37b7ec8361207a61d42cd39818381aa0e99728e35eb9746bedce6b4"
},
width: {ideal: 320, max: 576} width: {ideal: 320, max: 576}
} }
}; };
self.initDevices = async function () {
// await navigator.mediaDevices.enumerateDevices().then(gotDevices).catch(handleError);
}
function gotDevices(deviceInfos) {
let option = {}
// Handles being called several times to update labels. Preserve values.
for (let i = 0; i !== deviceInfos.length; ++i) {
const deviceInfo = deviceInfos[i];
const option = document.createElement('option');
option.value = deviceInfo.deviceId;
if (deviceInfo.kind === 'audioinput') {
console.log(option)
console.log(deviceInfo)
} else if (deviceInfo.kind === 'audiooutput') {
console.log(option)
console.log(deviceInfo)
} else if (deviceInfo.kind === 'videoinput') {
self.cameraDevices.push(deviceInfo)
} else {
console.log('Some other kind of source/device: ', deviceInfo);
}
}
}
function handleError(error) {
console.log('navigator.getUserMedia error: ', error);
}
self.changeCamera = async function(){
// console.log('navigator.getUserMedia')
// console.log(self.cameraDevices)
self.cameraIndex=self.cameraIndex+1==self.cameraDevices.length?0:self.cameraIndex+1
let deviceId={
exact:""
}
deviceId.exact=self.cameraDevices[self.cameraIndex].deviceId
self.constraints.video.deviceId=deviceId
self.publish(self.url)
console.log(self.constraints)
}
// @see https://github.com/rtcdn/rtcdn-draft // @see https://github.com/rtcdn/rtcdn-draft
// @url The WebRTC url to play with, for example: // @url The WebRTC url to play with, for example:
// webrtc://r.ossrs.net/live/livestream // webrtc://r.ossrs.net/live/livestream
@@ -59,12 +110,17 @@ function SrsRtcPublisherAsync() {
// or any other information, will pass-by in the query: // or any other information, will pass-by in the query:
// webrtc://r.ossrs.net/live/livestream?vhost=xxx // webrtc://r.ossrs.net/live/livestream?vhost=xxx
// webrtc://r.ossrs.net/live/livestream?token=xxx // webrtc://r.ossrs.net/live/livestream?token=xxx
self.publish = async function (url) { self.publish = async function (url,constraints={}) {
self.url=url;
var conf = self.__internal.prepareUrl(url); var conf = self.__internal.prepareUrl(url);
self.pc.addTransceiver("audio", {direction: "sendonly"}); self.pc.addTransceiver("audio", {direction: "sendonly"});
self.pc.addTransceiver("video", {direction: "sendonly"}); self.pc.addTransceiver("video", {direction: "sendonly"});
var stream = await navigator.mediaDevices.getUserMedia(self.constraints);
var stream = await navigator.mediaDevices.getUserMedia(constraints);
// @see https://developer.mozilla.org/en-US/docs/Web/API/RTCPeerConnection/addStream#Migrating_to_addTrack // @see https://developer.mozilla.org/en-US/docs/Web/API/RTCPeerConnection/addStream#Migrating_to_addTrack
stream.getTracks().forEach(function (track) { stream.getTracks().forEach(function (track) {
@@ -156,7 +212,7 @@ function SrsRtcPublisherAsync() {
return { return {
apiUrl: apiUrl, streamUrl: streamUrl, schema: schema, urlObject: urlObject, port: port, apiUrl: apiUrl, streamUrl: streamUrl, schema: schema, urlObject: urlObject, port: port,
tid: Number(parseInt(new Date().getTime()*Math.random()*100)).toString(16).slice(0, 7) tid: Number(parseInt(new Date().getTime() * Math.random() * 100)).toString(16).slice(0, 7)
}; };
}, },
parse: function (url) { parse: function (url) {
@@ -300,14 +356,14 @@ function SrsRtcPlayerAsync() {
// or any other information, will pass-by in the query: // or any other information, will pass-by in the query:
// webrtc://r.ossrs.net/live/livestream?vhost=xxx // webrtc://r.ossrs.net/live/livestream?vhost=xxx
// webrtc://r.ossrs.net/live/livestream?token=xxx // webrtc://r.ossrs.net/live/livestream?token=xxx
self.play = async function(url) { self.play = async function (url) {
var conf = self.__internal.prepareUrl(url); var conf = self.__internal.prepareUrl(url);
self.pc.addTransceiver("audio", {direction: "recvonly"}); self.pc.addTransceiver("audio", {direction: "recvonly"});
self.pc.addTransceiver("video", {direction: "recvonly"}); self.pc.addTransceiver("video", {direction: "recvonly"});
var offer = await self.pc.createOffer(); var offer = await self.pc.createOffer();
await self.pc.setLocalDescription(offer); await self.pc.setLocalDescription(offer);
var session = await new Promise(function(resolve, reject) { var session = await new Promise(function (resolve, reject) {
// @see https://github.com/rtcdn/rtcdn-draft // @see https://github.com/rtcdn/rtcdn-draft
var data = { var data = {
api: conf.apiUrl, tid: conf.tid, streamurl: conf.streamUrl, api: conf.apiUrl, tid: conf.tid, streamurl: conf.streamUrl,
@@ -317,15 +373,16 @@ function SrsRtcPlayerAsync() {
$.ajax({ $.ajax({
type: "POST", url: conf.apiUrl, data: JSON.stringify(data), type: "POST", url: conf.apiUrl, data: JSON.stringify(data),
contentType:'application/json', dataType: 'json' contentType: 'application/json', dataType: 'json'
}).done(function(data) { }).done(function (data) {
console.log("Got answer: ", data); console.log("Got answer: ", data);
if (data.code) { if (data.code) {
reject(data); return; reject(data);
return;
} }
resolve(data); resolve(data);
}).fail(function(reason){ }).fail(function (reason) {
reject(reason); reject(reason);
}); });
}); });
@@ -337,7 +394,7 @@ function SrsRtcPlayerAsync() {
}; };
// Close the player. // Close the player.
self.close = function() { self.close = function () {
self.pc && self.pc.close(); self.pc && self.pc.close();
self.pc = null; self.pc = null;
}; };
@@ -383,7 +440,7 @@ function SrsRtcPlayerAsync() {
return { return {
apiUrl: apiUrl, streamUrl: streamUrl, schema: schema, urlObject: urlObject, port: port, apiUrl: apiUrl, streamUrl: streamUrl, schema: schema, urlObject: urlObject, port: port,
tid: Number(parseInt(new Date().getTime()*Math.random()*100)).toString(16).slice(0, 7) tid: Number(parseInt(new Date().getTime() * Math.random() * 100)).toString(16).slice(0, 7)
}; };
}, },
parse: function (url) { parse: function (url) {
@@ -496,7 +553,7 @@ function SrsRtcPlayerAsync() {
self.stream = new MediaStream(); self.stream = new MediaStream();
// https://developer.mozilla.org/en-US/docs/Web/API/RTCPeerConnection/ontrack // https://developer.mozilla.org/en-US/docs/Web/API/RTCPeerConnection/ontrack
self.pc.ontrack = function(event) { self.pc.ontrack = function (event) {
if (self.ontrack) { if (self.ontrack) {
self.ontrack(event); self.ontrack(event);
} }
@@ -511,7 +568,7 @@ function SrsRtcFormatSenders(senders, kind) {
var codecs = []; var codecs = [];
senders.forEach(function (sender) { senders.forEach(function (sender) {
var params = sender.getParameters(); var params = sender.getParameters();
params && params.codecs && params.codecs.forEach(function(c) { params && params.codecs && params.codecs.forEach(function (c) {
if (kind && sender.track.kind !== kind) { if (kind && sender.track.kind !== kind) {
return; return;
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 812 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 598 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

@@ -1,17 +1,38 @@
<template> <template>
<div> <div class="videoRoomContainer">
<div class="wrapper"> <div class="wrapper">
<video ref="videoStreamtopVideo" width="100%" autoplay muted controls></video> <video ref="videoStreamtopVideo" width="100%" autoplay></video>
<div class="swiper-container"> <div class="swiper-container">
<div class="swiper-wrapper"> <div class="swiper-wrapper">
<template v-for="(item,index) in videoRoomSteamList"> <template v-for="(item,index) in videoRoomSteamList">
<div :key="item.webrtcUrl" class="swiper-slide"> <div :key="item.webrtcUrl" class="swiper-slide">
<video class="remoteVideo" :ref="'videoStream'+item.publishId" width="100%" autoplay <video class="remoteVideo" :ref="'videoStream'+item.publishId" width="100%" autoplay @click="videoClickAction(item.publishId)"></video>
@click="videoClickAction(item.publishId)"></video>
</div> </div>
</template> </template>
</div> </div>
</div> </div>
<div class="actionBtnList">
<div @click="closeVoice">
<div class="actionBtn">
<img :src="voiceImg">
</div>
</div>
<div @click="closeCamera">
<div class="actionBtn">
<img :src="cameraImg">
</div>
</div>
<div @click="switchCamera">
<div class="actionBtn">
<img :src="switchCameraImg">
</div>
</div>
</div>
<div class="callDownBox">
<div @click="videoDownAction">
<img :src="callDwonImg">
</div>
</div>
</div> </div>
<!-- <video ref="localVideo" id="rtc_media_local_player" width="310" autoplay muted controls></video>--> <!-- <video ref="localVideo" id="rtc_media_local_player" width="310" autoplay muted controls></video>-->
<!-- <van-button type="primary" @click="playVideo">主要按钮</van-button>--> <!-- <van-button type="primary" @click="playVideo">主要按钮</van-button>-->
@@ -23,6 +44,9 @@
import axios from "axios"; import axios from "axios";
import Swiper from 'swiper'; // 注意引入的是Swiper import Swiper from 'swiper'; // 注意引入的是Swiper
import 'swiper/css/swiper.min.css' // 注意这里的引入 import 'swiper/css/swiper.min.css' // 注意这里的引入
import {Notify, Dialog} from 'vant';
import {getStatisFileUrl} from '../utils/publicFun'
/* eslint-disable */ /* eslint-disable */
export default { export default {
@@ -39,6 +63,27 @@ export default {
videoRoomSteamList: [], videoRoomSteamList: [],
oldVideoStreamList: [], oldVideoStreamList: [],
swiperInstance: null, swiperInstance: null,
publishSdk: null,
publistUrl: "",
constraints: {
audio: true,
video: {
// deviceId: {
// exact: "136e115ef37b7ec8361207a61d42cd39818381aa0e99728e35eb9746bedce6b4"
// },
width: {ideal: 320, max: 576}
}
},
cameraDevices: [],
cameraIndex: 0,
isCloseCamera: false,
isCloseVoice: false,
voiceImg: "",
cameraImg: "",
switchCameraImg: "",
callDwonImg: "",
showConfirmDialog:0,
inviteName:0,
}; };
}, },
mounted() { mounted() {
@@ -46,30 +91,126 @@ export default {
this.isPlayer = this.$route.query.isPlayer; this.isPlayer = this.$route.query.isPlayer;
this.uid = this.$route.query.uid; this.uid = this.$route.query.uid;
this.roomId = this.$route.query.room; this.roomId = this.$route.query.room;
this.inviteName = this.$route.query.inviteName||'';
this.topVideo = this.uid; this.topVideo = this.uid;
this.showConfirmDialog = this.$route.query.showConfirmDialog;
if (this.isPublish == 1) {
this.beginPublish() this.voiceImg = getStatisFileUrl("/media/voice_open.png")
this.cameraImg = getStatisFileUrl("/media/camera_open.png")
this.switchCameraImg = getStatisFileUrl("/media/switch.png")
this.callDwonImg = getStatisFileUrl("/media/call_down.png")
if(this.showConfirmDialog==1){
Dialog.confirm({
title: '是否接受?',
message: `${this.inviteName}邀请你加入视频聊天`,
})
.then(() => {
this.init();
// on confirm
})
.catch(() => {
location.href = "uniwebview://action?function=refuseVideoInvite";
// on cancel
});
}else {
this.init();
} }
if (this.isPlayer == 1) {
this.roomTimer = setInterval(() => {
this.getRoomVideoList();
}, 2000)
}
this.swiperInstance = new Swiper('.swiper-container', {
slidesPerView: 4,
spaceBetween: 30,
observer: true,
on: {},
})
}, },
beforeDestroy() { beforeDestroy() {
clearInterval(this.roomTimer); clearInterval(this.roomTimer);
this.roomTimer = null; this.roomTimer = null;
this.leaveRoom(); this.leaveRoom();
}, },
methods: { methods: {
init(){
if (this.isPublish == 1) {
this.beginPublish()
}
if (this.isPlayer == 1) {
this.roomTimer = setInterval(() => {
this.getRoomVideoList();
}, 2000)
}
this.swiperInstance = new Swiper('.swiper-container', {
slidesPerView: 4,
spaceBetween: 30,
observer: true,
on: {},
})
},
closeVoice() {
this.constraints.audio = false;
//如果声音是开启状态
if (!this.isCloseVoice) {
// 关闭声音
this.isCloseVoice=true
this.voiceImg = getStatisFileUrl("/media/voice_close.png")
}else {
// 打开声音
this.isCloseVoice=false;
this.constraints.audio = true
this.voiceImg = getStatisFileUrl("/media/voice_open.png")
}
console.log(this.isCloseVoice)
console.log(this.voiceImg)
this.beginPublish()
},
closeCamera() {
this.constraints.video = false;
//如果视频是开启状态
if (!this.isCloseCamera) {
this.constraints.video=false
this.isCloseCamera=true
this.cameraImg = getStatisFileUrl("/media/camera_close.png")
}else {
let deviceId = {
exact: ""
}
deviceId.exact = this.cameraDevices[this.cameraIndex].deviceId
this.constraints.video = {}
this.constraints.video.deviceId = deviceId
this.isCloseCamera=false
this.cameraImg = getStatisFileUrl("/media/camera_open.png")
}
this.beginPublish()
},
switchCamera() {
let self = this;
self.cameraIndex = self.cameraIndex + 1 == self.cameraDevices.length ? 0 : self.cameraIndex + 1
let deviceId = {
exact: ""
}
deviceId.exact = self.cameraDevices[self.cameraIndex].deviceId
self.constraints.video.deviceId = deviceId
this.beginPublish()
},
gotDevices(deviceInfos) {
for (let i = 0; i !== deviceInfos.length; ++i) {
const deviceInfo = deviceInfos[i];
const option = document.createElement('option');
option.value = deviceInfo.deviceId;
if (deviceInfo.kind === 'audioinput') {
// console.log(option)
// console.log(deviceInfo)
} else if (deviceInfo.kind === 'audiooutput') {
// console.log(option)
// console.log(deviceInfo)
} else if (deviceInfo.kind === 'videoinput') {
this.cameraDevices.push(deviceInfo)
} else {
console.log('Some other kind of source/device: ', deviceInfo);
}
}
},
handleError(error) {
console.log('navigator.getUserMedia error: ', error);
},
beginPublish() { beginPublish() {
let _this = this; let _this = this;
//http://localhost:8080/hd-glasses-app/#/call_room?isPublish=1&isPlayer=1&uid=123&room=call_room //http://localhost:8080/hd-glasses-app/#/call_room?isPublish=1&isPlayer=1&uid=123&room=call_room
@@ -77,21 +218,24 @@ export default {
// var query = parse_query_string(); // var query = parse_query_string();
const publistUrl = process.env.VUE_APP_SRS_URL + this.roomId + "/" + this.uid; const publistUrl = process.env.VUE_APP_SRS_URL + this.roomId + "/" + this.uid;
_this.publistUrl = publistUrl;
// srs_init_rtc("#txt_url", publistUrl); // srs_init_rtc("#txt_url", publistUrl);
//初始化sdk navigator.mediaDevices.enumerateDevices().then(this.gotDevices).catch(this.handleError);
let sdk = null;
if (sdk) {
sdk.close(); if (_this.publishSdk) {
_this.publishSdk.close();
} }
sdk = new SrsRtcPublisherAsync(); _this.publishSdk = null;
//绑定本地视频流
_this.publishSdk = new SrsRtcPublisherAsync();
// 绑定本地视频流
// const localVideo = this.$refs.localVideo; // const localVideo = this.$refs.localVideo;
// localVideo.srcObject = null; // localVideo.srcObject = null;
// localVideo.srcObject = sdk.stream; // localVideo.srcObject = sdk.stream;
sdk.publish(publistUrl).then((session) => { _this.publishSdk.publish(publistUrl, _this.constraints).then((session) => {
_this.joinRoom() _this.joinRoom()
}).catch(function (reason) { }).catch(function (reason) {
console.error(reason) console.error(reason)
@@ -106,7 +250,7 @@ export default {
alert(`getUserMedia ${reason.name} ${reason.message}`); alert(`getUserMedia ${reason.name} ${reason.message}`);
} }
} }
sdk.close(); _this.publishSdk.close();
console.error(reason); console.error(reason);
}); });
@@ -262,6 +406,14 @@ export default {
this.$refs.videoStreamtopVideo.srcObject = video.srcObject; this.$refs.videoStreamtopVideo.srcObject = video.srcObject;
} }
},
videoDownAction(){
location.href = "uniwebview://action?function=restartCamera";
if(this.showConfirmDialog==1){
location.href = "uniwebview://action?function=restartCamera";
}else {
}
} }
} }
} }
@@ -269,6 +421,12 @@ export default {
<style lang="less"> <style lang="less">
.videoRoomContainer{
width:100vw;
height: 100vh;
background-color: #333030;
}
.slide { .slide {
height: 200px; height: 200px;
width: 200px; width: 200px;
@@ -289,4 +447,49 @@ export default {
height: auto; height: auto;
} }
} }
.actionBtnList {
margin-top: 50px;
display: flex;
flex-direction: row;
justify-content: space-around;
font-size: 16px;
.actionBtn {
width: 100px;
height: 100px;
border-radius: 100%;
background:#000000;
display: flex;
justify-content: center;
align-items: center;
img{
width: 50%;
height: 50%;
}
}
}
.callDownBox{
margin-top: 150px;
display: flex;
flex-direction: row;
justify-content: space-around;
font-size: 16px;
div{
width: 100px;
height: 100px;
border-radius: 100%;
background:#DA4C4B;
display: flex;
justify-content: center;
align-items: center;
img{
width: 50%;
height: 50%;
}
}
}
</style> </style>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -2,17 +2,19 @@
<div id="content"> <div id="content">
<div id="map" ref="map" style="width: 100vw; height: 100vh"/> <div id="map" ref="map" style="width: 100vw; height: 100vh"/>
<div id="overlay-box"/> <div id="overlay-box"/>
<div class="addAlarmPoint" v-if="page=='addAlarmPoint'"> <div class="addAlarmPoint" v-if="page=='addAlarmPoint'">
<div class="addAlarmPointNext" @click="addAlarmPointNextAction">下一步</div> <div class="addAlarmPointNext" @click="addAlarmPointNextAction">下一步</div>
</div> </div>
<div class="mobileHomePageExpandBtn" v-if="page=='mobileHomePage'"> <div class="mobileHomePageExpandBtn" v-if="page=='mobileHomePage'">
<van-icon name="expand-o" color="white" @click="switchFullScreen"/> <van-icon name="expand-o" color="white" @click="switchFullScreen"/>
</div> </div>
<div class="iconColorList" v-if="page=='mobileHomePage'&&pageType=='large'">
<div class="iconColorListItem"><span style="background-color: #FF0000"></span>报警点位</div> <!-- '#FF4D36':'#ffa502'-->
<div class="iconColorListItem"><span style="background-color: #369FFF"></span>在线</div>
<div class="iconColorListItem"><span style="background-color: #9B9B9B"></span>离线</div> <div class="iconColorList">
<div class="iconColorListItem"><span style="background-color: #16CE81"></span>接收报警</div> <div class="iconColorListItem" style="color: #ffa502"><span style="background-color: #ffa502"></span>计划路线</div>
<div class="iconColorListItem" style="color: #FF4D36"><span style="background-color: #FF4D36"></span>实际路线</div>
</div> </div>
<van-overlay :show="alarmDetailsOverlay" @click="alarmDetailsOverlay = false" z-index="20"> <van-overlay :show="alarmDetailsOverlay" @click="alarmDetailsOverlay = false" z-index="20">
<div class="alarmDetailsOverlayWrapper" @click.stop> <div class="alarmDetailsOverlayWrapper" @click.stop>
@@ -31,6 +33,8 @@
</div> </div>
</div> </div>
</van-overlay> </van-overlay>
<!-- <!--
<div class="pcPlanningPath" v-if="page=='pcPlanningPath'"> <div class="pcPlanningPath" v-if="page=='pcPlanningPath'">
<div class="pcPlanningPathNext" @click="clearPcPlanningPath">清空重新绘制</div> <div class="pcPlanningPathNext" @click="clearPcPlanningPath">清空重新绘制</div>
@@ -60,10 +64,15 @@ import {OL as ol} from "plot-ol/plottingol";
import GeoJSON from 'ol/format/GeoJSON' import GeoJSON from 'ol/format/GeoJSON'
import service from "@/utils/service"; import service from "@/utils/service";
import {appInit, getStatisFileUrl} from "../utils/publicFun"; import {appInit, getStatisFileUrl} from "../utils/publicFun";
import dayjs from "dayjs"
export default { export default {
data() { data() {
return { return {
showstartDate: false,
showendDate: false,
startDate: dayjs().subtract(1, 'hour').toDate(),
endDate: dayjs().toDate(),
map: {}, map: {},
pointLayer: {}, pointLayer: {},
canAddPoints: false, canAddPoints: false,
@@ -122,11 +131,16 @@ export default {
planningVectorLayer: {}, planningVectorLayer: {},
parentPostMessageData: [], parentPostMessageData: [],
isCanDraw: true, isCanDraw: true,
moveUserId: "",
patrolInstanceId: ""
}; };
}, },
mounted() { mounted() {
this.page = this.$route.query.page; this.page = this.$route.query.page;
this.pageType = this.$route.query.type; this.pageType = this.$route.query.type;
this.patrolInstanceId = this.$route.query.patrolInstanceId||'1717873511875563522';
this.equipmentId = this.$route.query.equipmentId;
this.moveUserId = this.$route.query.uerId;
setInterval(() => { setInterval(() => {
let hd_gps_location = localStorage.getItem("hd_gps_location") let hd_gps_location = localStorage.getItem("hd_gps_location")
@@ -139,6 +153,9 @@ export default {
this.initMap(); this.initMap();
this.pcDrawType = "LineString";
// this.pcPlanningPath()
switch (this.page) { switch (this.page) {
case "addAlarmPoint": case "addAlarmPoint":
@@ -201,6 +218,8 @@ export default {
break break
default: default:
console.log("未匹配到page参数") console.log("未匹配到page参数")
this.getPatrolInstanceDetailsById()
// this.planningPath() // this.planningPath()
// this.queryAlarmList() // this.queryAlarmList()
// this.queryAllEquipment() // this.queryAllEquipment()
@@ -765,21 +784,31 @@ export default {
}) })
}, },
drawPcPostMessageDataLayer() { drawPcPostMessageDataLayer(_list=[],type="") {
this.map.removeLayer(this.drawPlanningPathLayer);
this.pcDrawType = "LineString";
const tempGeometryList = [] const tempGeometryList = []
this.parentPostMessageData.map(item => { this.parentPostMessageData.map(item => {
tempGeometryList.push(ol.proj.transform(item, 'EPSG:4326', 'EPSG:3857')) tempGeometryList.push(ol.proj.transform(item,'EPSG:4326','EPSG:3857'))
}) })
if(_list.length!=0){
_list.map(item => {
tempGeometryList.push(ol.proj.transform(item,'EPSG:4326','EPSG:3857'))
})
}
console.log(tempGeometryList)
const polygonGeometry = new LineString(tempGeometryList) const polygonGeometry = new LineString(tempGeometryList)
const polygonFeature = new Feature({ const polygonFeature = new Feature({
geometry: polygonGeometry geometry: polygonGeometry
}) })
polygonFeature.setStyle(new Style({ polygonFeature.setStyle(new Style({
stroke: new Stroke({ stroke: new Stroke({
color: '#ffa502', color:type=="realyPathLine"?'#FF4D36':'#ffa502',
width: 2 width: 5
}), }),
fill: new Fill({ fill: new Fill({
color: '#ffffff00' color: '#ffffff00'
@@ -810,23 +839,21 @@ export default {
this.map.addLayer(this.drawPlanningPathLayer); this.map.addLayer(this.drawPlanningPathLayer);
service.get(`/api/patrol/area/list`, { service.get(`/api/patrol/area/list`, {}).then((res) => {
}).then((res) => {
if (res.status == 200) { if (res.status == 200) {
console.log(res.data.result.records) console.log(res.data.result.records)
res.data.result.records.map((record) =>{ res.data.result.records.map((record) => {
console.log(record) console.log(record)
this.drawAreaLayer(record.areaName,JSON.parse(record.area)) this.drawAreaLayer(record.areaName, JSON.parse(record.area))
}) })
} }
}) })
}, },
drawAreaLayer(title,areaList) { drawAreaLayer(title, areaList) {
console.log(title) console.log(title)
areaList=areaList[0] areaList = areaList[0]
console.log(areaList) console.log(areaList)
const tempGeometryList = [] const tempGeometryList = []
@@ -837,7 +864,7 @@ export default {
tempGeometryList.push(tempGeometryList[0]) tempGeometryList.push(tempGeometryList[0])
const _list=[tempGeometryList] const _list = [tempGeometryList]
console.log(_list) console.log(_list)
@@ -847,7 +874,7 @@ export default {
const polygonFeature = new Feature({ const polygonFeature = new Feature({
geometry: polygonGeometry, geometry: polygonGeometry,
name:title name: title
}) })
polygonFeature.setStyle(new Style({ polygonFeature.setStyle(new Style({
@@ -859,15 +886,171 @@ export default {
color: 'rgba(255,255,0,0.1)' color: 'rgba(255,255,0,0.1)'
}), }),
text: new Text({ text: new Text({
testAlign:'center', testAlign: 'center',
text:title, text: title,
font:'bold 20px 微软雅黑', font: 'bold 20px 微软雅黑',
fill:new Fill({ fill: new Fill({
color: '#ffa502', color: '#ffa502',
}) })
}) })
})) }))
this.drawPlanningPathLayer.getSource().addFeature(polygonFeature) this.drawPlanningPathLayer.getSource().addFeature(polygonFeature)
},
showMoveHistory() {
// 矢量地图源
let vectorSource = new VectorSource();
// 矢量地图
this.drawPlanningPathLayer = new VectorLayer({
source: vectorSource,
style: new Style({
stroke: new Stroke({
width: 6,
color: [237, 212, 0, 0.8],
}),
})
});
service.get(`/sys/equipment/trajectory`, {
params: {
uerId: this.moveUserId,
equipmentId: this.equipmentId,
startTime:dayjs(this.startDate).format('YYYY-MM-DD HH:mm'),
endTime:dayjs(this.endDate).format('YYYY-MM-DD HH:mm'),
pageSize:1000
}
}).then((res) => {
if (res.status == 200) {
this.showendDate=false
this.showstartDate=false
const _list=[]
res.data.result.records.map((record,index) => {
if(index==0){
const startPoint = ol.proj.transform(record.location.split(","),'EPSG:4326','EPSG:3857')
this.map.getView().animate({
center:startPoint,
duration:1000,
zoom:18
})
}
_list.push(record.location.split(","))
})
this.parentPostMessageData=_list
this.drawPcPostMessageDataLayer()
this.map.removeInteraction(this.draw)
this.map.removeInteraction(this.snap)
}
})
},
endDateConfirm(value) {
console.log(dayjs(value))
console.log(value)
console.log(this.startDate)
if (dayjs(value).isBefore(dayjs(this.startDate))) {
console.log("结束时间早于开始时间")
Notify({ type: 'warning', message: '结束时间不可早于开始时间' });
} else {
console.log("开始时间早于结束时间")
this.endDate = dayjs(value).toDate()
console.log("打印结束时间")
console.log(this.endDate)
setTimeout(()=>{
this.showMoveHistory()
},1000)
}
},
startDateConfirm(value) {
console.log(dayjs(value))
console.log(value)
console.log(this.endDate)
if (dayjs(value).isBefore(dayjs(this.endDate))) {
this.startDate = dayjs(value).toDate()
setTimeout(()=>{
this.showMoveHistory()
},1000)
console.log("开始时间早于结束时间")
} else {
Notify({ type: 'warning', message: '开始时间不可晚于结束时间' });
console.log("结束时间早于开始时间")
}
},
getPatrolInstanceDetailsById(){
// 矢量地图源
let vectorSource = new VectorSource();
// 矢量地图
this.drawPlanningPathLayer = new VectorLayer({
source: vectorSource,
style: new Style({
stroke: new Stroke({
width: 6,
color: [237, 212, 0, 0.8],
}),
})
});
service.get(`/middlegroundPeriodicWorkOrderInstance/queryById`, {
params: {
id: this.patrolInstanceId
}
}).then((res) => {
if (res.status == 200) {
this.showendDate=false
this.showstartDate=false
let longitudeLatitude=res.data.result.location;
longitudeLatitude=JSON.parse(longitudeLatitude)
const startPoint = ol.proj.transform(longitudeLatitude[0],'EPSG:4326','EPSG:3857')
this.map.getView().animate({
center:startPoint,
duration:1000,
zoom:18
})
this.drawPcPostMessageDataLayer(longitudeLatitude,"planPathLine")
this.map.removeInteraction(this.draw)
this.map.removeInteraction(this.snap)
this.getPatrolInstanceRealyPath(res.data.result.actualStartTime,res.data.result.actualEndTime);
}
})
},
getPatrolInstanceRealyPath(startTime,endTime){
service.get(`/sys/equipment/trajectory`, {
params: {
uerId: this.moveUserId,
equipmentId: this.equipmentId,
startTime:startTime,
endTime:endTime,
pageSize:1000
}
}).then((res) => {
if (res.status == 200) {
this.showendDate=false
this.showstartDate=false
const _list=[]
res.data.result.records.map((record,index) => {
if(index==0){
const startPoint = ol.proj.transform(record.location.split(","),'EPSG:4326','EPSG:3857')
this.map.getView().animate({
center:startPoint,
duration:1000,
zoom:18
})
}
_list.push(record.location.split(","))
})
this.drawPcPostMessageDataLayer(_list,"realyPathLine")
this.map.removeInteraction(this.draw)
this.map.removeInteraction(this.snap)
}
})
} }
}, },
@@ -959,12 +1142,15 @@ export default {
.iconColorList { .iconColorList {
position: fixed; position: fixed;
bottom: 20px; bottom: 0px;
left: 30px; left: 0px;
z-index: 2; z-index: 2;
text-align: left; text-align: left;
font-size: 16px; font-size: 16px;
color: #333333; color: #333333;
padding: 10px;
background-color: rgba(0,0,0,0.4);
.iconColorListItem { .iconColorListItem {
display: flex; display: flex;
@@ -1032,4 +1218,20 @@ export default {
} }
} }
} }
.timeSelectBox {
position: fixed;
bottom: 0;
left: 0;
width: 100%;
height: 100px;
display: flex;
flex-direction: row;
justify-content: center;
z-index: 100;
display: flex;
flex-direction: row;
justify-content: space-around;
}
</style> </style>

View File

@@ -32,6 +32,14 @@ const router = new Router({
path: '/hd_show_patrol_history', path: '/hd_show_patrol_history',
name: 'hd_show_patrol_history', name: 'hd_show_patrol_history',
component: () => import('../pages/hd_show_patrol_history.vue') component: () => import('../pages/hd_show_patrol_history.vue')
},{
path: '/hd_show_equipment_move_history',
name: 'hd_show_equipment_move_history',
component: () => import('../pages/hd_show_equipment_move_history.vue')
},{
path: '/hd_show_patrolTmp_history',
name: 'hd_show_patrolTmp_history',
component: () => import('../pages/hd_show_patrolTmp_history.vue')
} }
] ]
}); });

View File

@@ -141,6 +141,7 @@ public class MessageSyncService {
OfflineMessageContent offlineMessageContent = JSONObject.parseObject(value, OfflineMessageContent.class); OfflineMessageContent offlineMessageContent = JSONObject.parseObject(value, OfflineMessageContent.class);
respList.add(offlineMessageContent); respList.add(offlineMessageContent);
} }
resp.setDataList(respList); resp.setDataList(respList);
if(!CollectionUtils.isEmpty(respList)){ if(!CollectionUtils.isEmpty(respList)){
@@ -148,6 +149,10 @@ public class MessageSyncService {
resp.setCompleted(maxSeq <= offlineMessageContent.getMessageKey()); resp.setCompleted(maxSeq <= offlineMessageContent.getMessageKey());
} }
if(resp.getDataList().size()==0){
resp.setCompleted(true);
}
return ResponseVO.successResponse(resp); return ResponseVO.successResponse(resp);
} }

View File

@@ -18,7 +18,9 @@
appInit(500).then((res)=>{ appInit(500).then((res)=>{
console.log("获取到token创建长链接") console.log("获取到token创建长链接")
console.log(this.$socketTask.socketTask) console.log(this.$socketTask.socketTask)
this.$socketTask.connectSocket() setTimeout(()=>{
this.$socketTask.connectSocket()
},500)
}).then((error)=>{ }).then((error)=>{
console.log("未获取到IM的token") console.log("未获取到IM的token")
}) })

View File

@@ -1,7 +1,15 @@
export default class config{ export default class config{
static prod="online" static prod="online"
static getZnzqApiUrl(){ static getZnzqApiUrl(){
return process.env.NODE_ENV === 'development' ? 'http://work.ii999.live:19002/znzq' :'http://172.16.2.3:19000/znzq'; if(process.env.NODE_ENV === 'development' ){
return 'http://work.ii999.live:19002/znzq'
}else{
if(this.prod=="online"){
return 'http://work.ii999.live:19002/znzq'
}else{
return 'http://172.16.2.3:19000/znzq'
}
}
} }
static getBaseApiUrl(){ static getBaseApiUrl(){
//return process.env.NODE_ENV === 'development' ? 'http://119.45.242.222:8989' :'http://172.16.2.3:8989'; //return process.env.NODE_ENV === 'development' ? 'http://119.45.242.222:8989' :'http://172.16.2.3:8989';
@@ -9,7 +17,7 @@ export default class config{
} }
static getImApiUrl(){ static getImApiUrl(){
//return process.env.NODE_ENV === 'development' ? 'http://119.45.242.222:28000/v1' :'http://172.16.2.3:28000/v1'; //return process.env.NODE_ENV === 'development' ? 'http://119.45.242.222:28000/v1' :'http://172.16.2.3:28000/v1';
return process.env.NODE_ENV === 'development' ? 'http://119.45.242.222:28000/v1' :'/im_api/v1'; return process.env.NODE_ENV === 'development' ? 'http://119.45.242.222/im_api/v1' :'/im_api/v1';
} }
static getImAppId(){ static getImAppId(){
return 10000; return 10000;

View File

@@ -14,7 +14,9 @@ customHttp.interceptors.request.use((config) => {
if (config.custom.target == "znzq") { if (config.custom.target == "znzq") {
config.baseURL = conf.getZnzqApiUrl() config.baseURL = conf.getZnzqApiUrl()
const token = uni.getStorageSync('token'); const token = uni.getStorageSync('token');
config.headers["X-Access-Token"] = token; config.header["X-Access-Token"] = token;
console.log("==================customHttp.interceptors.request.use")
console.log(config)
} }
} }

View File

@@ -22,16 +22,20 @@ export function appInit(ms) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
var i = 0; var i = 0;
let timer = setInterval(() => { let timer = setInterval(() => {
var hd_token = localStorage.getItem("im_imUserSign") var im_imUserSign = localStorage.getItem("im_imUserSign")
var im_userId = localStorage.getItem("im_userId") var im_userId = localStorage.getItem("im_userId")
var hd_token = localStorage.getItem("hd_token")
i = i + 1; i = i + 1;
if (i > 10) { if (i > 30) {
reject("error") reject("error")
} }
if (hd_token) { if (im_imUserSign) {
localStorage.setItem("imUserSign",hd_token)
localStorage.setItem("imUserSign",im_imUserSign)
localStorage.setItem("appId",10000) localStorage.setItem("appId",10000)
localStorage.setItem("token",hd_token)
if(im_userId){ if(im_userId){
localStorage.setItem("userId",im_userId) localStorage.setItem("userId",im_userId)
} }

View File

@@ -3,9 +3,9 @@
<head> <head>
<meta charset="UTF-8" /> <meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" />
<script type="text/javascript" src="./vconsole.min.js"></script> <script type="text/javascript" src="/vconsole.min.js"></script>
<script> <script>
// var vConsole = new VConsole(); var vConsole = new VConsole();
</script> </script>
<title></title> <title></title>
<!--preload-links--> <!--preload-links-->

View File

@@ -12,7 +12,9 @@
"author": "php_echo@163.com", "author": "php_echo@163.com",
"license": "ISC", "license": "ISC",
"dependencies": { "dependencies": {
"base64-js": "^1.5.1",
"dayjs": "^1.11.10", "dayjs": "^1.11.10",
"js-base64": "^3.7.5",
"localforage": "^1.10.0", "localforage": "^1.10.0",
"luch-request": "^3.1.1" "luch-request": "^3.1.1"
} }

View File

@@ -447,28 +447,45 @@
content: 'TRTC_VIDEO_START' content: 'TRTC_VIDEO_START'
}; };
this.sendMsg(formdata,formdata.msgType) // this.sendMsg(formdata,formdata.msgType)
const userId=localStorage.getItem("userId")
const roomId=userId
const roomInfo={ const roomInfo={
roomId:"call_room",//后面改成发起人的手机号或者id roomId:userId,//后面改成发起人的手机号或者id
roomName:"某某发起的视频聊天", roomName:`${userId}发起的视频聊天`,
creatorId:"creatorId", creatorId:userId,
creatorName:"发起人的昵称", creatorName:userId,
publishId:userId,
publishName:userId,
isOver:0, isOver:0,
webrtcUrl:config.getSRSUrl()+"/call_room/uid13", webrtcUrl:config.getSRSUrl()+`/${roomId}/${userId}`,
type:"webrtc", type:"webrtc",
offline:0 offline:0,
invitedUserList:[this.talkTo.userId]
} }
this.$store this.$store
.dispatch('createRoom', roomInfo) .dispatch('createRoom', roomInfo)
.then(res => { .then(res => {
location.href=config.getVideoRoomUrl(roomInfo.roomId,roomInfo.creatorId,1,1) customHttp.customHttp.post("/api/im/app/wsMsg",{
msgType:"10000",
msgId:JSON.stringify(roomInfo),
cmd:"",
msgTxt:""
},{
dataType: 'json',
custom: {target: "znzq"} ,
}).then((res1)=>{
location.href=config.getVideoRoomUrl(roomInfo.roomId,roomInfo.creatorId,1,1)
})
}) })
if(1>0){
this.$http.request({ return false;
}
this.$http.request({
url: '/chat/sendMsg', url: '/chat/sendMsg',
method: 'POST', method: 'POST',
data: JSON.stringify(formdata), data: JSON.stringify(formdata),

View File

@@ -45,6 +45,8 @@
</template> </template>
<script> <script>
import customHttp from "@/common/customHttp.js"
import { Base64 } from 'js-base64';
export default { export default {
data() { data() {
@@ -146,91 +148,51 @@
return Math.floor(Math.random() * (max - min + 1)) + min return Math.floor(Math.random() * (max - min + 1)) + min
}, },
sublogin(e) { sublogin(e) {
var rules = {
phone: {
rules: [{
checkType: "required",
errorMsg: "请填写手机号码"
}, {
checkType: "phone",
errorMsg: "请填写正确的手机号码"
}]
},
password: {
rules: [{
checkType: "required",
errorMsg: "请输入密码"
}, {
checkType: "string",
checkRule: "4,6",
errorMsg: "至少输入4-6位"
}]
},
code: {
rules: [{
checkType: "required",
errorMsg: "请输入验证码"
}]
}
};
// var formData = e.detail.value;
var formData = JSON.parse(JSON.stringify(this.form));
var checkRes = this.$zmmFormCheck.check(formData, rules);
// #ifdef APP-PLUS
var cid = plus.push.getClientInfo().clientid
formData['cid'] = cid
// #endif
// #ifdef H5
// todo
var cid = ''
formData['cid'] = cid
// #endif
uni.setStorageSync('cid', cid);
console.log(cid)
if (checkRes) {
if (!this.agree) {
uni.showToast({
title: '请先同意《隐私及服务协议》',
icon: 'none'
});
return;
}
uni.showLoading()
formData.loginType = 1
this.$http.request({ //手机+验证码
url: '/v1/login', customHttp.customHttp.post('/api/im/app/login', {
method: 'POST', "username": this.form.userName,
data: JSON.stringify(formData), "password":Base64.encode(this.form.password)
success: (res) => { }, {
if (res.data.code == 200) { params: {},
this.loginDone(res.data.data) /* 会加在url上 */
} header: {},
/* 会与全局header合并如有同名属性局部覆盖全局 */
dataType: 'json',
// 注如果局部custom与全局custom有同名属性则后面的属性会覆盖前面的属性相当于Object.assign(全局,局部)
custom: {
target: "znzq"
}, // 可以加一些自定义参数在拦截器等地方使用。比如这里我加了一个auth可在拦截器里拿到如果true就传token
}).then(res => {
console.log("=========获取到数据")
console.log(res)
if (res.statusCode == 200) {
if (res.data.code == 200) {
this.loginDone(res.data.result)
} }
}); }
}).catch(err => {
})
} else {
uni.showToast({
title: this.$zmmFormCheck.error,
icon: "none",
position: 'bottom'
});
}
}, },
loginDone(data) { loginDone(data) {
uni.setStorageSync('appId', data.appId); uni.setStorageSync('appId', data.appId);
uni.setStorageSync('im_userId', data.userId); uni.setStorageSync('im_userId', data.id);
uni.setStorageSync('userId', data.userId); uni.setStorageSync('userId', data.id);
uni.setStorageSync('im_userCSign', data.userSign); uni.setStorageSync('im_userCSign', data.userSign);
uni.setStorageSync('im_imUserSign', data.imUserSign); uni.setStorageSync('im_imUserSign', data.imUserSign);
uni.setStorageSync('imUserSign', data.imUserSign); uni.setStorageSync('imUserSign', data.imUserSign);
uni.setStorageSync('token', data.token);
uni.setStorageSync('hd_token', data.token);
uni.reLaunch({ uni.reLaunch({
url: '../tabbar1/index' url: '../tabbar1/index'
}) })
} }
} }
} }
@@ -333,4 +295,4 @@
width: 300rpx; width: 300rpx;
margin-top: 120rpx; margin-top: 120rpx;
} }
</style> </style>

View File

@@ -63,21 +63,49 @@
} }
] ]
this.list=this.$fc.sortList({list:list,key:'name'})
console.log(customHttp)
console.log("================开始请求通讯录列表")
// 局部修改配置,局部配置优先级高于全局配置 // 局部修改配置,局部配置优先级高于全局配置
customHttp.customHttp.post('/api/im/app/addressList', {userName: 'name', password: '123456'}, { customHttp.customHttp.get('/api/im/app/addressList', {
params: {}, /* 会加在url上 */ params: {}, /* 会加在url上 */
header: {}, /* 会与全局header合并如有同名属性局部覆盖全局 */
dataType: 'json', dataType: 'json',
// 注如果局部custom与全局custom有同名属性则后面的属性会覆盖前面的属性相当于Object.assign(全局,局部) // 注如果局部custom与全局custom有同名属性则后面的属性会覆盖前面的属性相当于Object.assign(全局,局部)
custom: {target: "znzq"} // 可以加一些自定义参数在拦截器等地方使用。比如这里我加了一个auth可在拦截器里拿到如果true就传token custom: {target: "znzq"} , // 可以加一些自定义参数在拦截器等地方使用。比如这里我加了一个auth可在拦截器里拿到如果true就传token
}).then(res => { }).then(res => {
console.log("=========获取到数据")
console.log(res)
if(res.statusCode==200){
if(res.data.code==200){
var list=[]
res.data.result.records.map((item)=>{
console.log(item)
list.push({
name:item.realname,
avatar:item.portrait,
userId:item.userId,
userType:1,
chatNo:item.userId
})
})
this.list=this.$fc.sortList({list:list,key:'name'})
}
}
}).catch(err => { }).catch(err => {
}) })
/*
this.$http.request({ this.$http.request({
url: '/friend/friendList', url: '/friend/friendList',
method: 'POST', method: 'POST',
@@ -99,7 +127,8 @@
this.list=this.$fc.sortList({list:list,key:'name'}) this.list=this.$fc.sortList({list:list,key:'name'})
} }
} }
}); });
*/
}, },
}, },
onNavigationBarButtonTap(e) { onNavigationBarButtonTap(e) {