百度云推送 jsp

来源:互联网 发布:社交软件英文统称 编辑:程序博客网 时间:2024/04/27 11:09
<%@ page language="java" contentType="text/html; charset=UTF-8"         pageEncoding="UTF-8" %><%@ include file="/WEB-INF/jsp/common/taglibs.jsp" %><shiro:hasPermission name="push:tongzhi">    <link rel="stylesheet"          href="${ctx}/assets/plugins/bootstrap-datetimepicker/bootstrap-datetimepicker.min.css"/>        <div class="col-xs-6" style="color: black">            <div class="form-group">                <label>标题</label>                <input type="text" class="form-control" id="title"                       placeholder="字数限制20字" name="title">                <span id="tt" style="color: red;display: none;">标题 格式不对重新输入</span>            </div>            <div class="form-group">                <label>内容</label>                <textarea class="form-control" rows="5" placeholder="字数限制300字"                          name="messageString" id="messageString"></textarea>                <span id="cc" style="color: red;display: none">内容 格式不对重新输入</span>            </div>            <div class="form-group ">                <label>用户范围</label><br>                <div class="col-xs-2">                    <label style="color: grey">                        <input type="radio" name="device"                               id="allDevice" value="2" checked onclick='deviceIt(2)'>                        所有设备                    </label>                </div>                <div class="col-xs-2">                    <label style="color: grey">                        <input type="radio" name="device"                               id="oneDevice" value="1" onclick='deviceIt(1)'>                        指定设备                    </label>                </div>            </div>            <br>            <div class="form-group" id="oneShow" style="color: grey ;display:none ">                设备ID   <input type="text" id="channelId"                                        placeholder="输入一个channelId"                                        name="channelId">            </div>            <div class="form-group ">                <label> 设备型号</label><br>                <div class="col-xs-2">                    <label style="color: grey">                        <input type="radio" name="platform"                               checked id="android" value="android">                        安卓                    </label>                </div>                <div class="col-xs-2">                    <label style="color: grey">                        <input type="radio"                               name="platform"                               id="ios"                               value="ios">                        苹果                    </label>                </div>            </div>            <br>            <div class="form-group">                <label>发送时间</label><br>                <div class="col-xs-2">                    <label style="color: grey">                        <input type="radio" name="sendTime"                               id="sendNow" value="1" checked onclick='sendIt(1)'>                        即时发送                    </label>                </div>                <div class="col-xs-2" id="sendLater1">                    <label style="color: grey">                        <input type="radio" name="sendTime"                               id="sendLater" value="2" onclick='sendIt(2)'>                        定时发送                    </label>                </div>            </div>            <br>            <div id="timeShow" style="color: grey ;display:none ">                定时时间   <input type="text" id="sdTime" name="sdTime">            </div>            <br><br>            <div>                <input class="btn btn-primary" type="button" id="putIt" value="发送通知">            </div>        </div>    <script>        $('#sdTime').datetimepicker({format: "yyyy-mm-dd hh:ii", autoclose: true});        function sendIt(flag) {            if (flag == 1) {                $("#timeShow").hide();            } else if (flag == 2) {                $("#timeShow").show();            }        }        $("#title").change(function () {            $("#tt").hide();        })        $("#messageString").change(function () {            $("#cc").hide();        })        function deviceIt(flag) {            if (flag == 1) {                $("#oneShow").show();                $("#timeShow").hide();                $("#sendLater1").hide();            } else if (flag == 2) {                $("#oneShow").hide();                $("#sendLater1").show();            }        }        $("#putIt").click(function () {            var device=$('input:radio[name="device"]:checked').val();            var platform=$('input:radio[name="platform"]:checked').val();            alert(platform);            var sendTime=$('input:radio[name="sendTime"]:checked').val();            var channelId = $("#channelId").val();            var sdTime = $("#sdTime").val();            var ti = $("#title").val().trim();            var messageString = $("#messageString").val().trim();            if (ti.length == 0 || ti.length > 15) {                $("#tt").show();                return;            }            if (messageString.length == 0 || messageString.length > 300) {                $("#cc").show();                return;            }            $.ajax({                url: "../push/sendTongzhi",                type: "POST",                data: {                    platform:platform,                    device: device,                    sendTime: sendTime,                    channelId: channelId,                    sdTime: sdTime,                    title: ti,                    messageString: messageString                },                success: function (data) {                    console.log(data);                    if(data==1){                        alert("通知已发送");                    }                    if(data==2){                        alert("无效账号,发送失败");                    }                },                error: function () {                    alert("网络出错");                }            });        });    </script></shiro:hasPermission>

0 0
原创粉丝点击