panhui 3 years ago
parent
commit
9662cb2f45
3 changed files with 61 additions and 38 deletions
  1. 1 1
      .env.development
  2. 8 7
      src/components/asset/assetInfoSe.vue
  3. 52 30
      src/views/Store.vue

+ 1 - 1
.env.development

@@ -1,4 +1,4 @@
-VUE_APP_BASE_URL=https://www.raex.vip/
+VUE_APP_BASE_URL=https://test.raex.vip/
 NODE_ENV=development
 NODE_ENV=development
 VUE_APP_PUBLIC_PATH=/
 VUE_APP_PUBLIC_PATH=/
 ASSETS_PATH=raex
 ASSETS_PATH=raex

+ 8 - 7
src/components/asset/assetInfoSe.vue

@@ -11,8 +11,8 @@
     >
     >
         <van-image
         <van-image
             v-if="opened === false"
             v-if="opened === false"
-            width="21.3vw"
-            height="21.3vw"
+            width="80"
+            height="80"
             radius="8"
             radius="8"
             :src="require('../../assets/manghe.png')"
             :src="require('../../assets/manghe.png')"
             fit="cover"
             fit="cover"
@@ -21,16 +21,16 @@
             <van-image
             <van-image
                 class="icon-img"
                 class="icon-img"
                 radius="8"
                 radius="8"
-                width="21.3vw"
-                height="21.3vw"
+                width="80"
+                height="80"
                 :src="getImg(changeImgs(info.pic))"
                 :src="getImg(changeImgs(info.pic))"
                 fit="cover"
                 fit="cover"
             />
             />
             <van-image
             <van-image
                 class="more-img"
                 class="more-img"
                 radius="8"
                 radius="8"
-                width="21.3vw"
-                height="21.3vw"
+                width="80"
+                height="80"
                 :src="getImg(changeImgs(info.pic))"
                 :src="getImg(changeImgs(info.pic))"
                 fit="cover"
                 fit="cover"
                 v-if="isMore"
                 v-if="isMore"
@@ -121,12 +121,13 @@ export default {
 
 
 <style lang="less" scoped>
 <style lang="less" scoped>
 .product {
 .product {
-    width: 21.3vw;
+    width: 80px;
     display: inline-block;
     display: inline-block;
     border-radius: 8px;
     border-radius: 8px;
     overflow: hidden;
     overflow: hidden;
     position: relative;
     position: relative;
     margin: 8px;
     margin: 8px;
+    flex-shrink: 0;
 
 
     .icon-img {
     .icon-img {
         overflow: hidden;
         overflow: hidden;

+ 52 - 30
src/views/Store.vue

@@ -319,11 +319,7 @@ export default {
             }
             }
         },
         },
         sort() {
         sort() {
-            if (this.active == 'explore') {
-                return 'assetId,desc';
-            } else {
-                return 'createdAt,desc';
-            }
+            return 'createdAt,desc';
         },
         },
         url() {
         url() {
             if (this.active === 'coupon') {
             if (this.active === 'coupon') {
@@ -358,32 +354,58 @@ export default {
         this.emitter.on('updateList', info => {
         this.emitter.on('updateList', info => {
             console.log(info);
             console.log(info);
             let list = [...this.list];
             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];
             // let list = [...this.list];
             // list.forEach((item, index) => {
             // list.forEach((item, index) => {
             //     if (item.id === info.id) {
             //     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';
                 return item.status !== 'DESTROYED';
             });
             });
             this.$toast.clear();
             this.$toast.clear();
@@ -761,7 +783,7 @@ export default {
 }
 }
 
 
 .wrapper-box {
 .wrapper-box {
-    width: 314px;
+    width: 306px;
     height: 394px;
     height: 394px;
     background: rgba(255, 255, 255, 0.1);
     background: rgba(255, 255, 255, 0.1);
     border-radius: 16px;
     border-radius: 16px;