This commit is contained in:
huangjinming 2022-12-29 13:59:23 +08:00
parent 778006ad69
commit d3efb47e33
10 changed files with 125 additions and 113 deletions

View File

@ -1,6 +1,6 @@
<template>
<div class="container">
<Herofilter
<HeroFilter
v-if="nftType - 1 == 0"
@heroLevelChange="heroLevelChange"
@heroQuilityChange="heroQuilityChange"
@ -19,8 +19,8 @@
:isType="isType"
:priceMax="priceMax"
:priceMin="priceMin"
></Herofilter>
<Weaponfilter
></HeroFilter>
<WeaponFilter
v-else-if="nftType - 1 == 1"
@weaponSearch="weaponSearch"
@handWeaponSelect="handWeaponSelect"
@ -35,8 +35,8 @@
:isType="isType"
:priceMax="priceMax"
:priceMin="priceMin"
></Weaponfilter>
<Chipfilter
></WeaponFilter>
<ChipFilter
v-else-if="nftType - 1 == 2"
@chipSearch="chipSearch"
@handChipSelect="handChipSelect"
@ -51,8 +51,8 @@
:isType="isType"
:priceMax="priceMax"
:priceMin="priceMin"
></Chipfilter>
<Piecefilter
></ChipFilter>
<PieceFilter
v-else-if="nftType - 1 == 3"
@pieceSearch="pieceSearch"
@handPieceSelect="handPieceSelect"
@ -66,15 +66,15 @@
:isType="isType"
:priceMax="priceMax"
:priceMin="priceMin"
></Piecefilter>
></PieceFilter>
</div>
</template>
<script>
import Herofilter from "@/components/market/filters/Herofilter";
import Weaponfilter from "@/components/market/filters/Weaponfilter";
import Chipfilter from "@/components/market/filters/Chipfilter";
import Piecefilter from "@/components/market/filters/Piecefilter";
import HeroFilter from "@/components/market/filters/HeroFilter";
import WeaponFilter from "@/components/market/filters/WeaponFilter";
import ChipFilter from "@/components/market/filters/ChipFilter";
import PieceFilter from "@/components/market/filters/PieceFilter";
export default {
props: [
'priceMax',
@ -93,10 +93,10 @@ export default {
"weaponOptions",
],
components: {
Herofilter,
Chipfilter,
Weaponfilter,
Piecefilter,
HeroFilter,
ChipFilter,
WeaponFilter,
PieceFilter,
},
methods: {
sliderChange(value) {

View File

@ -45,7 +45,7 @@
<script lang="ts">
import { Component, Vue, Prop } from "vue-property-decorator";
import SortSelect from "@/components/market/SortSelect.vue";
import CardList from "@/components/market/CardList.vue";
import CardList from "@/components/market/HeroCardList.vue";
import DunList from "@/components/market/DunList.vue";
import ChipList from "@/components/market/ChipCardList.vue";
import PieceList from "@/components/market/nft/PieceNft.vue";

View File

@ -80,8 +80,8 @@ import WeaponSellTop from "./WeaponSellTop.vue";
import PieceSellTop from "./PieceSellTop.vue";
import HeroSellTop from "./HeroSellTop.vue";
import ChipSellTop from "./ChipSellTop.vue";
import { getSupportedCurrenTypes } from "@/api/Market";
import { AppModule } from "@/store/modules/app";
import { sellMyNft } from "@/api/Market";
import { CONTRACT_ADDRESS } from "@/configs/config_chain";
import ChainManager from "@/chain/ChainManager";
@ -107,13 +107,13 @@ export default {
};
},
created() {
// if (this.options.length > 0) {
// return;
// } else {
// this.getOption();
// }
// console.log(this.currencyTypeList.length,'this.currencyTypeList');
if (this.currencyTypeList.length > 0 && this.currencyTypeList) {
this.value = this.currencyTypeList[0].address;
console.log(this.options, "87887");
}else{
return false
}
// this.value = this.currencyTypeList[0].address;
},
methods: {
closeTip() {
@ -121,62 +121,57 @@ export default {
},
async handMessage() {
// this.$emit("handMessage");
// const data = {
// nft_token: this.piece
// ? this.piece.detail.token_id
// : this.data.detail.token_id,
// s_price: this.price,
// amount: this.piece ? this.cunout : null,
// };
// const res = await sellMyNft(data);
switch (this.type) {
case "hero":
console.log(this.type, "-=-", AppModule.chainId);
"1338";
console.log(CONTRACT_ADDRESS[AppModule.chainId]);
this.nft_Token = CONTRACT_ADDRESS["1338"].hero;
break;
case "weapon":
this.nft_Token = CONTRACT_ADDRESS["1338"].weapon;
break;
case "chip":
this.nft_Token = CONTRACT_ADDRESS["1338"].chip;
break;
case "piece":
this.nft_Token = CONTRACT_ADDRESS["1338"].piece;
break;
}
try {
const shellData = {
nftToken: this.nft_Token,
currency: this.value,
tokenId: this.piece
const data = {
nft_token: this.piece
? this.piece.detail.token_id
: this.data.detail.token_id,
s_price: this.price,
amount: this.piece ? this.cunout : 1,
price: this.price,
marketAddress: CONTRACT_ADDRESS["1338"].address,
};
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["1338"].address
);
console.log(nftres, "beginSell");
} catch (err) {
console.log("query order status error", err);
}
},
async getOption() {
const res = await getSupportedCurrenTypes();
this.options = res.list;
this.value = this.options[0].address;
const res = await sellMyNft(data);
// switch (this.type) {
// case "hero":
// console.log(this.type, "-=-", AppModule.chainId);
// "1338";
// console.log(CONTRACT_ADDRESS[AppModule.chainId]);
// this.nft_Token = CONTRACT_ADDRESS["1338"].hero;
// break;
// case "weapon":
// this.nft_Token = CONTRACT_ADDRESS["1338"].weapon;
// break;
// case "chip":
// this.nft_Token = CONTRACT_ADDRESS["1338"].chip;
// break;
// case "piece":
// this.nft_Token = CONTRACT_ADDRESS["1338"].piece;
// break;
// }
// try {
// const shellData = {
// nftToken: this.nft_Token,
// currency: this.value,
// tokenId: this.piece
// ? this.piece.detail.token_id
// : this.data.detail.token_id,
// amount: this.piece ? this.cunout : 1,
// price: this.price,
// marketAddress: CONTRACT_ADDRESS["1338"].address,
// };
// 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["1338"].address
// );
// console.log(nftres, "beginSell");
// } catch (err) {
// console.log("query order status error", err);
// }
},
init(data) {
this.dialogVisible = true;

View File

@ -49,7 +49,7 @@
</div>
</div>
</div>
<Chipdialog
<ChipDialog
:dialogVisible="dialogVisible"
@on-close="chipDialoghide"
@on-click="chipDialog"
@ -62,7 +62,7 @@
:data="chip"
:isType="isType"
:isPiecePut="isPiecePut"
></Chipdialog>
></ChipDialog>
<ChipBuyDialog
:type="type"
:isBuy="isBuy"
@ -70,9 +70,10 @@
@handBuyShow="handBuyShow"
@handBuyHide="handBuyHide"
></ChipBuyDialog>
<PriceSetting
<TheSellDialog
:type="type"
:data="chip"
v-if="currencyTypeList"
:currencyTypeList="currencyTypeList"
:isPiecePut="isPiecePut"
@handPutShow="handPutShow"
@ -82,14 +83,14 @@
</template>
<script>
import Chipdialog from "../Chipdialog.vue";
import ChipDialog from "../ChipDialog.vue";
import ChipBuyDialog from "../ChipBuyDialog.vue";
import PriceSetting from "../TheSellDialog.vue";
import TheSellDialog from "../TheSellDialog.vue";
export default {
props: ["chip", "isType",'currencyTypeList'],
components: {
Chipdialog,
PriceSetting,
ChipDialog,
TheSellDialog,
ChipBuyDialog,
},
data() {

View File

@ -1,6 +1,6 @@
<template>
<div>
<div class="container" @click="HeroDialog(data)">
<div class="container" @click="heroDialog(data)">
<!-- <div class="no-sale">
<div class="for-rent">
<div class="for-rent-img">
@ -55,7 +55,7 @@
</div>
<div class="info">
<div class="info-level">
Lv: <span></span>
<span>Lv:</span>
<span class="level"> {{ fillZero(levelNumber) }}</span>
</div>
@ -88,9 +88,9 @@
</div>
</div>
</div>
<Herodialog
<HeroDialog
:dialogVisible="dialogVisible"
@on-close="HeroDialoghide"
@on-close="heroDialoghide"
:isTab="isTab"
:isType="isType"
:type="type"
@ -99,16 +99,17 @@
@handBuyHide="handBuyHide"
@closeTip="closeTip"
@showTip="showTip"
@on-click="HeroDialog"
@on-click="heroDialog"
:isPiecePut="isPiecePut"
@handPutShow="handPutShow"
@handPutHide="handPutHide"
:hero="data"
></Herodialog>
></HeroDialog>
<TheSellDialog
:type="type"
:isPiecePut="isPiecePut"
:data="data"
v-if="currencyTypeList"
:currencyTypeList="currencyTypeList"
@handPutShow="handPutShow"
@handPutHide="handPutHide"
@ -123,15 +124,15 @@
</div>
</template>
<script lang="ts">
import { Component, Prop, Vue, Watch } from "vue-property-decorator";
import Herodialog from "../Herodialog.vue";
import { Component, Vue, Watch } from "vue-property-decorator";
import HeroDialog from "../HeroDialog.vue";
import HeroBuyDialog from "../HeroBuyDialog.vue";
import TheSellDialog from "../TheSellDialog.vue";
@Component({
name: "HeroNft",
components: {
Herodialog,
HeroDialog,
TheSellDialog,
HeroBuyDialog,
},
@ -208,11 +209,11 @@ export default class HeroNft extends Vue {
get qualityNumber() {
return this.data.detail.quality;
}
HeroDialog(data: void) {
heroDialog(data: void) {
this.dialogVisible = true;
}
HeroDialoghide(data: boolean) {
heroDialoghide(data: boolean) {
this.dialogVisible = data;
}
handPutShow() {
@ -297,7 +298,7 @@ export default class HeroNft extends Vue {
background: url("../../../assets/market/hero/name-bg.png") no-repeat;
background-size: 100% 100%;
position: absolute;
right: 24px;
right: 23px;
text-align: center;
color: #fff;
bottom: 5px;
@ -314,6 +315,7 @@ export default class HeroNft extends Vue {
}
.info-level {
color: #454545;
font-size: 16px;
font-style: italic;
margin-left: 20px;
}

View File

@ -81,6 +81,7 @@
ref="selldialog"
:type="type"
:isPiecePut="isPiecePut"
v-if="currencyTypeList"
:currencyTypeList="currencyTypeList"
@handMessage="handMessage"
@handPutShow="handPutShow"
@ -98,7 +99,7 @@
</template>
<script>
import Piecedialog from "../Piecedialog.vue";
import PieceDialog from "../PieceDialog";
import TheSell from "../TheSellDialog.vue";
import ChipBuyDialog from "../ChipBuyDialog.vue";
import MessageBox from "../MessageBox.vue";
@ -106,7 +107,7 @@ import WeaponBuyDialog from "../WeaponBuyDialog.vue";
export default {
props: ["isType", "nftList",'currencyTypeList'],
components: {
Piecedialog,
PieceDialog,
TheSell,
WeaponBuyDialog,
ChipBuyDialog,

View File

@ -61,7 +61,7 @@
</div>
</div>
</div>
<Dundialog
<DunDialog
:dialogVisible="dialogVisible"
@on-close="chipDialogHide"
@on-click="chipDialog"
@ -77,10 +77,11 @@
@handBuyHide="handBuyHide"
@handPutShow="handPutShow"
@handPutHide="handPutHide"
></Dundialog>
></DunDialog>
<TheSellDialog
:type="type"
:data="weapon"
v-if="currencyTypeList"
:currencyTypeList="currencyTypeList"
:isPiecePut="isPiecePut"
@handPutShow="handPutShow"
@ -97,14 +98,14 @@
</template>
<script>
import Dundialog from "../Dundialog.vue";
import DunDialog from "../DunDialog";
import TheSellDialog from "../TheSellDialog.vue";
import TheBuyDialog from "../WeaponBuyDialog.vue";
export default {
props: ["weapon", "isType",'currencyTypeList'],
components: {
Dundialog,
DunDialog,
TheSellDialog,
TheBuyDialog,
},

View File

@ -75,6 +75,7 @@
<script lang="ts">
import { Component, Vue, Watch } from "vue-property-decorator";
import { ElLoadingComponent } from "element-ui/types/loading";
import SearchPanel from "@/components/market/SearchPanel.vue";
import ResultNo from "@/components/market/ResultNo.vue";
import Pagination from "@/components/market/Pagination.vue";
@ -107,6 +108,7 @@ export default class Market extends Vue {
nftType = 1;
nftList = [];
debounce: any = null;
loadingInstance: ElLoadingComponent;
private totalPage = 1;
private pageSize = 10;
private currentPage = 1;
@ -595,6 +597,7 @@ export default class Market extends Vue {
if (!AppModule.accountId) {
return;
}
this.showLoading();
const reqData: any = {
page_size: this.pageSize,
start: this.starts,
@ -616,7 +619,6 @@ export default class Market extends Vue {
return item.details !== null;
});
if (res) {
const page = res;
this.totalPage = parseInt(page.total) || 1;
@ -624,7 +626,7 @@ export default class Market extends Vue {
this.starts = page.start;
this.currentPage = page.start / page.page_size + 1;
}
this.hideLoading();
}
}
@Watch("isLogin")
@ -662,7 +664,13 @@ export default class Market extends Vue {
this.searchFilters = null;
this.getHeroNftList(this.starts);
}
showLoading() {
this.loadingInstance = this.$loading({ background: "rgba(0, 0, 0, 0.8)" });
}
hideLoading() {
this.loadingInstance?.close();
}
// this.isValue
sliderChange() {}
}

View File

@ -632,6 +632,7 @@ export default class MyNft extends Vue {
if (!AppModule.accountId) {
return;
}
this.showLoading();
const reqData: any = {
page_size: this.pageSize,
start: this.starts,
@ -651,7 +652,7 @@ export default class MyNft extends Vue {
this.nftList = list.filter((item: any) => {
return item.details !== null;
});
console.log(this.nftList, "-==========================");
// console.log(this.nftList, "-==========================");
if (res) {
const page = res;
@ -666,6 +667,9 @@ export default class MyNft extends Vue {
}
}
async getCurrencyType() {
if (this.currencyTypeList.length > 0) {
return false;
}
const res: any = await getSupportedCurrenTypes();
this.currencyTypeList = res.list;
// this.value = this.options[0].address;
@ -694,7 +698,7 @@ export default class MyNft extends Vue {
// this.fetchDatas(1);
this.getHeroNftList(this.starts);
}
this.getCurrencyType()
this.getCurrencyType();
}
sliderChange() {}
filterChange(id: number) {
@ -719,7 +723,7 @@ export default class MyNft extends Vue {
// this.fetchDatas(this.pageSize);
this.checkOrderHistory();
this.getHeroNftList(this.starts);
this.getCurrencyType()
this.getCurrencyType();
} else {
this.resetData();
}