Browse Source

统一axios写法

pull/80/head
panlinlin 4 years ago
parent
commit
4010ed6c23
  1. 8
      pom.xml
  2. 4
      src/main/java/com/genersoft/iot/vmp/conf/Swagger3Config.java
  3. 2
      src/main/java/com/genersoft/iot/vmp/service/impl/PlayServiceImpl.java
  4. 5
      src/main/java/com/genersoft/iot/vmp/service/impl/StreamProxyServiceImpl.java
  5. 2
      src/main/java/com/genersoft/iot/vmp/storager/dao/GbStreamMapper.java
  6. 1
      src/main/java/com/genersoft/iot/vmp/storager/impl/VideoManagerStoragerImpl.java
  7. 5
      src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/SseController/SseController.java
  8. 2
      src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/media/MediaController.java
  9. 2
      src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/platformGbStream/PlatformGbStreamController.java
  10. 2
      src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/play/PlayController.java
  11. 2
      src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/playback/PlaybackController.java
  12. 2
      src/main/java/com/genersoft/iot/vmp/vmanager/server/ServerController.java
  13. 12
      src/main/java/com/genersoft/iot/vmp/vmanager/streamProxy/StreamProxyController.java
  14. 6
      src/main/java/com/genersoft/iot/vmp/vmanager/streamPush/StreamPushController.java
  15. 3
      src/main/java/com/genersoft/iot/vmp/vmanager/user/UserController.java
  16. 10
      web_src/src/components/DeviceList.vue
  17. 10
      web_src/src/components/Login.vue
  18. 18
      web_src/src/components/ParentPlatformList.vue
  19. 32
      web_src/src/components/PushVideoList.vue
  20. 58
      web_src/src/components/StreamProxyList.vue
  21. 24
      web_src/src/components/channelList.vue
  22. 33
      web_src/src/components/devicePosition.vue
  23. 21
      web_src/src/components/dialog/StreamProxyEdit.vue
  24. 23
      web_src/src/components/dialog/addStreamTOGB.vue
  25. 4
      web_src/src/components/dialog/chooseChannelForGb.vue
  26. 4
      web_src/src/components/dialog/chooseChannelForStream.vue
  27. 28
      web_src/src/components/dialog/platformEdit.vue
  28. 8
      web_src/src/components/dialog/rtcPlayer.vue

8
pom.xml

@ -109,6 +109,12 @@
<artifactId>springfox-boot-starter</artifactId> <artifactId>springfox-boot-starter</artifactId>
<version>3.0.0</version> <version>3.0.0</version>
</dependency> </dependency>
<dependency>
<groupId>com.github.xiaoymin</groupId>
<artifactId>knife4j-spring-boot-starter</artifactId>
<version>3.0.2</version>
</dependency>
<!--参数校验 --> <!--参数校验 -->
<dependency> <dependency>
@ -165,7 +171,7 @@
</dependencies> </dependencies>
<build> <build>
<finalName>wvp-2.5.8</finalName> <finalName>wvp-2.0</finalName>
<plugins> <plugins>
<plugin> <plugin>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>

4
src/main/java/com/genersoft/iot/vmp/conf/Swagger3Config.java

@ -92,8 +92,8 @@ public class Swagger3Config {
return new ApiInfoBuilder() return new ApiInfoBuilder()
.title("WVP-PRO 接口文档") .title("WVP-PRO 接口文档")
.description("更多请咨询服务开发者(18010473990@@163.com)。") .description("更多请咨询服务开发者(18010473990@@163.com)。")
.contact(new Contact("Ray。", "http://www.ruiyeclub.cn", "ruiyeclub@foxmail.com")) .contact(new Contact("panlinlin", "http://www.ruiyeclub.cn", "ruiyeclub@foxmail.com"))
.version("1.0") .version("2.0")
.build(); .build();
} }
} }

2
src/main/java/com/genersoft/iot/vmp/service/impl/PlayServiceImpl.java

