jt
2021-06-10 5d0d028456874576560552f5a5c4e8b801786f11
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
//ajax封装
function ajaxManage(options) {
    var defaults = {
        url: "",
        data: {},
        type: "POST",
        async: false,
        dataType: "json",
        success: function (result) {
            return result;
        }
    };
    var opts = $.extend(defaults, options);
    $.ajax({
        type: opts.type,
        url: opts.url,
        data: opts.data,
        dataType: opts.dataType,
        async: opts.async,
        success: opts.success,
        error: function (XMLHttpRequest, textStatus, errorThrown) {
            console.log(opts.url + " error:");
            console.log(XMLHttpRequest);
            console.log(textStatus);
            console.log(errorThrown);
        }
    });
}
//生产guid
function guid() {
    return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
        var r = Math.random() * 16 | 0, v = c == 'x' ? r : (r & 0x3 | 0x8);
        return v.toString(16);
    });
}
function GetUrlParam(key) {
    // 获取参数
    var url = window.location.search;
    // 正则筛选地址栏
    var reg = new RegExp("(^|&)" + key + "=([^&]*)(&|$)");
    // 匹配目标参数
    var result = url.substr(1).match(reg);
    //返回参数值
    return result ? decodeURIComponent(result[2]) : "";
}
 
function getPoint(obj) { //获取某元素以浏览器左上角为原点的坐标
    var t = obj.offsetTop;
    var l = obj.offsetLeft;
    while (obj = obj.offsetParent) {
        t += obj.offsetTop; //叠加父容器的上边距
        l += obj.offsetLeft; //叠加父容器的左边距
    }
    return { top: t, left: l };
}