赣州市洪水风险预警系统二维版本
xiebin
2023-03-02 b39483c96ae572121d3c619c0b9d37634e682cc4
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
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
 
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
        <meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no" />
        <title>宣传视频</title>
        <link rel="stylesheet" href="style.css" type="text/css">
    </head>
 
    <body>
        <div class="main-top">
            <div><label>视频名称:</label><input type="text" class="gjz" /></div>
            <input type="button" value="查询" class="cx" />
            <input type="button" value="清空" class="qk" />
        </div>
        <div class="wetland-table" id="wetlandTp">
            <table cellspacing="0">
                <thead>
                    <tr>
                        <th width="4%">序号</th>
                        <th width="40%">视频名称</th>
                        <th width="16%">视频大小</th>
                        <th width="20%">上传时间</th>
                        <th width="20%">操作</th>
                    </tr>
                </thead>
                <tbody>
                    <!--用于动态加载相关内容-->
                </tbody>
            </table>
        <div class="bottomDiv">
            <span style="margin-left:10px">共检索到<span id="amongData">0</span>条数据,共有<span id="amongNum">0</span>页。</span>
            <span class="changePageAll"><span id="firstPage">首页</span><span id="lastPage">上一页</span><span id="currentNum">0</span><span id="nextPage">下一页</span><span id="finalPage">尾页</span></span>
        </div>
    </body>
    <script type="text/javascript" src="js/jquery.min.js"></script>
    <script src="jcyj/js/dataShow.js"></script>
    <script type="text/javascript">
        $(function() {
            var IP_PATH = getNativePath();
            //var IP_PATH = window.location.protocol+"//"+window.location.host;
            var currentPage = 1; //当前页面
            var among; //数据总数目
            var totalPage;
            var search = '';
            getAjaxInfo(currentPage, search);
            //获取接口中的数据
            //点击上一页
            $("#lastPage").click(function() {
                if(currentPage == 1) {
                    $(this).css("background", '#E8E8E8')
                } else {
                    $(this).css("background", '#fff')
                    currentPage--;
                    $("#currentNum").text(currentPage);
                    getAjaxInfo(currentPage, search);
                }
            });
 
            //点击下一页
            $("#nextPage").click(function() {
                if(currentPage == totalPage) {
                    $(this).css("background", '#E8E8E8')
                } else {
                    $(this).css("background", '#fff')
                    currentPage++;
                    $("#currentNum").text(currentPage);
                    getAjaxInfo(currentPage, search);
                }
            });
            //点击查询
            $(".cx").click(function() {
                currentPage = 1;
                search = $(".gjz").val();
                getAjaxInfo(currentPage, search);
            });
            //点击清空
            $(".qk").click(function() {
                $(".gjz").val('');
                search = '';
                currentPage = 1;
                getAjaxInfo(currentPage, search);
            });
            //点击播放按钮获取视频资源播放视频
            $(document).on('click', '.play', function() {
                var id = $(this).attr('id');
                window.open(IP_PATH+"/common/downloadUploadAttachment.do?id=" + id); //湿地宣教--视频下载接口++++++++++++++++++++++++++++++++++++++++++++++++++++
            });
            //点击首页跳转
            $("#firstPage").click(function(){
                currentPage = 1,
                getAjaxInfo(currentPage, search);
            });
            //点击尾页跳转
            $("#finalPage").click(function(){
                currentPage = totalPage,
                getAjaxInfo(currentPage, search);
            });
            //同步获取视频资源
            var detailVedio = new Array();
            function getDetailVedio(id) {
                $.ajax({
                    type: "post",
                    url: IP_PATH+"/common/listUploadAttachment.do", //湿地宣教--视频大小信息查询接口++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
                    async: false,
                    data: {
                        "Q_uaTable_S_EQ": 'SYS_VIDEO',
                        "Q_uaTableid_S_EQ": id
                    },
                    dataType: "json",
                    success: function(result) {
                        detailVedio.push(result.data);
                    },
                    error: function() {
                        alert("请求错误!!");
                    }
                });
 
            }
            function getAjaxInfo(currentPage, search) {
                var num = 10;
                var start = (currentPage - 1) * num;
                $.ajax({
                    type: "post",
                    url: IP_PATH+"/video/findVideoFilter.do", //湿地宣教--视频列表详细信息查询接口++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
                    async: true,
                    data: {
                        "limit": num,
                        "start": start,
                        "Q_videoname_S_LK": search
                    },
                    dataType: "json",
                    success: function(result) {
                        $("tbody").text('');
                        var data = result.data;
                        among = result.total;
                        $("#amongData").text(among);
                        if(among==0){
                            $("tbody").html("<tr><td colspan='5'>暂无数据</td></tr>");
                            return;
                        }
                        if(among % num != 0) {
                            totalPage = parseInt((among / num) + 1);
                        } else {
                            totalPage = among / num;
                        }
                        $("#currentNum").text(currentPage);
                        $("#amongNum").text(totalPage);
                        var a = 1;
                        for(var i = 0; i < data.length; i++) {
                            getDetailVedio(data[i].videoid);
                            var time = data[i].uploadtime;
                            if(time == null || time == '') {
                                time = "未填写";
                            } else {
                                time = time.substring(0, 9);
                            }
                            var inners = "<tr>" +
                                "<td>" + a + "</td>" +
                                "<td>" + data[i].videoname + "</td>" +
                                "<td>" + (parseFloat(detailVedio[i][0].uaFileSize) / 1024).toFixed(2) + "kb</td>" +
                                "<td>" + time + "</td>" +
                                "<td><div class='play' id='" + detailVedio[i][0].uaId + "'></div></td>" +
                                "</tr>";
                            $("tbody").append(inners);
                            a++;
                        }
                    },
                    error: function(e) {
                        alert("请求失败!");
                        $("tbody").html("<tr><td colspan='5'>暂无数据</td></tr>");
                    }
 
                });
            }
 
        });
    </script>
 
</html>