统一axios写法

This commit is contained in:
panlinlin
2021-04-12 16:04:04 +08:00
parent 27df8bd84c
commit 4010ed6c23
28 changed files with 243 additions and 218 deletions

View File

@@ -146,9 +146,11 @@ export default {
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 @@ export default {
that.listChangeCallback();
}
}
})
.catch(function (error) {
}).catch(function (error) {
console.log(error);
});
},
@@ -175,14 +176,14 @@ export default {
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() {

View File

@@ -89,11 +89,11 @@ export default {
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 @@ export default {
that.listChangeCallback();
}
}
})
.catch(function (error) {
}).catch(function (error) {
console.log(error);
});
});
},
close: function () {
console.log("关闭加入GB");
@@ -118,14 +117,14 @@ export default {
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() {

View File

@@ -182,7 +182,9 @@ export default {
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,

View File

@@ -162,16 +162,18 @@ export default {
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;

View File

@@ -163,17 +163,17 @@ export default {
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 @@ export default {
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 @@ export default {
that.listChangeCallback();
}
}
})
.catch(function (error) {
}).catch(function (error) {
console.log(error);
});
},
@@ -218,8 +217,9 @@ export default {
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;
})

View File

@@ -11,7 +11,8 @@ export default {
name: 'rtcPlayer',
data() {
return {
webrtcPlayer: null
webrtcPlayer: null,
timer: null
};
},
props: ['videoUrl', 'error', 'hasaudio'],
@@ -55,7 +56,7 @@ export default {
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 @@ export default {
console.log(message)
}
},
destroyed() {
clearTimeout(this.timer);
},
}
</script>