123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136 |
- @{;
- ViewBag.Title = "表单页面";
- Layout = "~/Views/Shared/_Form.cshtml";
- }
- <link href="~/Content/scripts/plugins/simditor/css/simditor.css" rel="stylesheet" />
- <script src="~/Content/scripts/plugins/simditor/js/module.min.js"></script>
- <script src="~/Content/scripts/plugins/simditor/js/uploader.min.js"></script>
- <script src="~/Content/scripts/plugins/simditor/js/hotkeys.min.js"></script>
- <script src="~/Content/scripts/plugins/simditor/js/simditor.min.js"></script>
- <script>
- var keyValue = request('keyValue');
- var editor = null;
- $(function () {
- editor = new Simditor({
- textarea: $('#Content'),
- placeholder: '这里输入文章内容...',
- toolbar: ['title', 'bold', 'italic', 'underline', 'strikethrough', 'color', '|', 'ol', 'ul', 'blockquote', 'code', 'table', '|', 'link', 'image', 'hr', '|', 'indent', 'outdent']
- });
- initControl();
- });
- //初始化控件
- function initControl() {
- //获取表单
- if (!!keyValue) {
- $.SetForm({
- url: "../../BaseManage/Banner/GetFormJson",
- param: { keyValue: keyValue },
- success: function (data) {
- $("#form1").SetWebControls(data);
- editor.setValue(data.Content);
- }
- })
- }
- }
- //保存表单;
- function AcceptClick() {
- if (!$('#form1').Validform()) {
- return false;
- }
- //var postData = $("#form1").GetWebControls(keyValue);
- var postData = {
- Title: $("#Title").val(),
- Content: editor.getValue(),
- ImageUrl: $("#ImageUrl").val(),
- Sort: $("#Sort").val()
- }
- $.SaveForm({
- url: "../../BaseManage/Banner/SaveForm?keyValue=" + keyValue,
- param: postData,
- loading: "正在保存数据...",
- success: function () {
- $.currentIframe().$("#gridTable").trigger("reloadGrid");
- }
- })
- }
- </script>
- <script type="text/javascript">
- var editorOption = {
- initialFrameWidth: 1000,
- initialFrameHeight: 200
- };
- var editor = new baidu.editor.ui.Editor(editorOption);
- </script>
- <div style="margin-top: 20px; margin-right: 30px;">
- <table class="form">
- <tr>
- <td class="formTitle">标题</td>
- <td class="formValue">
- <input id="Title" type="text" class="form-control" />
- </td>
- </tr>
- <tr>
- <td class="formTitle">滚动图地址</td>
- <td class="formValue">
- <table style="width: 100%">
- <tr>
- <td style="width: 90%">
- @*<img id="img-preview" src=""/>*@
- <input id="ImageUrl" type="text" class="form-control" placeholder="" readonly="readonly" />
- </td>
- <td style="text-align: center">
- <span><i class="fa fa-plus fa-2x" onclick="upImage()" style="cursor: pointer"></i></span>
- @*<button type="button" onclick="upImage()"></button>*@
- </td>
- </tr>
- </table>
- <script type="text/plain" id="j_ueditorupload" style="height: 5px; display: none;">
- </script>
- <script type="text/javascript">
- //实例化编辑器
- var o_ueditorupload = UE.getEditor('j_ueditorupload',
- {
- autoHeightEnabled: false
- });
- o_ueditorupload.ready(function () {
- o_ueditorupload.hide(); //隐藏编辑器
- //监听图片上传,地址:arg[0].src
- o_ueditorupload.addListener('beforeInsertImage',
- function (t, arg) {
- //alert('这是图片地址:' + arg[0].src);
- //这里解析你的返回类型
- $("#ImageUrl").val(arg[0].src);
- });
- });
- //弹出图片上传的对话框
- function upImage() {
- var myImage = o_ueditorupload.getDialog("insertimage");
- myImage.open();
- }
- </script>
- </td>
- </tr>
- <tr>
- <td class="formTitle">内容</td>
- <td class="formValue">
- <textarea id="Content" class="form-control" rows="5"></textarea>
- </td>
- </tr>
- <tr>
- <td class="formTitle">排序码</td>
- <td class="formValue">
- <input id="Sort" type="text" class="form-control" value="99" />
- </td>
- </tr>
- </table>
- </div>
|