Commit 795c2e04 authored by wxk's avatar wxk

结构优化,解决详情页刷新问题

parent fa026470
<template>
<div class="nav-left">
<el-menu
:default-active="$route.path"
:default-active="active"
class="el-menu-vertical-demo"
:router="true"
@select="navClick">
<el-menu-item index="/monitor/home">
<el-menu-item index="home">
<span slot="title">首页</span>
</el-menu-item>
<el-submenu index="1">
<template slot="title">网站监控</template>
<el-menu-item :index="'/monitor/' + index" v-for="(item, index) in platInfo" :key="item.platform">{{item.platform}}</el-menu-item>
<el-menu-item :index="index+''" v-for="(item, index) in platInfo" :key="item.platform">{{item.platform}}</el-menu-item>
</el-submenu>
<el-submenu index="2">
<template slot="title">币种监控</template>
<el-menu-item index="/monitor/BTY">BTY</el-menu-item>
<el-menu-item index="/monitor/YCC">YCC</el-menu-item>
<el-menu-item index="BTY">BTY</el-menu-item>
<el-menu-item index="YCC">YCC</el-menu-item>
</el-submenu>
</el-menu>
</div>
......@@ -26,14 +26,23 @@
export default {
data(){
return{
active: ''
}
},
props: ['platInfo'],
created() {
this.active = this.$route.params.name;
},
methods: {
navClick() {
this.$router.push('/monitor/' + this.active)
Bus.$emit('navClick')
}
},
watch: {
$route() {
this.active = this.$route.params.name;
}
}
}
</script>
......
......@@ -27,7 +27,15 @@ export default new Router({
path:":name",
component: function(resolve){
require(['../views/overview.vue'],resolve);
},
children: [
{
path: 'RobotDetail',
component: function(resolve){
require(['../views/RobotDetails.vue'],resolve);
},
}
]
}
]
}
......
......@@ -457,6 +457,7 @@
export default {
data(){
return{
robotDetailInfo: JSON.parse(sessionStorage.getItem('robotDetailInfo')),
robotInfo: {},
username: localStorage.getItem('username'),
value1: true,
......@@ -503,13 +504,14 @@
recordsLoading: false,//交易记录查询加载
}
},
props: ['robotDetailInfo','robotBankList'],
props: ['robotBankList'],
created() {
this.init();
},
methods: {
//页面初始化
init() {
// this.robotDetailInfo = JSON.parse(sessionStorage.getItem('robotDetailInfo'));
this.getWalletInfo();
this.getTransaction();
this.getRecords();
......@@ -517,7 +519,8 @@
},
//返回上一页(关闭详情)
closeDetails() {
Bus.$emit('hideDetails')
Bus.$emit('navClick');
this.$router.go(-1);
},
//查询当前机器人信息
getCurrentRobot() {
......@@ -610,7 +613,9 @@
duration:'2000',
});
this.Loading = false;
setTimeout(()=>{
this.init();
},500)
}else{
this.Loading = false;
this.$notify({
......
<template>
<div class="overview">
<div v-show="!robotDetails">
<div v-if="$route.path.split('/').pop() !== 'RobotDetail'">
<div class="overview-title">
<span>机器人监控</span>
</div>
......@@ -130,10 +130,10 @@
</ul>
<p v-if="robotList === null" class="no-data">暂无数据</p>
</div>
<robot-details v-if="robotDetails" :robotDetailInfo="robotDetailInfo" :robotBankList="robotBankList"></robot-details>
<router-view :robotBankList="robotBankList"></router-view>
<!--<robot-details v-if="robotDetails" :robotDetailInfo="robotDetailInfo" :robotBankList="robotBankList"></robot-details>-->
</div>
</template>
<script>
import RobotDetails from './RobotDetails'
import Bus from '../assets/js/bus'
......@@ -144,7 +144,6 @@
return {
platform: '',//导航选中的交易所
value1: true, //是否开启机器人
robotDetails: false, //是否查看机器人详情
robotStatus: '', //机器人状态
robotStatusList: [],//状态预警信息
RobotListParams: {
......@@ -184,7 +183,6 @@
created() {
this.init();
Bus.$on('navClick', ()=> {
this.robotDetails = false;
this.robotStatus = '';
this.subtitle = '所有机器人';
this.checkAll = false; //交易所筛选
......@@ -204,9 +202,6 @@
this.init();
},0)
});
Bus.$on('hideDetails',()=>{
this.robotDetails = false;
})
},
methods: {
init() {
......@@ -332,8 +327,10 @@
this.getRobotList(ListParams);
},
showDetails(index) {
this.robotDetails = true;
this.robotDetailInfo = this.robotList[index];
// console.log(this.$route.path);
// this.RobotDetails = true;
sessionStorage.setItem('robotDetailInfo', JSON.stringify(this.robotList[index]));
this.$router.push(this.$route.path+'/RobotDetail');
// console.log(this.robotDetailInfo)
},
clickSwitch(val) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment