Commit 4010ed6c23d081a2937d0fe1719414ba127b17a2

Authored by panlinlin
1 parent 27df8bd8

统一axios写法

Showing 28 changed files with 243 additions and 218 deletions
... ... @@ -109,6 +109,12 @@
109 109 <artifactId>springfox-boot-starter</artifactId>
110 110 <version>3.0.0</version>
111 111 </dependency>
  112 + <dependency>
  113 + <groupId>com.github.xiaoymin</groupId>
  114 + <artifactId>knife4j-spring-boot-starter</artifactId>
  115 + <version>3.0.2</version>
  116 + </dependency>
  117 +
112 118  
113 119 <!--参数校验 -->
114 120 <dependency>
... ... @@ -165,7 +171,7 @@
165 171 </dependencies>
166 172  
167 173 <build>
168   - <finalName>wvp-2.5.8</finalName>
  174 + <finalName>wvp-2.0</finalName>
169 175 <plugins>
170 176 <plugin>
171 177 <groupId>org.springframework.boot</groupId>
... ...
src/main/java/com/genersoft/iot/vmp/conf/Swagger3Config.java
... ... @@ -92,8 +92,8 @@ public class Swagger3Config {
92 92 return new ApiInfoBuilder()
93 93 .title("WVP-PRO 接口文档")
94 94 .description("更多请咨询服务开发者(18010473990@@163.com)。")
95   - .contact(new Contact("Ray。", "http://www.ruiyeclub.cn", "ruiyeclub@foxmail.com"))
96   - .version("1.0")
  95 + .contact(new Contact("panlinlin", "http://www.ruiyeclub.cn", "ruiyeclub@foxmail.com"))
  96 + .version("2.0")
97 97 .build();
98 98 }
99 99 }
... ...
src/main/java/com/genersoft/iot/vmp/service/impl/PlayServiceImpl.java
... ... @@ -84,7 +84,7 @@ public class PlayServiceImpl implements IPlayService {
84 84 } else {
85 85 String streamId = streamInfo.getStreamId();
86 86 JSONObject rtpInfo = zlmresTfulUtils.getRtpInfo(streamId);
87   - if (rtpInfo.getBoolean("exist")) {
  87 + if (rtpInfo != null && rtpInfo.getBoolean("exist")) {
88 88 RequestMessage msg = new RequestMessage();
89 89 msg.setId(DeferredResultHolder.CALLBACK_CMD_PlAY + uuid);
90 90 msg.setData(JSON.toJSONString(streamInfo));
... ...
src/main/java/com/genersoft/iot/vmp/service/impl/StreamProxyServiceImpl.java
... ... @@ -118,12 +118,11 @@ public class StreamProxyServiceImpl implements IStreamProxyService {
118 118 public boolean stop(String app, String stream) {
119 119 boolean result = false;
120 120 StreamProxyItem streamProxyDto = videoManagerStorager.queryStreamProxy(app, stream);
121   - if (streamProxyDto.isEnable() && streamProxyDto != null) {
  121 + if (streamProxyDto != null && streamProxyDto.isEnable()) {
122 122 JSONObject jsonObject = removeStreamProxyFromZlm(streamProxyDto);
123 123 if (jsonObject.getInteger("code") == 0) {
124   - result = true;
125 124 streamProxyDto.setEnable(false);
126   - videoManagerStorager.updateStreamProxy(streamProxyDto);
  125 + result = videoManagerStorager.updateStreamProxy(streamProxyDto);
127 126 }
128 127 }
129 128 return result;
... ...
src/main/java/com/genersoft/iot/vmp/storager/dao/GbStreamMapper.java
... ... @@ -24,7 +24,7 @@ public interface GbStreamMapper {
24 24 "name=#{name}," +
25 25 "streamType=#{streamType}," +
26 26 "longitude=#{longitude}, " +
27   - "latitude=#{latitude} " +
  27 + "latitude=#{latitude}," +
28 28 "status=${status} " +
29 29 "WHERE app=#{app} AND stream=#{stream} AND gbId=#{gbId}")
30 30 int update(GbStream gbStream);
... ...
src/main/java/com/genersoft/iot/vmp/storager/impl/VideoManagerStoragerImpl.java
... ... @@ -440,6 +440,7 @@ public class VideoManagerStoragerImpl implements IVideoManagerStorager {
440 440 dataSourceTransactionManager.commit(transactionStatus); //手动提交
441 441 result = true;
442 442 }catch (Exception e) {
  443 + e.printStackTrace();
443 444 dataSourceTransactionManager.rollback(transactionStatus);
444 445 }
445 446 return result;
... ...
src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/SseController/SseController.java
... ... @@ -8,6 +8,7 @@ import io.swagger.annotations.ApiOperation;
8 8 import org.springframework.beans.factory.annotation.Autowired;
9 9 import org.springframework.stereotype.Controller;
10 10 import org.springframework.web.bind.annotation.CrossOrigin;
  11 +import org.springframework.web.bind.annotation.PostMapping;
11 12 import org.springframework.web.bind.annotation.RequestMapping;
12 13 import org.springframework.web.bind.annotation.RequestParam;
13 14 import org.springframework.web.servlet.mvc.method.annotation.SseEmitter;
... ... @@ -25,11 +26,11 @@ public class SseController {
25 26 @Autowired
26 27 AlarmEventListener alarmEventListener;
27 28  
28   - @ApiOperation("设置响应")
  29 + @ApiOperation("浏览器推送")
29 30 @ApiImplicitParams({
30 31 @ApiImplicitParam(name = "browserId", value = "浏览器ID", dataTypeClass = String.class),
31 32 })
32   - @RequestMapping("/emit")
  33 + @PostMapping("/emit")
33 34 public SseEmitter emit(@RequestParam String browserId) {
34 35 final SseEmitter sseEmitter = new SseEmitter(0L);
35 36 try {
... ...
src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/media/MediaController.java
... ... @@ -44,7 +44,7 @@ public class MediaController {
44 44 @ApiImplicitParam(name = "app", value = "应用名", dataTypeClass = String.class),
45 45 @ApiImplicitParam(name = "stream", value = "流id", dataTypeClass = String.class),
46 46 })
47   - @RequestMapping(value = "/getStreamInfoByAppAndStream")
  47 + @GetMapping(value = "/stream_info_by_app_and_stream")
48 48 @ResponseBody
49 49 public StreamInfo getStreamInfoByAppAndStream(String app, String stream){
50 50 return mediaService.getStreamInfoByAppAndStreamWithCheck(app, stream);
... ...
src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/platformGbStream/PlatformGbStreamController.java
... ... @@ -32,7 +32,7 @@ public class PlatformGbStreamController {
32 32 @ApiImplicitParam(name = "page", value = "当前页", dataTypeClass = Integer.class),
33 33 @ApiImplicitParam(name = "count", value = "每页条数", dataTypeClass = Integer.class),
34 34 })
35   - @RequestMapping(value = "/list")
  35 + @GetMapping(value = "/list")
36 36 @ResponseBody
37 37 public PageInfo<GbStream> list(@RequestParam(required = false)Integer page,
38 38 @RequestParam(required = false)Integer count){
... ...
src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/play/PlayController.java
... ... @@ -93,7 +93,7 @@ public class PlayController {
93 93 @ApiImplicitParams({
94 94 @ApiImplicitParam(name = "streamId", value = "视频流ID", dataTypeClass = String.class),
95 95 })
96   - @PostMapping("/stop/{streamId}")
  96 + @GetMapping("/stop/{streamId}")
97 97 public DeferredResult<ResponseEntity<String>> playStop(@PathVariable String streamId) {
98 98  
99 99 logger.debug(String.format("设备预览/回放停止API调用,streamId:%s", streamId));
... ...
src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/playback/PlaybackController.java
... ... @@ -105,7 +105,7 @@ public class PlaybackController {
105 105 @ApiImplicitParams({
106 106 @ApiImplicitParam(name = "ssrc", value = "视频流标识", dataTypeClass = String.class),
107 107 })
108   - @RequestMapping("/stop/{ssrc}")
  108 + @GetMapping("/stop/{ssrc}")
109 109 public ResponseEntity<String> playStop(@PathVariable String ssrc) {
110 110  
111 111 cmder.streamByeCmd(ssrc);
... ...
src/main/java/com/genersoft/iot/vmp/vmanager/server/ServerController.java
... ... @@ -25,7 +25,7 @@ public class ServerController {
25 25  
26 26  
27 27 @ApiOperation("重启服务")
28   - @RequestMapping(value = "/restart")
  28 + @GetMapping(value = "/restart")
29 29 @ResponseBody
30 30 public Object restart(){
31 31 Thread restartThread = new Thread(new Runnable() {
... ...
src/main/java/com/genersoft/iot/vmp/vmanager/streamProxy/StreamProxyController.java
... ... @@ -41,7 +41,7 @@ public class StreamProxyController {
41 41 @ApiImplicitParam(name="query", value = "查询内容", dataTypeClass = String.class),
42 42 @ApiImplicitParam(name="online", value = "是否在线", dataTypeClass = Boolean.class),
43 43 })
44   - @RequestMapping(value = "/list")
  44 + @GetMapping(value = "/list")
45 45 @ResponseBody
46 46 public PageInfo<StreamProxyItem> list(@RequestParam(required = false)Integer page,
47 47 @RequestParam(required = false)Integer count,
... ... @@ -55,7 +55,7 @@ public class StreamProxyController {
55 55 @ApiImplicitParams({
56 56 @ApiImplicitParam(name = "param", value = "代理参数", dataTypeClass = StreamProxyItem.class),
57 57 })
58   - @RequestMapping(value = "/save")
  58 + @PostMapping(value = "/save")
59 59 @ResponseBody
60 60 public Object save(@RequestBody StreamProxyItem param){
61 61 logger.info("添加代理: " + JSONObject.toJSONString(param));
... ... @@ -68,7 +68,7 @@ public class StreamProxyController {
68 68 @ApiImplicitParam(name = "app", value = "应用名", dataTypeClass = String.class),
69 69 @ApiImplicitParam(name = "stream", value = "流ID", dataTypeClass = String.class),
70 70 })
71   - @RequestMapping(value = "/del")
  71 + @DeleteMapping(value = "/del")
72 72 @ResponseBody
73 73 public Object del(String app, String stream){
74 74 logger.info("移除代理: " + app + "/" + stream);
... ... @@ -81,7 +81,7 @@ public class StreamProxyController {
81 81 @ApiImplicitParam(name = "app", value = "应用名", dataTypeClass = String.class),
82 82 @ApiImplicitParam(name = "stream", value = "流ID", dataTypeClass = String.class),
83 83 })
84   - @RequestMapping(value = "/start")
  84 + @GetMapping(value = "/start")
85 85 @ResponseBody
86 86 public Object start(String app, String stream){
87 87 logger.info("启用代理: " + app + "/" + stream);
... ... @@ -94,11 +94,11 @@ public class StreamProxyController {
94 94 @ApiImplicitParam(name = "app", value = "应用名", dataTypeClass = String.class),
95 95 @ApiImplicitParam(name = "stream", value = "流ID", dataTypeClass = String.class),
96 96 })
97   - @RequestMapping(value = "/stop")
  97 + @GetMapping(value = "/stop")
98 98 @ResponseBody
99 99 public Object stop(String app, String stream){
100 100 logger.info("停用代理: " + app + "/" + stream);
101 101 boolean result = streamProxyService.stop(app, stream);
102   - return "success";
  102 + return result?"success":"fail";
103 103 }
104 104 }
... ...
src/main/java/com/genersoft/iot/vmp/vmanager/streamPush/StreamPushController.java
... ... @@ -32,7 +32,7 @@ public class StreamPushController {
32 32 @ApiImplicitParam(name="query", value = "查询内容", dataTypeClass = String.class),
33 33 @ApiImplicitParam(name="online", value = "是否在线", dataTypeClass = Boolean.class),
34 34 })
35   - @RequestMapping(value = "/list")
  35 + @GetMapping(value = "/list")
36 36 @ResponseBody
37 37 public PageInfo<StreamPushItem> list(@RequestParam(required = false)Integer page,
38 38 @RequestParam(required = false)Integer count,
... ... @@ -47,7 +47,7 @@ public class StreamPushController {
47 47 @ApiImplicitParams({
48 48 @ApiImplicitParam(name = "stream", value = "直播流关联国标平台", dataTypeClass = GbStream.class),
49 49 })
50   - @RequestMapping(value = "/save_to_gb")
  50 + @PostMapping(value = "/save_to_gb")
51 51 @ResponseBody
52 52 public Object saveToGB(@RequestBody GbStream stream){
53 53 if (streamPushService.saveToGB(stream)){
... ... @@ -62,7 +62,7 @@ public class StreamPushController {
62 62 @ApiImplicitParams({
63 63 @ApiImplicitParam(name = "stream", value = "直播流关联国标平台", dataTypeClass = GbStream.class),
64 64 })
65   - @RequestMapping(value = "/remove_form_gb")
  65 + @DeleteMapping(value = "/remove_form_gb")
66 66 @ResponseBody
67 67 public Object removeFormGB(@RequestBody GbStream stream){
68 68 if (streamPushService.removeFromGB(stream)){
... ...
src/main/java/com/genersoft/iot/vmp/vmanager/user/UserController.java
... ... @@ -8,6 +8,7 @@ import io.swagger.annotations.ApiOperation;
8 8 import org.springframework.beans.factory.annotation.Value;
9 9 import org.springframework.util.StringUtils;
10 10 import org.springframework.web.bind.annotation.CrossOrigin;
  11 +import org.springframework.web.bind.annotation.GetMapping;
11 12 import org.springframework.web.bind.annotation.RequestMapping;
12 13 import org.springframework.web.bind.annotation.RestController;
13 14  
... ... @@ -28,7 +29,7 @@ public class UserController {
28 29 @ApiImplicitParam(name = "username", value = "用户名", dataTypeClass = String.class),
29 30 @ApiImplicitParam(name = "password", value = "密码(32未md5加密)", dataTypeClass = String.class),
30 31 })
31   - @RequestMapping("/login")
  32 + @GetMapping("/login")
32 33 public String login(String username, String password){
33 34 if (!StringUtils.isEmpty(username) && username.equals(usernameConfig)
34 35 && !StringUtils.isEmpty(password) && password.equals(passwordConfig)) {
... ...
web_src/src/components/DeviceList.vue
... ... @@ -136,20 +136,20 @@
136 136 getDeviceList: function() {
137 137 let that = this;
138 138 this.getDeviceListLoading = true;
139   - this.$axios.get(`/api/device/query/devices`,{
  139 + this.$axios({
  140 + method: 'get',
  141 + url:`/api/device/query/devices`,
140 142 params: {
141 143 page: that.currentPage,
142 144 count: that.count
143 145 }
144   - } )
145   - .then(function (res) {
  146 + }).then(function (res) {
146 147 console.log(res);
147 148 console.log(res.data.list);
148 149 that.total = res.data.total;
149 150 that.deviceList = res.data.list;
150 151 that.getDeviceListLoading = false;
151   - })
152   - .catch(function (error) {
  152 + }).catch(function (error) {
153 153 console.log(error);
154 154 that.getDeviceListLoading = false;
155 155 });
... ...
web_src/src/components/Login.vue
... ... @@ -61,10 +61,11 @@ export default {
61 61 //设置在登录状态
62 62 this.isLoging = true;
63 63  
64   - this.$axios.get("/api/user/login",{
65   - params: loginParam
66   - } )
67   - .then(function (res) {
  64 + this.$axios({
  65 + method: 'get',
  66 + url:"/api/user/login",
  67 + params: loginParam
  68 + }).then(function (res) {
68 69 console.log(JSON.stringify(res));
69 70 if (res.data == "success") {
70 71 that.$cookies.set("session", {"username": that.username}) ;
... ... @@ -79,8 +80,7 @@ export default {
79 80 type: 'error'
80 81 });
81 82 }
82   - })
83   - .catch(function (error) {
  83 + }).catch(function (error) {
84 84 that.$message.error(error.response.statusText);
85 85 that.isLoging = false;
86 86 });
... ...
web_src/src/components/ParentPlatformList.vue
... ... @@ -121,20 +121,21 @@ export default {
121 121 },
122 122 deletePlatformCommit: function(platform) {
123 123 var that = this;
124   - that.$axios.delete(`/api/platform/delete/${platform.serverGBId}`)
125   - .then(function (res) {
126   - if (res.data == "success") {
127   - that.$message({
128   - showClose: true,
129   - message: '删除成功',
130   - type: 'success'
131   - });
132   - that.initData()
133   - }
134   - })
135   - .catch(function (error) {
136   - console.log(error);
137   - });
  124 + that.$axios({
  125 + method: 'delete',
  126 + url:`/api/platform/delete/${platform.serverGBId}`
  127 + }).then(function (res) {
  128 + if (res.data == "success") {
  129 + that.$message({
  130 + showClose: true,
  131 + message: '删除成功',
  132 + type: 'success'
  133 + });
  134 + that.initData()
  135 + }
  136 + }).catch(function (error) {
  137 + console.log(error);
  138 + });
138 139 },
139 140 chooseChannel: function(platform) {
140 141 this.$refs.chooseChannelDialog.openDialog(platform.serverGBId, ()=>{
... ... @@ -155,14 +156,15 @@ export default {
155 156 getPlatformList: function() {
156 157 let that = this;
157 158  
158   - this.$axios.get(`/api/platform/query/${that.count}/${that.currentPage}`)
159   - .then(function (res) {
160   - that.total = res.data.total;
161   - that.platformList = res.data.list;
162   - })
163   - .catch(function (error) {
164   - console.log(error);
165   - });
  159 + this.$axios({
  160 + method: 'get',
  161 + url:`/api/platform/query/${that.count}/${that.currentPage}`
  162 + }).then(function (res) {
  163 + that.total = res.data.total;
  164 + that.platformList = res.data.list;
  165 + }).catch(function (error) {
  166 + console.log(error);
  167 + });
166 168  
167 169 }
168 170  
... ...
web_src/src/components/PushVideoList.vue
... ... @@ -107,20 +107,20 @@
107 107 getPushList: function() {
108 108 let that = this;
109 109 this.getDeviceListLoading = true;
110   - this.$axios.get(`/api/push/list`,{
  110 + this.$axios({
  111 + method: 'get',
  112 + url:`/api/push/list`,
111 113 params: {
112 114 page: that.currentPage,
113 115 count: that.count
114 116 }
115   - } )
116   - .then(function (res) {
  117 + }).then(function (res) {
117 118 console.log(res);
118 119 console.log(res.data.list);
119 120 that.total = res.data.total;
120 121 that.pushList = res.data.list;
121 122 that.getDeviceListLoading = false;
122   - })
123   - .catch(function (error) {
  123 + }).catch(function (error) {
124 124 console.log(error);
125 125 that.getDeviceListLoading = false;
126 126 });
... ... @@ -129,20 +129,20 @@
129 129 playPuhsh: function(row){
130 130 let that = this;
131 131 this.getListLoading = true;
132   - this.$axios.get(`/api/media/getStreamInfoByAppAndStream`,{
  132 + this.$axios({
  133 + method: 'get',
  134 + url:`/api/media/stream_info_by_app_and_stream`,
133 135 params: {
134 136 app: row.app,
135 137 stream: row.stream
136 138 }
137   - })
138   - .then(function (res) {
  139 + }).then(function (res) {
139 140 that.getListLoading = false;
140 141 that.$refs.devicePlayer.openDialog("streamPlay", null, null, {
141 142 streamInfo: res.data,
142 143 hasAudio: true
143 144 });
144   - })
145   - .catch(function (error) {
  145 + }).catch(function (error) {
146 146 console.log(error);
147 147 that.getListLoading = false;
148 148 });
... ... @@ -155,17 +155,17 @@
155 155 },
156 156 removeFromGB: function(row){
157 157 var that = this;
158   - that.$axios.post(`/api/push/remove_form_gb`, row)
159   - .then(function (res) {
160   - console.log(res);
161   - console.log(res.data == "success");
162   - if (res.data == "success") {
  158 + that.$axios({
  159 + method:"delete",
  160 + url:"/api/push/remove_form_gb",
  161 + data:row
  162 + }).then((res)=>{
  163 + if (res.data == "success") {
163 164 that.initData()
164 165 }
165   - })
166   - .catch(function (error) {
167   - console.log(error);
168   - });
  166 + }).catch(function (error) {
  167 + console.log(error);
  168 + });
169 169 },
170 170 dateFormat: function(/** timestamp=0 **/) {
171 171 var ts = arguments[0] || 0;
... ...
web_src/src/components/StreamProxyList.vue
... ... @@ -62,7 +62,7 @@
62 62 <el-button-group>
63 63 <el-button size="mini" icon="el-icon-video-play" v-if="scope.row.enable" @click="play(scope.row)">播放</el-button>
64 64 <el-button size="mini" icon="el-icon-close" type="success" v-if="scope.row.enable" @click="stop(scope.row)">停用</el-button>
65   - <el-button size="mini" icon="el-icon-check" type="primary" v-if="!scope.row.enable" @click="start(scope.row)">启用</el-button>
  65 + <el-button size="mini" icon="el-icon-check" type="primary" :loading="startBtnLaoding" v-if="!scope.row.enable" @click="start(scope.row)">启用</el-button>
66 66 <el-button size="mini" icon="el-icon-delete" type="danger" @click="deleteStreamProxy(scope.row)">删除</el-button>
67 67 </el-button-group>
68 68 </template>
... ... @@ -105,7 +105,8 @@
105 105 currentPage:1,
106 106 count:15,
107 107 total:0,
108   - getListLoading: false
  108 + getListLoading: false,
  109 + startBtnLaoding: false
109 110 };
110 111 },
111 112 computed: {
... ... @@ -133,20 +134,20 @@
133 134 getStreamProxyList: function() {
134 135 let that = this;
135 136 this.getListLoading = true;
136   - this.$axios.get(`/api/proxy/list`,{
  137 + this.$axios({
  138 + method: 'get',
  139 + url:`/api/proxy/list`,
137 140 params: {
138 141 page: that.currentPage,
139 142 count: that.count
140 143 }
141   - } )
142   - .then(function (res) {
  144 + }).then(function (res) {
143 145 console.log(res);
144 146 console.log(res.data.list);
145 147 that.total = res.data.total;
146 148 that.streamProxyList = res.data.list;
147 149 that.getListLoading = false;
148   - })
149   - .catch(function (error) {
  150 + }).catch(function (error) {
150 151 console.log(error);
151 152 that.getListLoading = false;
152 153 });
... ... @@ -159,20 +160,20 @@
159 160 play: function(row){
160 161 let that = this;
161 162 this.getListLoading = true;
162   - this.$axios.get(`/api/media/getStreamInfoByAppAndStream`,{
  163 + this.$axios({
  164 + method: 'get',
  165 + url:`/api/media/stream_info_by_app_and_stream`,
163 166 params: {
164 167 app: row.app,
165 168 stream: row.stream
166 169 }
167   - })
168   - .then(function (res) {
  170 + }).then(function (res) {
169 171 that.getListLoading = false;
170 172 that.$refs.devicePlayer.openDialog("streamPlay", null, null, {
171 173 streamInfo: res.data,
172 174 hasAudio: true
173 175 });
174   - })
175   - .catch(function (error) {
  176 + }).catch(function (error) {
176 177 console.log(error);
177 178 that.getListLoading = false;
178 179 });
... ... @@ -182,53 +183,56 @@
182 183 console.log(1111)
183 184 let that = this;
184 185 this.getListLoading = true;
185   - this.$axios.get(`/api/proxy/del`,{
186   - params: {
  186 + that.$axios({
  187 + method:"delete",
  188 + url:"/api/proxy/del",
  189 + params:{
187 190 app: row.app,
188 191 stream: row.stream
189 192 }
190   - })
191   - .then(function (res) {
192   - that.getListLoading = false;
  193 + }).then((res)=>{
  194 + that.getListLoading = false;
193 195 that.initData()
194   - })
195   - .catch(function (error) {
196   - console.log(error);
  196 + }).catch(function (error) {
  197 + console.log(error);
197 198 that.getListLoading = false;
198   - });
  199 + });
199 200 },
200 201 start: function(row){
201 202 let that = this;
202 203 this.getListLoading = true;
203   - this.$axios.get(`/api/proxy/start`,{
  204 + this.startBtnLaoding = true;
  205 + this.$axios({
  206 + method: 'get',
  207 + url:`/api/proxy/start`,
204 208 params: {
205 209 app: row.app,
206 210 stream: row.stream
207 211 }
208   - })
209   - .then(function (res) {
  212 + }).then(function (res) {
210 213 that.getListLoading = false;
  214 + that.startBtnLaoding = false;
211 215 that.initData()
212   - })
213   - .catch(function (error) {
  216 + }).catch(function (error) {
214 217 console.log(error);
215 218 that.getListLoading = false;
  219 + that.startBtnLaoding = false;
216 220 });
217 221 },
218 222 stop: function(row){
219 223 let that = this;
220 224 this.getListLoading = true;
221   - this.$axios.get(`/api/proxy/stop`,{
  225 + this.$axios({
  226 + method: 'get',
  227 + url:`/api/proxy/stop`,
222 228 params: {
223 229 app: row.app,
224 230 stream: row.stream
225 231 }
226   - })
227   - .then(function (res) {
  232 + }).then(function (res) {
228 233 that.getListLoading = false;
229 234 that.initData()
230   - })
231   - .catch(function (error) {
  235 + }).catch(function (error) {
232 236 console.log(error);
233 237 that.getListLoading = false;
234 238 });
... ...
web_src/src/components/channelList.vue
... ... @@ -153,17 +153,17 @@ export default {
153 153 },
154 154 getDeviceChannelList: function () {
155 155 let that = this;
156   -
157   - this.$axios.get(`/api/device/query/devices/${this.$route.params.deviceId}/channels`, {
158   - params: {
159   - page: that.currentPage,
  156 + this.$axios({
  157 + method: 'get',
  158 + url: `/api/device/query/devices/${this.$route.params.deviceId}/channels`,
  159 + params:{
  160 + page: that.currentPage,
160 161 count: that.count,
161 162 query: that.searchSrt,
162 163 online: that.online,
163 164 channelType: that.channelType
164   - }
165   - })
166   - .then(function (res) {
  165 + }
  166 + }).then(function (res) {
167 167 console.log(res);
168 168 that.total = res.data.total;
169 169 that.deviceChannelList = res.data.list;
... ... @@ -171,10 +171,10 @@ export default {
171 171 that.$nextTick(() => {
172 172 that.$refs.channelListTable.doLayout();
173 173 })
174   - })
175   - .catch(function (error) {
176   - console.log(error);
177   - });
  174 + }).catch(function (error) {
  175 + console.log(error);
  176 + });
  177 +
178 178  
179 179 },
180 180  
... ... @@ -215,7 +215,7 @@ export default {
215 215 console.log(itemData)
216 216 var that = this;
217 217 this.$axios({
218   - method: 'post',
  218 + method: 'get',
219 219 url: '/api/play/stop/' + itemData.streamId
220 220 }).then(function (res) {
221 221 console.log(JSON.stringify(res));
... ... @@ -251,26 +251,26 @@ export default {
251 251 showSubchannels: function (channelId) {
252 252 let that = this;
253 253  
254   - this.$axios.get(`/api/device/query/sub_channels/${this.deviceId}/${this.parentChannelId}/channels`, {
255   - params: {
256   - page: that.currentPage,
257   - count: that.count,
258   - query: that.searchSrt,
259   - online: that.online,
260   - channelType: that.channelType
261   - }
262   - })
263   - .then(function (res) {
264   - that.total = res.data.total;
265   - that.deviceChannelList = res.data.list;
266   - // 防止出现表格错位
267   - that.$nextTick(() => {
268   - that.$refs.channelListTable.doLayout();
269   - })
  254 + this.$axios({
  255 + method: 'get',
  256 + url:`/api/device/query/sub_channels/${this.deviceId}/${this.parentChannelId}/channels`,
  257 + params: {
  258 + page: that.currentPage,
  259 + count: that.count,
  260 + query: that.searchSrt,
  261 + online: that.online,
  262 + channelType: that.channelType
  263 + }
  264 + }).then(function (res) {
  265 + that.total = res.data.total;
  266 + that.deviceChannelList = res.data.list;
  267 + // 防止出现表格错位
  268 + that.$nextTick(() => {
  269 + that.$refs.channelListTable.doLayout();
270 270 })
271   - .catch(function (error) {
272   - console.log(error);
273   - });
  271 + }).catch(function (error) {
  272 + console.log(error);
  273 + });
274 274 },
275 275 search: function () {
276 276 console.log(this.searchSrt)
... ...
web_src/src/components/devicePosition.vue
... ... @@ -171,13 +171,14 @@ export default {
171 171 this.endTime = null;
172 172 }
173 173 let self = this;
174   - this.$axios.get(`/api/position/history/${this.deviceId}`, {
  174 + this.$axios({
  175 + method: 'get',
  176 + url:`/api/position/history/${this.deviceId}`,
175 177 params: {
176 178 start: self.startTime,
177 179 end: self.endTime,
178 180 },
179   - })
180   - .then(function (res) {
  181 + }).then(function (res) {
181 182 self.total = res.data.length;
182 183 self.mobilePositionList = res.data;
183 184 console.log(self.mobilePositionList);
... ... @@ -192,8 +193,7 @@ export default {
192 193 self.showMarkPoints(self);
193 194 });
194 195 }
195   - })
196   - .catch(function (error) {
  196 + }).catch(function (error) {
197 197 console.log(error);
198 198 });
199 199 },
... ... @@ -202,8 +202,10 @@ export default {
202 202 this.mapPointList = [];
203 203 this.mobilePositionList = [];
204 204 let self = this;
205   - this.$axios.get(`/api/position/latest/${this.deviceId}`)
206   - .then(function (res) {
  205 + this.$axios({
  206 + method: 'get',
  207 + url:`/api/position/latest/${this.deviceId}`
  208 + }).then(function (res) {
207 209 console.log(res.data);
208 210 self.total = res.data.length;
209 211 self.mobilePositionList.push(res.data);
... ... @@ -219,20 +221,20 @@ export default {
219 221 self.showMarkPoints(self);
220 222 });
221 223 }
222   - })
223   - .catch(function (error) {
  224 + }).catch(function (error) {
224 225 console.log(error);
225 226 });
226 227 },
227 228 subscribeMobilePosition: function() {
228 229 let self = this;
229   - this.$axios.get(`/api/position/subscribe/${this.deviceId}`, {
230   - params: {
231   - expires: self.expired,
232   - interval: self.interval,
233   - },
234   - })
235   - .then(function (res) {
  230 + this.$axios({
  231 + method: 'get',
  232 + url:`/api/position/subscribe/${this.deviceId}`,
  233 + params: {
  234 + expires: self.expired,
  235 + interval: self.interval,
  236 + },
  237 + }).then(function (res) {
236 238 console.log(res.data);
237 239 })
238 240 .catch(function (error) {
... ... @@ -241,16 +243,17 @@ export default {
241 243 },
242 244 unSubscribeMobilePosition: function() {
243 245 let self = this;
244   - this.$axios.get(`/api/position/subscribe/${this.deviceId}`, {
245   - params: {
246   - expires: 0,
247   - interval: self.interval,
248   - },
  246 + this.$axios({
  247 + method: 'get',
  248 + url:`/api/position/subscribe/${this.deviceId}`,
  249 + params: {
  250 + expires: 0,
  251 + interval: self.interval,
  252 + },
249 253 })
250 254 .then(function (res) {
251 255 console.log(res.data);
252   - })
253   - .catch(function (error) {
  256 + }).catch(function (error) {
254 257 console.log(error);
255 258 });
256 259 },
... ...
web_src/src/components/dialog/StreamProxyEdit.vue
... ... @@ -146,9 +146,11 @@ export default {
146 146 onSubmit: function () {
147 147 console.log("onSubmit");
148 148 var that = this;
149   - that.$axios
150   - .post(`/api/proxy/save`, that.proxyParam)
151   - .then(function (res) {
  149 + that.$axios({
  150 + method: 'post',
  151 + url:`/api/proxy/save`,
  152 + data: that.proxyParam
  153 + }).then(function (res) {
152 154 console.log(res);
153 155 console.log(res.data == "success");
154 156 if (res.data == "success") {
... ... @@ -162,8 +164,7 @@ export default {
162 164 that.listChangeCallback();
163 165 }
164 166 }
165   - })
166   - .catch(function (error) {
  167 + }).catch(function (error) {
167 168 console.log(error);
168 169 });
169 170 },
... ... @@ -175,14 +176,14 @@ export default {
175 176 deviceGBIdExit: async function (deviceGbId) {
176 177 var result = false;
177 178 var that = this;
178   - await that.$axios
179   - .post(`/api/platform/exit/${deviceGbId}`)
180   - .then(function (res) {
181   - result = res.data;
182   - })
183   - .catch(function (error) {
184   - console.log(error);
185   - });
  179 + await that.$axios({
  180 + method: 'post',
  181 + url:`/api/platform/exit/${deviceGbId}`
  182 + }).then(function (res) {
  183 + result = res.data;
  184 + }).catch(function (error) {
  185 + console.log(error);
  186 + });
186 187 return result;
187 188 },
188 189 checkExpires: function() {
... ...
web_src/src/components/dialog/addStreamTOGB.vue
... ... @@ -89,11 +89,11 @@ export default {
89 89 onSubmit: function () {
90 90 console.log("onSubmit");
91 91 var that = this;
92   - that.$axios
93   - .post(`/api/push/save_to_gb`, that.proxyParam)
94   - .then(function (res) {
95   - console.log(res);
96   - console.log(res.data == "success");
  92 + that.$axios({
  93 + method:"post",
  94 + url:`/api/push/save_to_gb`,
  95 + data: that.proxyParam
  96 + }).then(function (res) {
97 97 if (res.data == "success") {
98 98 that.$message({
99 99 showClose: true,
... ... @@ -105,10 +105,9 @@ export default {
105 105 that.listChangeCallback();
106 106 }
107 107 }
108   - })
109   - .catch(function (error) {
  108 + }).catch(function (error) {
110 109 console.log(error);
111   - });
  110 + });
112 111 },
113 112 close: function () {
114 113 console.log("关闭加入GB");
... ... @@ -118,14 +117,14 @@ export default {
118 117 deviceGBIdExit: async function (deviceGbId) {
119 118 var result = false;
120 119 var that = this;
121   - await that.$axios
122   - .post(`/api/platform/exit/${deviceGbId}`)
123   - .then(function (res) {
124   - result = res.data;
125   - })
126   - .catch(function (error) {
127   - console.log(error);
128   - });
  120 + await that.$axios({
  121 + method:"post",
  122 + url:`/api/platform/exit/${deviceGbId}`
  123 + }).then(function (res) {
  124 + result = res.data;
  125 + }).catch(function (error) {
  126 + console.log(error);
  127 + });
129 128 return result;
130 129 },
131 130 checkExpires: function() {
... ...
web_src/src/components/dialog/chooseChannelForGb.vue
... ... @@ -182,7 +182,9 @@ export default {
182 182 getChannelList: function () {
183 183 let that = this;
184 184  
185   - this.$axios.get(`/api/platform/channel_list`, {
  185 + this.$axios({
  186 + method:"get",
  187 + url:`/api/platform/channel_list`,
186 188 params: {
187 189 page: that.currentPage,
188 190 count: that.count,
... ...
web_src/src/components/dialog/chooseChannelForStream.vue
... ... @@ -162,16 +162,18 @@ export default {
162 162 getChannelList: function () {
163 163 let that = this;
164 164  
165   - this.$axios.get(`/api/gbStream/list`, {
166   - params: {
167   - page: that.currentPage,
168   - count: that.count,
169   - query: that.searchSrt,
170   - online: that.online,
171   - choosed: that.choosed,
172   - platformId: that.platformId,
173   - channelType: that.channelType
174   - }
  165 + this.$axios({
  166 + method: 'get',
  167 + url:`/api/gbStream/list`,
  168 + params: {
  169 + page: that.currentPage,
  170 + count: that.count,
  171 + query: that.searchSrt,
  172 + online: that.online,
  173 + choosed: that.choosed,
  174 + platformId: that.platformId,
  175 + channelType: that.channelType
  176 + }
175 177 })
176 178 .then(function (res) {
177 179 that.total = res.data.total;
... ...
web_src/src/components/dialog/platformEdit.vue
... ... @@ -163,17 +163,17 @@ export default {
163 163 methods: {
164 164 openDialog: function (platform, callback) {
165 165 var that = this;
166   - this.$axios
167   - .get(`/api/platform/server_config`)
168   - .then(function (res) {
  166 + this.$axios({
  167 + method: 'get',
  168 + url:`/api/platform/server_config`
  169 + }).then(function (res) {
169 170 console.log(res);
170 171 that.platform.deviceGBId = res.data.username;
171 172 that.platform.deviceIp = res.data.deviceIp;
172 173 that.platform.devicePort = res.data.devicePort;
173 174 that.platform.username = res.data.username;
174 175 that.platform.password = res.data.password;
175   - })
176   - .catch(function (error) {
  176 + }).catch(function (error) {
177 177 console.log(error);
178 178 });
179 179 this.showDialog = true;
... ... @@ -188,11 +188,11 @@ export default {
188 188 onSubmit: function () {
189 189 console.log("onSubmit");
190 190 var that = this;
191   - that.$axios
192   - .post(`/api/platform/save`, that.platform)
193   - .then(function (res) {
194   - console.log(res);
195   - console.log(res.data == "success");
  191 + that.$axios({
  192 + method: 'post',
  193 + url:`/api/platform/save`,
  194 + data: that.platform
  195 + }).then(function (res) {
196 196 if (res.data == "success") {
197 197 that.$message({
198 198 showClose: true,
... ... @@ -204,8 +204,7 @@ export default {
204 204 that.listChangeCallback();
205 205 }
206 206 }
207   - })
208   - .catch(function (error) {
  207 + }).catch(function (error) {
209 208 console.log(error);
210 209 });
211 210 },
... ... @@ -218,8 +217,9 @@ export default {
218 217 deviceGBIdExit: async function (deviceGbId) {
219 218 var result = false;
220 219 var that = this;
221   - await that.$axios
222   - .post(`/api/platform/exit/${deviceGbId}`)
  220 + await that.$axios({
  221 + method: 'post',
  222 + url:`/api/platform/exit/${deviceGbId}`})
223 223 .then(function (res) {
224 224 result = res.data;
225 225 })
... ...
web_src/src/components/dialog/rtcPlayer.vue
... ... @@ -11,7 +11,8 @@ export default {
11 11 name: 'rtcPlayer',
12 12 data() {
13 13 return {
14   - webrtcPlayer: null
  14 + webrtcPlayer: null,
  15 + timer: null
15 16 };
16 17 },
17 18 props: ['videoUrl', 'error', 'hasaudio'],
... ... @@ -55,7 +56,7 @@ export default {
55 56 this.eventcallbacK("OFFER ANSWER ERROR ", "offer anwser 交换失败")
56 57 if (e.code ==-400 && e.msg=="流不存在"){
57 58 console.log("111111")
58   - setTimeout(()=>{
  59 + this.timer = setTimeout(()=>{
59 60 this.webrtcPlayer.close();
60 61 this.play(url)
61 62 }, 100)
... ... @@ -83,6 +84,9 @@ export default {
83 84 console.log(message)
84 85 }
85 86 },
  87 + destroyed() {
  88 + clearTimeout(this.timer);
  89 + },
86 90 }
87 91 </script>
88 92  
... ...