topicEdit.html 6.24 KB
<!DOCTYPE html>
<div id="tt" class="easyui-layout" fit="true" style="overflow-y: scroll">
    <form name="topicForm" id="topicForm" method="post">
        <div style="margin-top: 20px;margin-left: 30px">
            <table border="0" style="width:95%;margin-top:5px;line-height:30px;" id="tab">


                <tr style="height: 60px">

                    <td>
                        <span style="color:red">*</span><label>话题名称</label> <br>
                        <input id="topicName" name="topicName" class="easyui-textbox" style="width: 380px;"/>
                    </td>
                </tr>
                <tr style="height: 60px">

                    <td>
                        <span style="color:red">*</span><label>话题描述</label> <br>
                        <textarea id="topicDesc" name="topicDesc" style="width: 380px;" rows="6" placeholder=""
                                  required maxlength="100"></textarea>
                    </td>
                </tr>

                <tr style="height: 60px">
                    <td>
                        <span style="color:red">*</span><label>背景图</label> <br>

                        <div id="imageUpload">
                        </div>
                        <!-- <span style=" margin-left: 10px; color: red"> 图片宽高(186x170)</span>-->
                    </td>
                </tr>
                <tr style="height: 60px">
                    <td>
                        <span style="color:red">*</span><label>话题分组</label><br>

                        <input class="easyui-combobox" id="relatedGroup" name="relatedGroup">
                        </input>
                        <!-- <span style=" margin-left: 10px; color: red"> 图片宽高(186x170)</span>-->
                    </td>
                </tr>

                <tr style="height: 60px">

                    <td >
                        <input value="1" type="checkbox" id="isOfficial" name="isOfficial" >官方话题</input>
                    </td>
                </tr>

                <tr style="height: 60px">

                    <td >
                        <span style="color:red">*</span><label>列表模式</label><br>

                        <input value="1" type="radio"  name="viewModel">大图详情</input>
                        <input value="2" type="radio"  name="viewModel" required="true">小图列表</input>
                    </td>
                </tr>

                <tr style="height: 60px">
                    <td >
                        <input value="1" type="checkbox"  id="showAttAmount" name="showAttAmount">展示关注人数</input>
                        <input  value="1" type="checkbox"  id="allowAttention" name="allowAttention" >允许用户关注</input>
                    </td>
                </tr>
            </table>
        </div>
    </form>

</div>


<script>


    $(function () {
        $("#topicName").textbox({
            required: true,
            missingMessage: "话题名称不能为空",
            prompt: "请输入话题名称"
        });

       /* $("#topicDesc").textarea({
            required: true,
            maxLength: 100,
            missingMessage: "话题描述不能为空,并小于100字",
            prompt: "请输入话题名称"
        });*/



        $("#relatedGroup").combobox({
            valueField : "id",
            textField : "groupName",
            required:true,
            prompt: "请选择话题分组",
            url : serverContextPath + "/topicGroupManage/getAllTopicGroupInfo",
            loadFilter: function (data) {
                var data = defaultLoadFilter(data);
                data.unshift({'id': '', 'groupName': '--请选择分组--'});
                return data;
            }
        });


        $("#imageUpload").imageUpload({
            width: 171,
            height: 120,
            realInputName: "topicImageUrl",
            url: serverContextPath + '/fileupload/uploadFile',
            queryParams: {
                bucket: "grassImg"
            },
            onBeforeSubmit: function () {
                $.messager.progress({
                    title: "正在执行",
                    msg: "正在执行,请稍后...",
                    interval: 500,
                    text: ""
                });
            },
            filterFileName: function (data) {
                debugger;
                if (!data || data.code != 200) {
                    $.messager.progress("close");
                    $.messager.alert("错误", data.message);
                    return "";
                }
                return data.data.url;
            },
            onLoadSuccess: function (data) {
                $.messager.progress("close");
                //$("#imageUpload").hide();
                //$("#fileName").val(data.data.fileName);
                //$("#videoSize").val(data.data.fileSize); //如果有大小校验
                /*$("#callBackDiv").html("<div id='videoUploadDiv' class='image-upload' style='position: relative;top:19px;width: 120px; height: 150px;'><img id='imageShow' src='"+data.data.url+"?vframe/jpg/offset/0' width='120' height='150'/></div>"
                 +"<span style='position: relative;top: -40px;left: 30px;'>"+data.data.fileName+"</span><span style='position: relative;left: 50px;top: -40px;'>"+data.data.fileSize+"M</span>").show();
                 */
                return false;
            }
        });



        var data = paramObject.mkData;
        if (data) {//编辑窗口

            $("#topicName").textbox("setValue", data.topicName);
            $("#topicDesc").html(data.topicDesc);
            //图片
            $("#imageUpload").imageUpload('setValue', data.topicImageUrl);
            debugger
            $("#relatedGroup").combobox('setValue', data.relatedGroup);
            if(data.isOfficial == 1){
                $("#isOfficial").attr("checked",true)
            }

            $("input[name='viewModel'][value='"+data.viewModel+"']").attr("checked", "checked").parent().addClass('checked');

            if(data.showAttAmount == 1){
                $("#showAttAmount").attr("checked",true)
            }

            if(data.allowAttention == 1){
                $("#allowAttention").attr("checked",true)
            }

        }



    });


</script>

</html>