From 3bfd69b33ad6b5c7c5ada276809da8f27c403d74 Mon Sep 17 00:00:00 2001
From: Tevin <tingquanren@163.com>
Date: Thu, 20 Jan 2022 11:38:45 +0800
Subject: [PATCH] 调整 tab 公共样式

---
 forms/imagePicker/CImagePicker.vue |   24 ++++++++++++++++++++----
 1 files changed, 20 insertions(+), 4 deletions(-)

diff --git a/forms/imagePicker/CImagePicker.vue b/forms/imagePicker/CImagePicker.vue
index 09012bd..8ab735c 100644
--- a/forms/imagePicker/CImagePicker.vue
+++ b/forms/imagePicker/CImagePicker.vue
@@ -32,6 +32,7 @@
 import Taro from '@tarojs/taro';
 import { $ } from '@tarojs/extend';
 import { AtInput, AtImagePicker, AtCurtain } from 'taro-ui-vue';
+import { Fetcher } from '@components/bases/Fetcher';
 import { $fetchCommon } from '@fetchers/FCommon';
 import { Tools } from '@components/common/Tools';
 import CImageCompressor from './CImageCompressor.vue';
@@ -160,7 +161,6 @@
             this.showImg = false;
         },
         handleFail(msg) {
-            console.log(msg);
             Taro.showToast({
                 title: msg,
                 icon: 'none',
@@ -169,19 +169,35 @@
             });
         },
         $uploadImage(callback) {
-            const url = $fetchCommon.getUploadImgURL();
+            const url = Fetcher.host + $fetchCommon.getUploadImgURL();
             const uploadTeam = [];
             const imgs = [];
             this.files.forEach(file => {
                 if (file.type === 'btn') {
                     return;
                 }
-                // blob 临时文件才上传
-                if (file.url.indexOf('blob') >= 0) {
+                // 临时文件才上传
+                if (
+                    file.url.indexOf('blob') >= 0 ||
+                    file.url.indexOf('wxfile') >= 0 ||
+                    file.url.indexOf('http://tmp/') >= 0
+                ) {
+                    let header = {};
+                    if (process.env.TARO_ENV === 'weapp') {
+                        const localCookies = JSON.parse(
+                            Taro.getStorageSync('cookies') || '{}'
+                        );
+                        const cookiesArr = [];
+                        Object.keys(localCookies).forEach(key => {
+                            cookiesArr.push(key + '=' + localCookies[key]);
+                        });
+                        header['Cookie'] = cookiesArr.join('; ');
+                    }
                     uploadTeam.push(
                         new Promise((resolve, reject) => {
                             Taro.uploadFile({
                                 url,
+                                header,
                                 filePath: file.url,
                                 name: 'file',
                                 formData: {},

--
Gitblit v1.9.1