123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163 |
-
- @{
- ViewBag.Title = "App_Window";
- Layout = "~/Views/Shared/_MainLayoutPage.cshtml";
- }
- <link href="~/Content/Scripts/plugins/umeditor-1.2.3/themes/default/_css/umeditor.css?v=1.1" rel="stylesheet" />
- <script src="~/Content/Scripts/plugins/umeditor-1.2.3/umeditor.min.js"></script>
- <script src="~/Content/Scripts/plugins/umeditor-1.2.3/umeditor.config.js?v=1.41"></script>
- <script src="~/Content/Scripts/plugins/umeditor-1.2.3/lang/zh-cn/zh-cn.js"></script>
- <script src="~/Content/Scripts/plugins/easyui/easyui-lang-zh_CN.js"></script>
- <script src="~/ViewModels/NoticeManager.js?r=1.31"></script>
- <style>
- table {
- width: 97%;
- }
- table td {
- padding: 3px;
- border-bottom: solid 1px #EEE;
- }
- </style>
- <script type="text/javascript">
- $(function () {
- var um = UM.getEditor('MS', {
- toolbar: [
- ' undo redo | forecolor backcolor | removeformat |',
- 'insertorderedlist insertunorderedlist | selectall cleardoc paragraph | fontsize',
- '| justifyleft justifycenter justifyright justifyjustify |',
- '| horizontal print preview']
- });
- })
- </script>
- <form class="easyui-tabs" fit="true" lay-filter="insert_appnotice" id="insert_appnotice">
- <div title="<i class='fa fa-sticky-note-o'></i> 添加" style="padding:5px;display:none;">
- <table>
- <tr>
- <td style="width:80px;">
- 标题:
- </td>
- <td>
- <input id="BT" name="BT" autofocus class="easyui-textbox" style="width:658px" />
- </td>
- </tr>
- <tr>
- <td>信息内容:</td>
- <td colspan="2">
- <textarea id="MS" name="MS" style="width:98%;height:140px;"></textarea>
- </td>
- </tr>
- <tr>
- <td style="border-bottom:0px">图 片:</td>
- <td colspan="2" id="demoList" style="border-bottom:0px">
- <a id="ChooseFile" href="#" class="easyui-linkbutton c8" data-options="plain:true"><i class="fa fa-plus-square-o"></i> 添加图片</a>
- </td>
- </tr>
- </table>
- <div class="layui-input-inline" style="width:150px;position:fixed;bottom:10px;right:0%">
- <a id="Add_AppNotice" href="#" class="easyui-linkbutton c1"><i class="fa fa-pencil"></i> 确认</a>
- <a onclick="Close()" href="#" class="easyui-linkbutton c5"><i class="fa fa-power-off"></i> 关闭</a>
- <button id="btn_upload" style="display:none"></button>
- </div>
- </div>
- </form>
-
- <script type="text/javascript">
- //附件上传
- layui.use('upload', function () {
- var upload = layui.upload;
- var demoListView = $('#demoList');
- var uploadInst = upload.render({
- elem: '#ChooseFile' //文件选择按钮
- , url: '/Notice/FileUpload?type=1'
- , method: "post"
- , accept: 'images' //(文件类型)
- , multiple: true //多文件上传
- , auto: false //自动上传
- , size: 5120
- , bindAction: "#btn_upload"
- , number: 1//最大允许上传文件数量
- , choose: function (obj) {
- var files = this.files = obj.pushFile(); //将每次选择的文件追加到文件队列
- //读取本地文件
- obj.preview(function (index, file, result) {
- appOBJ.count++;
- var display = "none";
- var tr = $(['<tr id="upload-' + index + '">'
- , '<td class="uplad-filename">' + file.name + '</td>'
- , '<td>' + (file.size / 1014).toFixed(1) + 'kb</td>'
- , '<td>等待上传</td>'
- , '<td>'
- , '<button class="layui-btn layui-btn-mini demo-reload layui-hide">重传</button>'
- , '<button class="layui-btn layui-btn-mini layui-btn-danger demo-delete" style="height:25px;line-height:25px">删除</button>'
- , '</td>'
- , '</tr>'].join(''));
- //单个重传
- tr.find('.demo-reload').on('click', function () {
- obj.upload(index, file);
- });
- //删除
- tr.find('.demo-delete').on('click', function () {
- delete files[index]; //删除对应的文件
- tr.remove();
- uploadInst.config.elem.next()[0].value = ''; //清空 input file 值,以免删除后出现同名文件不可选
- appOBJ.count--;
- });
- demoListView.append(tr);
- });
- }
- , done: function (res, index, upload) {
- if (res != 0) {
- top.ZLPMS.Msg("上传成功", 1)
- ZLPMS.CloseTopWindow(true)
- }
- else {
- top.ZLPMS.Msg("上传失败", 2);
- ZLPMS.CloseTopWindow(true)
- }
- }
- });
- });
- $("#Add_AppNotice").bind("click", function () {
- var r = $('#insert_appnotice').form('validate');
- if (r) {//post到后台
- var t = ZLPMS.FormToObject('insert_appnotice');
- if (!t.BT || !t.MS) {
- top.ZLPMS.Msg("请填写标题和内容!", 2)
- return;
- }
- if (appOBJ.count ==0)
- {
- top.ZLPMS.Msg("请上传图片!", 2)
- return;
- }
- if (appOBJ.count >1)
- {
- top.ZLPMS.Msg("只能上传一个文件!", 2)
- return;
- }
- var param = escape(JSON.stringify(t));
- $.post("/Notice/Add_AppPush", { text: param }, function (data) {
- if (data != null) {
- appOBJ.noticeID = data;
- top.ZLPMS.Msg("添加成功!", 1);
- document.getElementById("btn_upload").click();
- }
- else {
- ZLPMS.CloseTopWindow(true)
- top.ZLPMS.Msg("数据异常请重新填写!", 2)
- }
- });
- }
- })
- </script>
|