aboutsummaryrefslogtreecommitdiffstats
path: root/openo-portal/portal-common/src/main/webapp/common/js
diff options
context:
space:
mode:
author“shentao” <shentao@chinamobile.com>2016-10-08 21:18:18 +0800
committer“shentao” <shentao@chinamobile.com>2016-10-08 21:18:18 +0800
commit8004db9ae141e537abefd0e95dce2210f2e56d56 (patch)
tree4765ba130abb8a456f1010a2409d156190f9963b /openo-portal/portal-common/src/main/webapp/common/js
parentb0664da6ac21c58e23d99c4ab046977c7501df5f (diff)
modify main_page
Change-Id: I7e80ff78534db0d5c1fcfc69b690858d76a7a924 Signed-off-by: “shentao” <shentao@chinamobile.com>
Diffstat (limited to 'openo-portal/portal-common/src/main/webapp/common/js')
-rw-r--r--openo-portal/portal-common/src/main/webapp/common/js/core/const.js2
-rw-r--r--openo-portal/portal-common/src/main/webapp/common/js/international/loadi18n-login.js2
-rw-r--r--openo-portal/portal-common/src/main/webapp/common/js/international/loadi18n.js116
-rw-r--r--openo-portal/portal-common/src/main/webapp/common/js/login.js65
-rw-r--r--openo-portal/portal-common/src/main/webapp/common/js/mainpage/ict.main.page.js138
-rw-r--r--openo-portal/portal-common/src/main/webapp/common/js/mainpage/load_mainPage.js97
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';
-//加载主页面head部分国际化
-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