This commit is contained in:
huangjinming 2023-01-18 19:08:40 +08:00
parent 61b20d4243
commit c0e9963c76
4 changed files with 44 additions and 17 deletions

View File

@ -117,6 +117,7 @@
<script>
import { AppModule } from "@/store/modules/app";
import { UserModule } from "@/store/modules/user";
import { CONTRACT_ADDRESS } from "@/configs/config_chain";
import ChainManager from "@/chain/ChainManager";
import { formatPrice } from "@/utils/chain.util";
@ -132,8 +133,16 @@ export default {
loadingInstance: null,
};
},
computed: {
logined() {
return !!UserModule.token && !!AppModule.step;
},
},
methods: {
async haldBuy() {
if (!this.logined) {
await this.chainManager.login();
}
try {
this.showLoading();
const nftres = await this.chainManager.bc.beginApproveBuy(

View File

@ -59,6 +59,7 @@
<script>
import HeroBuyTop from "./HeroBuyTop.vue";
import { AppModule } from "@/store/modules/app";
import { UserModule } from "@/store/modules/user";
import { CONTRACT_ADDRESS } from "@/configs/config_chain";
import ChainManager from "@/chain/ChainManager";
import { formatPrice } from "@/utils/chain.util";
@ -76,9 +77,17 @@ export default {
dialogVisible: false,
};
},
computed: {
logined() {
return !!UserModule.token && !!AppModule.step;
},
},
methods: {
async haldBuy() {
console.log(this.logined, "logined");
if (!this.logined) {
await this.chainManager.login();
}
try {
this.showLoading();
const nftres = await this.chainManager.bc.beginApproveBuy(
@ -99,7 +108,6 @@ export default {
}
},
async handBeginBuy() {
try {
this.showLoading();
const nftres = await this.chainManager.bc.beginBuy(
@ -113,9 +121,9 @@ export default {
this.$emit("handMessageHide");
this.closeTip();
this.$emit("on-close");
setTimeout(()=>{
setTimeout(() => {
this.$emit("getMarketNftList");
},1000)
}, 1000);
}, 1000);
}
} catch (err) {
@ -138,7 +146,6 @@ export default {
},
closeTip() {
this.$emit("handBuyHide");
},
},
};

View File

@ -114,7 +114,7 @@ export default {
cunout: 1,
orderId: 9,
dialogVisible: false,
visible:this.isPiecePut,
visible: this.isPiecePut,
isWeapon: false,
isApprove: false,
options: [],
@ -182,16 +182,16 @@ export default {
if (nftres.status == true) {
this.hideLoading();
this.$emit("handMessage", 1);
setTimeout(() => {
this.$emit("handMessageHide");
this.closeTip();
this.type == "piece"
? this.$emit("closeTip", false)
: this.$emit("on-close");
setTimeout(() => {
this.$emit("getMarketNftList");
this.$emit("handMessageHide");
this.closeTip();
this.type == "piece"
? this.$emit("closeTip", false)
: this.$emit("on-close");
setTimeout(() => {
this.$emit("getMarketNftList");
}, 1000);
}, 1000);
}, 1000);
}
} catch (err) {
this.hideLoading();
@ -199,6 +199,10 @@ export default {
console.log("query order status error", err);
}
} else {
if (!this.currencyTypeList || this.currencyTypeList.length === 0) {
this.$emit("handMessage", 0);
return;
}
switch (this.type) {
case "hero":
this.nft_Token = CONTRACT_ADDRESS[AppModule.chainId].hero;
@ -213,7 +217,7 @@ export default {
this.nft_Token = CONTRACT_ADDRESS[AppModule.chainId].piece;
break;
}
try {
this.showLoading();
const nftres = await this.chainManager.bc.beginApproveSell(
@ -233,7 +237,6 @@ export default {
this.hideLoading();
this.isApprove = false;
this.$emit("handMessage", 0);
}
}
}
@ -261,7 +264,6 @@ export default {
break;
}
try {
this.showLoading();
const nftres = await this.chainManager.bc.beginNftSell(
this.nft_Token,

View File

@ -91,6 +91,7 @@
<script>
import { AppModule } from "@/store/modules/app";
import { UserModule } from "@/store/modules/user";
import { CONTRACT_ADDRESS } from "@/configs/config_chain";
import { formatPrice } from "@/utils/chain.util";
import ChainManager from "@/chain/ChainManager";
@ -107,8 +108,16 @@ export default {
dialogVisible: false,
};
},
computed: {
logined() {
return !!UserModule.token && !!AppModule.step;
},
},
methods: {
async haldBuy() {
if (!this.logined) {
await this.chainManager.login();
}
try {
this.showLoading();
const nftres = await this.chainManager.bc.beginApproveBuy(