fancy 5 лет назад
Родитель
Сommit
8f88c48f6f

+ 49 - 2
o2web/source/x_component_Forum/Attachment.js

@@ -224,12 +224,40 @@ MWF.xApplication.Forum.Attachment = new Class({
         }
         this.fileReplaceNode.click();
     },
+    //小程序文件是否支持打开
+    checkMiniProgramFile: function(ext) {
+        var exts = ["doc", "docx", "xls", "xlsx", "ppt", "pptx", "pdf"];
+        for(var i = 0; i < exts.length; i++){
+            if(ext === exts[i]){
+                return true;
+            }
+        }
+        return false;
+    },
     downloadAttachment: function (e, node, attachments) {
         //if( this.app.access.isAnonymousDynamic() ){
         //    this.app.openLoginForm( function(){ this.app.reload() }.bind(this) )
         //}else {
             attachments.each(function (att) {
-                this.actions.getAttachmentStream(att.data.id, this.options.documentId);
+                if (window.o2android && window.o2android.downloadAttachment) {
+                    window.o2android.downloadAttachment(att.data.id);
+                } else if (window.webkit && window.webkit.messageHandlers && window.webkit.messageHandlers.downloadAttachment) {
+                    window.webkit.messageHandlers.downloadAttachment.postMessage({ "id": att.data.id, "site": "bbs" });
+                } else if (window.wx && window.__wxjs_environment === 'miniprogram' && this.checkMiniProgramFile(att.data.extension)) { //微信小程序
+                    wx.miniProgram.navigateTo({ 
+                        url: '../file/download?attId=' + att.data.id + '&type=bbs&subjectId=' + this.options.documentId
+                    });
+                } else {
+                    if (layout.mobile) {
+                        //移动端 企业微信 钉钉 用本地打开 防止弹出自带浏览器 无权限问题
+                        this.actions.getAttachmentUrl(att.data.id, this.options.documentId, function (url) {
+                            var xtoken = Cookie.read("x-token");
+                            window.location = o2.filterUrl(url + "?x-token=" + xtoken);
+                        });
+                    } else {
+                        this.actions.getAttachmentStream(att.data.id, this.options.documentId);
+                    }
+                }
             }.bind(this));
         //}
     },
