Browse Source

币币合约下拉数据侦听

master
luyisha 3 years ago
parent
commit
766e1af692
  1. 2
      api/serve/index.js
  2. 6
      i18n/lang/en.json
  3. 34
      layout/vDropdwon.vue
  4. 107
      pages/auth/primary.vue
  5. 58
      pages/exchange/open-position.vue

2
api/serve/index.js

@ -86,7 +86,7 @@ x.fn = x.prototype = {
if(Cache.get(newMsg).data){ if(Cache.get(newMsg).data){
if(newMsg!='_user_walletImage'&& newMsg!='_user_getAuthInfo' && newMsg!='_user_withdrawalBalance' if(newMsg!='_user_walletImage'&& newMsg!='_user_getAuthInfo' && newMsg!='_user_withdrawalBalance'
&& newMsg!='_article_detail' && newMsg!='_contract_getSymbolDetail' && newMsg!='_categoryList' && newMsg!='_articleList' && newMsg!='_article_detail' && newMsg!='_contract_getSymbolDetail' && newMsg!='_categoryList' && newMsg!='_articleList'
&& newMsg!='_college' && newMsg!='_exchange_getCoinInfo' && newMsg!='_college' && newMsg!='_exchange_getCoinInfo' && newMsg!='_user_primaryAuth'
&& newMsg!='_wallet_getBalance' && newMsg!='_contract_getMarketInfo'&& newMsg!='_contract_openNum'){ && newMsg!='_wallet_getBalance' && newMsg!='_contract_getMarketInfo'&& newMsg!='_contract_openNum'){
resolve(Cache.get(newMsg).data); resolve(Cache.get(newMsg).data);
} }

6
i18n/lang/en.json

@ -202,7 +202,7 @@
"a6": "Authentication failed", "a6": "Authentication failed",
"a7": "Nationality", "a7": "Nationality",
"a8": "Please select nationality", "a8": "Please select nationality",
"a9": "Real name", "a9": "Real Name",
"b0": "Please enter your real name", "b0": "Please enter your real name",
"b1": "Certificate Number", "b1": "Certificate Number",
"b2": "Please enter the ID number", "b2": "Please enter the ID number",
@ -223,7 +223,7 @@
"d2": "ID card", "d2": "ID card",
"d3": "Driving License", "d3": "Driving License",
"d4": "Passport", "d4": "Passport",
"d5": "residential address", "d5": "Residential Address",
"d6": "Please enter residential address", "d6": "Please enter residential address",
"d7": "City", "d7": "City",
"d8": "Please enter your city", "d8": "Please enter your city",
@ -232,7 +232,7 @@
"d11": "Phone Number", "d11": "Phone Number",
"d12": "Please enter your phone number", "d12": "Please enter your phone number",
"d13": "Please select", "d13": "Please select",
"SelectAreaCode":"Select area code" "SelectAreaCode":"Select Area Code"
}, },
"exchange": { "exchange": {
"a0": "Spot Trading", "a0": "Spot Trading",

34
layout/vDropdwon.vue

@ -41,7 +41,11 @@ export default {
contract: { contract: {
type: String, type: String,
default: '' default: ''
} },
leverShow: {
type: String,
default: ''
},
}, },
data() { data() {
return { return {
@ -50,6 +54,31 @@ export default {
active:2 active:2
}; };
}, },
watch:{
leverShow:{
deep: true,
handler:function(newVal,oldVal) {
console.log(newVal, '下拉组件leverShow更新');
this.$nextTick(() => {
this.text=this.list[newVal].label;
})
}
},
list:{
deep: true,
handler:function(newVal,oldVal) {
console.log(newVal, '下拉组件list更新');
if(this.contract==1&&this.list){
this.text=this.list[1].label
}else if(this.contract==0&&this.list){
this.text=this.list[0].label
}
if(this.leverShow){
this.text=this.list[this.leverShow].label
}
}
}
},
methods: { methods: {
handlerItem(value,index) { handlerItem(value,index) {
this.showIf = false this.showIf = false
@ -70,6 +99,9 @@ export default {
}else if(this.contract==0&&this.list){ }else if(this.contract==0&&this.list){
this.text=this.list[0].label this.text=this.list[0].label
} }
if(this.leverShow){
this.text=this.list[this.leverShow].label
}
} }
}; };
</script> </script>

107
pages/auth/primary.vue

@ -10,25 +10,22 @@
</view> </view>
</view> </view>
<!-- 出生日期 --> <!-- 出生日期 -->
<view class="form-item border-b p-md m-b-md" v-if="0">
<view class="label m-b-xs">{{$t('auth.d0')}}</view>
<!--<view class="form-item border-b p-md m-b-md">--> <view class="input color-light" >
<!-- <view class="label m-b-xs">{{$t('auth.d0')}}</view>--> <uni-datetime-picker
<!-- <view class="input color-light" >--> type="date"
<!-- <uni-datetime-picker--> :value="single"
<!-- type="date"--> start="1900-1-1"
<!-- :value="single"--> end="2050-12-12"
<!-- start="1900-1-1"--> @change="selectDate"
<!-- end="2050-12-12"--> />
<!-- @change="selectDate"--> </view>
<!-- />--> </view>
<!-- </view>-->
<!--</view>-->
<!-- 证件号类型 --> <!-- 证件号类型 -->
<view class="form-item border-b p-md m-b-md"> <view class="form-item border-b p-md m-b-md">
<view class="label m-b-xs">{{$t('auth.d1')}}</view> <view class="label m-b-xs">{{$t('auth.d1')}}</view>
<view class="input color-light" > <view class="input color-light" style="height: 30px;">
<v-picker :value="form.type" @change="selectType" :list="typeList" range-value="value" range-label="label"> <v-picker :value="form.type" @change="selectType" :list="typeList" range-value="value" range-label="label">
<v-input disabled :value="activeType.label" :placeholder="$t('auth.d13')"> <v-input disabled :value="activeType.label" :placeholder="$t('auth.d13')">
<template #right> <template #right>
@ -91,8 +88,6 @@
</view> </view>
</main> </main>
<van-toast id="van-toast" /> <van-toast id="van-toast" />
</v-page> </v-page>
</template> </template>
@ -105,15 +100,15 @@ export default {
detail: {}, detail: {},
countryList: [], countryList: [],
form: { form: {
country_id: "",
country_code: "",
realname: "", realname: "",
birthday: "", birthday: "",
type: "", type: "2",
id_card: "", id_card: "",
address: "", address: "",
city: "", city: "",
postal_code: "", postal_code: "",
country_id: "",
country_code: "",
phone: "", phone: "",
}, },
single: "2023-06-3", single: "2023-06-3",
@ -182,7 +177,63 @@ export default {
primaryAuth() { primaryAuth() {
let data = this.form; let data = this.form;
data.country_code = this.activeCountry.country_code; data.country_code = this.activeCountry.country_code;
Profile.primaryAuth(data,{btn:this.$refs.btn}).then(() => { if(!data.realname){
uni.showToast({
title: this.$t('auth.b0'),
icon: 'none'
})
return;
}
if(!data.type){
uni.showToast({
title: this.$t('auth.d13')+this.$t('auth.d1'),
icon: 'none'
})
return;
}
if(!data.id_card){
uni.showToast({
title: this.$t('auth.b2'),
icon: 'none'
})
return;
}
if(!data.address){
uni.showToast({
title: this.$t('auth.d6'),
icon: 'none'
})
return;
}
if(!data.city){
uni.showToast({
title: this.$t('auth.d8'),
icon: 'none'
})
return;
}
if(!data.postal_code){
uni.showToast({
title: this.$t('auth.d10'),
icon: 'none'
})
return;
}
if(!data.country_id){
uni.showToast({
title: this.$t('auth.SelectAreaCode'),
icon: 'none'
})
return;
}
if(!data.phone){
uni.showToast({
title: this.$t('auth.d12'),
icon: 'none'
})
return;
}
Profile.primaryAuth(data,{btn:this.$refs.btn}).then((res) => {
this.$toast.success(this.$t('auth.b4')); this.$toast.success(this.$t('auth.b4'));
// this.$back(); // this.$back();
uni.navigateBack({ uni.navigateBack({
@ -201,5 +252,15 @@ export default {
} }
}; };
</script> </script>
<style lang="scss"> <style lang="scss" scoped>
.layout-page{
height: auto !important;
}
.uni-input-input{
font-size: 14px;
}
/deep/uni-input{
height: 24px;
font-size: 15px;
}
</style> </style>

58
pages/exchange/open-position.vue

@ -96,7 +96,7 @@
<text class="fn-bold">{{ form.lever_rate }} X</text> <text class="fn-bold">{{ form.lever_rate }} X</text>
<i class="iconfont fn-13">&#xe6e9;</i> <i class="iconfont fn-13">&#xe6e9;</i>
</v-picker> --> </v-picker> -->
<v-dropdwon v-if="lever_rage.length>0" class="w-40 m-r-xs posi bg-form-panel-3 p-y-xxs rounded" :contract="contract" :list="lever_rage" @onClick="openNum"> <v-dropdwon v-if="lever_rage.length>0" class="w-40 m-r-xs posi bg-form-panel-3 p-y-xxs rounded" :contract="contract" :list="lever_rage" @onClick="openNum" :leverShow="leverShow">
</v-dropdwon> </v-dropdwon>
</view> </view>
<view class="m-b-ms"> <view class="m-b-ms">
@ -750,6 +750,7 @@ export default {
accountInfo: {}, accountInfo: {},
// //
lever_rage: [], lever_rage: [],
leverShow: '',
// //
maxNum: 0, maxNum: 0,
form: { form: {
@ -1266,39 +1267,44 @@ export default {
symbol: this.symbolLeft, symbol: this.symbolLeft,
}; };
Contract.getSymbolDetail(data).then((res) => { Contract.getSymbolDetail(data).then((res) => {
console.info(res) console.info('res.data', res.data.default_lever, res.data.lever_rage, res)
this.unit_amount = res.data.unit_amount; this.unit_amount = res.data.unit_amount;
if (!this.lever_rage.length) {
this.lever_rage = res.data.lever_rage.map((item) => ({ // if (!this.lever_rage.length) {
label: item, this.lever_rage = res.data.lever_rage.map((item) => ({
value: item, label: item,
})); value: item,
// this.form.lever_rate = this.lever_rage[2].value; }));
console.log(res.data, '----------'); // this.form.lever_rate = res.data.default_lever;
this.form.lever_rate = res.data.default_lever; // let e=res.data.default_lever
console.info(this.form.lever_rate) let e={value:res.data.default_lever, label: res.data.default_lever}
// let e=this.lever_rage[2] this.openNum(e);
let e=res.data.default_lever // }
this.openNum(e); this.$emit("getSymbolDetail", res.data);
} // if (!this.form.lever_rate) {
this.$emit("getSymbolDetail", res.data); // this.form.lever_rate = res.data.default_lever;
if (!this.form.lever_rate) { // this.openNum(e);
// this.form.lever_rate = this.lever_rage[2].value; // }
this.form.lever_rate = res.data.default_lever;
this.openNum(e);
}
}); });
}, },
// //
openNum(e) { openNum(e) {
if(e){
this.form.lever_rate=e.value
}
if (!this.isLogin) return; if (!this.isLogin) return;
let data = { let data = {
symbol: this.symbolLeft, //ETH symbol: this.symbolLeft, //ETH
lever_rate: this.form.lever_rate, //10 lever_rate: this.form.lever_rate, //10
}; };
if(e){
this.form.lever_rate=e.value;
data.lever_rate = e.value;
for(let item =0;item<this.lever_rage.length;item++){
if(e.value==this.lever_rage[item].value){
// leverShow v-dropdwontext
// indexof-1
this.leverShow = item.toString();
}
}
}
Contract.openNum(data,{toast:false}).then((res) => { Contract.openNum(data,{toast:false}).then((res) => {
this.maxNum = res.data; this.maxNum = res.data;
}); });
@ -1426,7 +1432,7 @@ export default {
this.tradeList.unshift(data); this.tradeList.unshift(data);
this.tradeList.pop(); this.tradeList.pop();
this.newPrice = data; this.newPrice = data;
console.log(this.newPrice, 898989898988) // console.log(this.newPrice, 898989898988)
break; break;
} }
}); });

Loading…
Cancel
Save