提交 d273d30b 编写于 作者: F fancy

内容管理移动端编辑需求

上级 3e5a702c
...@@ -743,7 +743,7 @@ MWF.xApplication.cms.Xform.Form = MWF.CMSForm = new Class( ...@@ -743,7 +743,7 @@ MWF.xApplication.cms.Xform.Form = MWF.CMSForm = new Class(
return; return;
} }
//移动端去掉操作栏 //移动端去掉操作栏
if (this.app.mobile && json.type === "Actionbar") { if (layout.mobile && json.type === "Actionbar") {
return; return;
} }
var module = this._loadModule(json, node); var module = this._loadModule(json, node);
...@@ -1056,10 +1056,10 @@ MWF.xApplication.cms.Xform.Form = MWF.CMSForm = new Class( ...@@ -1056,10 +1056,10 @@ MWF.xApplication.cms.Xform.Form = MWF.CMSForm = new Class(
this.businessData.data.isNew = false; this.businessData.data.isNew = false;
this.fireEvent("afterPublish", [this, json.data]); this.fireEvent("afterPublish", [this, json.data]);
if (this.app) if (this.app.fireEvent) this.app.fireEvent("afterPublish",[this, json.data]); if (this.app) if (this.app.fireEvent) this.app.fireEvent("afterPublish",[this, json.data]);
if (callback) callback(); // if (callback) callback(); // 传进来不是function
if (this.app.mobile) { if (layout.mobile) {
this.app.content.unmask(); this.app.content.unmask();
// console.log('这里是移动端'); this.closeWindowOnMobile();
} else { } else {
if (this.businessData.document.title) { if (this.businessData.document.title) {
this.app.notice(MWF.xApplication.cms.Xform.LP.documentPublished + ": “" + this.businessData.document.title + "", "success"); this.app.notice(MWF.xApplication.cms.Xform.LP.documentPublished + ": “" + this.businessData.document.title + "", "success");
...@@ -1067,7 +1067,7 @@ MWF.xApplication.cms.Xform.Form = MWF.CMSForm = new Class( ...@@ -1067,7 +1067,7 @@ MWF.xApplication.cms.Xform.Form = MWF.CMSForm = new Class(
this.app.notice(MWF.xApplication.cms.Xform.LP.documentPublished, "success"); this.app.notice(MWF.xApplication.cms.Xform.LP.documentPublished, "success");
} }
this.options.saveOnClose = false; this.options.saveOnClose = false;
}
debugger; debugger;
if( layout.inBrowser ){ if( layout.inBrowser ){
try{ try{
...@@ -1081,6 +1081,8 @@ MWF.xApplication.cms.Xform.Form = MWF.CMSForm = new Class( ...@@ -1081,6 +1081,8 @@ MWF.xApplication.cms.Xform.Form = MWF.CMSForm = new Class(
}else{ }else{
this.app.close(); this.app.close();
} }
}
}.bind(this)); }.bind(this));
//}.bind(this)) //}.bind(this))
...@@ -1122,7 +1124,7 @@ MWF.xApplication.cms.Xform.Form = MWF.CMSForm = new Class( ...@@ -1122,7 +1124,7 @@ MWF.xApplication.cms.Xform.Form = MWF.CMSForm = new Class(
//}, //},
deleteDocumentForMobile: function () { deleteDocumentForMobile: function () {
if (this.app.mobile) { if (layout.mobile) {
this.app.content.mask({ this.app.content.mask({
"style": { "style": {
"background-color": "#999", "background-color": "#999",
...@@ -1140,7 +1142,7 @@ MWF.xApplication.cms.Xform.Form = MWF.CMSForm = new Class( ...@@ -1140,7 +1142,7 @@ MWF.xApplication.cms.Xform.Form = MWF.CMSForm = new Class(
this.options.autoSave = false; this.options.autoSave = false;
this.options.saveOnClose = false; this.options.saveOnClose = false;
this.fireEvent("postDelete"); this.fireEvent("postDelete");
this.app.close(); this.closeWindowOnMobile();
}.bind(this)); }.bind(this));
} }
}, },
...@@ -1233,7 +1235,7 @@ MWF.xApplication.cms.Xform.Form = MWF.CMSForm = new Class( ...@@ -1233,7 +1235,7 @@ MWF.xApplication.cms.Xform.Form = MWF.CMSForm = new Class(
* this.form.getApp().appForm.editDocumentForMobile(); * this.form.getApp().appForm.editDocumentForMobile();
*/ */
editDocumentForMobile: function () { editDocumentForMobile: function () {
if (this.app.mobile) { if (layout.mobile) {
this.app.options.readonly = false; this.app.options.readonly = false;
this.app.loadDocument(this.app.options); this.app.loadDocument(this.app.options);
} }
...@@ -1372,6 +1374,42 @@ MWF.xApplication.cms.Xform.Form = MWF.CMSForm = new Class( ...@@ -1372,6 +1374,42 @@ MWF.xApplication.cms.Xform.Form = MWF.CMSForm = new Class(
this.close(); this.close();
}); });
}, },
/**
* 移动端处理关闭
*/
closeWindowOnMobile: function () {
if (window.o2android && window.o2android.closeDocumentWindow) {
window.o2android.closeDocumentWindow("");
} else if (window.webkit && window.webkit.messageHandlers && window.webkit.messageHandlers.closeDocumentWindow) {
window.webkit.messageHandlers.closeDocumentWindow.postMessage("");
} else if (window.wx && window.__wxjs_environment === 'miniprogram') { //微信小程序 关闭页面
wx.miniProgram.navigateBack({ delta: 1 });
} else if (window.uni && window.uni.navigateBack) { // uniapp 关闭页面
window.uni.navigateBack();
} else 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 {
var uri = new URI(window.location.href);
var redirectlink = uri.getData("redirectlink");
if (redirectlink) {
history.replaceState(null, "work", redirectlink);
redirectlink.toURI().go();
} else {
this.app.close();
}
// var len = window.history.length;
// if (len > 1) {
// history.back();
// } else {
// // window.location = o2.filterUrl("../x_desktop/appMobile.html?app=process.TaskCenter");
// history.replaceState(null, "work", o2.filterUrl("../x_desktop/appMobile.html?app=process.TaskCenter"));
// o2.filterUrl("../x_desktop/appMobile.html?app=process.TaskCenter").toURI().go();
// }
}
},
......
...@@ -158,7 +158,9 @@ if (!window.layout || !layout.desktop || !layout.addReady) { ...@@ -158,7 +158,9 @@ if (!window.layout || !layout.desktop || !layout.addReady) {
var title = typeOf(options) === "object" ? (options.docTitle || options.title) : ""; var title = typeOf(options) === "object" ? (options.docTitle || options.title) : "";
title = title || ""; title = title || "";
var par = "app=" + encodeURIComponent(appNames) + "&status=" + encodeURIComponent((statusObj) ? JSON.encode(statusObj) : "") + "&option=" + encodeURIComponent((options) ? JSON.encode(options) : ""); var par = "app=" + encodeURIComponent(appNames) + "&status=" + encodeURIComponent((statusObj) ? JSON.encode(statusObj) : "") + "&option=" + encodeURIComponent((options) ? JSON.encode(options) : "");
if (window.o2android && window.o2android.openO2CmsDocument) { if (window.o2android && window.o2android.openO2CmsDocumentV2) {
window.o2android.openO2CmsDocumentV2(options.documentId, title, JSON.stringify(options));
} else if (window.o2android && window.o2android.openO2CmsDocument) {
window.o2android.openO2CmsDocument(options.documentId, title); window.o2android.openO2CmsDocument(options.documentId, title);
} else if (window.webkit && window.webkit.messageHandlers && window.webkit.messageHandlers.openO2CmsDocument) { } else if (window.webkit && window.webkit.messageHandlers && window.webkit.messageHandlers.openO2CmsDocument) {
window.webkit.messageHandlers.openO2CmsDocument.postMessage({ window.webkit.messageHandlers.openO2CmsDocument.postMessage({
......
...@@ -339,7 +339,9 @@ o2.addReady(function () { ...@@ -339,7 +339,9 @@ o2.addReady(function () {
var title = typeOf(options) === "object" ? (options.docTitle || options.title) : ""; var title = typeOf(options) === "object" ? (options.docTitle || options.title) : "";
title = title || ""; title = title || "";
var par = "app=" + encodeURIComponent(appNames) + "&status=" + encodeURIComponent((statusObj) ? JSON.encode(statusObj) : "") + "&option=" + encodeURIComponent((options) ? JSON.encode(options) : ""); var par = "app=" + encodeURIComponent(appNames) + "&status=" + encodeURIComponent((statusObj) ? JSON.encode(statusObj) : "") + "&option=" + encodeURIComponent((options) ? JSON.encode(options) : "");
if (window.o2android && window.o2android.openO2CmsDocument) { if (window.o2android && window.o2android.openO2CmsDocumentV2) {
window.o2android.openO2CmsDocumentV2(options.documentId, title, JSON.stringify(options));
} else if (window.o2android && window.o2android.openO2CmsDocument) {
window.o2android.openO2CmsDocument(options.documentId, title); window.o2android.openO2CmsDocument(options.documentId, title);
} else if (window.webkit && window.webkit.messageHandlers && window.webkit.messageHandlers.openO2CmsDocument) { } else if (window.webkit && window.webkit.messageHandlers && window.webkit.messageHandlers.openO2CmsDocument) {
window.webkit.messageHandlers.openO2CmsDocument.postMessage({ "docId": options.documentId, "docTitle": title }); window.webkit.messageHandlers.openO2CmsDocument.postMessage({ "docId": options.documentId, "docTitle": title });
......
...@@ -286,7 +286,9 @@ o2.addReady(function () { ...@@ -286,7 +286,9 @@ o2.addReady(function () {
var title = typeOf(options) === "object" ? (options.docTitle || options.title) : ""; var title = typeOf(options) === "object" ? (options.docTitle || options.title) : "";
title = title || ""; title = title || "";
var par = "app=" + encodeURIComponent(appNames) + "&status=" + encodeURIComponent((statusObj) ? JSON.encode(statusObj) : "") + "&option=" + encodeURIComponent((options) ? JSON.encode(options) : ""); var par = "app=" + encodeURIComponent(appNames) + "&status=" + encodeURIComponent((statusObj) ? JSON.encode(statusObj) : "") + "&option=" + encodeURIComponent((options) ? JSON.encode(options) : "");
if (window.o2android && window.o2android.openO2CmsDocument) { if (window.o2android && window.o2android.openO2CmsDocumentV2) {
window.o2android.openO2CmsDocumentV2(options.documentId, title, JSON.stringify(options));
} else if (window.o2android && window.o2android.openO2CmsDocument) {
window.o2android.openO2CmsDocument(options.documentId, title); window.o2android.openO2CmsDocument(options.documentId, title);
} else if (window.webkit && window.webkit.messageHandlers && window.webkit.messageHandlers.openO2CmsDocument) { } else if (window.webkit && window.webkit.messageHandlers && window.webkit.messageHandlers.openO2CmsDocument) {
window.webkit.messageHandlers.openO2CmsDocument.postMessage({ "docId": options.documentId, "docTitle": title }); window.webkit.messageHandlers.openO2CmsDocument.postMessage({ "docId": options.documentId, "docTitle": title });
......
...@@ -123,7 +123,9 @@ o2.xDesktop.requireApp = function (module, clazz, callback, async) { ...@@ -123,7 +123,9 @@ o2.xDesktop.requireApp = function (module, clazz, callback, async) {
var title = typeOf(options) === "object" ? (options.docTitle || options.title) : ""; var title = typeOf(options) === "object" ? (options.docTitle || options.title) : "";
title = title || ""; title = title || "";
var par = "app=" + encodeURIComponent(appNames) + "&status=" + encodeURIComponent((statusObj) ? JSON.encode(statusObj) : "") + "&option=" + encodeURIComponent((options) ? JSON.encode(options) : ""); var par = "app=" + encodeURIComponent(appNames) + "&status=" + encodeURIComponent((statusObj) ? JSON.encode(statusObj) : "") + "&option=" + encodeURIComponent((options) ? JSON.encode(options) : "");
if (window.o2android && window.o2android.openO2CmsDocument) { if (window.o2android && window.o2android.openO2CmsDocumentV2) {
window.o2android.openO2CmsDocumentV2(options.documentId, title, JSON.stringify(options));
} else if (window.o2android && window.o2android.openO2CmsDocument) {
window.o2android.openO2CmsDocument(options.documentId, title); window.o2android.openO2CmsDocument(options.documentId, title);
} else if (window.webkit && window.webkit.messageHandlers && window.webkit.messageHandlers.openO2CmsDocument) { } else if (window.webkit && window.webkit.messageHandlers && window.webkit.messageHandlers.openO2CmsDocument) {
window.webkit.messageHandlers.openO2CmsDocument.postMessage({ "docId": options.documentId, "docTitle": title }); window.webkit.messageHandlers.openO2CmsDocument.postMessage({ "docId": options.documentId, "docTitle": title });
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册