2 * Copyright 2016-2017, CMCC Technologies Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 commonUtil.sendSynRequest = function(url){
25 success: function (resp) {
29 error: function(XMLHttpRequest, textStatus, errorThrown){
34 commonUtil.strToJson = function(str){
35 var json = eval('(' + str + ')');
39 commonUtil.arrayRemove = function(aryInstance, index){
40 if (aryInstance == undefined || aryInstance == null) {
43 for (var i = 0, n = 0; i < aryInstance.length; i++) {
44 if (aryInstance[i] != aryInstance[dx]) {
45 aryInstance[n++] = aryInstance[i];
48 aryInstance.length -= 1;
51 // (new Date()).Format("yyyy-MM-dd hh:mm:ss.S") ==> 2006-07-02 08:09:04.423
52 // (new Date()).Format("yyyy-M-d h:m:s.S") ==> 2006-7-2 8:9:4.18
53 commonUtil.parseDate = function(dateObj, format){
55 "M+": dateObj.getMonth() + 1,
56 "d+": dateObj.getDate(),
57 "h+": dateObj.getHours(),
58 "m+": dateObj.getMinutes(),
59 "s+": dateObj.getSeconds(),
60 "q+": Math.floor((dateObj.getMonth() + 3) / 3),
61 "S": dateObj.getMilliseconds()
63 if (/(y+)/.test(format)) format = format.replace(RegExp.$1,
64 (dateObj.getFullYear() + "").substr(4 - RegExp.$1.length));
66 if (new RegExp("(" + k + ")").test(format))
67 format = format.replace(RegExp.$1, RegExp.$1.length == 1 ? o[k] :
68 ("00" + o[k]).substr(("" + o[k]).length));
72 commonUtil.strToJson = function(str){
73 var json = eval('(' + str + ')');