|
|
@@ -319,11 +319,7 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
sort() {
|
|
|
- if (this.active == 'explore') {
|
|
|
- return 'assetId,desc';
|
|
|
- } else {
|
|
|
- return 'createdAt,desc';
|
|
|
- }
|
|
|
+ return 'createdAt,desc';
|
|
|
},
|
|
|
url() {
|
|
|
if (this.active === 'coupon') {
|
|
|
@@ -358,32 +354,58 @@ export default {
|
|
|
this.emitter.on('updateList', info => {
|
|
|
console.log(info);
|
|
|
let list = [...this.list];
|
|
|
- list.forEach((item, index) => {
|
|
|
- if (item.id === info.id || item.assetId === info.id) {
|
|
|
- list[index] = {
|
|
|
- ...item,
|
|
|
- ...info,
|
|
|
- num: item.num,
|
|
|
- id: item.id,
|
|
|
- assetId: item.assetId
|
|
|
- };
|
|
|
- if (info.status === 'DESTROYED') {
|
|
|
- list.splice(index, 1);
|
|
|
+ let assetList = [...this.assetList];
|
|
|
+ if (assetList.length == 1) {
|
|
|
+ this.show = false;
|
|
|
+ }
|
|
|
+ if (!this.show) {
|
|
|
+ list.forEach((item, index) => {
|
|
|
+ if (item.id === info.id || item.assetId === info.id) {
|
|
|
+ list[index] = {
|
|
|
+ ...item,
|
|
|
+ ...info,
|
|
|
+ num: item.num,
|
|
|
+ id: item.id,
|
|
|
+ assetId: item.assetId
|
|
|
+ };
|
|
|
+ if (info.status === 'DESTROYED') {
|
|
|
+ list.splice(index, 1);
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
- });
|
|
|
- this.list = list;
|
|
|
+ });
|
|
|
+ this.list = list;
|
|
|
+ }
|
|
|
|
|
|
- let assetList = [...this.assetList];
|
|
|
- assetList.forEach((item, index) => {
|
|
|
- if (item.id === info.id) {
|
|
|
- assetList[index] = info;
|
|
|
- if (info.status === 'DESTROYED') {
|
|
|
- assetList.splice(index, 1);
|
|
|
+ if (assetList.length > 1) {
|
|
|
+ assetList.forEach((item, index) => {
|
|
|
+ if (item.id === info.id) {
|
|
|
+ assetList[index] = info;
|
|
|
+ if (info.status === 'DESTROYED') {
|
|
|
+ assetList.splice(index, 1);
|
|
|
+ let _index = [...this.list].findIndex(item => {
|
|
|
+ return item.prefixName === this.moreTitle;
|
|
|
+ });
|
|
|
+ let _info = {};
|
|
|
+ if (_index !== -1) {
|
|
|
+ _info = { ...this.list[_index] };
|
|
|
+ _info.num = _info.num - 1;
|
|
|
+ }
|
|
|
+ if (index === 0) {
|
|
|
+ _info = {
|
|
|
+ ..._info,
|
|
|
+ ...assetList[0],
|
|
|
+ num: _info.num,
|
|
|
+ id: _info.id,
|
|
|
+ assetId: assetList[0].id
|
|
|
+ };
|
|
|
+ }
|
|
|
+ this.list[_index] = _info;
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
- });
|
|
|
- this.assetList = assetList;
|
|
|
+ });
|
|
|
+ this.assetList = assetList;
|
|
|
+ }
|
|
|
+
|
|
|
// let list = [...this.list];
|
|
|
// list.forEach((item, index) => {
|
|
|
// if (item.id === info.id) {
|
|
|
@@ -391,7 +413,7 @@ export default {
|
|
|
// }
|
|
|
// });
|
|
|
|
|
|
- this.list = list.filter(item => {
|
|
|
+ this.list = [...this.list].filter(item => {
|
|
|
return item.status !== 'DESTROYED';
|
|
|
});
|
|
|
this.$toast.clear();
|
|
|
@@ -761,7 +783,7 @@ export default {
|
|
|
}
|
|
|
|
|
|
.wrapper-box {
|
|
|
- width: 314px;
|
|
|
+ width: 306px;
|
|
|
height: 394px;
|
|
|
background: rgba(255, 255, 255, 0.1);
|
|
|
border-radius: 16px;
|