bklLiudl
2024-07-23 675b8bcc4a3630d95e3d0b97d933e63442075ecb
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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
@{
    ViewBag.Title = "";
    Layout = null;
}
<!DOCTYPE html>
<html lang="zh" style="height: 100%">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta charset="utf-8" /> 
    <link href="~/Theme/css/bootstrap-grid.min.css" rel="stylesheet" />
    <link href="~/Theme/css/naranja.min.css" rel="stylesheet" />
    <script src="~/Theme/Js/jquery-1.8.3.min.js"></script>
</head>
@*<frameset rows="40,*,30" cols="*" frameborder="no" border="0" framespacing="0">
 
    顶部发104px,底部30px,中间部分自适应
    <frame src="/Home/Top" name="topFrame" scrolling="No" noresize="noresize" id="topFrame" title="topFrame" />
    <frameset cols="193,*" frameborder="no" border="0" framespacing="0" id="middenFram">
        左侧193px,右侧q自适应
        <frame src="/Home/Left" name="leftFrame" scrolling="No" noresize="noresize" id="leftFrame" title="leftFrame" />
        <frame src="/Home/Right" name="mainFrame" id="mainFrame" title="mainFrame" /> /Home/Right
    </frameset>
    <frame src="/Content/Bootom.html" name="bootomFrame" scrolling="No" noresize="noresize" id="bootomFrame" title="topFrame" />
</frameset>*@
 
@*<noframes>
    <body>
    
    </body>
</noframes>*@
<body style="height: 100%">
<iframe src="/Home/HomeIframe" style="height: 100%; width: 100%; border: 0px; padding: 0px; margin: 0px; vertical-align: bottom;" frameborder="0" scrolling="no"></iframe>
    
@*<div class="container">
    <div class="row" style="padding:2em 0">
        <div class="col-md-2">
            <button class="btn btn-error"  onclick="narn('log')">默认(log)</button>
        </div>
        <div class="col-md-2"><button class="btn btn-success" onClick="narn('success')">成功(success)</button></div>
        <div class="col-md-2"><button class="btn btn-warning"  onclick="narn('warn')">警告(warn)</button></div>
        <div class="col-md-2"><button class="btn btn-danger"  onclick="narn('error')">危险(error)</button></div>
    </div>
</div>*@
 
<script src="~/Theme/Js/naranja.js"></script>
<script type="text/javascript">
    function narn(type, text) {
        naranja()[type]({
            title: '新消息提示',
            text: text,
            //src: '/Wcs/TaskMonitor/index',
            timeout: '10000',//keep
            //buttons: [{
            //    text: '接受',
            //    click: function (e) {
            //        naranja().success({
            //            title: '通知',
            //            text: '通知被接受'
            //        })
            //    }
            //}, {
            //    text: '取消',
            //    click: function (e) {
            //        e.closeNotification()
            //    }
            //}]
        })
    }
 
    //narn('warn','测试提示!');
 
    //console.log("ws://" + window.location.hostname + ":" + window.location.port + "/api/WSChat");
    //var ws = new WebSocket("ws://" + window.location.hostname + ":" + window.location.port + "/api/WSChat/Get");
 
    var webSocket;
 
    function Connection() {
        webSocket = new WebSocket("ws://" + window.location.hostname + ":" + window.location.port + "/api/WSChat/Get");
        console.log("ws://" + window.location.hostname + ":" + window.location.port + "/api/WSChat/Get");
        InitEventHandles();
    }
 
    function InitEventHandles() {
        //建立成功
        webSocket.onopen = function () {
            console.log("socket opened");
        }
        //异常
        webSocket.onerror = function () {
            console.log("An exception hai occurred");
        }
        //服务端返回消息回调
        webSocket.onmessage = function (event) {
 
            if (event.data == "0") {
                console.log(event.data);
                narn('warn', event.data);
            }
            
            //Reload();
            //location.reload('/WCS/TaskMonitor/index');
            //var result = new Uint8Array(event.data);
            //console.log(result);
        }
        //webSocket.reload = function () {
        //    console.log('跳转')
        //    //URL: '/WCS/TaskMonitor/index';
        //}
        //关闭连接回调
        webSocket.onclose = function () {
            console.log("socket closed");
        }
    }
 
    function Reload() {
 
        //location.click('Dialog') = '/WCS/TaskMonitor/index';
        console.log('刷新:' + location.href);
        console.log('子界面:' + parent.location)
        //location.reload.console.log("");
        //console.log(breadcrumb);
        //location.replace("/WCS/TaskMonitor/index");
        //$(document).ready(function () {
            //TaskMonitorManager.ToolBar();
        //});
    }
 
    function Send() {
        //向服务器发送数据
        webSocket.send("你好");
    }
 
    function Disconnect() {
        webSocket.close();
    }
 
    Connection();
</script>
 
</body>
</html>