diff options
Diffstat (limited to 'openo-portal/portal-common/src/main/webapp/common/js')
6 files changed, 169 insertions, 251 deletions
diff --git a/openo-portal/portal-common/src/main/webapp/common/js/core/const.js b/openo-portal/portal-common/src/main/webapp/common/js/core/const.js index fc1e69bd..d8a3371e 100644 --- a/openo-portal/portal-common/src/main/webapp/common/js/core/const.js +++ b/openo-portal/portal-common/src/main/webapp/common/js/core/const.js @@ -25,7 +25,7 @@ var IS_V5_TESTVERSION = true; var FrameConst={}; //默认登录成功跳转页面 -FrameConst.DEFAULT_LOGINSKIP_PAGE = "main-page.html"; +FrameConst.DEFAULT_LOGINSKIP_PAGE = "common/main-page.html"; FrameConst.do_heartbeat = false; FrameConst.change_pass = false; diff --git a/openo-portal/portal-common/src/main/webapp/common/js/international/loadi18n-login.js b/openo-portal/portal-common/src/main/webapp/common/js/international/loadi18n-login.js index bdbb4057..ac9f77e0 100644 --- a/openo-portal/portal-common/src/main/webapp/common/js/international/loadi18n-login.js +++ b/openo-portal/portal-common/src/main/webapp/common/js/international/loadi18n-login.js @@ -20,7 +20,7 @@ function loadProperties_login(lang) { path:'./common/i18n/', mode:'map', callback: function() { - var i18nItems = $('[name_i18n=com_zte_ums_ict_framework_ui_i18n_login]'); + var i18nItems = $('[name_i18n=openo_login_i18n_login]'); for (var i = 0; i < i18nItems.length; i++) { var $item = $(i18nItems.eq(i)); var itemId = $item.attr('id'); diff --git a/openo-portal/portal-common/src/main/webapp/common/js/international/loadi18n.js b/openo-portal/portal-common/src/main/webapp/common/js/international/loadi18n.js index d62dbbd9..adfcbb98 100644 --- a/openo-portal/portal-common/src/main/webapp/common/js/international/loadi18n.js +++ b/openo-portal/portal-common/src/main/webapp/common/js/international/loadi18n.js @@ -14,97 +14,55 @@ * limitations under the License. */ var lang = getLanguage(); -//lang = 'en-US'; -//鍔犺浇涓婚〉闈ead閮ㄥ垎鍥介檯鍖 -function loadProperties(lang){ - jQuery.i18n.properties({ - language:lang, - name:'web-framework-integration-i18n', - path:'i18n/', // 璧勬簮鏂囦欢璺緞 - mode:'map', // 鐢 Map 鐨勬柟寮忎娇鐢ㄨ祫婧愭枃浠朵腑鐨勫 - callback: function() {// 鍔犺浇鎴愬姛鍚庤缃樉绀哄唴瀹 - var i18nItems = $('[name_i18n=com_zte_ums_ict_framework_ui_i18n]'); - for(var i=0;i<i18nItems.length;i++){ - var $item = $(i18nItems.eq(i)); - var itemId = $item.attr('id'); - if(typeof($item.attr("title"))!="undefined"){ +function loadProperties(lang) { + jQuery.i18n.properties({ + language:lang, + name:'web-framework-integration-i18n', + path:'./common/i18n/', + mode:'map', + callback: function() { + var i18nItems = $('[name_i18n=openo_main_page_i18n]'); + for (var i = 0; i < i18nItems.length; i++) { + var $item = $(i18nItems.eq(i)); + var itemId = $item.attr('id'); + if (typeof($item.attr("title")) != "undefined") { $item.attr("title", $.i18n.prop(itemId)); - }else{ + } else { $item.text($.i18n.prop(itemId)); } - } - } - }); + } + } + }); } -function loadi18n_WebFramework_1(){ - $.getScript("js/tools.js", function(){ - var lang = getLanguage(); - loadProperties(lang); - }); +function loadi18n_WebFramework() { + loadProperties(lang); } -function loadi18n_WebFramework(){ - loadProperties(lang); -} - -/* -function loadPropertiesSideMenu(lang){ - jQuery.i18n.properties({ - language:lang, - name:'web-framework-i18n', - path:'i18n/', // 璧勬簮鏂囦欢璺緞 - mode:'map', // 鐢 Map 鐨勬柟寮忎娇鐢ㄨ祫婧愭枃浠朵腑鐨勫 - callback: function() {// 鍔犺浇鎴愬姛鍚庤缃樉绀哄唴瀹 - var i18nItems = $('[name=com_zte_ums_ict_framework_ui_i18n]'); - for(var i=0;i<i18nItems.length;i++){ - var $item = $(i18nItems.eq(i)); - var itemId = $item.attr('id'); - if(typeof($item.attr("placeholder"))=="undefined"){ - $item.text($.i18n.prop(itemId)); - }else{ - $item.attr("placeholder", $.i18n.prop(itemId)); - } - } - } - }); -}*/ - -/** -* 鍥介檯鍖栬祫婧愭枃浠跺姞杞藉嚱鏁帮紱 -* 鐩稿簲鍙傛暟涓哄綋鍓嶈瑷锛堢敱妗嗘灦浠庡悗绔彇寰楋級锛屽浗闄呭寲璧勬簮鏂囦欢鍚嶅墠缂锛岃祫婧愭枃浠舵墍鍦ㄨ矾寰勩 -*/ -/** -* 鍥介檯鍖栬祫婧愭枃浠跺姞杞藉嚱鏁帮紱 -* 鐩稿簲鍙傛暟涓哄綋鍓嶈瑷锛堢敱妗嗘灦浠庡悗绔彇寰楋級锛屽浗闄呭寲璧勬簮鏂囦欢鍚嶅墠缂锛岃祫婧愭枃浠舵墍鍦ㄨ矾寰勩 -*/ -function loadPropertiesSideMenu(lang, propertiesFileNamePrefix, propertiesFilePath , name_I18n){ - console.info('loadPropertiesSideMenu has been called ' + propertiesFilePath); - if(!name_I18n) name_I18n='com_zte_ums_ict_framework_ui_i18n_sideMenu'; - jQuery.i18n.properties({ - language:lang, - name:propertiesFileNamePrefix, - path:propertiesFilePath, // 璧勬簮鏂囦欢璺緞 - mode:'map', // 鐢 Map 鐨勬柟寮忎娇鐢ㄨ祫婧愭枃浠朵腑鐨勫 - callback: function() {// 鍔犺浇鎴愬姛鍚庤缃樉绀哄唴瀹 +function loadPropertiesSideMenu(lang, propertiesFileNamePrefix, propertiesFilePath , name_I18n) { + if(!name_I18n) name_I18n='openo_main_page_i18n'; + jQuery.i18n.properties({ + language:lang, + name:propertiesFileNamePrefix, + path:propertiesFilePath, + mode:'map', + callback: function() { var i18nItems = $('[name_i18n='+ name_I18n + ']'); - for(var i=0;i<i18nItems.length;i++){ - var $item = $(i18nItems.eq(i)); - var itemId = $item.attr('id'); - if(typeof($item.attr("placeholder"))=="undefined"){ + for (var i = 0; i < i18nItems.length; i++) { + var $item = $(i18nItems.eq(i)); + var itemId = $item.attr('id'); + if (typeof($item.attr("placeholder")) == "undefined") { $item.text($.i18n.prop(itemId)); - }else{ + } else { $item.attr("placeholder", $.i18n.prop(itemId)); } - } - } - }); + } + } + }); } -function loadi18n_WebFramework_sideMenu(){ - //榛樿0鍦烘櫙鑿滃崟璧勬簮鏂囦欢 - //loadPropertiesSideMenu(lang, 'web-framework-i18n', 'i18n/'); - //鍔犺浇鍚勫簲鐢ㄨ彍鍗曡祫婧愭枃浠 +function loadi18n_WebFramework_sideMenu() { var srcpath ="i18n/"; - loadPropertiesSideMenu(lang , 'web-framework-integration-i18n', srcpath);} + loadPropertiesSideMenu(lang , 'web-framework-integration-i18n', srcpath); +} diff --git a/openo-portal/portal-common/src/main/webapp/common/js/login.js b/openo-portal/portal-common/src/main/webapp/common/js/login.js index 9e2e7f3a..ccc150a4 100644 --- a/openo-portal/portal-common/src/main/webapp/common/js/login.js +++ b/openo-portal/portal-common/src/main/webapp/common/js/login.js @@ -19,8 +19,8 @@ String.prototype.trim = function() { function loginSubmitHandler(form) { var params = {}; - params["username"] = $("#inputUserName").val().trim(); - var sourcePass = $("#inputPassword").val(); + params["username"] = $("#openo_input_userName").val().trim(); + var sourcePass = $("#openo_input_password").val(); var pass = sourcePass; if (FrameConst.isEncypt === "true") { pass = ict_framework_func1(pass); @@ -28,27 +28,28 @@ function loginSubmitHandler(form) { params["password"] = pass; params["isEncypted"] = FrameConst.isEncypt; saveUserInfo(params); + location.href = FrameConst.DEFAULT_LOGINSKIP_PAGE; - $.ajax({ - url : FrameConst.REST_LOGIN, - type : 'POST', - data : JSON.stringify(params), - dataType : 'json', - contentType : 'application/json; charset=utf-8', - success : function(data, status, xhr) { - if (data.result == 0) { - var epass = CryptoJS.MD5(params.username+sourcePass); - store("icttka", epass.toLocaleString()); - } - processLoginResult(data,params); - }, - Error : function(xhr, error, exception) { - if (console) { - console.log("login fail:" + error); - console.log(exception); - } - } - }); +// $.ajax({ +// url : FrameConst.REST_LOGIN, +// type : 'POST', +// data : JSON.stringify(params), +// dataType : 'json', +// contentType : 'application/json; charset=utf-8', +// success : function(data, status, xhr) { +// if (data.result == 0) { +// var epass = CryptoJS.MD5(params.username+sourcePass); +// store("icttka", epass.toLocaleString()); +// } +// processLoginResult(data, params); +// }, +// Error : function(xhr, error, exception) { +// if (console) { +// console.log("login fail:" + error); +// console.log(exception); +// } +// } +// }); }; var Login = function () { @@ -70,10 +71,10 @@ var Login = function () { }, messages: { username: { - required: $.i18n.prop('com_zte_ums_ict_login_inputname').replace(/\"/g,'') + required: $.i18n.prop('openo_input_userName').replace(/\"/g,'') }, password: { - required: $.i18n.prop('com_zte_ums_ict_login_inputpwd').replace(/\"/g,'') + required: $.i18n.prop('openo_input_password').replace(/\"/g,'') } }, invalidHandler: function (event, validator) { @@ -182,22 +183,22 @@ var Login = function () { $(document).ready(function() { if (store("remember") == "true") { $("input[name='remember']").attr("checked", "checked"); - $("#inputUserName").val(store("inputUserName")); - $("#inputPassword").val(store("inputPassword")); + $("#openo_input_userName").val(store("openo_input_userName")); + $("#openo_input_password").val(store("openo_input_password")); } }); function saveUserInfo(params) { var rmbcheck = $("input[name='remember']"); if (rmbcheck.attr("checked") == true || rmbcheck.is(':checked')) { - var userName = $("#inputUserName").val(); - var passWord = $("#inputPassword").val(); + var userName = $("#openo_input_userName").val(); + var passWord = $("#openo_input_password").val(); store("remember", "true"); - store("inputUserName", params.username); - store("inputPassword", passWord); + store("openo_input_userName", params.username); + store("openo_input_password", passWord); } else { store.remove("remember"); - store.remove("inputUserName"); - store.remove("inputPassword"); + store.remove("openo_input_userName"); + store.remove("openo_input_password"); } } diff --git a/openo-portal/portal-common/src/main/webapp/common/js/mainpage/ict.main.page.js b/openo-portal/portal-common/src/main/webapp/common/js/mainpage/ict.main.page.js deleted file mode 100644 index 6ccb3e52..00000000 --- a/openo-portal/portal-common/src/main/webapp/common/js/mainpage/ict.main.page.js +++ /dev/null @@ -1,138 +0,0 @@ -/* - * Copyright 2016, CMCC Technologies Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -var initMainPage = function(){ - var modules; - var resConfig; - - var lang = getLanguage(); - var propertiesFileNamePrefix = ""; - //var jsonUrl = "json/main-page-" + lang + ".json"; - //var jsonUrl = mainpagePath; - var jsonUrl = "appRes/json/main-page.json"; - var appResExist = false; - - $.ajax({ - async:false, - "type" : "GET", - url: jsonUrl, - dataType: "json", - "success" : function (res, textStatus, jqXHR) { - resConfig = res; - modules = res.modules; - propertiesFileNamePrefix = res.propertiesFileNamePrefix; - appResExist = true; - }, - "error" : function () { - //alert("Config file load error!"); - } - }); - - if(!appResExist){ - jsonUrl = "json/main-page.json"; - $.ajax({ - async:false, - "type" : "GET", - url: jsonUrl, - dataType: "json", - "success" : function (res, textStatus, jqXHR) { - resConfig = res; - modules = res.modules; - propertiesFileNamePrefix = res.propertiesFileNamePrefix; - }, - "error" : function () { - alert("Config file load error!"); - } - }); - } - - var template = "<div class='brick {image}'>" + - "<a id='{linkId}' href='{url}' class='entranceLink'>" + - "<div class='row'>" + - "<div class='cover contentToggle'>{cover}</div>" + - "<div class='{toolsImage}'></div>" + - "<div class='contentTip contentToggle'>{contentTip}</div>" + - "</div>" + - "</a>" + - "</div>"; - - var templatePic = "<div class='brick {image}'>" + - "<div class='row'>" + - "<div class='cover contentToggle'>{cover}</div>" + - "<div class='{toolsImage}'></div>" + - "<div class='contentTip contentToggle'>{contentTip}</div>" + - "</div>" + - "</div>"; - - for (var i = 0; i < modules.length; ++i) { - - if(!modules[i].background){ - alert("Brick background missed!"); - return; - } - - var temp = ""; - - if(modules[i].linkId){ - temp = template.replace("{linkId}", modules[i].linkId) - .replace("{image}", modules[i].background) - .replace("{toolsImage}", modules[i].toolsImage) - .replace("{url}", modules[i].url) - .replace("{contentTip}", modules[i].contentTip); - }else{ - temp = templatePic.replace("{image}", modules[i].background) - .replace("{url}", modules[i].url) - .replace("{contentTip}", ""); - } - - if(modules[i].cover){ - temp = temp.replace("{cover}", "<span id='" + modules[i].cover + "' name_i18n='com_zte_ums_ict_framework_ui_i18n'></span>"); - }else{ - temp = temp.replace("{cover}",""); - } - - $($(".column")[i % 4]).append(temp); - - } - - - $(function() { - - $("#headerName").html("<img src='" + resConfig.productImage + "' />" ); - - $(".brick").mouseover(function(){ - $(".contentTip", this).fadeTo(1000, 1); - $(".cover", this).fadeOut(1000); - }); - - $(".brick").mouseout(function(){ - $(".contentTip", this).fadeTo(1000, 0); - $(".cover", this).fadeIn(1000); - }); - - //娣诲姞妯″潡瀵艰埅閾炬帴 - $("a.entranceLink").click(function(e){ - e.preventDefault(); - if($(this).attr("id") && $(this).attr("id") != "undefined"){ - location.href = "default.html" + "#_" + $(this).attr("id"); - } - }); - - //鍥介檯鍖 - loadPropertiesSideMenu(lang, propertiesFileNamePrefix, "appRes/i18n/" , "com_zte_ums_ict_framework_ui_i18n"); - //loadPropertiesSideMenu(lang, propertiesFileNamePrefix, "i18n/" , "com_zte_ums_ict_framework_ui_i18n"); - loadPropertiesSideMenu(lang, "web-framework-integration-i18n", "i18n/" , "com_zte_ums_ict_framework_ui_i18n"); - }); -}
\ No newline at end of file diff --git a/openo-portal/portal-common/src/main/webapp/common/js/mainpage/load_mainPage.js b/openo-portal/portal-common/src/main/webapp/common/js/mainpage/load_mainPage.js new file mode 100644 index 00000000..05704b56 --- /dev/null +++ b/openo-portal/portal-common/src/main/webapp/common/js/mainpage/load_mainPage.js @@ -0,0 +1,97 @@ +/* + * Copyright 2016, CMCC Technologies Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +var initMainPage = function() { + var modules; + var resConfig; + var lang = getLanguage(); + var propertiesFileNamePrefix = ""; + + $.ajax({ + async : false, + "type" : "GET", + url : "json/main-page.json", + dataType : "json", + "success" : function (res, textStatus, jqXHR) { + resConfig = res; + modules = res.modules; + propertiesFileNamePrefix = res.propertiesFileNamePrefix; + }, + error : function () { + } + }); + + var template = "<div class='brick {image}'>" + + "<a id='{linkId}' href='{url}' class='entranceLink'>" + + "<div class='row'>" + + "<div class='cover contentToggle'>{cover}</div>" + + "<div class='{toolsImage}'></div>" + + "<div class='contentTip contentToggle'>{contentTip}</div>" + + "</div>" + + "</a>" + + "</div>"; + + var templatePic = "<div class='brick {image}'>" + + "<div class='row'>" + + "<div class='cover contentToggle'>{cover}</div>" + + "<div class='{toolsImage}'></div>" + + "<div class='contentTip contentToggle'>{contentTip}</div>" + + "</div>" + + "</div>"; + + for (var i = 0; i < modules.length; ++i) { + var temp = ""; + if (modules[i].linkId) { + temp = template.replace("{linkId}", modules[i].linkId) + .replace("{image}", modules[i].background) + .replace("{toolsImage}", modules[i].toolsImage) + .replace("{url}", modules[i].url) + .replace("{contentTip}", modules[i].contentTip); + } else { + temp = templatePic.replace("{image}", modules[i].background) + .replace("{url}", modules[i].url) + .replace("{contentTip}", ""); + } + + if (modules[i].cover) { + temp = temp.replace("{cover}", "<span id='" + modules[i].cover + "' name_i18n='openo_main_page_i18n'></span>"); + } else { + temp = temp.replace("{cover}",""); + } + + $($(".column")[i % 4]).append(temp); + } + + $(function() { + $(".brick").mouseover(function() { + $(".contentTip", this).fadeTo(1000, 1); + $(".cover", this).fadeOut(1000); + }); + + $(".brick").mouseout(function() { + $(".contentTip", this).fadeTo(1000, 0); + $(".cover", this).fadeIn(1000); + }); + + $("a.entranceLink").click(function(e) { + e.preventDefault(); + if ($(this).attr("id") && $(this).attr("id") != "undefined") { + location.href = "default.html" + "#_" + $(this).attr("id"); + } + }); + + loadPropertiesSideMenu(lang, propertiesFileNamePrefix, "i18n/" , "openo_main_page_i18n"); + }); +}
\ No newline at end of file |