فهرست منبع

Merge branch 'dev' of xiongzhu/raex_front into master

panhui 3 سال پیش
والد
کامیت
e000651f5d
4فایلهای تغییر یافته به همراه29 افزوده شده و 7 حذف شده
  1. 1 1
      .env.development
  2. 9 1
      src/components/PictureCropper.vue
  3. 7 3
      src/mixins/common.js
  4. 12 2
      src/views/asset/Detail.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
 VUE_APP_PUBLIC_PATH=/
 ASSETS_PATH=raex

+ 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) {

+ 12 - 2
src/views/asset/Detail.vue

@@ -923,8 +923,18 @@ export default {
                             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' && _this.info.type === 'PICTURE') {
+                        return _this.$http
+                            .get('/sysConfig/get/pic_gift_days')
+                            .catch(e => {
+                                return _this.$http.get('/sysConfig/get/gift_days');
+                            })
+                            .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 => {
                             holdDays = Number(res.value);
                             return Promise.resolve();
                         });