| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295 |
- <!DOCTYPE HTML>
- <html xmlns:th="http://www.thymeleaf.org"
- xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
- layout:decorate="~{admin/common/common}">
- <head>
- <title>活动管理编辑</title>
- <style>
- .push-names span {
- display: inline-block;
- background: #f5f5f5;
- padding: 5px 10px;
- border-radius: 3px;
- margin: 0 5px 5px 0;
- }
- </style>
- </head>
- <body layout:fragment="content">
- <article class="page-container">
- <form class="form form-horizontal" id="form-review-add">
- <div class="row cl">
- <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>关联活动:</label>
- <div class="formControls col-xs-8 col-sm-7">
- <input type="hidden" class="input-text" th:name="id" th:value="${review.id}"/>
- <input type="hidden" class="input-text" th:name="activity_id" th:value="${review.activity_id}"/>
- <input type="text" class="input-text" readonly placeholder="点击查找关联活动" th:id="activity_title"
- th:name="activity_title" onclick="findActivity()" th:value="${review.activity_title}"/>
- </div>
- </div>
- <div class="row cl">
- <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>标题:</label>
- <div class="formControls col-xs-8 col-sm-7">
- <input type="text" class="input-text" value="" placeholder="请输入标题" th:id="title"
- th:name="title" th:value="${review.title}"/>
- </div>
- </div>
- <div class="row cl">
- <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>是否置顶:</label>
- <div class="formControls col-xs-8 col-sm-9">
- <label style="margin-right: 10px;"><input name="is_top" type="radio" value="0"> 不置顶</label>
- <label><input name="is_top" type="radio" value="1"> 置顶</label>
- </div>
- </div>
- <div class="row cl">
- <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>图片:</label>
- <div class="formControls col-xs-8 col-sm-9">
- <div class="uploader-thum-container">
- <div id="fileList" class="uploader-list"></div>
- <div id="filePicker" class="margin-right-10">重新选择图片</div>
- <input type="hidden" th:id="img" th:name="img" />
- <input type="hidden" value="" th:id="imgName" th:name="imgName"/>
- <div id="fileListPre"><img id="preImg" height=100 width=200 th:src="${fileUrl} +${review.fileDown.file_url}"/></div>
- </div>
- </div>
- </div>
- <div class="row cl">
- <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>是否有视频:</label>
- <div class="formControls col-xs-8 col-sm-9">
- <label style="margin-right: 10px;"><input name="has_video" th:checked="${review.has_video==false }" type="radio" value="0">否</label>
- <label><input name="has_video" th:checked="${review.has_video==true }" type="radio" value="1"> 是</label>
- </div>
- </div>
- <div class="row cl" id="videoArea">
- <label class="form-label col-xs-4 col-sm-2">视频:</label>
- <div class="formControls col-xs-8 col-sm-9">
- <div class="uploader-thum-container">
- <div id="videoList" class="uploader-list"></div>
- <div id="videoPicker" class="margin-right-10">选择视频</div>
- <input type="hidden" th:value="${review.video_url}" th:id="video_url" th:name="video_url"/>
- <div id="videoListPre" >
- <div th:if="${review.has_video==true}">
- <a th:href="@{ '' + ${review.videoDown.file_url}}">[[${review.videoDown.file_name}]]</a>
- </div>
- <!-- <video id="videoElement" class="centeredVideo" controls autoplay width="450" height="400">Your browser is too old which doesn't support HTML5 video.</video>-->
- </div>
- </div>
- </div>
- </div>
- <div class="row cl">
- <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>内容:</label>
- <div class="formControls col-xs-8 col-sm-9">
- <textarea id="content" name="content" th:value="${review.content}"></textarea>
- </div>
- </div>
- <input type="hidden" id="isPush">
- <div class="row cl">
- <div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-2">
- <a onclick="saveAsDraft()" class="btn btn-primary radius">保存草稿</a>
- <a onclick="preview()" class="btn btn-secondary radius">预览</a>
- <a onclick="publish()" class="btn btn-primary radius">发布</a>
- <a onclick="removeIframe();" class="btn btn-default radius" type="button">返回</a>
- </div>
- </div>
- </form>
- </article>
- <script type="text/javascript" th:src="@{/h-ui/lib/webuploader/0.1.5/webuploader.min.js}"></script>
- <script th:inline="javascript">
- // var player = document.getElementById('videoElement');
- // var video_url = $('#video_url').val();
- // if (flvjs.isSupported() && video_url !=null) {
- // var flvPlayer = flvjs.createPlayer({
- // type: 'flv',
- // url: video_url
- // });
- // flvPlayer.attachMediaElement(videoElement);
- // flvPlayer.load(); //加载
- // }
- //富文本kindeditor初始化
- var editor;
- KindEditor.ready(function (K) {
- editor = K.create('#content', {
- uploadJson: pagePath + '/upload/kindEditorUpload',
- allowFileManager: false,
- allowUpload: true,
- width: "750px",
- height: "350px",
- items: array,
- syncType: "auto",
- afterBlur: function () {
- this.sync();
- }
- });
- });
- // 初始化图片上传
- var options = {
- auto: false,
- uploadBtnId: '#filePicker',
- picturePreId: 'fileListPre',
- //serverUrl: '/government/slides/uploadImg',
- hiddenPictureUrl: 'fileDown.file_id',
- hiddenPictureName: 'imgName',
- accept: {
- title: 'Images',
- extensions: 'gif,jpg,jpeg,bmp,png',
- mimeTypes: 'image/gif,image/jpg,image/jpeg,image/bmp,image/png'
- },
- width: 81,
- height: 81,
- fileSizeLimit: 100 * 1024 * 1024,
- fileSingleSizeLimit: 100 * 1024 * 1024
- // fileNumLimit: 1
- };
- var webUploadPicture = new $WebUploadPicture(options);
- webUploadPicture.init();
- // 初始视频上传
- var options2 = {
- auto: false,
- uploadBtnId: '#videoPicker',
- docPreId: 'videoListPre',
- //serverUrl: '/government/slides/uploadImg',
- hiddenDocUrl: 'videoDown.file_id',
- hiddenPictureName: 'videoName',
- accept: {
- title: 'video',
- extensions: 'flv',
- mimeTypes: 'flv-application/octet-stream'
- },
- width: 81,
- height: 81,
- fileSizeLimit: 300 * 1024 * 1024,
- fileSingleSizeLimit: 300 * 1024 * 1024
- // fileNumLimit: 1
- };
- var webUploadPicture2 = new $WebUploadDoc(options2);
- webUploadPicture2.init();
- $("#is_quota").change(function () {
- if ($('#is_quota option:selected').val() == "1") {
- $("#quota").show()
- } else {
- $("#quota").hide()
- }
- });
- $(function () {
- var userAgent = navigator.userAgent; //取得浏览器的userAgent字符串
- var isOpera = userAgent.indexOf("Opera") > -1;
- //判断是否IE浏览器
- if (userAgent.indexOf("compatible") > -1 && userAgent.indexOf("MSIE") > -1 && !isOpera) {
- $("#activity_starttime").remove();
- $("#activity_endtime").remove();
- $("#activity_deadline").remove();
- } else {
- $("#activity_starttimeIE").remove();
- $("#activity_endtimeIE").remove();
- $("#activity_deadlineIE").remove();
- }
- var conent = [[${review.content}]];
- $("#content").val(conent);
- var is_top = [[${review.is_top}]];
- console.log(is_top);
- if (is_top){
- $("input:radio[name='is_top'][value= '1']").prop("checked", true);
- }
- else {
- $("input:radio[name='is_top'][value= '0']").prop("checked", true);
- }
- var hasVideo = [[${review.has_video}]];
- if (hasVideo) {
- $("#videoArea").show()
- } else {
- setTimeout(function () {
- $("#videoArea").hide()
- }, 500)
- }
- $('input[type=radio][name=has_video]').change(function() {
- if (this.value == '1') {
- $("#videoArea").show()
- } else {
- $("#videoArea").hide()
- }
- });
- });
-
- function findActivity() {
- console.log("123456789");
- var url = pagePath+ "/activity/review/activityList";
- layer_show("选择关联活动",url,800, 500);
- }
- function saveAsDraft() {
- submit(0);
- }
- function publish() {
- submit(1);
- }
- function preview() {
- var url = pagePath + "/activity/review/proview";
- layer_show("预览", url, 800, 500);
- }
- function submit(status) {
- var activity_title = $("#activity_title").val();
- console.log(activity_title);
- if (activity_title == ''){
- errorMessage("活动不能为空");
- return;
- }
- var title = $("#title").val();
- console.log(title);
- if (title.replace(/\s+/g,"") == ''){
- errorMessage("标题不能为空");
- return;
- }
- var content = $("#content").val();
- console.log(content);
- if (content.replace(/\s+/g,"") == ''){
- errorMessage("内容不能为空");
- return;
- }
- $("#form-review-add").ajaxSubmit({
- type: 'post',
- url: pagePath + "/activity/review/update",
- dataType: "json",
- data: {
- status: status
- },
- success: function (data) {
- if (data.success) {
- succeedMessage(data.message);
- setTimeClose();
- } else {
- errorMessage(data.message);
- }
- },
- error: function () {
- errorMessage('系统错误!');
- }
- });
- }
- /**
- * 取消
- */
- function removeIframe() {
- var index = parent.layer.getFrameIndex(window.name);
- parent.layer.close(index);
- }
- </script>
- </body>
- </html>
|