@@ -238,7 +266,26 @@ MWF.xApplication.Forum.Attachment = new Class({
         //    this.app.openLoginForm( function(){ this.app.reload() }.bind(this) )
         //}else{
             attachments.each(function (att) {
-                this.actions.getAttachmentData(att.data.id, this.options.documentId);
+                if (window.o2android && window.o2android.downloadAttachment) {
+                    window.o2android.downloadAttachment(att.data.id);
+                } else if (window.webkit && window.webkit.messageHandlers && window.webkit.messageHandlers.downloadAttachment) {
+                    window.webkit.messageHandlers.downloadAttachment.postMessage({ "id": att.data.id, "site": "bbs" });
+                } else if (window.wx && window.__wxjs_environment === 'miniprogram' && this.checkMiniProgramFile(att.data.extension)) { //微信小程序
+                    wx.miniProgram.navigateTo({ 
+                        url: '../file/download?attId=' + att.data.id + '&type=bbs&subjectId=' + this.options.documentId
+                    });
+                } else {
+                    if (layout.mobile) {
+                        //移动端 企业微信 钉钉 用本地打开 防止弹出自带浏览器 无权限问题
+                        this.actions.getAttachmentUrl(att.data.id, this.options.documentId, function (url) {
+                            var xtoken = Cookie.read("x-token");
+                            window.location = o2.filterUrl(url + "?x-token=" + xtoken);
+                        });
+                    } else {
+                        this.actions.getAttachmentData(att.data.id, this.options.documentId);
+                    }
+                }
+                
             }.bind(this));
         //}
     },

+ 18 - 1
o2web/source/x_component_cms_Xform/Attachment.js

@@ -389,7 +389,16 @@ MWF.xApplication.cms.Xform.Attachment = MWF.CMSAttachment = new Class({
         // }.bind(this));
     },
 
-
+    //小程序文件是否支持打开
+    checkMiniProgramFile: function(ext) {
+        var exts = ["doc", "docx", "xls", "xlsx", "ppt", "pptx", "pdf"];
+        for(var i = 0; i < exts.length; i++){
+            if(ext === exts[i]){
+                return true;
+            }
+        }
+        return false;
+    },
     downloadAttachment: function (e, node, attachments) {
         if (this.form.businessData.document) {
             attachments.each(function (att) {
@@ -397,6 +406,10 @@ MWF.xApplication.cms.Xform.Attachment = MWF.CMSAttachment = new Class({
                     window.o2android.downloadAttachment(att.data.id);
                 } else if (window.webkit && window.webkit.messageHandlers && window.webkit.messageHandlers.downloadAttachment) {
                     window.webkit.messageHandlers.downloadAttachment.postMessage({ "id": att.data.id, "site": this.json.id });
+                } else if (window.wx && window.__wxjs_environment === 'miniprogram' && this.checkMiniProgramFile(att.data.extension)) { //微信小程序
+                    wx.miniProgram.navigateTo({ 
+                        url: '../file/download?attId=' + att.data.id + '&type=cms&documentId=' + this.form.businessData.document.id
+                    });
                 } else {
                     if (layout.mobile) {
                         //移动端 企业微信 钉钉 用本地打开 防止弹出自带浏览器 无权限问题
@@ -418,6 +431,10 @@ MWF.xApplication.cms.Xform.Attachment = MWF.CMSAttachment = new Class({
                     window.o2android.downloadAttachment(att.data.id);
                 } else if (window.webkit && window.webkit.messageHandlers && window.webkit.messageHandlers.downloadAttachment) {
                     window.webkit.messageHandlers.downloadAttachment.postMessage({ "id": att.data.id, "site": this.json.id });
+                } else if (window.wx && window.__wxjs_environment === 'miniprogram' && this.checkMiniProgramFile(att.data.extension)) { //微信小程序
+                    wx.miniProgram.navigateTo({ 
+                        url: '../file/download?attId=' + att.data.id + '&type=cms&documentId=' + this.form.businessData.document.id
+                    });
                 } else {
                     if (layout.mobile) {
                         //移动端 企业微信 钉钉 用本地打开 防止弹出自带浏览器 无权限问题

+ 26 - 0
o2web/source/x_component_process_Xform/Attachment.js

@@ -1451,6 +1451,16 @@ MWF.xApplication.process.Xform.Attachment = MWF.APPAttachment = new Class({
             return true;
         }
     },
+    //小程序文件是否支持打开
+    checkMiniProgramFile: function(ext) {
+        var exts = ["doc", "docx", "xls", "xlsx", "ppt", "pptx", "pdf"];
+        for(var i = 0; i < exts.length; i++){
+            if(ext === exts[i]){
+                return true;
+            }
+        }
+        return false;
+    },
     downloadAttachment: function (e, node, attachments) {
         if (this.form.businessData.work && !this.form.businessData.work.completedTime) {
             attachments.each(function (att) {
@@ -1459,6 +1469,10 @@ MWF.xApplication.process.Xform.Attachment = MWF.APPAttachment = new Class({
                     window.o2android.downloadAttachment(att.data.id);
                 } else if (window.webkit && window.webkit.messageHandlers && window.webkit.messageHandlers.downloadAttachment) {
                     window.webkit.messageHandlers.downloadAttachment.postMessage({ "id": att.data.id, "site": this.json.id });
+                } else if (window.wx && window.__wxjs_environment === 'miniprogram' && this.checkMiniProgramFile(att.data.extension)) { //微信小程序
+                    wx.miniProgram.navigateTo({ 
+                        url: '../file/download?attId=' + att.data.id + '&type=work&work=' + this.form.businessData.work.id
+                    });
                 } else {
                     if (layout.mobile) {
                         //移动端 企业微信 钉钉 用本地打开 防止弹出自带浏览器 无权限问题
@@ -1479,6 +1493,10 @@ MWF.xApplication.process.Xform.Attachment = MWF.APPAttachment = new Class({
                     window.o2android.downloadAttachment(att.data.id);
                 } else if (window.webkit && window.webkit.messageHandlers && window.webkit.messageHandlers.downloadAttachment) {
                     window.webkit.messageHandlers.downloadAttachment.postMessage({ "id": att.data.id, "site": this.json.id });
+                } else if (window.wx && window.__wxjs_environment === 'miniprogram' && this.checkMiniProgramFile(att.data.extension)) { //微信小程序
+                    wx.miniProgram.navigateTo({ 
+                        url: '../file/download?attId=' + att.data.id + '&type=work&workCompleted=' + this.form.businessData.workCompleted.id
+                    });
                 } else {
                     if (layout.mobile) {
                         //移动端 企业微信 钉钉 用本地打开 防止弹出自带浏览器 无权限问题
@@ -1502,6 +1520,10 @@ MWF.xApplication.process.Xform.Attachment = MWF.APPAttachment = new Class({
                     window.o2android.downloadAttachment(att.data.id);
                 } else if (window.webkit && window.webkit.messageHandlers && window.webkit.messageHandlers.downloadAttachment) {
                     window.webkit.messageHandlers.downloadAttachment.postMessage({ "id": att.data.id, "site": this.json.id });
+                } else if (window.wx && window.__wxjs_environment === 'miniprogram' && this.checkMiniProgramFile(att.data.extension)) { //微信小程序
+                    wx.miniProgram.navigateTo({ 
+                        url: '../file/download?attId=' + att.data.id + '&type=work&work=' + this.form.businessData.work.id
+                    });
                 } else {
                     if (layout.mobile) {
                         //移动端 企业微信 钉钉 用本地打开 防止弹出自带浏览器 无权限问题
@@ -1523,6 +1545,10 @@ MWF.xApplication.process.Xform.Attachment = MWF.APPAttachment = new Class({
                     window.o2android.downloadAttachment(att.data.id);
                 } else if (window.webkit && window.webkit.messageHandlers && window.webkit.messageHandlers.downloadAttachment) {
                     window.webkit.messageHandlers.downloadAttachment.postMessage({ "id": att.data.id, "site": this.json.id });
+                } else if (window.wx && window.__wxjs_environment === 'miniprogram' && this.checkMiniProgramFile(att.data.extension)) { //微信小程序
+                    wx.miniProgram.navigateTo({ 
+                        url: '../file/download?attId=' + att.data.id + '&type=work&workCompleted=' + this.form.businessData.workCompleted.id
+                    });
                 } else {
 
                     if (layout.mobile) {

+ 101 - 97
o2web/source/x_component_process_Xform/Form.js

@@ -217,13 +217,13 @@ MWF.xApplication.process.Xform.Form = MWF.APPForm = new Class({
 
                 this.loadRelatedScript();
                 //this.loadResource( function () {
-                this.loadDictionaryList( function () {
+                this.loadDictionaryList(function () {
                     this.fireEvent("queryLoad");
-                    if (this.event_resolve){
-                        this.event_resolve(function(){
+                    if (this.event_resolve) {
+                        this.event_resolve(function () {
                             this.loadForm(callback)
                         }.bind(this));
-                    }else{
+                    } else {
                         this.loadForm(callback);
                     }
                 }.bind(this));
@@ -233,14 +233,14 @@ MWF.xApplication.process.Xform.Form = MWF.APPForm = new Class({
             }.bind(this));
         }.bind(this));
     },
-    loadRelatedScript: function(){
+    loadRelatedScript: function () {
         debugger;
-        if (this.json.includeScripts && this.json.includeScripts.length){
+        if (this.json.includeScripts && this.json.includeScripts.length) {
             var includeScriptText = "";
             var includedIds = [];
-            this.json.includeScripts.each(function(s){
-                if (this.app.relatedScriptMap && this.app.relatedScriptMap[s.id]){
-                    includeScriptText+="\n"+this.app.relatedScriptMap[s.id].text;
+            this.json.includeScripts.each(function (s) {
+                if (this.app.relatedScriptMap && this.app.relatedScriptMap[s.id]) {
+                    includeScriptText += "\n" + this.app.relatedScriptMap[s.id].text;
                     includedIds.push(s.id);
                 }
             }.bind(this));
@@ -258,39 +258,39 @@ MWF.xApplication.process.Xform.Form = MWF.APPForm = new Class({
     //     // this.loadScriptList( cb );
     //     this.loadDictionaryList( cb );
     // },
-    loadDictionaryList: function( callback ){
+    loadDictionaryList: function (callback) {
         this.dictionaryLoaded = false;
         var loadedCount = 0;
-        if( this.json.includeDictionaries && this.json.includeDictionaries.length ){
+        if (this.json.includeDictionaries && this.json.includeDictionaries.length) {
             var fun = function () {
                 loadedCount++;
-                if (this.json.includeDictionaries.length <= loadedCount){
+                if (this.json.includeDictionaries.length <= loadedCount) {
                     this.dictionaryLoaded = true;
-                    if(callback)callback();
+                    if (callback) callback();
                 }
             }.bind(this);
 
             this.json.includeDictionaries.map(function (d) {
-                var action = MWF.Actions.get( d.dictionary.appType === "cms" ? "x_cms_assemble_control" : "x_processplatform_assemble_surface");
-                if ( d.path && d.path !== "root" ){
-                    action[ "getDictData" ]( d.dictionary.id, d.dictionary.appId, d.path, function(json){
+                var action = MWF.Actions.get(d.dictionary.appType === "cms" ? "x_cms_assemble_control" : "x_processplatform_assemble_surface");
+                if (d.path && d.path !== "root") {
+                    action["getDictData"](d.dictionary.id, d.dictionary.appId, d.path, function (json) {
                         MWF.xScript.addDictToCache(d.dictionary, d.path, json.data);
                         fun();
-                    }.bind(this), function(){
+                    }.bind(this), function () {
                         fun();
-                    }.bind(this), true );
-                }else{
-                    action[ "getDictRoot" ](d.dictionary.id, d.dictionary.appId, function(json){
+                    }.bind(this), true);
+                } else {
+                    action["getDictRoot"](d.dictionary.id, d.dictionary.appId, function (json) {
                         MWF.xScript.addDictToCache(d.dictionary, d.path, json.data);
                         fun();
-                    }.bind(this), function(){
+                    }.bind(this), function () {
                         fun();
-                    }.bind(this), true );
+                    }.bind(this), true);
                 }
             }.bind(this));
-        }else{
+        } else {
             this.dictionaryLoaded = true;
-            if(callback)callback();
+            if (callback) callback();
         }
     },
     // loadScriptList : function( callback ){
@@ -342,8 +342,8 @@ MWF.xApplication.process.Xform.Form = MWF.APPForm = new Class({
     //     loadAsyncList();
     //     loadSyncList();
     // },
-    loadForm: function(callback){
-        if (this.lockDataPerson){
+    loadForm: function (callback) {
+        if (this.lockDataPerson) {
             var text = MWF.xApplication.process.Xform.LP.keyLockInfor;
             text = text.replace("{name}", o2.name.cn(this.lockDataPerson));
             var title = MWF.xApplication.process.Xform.LP.keyLockTitle;
@@ -361,25 +361,25 @@ MWF.xApplication.process.Xform.Form = MWF.APPForm = new Class({
             if (callback) callback();
             return;
         }
-        if (this.json["$version"]=="5.2"){
+        if (this.json["$version"] == "5.2") {
             if (callback) callback();
             return;
         }
         var stylesUrl = "../x_component_process_FormDesigner/Module/Form/skin/" + this.json.styleConfig.extendFile;
         MWF.getJSON(stylesUrl, {
-                "onSuccess": function (responseJSON) {
-                    if (responseJSON && responseJSON.form) {
-                        this.json = Object.merge(this.json, responseJSON.form);
-                    }
-                    if (callback) callback();
-                }.bind(this),
-                "onRequestFailure": function () {
-                    if (callback) callback();
-                }.bind(this),
-                "onError": function () {
-                    if (callback) callback();
-                }.bind(this)
-            }
+            "onSuccess": function (responseJSON) {
+                if (responseJSON && responseJSON.form) {
+                    this.json = Object.merge(this.json, responseJSON.form);
+                }
+                if (callback) callback();
+            }.bind(this),
+            "onRequestFailure": function () {
+                if (callback) callback();
+            }.bind(this),
+            "onError": function () {
+                if (callback) callback();
+            }.bind(this)
+        }
         );
     },
     loadMacro: function (callback) {
@@ -418,7 +418,7 @@ MWF.xApplication.process.Xform.Form = MWF.APPForm = new Class({
             if (node) {
                 node.empty();
                 this._loadMobileActions(node, callback);
-            }else {
+            } else {
                 console.log("没有找到移动端底部操作栏!")
             }
         } else {
@@ -970,11 +970,11 @@ MWF.xApplication.process.Xform.Form = MWF.APPForm = new Class({
         if (beforeLoad) beforeLoad.apply(module);
         if (!this.all[json.id]) this.all[json.id] = module;
 
-        if ( json.name ){
-            if( this.allForName[json.name] ){
+        if (json.name) {
+            if (this.allForName[json.name]) {
                 var item = this.allForName[json.name];
-                typeOf(item) === "array" ? item.push( module ) : this.allForName[json.name] = [item, module];
-            }else{
+                typeOf(item) === "array" ? item.push(module) : this.allForName[json.name] = [item, module];
+            } else {
                 this.allForName[json.name] = module;
             }
         }
@@ -1018,9 +1018,9 @@ MWF.xApplication.process.Xform.Form = MWF.APPForm = new Class({
                     this.saveOpinion(module);
 
                     var key = layout.desktop.session.user.id;
-                    if( typeOf( data[id] ) === "object" && typeOf(data[id][key])==="string" ){
-                        data[id][key]= "";
-                    }else if( typeOf( data[id] ) === "string" ){
+                    if (typeOf(data[id]) === "object" && typeOf(data[id][key]) === "string") {
+                        data[id][key] = "";
+                    } else if (typeOf(data[id]) === "string") {
                         data[id] = "";
                     }
                     // delete data[id];
@@ -1275,11 +1275,11 @@ MWF.xApplication.process.Xform.Form = MWF.APPForm = new Class({
                 this.app.options.desktopReload = true;
 
                 this.app.appId = "process.Work" + json.data.work.id;
-                if(layout.desktop.apps) {
+                if (layout.desktop.apps) {
                     delete layout.desktop.apps[this.app.options.appId];
-                }else {
+                } else {
                     layout.desktop.apps = {};
-                } 
+                }
                 layout.desktop.apps[this.app.appId] = this.app;
 
                 if (callback) callback();
@@ -1358,32 +1358,32 @@ MWF.xApplication.process.Xform.Form = MWF.APPForm = new Class({
         if (data.completed) {
             content += MWF.xApplication.process.Xform.LP.workCompleted;
         } else {
-            if (data.occurSignalStack){
-                if (data.signalStack && data.signalStack.length){
+            if (data.occurSignalStack) {
+                if (data.signalStack && data.signalStack.length) {
                     var activityUsers = [];
-                    data.signalStack.each(function(stack){
+                    data.signalStack.each(function (stack) {
                         var ids = [];
-                        if (stack.splitExecute){
+                        if (stack.splitExecute) {
                             ids = stack.splitExecute.splitValueList || [];
                         }
-                        if (stack.manualExecute){
+                        if (stack.manualExecute) {
                             ids = stack.manualExecute.identities || [];
                         }
                         var count = 0;
-                        if (ids.length>8){
+                        if (ids.length > 8) {
                             count = ids.length;
-                            ids = ids.slice(0,8);
+                            ids = ids.slice(0, 8);
                         }
                         ids = o2.name.cns(ids);
                         var lp = MWF.xApplication.process.Xform.LP;
-                        var t = "<b>" + lp.nextActivity + "</b><span style='color: #ea621f'>" + stack.name + "</span>;<b>" + lp.nextUser + "</b><span style='color: #ea621f'>" + ids.join(",") + "</span> <b>"+ ((count) ? ","+lp.next_etc.replace("{count}", count) : "")+"</b>";
+                        var t = "<b>" + lp.nextActivity + "</b><span style='color: #ea621f'>" + stack.name + "</span>;<b>" + lp.nextUser + "</b><span style='color: #ea621f'>" + ids.join(",") + "</span> <b>" + ((count) ? "," + lp.next_etc.replace("{count}", count) : "") + "</b>";
                         activityUsers.push(t);
                     }.bind(this));
                     content += activityUsers.join("<br>");
-                }else{
+                } else {
                     content += MWF.xApplication.process.Xform.LP.taskCompleted;
                 }
-            }else{
+            } else {
                 if (data.properties.nextManualList && data.properties.nextManualList.length) {
                     var activityUsers = [];
                     data.properties.nextManualList.each(function (a) {
@@ -1676,10 +1676,10 @@ MWF.xApplication.process.Xform.Form = MWF.APPForm = new Class({
                             if (this.json.isPrompt !== false) {
                                 this.showSubmitedDialog(json.data);
                             } else {
-                                if (this.json.afterProcessAction=="redirect" && this.json.afterProcessRedirectScript && this.json.afterProcessRedirectScript.code){
+                                if (this.json.afterProcessAction == "redirect" && this.json.afterProcessRedirectScript && this.json.afterProcessRedirectScript.code) {
                                     var url = this.Macro.exec(this.json.afterProcessRedirectScript.code, this);
                                     (new URI(url)).go();
-                                }else{
+                                } else {
                                     this.app.close();
                                 }
                             }
@@ -1723,10 +1723,10 @@ MWF.xApplication.process.Xform.Form = MWF.APPForm = new Class({
                     "text": this.app.lp.closePage,
                     "action": function () {
                         dlg.close();
-                        if (this.json.afterProcessAction=="redirect" && this.json.afterProcessRedirectScript && this.json.afterProcessRedirectScript.code){
+                        if (this.json.afterProcessAction == "redirect" && this.json.afterProcessRedirectScript && this.json.afterProcessRedirectScript.code) {
                             var url = this.Macro.exec(this.json.afterProcessRedirectScript.code, this);
                             (new URI(url)).go();
-                        }else{
+                        } else {
                             this.app.close();
                         }
                     }.bind(this)
@@ -1800,10 +1800,10 @@ MWF.xApplication.process.Xform.Form = MWF.APPForm = new Class({
                         } else {
                             dlg.close();
 
-                            if (_work.json.afterProcessAction=="redirect" && _work.json.afterProcessRedirectScript && _work.json.afterProcessRedirectScript.code){
+                            if (_work.json.afterProcessAction == "redirect" && _work.json.afterProcessRedirectScript && _work.json.afterProcessRedirectScript.code) {
                                 var url = _work.Macro.exec(_work.json.afterProcessRedirectScript.code, _work);
                                 (new URI(url)).go();
-                            }else{
+                            } else {
                                 _work.app.close();
                             }
                         }
@@ -1811,10 +1811,10 @@ MWF.xApplication.process.Xform.Form = MWF.APPForm = new Class({
                     window.setTimeout(countDown, 1000);
                 } else {
                     window.setTimeout(function () {
-                        if (_work.json.afterProcessAction=="redirect" && _work.json.afterProcessRedirectScript && _work.json.afterProcessRedirectScript.code){
+                        if (_work.json.afterProcessAction == "redirect" && _work.json.afterProcessRedirectScript && _work.json.afterProcessRedirectScript.code) {
                             var url = _work.Macro.exec(_work.json.afterProcessRedirectScript.code, _work);
                             (new URI(url)).go();
-                        }else{
+                        } else {
                             _work.app.close();
                         }
                     }, t);
@@ -1839,10 +1839,10 @@ MWF.xApplication.process.Xform.Form = MWF.APPForm = new Class({
             this.workAction.startDraft(this.businessData.work.id, function (json) {
                 this.app.options.workId = json.data[0].work;
                 if (layout.mobile) {
-                    if(layout.notice) {
+                    if (layout.notice) {
                         layout.notice(MWF.xApplication.process.Xform.LP.processStartedMessage + "“[" + json.data[0].processName + "]" + (this.businessData.data.title || this.businessData.data.subject));
                     }
-                }else {
+                } else {
                     var msg = {
                         "subject": MWF.xApplication.process.Xform.LP.processStarted,
                         "content": "<div>" + MWF.xApplication.process.Xform.LP.processStartedMessage + "“[" + json.data[0].processName + "]" + (this.businessData.data.title || this.businessData.data.subject) + "”</div>"
@@ -1850,7 +1850,7 @@ MWF.xApplication.process.Xform.Form = MWF.APPForm = new Class({
                     var tooltip = layout.desktop.message.addTooltip(msg);
                     var item = layout.desktop.message.addMessage(msg);
                 }
-                
+
 
                 this.app.reload();
 
@@ -1905,9 +1905,9 @@ MWF.xApplication.process.Xform.Form = MWF.APPForm = new Class({
         debugger;
         if (!this.businessData.work.startTime) {
             this.startDraftProcess();
-        } else if( this.json.submitFormType === "select" ){
+        } else if (this.json.submitFormType === "select") {
             this.processWork_custom();
-        } else if( this.json.submitFormType === "script" ){
+        } else if (this.json.submitFormType === "script") {
             this.processWork_custom();
         } else {
             if (this.json.mode == "Mobile") {
@@ -1919,7 +1919,7 @@ MWF.xApplication.process.Xform.Form = MWF.APPForm = new Class({
             }
         }
     },
-    processWork_custom : function(){
+    processWork_custom: function () {
         this.fireEvent("beforeProcessWork");
         if (this.app && this.app.fireEvent) this.app.fireEvent("beforeProcessWork");
 
@@ -1936,21 +1936,21 @@ MWF.xApplication.process.Xform.Form = MWF.APPForm = new Class({
         }
 
         debugger;
-        if( !this.submitFormModule ){
+        if (!this.submitFormModule) {
             if (!MWF["APPSubmitform"]) {
                 MWF.xDesktop.requireApp("process.Xform", "Subform", null, false);
             }
-            var submitFormContainer = new Element("div").inject( layout.mobile ? $(document.body) : this.app.content );
-            this.submitFormModule = new MWF["APPSubmitform"]( submitFormContainer , this.json, this);
+            var submitFormContainer = new Element("div").inject(layout.mobile ? $(document.body) : this.app.content);
+            this.submitFormModule = new MWF["APPSubmitform"](submitFormContainer, this.json, this);
             this.submitFormModule.addEvent("afterModulesLoad", function () {
                 this.submitFormModule.show();
             }.bind(this))
             this.submitFormModule.load();
-        }else{
+        } else {
             this.submitFormModule.show();
         }
     },
-    processWork_pc: function(){
+    processWork_pc: function () {
         var _self = this;
         this.fireEvent("beforeProcessWork");
         if (this.app && this.app.fireEvent) this.app.fireEvent("beforeProcessWork");
@@ -1994,7 +1994,7 @@ MWF.xApplication.process.Xform.Form = MWF.APPForm = new Class({
 
         //var node = new Element("div", {"styles": this.css.rollbackAreaNode});
         var processNode = new Element("div", { "styles": this.app.css.processNode_Area }).inject(this.node);
-        this.setProcessNode(processNode, "process", function ( processor ){
+        this.setProcessNode(processNode, "process", function (processor) {
             this.processDlg = o2.DL.open({
                 "title": this.app.lp.process,
                 "style": this.json.dialogStyle || "user",
@@ -2140,7 +2140,7 @@ MWF.xApplication.process.Xform.Form = MWF.APPForm = new Class({
                 "tabletWidth": this.json.tabletWidth || 0,
                 "tabletHeight": this.json.tabletHeight || 0,
                 "onPostLoad": function () {
-                    if (postLoadFun) postLoadFun( this );
+                    if (postLoadFun) postLoadFun(this);
                 },
                 "onResize": function () {
                     if (resizeFun) resizeFun();
@@ -2458,12 +2458,12 @@ MWF.xApplication.process.Xform.Form = MWF.APPForm = new Class({
     addSplitWork: function (splitValue, trimExist, success, failure) {
         var data = { "splitValueList": splitValue, "trimExist": trimExist };
         if (this.options.readonly) {
-            o2.Actions.load("x_processplatform_assemble_surface").WorkAction.V2AddSplit(this.businessData.work.id, data,function (json) {
+            o2.Actions.load("x_processplatform_assemble_surface").WorkAction.V2AddSplit(this.businessData.work.id, data, function (json) {
                 if (success) success(json);
             }.bind(this),
-            function (xhr, text, error) {
-                if (failure) failure(xhr, text, error);
-            });
+                function (xhr, text, error) {
+                    if (failure) failure(xhr, text, error);
+                });
             // this.workAction.addSplit(
             //     function (json) {
             //         if (success) success(json);
@@ -2476,12 +2476,12 @@ MWF.xApplication.process.Xform.Form = MWF.APPForm = new Class({
         } else {
             this.saveFormData(
                 function (json) {
-                    o2.Actions.load("x_processplatform_assemble_surface").WorkAction.V2AddSplit(this.businessData.work.id, data,function (json) {
+                    o2.Actions.load("x_processplatform_assemble_surface").WorkAction.V2AddSplit(this.businessData.work.id, data, function (json) {
                         if (success) success(json);
                     }.bind(this),
-                    function (xhr, text, error) {
-                        if (failure) failure(xhr, text, error);
-                    });
+                        function (xhr, text, error) {
+                            if (failure) failure(xhr, text, error);
+                        });
                     // this.workAction.addSplit(
                     //     function (json) {
                     //         if (success) success(json);
@@ -2864,14 +2864,14 @@ MWF.xApplication.process.Xform.Form = MWF.APPForm = new Class({
         var htmlFormId = "";
         o2.Actions.load("x_processplatform_assemble_surface").AttachmentAction.uploadWorkInfo(this.businessData.work.id, "pdf", {
             "workHtml": this.app.content.get("html"),
-            "pageWidth" : 1000
+            "pageWidth": 1000
         }, function (json) {
             htmlFormId = json.data.id;
         }.bind(this), null, false);
         htmlFormId = htmlFormId.replace("#", "%23");
         var url = "/x_processplatform_assemble_surface/jaxrs/attachment/batch/download/work/" + this.businessData.work.id + "/site/(0)/stream";
         url = o2.filterUrl(o2.Actions.getHost("x_processplatform_assemble_surface") + url);
-        window.open( o2.filterUrl(url + "?fileName=&flag=" + htmlFormId));
+        window.open(o2.filterUrl(url + "?fileName=&flag=" + htmlFormId));
     },
     resetWork: function () {
         if (!this.businessData.control["allowReset"]) {
@@ -2949,10 +2949,10 @@ MWF.xApplication.process.Xform.Form = MWF.APPForm = new Class({
                 //     this.selectPeopleCompany(dlg, json.data, count)
                 // }.bind(this), null, this.businessData.task.identity);
                 break;
-            case "script" :
-                o2.Actions.load("x_processplatform_assemble_surface").ProcessAction.getActivity( this.businessData.work.activity,"manual",function (activityJson) {
+            case "script":
+                o2.Actions.load("x_processplatform_assemble_surface").ProcessAction.getActivity(this.businessData.work.activity, "manual", function (activityJson) {
                     var scriptText = activityJson.data.activity.resetRangeScriptText;
-                    if( !scriptText )return;
+                    if (!scriptText) return;
                     var resetRange = this.Macro.exec(activityJson.data.activity.resetRangeScriptText, this);
                     this.selectPeopleUnit(dlg, "", count, resetRange);
                 }.bind(this))
@@ -2980,9 +2980,9 @@ MWF.xApplication.process.Xform.Form = MWF.APPForm = new Class({
                 dlg.identityList = identityList;
             }.bind(this)
         };
-        if( include ){
+        if (include) {
             options.noUnit = true;
-            options.include = typeOf(include)==="array" ? include : [include];
+            options.include = typeOf(include) === "array" ? include : [include];
         }
         MWF.xDesktop.requireApp("Selector", "package", function () {
             var selector = new MWF.O2Selector(this.app.content, options);
@@ -3931,6 +3931,10 @@ MWF.xApplication.process.Xform.Form = MWF.APPForm = new Class({
             window.o2android.closeWork("");
         } else if (window.webkit && window.webkit.messageHandlers && window.webkit.messageHandlers.closeWork) {
             window.webkit.messageHandlers.closeWork.postMessage("");
+        } else if (window.wx && window.__wxjs_environment === 'miniprogram') { //微信小程序 关闭页面
+            wx.miniProgram.navigateBack({ delta: 1 });
+        } else if (window.wx) { //微信关闭 当前页面
+            wx.closeWindow();
         } else {
             var len = window.history.length;
             if (len > 1) {

+ 15 - 0
o2web/source/x_desktop/cmsdocMobile.html

@@ -23,6 +23,21 @@
 
 <body style="overflow: auto; margin:0px">
     <div id="layout" style="overflow: auto"></div>
+    <script>
+        //动态添加 微信的 jssdk
+        function addWxJsSdk() {
+            var script = document.createElement("script");
+            script.type = "text/javascript";
+            script.src = "http://res.wx.qq.com/open/js/jweixin-1.6.0.js";
+            document.body.appendChild(script);
+        }
+        //微信的WeixinJSBridgeReady加载完成后进行判断
+        if (!window.WeixinJSBridge || !WeixinJSBridge.invoke) {
+            document.addEventListener('WeixinJSBridgeReady', addWxJsSdk, false);
+        } else {
+            addWxJsSdk();
+        }
+    </script>
 </body>
 
 </html>

+ 15 - 0
o2web/source/x_desktop/forumdocMobile.html

@@ -20,5 +20,20 @@
 </head>
 <body style="overflow: auto; margin:0px">
 <div id="layout" style="overflow: auto"></div>
+<script>
+    //动态添加 微信的 jssdk
+    function addWxJsSdk() {
+        var script = document.createElement("script");
+        script.type = "text/javascript";
+        script.src = "http://res.wx.qq.com/open/js/jweixin-1.6.0.js";
+        document.body.appendChild(script);
+    }
+    //微信的WeixinJSBridgeReady加载完成后进行判断
+    if (!window.WeixinJSBridge || !WeixinJSBridge.invoke) {
+        document.addEventListener('WeixinJSBridgeReady', addWxJsSdk, false);
+    } else {
+        addWxJsSdk();
+    }
+</script>
 </body>
 </html>

+ 7 - 0
o2web/source/x_desktop/js/cmsDocMobile.js

@@ -13,6 +13,13 @@ o2.addReady(function () {
         MWF.require("MWF.xDesktop.Common", null, false);
         MWF.require("MWF.widget.Mask", null, false);
 
+        //修改支持x-token
+        var uri = new URI(window.location.href);
+        var options = uri.get("data");
+        if (options["x-token"]) {
+            Cookie.write("x-token", options["x-token"]);
+        }
+
         layout.mask = new MWF.widget.Mask({ "style": "desktop" });
         layout.mask.load();
 

Разница между файлами не показана из-за своего большого размера
+ 59 - 51
o2web/source/x_desktop/js/forumDocMobile.js


+ 21 - 0
o2web/source/x_desktop/workmobilewithaction.html

@@ -35,6 +35,27 @@
         style="height: 4em;overflow: hidden; border-top: 1px solid #dfdfdf; display: block; position: absolute; bottom: 0px; background: #ffffff; width: 100%; z-index:100;">
 
     </div>
+    <script>
+        //动态添加 微信的 jssdk
+        function addWxJsSdk() {
+            var script = document.createElement("script");
+            script.type = "text/javascript";
+            script.src = "http://res.wx.qq.com/open/js/jweixin-1.6.0.js";
+            document.body.appendChild(script);
+        }
+        //判断是否是在小程序中
+        // function ready() {
+        //     if (window.__wxjs_environment === 'miniprogram') { // true 
+        //         addWxJsSdk();
+        //     }
+        // }
+        //微信的WeixinJSBridgeReady加载完成后进行判断
+        if (!window.WeixinJSBridge || !WeixinJSBridge.invoke) {
+            document.addEventListener('WeixinJSBridgeReady', addWxJsSdk, false);
+        } else {
+            addWxJsSdk();
+        }
+    </script>
 </body>
 
 </html>

Некоторые файлы не были показаны из-за большого количества измененных файлов