From 4010ed6c23d081a2937d0fe1719414ba127b17a2 Mon Sep 17 00:00:00 2001
From: panlinlin <648540858@qq.com>
Date: 星期一, 12 四月 2021 16:04:04 +0800
Subject: [PATCH] 统一axios写法
---
src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/playback/PlaybackController.java | 2
web_src/src/components/dialog/rtcPlayer.vue | 8
src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/media/MediaController.java | 2
web_src/src/components/PushVideoList.vue | 38 ++--
src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/platformGbStream/PlatformGbStreamController.java | 2
pom.xml | 8
web_src/src/components/dialog/chooseChannelForGb.vue | 4
src/main/java/com/genersoft/iot/vmp/conf/Swagger3Config.java | 4
src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/SseController/SseController.java | 5
web_src/src/components/Login.vue | 12
web_src/src/components/devicePosition.vue | 49 +++--
web_src/src/components/dialog/StreamProxyEdit.vue | 27 +-
web_src/src/components/DeviceList.vue | 10
web_src/src/components/dialog/platformEdit.vue | 28 +-
src/main/java/com/genersoft/iot/vmp/service/impl/PlayServiceImpl.java | 2
web_src/src/components/StreamProxyList.vue | 66 ++++---
src/main/java/com/genersoft/iot/vmp/vmanager/streamPush/StreamPushController.java | 6
web_src/src/components/ParentPlatformList.vue | 46 +++--
src/main/java/com/genersoft/iot/vmp/vmanager/streamProxy/StreamProxyController.java | 12
src/main/java/com/genersoft/iot/vmp/storager/impl/VideoManagerStoragerImpl.java | 1
src/main/java/com/genersoft/iot/vmp/vmanager/server/ServerController.java | 2
web_src/src/components/dialog/chooseChannelForStream.vue | 22 +-
web_src/src/components/channelList.vue | 62 +++---
web_src/src/components/dialog/addStreamTOGB.vue | 31 +--
src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/play/PlayController.java | 2
src/main/java/com/genersoft/iot/vmp/storager/dao/GbStreamMapper.java | 2
src/main/java/com/genersoft/iot/vmp/vmanager/user/UserController.java | 3
src/main/java/com/genersoft/iot/vmp/service/impl/StreamProxyServiceImpl.java | 5
28 files changed, 243 insertions(+), 218 deletions(-)
diff --git a/pom.xml b/pom.xml
index dda226d..7ca876f 100644
--- a/pom.xml
+++ b/pom.xml
@@ -109,6 +109,12 @@
<artifactId>springfox-boot-starter</artifactId>
<version>3.0.0</version>
</dependency>
+ <dependency>
+ <groupId>com.github.xiaoymin</groupId>
+ <artifactId>knife4j-spring-boot-starter</artifactId>
+ <version>3.0.2</version>
+ </dependency>
+
<!--鍙傛暟鏍¢獙 -->
<dependency>
@@ -165,7 +171,7 @@
</dependencies>
<build>
- <finalName>wvp-2.5.8</finalName>
+ <finalName>wvp-2.0</finalName>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
diff --git a/src/main/java/com/genersoft/iot/vmp/conf/Swagger3Config.java b/src/main/java/com/genersoft/iot/vmp/conf/Swagger3Config.java
index 84aa3d9..240e39d 100644
--- a/src/main/java/com/genersoft/iot/vmp/conf/Swagger3Config.java
+++ b/src/main/java/com/genersoft/iot/vmp/conf/Swagger3Config.java
@@ -92,8 +92,8 @@
return new ApiInfoBuilder()
.title("WVP-PRO 鎺ュ彛鏂囨。")
.description("鏇村璇峰挩璇㈡湇鍔″紑鍙戣��(18010473990@@163.com)銆�")
- .contact(new Contact("Ray銆�", "http://www.ruiyeclub.cn", "ruiyeclub@foxmail.com"))
- .version("1.0")
+ .contact(new Contact("panlinlin", "http://www.ruiyeclub.cn", "ruiyeclub@foxmail.com"))
+ .version("2.0")
.build();
}
}
diff --git a/src/main/java/com/genersoft/iot/vmp/service/impl/PlayServiceImpl.java b/src/main/java/com/genersoft/iot/vmp/service/impl/PlayServiceImpl.java
index abe2278..93466b3 100644
--- a/src/main/java/com/genersoft/iot/vmp/service/impl/PlayServiceImpl.java
+++ b/src/main/java/com/genersoft/iot/vmp/service/impl/PlayServiceImpl.java
@@ -84,7 +84,7 @@
} else {
String streamId = streamInfo.getStreamId();
JSONObject rtpInfo = zlmresTfulUtils.getRtpInfo(streamId);
- if (rtpInfo.getBoolean("exist")) {
+ if (rtpInfo != null && rtpInfo.getBoolean("exist")) {
RequestMessage msg = new RequestMessage();
msg.setId(DeferredResultHolder.CALLBACK_CMD_PlAY + uuid);
msg.setData(JSON.toJSONString(streamInfo));
diff --git a/src/main/java/com/genersoft/iot/vmp/service/impl/StreamProxyServiceImpl.java b/src/main/java/com/genersoft/iot/vmp/service/impl/StreamProxyServiceImpl.java
index ddf8183..e31f0e8 100644
--- a/src/main/java/com/genersoft/iot/vmp/service/impl/StreamProxyServiceImpl.java
+++ b/src/main/java/com/genersoft/iot/vmp/service/impl/StreamProxyServiceImpl.java
@@ -118,12 +118,11 @@
public boolean stop(String app, String stream) {
boolean result = false;
StreamProxyItem streamProxyDto = videoManagerStorager.queryStreamProxy(app, stream);
- if (streamProxyDto.isEnable() && streamProxyDto != null) {
+ if (streamProxyDto != null && streamProxyDto.isEnable()) {
JSONObject jsonObject = removeStreamProxyFromZlm(streamProxyDto);
if (jsonObject.getInteger("code") == 0) {
- result = true;
streamProxyDto.setEnable(false);
- videoManagerStorager.updateStreamProxy(streamProxyDto);
+ result = videoManagerStorager.updateStreamProxy(streamProxyDto);
}
}
return result;
diff --git a/src/main/java/com/genersoft/iot/vmp/storager/dao/GbStreamMapper.java b/src/main/java/com/genersoft/iot/vmp/storager/dao/GbStreamMapper.java
index 2ada231..80397d2 100644
--- a/src/main/java/com/genersoft/iot/vmp/storager/dao/GbStreamMapper.java
+++ b/src/main/java/com/genersoft/iot/vmp/storager/dao/GbStreamMapper.java
@@ -24,7 +24,7 @@
"name=#{name}," +
"streamType=#{streamType}," +
"longitude=#{longitude}, " +
- "latitude=#{latitude} " +
+ "latitude=#{latitude}," +
"status=${status} " +
"WHERE app=#{app} AND stream=#{stream} AND gbId=#{gbId}")
int update(GbStream gbStream);
diff --git a/src/main/java/com/genersoft/iot/vmp/storager/impl/VideoManagerStoragerImpl.java b/src/main/java/com/genersoft/iot/vmp/storager/impl/VideoManagerStoragerImpl.java
index 6d35eb2..5d1cfc8 100644
--- a/src/main/java/com/genersoft/iot/vmp/storager/impl/VideoManagerStoragerImpl.java
+++ b/src/main/java/com/genersoft/iot/vmp/storager/impl/VideoManagerStoragerImpl.java
@@ -440,6 +440,7 @@
dataSourceTransactionManager.commit(transactionStatus); //鎵嬪姩鎻愪氦
result = true;
}catch (Exception e) {
+ e.printStackTrace();
dataSourceTransactionManager.rollback(transactionStatus);
}
return result;
diff --git a/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/SseController/SseController.java b/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/SseController/SseController.java
index 145855d..3a10cb0 100644
--- a/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/SseController/SseController.java
+++ b/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/SseController/SseController.java
@@ -8,6 +8,7 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.CrossOrigin;
+import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.mvc.method.annotation.SseEmitter;
@@ -25,11 +26,11 @@
@Autowired
AlarmEventListener alarmEventListener;
- @ApiOperation("璁剧疆鍝嶅簲")
+ @ApiOperation("娴忚鍣ㄦ帹閫�")
@ApiImplicitParams({
@ApiImplicitParam(name = "browserId", value = "娴忚鍣↖D", dataTypeClass = String.class),
})
- @RequestMapping("/emit")
+ @PostMapping("/emit")
public SseEmitter emit(@RequestParam String browserId) {
final SseEmitter sseEmitter = new SseEmitter(0L);
try {
diff --git a/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/media/MediaController.java b/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/media/MediaController.java
index 7598178..5db9478 100644
--- a/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/media/MediaController.java
+++ b/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/media/MediaController.java
@@ -44,7 +44,7 @@
@ApiImplicitParam(name = "app", value = "搴旂敤鍚�", dataTypeClass = String.class),
@ApiImplicitParam(name = "stream", value = "娴乮d", dataTypeClass = String.class),
})
- @RequestMapping(value = "/getStreamInfoByAppAndStream")
+ @GetMapping(value = "/stream_info_by_app_and_stream")
@ResponseBody
public StreamInfo getStreamInfoByAppAndStream(String app, String stream){
return mediaService.getStreamInfoByAppAndStreamWithCheck(app, stream);
diff --git a/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/platformGbStream/PlatformGbStreamController.java b/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/platformGbStream/PlatformGbStreamController.java
index 5859102..0eeea8b 100644
--- a/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/platformGbStream/PlatformGbStreamController.java
+++ b/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/platformGbStream/PlatformGbStreamController.java
@@ -32,7 +32,7 @@
@ApiImplicitParam(name = "page", value = "褰撳墠椤�", dataTypeClass = Integer.class),
@ApiImplicitParam(name = "count", value = "姣忛〉鏉℃暟", dataTypeClass = Integer.class),
})
- @RequestMapping(value = "/list")
+ @GetMapping(value = "/list")
@ResponseBody
public PageInfo<GbStream> list(@RequestParam(required = false)Integer page,
@RequestParam(required = false)Integer count){
diff --git a/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/play/PlayController.java b/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/play/PlayController.java
index 1af7e6e..183b72a 100644
--- a/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/play/PlayController.java
+++ b/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/play/PlayController.java
@@ -93,7 +93,7 @@
@ApiImplicitParams({
@ApiImplicitParam(name = "streamId", value = "瑙嗛娴両D", dataTypeClass = String.class),
})
- @PostMapping("/stop/{streamId}")
+ @GetMapping("/stop/{streamId}")
public DeferredResult<ResponseEntity<String>> playStop(@PathVariable String streamId) {
logger.debug(String.format("璁惧棰勮/鍥炴斁鍋滄API璋冪敤锛宻treamId锛�%s", streamId));
diff --git a/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/playback/PlaybackController.java b/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/playback/PlaybackController.java
index f55083e..b24f575 100644
--- a/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/playback/PlaybackController.java
+++ b/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/playback/PlaybackController.java
@@ -105,7 +105,7 @@
@ApiImplicitParams({
@ApiImplicitParam(name = "ssrc", value = "瑙嗛娴佹爣璇�", dataTypeClass = String.class),
})
- @RequestMapping("/stop/{ssrc}")
+ @GetMapping("/stop/{ssrc}")
public ResponseEntity<String> playStop(@PathVariable String ssrc) {
cmder.streamByeCmd(ssrc);
diff --git a/src/main/java/com/genersoft/iot/vmp/vmanager/server/ServerController.java b/src/main/java/com/genersoft/iot/vmp/vmanager/server/ServerController.java
index 84d246f..82632d8 100644
--- a/src/main/java/com/genersoft/iot/vmp/vmanager/server/ServerController.java
+++ b/src/main/java/com/genersoft/iot/vmp/vmanager/server/ServerController.java
@@ -25,7 +25,7 @@
@ApiOperation("閲嶅惎鏈嶅姟")
- @RequestMapping(value = "/restart")
+ @GetMapping(value = "/restart")
@ResponseBody
public Object restart(){
Thread restartThread = new Thread(new Runnable() {
diff --git a/src/main/java/com/genersoft/iot/vmp/vmanager/streamProxy/StreamProxyController.java b/src/main/java/com/genersoft/iot/vmp/vmanager/streamProxy/StreamProxyController.java
index d7e6201..9b2e4f0 100644
--- a/src/main/java/com/genersoft/iot/vmp/vmanager/streamProxy/StreamProxyController.java
+++ b/src/main/java/com/genersoft/iot/vmp/vmanager/streamProxy/StreamProxyController.java
@@ -41,7 +41,7 @@
@ApiImplicitParam(name="query", value = "鏌ヨ鍐呭", dataTypeClass = String.class),
@ApiImplicitParam(name="online", value = "鏄惁鍦ㄧ嚎", dataTypeClass = Boolean.class),
})
- @RequestMapping(value = "/list")
+ @GetMapping(value = "/list")
@ResponseBody
public PageInfo<StreamProxyItem> list(@RequestParam(required = false)Integer page,
@RequestParam(required = false)Integer count,
@@ -55,7 +55,7 @@
@ApiImplicitParams({
@ApiImplicitParam(name = "param", value = "浠g悊鍙傛暟", dataTypeClass = StreamProxyItem.class),
})
- @RequestMapping(value = "/save")
+ @PostMapping(value = "/save")
@ResponseBody
public Object save(@RequestBody StreamProxyItem param){
logger.info("娣诲姞浠g悊锛� " + JSONObject.toJSONString(param));
@@ -68,7 +68,7 @@
@ApiImplicitParam(name = "app", value = "搴旂敤鍚�", dataTypeClass = String.class),
@ApiImplicitParam(name = "stream", value = "娴両D", dataTypeClass = String.class),
})
- @RequestMapping(value = "/del")
+ @DeleteMapping(value = "/del")
@ResponseBody
public Object del(String app, String stream){
logger.info("绉婚櫎浠g悊锛� " + app + "/" + stream);
@@ -81,7 +81,7 @@
@ApiImplicitParam(name = "app", value = "搴旂敤鍚�", dataTypeClass = String.class),
@ApiImplicitParam(name = "stream", value = "娴両D", dataTypeClass = String.class),
})
- @RequestMapping(value = "/start")
+ @GetMapping(value = "/start")
@ResponseBody
public Object start(String app, String stream){
logger.info("鍚敤浠g悊锛� " + app + "/" + stream);
@@ -94,11 +94,11 @@
@ApiImplicitParam(name = "app", value = "搴旂敤鍚�", dataTypeClass = String.class),
@ApiImplicitParam(name = "stream", value = "娴両D", dataTypeClass = String.class),
})
- @RequestMapping(value = "/stop")
+ @GetMapping(value = "/stop")
@ResponseBody
public Object stop(String app, String stream){
logger.info("鍋滅敤浠g悊锛� " + app + "/" + stream);
boolean result = streamProxyService.stop(app, stream);
- return "success";
+ return result?"success":"fail";
}
}
diff --git a/src/main/java/com/genersoft/iot/vmp/vmanager/streamPush/StreamPushController.java b/src/main/java/com/genersoft/iot/vmp/vmanager/streamPush/StreamPushController.java
index 6396b10..c266ff6 100644
--- a/src/main/java/com/genersoft/iot/vmp/vmanager/streamPush/StreamPushController.java
+++ b/src/main/java/com/genersoft/iot/vmp/vmanager/streamPush/StreamPushController.java
@@ -32,7 +32,7 @@
@ApiImplicitParam(name="query", value = "鏌ヨ鍐呭", dataTypeClass = String.class),
@ApiImplicitParam(name="online", value = "鏄惁鍦ㄧ嚎", dataTypeClass = Boolean.class),
})
- @RequestMapping(value = "/list")
+ @GetMapping(value = "/list")
@ResponseBody
public PageInfo<StreamPushItem> list(@RequestParam(required = false)Integer page,
@RequestParam(required = false)Integer count,
@@ -47,7 +47,7 @@
@ApiImplicitParams({
@ApiImplicitParam(name = "stream", value = "鐩存挱娴佸叧鑱斿浗鏍囧钩鍙�", dataTypeClass = GbStream.class),
})
- @RequestMapping(value = "/save_to_gb")
+ @PostMapping(value = "/save_to_gb")
@ResponseBody
public Object saveToGB(@RequestBody GbStream stream){
if (streamPushService.saveToGB(stream)){
@@ -62,7 +62,7 @@
@ApiImplicitParams({
@ApiImplicitParam(name = "stream", value = "鐩存挱娴佸叧鑱斿浗鏍囧钩鍙�", dataTypeClass = GbStream.class),
})
- @RequestMapping(value = "/remove_form_gb")
+ @DeleteMapping(value = "/remove_form_gb")
@ResponseBody
public Object removeFormGB(@RequestBody GbStream stream){
if (streamPushService.removeFromGB(stream)){
diff --git a/src/main/java/com/genersoft/iot/vmp/vmanager/user/UserController.java b/src/main/java/com/genersoft/iot/vmp/vmanager/user/UserController.java
index c3f8b3f..e5e4c4d 100644
--- a/src/main/java/com/genersoft/iot/vmp/vmanager/user/UserController.java
+++ b/src/main/java/com/genersoft/iot/vmp/vmanager/user/UserController.java
@@ -8,6 +8,7 @@
import org.springframework.beans.factory.annotation.Value;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.CrossOrigin;
+import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@@ -28,7 +29,7 @@
@ApiImplicitParam(name = "username", value = "鐢ㄦ埛鍚�", dataTypeClass = String.class),
@ApiImplicitParam(name = "password", value = "瀵嗙爜锛�32鏈猰d5鍔犲瘑锛�", dataTypeClass = String.class),
})
- @RequestMapping("/login")
+ @GetMapping("/login")
public String login(String username, String password){
if (!StringUtils.isEmpty(username) && username.equals(usernameConfig)
&& !StringUtils.isEmpty(password) && password.equals(passwordConfig)) {
diff --git a/web_src/src/components/DeviceList.vue b/web_src/src/components/DeviceList.vue
index 21e02aa..40d2146 100644
--- a/web_src/src/components/DeviceList.vue
+++ b/web_src/src/components/DeviceList.vue
@@ -136,20 +136,20 @@
getDeviceList: function() {
let that = this;
this.getDeviceListLoading = true;
- this.$axios.get(`/api/device/query/devices`,{
+ this.$axios({
+ method: 'get',
+ url:`/api/device/query/devices`,
params: {
page: that.currentPage,
count: that.count
}
- } )
- .then(function (res) {
+ }).then(function (res) {
console.log(res);
console.log(res.data.list);
that.total = res.data.total;
that.deviceList = res.data.list;
that.getDeviceListLoading = false;
- })
- .catch(function (error) {
+ }).catch(function (error) {
console.log(error);
that.getDeviceListLoading = false;
});
diff --git a/web_src/src/components/Login.vue b/web_src/src/components/Login.vue
index 2a91886..5e75867 100644
--- a/web_src/src/components/Login.vue
+++ b/web_src/src/components/Login.vue
@@ -61,10 +61,11 @@
//璁剧疆鍦ㄧ櫥褰曠姸鎬�
this.isLoging = true;
- this.$axios.get("/api/user/login",{
- params: loginParam
- } )
- .then(function (res) {
+ this.$axios({
+ method: 'get',
+ url:"/api/user/login",
+ params: loginParam
+ }).then(function (res) {
console.log(JSON.stringify(res));
if (res.data == "success") {
that.$cookies.set("session", {"username": that.username}) ;
@@ -79,8 +80,7 @@
type: 'error'
});
}
- })
- .catch(function (error) {
+ }).catch(function (error) {
that.$message.error(error.response.statusText);
that.isLoging = false;
});
diff --git a/web_src/src/components/ParentPlatformList.vue b/web_src/src/components/ParentPlatformList.vue
index ee0d342..9a525c6 100644
--- a/web_src/src/components/ParentPlatformList.vue
+++ b/web_src/src/components/ParentPlatformList.vue
@@ -121,20 +121,21 @@
},
deletePlatformCommit: function(platform) {
var that = this;
- that.$axios.delete(`/api/platform/delete/${platform.serverGBId}`)
- .then(function (res) {
- if (res.data == "success") {
- that.$message({
- showClose: true,
- message: '鍒犻櫎鎴愬姛',
- type: 'success'
- });
- that.initData()
- }
- })
- .catch(function (error) {
- console.log(error);
- });
+ that.$axios({
+ method: 'delete',
+ url:`/api/platform/delete/${platform.serverGBId}`
+ }).then(function (res) {
+ if (res.data == "success") {
+ that.$message({
+ showClose: true,
+ message: '鍒犻櫎鎴愬姛',
+ type: 'success'
+ });
+ that.initData()
+ }
+ }).catch(function (error) {
+ console.log(error);
+ });
},
chooseChannel: function(platform) {
this.$refs.chooseChannelDialog.openDialog(platform.serverGBId, ()=>{
@@ -155,14 +156,15 @@
getPlatformList: function() {
let that = this;
- this.$axios.get(`/api/platform/query/${that.count}/${that.currentPage}`)
- .then(function (res) {
- that.total = res.data.total;
- that.platformList = res.data.list;
- })
- .catch(function (error) {
- console.log(error);
- });
+ this.$axios({
+ method: 'get',
+ url:`/api/platform/query/${that.count}/${that.currentPage}`
+ }).then(function (res) {
+ that.total = res.data.total;
+ that.platformList = res.data.list;
+ }).catch(function (error) {
+ console.log(error);
+ });
}
diff --git a/web_src/src/components/PushVideoList.vue b/web_src/src/components/PushVideoList.vue
index 3e155c2..f40fe3c 100644
--- a/web_src/src/components/PushVideoList.vue
+++ b/web_src/src/components/PushVideoList.vue
@@ -107,20 +107,20 @@
getPushList: function() {
let that = this;
this.getDeviceListLoading = true;
- this.$axios.get(`/api/push/list`,{
+ this.$axios({
+ method: 'get',
+ url:`/api/push/list`,
params: {
page: that.currentPage,
count: that.count
}
- } )
- .then(function (res) {
+ }).then(function (res) {
console.log(res);
console.log(res.data.list);
that.total = res.data.total;
that.pushList = res.data.list;
that.getDeviceListLoading = false;
- })
- .catch(function (error) {
+ }).catch(function (error) {
console.log(error);
that.getDeviceListLoading = false;
});
@@ -129,20 +129,20 @@
playPuhsh: function(row){
let that = this;
this.getListLoading = true;
- this.$axios.get(`/api/media/getStreamInfoByAppAndStream`,{
+ this.$axios({
+ method: 'get',
+ url:`/api/media/stream_info_by_app_and_stream`,
params: {
app: row.app,
stream: row.stream
}
- })
- .then(function (res) {
+ }).then(function (res) {
that.getListLoading = false;
that.$refs.devicePlayer.openDialog("streamPlay", null, null, {
streamInfo: res.data,
hasAudio: true
});
- })
- .catch(function (error) {
+ }).catch(function (error) {
console.log(error);
that.getListLoading = false;
});
@@ -155,17 +155,17 @@
},
removeFromGB: function(row){
var that = this;
- that.$axios.post(`/api/push/remove_form_gb`, row)
- .then(function (res) {
- console.log(res);
- console.log(res.data == "success");
- if (res.data == "success") {
+ that.$axios({
+ method:"delete",
+ url:"/api/push/remove_form_gb",
+ data:row
+ }).then((res)=>{
+ if (res.data == "success") {
that.initData()
}
- })
- .catch(function (error) {
- console.log(error);
- });
+ }).catch(function (error) {
+ console.log(error);
+ });
},
dateFormat: function(/** timestamp=0 **/) {
var ts = arguments[0] || 0;
diff --git a/web_src/src/components/StreamProxyList.vue b/web_src/src/components/StreamProxyList.vue
index 23cda7f..6d4183e 100644
--- a/web_src/src/components/StreamProxyList.vue
+++ b/web_src/src/components/StreamProxyList.vue
@@ -62,7 +62,7 @@
<el-button-group>
<el-button size="mini" icon="el-icon-video-play" v-if="scope.row.enable" @click="play(scope.row)">鎾斁</el-button>
<el-button size="mini" icon="el-icon-close" type="success" v-if="scope.row.enable" @click="stop(scope.row)">鍋滅敤</el-button>
- <el-button size="mini" icon="el-icon-check" type="primary" v-if="!scope.row.enable" @click="start(scope.row)">鍚敤</el-button>
+ <el-button size="mini" icon="el-icon-check" type="primary" :loading="startBtnLaoding" v-if="!scope.row.enable" @click="start(scope.row)">鍚敤</el-button>
<el-button size="mini" icon="el-icon-delete" type="danger" @click="deleteStreamProxy(scope.row)">鍒犻櫎</el-button>
</el-button-group>
</template>
@@ -105,7 +105,8 @@
currentPage:1,
count:15,
total:0,
- getListLoading: false
+ getListLoading: false,
+ startBtnLaoding: false
};
},
computed: {
@@ -133,20 +134,20 @@
getStreamProxyList: function() {
let that = this;
this.getListLoading = true;
- this.$axios.get(`/api/proxy/list`,{
+ this.$axios({
+ method: 'get',
+ url:`/api/proxy/list`,
params: {
page: that.currentPage,
count: that.count
}
- } )
- .then(function (res) {
+ }).then(function (res) {
console.log(res);
console.log(res.data.list);
that.total = res.data.total;
that.streamProxyList = res.data.list;
that.getListLoading = false;
- })
- .catch(function (error) {
+ }).catch(function (error) {
console.log(error);
that.getListLoading = false;
});
@@ -159,20 +160,20 @@
play: function(row){
let that = this;
this.getListLoading = true;
- this.$axios.get(`/api/media/getStreamInfoByAppAndStream`,{
+ this.$axios({
+ method: 'get',
+ url:`/api/media/stream_info_by_app_and_stream`,
params: {
app: row.app,
stream: row.stream
}
- })
- .then(function (res) {
+ }).then(function (res) {
that.getListLoading = false;
that.$refs.devicePlayer.openDialog("streamPlay", null, null, {
streamInfo: res.data,
hasAudio: true
});
- })
- .catch(function (error) {
+ }).catch(function (error) {
console.log(error);
that.getListLoading = false;
});
@@ -182,53 +183,56 @@
console.log(1111)
let that = this;
this.getListLoading = true;
- this.$axios.get(`/api/proxy/del`,{
- params: {
+ that.$axios({
+ method:"delete",
+ url:"/api/proxy/del",
+ params:{
app: row.app,
stream: row.stream
}
- })
- .then(function (res) {
- that.getListLoading = false;
+ }).then((res)=>{
+ that.getListLoading = false;
that.initData()
- })
- .catch(function (error) {
- console.log(error);
+ }).catch(function (error) {
+ console.log(error);
that.getListLoading = false;
- });
+ });
},
start: function(row){
let that = this;
this.getListLoading = true;
- this.$axios.get(`/api/proxy/start`,{
+ this.startBtnLaoding = true;
+ this.$axios({
+ method: 'get',
+ url:`/api/proxy/start`,
params: {
app: row.app,
stream: row.stream
}
- })
- .then(function (res) {
+ }).then(function (res) {
that.getListLoading = false;
+ that.startBtnLaoding = false;
that.initData()
- })
- .catch(function (error) {
+ }).catch(function (error) {
console.log(error);
that.getListLoading = false;
+ that.startBtnLaoding = false;
});
},
stop: function(row){
let that = this;
this.getListLoading = true;
- this.$axios.get(`/api/proxy/stop`,{
+ this.$axios({
+ method: 'get',
+ url:`/api/proxy/stop`,
params: {
app: row.app,
stream: row.stream
}
- })
- .then(function (res) {
+ }).then(function (res) {
that.getListLoading = false;
that.initData()
- })
- .catch(function (error) {
+ }).catch(function (error) {
console.log(error);
that.getListLoading = false;
});
diff --git a/web_src/src/components/channelList.vue b/web_src/src/components/channelList.vue
index ebb4318..5e778f7 100644
--- a/web_src/src/components/channelList.vue
+++ b/web_src/src/components/channelList.vue
@@ -153,17 +153,17 @@
},
getDeviceChannelList: function () {
let that = this;
-
- this.$axios.get(`/api/device/query/devices/${this.$route.params.deviceId}/channels`, {
- params: {
- page: that.currentPage,
+ this.$axios({
+ method: 'get',
+ url: `/api/device/query/devices/${this.$route.params.deviceId}/channels`,
+ params:{
+ page: that.currentPage,
count: that.count,
query: that.searchSrt,
online: that.online,
channelType: that.channelType
- }
- })
- .then(function (res) {
+ }
+ }).then(function (res) {
console.log(res);
that.total = res.data.total;
that.deviceChannelList = res.data.list;
@@ -171,10 +171,10 @@
that.$nextTick(() => {
that.$refs.channelListTable.doLayout();
})
- })
- .catch(function (error) {
- console.log(error);
- });
+ }).catch(function (error) {
+ console.log(error);
+ });
+
},
@@ -215,7 +215,7 @@
console.log(itemData)
var that = this;
this.$axios({
- method: 'post',
+ method: 'get',
url: '/api/play/stop/' + itemData.streamId
}).then(function (res) {
console.log(JSON.stringify(res));
@@ -251,26 +251,26 @@
showSubchannels: function (channelId) {
let that = this;
- this.$axios.get(`/api/device/query/sub_channels/${this.deviceId}/${this.parentChannelId}/channels`, {
- params: {
- page: that.currentPage,
- count: that.count,
- query: that.searchSrt,
- online: that.online,
- channelType: that.channelType
- }
+ this.$axios({
+ method: 'get',
+ url:`/api/device/query/sub_channels/${this.deviceId}/${this.parentChannelId}/channels`,
+ params: {
+ page: that.currentPage,
+ count: that.count,
+ query: that.searchSrt,
+ online: that.online,
+ channelType: that.channelType
+ }
+ }).then(function (res) {
+ that.total = res.data.total;
+ that.deviceChannelList = res.data.list;
+ // 闃叉鍑虹幇琛ㄦ牸閿欎綅
+ that.$nextTick(() => {
+ that.$refs.channelListTable.doLayout();
})
- .then(function (res) {
- that.total = res.data.total;
- that.deviceChannelList = res.data.list;
- // 闃叉鍑虹幇琛ㄦ牸閿欎綅
- that.$nextTick(() => {
- that.$refs.channelListTable.doLayout();
- })
- })
- .catch(function (error) {
- console.log(error);
- });
+ }).catch(function (error) {
+ console.log(error);
+ });
},
search: function () {
console.log(this.searchSrt)
diff --git a/web_src/src/components/devicePosition.vue b/web_src/src/components/devicePosition.vue
index dfee0b1..777b11e 100644
--- a/web_src/src/components/devicePosition.vue
+++ b/web_src/src/components/devicePosition.vue
@@ -171,13 +171,14 @@
this.endTime = null;
}
let self = this;
- this.$axios.get(`/api/position/history/${this.deviceId}`, {
+ this.$axios({
+ method: 'get',
+ url:`/api/position/history/${this.deviceId}`,
params: {
start: self.startTime,
end: self.endTime,
},
- })
- .then(function (res) {
+ }).then(function (res) {
self.total = res.data.length;
self.mobilePositionList = res.data;
console.log(self.mobilePositionList);
@@ -192,8 +193,7 @@
self.showMarkPoints(self);
});
}
- })
- .catch(function (error) {
+ }).catch(function (error) {
console.log(error);
});
},
@@ -202,8 +202,10 @@
this.mapPointList = [];
this.mobilePositionList = [];
let self = this;
- this.$axios.get(`/api/position/latest/${this.deviceId}`)
- .then(function (res) {
+ this.$axios({
+ method: 'get',
+ url:`/api/position/latest/${this.deviceId}`
+ }).then(function (res) {
console.log(res.data);
self.total = res.data.length;
self.mobilePositionList.push(res.data);
@@ -219,20 +221,20 @@
self.showMarkPoints(self);
});
}
- })
- .catch(function (error) {
+ }).catch(function (error) {
console.log(error);
});
},
subscribeMobilePosition: function() {
let self = this;
- this.$axios.get(`/api/position/subscribe/${this.deviceId}`, {
- params: {
- expires: self.expired,
- interval: self.interval,
- },
- })
- .then(function (res) {
+ this.$axios({
+ method: 'get',
+ url:`/api/position/subscribe/${this.deviceId}`,
+ params: {
+ expires: self.expired,
+ interval: self.interval,
+ },
+ }).then(function (res) {
console.log(res.data);
})
.catch(function (error) {
@@ -241,16 +243,17 @@
},
unSubscribeMobilePosition: function() {
let self = this;
- this.$axios.get(`/api/position/subscribe/${this.deviceId}`, {
- params: {
- expires: 0,
- interval: self.interval,
- },
+ this.$axios({
+ method: 'get',
+ url:`/api/position/subscribe/${this.deviceId}`,
+ params: {
+ expires: 0,
+ interval: self.interval,
+ },
})
.then(function (res) {
console.log(res.data);
- })
- .catch(function (error) {
+ }).catch(function (error) {
console.log(error);
});
},
diff --git a/web_src/src/components/dialog/StreamProxyEdit.vue b/web_src/src/components/dialog/StreamProxyEdit.vue
index bdde9db..b0ea10e 100644
--- a/web_src/src/components/dialog/StreamProxyEdit.vue
+++ b/web_src/src/components/dialog/StreamProxyEdit.vue
@@ -146,9 +146,11 @@
onSubmit: function () {
console.log("onSubmit");
var that = this;
- that.$axios
- .post(`/api/proxy/save`, that.proxyParam)
- .then(function (res) {
+ that.$axios({
+ method: 'post',
+ url:`/api/proxy/save`,
+ data: that.proxyParam
+ }).then(function (res) {
console.log(res);
console.log(res.data == "success");
if (res.data == "success") {
@@ -162,8 +164,7 @@
that.listChangeCallback();
}
}
- })
- .catch(function (error) {
+ }).catch(function (error) {
console.log(error);
});
},
@@ -175,14 +176,14 @@
deviceGBIdExit: async function (deviceGbId) {
var result = false;
var that = this;
- await that.$axios
- .post(`/api/platform/exit/${deviceGbId}`)
- .then(function (res) {
- result = res.data;
- })
- .catch(function (error) {
- console.log(error);
- });
+ await that.$axios({
+ method: 'post',
+ url:`/api/platform/exit/${deviceGbId}`
+ }).then(function (res) {
+ result = res.data;
+ }).catch(function (error) {
+ console.log(error);
+ });
return result;
},
checkExpires: function() {
diff --git a/web_src/src/components/dialog/addStreamTOGB.vue b/web_src/src/components/dialog/addStreamTOGB.vue
index 7dc8a87..9baf1bc 100644
--- a/web_src/src/components/dialog/addStreamTOGB.vue
+++ b/web_src/src/components/dialog/addStreamTOGB.vue
@@ -89,11 +89,11 @@
onSubmit: function () {
console.log("onSubmit");
var that = this;
- that.$axios
- .post(`/api/push/save_to_gb`, that.proxyParam)
- .then(function (res) {
- console.log(res);
- console.log(res.data == "success");
+ that.$axios({
+ method:"post",
+ url:`/api/push/save_to_gb`,
+ data: that.proxyParam
+ }).then(function (res) {
if (res.data == "success") {
that.$message({
showClose: true,
@@ -105,10 +105,9 @@
that.listChangeCallback();
}
}
- })
- .catch(function (error) {
+ }).catch(function (error) {
console.log(error);
- });
+ });
},
close: function () {
console.log("鍏抽棴鍔犲叆GB");
@@ -118,14 +117,14 @@
deviceGBIdExit: async function (deviceGbId) {
var result = false;
var that = this;
- await that.$axios
- .post(`/api/platform/exit/${deviceGbId}`)
- .then(function (res) {
- result = res.data;
- })
- .catch(function (error) {
- console.log(error);
- });
+ await that.$axios({
+ method:"post",
+ url:`/api/platform/exit/${deviceGbId}`
+ }).then(function (res) {
+ result = res.data;
+ }).catch(function (error) {
+ console.log(error);
+ });
return result;
},
checkExpires: function() {
diff --git a/web_src/src/components/dialog/chooseChannelForGb.vue b/web_src/src/components/dialog/chooseChannelForGb.vue
index 28b3d58..eddcdf9 100644
--- a/web_src/src/components/dialog/chooseChannelForGb.vue
+++ b/web_src/src/components/dialog/chooseChannelForGb.vue
@@ -182,7 +182,9 @@
getChannelList: function () {
let that = this;
- this.$axios.get(`/api/platform/channel_list`, {
+ this.$axios({
+ method:"get",
+ url:`/api/platform/channel_list`,
params: {
page: that.currentPage,
count: that.count,
diff --git a/web_src/src/components/dialog/chooseChannelForStream.vue b/web_src/src/components/dialog/chooseChannelForStream.vue
index 514ac3e..c78d699 100644
--- a/web_src/src/components/dialog/chooseChannelForStream.vue
+++ b/web_src/src/components/dialog/chooseChannelForStream.vue
@@ -162,16 +162,18 @@
getChannelList: function () {
let that = this;
- this.$axios.get(`/api/gbStream/list`, {
- params: {
- page: that.currentPage,
- count: that.count,
- query: that.searchSrt,
- online: that.online,
- choosed: that.choosed,
- platformId: that.platformId,
- channelType: that.channelType
- }
+ this.$axios({
+ method: 'get',
+ url:`/api/gbStream/list`,
+ params: {
+ page: that.currentPage,
+ count: that.count,
+ query: that.searchSrt,
+ online: that.online,
+ choosed: that.choosed,
+ platformId: that.platformId,
+ channelType: that.channelType
+ }
})
.then(function (res) {
that.total = res.data.total;
diff --git a/web_src/src/components/dialog/platformEdit.vue b/web_src/src/components/dialog/platformEdit.vue
index 34ee27d..c0e0f9a 100644
--- a/web_src/src/components/dialog/platformEdit.vue
+++ b/web_src/src/components/dialog/platformEdit.vue
@@ -163,17 +163,17 @@
methods: {
openDialog: function (platform, callback) {
var that = this;
- this.$axios
- .get(`/api/platform/server_config`)
- .then(function (res) {
+ this.$axios({
+ method: 'get',
+ url:`/api/platform/server_config`
+ }).then(function (res) {
console.log(res);
that.platform.deviceGBId = res.data.username;
that.platform.deviceIp = res.data.deviceIp;
that.platform.devicePort = res.data.devicePort;
that.platform.username = res.data.username;
that.platform.password = res.data.password;
- })
- .catch(function (error) {
+ }).catch(function (error) {
console.log(error);
});
this.showDialog = true;
@@ -188,11 +188,11 @@
onSubmit: function () {
console.log("onSubmit");
var that = this;
- that.$axios
- .post(`/api/platform/save`, that.platform)
- .then(function (res) {
- console.log(res);
- console.log(res.data == "success");
+ that.$axios({
+ method: 'post',
+ url:`/api/platform/save`,
+ data: that.platform
+ }).then(function (res) {
if (res.data == "success") {
that.$message({
showClose: true,
@@ -204,8 +204,7 @@
that.listChangeCallback();
}
}
- })
- .catch(function (error) {
+ }).catch(function (error) {
console.log(error);
});
},
@@ -218,8 +217,9 @@
deviceGBIdExit: async function (deviceGbId) {
var result = false;
var that = this;
- await that.$axios
- .post(`/api/platform/exit/${deviceGbId}`)
+ await that.$axios({
+ method: 'post',
+ url:`/api/platform/exit/${deviceGbId}`})
.then(function (res) {
result = res.data;
})
diff --git a/web_src/src/components/dialog/rtcPlayer.vue b/web_src/src/components/dialog/rtcPlayer.vue
index 6208100..a7c0212 100644
--- a/web_src/src/components/dialog/rtcPlayer.vue
+++ b/web_src/src/components/dialog/rtcPlayer.vue
@@ -11,7 +11,8 @@
name: 'rtcPlayer',
data() {
return {
- webrtcPlayer: null
+ webrtcPlayer: null,
+ timer: null
};
},
props: ['videoUrl', 'error', 'hasaudio'],
@@ -55,7 +56,7 @@
this.eventcallbacK("OFFER ANSWER ERROR ", "offer anwser 浜ゆ崲澶辫触")
if (e.code ==-400 && e.msg=="娴佷笉瀛樺湪"){
console.log("111111")
- setTimeout(()=>{
+ this.timer = setTimeout(()=>{
this.webrtcPlayer.close();
this.play(url)
}, 100)
@@ -83,6 +84,9 @@
console.log(message)
}
},
+ destroyed() {
+ clearTimeout(this.timer);
+ },
}
</script>
--
Gitblit v1.8.0