fix
This commit is contained in:
parent
1ba20aa3b9
commit
bc9185d0d2
@ -465,7 +465,7 @@ export class Blockchain {
|
|||||||
.send({ gas: 1000000 })
|
.send({ gas: 1000000 })
|
||||||
}
|
}
|
||||||
|
|
||||||
public async beginBuy(orderId:string,marketAddress:string,price:string,currency:string){
|
public async beginBuy(orderId:string,price:number,currency:string,marketAddress:string){
|
||||||
const coinInstance: any = await this.getContractInstance(currency)
|
const coinInstance: any = await this.getContractInstance(currency)
|
||||||
const res = await coinInstance.methods.increaseAllowance(marketAddress, price).send({ gas: 1000000 })
|
const res = await coinInstance.methods.increaseAllowance(marketAddress, price).send({ gas: 1000000 })
|
||||||
const marketInstance: any = await this.getContractInstance(marketAddress, MARKET_ABI)
|
const marketInstance: any = await this.getContractInstance(marketAddress, MARKET_ABI)
|
||||||
|
@ -71,6 +71,8 @@ export default {
|
|||||||
try {
|
try {
|
||||||
const nftres = await this.chainManager.bc.beginBuy(
|
const nftres = await this.chainManager.bc.beginBuy(
|
||||||
this.orderId,
|
this.orderId,
|
||||||
|
this.data.s_price,
|
||||||
|
this.data.currency,
|
||||||
CONTRACT_ADDRESS[AppModule.chainId].marketDddress
|
CONTRACT_ADDRESS[AppModule.chainId].marketDddress
|
||||||
);
|
);
|
||||||
console.log(nftres, "beginSell");
|
console.log(nftres, "beginSell");
|
||||||
|
@ -276,8 +276,8 @@
|
|||||||
<div class="buy-price">
|
<div class="buy-price">
|
||||||
<div class="mynft" v-if="isType === 'mynft'">
|
<div class="mynft" v-if="isType === 'mynft'">
|
||||||
<div class="for-rent-btn" v-if="hero.selling > 0">
|
<div class="for-rent-btn" v-if="hero.selling > 0">
|
||||||
<div class="adjust" @click="handPutShow"></div>
|
<div class="adjust" @click="handPutShow(hero)"></div>
|
||||||
<div class="remove"></div>
|
<div class="remove" @click="handremove"></div>
|
||||||
</div>
|
</div>
|
||||||
<div v-else>
|
<div v-else>
|
||||||
<div class="rent"></div>
|
<div class="rent"></div>
|
||||||
@ -329,7 +329,9 @@ import AccountCard from "./AccountCard.vue";
|
|||||||
import ProgressCard from "./ProgressCard.vue";
|
import ProgressCard from "./ProgressCard.vue";
|
||||||
import LuckyValue from "./LuckyValue.vue";
|
import LuckyValue from "./LuckyValue.vue";
|
||||||
import MosaicChipDialog from "./MosaicChip.vue";
|
import MosaicChipDialog from "./MosaicChip.vue";
|
||||||
|
import { AppModule } from "@/store/modules/app";
|
||||||
|
import { CONTRACT_ADDRESS } from "@/configs/config_chain";
|
||||||
|
import ChainManager from "@/chain/ChainManager";
|
||||||
export default {
|
export default {
|
||||||
props: ["dialogVisible", "hero", "isType"],
|
props: ["dialogVisible", "hero", "isType"],
|
||||||
components: {
|
components: {
|
||||||
@ -344,6 +346,8 @@ export default {
|
|||||||
return {
|
return {
|
||||||
isTabs: false,
|
isTabs: false,
|
||||||
type: "hero",
|
type: "hero",
|
||||||
|
orderId: 1,
|
||||||
|
chainManager: new ChainManager(),
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
@ -355,6 +359,7 @@ export default {
|
|||||||
this.$emit("on-open");
|
this.$emit("on-open");
|
||||||
//如果需要传参的话,可以在"on-close"后面再加参数,然后在父组件的函数里接收就可以了。
|
//如果需要传参的话,可以在"on-close"后面再加参数,然后在父组件的函数里接收就可以了。
|
||||||
},
|
},
|
||||||
|
|
||||||
closeTip() {},
|
closeTip() {},
|
||||||
showTip() {
|
showTip() {
|
||||||
this.isTabs = true;
|
this.isTabs = true;
|
||||||
@ -380,14 +385,25 @@ export default {
|
|||||||
this.$emit("showTip", true);
|
this.$emit("showTip", true);
|
||||||
this.isTabs = true;
|
this.isTabs = true;
|
||||||
},
|
},
|
||||||
handPutShow() {
|
handPutShow(data) {
|
||||||
this.$emit("handPutShow");
|
this.$emit("handPutShow",data);
|
||||||
console.log("ppwowerw");
|
console.log("ppwowerw");
|
||||||
},
|
},
|
||||||
handBuyShow() {
|
handBuyShow() {
|
||||||
this.$emit("handBuyShow");
|
this.$emit("handBuyShow");
|
||||||
console.log("handBuyShow");
|
console.log("handBuyShow");
|
||||||
},
|
},
|
||||||
|
async handremove() {
|
||||||
|
try {
|
||||||
|
const nftres = await this.chainManager.bc.beginCancelOrder(
|
||||||
|
this.orderId,
|
||||||
|
CONTRACT_ADDRESS[AppModule.chainId].marketDddress
|
||||||
|
);
|
||||||
|
console.log(nftres, "beginSell");
|
||||||
|
} catch (err) {
|
||||||
|
console.log("query order status error", err);
|
||||||
|
}
|
||||||
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
@ -142,43 +142,56 @@ export default {
|
|||||||
this.$emit("handPutHide");
|
this.$emit("handPutHide");
|
||||||
},
|
},
|
||||||
async handMessage() {
|
async handMessage() {
|
||||||
switch (this.type) {
|
if (this.data.selling ? this.data.selling > 0 : this.price.selling > 0) {
|
||||||
case "hero":
|
try {
|
||||||
this.nft_Token = CONTRACT_ADDRESS[AppModule.chainId].hero;
|
const nftres = await this.chainManager.bc.beginUpdatePrice(
|
||||||
break;
|
this.orderId,
|
||||||
case "weapon":
|
this.price,
|
||||||
this.nft_Token = CONTRACT_ADDRESS[AppModule.chainId].weapon;
|
CONTRACT_ADDRESS[AppModule.chainId].marketDddress
|
||||||
break;
|
);
|
||||||
case "chip":
|
console.log(nftres, "beginSell");
|
||||||
this.nft_Token = CONTRACT_ADDRESS[AppModule.chainId].chip;
|
} catch (err) {
|
||||||
break;
|
console.log("query order status error", err);
|
||||||
case "piece":
|
}
|
||||||
this.nft_Token = CONTRACT_ADDRESS[AppModule.chainId].piece;
|
} else {
|
||||||
break;
|
switch (this.type) {
|
||||||
}
|
case "hero":
|
||||||
try {
|
this.nft_Token = CONTRACT_ADDRESS[AppModule.chainId].hero;
|
||||||
const shellData = {
|
break;
|
||||||
nftToken: this.nft_Token,
|
case "weapon":
|
||||||
currency: this.value,
|
this.nft_Token = CONTRACT_ADDRESS[AppModule.chainId].weapon;
|
||||||
tokenId: this.piece
|
break;
|
||||||
? this.piece.detail.token_id
|
case "chip":
|
||||||
: this.data.detail.token_id,
|
this.nft_Token = CONTRACT_ADDRESS[AppModule.chainId].chip;
|
||||||
amount: this.piece ? this.cunout : 1,
|
break;
|
||||||
price: this.price,
|
case "piece":
|
||||||
marketAddress: CONTRACT_ADDRESS[AppModule.chainId].address,
|
this.nft_Token = CONTRACT_ADDRESS[AppModule.chainId].piece;
|
||||||
};
|
break;
|
||||||
console.log(shellData, "shellData");
|
}
|
||||||
const nftres = await this.chainManager.bc.beginNftSell(
|
try {
|
||||||
this.nft_Token,
|
const shellData = {
|
||||||
this.value,
|
nftToken: this.nft_Token,
|
||||||
this.piece ? this.piece.detail.token_id : this.data.detail.token_id,
|
currency: this.value,
|
||||||
this.piece ? this.cunout : 1,
|
tokenId: this.piece
|
||||||
this.price,
|
? this.piece.detail.token_id
|
||||||
CONTRACT_ADDRESS[AppModule.chainId].marketDddress
|
: this.data.detail.token_id,
|
||||||
);
|
amount: this.piece ? this.cunout : 1,
|
||||||
console.log(nftres, "beginSell");
|
price: this.price,
|
||||||
} catch (err) {
|
marketAddress: CONTRACT_ADDRESS[AppModule.chainId].address,
|
||||||
console.log("query order status error", err);
|
};
|
||||||
|
console.log(shellData, "shellData");
|
||||||
|
const nftres = await this.chainManager.bc.beginNftSell(
|
||||||
|
this.nft_Token,
|
||||||
|
this.value,
|
||||||
|
this.piece ? this.piece.detail.token_id : this.data.detail.token_id,
|
||||||
|
this.piece ? this.cunout : 1,
|
||||||
|
this.price,
|
||||||
|
CONTRACT_ADDRESS[AppModule.chainId].marketDddress
|
||||||
|
);
|
||||||
|
console.log(nftres, "beginSell");
|
||||||
|
} catch (err) {
|
||||||
|
console.log("query order status error", err);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
init(data) {
|
init(data) {
|
||||||
|
@ -127,7 +127,9 @@ import { Component, Vue, Watch } from "vue-property-decorator";
|
|||||||
import Herodialog from "../HeroDialog.vue";
|
import Herodialog from "../HeroDialog.vue";
|
||||||
import HeroBuyDialog from "../HeroBuyDialog.vue";
|
import HeroBuyDialog from "../HeroBuyDialog.vue";
|
||||||
import TheSellDialog from "../TheSellDialog.vue";
|
import TheSellDialog from "../TheSellDialog.vue";
|
||||||
|
import { AppModule } from "@/store/modules/app";
|
||||||
|
import { CONTRACT_ADDRESS } from "@/configs/config_chain";
|
||||||
|
import ChainManager from "@/chain/ChainManager";
|
||||||
@Component({
|
@Component({
|
||||||
name: "HeroNft",
|
name: "HeroNft",
|
||||||
components: {
|
components: {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user