@ -84,7 +84,7 @@ public class PlayServiceImpl implements IPlayService {
} else { } else {
String streamId = streamInfo.getStreamId(); String streamId = streamInfo.getStreamId();
JSONObject rtpInfo = zlmresTfulUtils.getRtpInfo(streamId); JSONObject rtpInfo = zlmresTfulUtils.getRtpInfo(streamId);
if (rtpInfo.getBoolean("exist")) { if (rtpInfo != null && rtpInfo.getBoolean("exist")) {
RequestMessage msg = new RequestMessage(); RequestMessage msg = new RequestMessage();
msg.setId(DeferredResultHolder.CALLBACK_CMD_PlAY + uuid); msg.setId(DeferredResultHolder.CALLBACK_CMD_PlAY + uuid);
msg.setData(JSON.toJSONString(streamInfo)); msg.setData(JSON.toJSONString(streamInfo));

5
src/main/java/com/genersoft/iot/vmp/service/impl/StreamProxyServiceImpl.java

@ -118,12 +118,11 @@ public class StreamProxyServiceImpl implements IStreamProxyService {
public boolean stop(String app, String stream) { public boolean stop(String app, String stream) {
boolean result = false; boolean result = false;
StreamProxyItem streamProxyDto = videoManagerStorager.queryStreamProxy(app, stream); StreamProxyItem streamProxyDto = videoManagerStorager.queryStreamProxy(app, stream);
if (streamProxyDto.isEnable() && streamProxyDto != null) { if (streamProxyDto != null && streamProxyDto.isEnable()) {
JSONObject jsonObject = removeStreamProxyFromZlm(streamProxyDto); JSONObject jsonObject = removeStreamProxyFromZlm(streamProxyDto);
if (jsonObject.getInteger("code") == 0) { if (jsonObject.getInteger("code") == 0) {
result = true;
streamProxyDto.setEnable(false); streamProxyDto.setEnable(false);
videoManagerStorager.updateStreamProxy(streamProxyDto); result = videoManagerStorager.updateStreamProxy(streamProxyDto);
} }
} }
return result; return result;

2
src/main/java/com/genersoft/iot/vmp/storager/dao/GbStreamMapper.java

@ -24,7 +24,7 @@ public interface GbStreamMapper {
"name=#{name}," + "name=#{name}," +
"streamType=#{streamType}," + "streamType=#{streamType}," +
"longitude=#{longitude}, " + "longitude=#{longitude}, " +
"latitude=#{latitude} " + "latitude=#{latitude}," +
"status=${status} " + "status=${status} " +
"WHERE app=#{app} AND stream=#{stream} AND gbId=#{gbId}") "WHERE app=#{app} AND stream=#{stream} AND gbId=#{gbId}")
int update(GbStream gbStream); int update(GbStream gbStream);

1
src/main/java/com/genersoft/iot/vmp/storager/impl/VideoManagerStoragerImpl.java

@ -440,6 +440,7 @@ public class VideoManagerStoragerImpl implements IVideoManagerStorager {
dataSourceTransactionManager.commit(transactionStatus); //手动提交 dataSourceTransactionManager.commit(transactionStatus); //手动提交
result = true; result = true;
}catch (Exception e) { }catch (Exception e) {
e.printStackTrace();
dataSourceTransactionManager.rollback(transactionStatus); dataSourceTransactionManager.rollback(transactionStatus);
} }
return result; return result;

5
src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/SseController/SseController.java

@ -8,6 +8,7 @@ import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.CrossOrigin; 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.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.mvc.method.annotation.SseEmitter; import org.springframework.web.servlet.mvc.method.annotation.SseEmitter;
@ -25,11 +26,11 @@ public class SseController {
@Autowired @Autowired
AlarmEventListener alarmEventListener; AlarmEventListener alarmEventListener;
@ApiOperation("设置响应") @ApiOperation("浏览器推送")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "browserId", value = "浏览器ID", dataTypeClass = String.class), @ApiImplicitParam(name = "browserId", value = "浏览器ID", dataTypeClass = String.class),
}) })
@RequestMapping("/emit") @PostMapping("/emit")
public SseEmitter emit(@RequestParam String browserId) { public SseEmitter emit(@RequestParam String browserId) {
final SseEmitter sseEmitter = new SseEmitter(0L); final SseEmitter sseEmitter = new SseEmitter(0L);
try { try {

2
src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/media/MediaController.java

@ -44,7 +44,7 @@ public class MediaController {
@ApiImplicitParam(name = "app", value = "应用名", dataTypeClass = String.class), @ApiImplicitParam(name = "app", value = "应用名", dataTypeClass = String.class),
@ApiImplicitParam(name = "stream", value = "流id", dataTypeClass = String.class), @ApiImplicitParam(name = "stream", value = "流id", dataTypeClass = String.class),
}) })
@RequestMapping(value = "/getStreamInfoByAppAndStream") @GetMapping(value = "/stream_info_by_app_and_stream")
@ResponseBody @ResponseBody
public StreamInfo getStreamInfoByAppAndStream(String app, String stream){ public StreamInfo getStreamInfoByAppAndStream(String app, String stream){
return mediaService.getStreamInfoByAppAndStreamWithCheck(app, stream); return mediaService.getStreamInfoByAppAndStreamWithCheck(app, stream);

2
src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/platformGbStream/PlatformGbStreamController.java

@ -32,7 +32,7 @@ public class PlatformGbStreamController {
@ApiImplicitParam(name = "page", value = "当前页", dataTypeClass = Integer.class), @ApiImplicitParam(name = "page", value = "当前页", dataTypeClass = Integer.class),
@ApiImplicitParam(name = "count", value = "每页条数", dataTypeClass = Integer.class), @ApiImplicitParam(name = "count", value = "每页条数", dataTypeClass = Integer.class),
}) })
@RequestMapping(value = "/list") @GetMapping(value = "/list")
@ResponseBody @ResponseBody
public PageInfo<GbStream> list(@RequestParam(required = false)Integer page, public PageInfo<GbStream> list(@RequestParam(required = false)Integer page,
@RequestParam(required = false)Integer count){ @RequestParam(required = false)Integer count){

2
src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/play/PlayController.java

@ -93,7 +93,7 @@ public class PlayController {
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "streamId", value = "视频流ID", dataTypeClass = String.class), @ApiImplicitParam(name = "streamId", value = "视频流ID", dataTypeClass = String.class),
}) })
@PostMapping("/stop/{streamId}") @GetMapping("/stop/{streamId}")
public DeferredResult<ResponseEntity<String>> playStop(@PathVariable String streamId) { public DeferredResult<ResponseEntity<String>> playStop(@PathVariable String streamId) {
logger.debug(String.format("设备预览/回放停止API调用,streamId:%s", streamId)); logger.debug(String.format("设备预览/回放停止API调用,streamId:%s", streamId));

2
src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/playback/PlaybackController.java

@ -105,7 +105,7 @@ public class PlaybackController {
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "ssrc", value = "视频流标识", dataTypeClass = String.class), @ApiImplicitParam(name = "ssrc", value = "视频流标识", dataTypeClass = String.class),
}) })
@RequestMapping("/stop/{ssrc}") @GetMapping("/stop/{ssrc}")
public ResponseEntity<String> playStop(@PathVariable String ssrc) { public ResponseEntity<String> playStop(@PathVariable String ssrc) {
cmder.streamByeCmd(ssrc); cmder.streamByeCmd(ssrc);

2
src/main/java/com/genersoft/iot/vmp/vmanager/server/ServerController.java

@ -25,7 +25,7 @@ public class ServerController {
@ApiOperation("重启服务") @ApiOperation("重启服务")
@RequestMapping(value = "/restart") @GetMapping(value = "/restart")
@ResponseBody @ResponseBody
public Object restart(){ public Object restart(){
Thread restartThread = new Thread(new Runnable() { Thread restartThread = new Thread(new Runnable() {

12
src/main/java/com/genersoft/iot/vmp/vmanager/streamProxy/StreamProxyController.java

@ -41,7 +41,7 @@ public class StreamProxyController {
@ApiImplicitParam(name="query", value = "查询内容", dataTypeClass = String.class), @ApiImplicitParam(name="query", value = "查询内容", dataTypeClass = String.class),
@ApiImplicitParam(name="online", value = "是否在线", dataTypeClass = Boolean.class), @ApiImplicitParam(name="online", value = "是否在线", dataTypeClass = Boolean.class),
}) })
@RequestMapping(value = "/list") @GetMapping(value = "/list")
@ResponseBody @ResponseBody
public PageInfo<StreamProxyItem> list(@RequestParam(required = false)Integer page, public PageInfo<StreamProxyItem> list(@RequestParam(required = false)Integer page,
@RequestParam(required = false)Integer count, @RequestParam(required = false)Integer count,
@ -55,7 +55,7 @@ public class StreamProxyController {
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "param", value = "代理参数", dataTypeClass = StreamProxyItem.class), @ApiImplicitParam(name = "param", value = "代理参数", dataTypeClass = StreamProxyItem.class),
}) })
@RequestMapping(value = "/save") @PostMapping(value = "/save")
@ResponseBody @ResponseBody
public Object save(@RequestBody StreamProxyItem param){ public Object save(@RequestBody StreamProxyItem param){
logger.info("添加代理: " + JSONObject.toJSONString(param)); logger.info("添加代理: " + JSONObject.toJSONString(param));
@ -68,7 +68,7 @@ public class StreamProxyController {
@ApiImplicitParam(name = "app", value = "应用名", dataTypeClass = String.class), @ApiImplicitParam(name = "app", value = "应用名", dataTypeClass = String.class),
@ApiImplicitParam(name = "stream", value = "流ID", dataTypeClass = String.class), @ApiImplicitParam(name = "stream", value = "流ID", dataTypeClass = String.class),
}) })
@RequestMapping(value = "/del") @DeleteMapping(value = "/del")
@ResponseBody @ResponseBody
public Object del(String app, String stream){ public Object del(String app, String stream){
logger.info("移除代理: " + app + "/" + stream); logger.info("移除代理: " + app + "/" + stream);
@ -81,7 +81,7 @@ public class StreamProxyController {
@ApiImplicitParam(name = "app", value = "应用名", dataTypeClass = String.class), @ApiImplicitParam(name = "app", value = "应用名", dataTypeClass = String.class),
@ApiImplicitParam(name = "stream", value = "流ID", dataTypeClass = String.class), @ApiImplicitParam(name = "stream", value = "流ID", dataTypeClass = String.class),
}) })
@RequestMapping(value = "/start") @GetMapping(value = "/start")
@ResponseBody @ResponseBody
public Object start(String app, String stream){ public Object start(String app, String stream){
logger.info("启用代理: " + app + "/" + stream); logger.info("启用代理: " + app + "/" + stream);
@ -94,11 +94,11 @@ public class StreamProxyController {
@ApiImplicitParam(name = "app", value = "应用名", dataTypeClass = String.class), @ApiImplicitParam(name = "app", value = "应用名", dataTypeClass = String.class),
@ApiImplicitParam(name = "stream", value = "流ID", dataTypeClass = String.class), @ApiImplicitParam(name = "stream", value = "流ID", dataTypeClass = String.class),
}) })
@RequestMapping(value = "/stop") @GetMapping(value = "/stop")
@ResponseBody @ResponseBody
public Object stop(String app, String stream){ public Object stop(String app, String stream){
logger.info("停用代理: " + app + "/" + stream); logger.info("停用代理: " + app + "/" + stream);
boolean result = streamProxyService.stop(app, stream); boolean result = streamProxyService.stop(app, stream);
return "success"; return result?"success":"fail";
} }
} }

