wzy
2021-04-01 d388e2788b7ef088d7cd40f901b0acdcec460bc3
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
<!DOCTYPE HTML>
<html xmlns:th="http://www.thymeleaf.org" xmlns:matrix="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="utf-8">
    <META HTTP-EQUIV="Pragma" CONTENT="no-cache">
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
          content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no"/>
    <meta http-equiv="Cache-Control" content="no-siteapp"/>
    <link th:href="@{/plugin/bootstrap-fileinput/css/fileinput.css}"
          media="all" rel="stylesheet" type="text/css"/>
    <!-- 本框架基本脚本和样式 -->
    <script type="text/javascript"
            th:src="@{/js/plugin/jquery-2.1.4.min.js}"></script>
    <script type="text/javascript"
            th:src="@{/js/systools/MBase.js}"></script>
    <script th:src="@{/plugin/bootstrap-fileinput/js/fileinput.js}"
            type="text/javascript"></script>
    <script th:src="@{/plugin/bootstrap-fileinput/js/locales/zh.js}"
            type="text/javascript"></script>
</head>
<body>
<div class="ibox-content">
    <form class="form-horizontal" id="dataform" onsubmit="javascript:return false;">
        <input autocomplete="off"   type="hidden" name="tokenUrl" th:value="${tokenUrl}">
        <input autocomplete="off"   type="hidden" name="token" th:value="${token}">
        <input autocomplete="off"   type="hidden" name="id" th:value="${obj.id}">
        <div class="form-group">
            <label class="col-sm-2 control-label">广告标题
                <span class="text-danger">*</span>
            </label>
            <div class="col-sm-4">
                <input autocomplete="off"   type="text" class="form-control" name="title"
                       maxLength="120" dataType="*1-120"
                       th:value="${obj.title}" nullmsg="广告标题不能为空">
            </div>
            <label class="col-sm-2 control-label">跳转路径
            </label>
            <div class="col-sm-4">
                <input autocomplete="off"   type="text" class="form-control" name="jumpPath"
                       maxLength="250" dataType="*1-250" ignore="ignore"
                       th:value="${obj.jumpPath}" >
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-2 control-label">所属分类
            </label>
            <div class="col-sm-4">
                <select class="form-control autoFull"
                        th:data-url="@{/admin/shopAdvertis/getAllAdvertisingType}" data-value="adtId"
                        data-filed="adtName" th:data-def="${obj.typeId}" name="typeId">
                    <option value=''>--请选择所属分类--</option>
                </select>
                <!--<input autocomplete="off"   type="text" class="form-control" name="typeId"-->
                       <!--th:value="${obj.typeId}" nullmsg="所属分类不能为空">-->
            </div>
            <label class="col-sm-2 control-label">排序
            </label>
            <div class="col-sm-4">
                <input autocomplete="off"   type="text" class="form-control" name="sort"
                       ignore="ignore"
                       th:value="${obj.sort}" nullmsg="排序不能为空">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-2 control-label">备注
            </label>
            <div class="col-sm-10">
                <textarea class="form-control" name="remarks"
                       maxLength="500" dataType="*1-500"
                       ignore="ignore"
                          th:text="${obj?.remarks}" nullmsg="备注不能为空"></textarea>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-2 control-label">图片路径
                <!--<span class="text-danger">*</span>-->
            </label>
 
            <!--<div class="col-sm-5">
                <input autocomplete="off"   type="text" readonly="true" class="form-control" name="imgUrl"
                       maxLength="250" th:value="${obj.imgUrl}">
                <form enctype="multipart/form-data">
                    &lt;!&ndash;<label>French Input</label> &ndash;&gt;
                    <input autocomplete="off"   id="file-zh" name="file-zh" type="file">
                    &lt;!&ndash; <hr style="border: 2px dotted">
                        <label>Spanish Input</label>
                        <input autocomplete="off"   id="file-es" name="file-es[]" type="file" multiple> &ndash;&gt;
                </form>
            </div>-->
            <div class="col-sm-10">
                <input autocomplete="off"   value="" name="imgUrl" id="imgUrl"
                       class="form-control  upload-input" type="text" /> <a style="width: 10%" class="btn btn-primary radius upload-a">选择图片
            </a>
            </div>
            <!--<div class="col-sm-12" id="imgUrlDiv">
 
            </div>-->
        </div>
        <div class="form-group" id="showImgUrl">
            <label class="col-sm-2 control-label">
 
            </label>
            <div class="col-sm-10">
                <img id="imgUrlDiv"  style="width: 50%"/>
            </div>
        </div>
        <div class="form-group ">
            <div class="col-sm-12 text-center">
                <a href="javascript:;" onclick="myForm.submit()"
                   class="btn btn-success radius"><i class="fa fa-check"></i> 保存</a>&nbsp;&nbsp;&nbsp;&nbsp; <a
                    class="btn btn-danger radius" href="javascript:;" onclick="MTools.closeForm()"><i
                    class="fa fa-close"></i> 关闭</a>
            </div>
        </div>
    </form>
</div>
</body>
<script type="text/javascript" th:src="@{/js/systools/MJsBase.js}"></script>
<script th:inline="javascript">
    var invokeUrl = basePath + "/admin/multipleUploadFile/doUpload";
    MUI.initImgUpload(".upload-input");
    $('#file-zh').fileinput({
        language: 'zh',
        uploadUrl: invokeUrl,
        allowedFileExtensions: ['jpg', 'png', 'gif'],
        maxFileCount: 1,
        // minImageWidth: 50, //图片的最小宽度
        // minImageHeight: 50,//图片的最小高度
        // maxImageWidth: 100,//图片的最大宽度
        // maxImageHeight: 100,//图片的最大高度
    }).on("fileuploaded", function (event, data, previewId, index) {
        $('input[name=imgUrl]').val(data.response.path)
    });
 
    MTools.autoFullSelect();
    $(".select2").select2();
 
    /*<![CDATA[*/
    var obj =/*[[${obj}]]*/
    /*]]>*/
 
    var invokeUrl = basePath + "/admin/shopAdvertis/addShopAdvertis";
    if (obj.id != null) {
        invokeUrl = basePath + "/admin/shopAdvertis/modifyShopAdvertis";
        if (obj.imgUrl) {
            /*var html = '<img src="' + obj.imgUrl + '"/>'
            $('#imgUrlDiv').html(html)*/
            $('#imgUrlDiv').attr("src",obj.imgUrl);
        }
    }
    var myForm = MForm.initForm({
        invokeUrl: invokeUrl,
        afterSubmit: function () {
            parent.myGrid.serchData();
        },
    });
</script>
</body>
</html>