This commit is contained in:
lVAL 2020-12-30 15:15:11 +08:00
commit 5e73352856

View File

@ -1,8 +1,12 @@
<template> <template>
<div> <div>
<div :id="ibpId" v-loading="loading" :style="{ width: canvasWidth+'px', height: canvasHeight +'px',background:'#000' }" class="ibp-canvas" /> <div :id="ibpId" v-loading="loading" :style="{ width: canvasWidth+'px', height: canvasHeight +'px',background:'#000' }" class="ibp-canvas" />
<el-button v-if="showBackButton" class="ibp-button" type="primary" @click="back">{{ $t('global.back') }}</el-button> <el-button-group class="ibp-button">
<el-button v-if="$route.query.noPreLogout" class="ibp-button" type="primary" @click="quit">退出</el-button> <el-button v-if="moreScreen" type="primary" @click="switchOffset">切换</el-button>
<el-button v-if="showBackButton" type="primary" @click="back">{{ $t('global.back') }}</el-button>
<el-button v-if="$route.query.noPreLogout" type="primary" @click="quit">退出</el-button>
</el-button-group>
<audio id="buzzer" controls loop="loop"> <audio id="buzzer" controls loop="loop">
<source :src="buzzerAudio" type="audio/mpeg"> <source :src="buzzerAudio" type="audio/mpeg">
</audio> </audio>
@ -38,6 +42,7 @@ export default {
return { return {
width: this.$store.state.config.width, width: this.$store.state.config.width,
height: this.$store.state.config.height, height: this.$store.state.config.height,
moreScreen: false,
offsetX: 0, offsetX: 0,
dataZoom: { dataZoom: {
offsetX: '0', offsetX: '0',
@ -101,8 +106,8 @@ export default {
} }
this.initIbp(); this.initIbp();
if (this.$route.query.loadAll && this.$route.query.stationCode) { if (this.$route.query.loadAll && this.$route.query.stationCode) {
await this.show(this.$route.query.stationCode); await this.show(this.$route.query.stationCode, 'left');
await this.setMoveInit(true); await this.setMoveInit(false);
this.showBackButton = false; this.showBackButton = false;
} }
}, },
@ -182,7 +187,7 @@ export default {
} }
const data = parser(ibpDatas, {width: this.canvasWidth, height: this.canvasHeight}); // ibp const data = parser(ibpDatas, {width: this.canvasWidth, height: this.canvasHeight}); // ibp
this.initIbp(this.offsetX); this.initIbp(this.offsetX);
this.moreScreen = ibpDatas.background && ibpDatas.background.width > 1920;
this.setIbp(data, ibpDatas); this.setIbp(data, ibpDatas);
this.$store.dispatch('ibp/setIbpData', ibpDatas); this.$store.dispatch('ibp/setIbpData', ibpDatas);
this.handleBanOpenScreenDoorStatus(); this.handleBanOpenScreenDoorStatus();
@ -195,7 +200,6 @@ export default {
}); });
} }
} catch (error) { } catch (error) {
console.log(error, '===');
this.loading = false; this.loading = false;
this.$alert('当前ibp盘数据有问题请检查', '信息', { this.$alert('当前ibp盘数据有问题请检查', '信息', {
confirmButtonText: '确定', confirmButtonText: '确定',
@ -313,6 +317,19 @@ export default {
audio.pause(); audio.pause();
} }
} }
},
switchOffset() {
if (this.offsetX === 0) {
this.offsetX = 1920;
} else if (this.offsetX === 1920) {
this.offsetX = 0;
}
const options = {
scaleRate: this.canvasWidth / 1920,
offsetX: this.offsetX,
offsetY: 0
};
this.$ibp && this.$ibp.setOptions(options);
} }
} }
}; };