123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149 |
- <!DOCTYPE html>
- <html lang="zh" xmlns:th="http://www.thymeleaf.org" >
- <head>
- <th:block th:include="include :: header('新增消息')" />
- </head>
- <body class="white-bg">
- <div class="wrapper wrapper-content animated fadeInRight ibox-content">
- <form class="form-horizontal m" id="form-notice-add">
- <div class="form-group">
- <label class="col-sm-2 control-label">接收者:</label>
- <div class="col-sm-10">
- <select name="toObjType" id="toObjType" class="form-control m-b" th:with="type=${@dict.getType('receive_type')}">
- <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
- </select>
- </div>
- </div>
- <div class="form-group">
- <label class="col-sm-2 control-label">消息类型:</label>
- <div class="col-sm-10">
- <select name="msgType" id="msgType" class="form-control m-b" th:with="type=${@dict.getType('message_type')}">
- <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
- </select>
- </div>
- </div>
- <div class="form-group" id="chargeSkipType">
- <label class="col-sm-2 control-label">跳转类型:</label>
- <div class="col-sm-10">
- <select name="skipType" id="skipType" class="form-control m-b" th:with="type=${@dict.getType('skip_type')}">
- <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
- </select>
- <input id="skipContent" name="skipContent" class="form-control" type="text"/>
- </div>
- </div>
- <div class="form-group" id="chargeErBanNo">
- <label class="col-sm-2 control-label">卿卿号:<span style="color: red;">多个用英文逗号隔开</span></label>
- <div class="col-sm-10">
- <input id="erBanNos" name="erBanNos" class="form-control" type="text" placeholder="请输入卿卿号,多个卿卿号用英文隔开"/>
- </div>
- </div>
- <div class="form-group" id="chargeTitle">
- <label class="col-sm-2 control-label">标题:</label>
- <div class="col-sm-10">
- <input id="title" name="title" class="form-control" type="text" placeholder="请输入标题" required/>
- </div>
- </div>
- <div class="form-group" id="chargeDesc">
- <label class="col-sm-2 control-label">内容:</label>
- <div class="col-sm-10">
- <input id="desc" name="desc" class="form-control" type="text" placeholder="请输入内容" required/>
- </div>
- </div>
- <div class="form-group" id="chargePic">
- <label class="col-sm-2 control-label">图片:</label>
- <div class="col-sm-10">
- <img src="" id="imgUrl" style="width:250px;height:90px;" alt="">
- <input type="file" id="uploadFile" name="uploadFile" accept="image/gif,image/jpeg,image/jpg,image/png,image/svg">
- <button class="btn btn-success" type="button" id="uploadBtn">上传</button>
- <span class="attention" style="color: red;">注意:图片尺寸请注意在750*250,选择图片后请点击上传按钮</span>
- <input type="hidden" id="pic" name="pic" class="form-control validate[required]"/>
- </div>
- </div>
- </form>
- </div>
- <th:block th:include="include :: footer" />
- <th:block th:include="include :: summernote-js" />
- <script type="text/javascript">
- var prefix = ctx + "users/message";
- $("#form-notice-add").validate({
- focusCleanup: true
- });
- $(function(){
- $("#chargeTitle").hide();
- $("#chargePic").hide();
- $("#chargeSkipType").hide();
- });
- $('#uploadBtn').on('click',function () {
- var formData = new FormData();
- formData.append("file", $('#uploadFile').get(0).files[0]);
- $.ajax({
- url: ctx + "file/upload",
- data: formData,
- type: "post",
- processData: false,
- contentType: false,
- success: function(result) {
- $('#imgUrl').attr('src',result.data);
- $("input[name='pic']").val(result.data);
- }
- })
- });
- $("#toObjType").on("change", function (){
- var val = $(this).val();
- if(val == 0){
- $("#chargeErBanNo").show();
- $('input[name="erBanNos"]').attr("required", "true");
- }else if(val == 1){
- $("#chargeErBanNo").hide();
- $('input[name="erBanNos"]').attr("required", "false");
- }
- });
- $("#msgType").on("change", function (){
- var val = $(this).val();
- // 0.文本 1.图片 100.图文
- if(val == 0){
- $("#chargeTitle").hide();
- $("#chargeDesc").show();
- $("#chargePic").hide();
- $("#chargeSkipType").hide();
- $('input[name="title"]').attr("required", "false");
- $('input[name="desc"]').attr("required", "false");
- }else if(val == 1){
- $("#chargeTitle").hide();
- $("#chargeDesc").hide();
- $("#chargePic").show();
- $("#chargeSkipType").hide();
- $('input[name="title"]').attr("required", "false");
- $('input[name="desc"]').attr("required", "false");
- }else if(val == 100){
- $("#chargeTitle").show();
- $("#chargeDesc").show();
- $("#chargePic").show();
- $("#chargeSkipType").show();
- $('input[name="title"]').attr("required", "true");
- $('input[name="desc"]').attr("required", "true");
- }
- });
-
- function submitHandler() {
- if ($.validate.form()) {
- $.operate.save(prefix + "/add", $('#form-notice-add').serialize());
- }
- }
- </script>
- </body>
- </html>
|