支持全局异常和统一返回结果
This commit is contained in:
@@ -200,7 +200,7 @@ export default {
|
||||
method: 'get',
|
||||
url:`/api/platform/query/10000/1`
|
||||
}).then(function (res) {
|
||||
that.platformList = res.data.list;
|
||||
that.platformList = res.data.data.list;
|
||||
}).catch(function (error) {
|
||||
console.log(error);
|
||||
});
|
||||
|
||||
@@ -57,7 +57,7 @@ export default {
|
||||
method: 'get',
|
||||
url:`/api/device/query/${this.deviceId}/sync_status/`,
|
||||
}).then((res) => {
|
||||
if (res.data.code == 0) {
|
||||
if (res.data.code === 0) {
|
||||
if (!this.syncFlag) {
|
||||
this.syncFlag = true;
|
||||
}
|
||||
|
||||
@@ -142,13 +142,8 @@ export default {
|
||||
url: "/api/role/all"
|
||||
}).then((res) => {
|
||||
this.loading = true;
|
||||
console.info(res)
|
||||
res.data
|
||||
console.info(res.data.code)
|
||||
if (res.data.code === 0) {
|
||||
console.info(res.data.data)
|
||||
this.options=res.data.data
|
||||
|
||||
}
|
||||
}).catch((error) => {
|
||||
console.error(error)
|
||||
|
||||
@@ -118,8 +118,7 @@ export default {
|
||||
method:"post",
|
||||
url:`/api/platform/catalog/${!this.isEdit? "add":"edit"}`,
|
||||
data: this.form
|
||||
})
|
||||
.then((res)=> {
|
||||
}).then((res)=> {
|
||||
if (res.data.code === 0) {
|
||||
if (this.submitCallback)this.submitCallback(this.form)
|
||||
}else {
|
||||
|
||||
@@ -96,7 +96,7 @@ export default {
|
||||
password: this.newPassword
|
||||
}
|
||||
}).then((res)=> {
|
||||
if (res.data === "success"){
|
||||
if (res.data.code === 0) {
|
||||
this.$message({
|
||||
showClose: true,
|
||||
message: '修改成功,请重新登录',
|
||||
|
||||
@@ -91,7 +91,7 @@ export default {
|
||||
userId: this.form.id,
|
||||
}
|
||||
}).then((res)=> {
|
||||
if (res.data === "success"){
|
||||
if (res.data.code === 0) {
|
||||
this.$message({
|
||||
showClose: true,
|
||||
message: '修改成功',
|
||||
|
||||
@@ -71,8 +71,7 @@ export default {
|
||||
userId: this.form.id,
|
||||
}
|
||||
}).then((res)=> {
|
||||
console.log(res.data)
|
||||
if (res.data.msg === "success"){
|
||||
if (res.data.code === 0) {
|
||||
this.$message({
|
||||
showClose: true,
|
||||
message: '修改成功',
|
||||
|
||||
@@ -101,7 +101,7 @@ export default {
|
||||
channelReduces: that.chooseData
|
||||
}
|
||||
}).then((res)=>{
|
||||
if (res.data == true) {
|
||||
if (res.data.code === 0) {
|
||||
that.$message({
|
||||
showClose: true,
|
||||
message: '保存成功,',
|
||||
|
||||
@@ -87,8 +87,7 @@ export default {
|
||||
platformId: that.platformId,
|
||||
parentId: parentId
|
||||
}
|
||||
})
|
||||
.then((res)=> {
|
||||
}).then((res)=> {
|
||||
if (res.data.code === 0) {
|
||||
if (typeof(callback) === 'function') {
|
||||
callback(res.data.data)
|
||||
@@ -140,8 +139,7 @@ export default {
|
||||
id: id,
|
||||
platformId: this.platformId,
|
||||
}
|
||||
})
|
||||
.then((res) => {
|
||||
}).then((res) => {
|
||||
if (res.data.code === 0) {
|
||||
console.log("移除成功")
|
||||
node.parent.loaded = false
|
||||
@@ -163,8 +161,7 @@ export default {
|
||||
platformId: this.platformId,
|
||||
catalogId: id,
|
||||
}
|
||||
})
|
||||
.then((res)=> {
|
||||
}).then((res)=> {
|
||||
if (res.data.code === 0) {
|
||||
this.defaultCatalogIdSign = id;
|
||||
}
|
||||
|
||||
@@ -180,15 +180,17 @@ export default {
|
||||
}
|
||||
})
|
||||
.then(function (res) {
|
||||
that.total = res.data.total;
|
||||
that.gbStreams = res.data.list;
|
||||
that.gbChoosechannel = {};
|
||||
// 防止出现表格错位
|
||||
that.$nextTick(() => {
|
||||
if (res.data.code === 0) {
|
||||
that.total = res.data.data.total;
|
||||
that.gbStreams = res.data.data.list;
|
||||
that.gbChoosechannel = {};
|
||||
// 防止出现表格错位
|
||||
that.$nextTick(() => {
|
||||
that.$refs.gbStreamsTable.doLayout();
|
||||
// 默认选中
|
||||
that.eventEnable = true;
|
||||
})
|
||||
that.eventEnable = true;
|
||||
})
|
||||
}
|
||||
})
|
||||
.catch(function (error) {
|
||||
console.log(error);
|
||||
|
||||
@@ -122,7 +122,7 @@ export default {
|
||||
params: this.form
|
||||
}).then((res) => {
|
||||
console.log(res.data)
|
||||
if (res.data.code == 0) {
|
||||
if (res.data.code === 0) {
|
||||
this.listChangeCallback()
|
||||
}else {
|
||||
this.$message({
|
||||
|
||||
@@ -438,6 +438,7 @@ export default {
|
||||
this.playFromStreamInfo(false, streamInfo)
|
||||
},
|
||||
getUrlByStreamInfo(){
|
||||
console.log(this.streamInfo)
|
||||
if (location.protocol === "https:") {
|
||||
this.videoUrl = this.streamInfo[this.player[this.activePlayer][1]]
|
||||
}else {
|
||||
@@ -452,9 +453,9 @@ export default {
|
||||
this.$refs[this.activePlayer].pause()
|
||||
that.$axios({
|
||||
method: 'post',
|
||||
url: '/api/gb_record/convert/' + that.streamId
|
||||
url: '/api/play/convert/' + that.streamId
|
||||
}).then(function (res) {
|
||||
if (res.data.code == 0) {
|
||||
if (res.data.code === 0) {
|
||||
that.convertKey = res.data.key;
|
||||
setTimeout(()=>{
|
||||
that.isLoging = false;
|
||||
|
||||
@@ -90,7 +90,7 @@ export default {
|
||||
}
|
||||
}).then((res) => {
|
||||
console.log(res.data)
|
||||
if (res.data.code == 0) {
|
||||
if (res.data.code === 0) {
|
||||
if (res.data.data != null) {
|
||||
this.listChangeCallback(res.data.data)
|
||||
}else {
|
||||
|
||||
@@ -112,7 +112,7 @@ export default {
|
||||
url:`/api/push/save_to_gb`,
|
||||
data: this.proxyParam
|
||||
}).then( (res) => {
|
||||
if (res.data == "success") {
|
||||
if (res.data.code === 0) {
|
||||
this.$message({
|
||||
showClose: true,
|
||||
message: "保存成功",
|
||||
|
||||
@@ -84,15 +84,16 @@ export default {
|
||||
method: 'get',
|
||||
url: `/api/gb_record/download/progress/${this.deviceId}/${this.channelId}/${this.stream}`
|
||||
}).then((res)=> {
|
||||
console.log(res)
|
||||
console.log(res.data.progress)
|
||||
this.streamInfo = res.data;
|
||||
if (parseFloat(res.data.progress) == 1) {
|
||||
this.percentage = 100;
|
||||
}else {
|
||||
this.percentage = (res.data.progress*100).toFixed(1);
|
||||
if (res.data.code === 0) {
|
||||
this.streamInfo = res.data.data;
|
||||
if (parseFloat(res.data.progress) == 1) {
|
||||
this.percentage = 100;
|
||||
}else {
|
||||
this.percentage = (res.data.progress*100).toFixed(1);
|
||||
}
|
||||
if (callback)callback();
|
||||
}
|
||||
if (callback)callback();
|
||||
|
||||
}).catch((e) =>{
|
||||
|
||||
});
|
||||
@@ -140,7 +141,7 @@ export default {
|
||||
endTime: null,
|
||||
}
|
||||
}).then((res) =>{
|
||||
if (res.data.code === 0 && res.data.msg === "success") {
|
||||
if (res.data.code === 0 ) {
|
||||
// 查询进度
|
||||
this.title = "录像文件处理中..."
|
||||
this.taskId = res.data.data;
|
||||
@@ -173,7 +174,7 @@ export default {
|
||||
}
|
||||
}).then((res) => {
|
||||
console.log(res)
|
||||
if (res.data.code == 0) {
|
||||
if (res.data.code === 0) {
|
||||
this.percentage = parseFloat(res.data.data.percentage)*100
|
||||
if (res.data.data[0].percentage === '1') {
|
||||
this.getProgressForFileRun = false;
|
||||
|
||||
Reference in New Issue
Block a user