支持全局异常和统一返回结果,未完待续

This commit is contained in:
648540858
2022-08-21 22:22:34 +08:00
parent ecd14d6757
commit 5461b8ebf2
74 changed files with 844 additions and 15397 deletions

View File

@@ -125,8 +125,10 @@
}
}).then(function (res) {
console.log(res)
that.total = res.data.data.total;
that.recordList = res.data.data.list;
if (res.data.code === 0) {
that.total = res.data.data.total;
that.recordList = res.data.data.list;
}
that.loading = false;
}).catch(function (error) {
console.log(error);
@@ -174,8 +176,10 @@
}
}).then(function (res) {
console.log(res)
that.total = res.data.data.total;
that.recordList = res.data.data.list;
if (res.data.code === 0) {
that.total = res.data.data.total;
that.recordList = res.data.data.list;
}
}).catch(function (error) {
console.log(error);
});

View File

@@ -250,8 +250,10 @@
count: that.count
}
}).then(function (res) {
that.total = res.data.data.total;
that.detailFiles = that.detailFiles.concat(res.data.data.list);
if (res.data.code === 0) {
that.total = res.data.data.total;
that.detailFiles = that.detailFiles.concat(res.data.data.list);
}
that.loading = false;
if (callback) callback();
}).catch(function (error) {
@@ -320,7 +322,7 @@
count: that.count
}
}).then(function (res) {
if (res.data.code == 0) {
if (res.data.code === 0) {
that.total = res.data.data.total;
that.recordList = res.data.data.list;
}

View File

@@ -146,22 +146,23 @@ export default {
this.getDeviceList();
},
getDeviceList: function () {
let that = this;
this.getDeviceListLoading = true;
this.$axios({
method: 'get',
url: `/api/device/query/devices`,
params: {
page: that.currentPage,
count: that.count
page: this.currentPage,
count: this.count
}
}).then(function (res) {
that.total = res.data.total;
that.deviceList = res.data.list;
that.getDeviceListLoading = false;
}).catch(function (error) {
}).then( (res)=> {
if (res.data.code === 0) {
this.total = res.data.data.total;
this.deviceList = res.data.data.list;
}
this.getDeviceListLoading = false;
}).catch( (error)=> {
console.error(error);
that.getDeviceListLoading = false;
this.getDeviceListLoading = false;
});
},

View File

@@ -85,7 +85,7 @@ export default {
params: loginParam
}).then(function (res) {
console.log(JSON.stringify(res));
if (res.data.code == 0 && res.data.msg == "success") {
if (res.data.code === 0 ) {
that.$cookies.set("session", {"username": that.username,"roleId":res.data.data.role.id}) ;
//登录成功后
that.cancelEnterkeyDefaultAction();

View File

@@ -130,7 +130,7 @@ export default {
method: 'delete',
url:`/api/platform/delete/${platform.serverGBId}`
}).then(function (res) {
if (res.data == "success") {
if (res.data.code === 0) {
that.$message({
showClose: true,
message: '删除成功',
@@ -163,8 +163,11 @@ export default {
method: 'get',
url:`/api/platform/query/${that.count}/${that.currentPage}`
}).then(function (res) {
that.total = res.data.total;
that.platformList = res.data.list;
if (res.data.code === 0) {
that.total = res.data.data.total;
that.platformList = res.data.data.list;
}
}).catch(function (error) {
console.log(error);
});

View File

@@ -180,8 +180,11 @@ export default {
mediaServerId: that.mediaServerId,
}
}).then(function (res) {
that.total = res.data.total;
that.pushList = res.data.list;
if (res.data.code === 0) {
that.total = res.data.data.total;
that.pushList = res.data.data.list;
}
that.getDeviceListLoading = false;
}).catch(function (error) {
console.error(error);

View File

@@ -215,12 +215,15 @@ export default {
channelType: that.channelType
}
}).then(function (res) {
that.total = res.data.total;
that.deviceChannelList = res.data.list;
// 防止出现表格错位
that.$nextTick(() => {
that.$refs.channelListTable.doLayout();
})
if (res.data.code === 0) {
that.total = res.data.data.total;
that.deviceChannelList = res.data.data.list;
// 防止出现表格错位
that.$nextTick(() => {
that.$refs.channelListTable.doLayout();
})
}
}).catch(function (error) {
console.log(error);
});

View File

@@ -243,15 +243,16 @@ export default {
}
})
.then(function (res) {
that.total = res.data.total;
that.gbChannels = res.data.list;
if (res.data.code === 0 ) {
that.total = res.data.data.total;
that.gbChannels = res.data.data.list;
that.gbChoosechannel = {};
// 防止出现表格错位
that.$nextTick(() => {
that.$refs.gbChannelsTable.doLayout();
that.eventEnable = true;
})
console.log(that.gbChoosechannel)
}
// 防止出现表格错位
that.$nextTick(() => {
that.$refs.gbChannelsTable.doLayout();
that.eventEnable = true;
})
})
.catch(function (error) {
console.log(error);

View File

@@ -605,13 +605,15 @@ export default {
url: '/api/playback/start/' + this.deviceId + '/' + this.channelId + '?startTime=' + row.startTime + '&endTime=' +
row.endTime
}).then(function (res) {
that.streamInfo = res.data;
if (res.data.code === 0) {
that.streamInfo = res.data.data;
that.app = that.streamInfo.app;
that.streamId = that.streamInfo.stream;
that.mediaServerId = that.streamInfo.mediaServerId;
that.ssrc = that.streamInfo.ssrc;
that.videoUrl = that.getUrlByStreamInfo();
that.recordPlay = true;
}
that.recordPlay = true;
});
}
},

View File

@@ -194,13 +194,16 @@ export default {
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;
that.platform.treeType = "BusinessGroup";
that.platform.administrativeDivision = res.data.username.substr(0, 6);
if (res.data.code === 0) {
that.platform.deviceGBId = res.data.data.username;
that.platform.deviceIp = res.data.data.deviceIp;
that.platform.devicePort = res.data.data.devicePort;
that.platform.username = res.data.data.username;
that.platform.password = res.data.data.password;
that.platform.treeType = "BusinessGroup";
that.platform.administrativeDivision = res.data.data.username.substr(0, 6);
}
}).catch(function (error) {
console.log(error);
});
@@ -328,7 +331,9 @@ export default {
method: 'post',
url:`/api/platform/exit/${deviceGbId}`})
.then(function (res) {
result = res.data;
if (res.data.code === 0) {
result = res.data.data;
}
})
.catch(function (error) {
console.log(error);

View File

@@ -140,7 +140,7 @@ export default {
// that.isLoging = false;
console.log('=====----=====')
console.log(res)
if (res.data.code == 0 && res.data.data) {
if (res.data.code === 0 && res.data.data) {
itemData.playUrl = res.data.data.httpsFlv
that.setPlayUrl(res.data.data.ws_flv, idxTmp)
} else {