Browse Source

优化

master
ltlzx 4 years ago
parent
commit
7900278c91
  1. 7
      api/serve/index.js
  2. 16
      pages/exchange/open-position.vue

7
api/serve/index.js

@ -84,9 +84,10 @@ x.fn = x.prototype = {
let newMsg=options.url.replace(reg,'_'); let newMsg=options.url.replace(reg,'_');
console.info(newMsg) console.info(newMsg)
if(Cache.get(newMsg).data){ if(Cache.get(newMsg).data){
if(newMsg!='_user_walletImage'&& newMsg!='_user_getAuthInfo' && newMsg!='_user_withdrawalBalance' && newMsg!='_wallet_getBalance' && newMsg!='_contract_getMarketInfo'){ if(newMsg!='_user_walletImage'&& newMsg!='_user_getAuthInfo' && newMsg!='_user_withdrawalBalance'
resolve(Cache.get(newMsg).data); && newMsg!='_wallet_getBalance' && newMsg!='_contract_getMarketInfo'&& newMsg!='_contract_openNum'){
} resolve(Cache.get(newMsg).data);
}
uni.request({ uni.request({
url: this.url, url: this.url,
data: this.data, data: this.data,

16
pages/exchange/open-position.vue

@ -756,7 +756,7 @@ export default {
type: 1, type: 1,
entrust_price: "", entrust_price: "",
amount: "", amount: "",
lever_rate: "", lever_rate: 50,
tp_trigger_price: "", tp_trigger_price: "",
sl_trigger_price: "", sl_trigger_price: "",
}, },
@ -782,6 +782,7 @@ export default {
progress:[25,50,75,100], progress:[25,50,75,100],
progressPing:[25,50,75,100], progressPing:[25,50,75,100],
sliderActive:-1, sliderActive:-1,
sliderActive1:0,
pingActive:3, pingActive:3,
contract:"1", contract:"1",
// contract:"0", // contract:"0",
@ -860,6 +861,10 @@ export default {
} }
}, },
watch: { watch: {
maxNum(n){
this.form.amount = Math.round((this.maxNum * this.sliderActive1) / 100);
this.margin=this.form.amount/this.form.lever_rate
},
symbol() { symbol() {
this.$emit("symbols",this.symbol) this.$emit("symbols",this.symbol)
if (this.unSymbol) { if (this.unSymbol) {
@ -1337,18 +1342,21 @@ export default {
} }
Contract.openPosition(data, { btn }).then(() => { Contract.openPosition(data, { btn }).then(() => {
this.$toast(this.$t("contract.g2")); this.$toast(this.$t("contract.g2"));
console.info(this.form.type)
if(this.form.type==1){ if(this.form.type==1){
this.holdPosition() this.holdPosition()
}else{ }else{
this.getCurrentEntrust() this.getCurrentEntrust()
} }
this.contractAccount(); this.contractAccount();
this.openNum()
}); });
}, },
sliderChange(n,i) { sliderChange(n,i) {
console.info(n,i)
this.form.amount = Math.round((this.maxNum * n) / 100); this.form.amount = Math.round((this.maxNum * n) / 100);
this.sliderActive=i this.sliderActive=i
this.sliderActive1=n
this.margin=this.form.amount/this.form.lever_rate this.margin=this.form.amount/this.form.lever_rate
}, },
pingChange(n,i) { pingChange(n,i) {
@ -1467,6 +1475,7 @@ export default {
this.pingAmount = ""; this.pingAmount = "";
this.holdPosition(); this.holdPosition();
this.$toast(res.message); this.$toast(res.message);
this.openNum()
}); });
}, },
// //
@ -1536,6 +1545,7 @@ export default {
Contract.onekeyAllFlat({}).then(() => { Contract.onekeyAllFlat({}).then(() => {
this.holdPosition(true); this.holdPosition(true);
this.$toast(this.$t("contract.l0")); this.$toast(this.$t("contract.l0"));
this.openNum()
}); });
}); });
}, },
@ -1820,4 +1830,4 @@ export default {
.but_text{ .but_text{
font-size: 14px; font-size: 14px;
} }
</style> </style>s
Loading…
Cancel
Save