Commit e6f0f773 authored by xiedong's avatar xiedong

支持开关机器人

parent 5232ed00
...@@ -11,9 +11,8 @@ module.exports = { ...@@ -11,9 +11,8 @@ module.exports = {
assetsPublicPath: '/', assetsPublicPath: '/',
proxyTable: { proxyTable: {
'/asset_monitor': { '/asset_monitor': {
// target: 'http://13.70.1.145:4567', //正式 target: 'http://47.52.169.49:4567', //正式
target: 'http://172.16.100.22:46656', // 测试 // target: 'http://172.16.100.22:46656', // 测试
// target: 'http://172.16.100.22:46657', // 测试
// secure: false, // 如果是https接口,需要配置这个参数 // secure: false, // 如果是https接口,需要配置这个参数
changeOrigin: true, // 如果接口跨域,需要进行这个参数配置 changeOrigin: true, // 如果接口跨域,需要进行这个参数配置
pathRewrite: { pathRewrite: {
......
...@@ -22,6 +22,7 @@ const Api = { ...@@ -22,6 +22,7 @@ const Api = {
GetRobotConfig: originUrl + '/getRobotConfig', //获取机器人配置 GetRobotConfig: originUrl + '/getRobotConfig', //获取机器人配置
UpdateRobotConfig: originUrl + '/updateRobotConfig', //修改机器人配置接口 UpdateRobotConfig: originUrl + '/updateRobotConfig', //修改机器人配置接口
transferStatusChange: originUrl + '/updateTransferStatus', //充提状态开关 transferStatusChange: originUrl + '/updateTransferStatus', //充提状态开关
changeStatus: originUrl + '/changeStatus', //修改机器人运行状态
} }
export default Api; export default Api;
...@@ -89,14 +89,14 @@ ...@@ -89,14 +89,14 @@
<i class="el-icon-caret-right"></i> <i class="el-icon-caret-right"></i>
</div> </div>
<div class="switch"> <div class="switch">
<span v-show="value1">关闭</span> <span v-show="item.status=='normal'">关闭</span>
<span v-show="!value1">开启</span> <span v-show="!item.status=='normal'">开启</span>
<el-switch <el-switch
v-model="value1" :value="item.status=='normal'"
active-color="rgba(119,146,167,1)" active-color="rgba(119,146,167,1)"
inactive-color="rgba(236,239,241,1)" inactive-color="rgba(236,239,241,1)"
@change="clickSwitch" @change="clickSwitch(item)"
disabled> >
</el-switch> </el-switch>
</div> </div>
</div> </div>
...@@ -398,17 +398,32 @@ ...@@ -398,17 +398,32 @@
this.$router.push(`/monitor/${this.$route.params.name}/RobotDetail`); this.$router.push(`/monitor/${this.$route.params.name}/RobotDetail`);
}, },
clickSwitch(val) { clickSwitch(val) {
const Tips = val ? '此操作将开启机器人, 是否继续?' : '此操作将关闭机器人, 是否继续?'; const Tips = val.status=='close' ? '此操作将开启机器人, 是否继续?' : '此操作将关闭机器人, 是否继续?';
const Message = val ? '开启机器人成功' : '关闭机器人成功'; // const Message = val.status=='close' ? '开启机器人成功' : '关闭机器人成功';
this.$confirm( Tips, '提示', { this.$confirm( Tips, '提示', {
confirmButtonText: '确定', confirmButtonText: '确定',
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning' type: 'warning'
}).then(() => { }).then(() => {
this.$message({ axios.post(ApiConfig.changeStatus,{
type: 'success', account: val.account,
message: Message symbol:`${val.coin}/${val.base}`,
}); new_status:val.status=='normal'&&'close'||'open'
}).then(res=>{
if(res.data.code=200){
this.init()//为了改变switch的状态
this.$message({
type: 'success',
message: res.data.msg
});
}else{
this.$message({
type: 'error',
message: res.data.msg
});
}
})
}).catch(() => { }).catch(() => {
this.value1 = !val; this.value1 = !val;
this.$message({ this.$message({
......
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