Prechádzať zdrojové kódy

Merge branch 'master' of http://git.izouma.com/xiongzhu/9th

xuqiang 4 rokov pred
rodič
commit
0dbcd76f59

+ 1 - 1
src/main/nine-space/src/views/Home.vue

@@ -158,7 +158,7 @@ export default {
                         page: 0,
                         query: { hasRole: 'ROLE_MINTER' },
                         size: 5,
-                        sort: 'createdAt,desc'
+                        sort: 'sales,desc'
                     },
                     { body: 'json' }
                 )

+ 46 - 2
src/main/nine-space/src/views/creator/Detail.vue

@@ -12,6 +12,8 @@
                         fit="cover"
                         @click="$router.push('/setting')"
                     />
+                    <img class="rank-icon" :src="rankInfo.img1" v-if="rankInfo.img1" alt="" />
+
                     <div class="text">
                         <div class="text1 van-ellipsis">{{ info.nickname }}</div>
                         <div class="text2">
@@ -92,7 +94,22 @@ import productInfo from '../../components/product/productInfo.vue';
 export default {
     components: { productInfo },
     computed: {
-        ...mapState(['userInfo'])
+        ...mapState(['userInfo']),
+        rankInfo() {
+            let index = [...this.hots].findIndex(item => {
+                return item.id === this.info.id;
+            });
+            let rank = index + 1;
+            if (rank) {
+                const colors = ['#FF8E12', '#C37BFF', '#3ACEFF'];
+                return {
+                    img1: require(`../../assets/NO${rank}.png`),
+                    img2: require(`../../assets/svgs/NOicon${rank}.svg`),
+                    color: colors[rank]
+                };
+            }
+            return {};
+        }
     },
     inject: ['bar'],
     data() {
@@ -102,11 +119,13 @@ export default {
             salable: '',
             stiky: null,
             list: [],
-            empty: false
+            empty: false,
+            hots: []
         };
     },
     mounted() {
         this.getInfo();
+        this.getHot();
     },
     methods: {
         copy() {
@@ -174,6 +193,22 @@ export default {
         changeMenu(menu) {
             this.type = menu;
             this.getList();
+        },
+        getHot() {
+            this.$http
+                .post(
+                    '/user/all',
+                    {
+                        page: 0,
+                        query: { hasRole: 'ROLE_MINTER' },
+                        size: 3,
+                        sort: 'sales,desc'
+                    },
+                    { body: 'json' }
+                )
+                .then(res => {
+                    this.hots = res.content;
+                });
         }
     }
 };
@@ -264,11 +299,20 @@ export default {
 .userInfo-top {
     display: flex;
     align-items: center;
+    position: relative;
     .van-image {
         border: 5px solid @bg;
         flex-shrink: 0;
     }
 
+    .rank-icon {
+        width: 90px;
+        height: 90px;
+        position: absolute;
+        top: -4px;
+        left: 0px;
+    }
+
     .text {
         margin: 0 40px 0 12px;
         overflow: hidden;