From 2f5415713eb904a5ac8f2daed81b996094a83df9 Mon Sep 17 00:00:00 2001
From: xiexiaoqin <xie.xiaoqin@mingwork.com>
Date: Tue, 1 Dec 2020 14:12:23 +0800
Subject: [PATCH] fix:file preview in dingtalk

---
 components/fileList/fileList.axml |  4 ++--
 components/fileList/fileList.js   | 25 +++++++++++--------------
 config.js                         |  2 +-
 utils/checkFullScren.js           |  3 +--
 4 files changed, 15 insertions(+), 19 deletions(-)

diff --git a/components/fileList/fileList.axml b/components/fileList/fileList.axml
index 466b6ac..146d8da 100644
--- a/components/fileList/fileList.axml
+++ b/components/fileList/fileList.axml
@@ -10,8 +10,8 @@
         <text>{{item.name.slice(0, item.name.length  - 5)}}</text>
         <text>{{item.name.slice(-5)}}</text>
       </view>
-      <view class="file-size">{{item.sizeShow}}</view>
-      <view a:if="{{showName}}" class=" color4 file-showName">{{item.userDetail.name}}</view>
+      <view class="file-size">{{item.sizeShow}} {{showName ? item.userDetail.name : ''}}</view>
+      <view a:if="{{item.platform === 'dingTalk'}}" class=" color4 file-showName">来自钉盘</view>
       <view a:if="{{isCanDelete}}" class="iconfont iconicon_noAgreed1" catchTap="removeFile" data-id="{{item.fileId}}"></view>
     </view>
   </view>
diff --git a/components/fileList/fileList.js b/components/fileList/fileList.js
index 6101432..be6ceab 100644
--- a/components/fileList/fileList.js
+++ b/components/fileList/fileList.js
@@ -87,27 +87,24 @@ create.Component({
           projectName: 'MING_MEETING',
           fileIds: file.fileId
         }
-        if (file.spaceId) {
+        uploadPermissions(data).then(res => {
           dd.previewFileInDingTalk({
             corpId: dd.corpId,
             spaceId: file.spaceId,
             fileId: file.fileId,
             fileName: file.name,
-            fileSize: file.size,
+            fileSize: parseInt(file.size),
             fileType: file.mimeType,
+            success: function (res) {
+              console.log(res);
+              //无,直接在native显示文件详细信息
+            },
+            fail: function (err) {
+              console.log(err);
+              // 无,直接在native页面显示具体的错误
+            }
           })
-        } else {
-          uploadPermissions(data).then(res => {
-            dd.previewFileInDingTalk({
-              corpId: dd.corpId,
-              spaceId: res.data.data,
-              fileId: file.fileId,
-              fileName: file.name,
-              fileSize: file.size,
-              fileType: file.mimeType,
-            })
-          })
-        }
+        })
       }
     },
     //显示操作框
diff --git a/config.js b/config.js
index f9ba66f..63173e5 100644
--- a/config.js
+++ b/config.js
@@ -1,4 +1,4 @@
 export const globalUrl = "https://gateway-ding.mingwork.com";
 export const globalUrl2 = "https://third-authentication.mingwork.com";
-export const version = 0.050;
+export const version = 0.051;
 export const websocketUrl = 'wss://gateway-ding.mingwork.com';
diff --git a/utils/checkFullScren.js b/utils/checkFullScren.js
index 433f0c0..e69445c 100644
--- a/utils/checkFullScren.js
+++ b/utils/checkFullScren.js
@@ -1,6 +1,5 @@
 
-const iphoneModel = ['iPhone10,3', 'iPhone10,6', 'iPhone11,2', 'iPhone11,4', 'iPhone11,6', 'iPhone11,8', 'iPhone12,1', 'iPhone12,3', 'iPhone12,5']
-let fullscren = false
+const iphoneModel = ['iPhone10,3', 'iPhone10,6', 'iPhone11,2', 'iPhone11,4', 'iPhone11,6', 'iPhone11,8', 'iPhone12,1', 'iPhone12,3', 'iPhone12,5', 'iPhone13,1', 'iPhone13,2', 'iPhone13,3', 'iPhone13,4']
 export function checkFullScren() {
     let systemInfo = dd.getSystemInfoSync()
     if (iphoneModel.includes(systemInfo.model)) {
--
libgit2 0.26.0