Browse Source

合约添加搜索,修改币币不能搜索

master
liaoxinyu 2 years ago
parent
commit
1775eb6227
  1. 2
      src/views/contract/handicap.vue
  2. 47
      src/views/contract/index.vue
  3. 4
      src/views/exchange/symbols.vue

2
src/views/contract/handicap.vue

@ -197,7 +197,7 @@ export default {
} }
bus.$on('collapse', msg => { bus.$on('collapse', msg => {
// this.newPriceObj.price =this.symbol=='BTC'? (msg.close).toFixed(1):(msg.close).toFixed(3); // this.newPriceObj.price =this.symbol=='BTC'? (msg.close).toFixed(1):(msg.close).toFixed(3);
const closeStr = msg.close.toString(); const closeStr = msg.close.toFixed(1)
this.newPriceObj.price = this.symbol === 'BTC' ? closeStr.slice(0, closeStr.indexOf('.') + 2) : closeStr.slice(0, closeStr.indexOf('.') + 4); this.newPriceObj.price = this.symbol === 'BTC' ? closeStr.slice(0, closeStr.indexOf('.') + 2) : closeStr.slice(0, closeStr.indexOf('.') + 4);
this.$emit("input", this.newPriceObj); this.$emit("input", this.newPriceObj);
}); });

47
src/views/contract/index.vue

@ -31,9 +31,18 @@
style="max-height:300px;overflow:auto;" style="max-height:300px;overflow:auto;"
> >
<template v-for="parent in contractList"> <template v-for="parent in contractList">
<div style="display: flex;align-items: center;justify-content: space-between;margin-bottom: 10px;">
<div class="px-3 text-primary" :key="parent.coin_name"> <div class="px-3 text-primary" :key="parent.coin_name">
{{ parent.coin_name }} {{ parent.coin_name }}
</div> </div>
<div>
<!-- 搜索框区域 -->
<div class="input-group search_box">
<i class="el-icon-search" style="color: #fff;"></i>
<input type="text" class="form-control" v-model="searchs" :placeholder="$t('exchange.search')">
</div>
</div>
</div>
<table class="table" :key="parent.coin_name + 1"> <table class="table" :key="parent.coin_name + 1">
<thead> <thead>
<tr class="text-secondary"> <tr class="text-secondary">
@ -51,6 +60,7 @@
:key="item.symbol" :key="item.symbol"
:class="{ active: item.symbol == activeSymbol }" :class="{ active: item.symbol == activeSymbol }"
@click="ispopover1(item.symbol)" @click="ispopover1(item.symbol)"
v-show="searchsShow(item)"
> >
<td class="w-10/24"> <td class="w-10/24">
{{ item.symbol }}/{{ parent.coin_name }} {{ item.symbol }}/{{ parent.coin_name }}
@ -232,6 +242,7 @@ export default {
contractOpen: false, contractOpen: false,
contractAgreement: {}, contractAgreement: {},
symbolDetail:{}, symbolDetail:{},
searchs:''
}; };
}, },
computed: { computed: {
@ -273,8 +284,8 @@ export default {
// console.info(this.$refs) // console.info(this.$refs)
bus.$on('collapse', msg => { bus.$on('collapse', msg => {
// //
const closeStr = msg.close.toString();
// this.activeContract.price =this.activeContract.symbol=='BTC'? (msg.close).toFixed(1):(msg.close).toFixed(3); // this.activeContract.price =this.activeContract.symbol=='BTC'? (msg.close).toFixed(1):(msg.close).toFixed(3);
const closeStr = msg.close.toFixed(1)
this.activeContract.price = this.activeContract.symbol === 'BTC' ? closeStr.slice(0, closeStr.indexOf('.') + 2) : closeStr.slice(0, closeStr.indexOf('.') + 4); this.activeContract.price = this.activeContract.symbol === 'BTC' ? closeStr.slice(0, closeStr.indexOf('.') + 2) : closeStr.slice(0, closeStr.indexOf('.') + 4);
this.holdPositionList.map(item=>{ this.holdPositionList.map(item=>{
if(item.symbol==this.activeContract.symbol) item.realtimePrice=this.activeContract.price if(item.symbol==this.activeContract.symbol) item.realtimePrice=this.activeContract.price
@ -386,6 +397,15 @@ export default {
// //
setactiveItem(index=0){ setactiveItem(index=0){
this.accountInfo=this.holdPositionList[index] this.accountInfo=this.holdPositionList[index]
},
searchsShow(item){
const reg = new RegExp(this.searchs, "gi");
if (!this.searchs){
return true;
}else {
let name = item.pair_name || item.coin_name;
return reg.test(name);
}
} }
} }
}; };
@ -401,4 +421,29 @@ export default {
.increase{ .increase{
color: #6EB189; color: #6EB189;
} }
.search_box{
width: 90%;
height: 30px;
// margin: 10px auto;
border: 1px solid #fff;
border-radius: 5px;
color: #2e2e2e;
align-items: center;
margin-right: 15px;
i{
width: 40px;
text-align: center;
font-size: 16px;
}
input{
background-color: transparent;
border: none;
border-left: 1px solid #fff;
padding: 0px 10px;
height: 27px;
font-size: 14px;
color: #fff;
line-height: 30px;
}
}
</style> </style>

4
src/views/exchange/symbols.vue

@ -181,7 +181,9 @@ export default {
const reg = new RegExp(this.keyword, "gi"); const reg = new RegExp(this.keyword, "gi");
if (!this.keyword) return true; if (!this.keyword) return true;
else { else {
let name = symbol.coinName || symbol.pair; // let name = symbol.coinName || symbol.pair;
// return name.search(reg) >= 0;
let name = symbol.pair_name || symbol.coin_name;
return name.search(reg) >= 0; return name.search(reg) >= 0;
} }
// return !this.keyword || symbol.coinName.concat(symbol.pair).search(reg) >= 0; // return !this.keyword || symbol.coinName.concat(symbol.pair).search(reg) >= 0;

Loading…
Cancel
Save