提交 7c3851fa 编写于 作者: NoSubject's avatar NoSubject

优化门户页面请求,合并js文件

修改gulp打包脚本,去掉base_work_begin和base_work_end文件,不再需要两次修改代码
上级 66d3f2aa
......@@ -19,6 +19,8 @@ var fg = require('fast-glob');
var logger = require('gulp-logger');
var assetRev = require('gulp-tm-asset-rev');
const os = require('os');
var through2 = require('through2');
var path = require('path');
//var downloadHost = "download.o2oa.net";
// var downloadHost = "release.o2oa.net";
......@@ -62,10 +64,11 @@ var scripts = {
};
var o_options = minimist(process.argv.slice(2), {//upload: local ftp or sftp
string: ["e"]
string: ["e", "lp"]
});
var options = {};
options.ev = o_options.e || "all";
options.lp = o_options.lp || "zh-cn";
var jvmUrl = jvmUrls[options.ev];
var scriptSource = scripts[options.ev];
......@@ -493,9 +496,95 @@ function build_bundle(){
.pipe(gulp.dest(dest))
}
function build_concat_basework() {
function concat_Actions(){
return through2.obj(function (file, enc, cb) {
if (file.isNull()) {
this.push(file);
return cb();
}
if (file.isStream()) {
this.emit('error', new gutil.PluginError(PLUGIN_NAME, 'Streaming not supported'));
return cb();
}
var content = file.contents.toString();
var o = path.parse(file.path);
var name = o.name;
content = "var actionJson = "+content;
content = content+"\nif (!o2.xAction.RestActions.Action[\""+name+"\"]) o2.xAction.RestActions.Action[\""+name+"\"] = new Class({Extends: o2.xAction.RestActions.Action});";
content = content+"\no2.Actions.actions[\""+name+"\"] = new o2.xAction.RestActions.Action[\""+name+"\"](\""+name+"\", actionJson);";
file.contents = new Buffer.from(content);
this.push(file);
cb();
});
}
function concat_Style(){
return through2.obj(function (file, enc, cb) {
if (file.isNull()) {
this.push(file);
return cb();
}
if (file.isStream()) {
this.emit('error', new gutil.PluginError(PLUGIN_NAME, 'Streaming not supported'));
return cb();
}
var content = file.contents.toString();
name = ".."+file.path.replace(process.cwd(), "").replace(/\\/g, "/").substring("/source".length);
content = "var csskey = encodeURIComponent(\""+name+"\");\no2.widget.css[csskey]="+content;
file.contents = new Buffer.from(content);
this.push(file);
cb();
});
}
function build_concat_basework_style(){
return gulp.src([
"o2web/source/x_component_process_Work/$Main/default/css.wcss",
"o2web/source/x_component_process_Xform/$Form/default/css.wcss"
])
.pipe(concat_Style())
.pipe(concat('js/base_work_style_temp.js'))
.pipe(gulp.dest('o2web/source/x_desktop/'));
}
function build_concat_basework_action(){
return gulp.src([
"o2web/source/o2_core/o2/xAction/services/x_organization_assemble_authentication.json",
"o2web/source/o2_core/o2/xAction/services/x_processplatform_assemble_surface.json",
"o2web/source/o2_core/o2/xAction/services/x_organization_assemble_control.json",
"o2web/source/o2_core/o2/xAction/services/x_query_assemble_surface.json",
"o2web/source/o2_core/o2/xAction/services/x_cms_assemble_control.json",
"o2web/source/o2_core/o2/xAction/services/x_program_center.json",
"o2web/source/o2_core/o2/xAction/services/x_organization_assemble_personal.json"
])
.pipe(concat_Actions())
.pipe(concat('js/base_work_actions_temp.js'))
.pipe(gulp.dest('o2web/source/x_desktop/'));
}
function build_concat_basework_clean(cb) {
var dest = [
'o2web/source/x_desktop/js/base_work_actions_temp.js',
'o2web/source/x_desktop/js/base_work_style_temp.js'
];
return del(dest, cb);
}
function build_concat_basework_body() {
var src = [
'o2web/source/x_desktop/js/base_work_begin.js',
'o2web/source/' + path + '/js/base_concat_head.js',
'o2web/source/o2_core/o2/lp/'+(options.lp || 'zh-cn')+'.js',
'o2web/source/x_component_process_Work/lp/'+(options.lp || 'zh-cn')+'.js',
'o2web/source/x_component_process_Xform/lp/'+(options.lp || 'zh-cn')+'.js',
'o2web/source/x_component_Selector/lp/'+(options.lp || 'zh-cn')+'.js',
'o2web/source/' + path + '/js/base_work_style_temp.js',
'o2web/source/o2_core/o2/widget/Common.js',
'o2web/source/o2_core/o2/widget/Dialog.js',
'o2web/source/o2_core/o2/widget/UUID.js',
......@@ -534,7 +623,9 @@ function build_concat_basework() {
'o2web/source/o2_core/o2/xAction/services/x_organization_assemble_control.js',
'o2web/source/o2_core/o2/xAction/services/x_query_assemble_surface.js',
'o2web/source/o2_core/o2/xAction/services/x_organization_assemble_personal.js',
'o2web/source/x_desktop/js/base_work_end.js',
'o2web/source/' + path + '/js/base_work_actions_temp.js',
'o2web/source/x_desktop/js/base.js'
];
var dest = 'target/o2server/servers/webServer/x_desktop/js/';
......@@ -545,10 +636,114 @@ function build_concat_basework() {
.pipe(rename({ extname: '.min.js' }))
.pipe(gulp.dest(dest));
}
// function build_concat(){
// return gulp.parallel(build_concat_o2, build_concat_desktop, build_concat_xform);
// }
exports.build_concat = gulp.parallel(build_concat_o2, build_concat_desktop, build_concat_xform, build_bundle, build_concat_basework);
function build_concat_baseportal_style(){
return gulp.src([
"o2web/source/x_component_process_Work/$Main/default/css.wcss",
"o2web/source/x_component_portal_Portal/$Main/default/css.wcss",
"o2web/source/x_component_process_Xform/$Form/default/css.wcss"
])
.pipe(concat_Style())
.pipe(concat('js/base_portal_style_temp.js'))
.pipe(gulp.dest('o2web/source/x_desktop/'));
}
function build_concat_baseportal_action(){
return gulp.src([
"o2web/source/o2_core/o2/xAction/services/x_organization_assemble_authentication.json",
"o2web/source/o2_core/o2/xAction/services/x_portal_assemble_surface.json",
"o2web/source/o2_core/o2/xAction/services/x_organization_assemble_control.json",
"o2web/source/o2_core/o2/xAction/services/x_query_assemble_surface.json",
"o2web/source/o2_core/o2/xAction/services/x_cms_assemble_control.json",
"o2web/source/o2_core/o2/xAction/services/x_program_center.json",
"o2web/source/o2_core/o2/xAction/services/x_organization_assemble_personal.json"
])
.pipe(concat_Actions())
.pipe(concat('js/base_portal_actions_temp.js'))
.pipe(gulp.dest('o2web/source/x_desktop/'));
}
function build_concat_baseportal_clean(cb) {
var dest = [
'o2web/source/x_desktop/js/base_portal_actions_temp.js',
'o2web/source/x_desktop/js/base_portal_style_temp.js'
];
return del(dest, cb);
}
function build_concat_baseportal_body() {
var src = [
'o2web/source/x_desktop/js/base_concat_head.js',
'o2web/source/o2_core/o2/lp/'+(options.lp || 'zh-cn')+'.js',
'o2web/source/x_desktop/js/base_portal_style_temp.js',
'o2web/source/o2_core/o2/widget/Common.js',
'o2web/source/o2_core/o2/widget/Dialog.js',
'o2web/source/o2_core/o2/widget/UUID.js',
'o2web/source/o2_core/o2/widget/Menu.js',
'o2web/source/o2_core/o2/widget/Toolbar.js',
'o2web/source/o2_core/o2/xDesktop/Common.js',
'o2web/source/o2_core/o2/xDesktop/Actions/RestActions.js',
'o2web/source/o2_core/o2/xAction/RestActions.js',
'o2web/source/o2_core/o2/xDesktop/Access.js',
'o2web/source/o2_core/o2/xDesktop/Dialog.js',
'o2web/source/o2_core/o2/xDesktop/Menu.js',
'o2web/source/o2_core/o2/xDesktop/UserData.js',
'o2web/source/x_component_Template/MPopupForm.js',
'o2web/source/o2_core/o2/xDesktop/Authentication.js',
'o2web/source/o2_core/o2/xDesktop/Window.js',
'o2web/source/x_component_Common/Main.js',
'o2web/source/x_component_process_Work/lp/'+(options.lp || 'zh-cn')+'.js',
'o2web/source/x_component_portal_Portal/lp/'+(options.lp || 'zh-cn')+'.js',
'o2web/source/x_component_process_Xform/lp/'+(options.lp || 'zh-cn')+'.js',
'o2web/source/x_component_Selector/lp/'+(options.lp || 'zh-cn')+'.js',
'o2web/source/x_component_portal_Portal/Main.js',
'o2web/source/x_component_Selector/package.js',
'o2web/source/x_component_Selector/Person.js',
'o2web/source/x_component_Selector/Identity.js',
'o2web/source/x_component_Selector/Unit.js',
'o2web/source/x_component_Selector/IdentityWidthDuty.js',
'o2web/source/x_component_Selector/IdentityWidthDutyCategoryByUnit.js',
'o2web/source/x_component_Selector/UnitWithType.js',
'o2web/source/o2_core/o2/xScript/Actions/UnitActions.js',
'o2web/source/o2_core/o2/xScript/Actions/ScriptActions.js',
'o2web/source/o2_core/o2/xScript/Actions/CMSScriptActions.js',
'o2web/source/o2_core/o2/xScript/Actions/PortalScriptActions.js',
'o2web/source/o2_core/o2/xScript/PageEnvironment.js',
'o2web/source/o2_core/o2/xAction/services/x_organization_assemble_authentication.js',
'o2web/source/o2_core/o2/xAction/services/x_cms_assemble_control.js',
'o2web/source/o2_core/o2/xAction/services/x_organization_assemble_control.js',
'o2web/source/o2_core/o2/xAction/services/x_query_assemble_surface.js',
'o2web/source/o2_core/o2/xAction/services/x_organization_assemble_personal.js',
'o2web/source/x_desktop/js/base_portal_actions_temp.js',
'o2web/source/x_desktop/js/base.js'
];
var dest = 'target/o2server/servers/webServer/x_desktop/js/';
return gulp.src(src)
.pipe(concat('base_portal.js'))
.pipe(gulp.dest(dest))
.pipe(uglify())
.pipe(rename({ extname: '.min.js' }))
.pipe(gulp.dest(dest));
}
exports.build_concat = gulp.parallel(
build_concat_o2,
build_concat_desktop,
build_concat_xform,
build_bundle,
gulp.series(build_concat_basework_style, build_concat_basework_action, build_concat_basework_body,build_concat_basework_clean),
gulp.series(build_concat_baseportal_style, build_concat_baseportal_action, build_concat_baseportal_body,build_concat_baseportal_clean)
);
function build_web_v_html() {
......@@ -640,7 +835,20 @@ function chmod_sh(){
function chmod_servers(){
return (shell.task('chmod 777 -R target/o2server/servers'))();
}
exports.build_web = gulp.series(build_web_minimize, build_web_move, gulp.parallel(build_concat_o2, build_concat_desktop, build_concat_xform, build_bundle, build_concat_basework), build_web_v_html, build_web_v_o2);
exports.build_web = gulp.series(
build_web_minimize,
build_web_move,
gulp.parallel(
build_concat_o2,
build_concat_desktop,
build_concat_xform,
gulp.series(build_concat_basework_style, build_concat_basework_action, build_concat_basework_body,build_concat_basework_clean),
gulp.series(build_concat_baseportal_style, build_concat_baseportal_action, build_concat_baseportal_body,build_concat_baseportal_clean),
build_bundle
),
build_web_v_html,
build_web_v_o2);
if (os.platform().indexOf("win")==-1){
exports.deploy = gulp.series(deploy_server, chmod_jvm, chmod_commons, chmod_sh, chmod_servers);
}else{
......
......@@ -15,13 +15,15 @@ var gulp = require('gulp'),
concat = require('gulp-concat');
//let uglify = require('gulp-uglify-es').default;
var through2 = require('through2');
var path = require('path');
var assetRev = require('gulp-tm-asset-rev');
var apps = require('./gulpapps.js');
var ftpconfig = require('./gulpconfig.js');
var o_options = minimist(process.argv.slice(2), {//upload: local ftp or sftp
string: ["ev", "upload", "location", "host", "user", "pass", "port", "remotePath", "dest", "src"]
string: ["ev", "upload", "location", "host", "user", "pass", "port", "remotePath", "dest", "src", "lp"]
});
function getEvOptions(ev){
options.ev = ev;
......@@ -46,6 +48,7 @@ function setOptions(op1, op2){
options.port = op1.port || op2.port || "";
options.remotePath = op1.remotePath || op2.remotePath || "";
options.dest = op1.dest || op2.dest || "dest";
options.lp = op1.lp || op2.lp || "zh-cn";
}
var options = {};
setOptions(o_options, getEvOptions(o_options.ev));
......@@ -354,11 +357,102 @@ function createO2ConcatTask(path, isMin, thisOptions) {
});
}
function createBaseWorkConcatTask(path, isMin, thisOptions) {
function concat_Actions(){
return through2.obj(function (file, enc, cb) {
debugger;
if (file.isNull()) {
this.push(file);
return cb();
}
if (file.isStream()) {
this.emit('error', new gutil.PluginError(PLUGIN_NAME, 'Streaming not supported'));
return cb();
}
var content = file.contents.toString();
var o = path.parse(file.path);
var name = o.name;
content = "var actionJson = "+content;
content = content+"\nif (!o2.xAction.RestActions.Action[\""+name+"\"]) o2.xAction.RestActions.Action[\""+name+"\"] = new Class({Extends: o2.xAction.RestActions.Action});";
content = content+"\no2.Actions.actions[\""+name+"\"] = new o2.xAction.RestActions.Action[\""+name+"\"](\""+name+"\", actionJson);";
file.contents = new Buffer.from(content);
this.push(file);
cb();
});
}
function concat_Style(){
return through2.obj(function (file, enc, cb) {
if (file.isNull()) {
this.push(file);
return cb();
}
if (file.isStream()) {
this.emit('error', new gutil.PluginError(PLUGIN_NAME, 'Streaming not supported'));
return cb();
}
var content = file.contents.toString();
name = ".."+file.path.replace(process.cwd(), "").replace(/\\/g, "/").substring("/source".length);
content = "var csskey = encodeURIComponent(\""+name+"\");\no2.widget.css[csskey]="+content;
file.contents = new Buffer.from(content);
this.push(file);
cb();
});
}
function createBaseWorkConcatStyleTask(path){
gulp.task(path+".base_work : style", function(){
return gulp.src([
"source/x_component_process_Work/$Main/default/css.wcss",
"source/x_component_process_Xform/$Form/default/css.wcss"
])
.pipe(concat_Style())
.pipe(concat('js/base_work_style_temp.js'))
.pipe(gulp.dest('source/x_desktop/'))
})
}
function createBaseWorkConcatActionTask(path){
gulp.task(path+".base_work : action", function(){
return gulp.src([
"source/o2_core/o2/xAction/services/x_organization_assemble_authentication.json",
"source/o2_core/o2/xAction/services/x_processplatform_assemble_surface.json",
"source/o2_core/o2/xAction/services/x_organization_assemble_control.json",
"source/o2_core/o2/xAction/services/x_query_assemble_surface.json",
"source/o2_core/o2/xAction/services/x_cms_assemble_control.json",
"source/o2_core/o2/xAction/services/x_program_center.json",
"source/o2_core/o2/xAction/services/x_organization_assemble_personal.json"
])
.pipe(concat_Actions())
.pipe(concat('js/base_work_actions_temp.js'))
.pipe(gulp.dest('source/x_desktop/'))
})
}
function createBaseWorkConcatDelTempTask(path) {
gulp.task(path+".base_work : clean", function(cb){
var dest = [
'source/'+path+'/js/base_work_actions_temp.js',
'source/'+path+'/js/base_work_style_temp.js'
];
return del(dest, cb);
});
}
function createBaseWorkConcatBodyTask(path, isMin, thisOptions) {
gulp.task(path+".base_work : concat", function(){
var option = thisOptions || options;
var src = [
'source/' + path + '/js/base_work_begin.js',
'source/' + path + '/js/base_concat_head.js',
'source/o2_core/o2/lp/'+(option.lp || 'zh-cn')+'.js',
'source/x_component_process_Work/lp/'+(option.lp || 'zh-cn')+'.js',
'source/x_component_process_Xform/lp/'+(option.lp || 'zh-cn')+'.js',
'source/x_component_Selector/lp/'+(option.lp || 'zh-cn')+'.js',
'source/' + path + '/js/base_work_style_temp.js',
'source/o2_core/o2/widget/Common.js',
'source/o2_core/o2/widget/Dialog.js',
'source/o2_core/o2/widget/UUID.js',
......@@ -373,7 +467,6 @@ function createBaseWorkConcatTask(path, isMin, thisOptions) {
'source/o2_core/o2/xDesktop/UserData.js',
'source/x_component_Template/MPopupForm.js',
'source/o2_core/o2/xDesktop/Authentication.js',
'source/o2_core/o2/xDesktop/Dialog.js',
'source/o2_core/o2/xDesktop/Window.js',
'source/x_component_Common/Main.js',
'source/x_component_process_Work/Main.js',
......@@ -397,7 +490,9 @@ function createBaseWorkConcatTask(path, isMin, thisOptions) {
'source/o2_core/o2/xAction/services/x_organization_assemble_control.js',
'source/o2_core/o2/xAction/services/x_query_assemble_surface.js',
'source/o2_core/o2/xAction/services/x_organization_assemble_personal.js',
'source/' + path + '/js/base_work_end.js',
'source/' + path + '/js/base_work_actions_temp.js',
'source/' + path + '/js/base.js'
];
var dest = option.dest+'/' + path + '/';
......@@ -439,6 +534,161 @@ function createBaseWorkConcatTask(path, isMin, thisOptions) {
.pipe(gulp.dest(dest))
});
}
function createBaseWorkConcatTask(path, isMin, thisOptions){
createBaseWorkConcatActionTask(path);
createBaseWorkConcatStyleTask(path);
createBaseWorkConcatBodyTask(path, isMin, thisOptions);
createBaseWorkConcatDelTempTask(path);
gulp.task( path+".base_work", gulp.series(path+".base_work : action", path+".base_work : style", path+".base_work : concat", path+".base_work : clean"));
}
function createBasePortalConcatStyleTask(path){
gulp.task(path+".base_portal : style", function(){
return gulp.src([
"source/x_component_process_Work/$Main/default/css.wcss",
"source/x_component_portal_Portal/$Main/default/css.wcss",
"source/x_component_process_Xform/$Form/default/css.wcss"
])
.pipe(concat_Style())
.pipe(concat('js/base_portal_style_temp.js'))
.pipe(gulp.dest('source/x_desktop/'))
})
}
function createBasePortalConcatActionTask(path){
gulp.task(path+".base_portal : action", function(){
return gulp.src([
"source/o2_core/o2/xAction/services/x_organization_assemble_authentication.json",
"source/o2_core/o2/xAction/services/x_portal_assemble_surface.json",
"source/o2_core/o2/xAction/services/x_organization_assemble_control.json",
"source/o2_core/o2/xAction/services/x_query_assemble_surface.json",
"source/o2_core/o2/xAction/services/x_cms_assemble_control.json",
"source/o2_core/o2/xAction/services/x_program_center.json",
"source/o2_core/o2/xAction/services/x_organization_assemble_personal.json"
])
.pipe(concat_Actions())
.pipe(concat('js/base_portal_actions_temp.js'))
.pipe(gulp.dest('source/x_desktop/'))
})
}
function createBasePortalConcatDelTempTask(path) {
gulp.task(path+".base_portal : clean", function(cb){
var dest = [
'source/'+path+'/js/base_portal_actions_temp.js',
'source/'+path+'/js/base_portal_style_temp.js'
];
return del(dest, cb);
});
}
function createBasePortalConcatBodyTask(path, isMin, thisOptions) {
gulp.task(path+".base_portal : concat", function(){
var option = thisOptions || options;
var src = [
'source/' + path + '/js/base_concat_head.js',
'source/o2_core/o2/lp/'+(option.lp || 'zh-cn')+'.js',
'source/' + path + '/js/base_portal_style_temp.js',
'source/o2_core/o2/widget/Common.js',
'source/o2_core/o2/widget/Dialog.js',
'source/o2_core/o2/widget/UUID.js',
'source/o2_core/o2/widget/Menu.js',
'source/o2_core/o2/widget/Toolbar.js',
'source/o2_core/o2/xDesktop/Common.js',
'source/o2_core/o2/xDesktop/Actions/RestActions.js',
'source/o2_core/o2/xAction/RestActions.js',
'source/o2_core/o2/xDesktop/Access.js',
'source/o2_core/o2/xDesktop/Dialog.js',
'source/o2_core/o2/xDesktop/Menu.js',
'source/o2_core/o2/xDesktop/UserData.js',
'source/x_component_Template/MPopupForm.js',
'source/o2_core/o2/xDesktop/Authentication.js',
'source/o2_core/o2/xDesktop/Window.js',
'source/x_component_Common/Main.js',
'source/x_component_process_Work/lp/'+(option.lp || 'zh-cn')+'.js',
'source/x_component_portal_Portal/lp/'+(option.lp || 'zh-cn')+'.js',
'source/x_component_process_Xform/lp/'+(option.lp || 'zh-cn')+'.js',
'source/x_component_Selector/lp/'+(option.lp || 'zh-cn')+'.js',
'source/x_component_portal_Portal/Main.js',
'source/x_component_Selector/package.js',
'source/x_component_Selector/Person.js',
'source/x_component_Selector/Identity.js',
'source/x_component_Selector/Unit.js',
'source/x_component_Selector/IdentityWidthDuty.js',
'source/x_component_Selector/IdentityWidthDutyCategoryByUnit.js',
'source/x_component_Selector/UnitWithType.js',
'source/o2_core/o2/xScript/Actions/UnitActions.js',
'source/o2_core/o2/xScript/Actions/ScriptActions.js',
'source/o2_core/o2/xScript/Actions/CMSScriptActions.js',
'source/o2_core/o2/xScript/Actions/PortalScriptActions.js',
'source/o2_core/o2/xScript/PageEnvironment.js',
'source/o2_core/o2/xAction/services/x_organization_assemble_authentication.js',
'source/o2_core/o2/xAction/services/x_cms_assemble_control.js',
'source/o2_core/o2/xAction/services/x_organization_assemble_control.js',
'source/o2_core/o2/xAction/services/x_query_assemble_surface.js',
'source/o2_core/o2/xAction/services/x_organization_assemble_personal.js',
'source/' + path + '/js/base_portal_actions_temp.js',
'source/' + path + '/js/base.js'
];
var dest = option.dest+'/' + path + '/';
return gulp.src(src)
.pipe(concat('js/base_portal.js'))
.pipe(gulpif((option.upload == 'local' && option.location != ''), gulp.dest(option.location + path + '/')))
.pipe(gulpif((option.upload == 'ftp' && option.host != ''), ftp({
host: option.host,
user: option.user || 'anonymous',
pass: option.pass || '@anonymous',
port: option.port || 21,
remotePath: (option.remotePath || '/') + path
})))
.pipe(gulpif((option.upload == 'sftp' && option.host != ''), sftp({
host: option.host,
user: option.user || 'anonymous',
pass: option.pass || null,
port: option.port || 22,
remotePath: (option.remotePath || '/') + path
})))
.pipe(gulp.dest(dest))
// .pipe(gulp.src(src))
.pipe(concat('js/base_portal.min.js'))
.pipe(uglify())
// .pipe(rename({ extname: '.min.js' }))
.pipe(gulpif((option.upload == 'local' && option.location != ''), gulp.dest(option.location + path + '/')))
.pipe(gulpif((option.upload == 'ftp' && option.host != ''), ftp({
host: option.host,
user: option.user || 'anonymous',
pass: option.pass || '@anonymous',
port: option.port || 21,
remotePath: (option.remotePath || '/') + path
})))
.pipe(gulpif((option.upload == 'sftp' && option.host != ''), sftp({
host: option.host,
user: option.user || 'anonymous',
pass: option.pass || null,
port: option.port || 22,
remotePath: (option.remotePath || '/') + path
})))
.pipe(gulp.dest(dest))
});
}
function createBasePortalConcatTask(path, isMin, thisOptions){
createBasePortalConcatActionTask(path);
createBasePortalConcatStyleTask(path);
createBasePortalConcatBodyTask(path, isMin, thisOptions);
createBasePortalConcatDelTempTask(path);
gulp.task( path+".base_portal", gulp.series(path+".base_portal : action", path+".base_portal : style", path+".base_portal : concat", path+".base_portal : clean"));
}
function getAppTask(path, isMin, thisOptions) {
if (path==="x_component_process_Xform"){
createDefaultTask(path, isMin, thisOptions);
......@@ -451,7 +701,9 @@ function getAppTask(path, isMin, thisOptions) {
}else if (path==="x_desktop") {
createDefaultTask(path, isMin, thisOptions);
createBaseWorkConcatTask(path, isMin, thisOptions);
return gulp.series(path, path+".base_work : concat");
createBasePortalConcatTask(path, isMin, thisOptions);
return gulp.series(path, path+".base_work", path+".base_portal");
//return gulp.series(path, path+".base_work : concat");
}else{
createDefaultTask(path, isMin, thisOptions);
return gulp.series(path);
......
MWF.xApplication.Selector=MWF.xApplication.Selector||{};
MWF.xApplication.Selector.LP = MWF.SelectorLP = {
"title": "Select",
"multiSelectTitle": "Select",
......
MWF.xApplication.Selector=MWF.xApplication.Selector||{};
MWF.xApplication.Selector.LP = MWF.SelectorLP = {
"title": "选择",
"multiSelectTitle": "选择",
......@@ -50,3 +51,4 @@ MWF.xApplication.Selector.LP = MWF.SelectorLP = {
"ok": "确定",
"noPerson": "人员“{name}”不存在"
};
MWF.xApplication.Selector["lp."+o2.language] = MWF.xApplication.Selector.LP;
MWF.xApplication.Selector = MWF.xApplication.Selector || {};
MWF.xDesktop.requireApp("Selector", "lp."+MWF.language, null, false);
//MWF.xDesktop.requireApp("Selector", "Actions.RestActions", null, false);
MWF.O2Selector = new Class({
o2.xApplication.Selector.package = MWF.O2Selector = new Class({
Implements: [Options],
options: {
"count": 0,
......
MWF.xApplication.portal = MWF.xApplication.portal || {};
MWF.xApplication.portal.Portal = MWF.xApplication.portal.Portal || {};
MWF.xApplication.portal.Portal.options = Object.clone(o2.xApplication.Common.options);
MWF.xApplication.portal.Portal.options.multitask = true;
MWF.xApplication.portal.Portal.Main = new Class({
Extends: MWF.xApplication.Common.Main,
......@@ -82,18 +86,17 @@ MWF.xApplication.portal.Portal.Main = new Class({
}
},
toPage: function(name, par, nohis){
debugger;
if (!nohis) this.doHistory(name, this.portal.id);
if (name){
var m = (layout.mobile) ? "getPageByNameMobile" : "getPageByName";
this.action[m](name, this.portal.id, function(json){
this.pageInfor = json.data;
this.setTitle(this.portal.name+"-"+json.data.name);
var page = (json.data.data) ? JSON.decode(MWF.decodeJsonString(json.data.data)): null;
var pageJson = null;
var loadModuleFlag = false;
var check = function(){
if (!!pageJson && loadModuleFlag){
layout.sessionPromise.then(function(){
this.pageInfor = pageJson.data;
this.setTitle(this.portal.name+"-"+pageJson.data.name);
var page = (pageJson.data.data) ? JSON.decode(MWF.decodeJsonString(pageJson.data.data)): null;
if (page){
this.options.pageId = json.data.id;
this.options.pageId = pageJson.data.id;
if (this.appForm) this.appForm.fireEvent("beforeClose");
Object.keys(this.$events).each(function(k){
......@@ -107,37 +110,85 @@ MWF.xApplication.portal.Portal.Main = new Class({
this.openPortal(par);
}
}.bind(this));
}
}.bind(this);
if (name){
var m = (layout.mobile) ? "getPageByNameMobile" : "getPageByName";
this.action[m](name, this.portal.id, function(json){
pageJson = json;
check();
}.bind(this));
var cl = "$all";
MWF.xDesktop.requireApp("process.Xform", cl, function(){
loadModuleFlag = true;
check();
});
}else{
if (this.options.pageId){
var m = (layout.mobile) ? "getPageByNameMobile" : "getPageByName";
this.action[m](this.options.pageId, this.portal.id, function(json){
this.pageInfor = json.data;
this.setTitle(this.portal.name+"-"+json.data.name);
var page = (json.data.data) ? JSON.decode(MWF.decodeJsonString(json.data.data)): null;
if (page){
this.options.pageId = json.data.id;
if (this.appForm) this.appForm.fireEvent("beforeClose");
Object.keys(this.$events).each(function(k){
this.removeEvents(k);
pageJson = json;
check();
}.bind(this));
MWF.release(this.appForm);
this.appForm = null;
this.formNode.empty();
this.page = page;
this.openPortal(par);
MWF.xDesktop.requireApp("process.Xform", "$all", function(){
loadModuleFlag = true;
check();
});
}
}
},
loadPortal: function(par, callback){
if (this.options.pageId || this.options.widgetId){
this.loadPortalPage(par, callback);
this.getPageData();
}else{
this.getPageData(function(json){
this.options.pageId = this.portal.firstPage;
this.loadPortalPage();
});
}
},
loadPortalPage: function(par, callback){
var pageJson = null;
var loadModuleFlag = false;
var check = function(){
if (!!pageJson && loadModuleFlag){
layout.sessionPromise.then(function(){
this.setTitle(pageJson.data.name);
this.page = (pageJson.data.data) ? JSON.decode(MWF.decodeJsonString(pageJson.data.data)): null;
this.pageInfor = pageJson.data;
this.openPortal(par, callback);
}.bind(this));
}
}.bind(this);
var m;
if( this.options.widgetId ){
m = (layout.mobile) ? "getWidgetByNameMobile" : "getWidgetByName";
}else{
m = (layout.mobile) ? "getPageByNameMobile" : "getPageByName";
}
this.action[m]( this.options.widgetId || this.options.pageId, this.options.portalId, function(json){
pageJson = json;
check();
}.bind(this));
MWF.xDesktop.requireApp("process.Xform", "$all", function(){
loadModuleFlag = true;
check();
});
},
loadPortal: function(par, callback){
getPageData: function(callback){
if (this.portal){
if (callback) callback(this.portal);
return ;
}
this.action.getApplication(this.options.portalId, function(json){
this.portal = json.data;
this.setTitle(this.portal.name);
if (!this.options.pageId) this.options.pageId = this.portal.firstPage;
if (this.portal.icon){
if (this.taskitem){
this.taskitem.iconNode.setStyles({
......@@ -146,31 +197,13 @@ MWF.xApplication.portal.Portal.Main = new Class({
});
}
}
var m;
if( this.options.widgetId ){
m = (layout.mobile) ? "getWidgetByNameMobile" : "getWidgetByName";
}else{
m = (layout.mobile) ? "getPageByNameMobile" : "getPageByName";
}
this.action[m]( this.options.widgetId || this.options.pageId, this.options.portalId, function(json){
// if (layout.mobile) {
// this.page = (json.data.mobileData) ? JSON.decode(MWF.decodeJsonString(json.data.mobileData)): null;
// if (!this.page || !this.page.json.moduleList.length){
// this.page = (json.data.data) ? JSON.decode(MWF.decodeJsonString(json.data.data)): null;
// }
// }else{
this.setTitle(this.portal.name+"-"+json.data.name);
this.page = (json.data.data) ? JSON.decode(MWF.decodeJsonString(json.data.data)): null;
this.pageInfor = json.data;
// }
this.openPortal(par, callback);
}.bind(this));
if (callback) callback(json)
}.bind(this));
},
openPortal: function(par, callback){
if (this.page){
MWF.xDesktop.requireApp("process.Xform", "Form", function(){
//MWF.xDesktop.requireApp("process.Xform", "Form", function(){
this.appForm = new MWF.APPForm(this.formNode, this.page, {
"macro": "PageContext",
"parameters": par
......@@ -189,7 +222,7 @@ MWF.xApplication.portal.Portal.Main = new Class({
if (callback) callback();
if (this.mask) this.mask.hide();
}.bind(this));
//}.bind(this));
}
},
recordStatus: function(){
......
MWF.xApplication.portal = MWF.xApplication.portal || {};
MWF.xApplication.portal.Portal = MWF.xApplication.portal.Portal || {};
MWF.xApplication.portal.Portal.LP = {
"title": "门户"
};
MWF.xApplication.portal.Portal["lp."+o2.language] = MWF.xApplication.portal.Portal.LP;
......@@ -69,3 +69,4 @@ MWF.xApplication.process.Work.LP = {
"managerLoginConfirmContent" : "确定要以{user}身份登录并打开文件?点击确定后,需注销重新登录才能回到当前用户。",
"managerLoginSuccess" : "已成功切换为{user}"
};
MWF.xApplication.process.Work["lp."+o2.language] = MWF.xApplication.process.Work.LP;
MWF.xApplication.process = MWF.xApplication.process || {};
MWF.xApplication.process.Xform = MWF.xApplication.process.Xform || {};
MWF.xApplication.process.Xform.LP = {
"ok": "确定",
"deleteDatagridLineTitle":"删除条目确认",
......@@ -238,3 +240,4 @@ MWF.xApplication.process.Xform.LP = {
"fullWidth": "已启用半角空格自动转换为全角空格,如需输入半角空格,请使用:SHIFT+空格"
};
MWF.xApplication.process.Xform["lp."+o2.language] = MWF.xApplication.process.Xform.LP;
......@@ -494,6 +494,7 @@ o2.addReady(function () {
this.resolveReturn = this;
//先判断用户是否登录
console.log("layout.sessionPromise.init")
o2.Actions.get("x_organization_assemble_authentication").getAuthentication(function (json) {
this.status = "fulfilled";
this.resolveReturn = json.data;
......@@ -540,7 +541,7 @@ o2.addReady(function () {
layout.session.user = data;
layout.session.token = data.token;
layout.desktop.session = layout.session;
_loadApp();
}, function(){
//允许匿名访问
if (layout.anonymous) {
......@@ -550,7 +551,7 @@ o2.addReady(function () {
layout.session.user = data;
layout.session.token = data.token;
layout.desktop.session = layout.session;
_loadApp();
//_loadApp();
} else {
_loadProgressBar(true);
if (layout.yqwx) {
......@@ -560,6 +561,7 @@ o2.addReady(function () {
}
}
});
_loadApp();
// //先判断用户是否登录
// o2.Actions.get("x_organization_assemble_authentication").getAuthentication(function (json) {
......
layout = {};
o2.xApplication = o2.xApplication || {};
o2.widget = o2.widget || {};
o2.widget.css = o2.widget.css || {};
o2.xDesktop = o2.xDesktop || {};
o2.xDesktop.$all=true;
o2.xDesktop.Common=true;
此差异已折叠。
o2.xDesktop.$all=true;
o2.xDesktop.Common=true;
o2.xApplication.Selector.package = MWF.O2Selector;
//layout.addReady(function(){
o2.Actions.actions["x_organization_assemble_authentication"] = new o2.xAction.RestActions.Action["x_organization_assemble_authentication"]("x_organization_assemble_authentication", orgActins);
o2.Actions.actions["x_processplatform_assemble_surface"] = new o2.xAction.RestActions.Action["x_processplatform_assemble_surface"]("x_processplatform_assemble_surface", processActins);
o2.Actions.actions["x_cms_assemble_control"] = new o2.xAction.RestActions.Action["x_cms_assemble_control"]("x_cms_assemble_control", cmsActins);
o2.Actions.actions["x_organization_assemble_control"] = new o2.xAction.RestActions.Action["x_organization_assemble_control"]("x_organization_assemble_control", orgControlActins);
o2.Actions.actions["x_query_assemble_surface"] = new o2.xAction.RestActions.Action["x_query_assemble_surface"]("x_query_assemble_surface", queryActins);
o2.xAction.RestActions.Action["x_program_center"] = new Class({Extends: o2.xAction.RestActions.Action});
o2.Actions.actions["x_program_center"] = new o2.xAction.RestActions.Action["x_program_center"]("x_program_center", centerActins);
o2.Actions.actions["x_organization_assemble_personal"] = new o2.xAction.RestActions.Action["x_organization_assemble_personal"]("x_organization_assemble_personal", personalActions);
//});
......@@ -30,16 +30,16 @@ layout.addReady(function(){
layout.openApplication(null, appName, option||{}, m_status);
};
if (layout.session && layout.session.user){
// if (layout.session && layout.session.user){
// _load();
// }else{
// if (layout.sessionPromise){
// layout.sessionPromise.then(function(){
// _load();
// });
// }
// }
_load();
}else{
if (layout.sessionPromise){
layout.sessionPromise.then(function(){
_load();
});
}
}
//_load();
window.addEventListener('popstate', function (event) {
uri = new URI(document.location.href);
......
......@@ -37,15 +37,16 @@ layout.addReady(function(){
});
};
if (layout.session && layout.session.user){
_load();
}else{
if (layout.sessionPromise){
layout.sessionPromise.then(function(){
_load();
});
}
}
// if (layout.session && layout.session.user){
// _load();
// }else{
// if (layout.sessionPromise){
//
// }
// }
})(layout);
});
......
......@@ -5,11 +5,7 @@
<link rel="stylesheet" type="text/css" href="css/style.css" charset="UTF-8" />
<link rel="stylesheet" href="css/mBoxNotice.css" charset="UTF-8" />
<link rel="stylesheet" href="css/mBoxTooltip.css" charset="UTF-8" />
<script src="../o2_core/o2.min.js"></script>
<script src="../o2_lib/Decimal.js"></script>
<script src="js/base.min.js"></script>
<script src="js/portal.min.js"></script>
<link rel="icon" href="data:;">
<title></title>
......@@ -23,5 +19,10 @@
<div id="appContent" style="overflow: hidden; height:100%;">
<div id="loaddingArea" style="overflow: hidden;width:0px; height:2px; background-color:#4e82bd; position: absolute; top: 0; z-index: 10000"></div>
</div>
<script src="../o2_core/o2.min.js"></script>
<script src="../o2_lib/Decimal.js"></script>
<script src="js/base_work.min.js"></script>
<script src="js/portal.min.js"></script>
</body>
</html>
......@@ -2,14 +2,10 @@
<html lang="zh-CN">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<link rel="stylesheet" type="text/css" href="css/style.css" charset="UTF-8" />
<link rel="stylesheet" href="css/mBoxNotice.css" charset="UTF-8" />
<link rel="stylesheet" href="css/mBoxTooltip.css" charset="UTF-8" />
<script src="../o2_core/o2.min.js"></script>
<script src="../o2_lib/Decimal.js"></script>
<script src="js/base.min.js"></script>
<script src="js/portal.min.js"></script>
<script>layout.mobile = true;</script>
<link rel="stylesheet" type="text/css" href="css/style_all.css" charset="UTF-8" />
<!-- <link rel="stylesheet" href="css/mBoxNotice.css" charset="UTF-8" />-->
<!-- <link rel="stylesheet" href="css/mBoxTooltip.css" charset="UTF-8" />-->
<link rel="icon" href="data:;">
<title></title>
......@@ -23,6 +19,12 @@
<div id="appContent" style="overflow: hidden; height:100%;">
<div id="loaddingArea" style="overflow: hidden;width:0px; height:2px; background-color:#4e82bd; position: absolute; top: 0; z-index: 100"></div>
</div>
<div id="appContentMask" style="overflow: hidden; height:100%; position: relative; top: -100%; background-image:url('../x_desktop/img/launch_background.png'); background-size: cover"></div>
<div id="appContentMask" style="overflow: hidden; height:100%; position: relative; top: -100%; background-size: cover"></div>
<script src="../o2_core/o2.min.js"></script>
<script src="../o2_lib/Decimal.js"></script>
<script src="js/base_portal.min.js"></script>
<script src="js/portal.min.js"></script>
<script>layout.mobile = true;</script>
</body>
</html>
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册