Commit e72c114b authored by wxk's avatar wxk

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

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