6
src/main/java/com/genersoft/iot/vmp/vmanager/streamPush/StreamPushController.java

@ -32,7 +32,7 @@ public class StreamPushController {
@ApiImplicitParam(name="query", value = "查询内容", dataTypeClass = String.class), @ApiImplicitParam(name="query", value = "查询内容", dataTypeClass = String.class),
@ApiImplicitParam(name="online", value = "是否在线", dataTypeClass = Boolean.class), @ApiImplicitParam(name="online", value = "是否在线", dataTypeClass = Boolean.class),
}) })
@RequestMapping(value = "/list") @GetMapping(value = "/list")
@ResponseBody @ResponseBody
public PageInfo<StreamPushItem> list(@RequestParam(required = false)Integer page, public PageInfo<StreamPushItem> list(@RequestParam(required = false)Integer page,
@RequestParam(required = false)Integer count, @RequestParam(required = false)Integer count,
@ -47,7 +47,7 @@ public class StreamPushController {
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "stream", value = "直播流关联国标平台", dataTypeClass = GbStream.class), @ApiImplicitParam(name = "stream", value = "直播流关联国标平台", dataTypeClass = GbStream.class),
}) })
@RequestMapping(value = "/save_to_gb") @PostMapping(value = "/save_to_gb")
@ResponseBody @ResponseBody
public Object saveToGB(@RequestBody GbStream stream){ public Object saveToGB(@RequestBody GbStream stream){
if (streamPushService.saveToGB(stream)){ if (streamPushService.saveToGB(stream)){
@ -62,7 +62,7 @@ public class StreamPushController {
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "stream", value = "直播流关联国标平台", dataTypeClass = GbStream.class), @ApiImplicitParam(name = "stream", value = "直播流关联国标平台", dataTypeClass = GbStream.class),
}) })
@RequestMapping(value = "/remove_form_gb") @DeleteMapping(value = "/remove_form_gb")
@ResponseBody @ResponseBody
public Object removeFormGB(@RequestBody GbStream stream){ public Object removeFormGB(@RequestBody GbStream stream){
if (streamPushService.removeFromGB(stream)){ if (streamPushService.removeFromGB(stream)){

3
src/main/java/com/genersoft/iot/vmp/vmanager/user/UserController.java

@ -8,6 +8,7 @@ import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.CrossOrigin; 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.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
@ -28,7 +29,7 @@ public class UserController {
@ApiImplicitParam(name = "username", value = "用户名", dataTypeClass = String.class), @ApiImplicitParam(name = "username", value = "用户名", dataTypeClass = String.class),
@ApiImplicitParam(name = "password", value = "密码(32未md5加密)", dataTypeClass = String.class), @ApiImplicitParam(name = "password", value = "密码(32未md5加密)", dataTypeClass = String.class),
}) })
@RequestMapping("/login") @GetMapping("/login")
public String login(String username, String password){ public String login(String username, String password){
if (!StringUtils.isEmpty(username) && username.equals(usernameConfig) if (!StringUtils.isEmpty(username) && username.equals(usernameConfig)
&& !StringUtils.isEmpty(password) && password.equals(passwordConfig)) { && !StringUtils.isEmpty(password) && password.equals(passwordConfig)) {

10
web_src/src/components/DeviceList.vue

@ -136,20 +136,20 @@
getDeviceList: function() { getDeviceList: function() {
let that = this; let that = this;
this.getDeviceListLoading = true; this.getDeviceListLoading = true;
this.$axios.get(`/api/device/query/devices`,{ this.$axios({
method: 'get',
url:`/api/device/query/devices`,
params: { params: {
page: that.currentPage, page: that.currentPage,
count: that.count count: that.count
} }
} ) }).then(function (res) {
.then(function (res) {
console.log(res); console.log(res);
console.log(res.data.list); console.log(res.data.list);
that.total = res.data.total; that.total = res.data.total;
that.deviceList = res.data.list; that.deviceList = res.data.list;
that.getDeviceListLoading = false; that.getDeviceListLoading = false;
}) }).catch(function (error) {
.catch(function (error) {
console.log(error); console.log(error);
that.getDeviceListLoading = false; that.getDeviceListLoading = false;
}); });

10
web_src/src/components/Login.vue

@ -61,10 +61,11 @@ export default {
// //
this.isLoging = true; this.isLoging = true;
this.$axios.get("/api/user/login",{ this.$axios({
method: 'get',
url:"/api/user/login",
params: loginParam params: loginParam
} ) }).then(function (res) {
.then(function (res) {
console.log(JSON.stringify(res)); console.log(JSON.stringify(res));
if (res.data == "success") { if (res.data == "success") {
that.$cookies.set("session", {"username": that.username}) ; that.$cookies.set("session", {"username": that.username}) ;
@ -79,8 +80,7 @@ export default {
type: 'error' type: 'error'
}); });
} }
}) }).catch(function (error) {
.catch(function (error) {
that.$message.error(error.response.statusText); that.$message.error(error.response.statusText);
that.isLoging = false; that.isLoging = false;
}); });

18
web_src/src/components/ParentPlatformList.vue

@ -121,8 +121,10 @@ export default {
}, },
deletePlatformCommit: function(platform) { deletePlatformCommit: function(platform) {
var that = this; var that = this;
that.$axios.delete(`/api/platform/delete/${platform.serverGBId}`) that.$axios({
.then(function (res) { method: 'delete',
url:`/api/platform/delete/${platform.serverGBId}`
}).then(function (res) {
if (res.data == "success") { if (res.data == "success") {
that.$message({ that.$message({
showClose: true, showClose: true,
@ -131,8 +133,7 @@ export default {
}); });
that.initData() that.initData()
} }
}) }).catch(function (error) {
.catch(function (error) {
console.log(error); console.log(error);
}); });
}, },
@ -155,12 +156,13 @@ export default {
getPlatformList: function() { getPlatformList: function() {
let that = this; let that = this;
this.$axios.get(`/api/platform/query/${that.count}/${that.currentPage}`) this.$axios({
.then(function (res) { method: 'get',
url:`/api/platform/query/${that.count}/${that.currentPage}`
}).then(function (res) {
that.total = res.data.total; that.total = res.data.total;
that.platformList = res.data.list; that.platformList = res.data.list;
}) }).catch(function (error) {
.catch(function (error) {
console.log(error); console.log(error);
}); });

32
web_src/src/components/PushVideoList.vue

@ -107,20 +107,20 @@
getPushList: function() { getPushList: function() {
let that = this; let that = this;
this.getDeviceListLoading = true; this.getDeviceListLoading = true;
this.$axios.get(`/api/push/list`,{ this.$axios({
method: 'get',
url:`/api/push/list`,
params: { params: {
page: that.currentPage, page: that.currentPage,
count: that.count count: that.count
} }
} ) }).then(function (res) {
.then(function (res) {
console.log(res); console.log(res);
console.log(res.data.list); console.log(res.data.list);
that.total = res.data.total; that.total = res.data.total;
that.pushList = res.data.list; that.pushList = res.data.list;
that.getDeviceListLoading = false; that.getDeviceListLoading = false;
}) }).catch(function (error) {
.catch(function (error) {
console.log(error); console.log(error);
that.getDeviceListLoading = false; that.getDeviceListLoading = false;
}); });
@ -129,20 +129,20 @@
playPuhsh: function(row){ playPuhsh: function(row){
let that = this; let that = this;
this.getListLoading = true; this.getListLoading = true;
this.$axios.get(`/api/media/getStreamInfoByAppAndStream`,{ this.$axios({
method: 'get',
url:`/api/media/stream_info_by_app_and_stream`,
params: { params: {
app: row.app, app: row.app,
stream: row.stream stream: row.stream
} }
}) }).then(function (res) {
.then(function (res) {
that.getListLoading = false; that.getListLoading = false;
that.$refs.devicePlayer.openDialog("streamPlay", null, null, { that.$refs.devicePlayer.openDialog("streamPlay", null, null, {
streamInfo: res.data, streamInfo: res.data,
hasAudio: true hasAudio: true
}); });
}) }).catch(function (error) {
.catch(function (error) {
console.log(error); console.log(error);
that.getListLoading = false; that.getListLoading = false;
}); });
@ -155,15 +155,15 @@
}, },
removeFromGB: function(row){ removeFromGB: function(row){
var that = this; var that = this;
that.$axios.post(`/api/push/remove_form_gb`, row) that.$axios({
.then(function (res) { method:"delete",
console.log(res); url:"/api/push/remove_form_gb",
console.log(res.data == "success"); data:row
}).then((res)=>{
if (res.data == "success") { if (res.data == "success") {
that.initData() that.initData()
} }
}) }).catch(function (error) {
.catch(function (error) {
console.log(error); console.log(error);
}); });
}, },

58
web_src/src/components/StreamProxyList.vue

@ -62,7 +62,7 @@
<el-button-group> <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-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-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 size="mini" icon="el-icon-delete" type="danger" @click="deleteStreamProxy(scope.row)">删除</el-button>
</el-button-group> </el-button-group>
</template> </template>
@ -105,7 +105,8 @@
currentPage:1, currentPage:1,
count:15, count:15,
total:0, total:0,
getListLoading: false getListLoading: false,
startBtnLaoding: false
}; };
}, },
computed: { computed: {
@ -133,20 +134,20 @@
getStreamProxyList: function() { getStreamProxyList: function() {
let that = this; let that = this;
this.getListLoading = true; this.getListLoading = true;
this.$axios.get(`/api/proxy/list`,{ this.$axios({
method: 'get',
url:`/api/proxy/list`,
params: { params: {
page: that.currentPage, page: that.currentPage,
count: that.count count: that.count
} }
} ) }).then(function (res) {
.then(function (res) {
console.log(res); console.log(res);
console.log(res.data.list); console.log(res.data.list);
that.total = res.data.total; that.total = res.data.total;
that.streamProxyList = res.data.list; that.streamProxyList = res.data.list;
that.getListLoading = false; that.getListLoading = false;
}) }).catch(function (error) {
.catch(function (error) {
console.log(error); console.log(error);
that.getListLoading = false; that.getListLoading = false;
}); });
@ -159,20 +160,20 @@
play: function(row){ play: function(row){
let that = this; let that = this;
this.getListLoading = true; this.getListLoading = true;
this.$axios.get(`/api/media/getStreamInfoByAppAndStream`,{ this.$axios({
method: 'get',
url:`/api/media/stream_info_by_app_and_stream`,
params: { params: {
app: row.app, app: row.app,
stream: row.stream stream: row.stream
} }
}) }).then(function (res) {
.then(function (res) {
that.getListLoading = false; that.getListLoading = false;
that.$refs.devicePlayer.openDialog("streamPlay", null, null, { that.$refs.devicePlayer.openDialog("streamPlay", null, null, {
streamInfo: res.data, streamInfo: res.data,
hasAudio: true hasAudio: true
}); });
}) }).catch(function (error) {
.catch(function (error) {
console.log(error); console.log(error);
that.getListLoading = false; that.getListLoading = false;
}); });
@ -182,17 +183,17 @@
console.log(1111) console.log(1111)
let that = this; let that = this;
this.getListLoading = true; this.getListLoading = true;
this.$axios.get(`/api/proxy/del`,{ that.$axios({
method:"delete",
url:"/api/proxy/del",
params:{ params:{
app: row.app, app: row.app,
stream: row.stream stream: row.stream
} }
}) }).then((res)=>{
.then(function (res) {
that.getListLoading = false; that.getListLoading = false;
that.initData() that.initData()
}) }).catch(function (error) {
.catch(function (error) {
console.log(error); console.log(error);
that.getListLoading = false; that.getListLoading = false;
}); });
@ -200,35 +201,38 @@
start: function(row){ start: function(row){
let that = this; let that = this;
this.getListLoading = true; this.getListLoading = true;
this.$axios.get(`/api/proxy/start`,{ this.startBtnLaoding = true;
this.$axios({
method: 'get',
url:`/api/proxy/start`,
params: { params: {
app: row.app, app: row.app,
stream: row.stream stream: row.stream
} }
}) }).then(function (res) {
.then(function (res) {
that.getListLoading = false; that.getListLoading = false;
that.startBtnLaoding = false;
that.initData() that.initData()
}) }).catch(function (error) {
.catch(function (error) {
console.log(error); console.log(error);
that.getListLoading = false; that.getListLoading = false;
that.startBtnLaoding = false;
}); });
}, },
stop: function(row){ stop: function(row){
let that = this; let that = this;
this.getListLoading = true; this.getListLoading = true;
this.$axios.get(`/api/proxy/stop`,{ this.$axios({
method: 'get',
url:`/api/proxy/stop`,
params: { params: {
app: row.app, app: row.app,
stream: row.stream stream: row.stream
} }
}) }).then(function (res) {
.then(function (res) {
that.getListLoading = false; that.getListLoading = false;
that.initData() that.initData()
}) }).catch(function (error) {
.catch(function (error) {
console.log(error); console.log(error);
that.getListLoading = false; that.getListLoading = false;
}); });

24
web_src/src/components/channelList.vue

@ -153,8 +153,9 @@ export default {
}, },
getDeviceChannelList: function () { getDeviceChannelList: function () {
let that = this; let that = this;
this.$axios({
this.$axios.get(`/api/device/query/devices/${this.$route.params.deviceId}/channels`, { method: 'get',
url: `/api/device/query/devices/${this.$route.params.deviceId}/channels`,
params:{ params:{
page: that.currentPage, page: that.currentPage,
count: that.count, count: that.count,
@ -162,8 +163,7 @@ export default {
online: that.online, online: that.online,
channelType: that.channelType channelType: that.channelType
} }
}) }).then(function (res) {
.then(function (res) {
console.log(res); console.log(res);
that.total = res.data.total; that.total = res.data.total;
that.deviceChannelList = res.data.list; that.deviceChannelList = res.data.list;
@ -171,11 +171,11 @@ export default {
that.$nextTick(() => { that.$nextTick(() => {
that.$refs.channelListTable.doLayout(); that.$refs.channelListTable.doLayout();
}) })
}) }).catch(function (error) {
.catch(function (error) {
console.log(error); console.log(error);
}); });
}, },
// //
@ -215,7 +215,7 @@ export default {
console.log(itemData) console.log(itemData)
var that = this; var that = this;
this.$axios({ this.$axios({
method: 'post', method: 'get',
url: '/api/play/stop/' + itemData.streamId url: '/api/play/stop/' + itemData.streamId
}).then(function (res) { }).then(function (res) {
console.log(JSON.stringify(res)); console.log(JSON.stringify(res));
@ -251,7 +251,9 @@ export default {
showSubchannels: function (channelId) { showSubchannels: function (channelId) {
let that = this; let that = this;
this.$axios.get(`/api/device/query/sub_channels/${this.deviceId}/${this.parentChannelId}/channels`, { this.$axios({
method: 'get',
url:`/api/device/query/sub_channels/${this.deviceId}/${this.parentChannelId}/channels`,
params: { params: {
page: that.currentPage, page: that.currentPage,
count: that.count, count: that.count,
@ -259,16 +261,14 @@ export default {
online: that.online, online: that.online,
channelType: that.channelType channelType: that.channelType
} }
}) }).then(function (res) {
.then(function (res) {
that.total = res.data.total; that.total = res.data.total;
that.deviceChannelList = res.data.list; that.deviceChannelList = res.data.list;
// //
that.$nextTick(() => { that.$nextTick(() => {
that.$refs.channelListTable.doLayout(); that.$refs.channelListTable.doLayout();
}) })
}) }).catch(function (error) {
.catch(function (error) {
console.log(error); console.log(error);
}); });
}, },

33
web_src/src/components/devicePosition.vue

@ -171,13 +171,14 @@ export default {
this.endTime = null; this.endTime = null;
} }
let self = this; let self = this;
this.$axios.get(`/api/position/history/${this.deviceId}`, { this.$axios({
method: 'get',
url:`/api/position/history/${this.deviceId}`,
params: { params: {
start: self.startTime, start: self.startTime,
end: self.endTime, end: self.endTime,
}, },
}) }).then(function (res) {
.then(function (res) {
self.total = res.data.length; self.total = res.data.length;
self.mobilePositionList = res.data; self.mobilePositionList = res.data;
console.log(self.mobilePositionList); console.log(self.mobilePositionList);
@ -192,8 +193,7 @@ export default {
self.showMarkPoints(self); self.showMarkPoints(self);
}); });
} }
}) }).catch(function (error) {
.catch(function (error) {
console.log(error); console.log(error);
}); });
}, },
@ -202,8 +202,10 @@ export default {
this.mapPointList = []; this.mapPointList = [];
this.mobilePositionList = []; this.mobilePositionList = [];
let self = this; let self = this;
this.$axios.get(`/api/position/latest/${this.deviceId}`) this.$axios({
.then(function (res) { method: 'get',
url:`/api/position/latest/${this.deviceId}`
}).then(function (res) {
console.log(res.data); console.log(res.data);
self.total = res.data.length; self.total = res.data.length;
self.mobilePositionList.push(res.data); self.mobilePositionList.push(res.data);
@ -219,20 +221,20 @@ export default {
self.showMarkPoints(self); self.showMarkPoints(self);
}); });
} }
}) }).catch(function (error) {
.catch(function (error) {
console.log(error); console.log(error);
}); });
}, },
subscribeMobilePosition: function() { subscribeMobilePosition: function() {
let self = this; let self = this;
this.$axios.get(`/api/position/subscribe/${this.deviceId}`, { this.$axios({
method: 'get',
url:`/api/position/subscribe/${this.deviceId}`,
params: { params: {
expires: self.expired, expires: self.expired,
interval: self.interval, interval: self.interval,
}, },
}) }).then(function (res) {
.then(function (res) {
console.log(res.data); console.log(res.data);
}) })
.catch(function (error) { .catch(function (error) {
@ -241,7 +243,9 @@ export default {
}, },
unSubscribeMobilePosition: function() { unSubscribeMobilePosition: function() {
let self = this; let self = this;
this.$axios.get(`/api/position/subscribe/${this.deviceId}`, { this.$axios({
method: 'get',
url:`/api/position/subscribe/${this.deviceId}`,
params: { params: {
expires: 0, expires: 0,
interval: self.interval, interval: self.interval,
@ -249,8 +253,7 @@ export default {
}) })
.then(function (res) { .then(function (res) {
console.log(res.data); console.log(res.data);
}) }).catch(function (error) {
.catch(function (error) {
console.log(error); console.log(error);
}); });
}, },

21
web_src/src/components/dialog/StreamProxyEdit.vue

@ -146,9 +146,11 @@ export default {
onSubmit: function () { onSubmit: function () {
console.log("onSubmit"); console.log("onSubmit");
var that = this; var that = this;
that.$axios that.$axios({
.post(`/api/proxy/save`, that.proxyParam) method: 'post',
.then(function (res) { url:`/api/proxy/save`,
data: that.proxyParam
}).then(function (res) {
console.log(res); console.log(res);
console.log(res.data == "success"); console.log(res.data == "success");
if (res.data == "success") { if (res.data == "success") {
@ -162,8 +164,7 @@ export default {
that.listChangeCallback(); that.listChangeCallback();
} }
} }
}) }).catch(function (error) {
.catch(function (error) {
console.log(error); console.log(error);
}); });
}, },
@ -175,12 +176,12 @@ export default {
deviceGBIdExit: async function (deviceGbId) { deviceGBIdExit: async function (deviceGbId) {
var result = false; var result = false;
var that = this; var that = this;
await that.$axios await that.$axios({
.post(`/api/platform/exit/${deviceGbId}`) method: 'post',
.then(function (res) { url:`/api/platform/exit/${deviceGbId}`
}).then(function (res) {
result = res.data; result = res.data;
}) }).catch(function (error) {
.catch(function (error) {
console.log(error); console.log(error);
}); });
return result; return result;

23
web_src/src/components/dialog/addStreamTOGB.vue

@ -89,11 +89,11 @@ export default {
onSubmit: function () { onSubmit: function () {
console.log("onSubmit"); console.log("onSubmit");
var that = this; var that = this;
that.$axios that.$axios({
.post(`/api/push/save_to_gb`, that.proxyParam) method:"post",
.then(function (res) { url:`/api/push/save_to_gb`,
console.log(res); data: that.proxyParam
console.log(res.data == "success"); }).then(function (res) {
if (res.data == "success") { if (res.data == "success") {
that.$message({ that.$message({
showClose: true, showClose: true,
@ -105,8 +105,7 @@ export default {
that.listChangeCallback(); that.listChangeCallback();
} }
} }
}) }).catch(function (error) {
.catch(function (error) {
console.log(error); console.log(error);
}); });
}, },
@ -118,12 +117,12 @@ export default {
deviceGBIdExit: async function (deviceGbId) { deviceGBIdExit: async function (deviceGbId) {
var result = false; var result = false;
var that = this; var that = this;
await that.$axios await that.$axios({
.post(`/api/platform/exit/${deviceGbId}`) method:"post",
.then(function (res) { url:`/api/platform/exit/${deviceGbId}`
}).then(function (res) {
result = res.data; result = res.data;
}) }).catch(function (error) {
.catch(function (error) {
console.log(error); console.log(error);
}); });
return result; return result;

4
web_src/src/components/dialog/chooseChannelForGb.vue

@ -182,7 +182,9 @@ export default {
getChannelList: function () { getChannelList: function () {
let that = this; let that = this;
this.$axios.get(`/api/platform/channel_list`, { this.$axios({
method:"get",
url:`/api/platform/channel_list`,
params: { params: {
page: that.currentPage, page: that.currentPage,
count: that.count, count: that.count,

4
web_src/src/components/dialog/chooseChannelForStream.vue

@ -162,7 +162,9 @@ export default {
getChannelList: function () { getChannelList: function () {
let that = this; let that = this;
this.$axios.get(`/api/gbStream/list`, { this.$axios({
method: 'get',
url:`/api/gbStream/list`,
params: { params: {
page: that.currentPage, page: that.currentPage,
count: that.count, count: that.count,

28
web_src/src/components/dialog/platformEdit.vue

@ -163,17 +163,17 @@ export default {
methods: { methods: {
openDialog: function (platform, callback) { openDialog: function (platform, callback) {
var that = this; var that = this;
this.$axios this.$axios({
.get(`/api/platform/server_config`) method: 'get',
.then(function (res) { url:`/api/platform/server_config`
}).then(function (res) {
console.log(res); console.log(res);
that.platform.deviceGBId = res.data.username; that.platform.deviceGBId = res.data.username;
that.platform.deviceIp = res.data.deviceIp; that.platform.deviceIp = res.data.deviceIp;
that.platform.devicePort = res.data.devicePort; that.platform.devicePort = res.data.devicePort;
that.platform.username = res.data.username; that.platform.username = res.data.username;
that.platform.password = res.data.password; that.platform.password = res.data.password;
}) }).catch(function (error) {
.catch(function (error) {
console.log(error); console.log(error);
}); });
this.showDialog = true; this.showDialog = true;
@ -188,11 +188,11 @@ export default {
onSubmit: function () { onSubmit: function () {
console.log("onSubmit"); console.log("onSubmit");
var that = this; var that = this;
that.$axios that.$axios({
.post(`/api/platform/save`, that.platform) method: 'post',
.then(function (res) { url:`/api/platform/save`,
console.log(res); data: that.platform
console.log(res.data == "success"); }).then(function (res) {
if (res.data == "success") { if (res.data == "success") {
that.$message({ that.$message({
showClose: true, showClose: true,
@ -204,8 +204,7 @@ export default {
that.listChangeCallback(); that.listChangeCallback();
} }
} }
}) }).catch(function (error) {
.catch(function (error) {
console.log(error); console.log(error);
}); });
}, },
@ -218,8 +217,9 @@ export default {
deviceGBIdExit: async function (deviceGbId) { deviceGBIdExit: async function (deviceGbId) {
var result = false; var result = false;
var that = this; var that = this;
await that.$axios await that.$axios({
.post(`/api/platform/exit/${deviceGbId}`) method: 'post',
url:`/api/platform/exit/${deviceGbId}`})
.then(function (res) { .then(function (res) {
result = res.data; result = res.data;
}) })

8
web_src/src/components/dialog/rtcPlayer.vue

@ -11,7 +11,8 @@ export default {
name: 'rtcPlayer', name: 'rtcPlayer',
data() { data() {
return { return {
webrtcPlayer: null webrtcPlayer: null,
timer: null
}; };
}, },
props: ['videoUrl', 'error', 'hasaudio'], props: ['videoUrl', 'error', 'hasaudio'],
@ -55,7 +56,7 @@ export default {
this.eventcallbacK("OFFER ANSWER ERROR ", "offer anwser 交换失败") this.eventcallbacK("OFFER ANSWER ERROR ", "offer anwser 交换失败")
if (e.code ==-400 && e.msg=="流不存在"){ if (e.code ==-400 && e.msg=="流不存在"){
console.log("111111") console.log("111111")
setTimeout(()=>{ this.timer = setTimeout(()=>{
this.webrtcPlayer.close(); this.webrtcPlayer.close();
this.play(url) this.play(url)
}, 100) }, 100)
@ -83,6 +84,9 @@ export default {
console.log(message) console.log(message)
} }
}, },
destroyed() {
clearTimeout(this.timer);
},
} }
</script> </script>

Loading…
Cancel
Save