Commit e72c114b authored by wxk's avatar wxk

优化:机器人详情返回保留筛选条件

parent ecb636e5
...@@ -37,9 +37,11 @@ ...@@ -37,9 +37,11 @@
this.active = this.$route.params.name || 'account'; this.active = this.$route.params.name || 'account';
}, },
methods: { methods: {
navClick() { navClick(index) {
this.active = index;
Bus.$emit('refresh');
if(this.active != 'account'){ if(this.active != 'account'){
this.$router.push('/monitor/' + this.active) this.$router.push(`/monitor/${index}`)
}else{ }else{
this.$router.push('/monitor/account'); this.$router.push('/monitor/account');
} }
......
...@@ -24,23 +24,30 @@ export default new Router({ ...@@ -24,23 +24,30 @@ export default new Router({
children: children:
[ [
{ {
path: 'account', path: '/monitor/account',
component: function(resolve){ component: function(resolve){
require(['../views/account.vue'],resolve); require(['../views/account.vue'],resolve);
}, },
}, },
{ {
path:":name", path:"/monitor/:name",
component: function(resolve){ component: function(resolve){
require(['../views/RobotContainer.vue'],resolve); require(['../views/RobotContainer.vue'],resolve);
}, },
children: [ children: [
{ {
path: '/',
component: function(resolve){
require(['../views/overview.vue'],resolve);
},
},
{
path: 'RobotDetail', path: 'RobotDetail',
component: function(resolve){ component: function(resolve){
require(['../views/RobotDetails.vue'],resolve); require(['../views/RobotDetails.vue'],resolve);
}, },
} },
] ]
} }
] ]
......
...@@ -255,7 +255,7 @@ export default { ...@@ -255,7 +255,7 @@ export default {
localStorage["username"] = this.loginEmail; localStorage["username"] = this.loginEmail;
sessionStorage.setItem("isLogin",true); sessionStorage.setItem("isLogin",true);
this.$router.push({ this.$router.push({
path:'/monitor' path:'/monitor/home/overview'
}) })
}else{ }else{
......
<template> <template>
<div class="box"> <div class="box">
<overview v-if="$route.path.split('/').pop() !== 'RobotDetail'" :platInfo="platInfo"></overview> <keep-alive>
<router-view></router-view> <router-view :platInfo="platInfo"></router-view>
</keep-alive>
</div> </div>
</template> </template>
<script> <script>
import overview from './overview'
export default { export default {
data() {
return {
}
},
props: ['platInfo'], props: ['platInfo'],
components: { overview },
} }
</script> </script>
......
...@@ -540,7 +540,7 @@ ...@@ -540,7 +540,7 @@
}, },
//返回上一页(关闭详情) //返回上一页(关闭详情)
closeDetails() { closeDetails() {
// Bus.$emit('back'); Bus.$emit('back');
this.$router.go(-1); this.$router.go(-1);
}, },
//查询行情信息 //查询行情信息
...@@ -868,6 +868,9 @@ ...@@ -868,6 +868,9 @@
} }
}, },
watch: { watch: {
$route() {
this.init();
},
robotDetailInfo() { robotDetailInfo() {
this.init(); this.init();
}, },
......
...@@ -173,39 +173,32 @@ ...@@ -173,39 +173,32 @@
props: ['platInfo'], props: ['platInfo'],
created() { created() {
this.init(); this.init();
/*Bus.$on('back', ()=> { Bus.$on('refresh', ()=>{
setTimeout(()=>{ setTimeout(()=>{
const overviewParams = JSON.parse(sessionStorage.getItem('overviewParams')); this.init();
this.robotStatus = overviewParams.robotStatus; },0)
this.checkedWebs = overviewParams.checkedWebs; });
this.checkedPairs = overviewParams.checkedPairs; Bus.$on('back', ()=>{
this.checkedCurrencies = overviewParams.checkedCurrencies; let Params = {
this.subtitle = this.robotStatus === 'normal' ? '正在运行机器人' : class: "robot", //账户级别
(this.robotStatus === 'stop' ? '停止运行机器人' : coin: [], //目标币种,用于首页里的筛选和币种监控 可选参数
(this.robotStatus === 'profit' ? '盈利异常机器人' : symbol: [], //币种对,用于网站监控里的筛选 可选参数
(this.robotStatus === 'coin' ? '目标币异常机器人' : status: "", //机器人运行状态 可选参数
(this.robotStatus === 'base' ? '基础币异常机器人':'所有机器人')))); abnormal: "", //有profit,coin,base这三种异常类别 可选参数
let Params = { platform: [] //交易所种类 可选参数
class: "robot", //账户级别 };
coin: [], //目标币种,用于首页里的筛选和币种监控 可选参数 if (this.robotStatus==='normal' || this.robotStatus==='stop') {
symbol: [], //币种对,用于网站监控里的筛选 可选参数 Params.status = this.robotStatus;
status: "", //机器人运行状态 可选参数 }else {
abnormal: "", //有profit,coin,base这三种异常类别 可选参数 Params.abnormal = this.robotStatus;
platform: [] //交易所种类 可选参数 }
}; if(!this.robotStatus) {
if (this.robotStatus==='normal' || this.robotStatus==='stop') { Params.coin = this.checkedCurrencies;
Params.status = this.robotStatus; Params.symbol = this.checkedPairs;
}else { Params.platform = this.checkedWebs;
Params.abnormal = this.robotStatus; }
} this.getRobotList(Params);
if(!this.robotStatus) { })
Params.coin = this.checkedCurrencies;
Params.symbol = this.checkedPairs;
Params.platform = this.checkedWebs;
}
this.getRobotList(Params);
},1000)
})*/
}, },
methods: { methods: {
init() { init() {
...@@ -336,17 +329,7 @@ ...@@ -336,17 +329,7 @@
this.getRobotList(ListParams); this.getRobotList(ListParams);
}, },
showDetails(index) { showDetails(index) {
const overviewParams = { this.$router.push(`/monitor/${this.$route.params.name}/RobotDetail`);
robotStatus: this.robotStatus,
checkedWebs: this.checkedWebs,
checkedCurrencies: this.checkedCurrencies,
checkedPairs: this.checkedPairs,
};
// console.log(overviewParams);
sessionStorage.setItem('overviewParams', JSON.stringify(overviewParams));
sessionStorage.setItem('robotDetailInfo', JSON.stringify(this.robotList[index]));
this.$router.push(this.$route.path+'/RobotDetail');
// console.log(this.robotDetailInfo)
}, },
clickSwitch(val) { clickSwitch(val) {
const Tips = val ? '此操作将开启机器人, 是否继续?' : '此操作将关闭机器人, 是否继续?'; const Tips = val ? '此操作将开启机器人, 是否继续?' : '此操作将关闭机器人, 是否继续?';
...@@ -412,10 +395,6 @@ ...@@ -412,10 +395,6 @@
} }
}, },
watch:{ watch:{
$route(newVal, oldVal){
// console.log(newVal.params.name)
this.init();
},
platInfo(val){ platInfo(val){
this.webs = []; this.webs = [];
//获取所有的交易所和币种 //获取所有的交易所和币种
......
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