This commit is contained in:
huangjinming 2022-12-14 19:20:25 +08:00
parent cb07039bc1
commit 1e386e81bd
9 changed files with 102 additions and 70 deletions

View File

@ -26,6 +26,7 @@
@searchClear="searchClear" @searchClear="searchClear"
:value="value" :value="value"
:chipOptions="chipOptions" :chipOptions="chipOptions"
@chipStatus="chipStatus"
:chipList="chipList" :chipList="chipList"
:isType="isType" :isType="isType"
></Chipfilter> ></Chipfilter>
@ -33,6 +34,7 @@
v-else-if="nftType - 1 == 3" v-else-if="nftType - 1 == 3"
@searchClear="searchClear" @searchClear="searchClear"
:pieceList="pieceList" :pieceList="pieceList"
@pieceStatus="pieceStatus"
:pieceOptions="pieceOptions" :pieceOptions="pieceOptions"
:value="value" :value="value"
:isType="isType" :isType="isType"
@ -57,8 +59,8 @@ export default {
"chipList", "chipList",
"pieceList", "pieceList",
"pieceOptions", "pieceOptions",
'chipOptions', "chipOptions",
'weaponOptions' "weaponOptions",
], ],
components: { components: {
Herofilter, Herofilter,
@ -81,6 +83,12 @@ export default {
jobStatus(item) { jobStatus(item) {
this.$emit("jobStatus", item); this.$emit("jobStatus", item);
}, },
chipStatus(item) {
this.$emit("chipStatus", item);
},
pieceStatus(item) {
this.$emit("chipStatus", item);
},
heroLevelChange(levelSlider) { heroLevelChange(levelSlider) {
console.log(levelSlider, "levelSlider2"); console.log(levelSlider, "levelSlider2");
this.$emit("heroLevelChange", levelSlider); this.$emit("heroLevelChange", levelSlider);

View File

@ -25,7 +25,7 @@ import Close from "./Close.vue";
export default { export default {
components: { Close }, components: { Close },
props: ["dialogVisible", "data", "isType"], props: [ "data", "isType"],
data() { data() {
return { return {
dialogVisible: false, dialogVisible: false,

View File

@ -17,12 +17,12 @@
class="se" class="se"
v-model="value" v-model="value"
:popper-append-to-body="false" :popper-append-to-body="false"
@change="handSelect" @change="handSortSelect"
placeholder="请选择" placeholder="请选择"
popper-class="select-popper" popper-class="select-popper"
> >
<el-option <el-option
v-for="item in options" v-for="item in sortOptions"
:key="item.value" :key="item.value"
:label="item.label" :label="item.label"
:value="item.value" :value="item.value"
@ -38,9 +38,10 @@ import { Component, Prop, Vue } from "vue-property-decorator";
@Component({ @Component({
name: "NftTypeBar", name: "NftTypeBar",
components: {}, components: {},
props:['sortOptions','selectIdx']
}) })
export default class NftTypeBar extends Vue { export default class NftTypeBar extends Vue {
@Prop() private selectIdx: number; // @Prop() private selectIdx: number;
private types = [ private types = [
{ Image: require("../../assets/market/hero.png") }, { Image: require("../../assets/market/hero.png") },
{ Image: require("../../assets/market/weapon.png") }, { Image: require("../../assets/market/weapon.png") },
@ -48,35 +49,14 @@ export default class NftTypeBar extends Vue {
{ Image: require("../../assets/market/piece.png") }, { Image: require("../../assets/market/piece.png") },
// { Image: require("../../assets/market/voucher.png") }, // { Image: require("../../assets/market/voucher.png") },
]; ];
options = [
{
value: "1",
label: "Recently",
},
{
value: "2",
label: "Highest Price",
},
{
value: "3",
label: "Maximum Quality ",
},
{
value: "4",
label: "Maximun Level ",
},
{
value: "5",
label: "Maximum Energy",
},
];
value = ""; value = "";
private onClickItem(idx: number) { private onClickItem(idx: number) {
this.$emit("nft-type-changed", idx + 1); this.$emit("nft-type-changed", idx + 1);
} }
public handSelect(value: any) { handSortSelect(value: any) {
console.log(value); console.log(value);
this.$emit("handSelect", value); this.$emit("handSortSelect", value);
} }
} }
</script> </script>

View File

@ -6,7 +6,7 @@
v-model="value" v-model="value"
:popper-append-to-body="false" :popper-append-to-body="false"
@change="handSelect" @change="handSelect"
placeholder="请选择" placeholder="all"
popper-class="select-popper" popper-class="select-popper"
> >
<el-option <el-option

View File

@ -33,17 +33,13 @@ export default {
// }, // },
methods: { methods: {
searchClear() { searchClear() {
this.$emit("searchClear", this.value); // this.$emit("searchClear", this.value);
console.log(this.value,'this.value ');
this.value =''
}, },
search() { search() {
this.$emit("Search",this.value);
this.$emit("heroSearch",this.value);
console.log(this.value,'dsfsdfs1');
// clearTimeout(this.timer);
// this.timer = setTimeout(() => {
// //
// console.log(this.value);
// }, 1000); //
}, },
disable(fn, delay) { disable(fn, delay) {
let timer = null; let timer = null;

View File

@ -18,7 +18,7 @@
</div> </div>
<div class="job-options"> <div class="job-options">
<div class="job-item" v-for="(item, i) in chipList" :key="i"> <div class="job-item" v-for="(item, i) in chipList" :key="i">
<div @click="jobStatus(item)"> <div @click="chipStatus(item)">
<img <img
width="66px" width="66px"
v-if="item.jobType === true" v-if="item.jobType === true"
@ -134,8 +134,9 @@ export default {
}, },
methods: { methods: {
jobStatus(item) { chipStatus(item) {
this.jobList[item.id].jobType = !this.jobList[item.id].jobType; console.log(item,'chipStatus')
this.$emit("chipStatus",item);
}, },
searchClear() { searchClear() {
// this.hero = ""; // this.hero = "";

View File

@ -5,7 +5,7 @@
<SearchInput <SearchInput
:heroValue="heroValue" :heroValue="heroValue"
@searchClear="searchClear" @searchClear="searchClear"
@heroSearch="heroSearch" @Search="heroSearch"
/> />
<PropertySelect <PropertySelect
:options="options" :options="options"
@ -134,11 +134,10 @@ export default {
this.priceMax = ""; this.priceMax = "";
}, },
handSelect(value) { handSelect(value) {
console.log(value, "1");
this.$emit("handSelect", value); this.$emit("handSelect", value);
}, },
heroLevelChange(levelSlider) { heroLevelChange(levelSlider) {
console.log(levelSlider, "levelSlider");
this.$emit("heroLevelChange", levelSlider); this.$emit("heroLevelChange", levelSlider);
}, },
levelonChange(newVal2) { levelonChange(newVal2) {

View File

@ -18,7 +18,7 @@
</div> </div>
<div class="job-options"> <div class="job-options">
<div class="job-item" v-for="(item, i) in pieceList" :key="i"> <div class="job-item" v-for="(item, i) in pieceList" :key="i">
<div @click="jobStatus(item)"> <div @click="pieceStatus(item)">
<img <img
width="66px" width="66px"
v-if="item.jobType === true" v-if="item.jobType === true"
@ -135,8 +135,8 @@ export default {
}, },
methods: { methods: {
jobStatus(item) { pieceStatus(item) {
this.jobList[item.id].jobType = !this.jobList[item.id].jobType; this.$emit("pieceStatus", item);
}, },
searchClear() { searchClear() {
// this.hero = ""; // this.hero = "";

View File

@ -16,6 +16,8 @@
:heroValue="heroValue" :heroValue="heroValue"
:jobList="jobList" :jobList="jobList"
@jobStatus="jobStatus" @jobStatus="jobStatus"
@chipStatus="chipStatus"
@pieceStatus="pieceStatus"
:chipList="chipList" :chipList="chipList"
:pieceList="pieceList" :pieceList="pieceList"
:selectValue="selectValue" :selectValue="selectValue"
@ -27,6 +29,8 @@
<div class="right-part"> <div class="right-part">
<nft-type-bar <nft-type-bar
:select-idx="nftType" :select-idx="nftType"
:sortOptions="sortOptions"
@handSortSelect="handSortSelect"
@nft-type-changed="onNftTypeClicked" @nft-type-changed="onNftTypeClicked"
class="left-bar" class="left-bar"
></nft-type-bar> ></nft-type-bar>
@ -348,27 +352,47 @@ export default class MyNft extends Vue {
label: "Trigger", label: "Trigger",
}, },
{ {
value: 110240 , value: 110240,
label: "Ammo", label: "Ammo",
}, },
{ {
value: 110250 , value: 110250,
label: "Bolt", label: "Bolt",
}, },
{ {
value: 110260 , value: 110260,
label: "Barrel", label: "Barrel",
}, },
{ {
value: 110270 , value: 110270,
label: "Grip", label: "Grip",
}, },
{ {
value: 110280 , value: 110280,
label: "Clip", label: "Clip",
}, },
];
sortOptions = [
{
value: "1",
label: "Recently",
},
{
value: "2",
label: "Highest Price",
},
{
value: "3",
label: "Maximum Quality ",
},
{
value: "4",
label: "Maximun Level ",
},
{
value: "5",
label: "Maximum Energy",
},
]; ];
jobList = [ jobList = [
{ {
@ -462,12 +486,6 @@ export default class MyNft extends Vue {
heroSearch(value: string) { heroSearch(value: string) {
this.searchFilters = value; this.searchFilters = value;
debounce(this.getHeroNftList(this.currentPage), 2000); debounce(this.getHeroNftList(this.currentPage), 2000);
// clearTimeout(this.timer);
// this.timer = setTimeout(() => {
// //
// console.log(value, "-==-=");
// }, 1000); //
} }
searchClear(hero: string) { searchClear(hero: string) {
console.log(hero, "herio2020"); console.log(hero, "herio2020");
@ -476,6 +494,10 @@ export default class MyNft extends Vue {
this.searchFilters = value; this.searchFilters = value;
this.getHeroNftList(this.currentPage); this.getHeroNftList(this.currentPage);
} }
handSortSelect(value: string | number) {
this.orderMethod = value;
this.getHeroNftList(this.currentPage);
}
jobStatus(item: any) { jobStatus(item: any) {
this.jobList[item.id].jobType = !this.jobList[item.id].jobType; this.jobList[item.id].jobType = !this.jobList[item.id].jobType;
@ -485,13 +507,43 @@ export default class MyNft extends Vue {
let arry = list.map((item) => { let arry = list.map((item) => {
return item.id; return item.id;
}); });
console.log(arry.join("|"), "list");
let newArray = arry.map(function (index) { let newArray = arry.map(function (index) {
return index + 1; return index + 1;
}); });
this.jobFilters = newArray.join("|"); this.jobFilters = newArray.join("|");
this.getHeroNftList(this.currentPage); this.getHeroNftList(this.currentPage);
} }
pieceStatus(item: any) {
this.pieceList[item.id].jobType = !this.pieceList[item.id].jobType;
let list = this.pieceList.filter((item) => {
return item.jobType == true;
});
let arry = list.map((item) => {
return item.id;
});
let newArray = arry.map(function (index) {
return index + 1;
});
// this.jobFilters = newArray.join("|");
// this.getHeroNftList(this.currentPage);
}
chipStatus(item: any) {
this.chipList[item.id].jobType = !this.chipList[item.id].jobType;
let list = this.chipList.filter((item) => {
return item.jobType == true;
});
let arry = list.map((item) => {
return item.id;
});
let newArray = arry.map(function (index) {
return index + 1;
});
// this.jobFilters = newArray.join("|");
// this.getHeroNftList(this.currentPage);
}
heroLevelChange(levelSlider: any) { heroLevelChange(levelSlider: any) {
this.lvFilter = levelSlider; this.lvFilter = levelSlider;
this.getHeroNftList(this.currentPage); this.getHeroNftList(this.currentPage);
@ -512,7 +564,6 @@ export default class MyNft extends Vue {
order_method: this.orderMethod, order_method: this.orderMethod,
}; };
const res: any = await queryNftList(reqData); const res: any = await queryNftList(reqData);
console.log(res, "hero");
if (res.nfts) { if (res.nfts) {
let list = res.nfts; let list = res.nfts;
this.nftList = list.filter((item: any) => { this.nftList = list.filter((item: any) => {
@ -533,7 +584,6 @@ export default class MyNft extends Vue {
this.nftType = typeId; this.nftType = typeId;
// this.fetchDatas(1); // this.fetchDatas(1);
this.getHeroNftList(this.currentPage); this.getHeroNftList(this.currentPage);
console.log("2222222222222");
} }
} }
sliderChange() {} sliderChange() {}
@ -558,9 +608,7 @@ export default class MyNft extends Vue {
if (this.isLogin) { if (this.isLogin) {
// this.fetchDatas(this.currentPage); // this.fetchDatas(this.currentPage);
this.checkOrderHistory(); this.checkOrderHistory();
console.log("-----------------");
this.getHeroNftList(this.currentPage); this.getHeroNftList(this.currentPage);
console.log("2222222222222");
} else { } else {
this.resetData(); this.resetData();
} }