Sfoglia il codice sorgente

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

panhui 3 anni fa
parent
commit
9d9285c0c1

+ 9 - 1
src/components/PictureCropper.vue

@@ -24,6 +24,7 @@
 
 <script>
 import VuePictureCropper, { cropper } from 'vue-picture-cropper';
+import http from '../plugins/http';
 export default {
     data() {
         return {
@@ -59,13 +60,20 @@ export default {
             this.result.dataURL = base64;
             this.result.blobURL = URL.createObjectURL(blob);
             console.log(this.result);
-            this.updateFile({ file: file }, file.type).then(img => {
+            this.updateFile(base64).then(img => {
                 this.$toast.clear();
                 this.show = false;
                 this.$emit('updateImg', img);
             });
             // 隐藏裁切弹窗
             // this.isShowDialog = false;
+        },
+        updateFile(base64) {
+            const formData = new FormData();
+            formData.append('base64', base64);
+            return http.axios.post('/upload/base64', formData).then(res => {
+                return Promise.resolve(res.data);
+            });
         }
     },
     components: {

+ 7 - 3
src/mixins/common.js

@@ -53,9 +53,13 @@ export default {
             formData.append('width', size);
             formData.append('height', size);
             formData.append('size', size);
-            return http.axios.post('/upload/user', formData).then(res => {
-                return Promise.resolve(res.data);
-            });
+            return http.axios
+                .post('/upload/user', formData, {
+                    headers: { 'Content-Type': 'multipart/form-data' }
+                })
+                .then(res => {
+                    return Promise.resolve(res.data);
+                });
         },
         getImg(imgs = '', type = '', size = 800) {
             if (!imgs) {

+ 0 - 2
src/views/Home.vue

@@ -191,8 +191,6 @@ import banner from '../mixins/banner';
 import ProductLarge from '../components/product/productLarge.vue';
 import ProductSmall from '../components/product/productSmall.vue';
 import { mapState } from 'vuex';
-import NewsInfo from '../components/product/NewsInfo';
-import NewsSmall from '../components/product/NewsSmall.vue';
 import NewsRecord from '../components/product/NewsRecord.vue';
 import RankInfo from '../components/creator/RankInfo.vue';
 import HotCollect from '../components/product/HotCollect.vue';

+ 53 - 3
src/views/StarMap.vue

@@ -1,5 +1,13 @@
 <template>
-    <div class="container">
+    <van-pull-refresh
+        class="container"
+        success-text="加载成功"
+        success-duration="500"
+        v-model="isLoading"
+        :head-height="80"
+        @refresh="onRefresh"
+        pageType="light"
+    >
         <div class="bg">
             <img src="@assets/png-xingtu-bg.png" alt="" />
         </div>
@@ -32,20 +40,25 @@
         <van-list class="list" v-model:loading="loading" :finished="finished" finished-text="" @load="getData">
             <product-info v-for="(item, index) in list" dark :key="index" v-model:info="list[index]"></product-info>
         </van-list>
-    </div>
+
+        <img src="../assets/png-zhiding.png" @click="goTop" class="goTop" v-if="bodyScroll > 200" alt="" />
+    </van-pull-refresh>
 </template>
 
 <script>
 import list from '../mixins/list';
 import ProductInfo from '../components/product/productInfo.vue';
 export default {
+    name: 'starMap',
     mixins: [list],
+    inject: ['bar', 'setKeeps', 'scrollWrapper', 'changeScroll', 'bodyScroll'],
     components: {
         ProductInfo
     },
     data() {
         return {
-            url: '/collection/all'
+            url: '/collection/all',
+            scrollTop: 0
         };
     },
     methods: {
@@ -58,7 +71,33 @@ export default {
                 },
                 sort: 'id,desc'
             };
+        },
+        goTop() {
+            this.changeScroll(0, true);
+        },
+        onRefresh() {
+            this.getData(true).then(() => {
+                this.isLoading = false;
+            });
+            // setTimeout(() => {
+
+            // }, 1000);
         }
+    },
+    activated() {
+        this.$nextTick(() => {
+            this.changeScroll(this.scrollTop || 0);
+        });
+    },
+    beforeRouteLeave(to, from, next) {
+        if (!to.meta.menuPage) {
+            this.scrollTop = this.scrollWrapper.scrollTop;
+            this.setKeeps(['index', 'starMap']);
+        } else {
+            this.scrollTop = 0;
+            this.setKeeps(['index', 'starMap'], false);
+        }
+        next();
     }
 };
 </script>
@@ -160,4 +199,15 @@ export default {
 .list {
     padding: 20px 8px 100px;
 }
+
+.goTop {
+    position: fixed;
+    right: 16px;
+    bottom: 100px;
+    bottom: calc(env(safe-area-inset-bottom) + 100px);
+    width: 40px;
+    height: 40px;
+    display: block;
+    z-index: 20;
+}
 </style>

+ 37 - 3
src/views/asset/Detail.vue

@@ -918,13 +918,47 @@ export default {
             }
             getHolds()
                 .then(() => {
-                    if (holdDays === 0 && _this.info.source === 'OFFICIAL') {
+                    console.log(_this.info.type === 'PICTURE');
+                    if (
+                        (_this.info.holdDays === 0 || _this.info.holdDays === '0') &&
+                        _this.info.source === 'OFFICIAL'
+                    ) {
                         return _this.$http.get('/sysConfig/get/OFFICIAL_CONSIGNMENT').then(res => {
                             holdDays = Number(res.value);
                             return Promise.resolve();
                         });
-                    } else if (this.info.source === 'GIFT') {
-                        return this.$http.get('/sysConfig/get/gift_days').then(res => {
+                    } else if (_this.info.source === 'GIFT') {
+                        return _this.$http.get('/sysConfig/get/gift_change_time,git_pre_days').then(res => {
+                            if (res.gift_change_time) {
+                                if (
+                                    _this
+                                        .dayjs(_this.info.createdAt)
+                                        .isSameOrBefore(_this.dayjs(res.gift_change_time.value))
+                                ) {
+                                    let _days = res.git_pre_days.value.split(',');
+                                    if (_this.info.type === 'PICTURE') {
+                                        holdDays = Number(_days[1]);
+                                    } else {
+                                        holdDays = Number(_days[0]);
+                                    }
+                                    return Promise.resolve();
+                                }
+                            }
+                            if (_this.info.type === 'PICTURE') {
+                                return _this.$http.get('/sysConfig/get/pic_gift_days').then(res => {
+                                    holdDays = Number(res.value);
+                                    return Promise.resolve();
+                                });
+                            } else {
+                                return _this.$http.get('/sysConfig/get/gift_days').then(res => {
+                                    holdDays = Number(res.value);
+                                    return Promise.resolve();
+                                });
+                            }
+                        });
+                    } else if (_this.info.type === 'PICTURE') {
+                        console.log('3746');
+                        return _this.$http.get('/sysConfig/get/picture_hold_days').then(res => {
                             holdDays = Number(res.value);
                             return Promise.resolve();
                         });