|
|
@@ -20,14 +20,18 @@
|
|
|
<img class="out-img" @click="openBackManageUrl" src="@/assets/ZDimages/icon_gb@1x.png">
|
|
|
</div>
|
|
|
<div class="bottom-max-box">
|
|
|
- <div :class="index == checkDept?'checkP':'noCheckP'" v-for="(item,index) in deptList" :key="index">
|
|
|
- <p >{{item.deptName}}</p>
|
|
|
+ <div :class="index == setCheckIndex?'checkP':'noCheckP'"
|
|
|
+ @click="checkIndexButton(index)"
|
|
|
+ v-for="(item,index) in deptList" :key="index">
|
|
|
+ <p >{{item.level == 1 ?'汇总数据':item.name}}</p>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
</template>
|
|
|
<script>
|
|
|
+ import store from '@/store'
|
|
|
import { removeToken } from '@/utils/auth'
|
|
|
+ import { setToken } from '@/utils/auth'
|
|
|
export default {
|
|
|
name: 'headerComponent',
|
|
|
data () {
|
|
|
@@ -37,23 +41,45 @@
|
|
|
timeData1:'',
|
|
|
timeData2:'',
|
|
|
timeData3:'',
|
|
|
- deptList:[
|
|
|
- {deptName:"汇总数据",deptId:'9999999'},
|
|
|
- {deptName:"材料与物理学院",deptId:'9999999'},
|
|
|
- {deptName:"化工学院",deptId:'9999999'},
|
|
|
- {deptName:"低碳能源与动学院学院学院",deptId:'9999999'},
|
|
|
- ],
|
|
|
- checkDept:0,
|
|
|
+ deptList:[],
|
|
|
+ setCheckIndex:0,
|
|
|
+ deptTimer:null,
|
|
|
+
|
|
|
}
|
|
|
},
|
|
|
created(){
|
|
|
|
|
|
},
|
|
|
mounted(){
|
|
|
+ this.$set(this,'deptList',JSON.parse(localStorage.getItem('deptList')));
|
|
|
+ this.$set(this,'setCheckIndex',parseInt(localStorage.getItem('setCheckIndex')));
|
|
|
this.updateTime();
|
|
|
- this.timer = setInterval(this.updateTime, 1000)
|
|
|
+ this.timer = setInterval(this.updateTime, 1000);
|
|
|
+ this.deptTimerFunction();
|
|
|
},
|
|
|
methods:{
|
|
|
+ deptTimerFunction(){
|
|
|
+ let self = this
|
|
|
+ clearInterval(this.deptTimer)
|
|
|
+ this.deptTimer = setInterval(function() {
|
|
|
+ if(self.setCheckIndex == 3){
|
|
|
+ self.checkIndexButton(0);
|
|
|
+ }else{
|
|
|
+ self.checkIndexButton((self.setCheckIndex+1));
|
|
|
+ }
|
|
|
+ }, 1000 * 180)
|
|
|
+ },
|
|
|
+ checkIndexButton(index){
|
|
|
+ this.$set(this,'setCheckIndex',index);
|
|
|
+ localStorage.setItem('setCheckIndex', index);
|
|
|
+ if(this.deptList[index].level == 1){
|
|
|
+ localStorage.setItem('deptId','');
|
|
|
+ }else{
|
|
|
+ localStorage.setItem('deptId',this.deptList[index].deptId);
|
|
|
+ }
|
|
|
+ setToken(this.deptList[index].token);
|
|
|
+ this.$parent.checkDept();
|
|
|
+ },
|
|
|
//跳转后台管理
|
|
|
openBackManageUrl() {
|
|
|
this.$confirm('确定注销并退出系统吗?', '提示', {
|
|
|
@@ -102,11 +128,13 @@
|
|
|
beforeDestroy() {
|
|
|
//清除定时器
|
|
|
clearInterval(this.timer);
|
|
|
+ clearInterval(this.deptTimer);
|
|
|
}
|
|
|
,
|
|
|
destroyed() {
|
|
|
//清除定时器
|
|
|
clearInterval(this.timer);
|
|
|
+ clearInterval(this.deptTimer);
|
|
|
}
|
|
|
}
|
|
|
</script>
|