view.html
3.76 KB
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
<html>
<head>
    <script>
        function getUrlParam(name) {
            var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
            var r = window.location.search.substr(1).match(reg);
            if (r != null)
                return unescape(r[2])
            return null;
        }
        function getResourceUrl(resourcetype, isPc) {
            switch (resourcetype) {
                case 0:
                case 152:
                    if (isPc) {
                        return "/workflow/request/ViewRequestForwardSPA.jsp?requestid=";
                    } else {
                        return "/spa/workflow/static4mobileform/index.html?_random=" + new Date().getTime() + "#/req?openWay=messageCenter&requestid=";
                    }
                case 1:
                case 37:
                    if (isPc) {
                        return "/spa/document/index.jsp?id=";
                    } else {
                        return "/spa/document/static4mobile/index.html#/doc/";//E9移动端文档详情页
                    }
                case 7:
                case 18:
                    if (isPc) {
                        return "/spa/crm/static/index.html#/main/crm/customerView?customerId=";
                    } else {
                        return "/mobile/plugin/crm_new/index.jsp#&/mobile/plugin/crm_new/customer.jsp?id=";
                    }
                case 2:
                    if (isPc) {
                        return "/spa/workplan/static/index.html#/main/wp/workPlanCreateSingle?workPlanId=";
                    } else {
                        return "/spa/workplan/static4mobile/index.html#/detail?workplanId=";
                    }
                case 28:
                    if (isPc) {
                        return "/spa/meeting/static/index.html#/main/meeting/dialogsingle?meetingid=";
                    } else {
                        return "/spa/meeting/static4mobile/index.html#/calendar/detail?meetingid=";
                    }
                default:
                    return "";
            }
        }
        var params = window.location.search;
        var resourcetype = getUrlParam('resourcetype');
        var resourceid = getUrlParam('resourceid');
        if (resourcetype == null) resourcetype = 0;
        var clientType = getUrlParam('em_client_type');
        var isPc = clientType == null || clientType == 'pc';
        var url = getResourceUrl(parseInt(resourcetype), isPc);
        if ((resourcetype == 1 || resourcetype == 37) && !isPc) {
            url += resourceid;
            url += params;
        } else {
            url += resourceid;
            url += params.replace('?', '&');
        }
        if ((resourcetype == 0 || resourcetype == 152) && !isPc) {
            var em_url = window.localStorage.getItem("wf_em_url");
            var em_url_open = window.localStorage.getItem("wf_em_url");
            if (window.performance.navigation.type && (em_url_open || em_url)) {
                var src = em_url_open ? em_url_open + "/open/js/jem.js" : em_url + "/open/js/jem.js"
                var head = document.getElementsByTagName("head")[0];
                var script = document.createElement('script');
                script.type = 'text/javascript';
                script.src = src;
                script.onload = function () {
                    em.ready(function () {
                        em.closeWindow();
                    })
                }
                head.appendChild(script);
                window.localStorage.removeItem("wf_em_url");
                window.localStorage.removeItem("wf_em_url_open");
            } else {
                window.location.href = url;
            }
        } else {
            window.location.href = url;
        }
    </script>
</head>
<body>
</body>
</html>