From 5f186071e16296b5121e2c6ed012db7d4491c2b9 Mon Sep 17 00:00:00 2001
From: wuxw <928255095@qq.com>
Date: 星期三, 27 十一月 2019 09:50:18 +0800
Subject: [PATCH] 报错 _uploadEditPhoto is not defined

---
 WebService/src/main/resources/components/ownerPackage/edit-owner/editOwner.js |   48 +++++++++++++++++++++++++++++++++++++++++++-----
 1 files changed, 43 insertions(+), 5 deletions(-)

diff --git a/WebService/src/main/resources/components/ownerPackage/edit-owner/editOwner.js b/WebService/src/main/resources/components/ownerPackage/edit-owner/editOwner.js
index 4533b5f..59ea80f 100644
--- a/WebService/src/main/resources/components/ownerPackage/edit-owner/editOwner.js
+++ b/WebService/src/main/resources/components/ownerPackage/edit-owner/editOwner.js
@@ -1,5 +1,6 @@
 (function(vc){
-
+    //var _fileUrl = 'https://hc.demo.winqi.cn/callComponent/download/getFile/fileByObjId';
+    var _fileUrl = '/callComponent/download/getFile/fileByObjId';
     vc.extends({
         propTypes: {
             notifyLoadDataComponentName:vc.propTypes.string
@@ -14,6 +15,7 @@
                 sex:'',
                 remark:'',
                 ownerPhoto:'',
+                idCard:'',
                 videoPlaying:false
             }
         },
@@ -24,14 +26,14 @@
             vc.on('editOwner','openEditOwnerModal',function(_owner){
                 vc.copyObject(_owner,vc.component.editOwnerInfo);
                 //鏍规嵁memberId 鏌ヨ 鐓х墖淇℃伅
-                vc.component.editOwnerInfo.ownerPhoto = "https://hc.demo.winqi.cn/callComponent/download/getFileByObjId/file?objId="+
-                   vc.component.editOwnerInfo.memberId +"&communityId="+vc.getCommunitys().communityId;
+                vc.component.editOwnerInfo.ownerPhoto = _fileUrl+"?objId="+
+                   vc.component.editOwnerInfo.memberId +"&communityId="+vc.getCurrentCommunity().communityId+"&fileTypeCd=10000&time="+new Date();
                 $('#editOwnerModel').modal('show');
                 vc.component._initAddOwnerMediaForEdit();
             });
         },
         methods:{
-            editOwnerValidate(){
+            editOwnerValidate:function(){
                 return vc.validate.validate({
                     editOwnerInfo:vc.component.editOwnerInfo
                 },{
@@ -64,6 +66,18 @@
                             limit:"required",
                             param:"",
                             errInfo:"鎬у埆涓嶈兘涓虹┖"
+                        }
+                    ],
+                    'editOwnerInfo.idCard':[
+                        {
+                            limit:"required",
+                            param:"",
+                            errInfo:"韬唤璇佸彿涓嶈兘涓虹┖"
+                        },
+                        {
+                            limit:"idCard",
+                            param:"",
+                            errInfo:"涓嶆槸鏈夋晥鐨勮韩浠借瘉鍙�"
                         }
                     ],
                     'editOwnerInfo.link':[
@@ -99,6 +113,11 @@
                 }
 
                 vc.component.editOwnerInfo.communityId = vc.getCurrentCommunity().communityId;
+
+                //缂栬緫鏃� ownerPhoto 涓唴瀹逛笉鏄収鐗囧唴瀹癸紝鍒欐竻绌�
+                if(vc.component.editOwnerInfo.ownerPhoto.indexOf(_fileUrl) != -1){
+                    vc.component.editOwnerInfo.ownerPhoto = "";
+                }
                 vc.http.post(
                     'editOwner',
                     'changeOwner',
@@ -180,7 +199,26 @@
                     vc.component.editOwnerInfo.ownerPhoto = data;
                     //document.getElementById('photo').setAttribute('src', data);
                 }
-            }
+            },
+            _uploadEditPhoto:function(event){
+                $("#uploadEditOwnerPhoto").trigger("click")
+            },
+            _chooseEditPhoto:function(event){
+                var photoFiles = event.target.files;
+                if (photoFiles && photoFiles.length > 0) {
+                    // 鑾峰彇鐩墠涓婁紶鐨勬枃浠�
+                    var file = photoFiles[0];// 鏂囦欢澶у皬鏍¢獙鐨勫姩浣�
+                    if(file.size > 1024 * 1024 * 1) {
+                        vc.toast("鍥剧墖澶у皬涓嶈兘瓒呰繃 2MB!")
+                        return false;
+                    }
+                    var reader = new FileReader(); //鏂板缓FileReader瀵硅薄
+                    reader.readAsDataURL(file); //璇诲彇涓篵ase64
+                    reader.onloadend = function(e) {
+                        vc.component.editOwnerInfo.ownerPhoto = reader.result;
+                    }
+                }
+            },
         }
     });
 

--
Gitblit v1.8.0