songjun
2024-09-05 a3302fda10ff21ed3700be462ad560163ca13f14
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
@model sbcLabSystem.Data.Domain.Backstage.Menus
@{
    ViewBag.Title = "公告明细";
    Layout = "~/Views/Shared/Master.cshtml";
@section scripts{
<script src="@Url.Content("~/ueditor/ueditor.config.js")"></script>
<script src="@Url.Content("~/ueditor/ueditor.all.min.js")"></script>
<script src="@Url.Content("~/ueditor/ueditor.parse.min.js")"></script>
}
<script type="text/javascript"> 
    var ue = UE.getEditor("editor", {
        initialContent: "${initParam}",
    }); 
    $(function () {
        var viewModel = ko.mapping.fromJS(@Html.Raw(Json.Encode(Model)));
        viewModel.uptates = function () {
            var name = viewModel.Name();      
            if (name != "" && name != null) {
                var html = ue.getContent();
                viewModel.Contents(html);
                $.ajax({
                    type: "post",
                    url: '@Url.Action("UpdeteMenus", "Backstage")',
                    datatype: "json",
                    data: JSON.stringify(ko.toJS(viewModel)),
                    contentType: 'application/json; charset=utf-8',
                    async: false,
                    success: function (data) {                  
                        if (data == "2")
                        {
                            window.location.href="@Url.Action("Notices","Backstage")"
                        }
                        if (data == "4")
                        {
                            window.location.href="@Url.Action("EmileTemplate","Backstage")"
                        }
 
                    }
                })
            }
            else {
                alert("标题不能为空");
            }
         
           
        }
        console.log(ko.toJS( viewModel));
        ko.applyBindings(viewModel, $(".container")[0]);
    });
 
 
</script>
<div class="container">
    <div class="row">
        <div class="col-xs-12">
            <ol class="breadcrumb"> 
                <li><a href="@Url.Action("Notices","Backstage")">公告管理</a></li>
                <li class="active">公告操作</li>
            </ol>
        </div>
    </div>
    <div class="row">    
        <table class="table table-bordered">
            <tr>
                <td align="right" style="width:100px;">标题:</td>
                <td>
                    <input name="" type="text" id="" style="width:70%;" data-bind="value:Name" />
                   
                </td>
            </tr>
            <tr>
                <td  style="width:100px;" valign="top" align="right">公告内容:</td>
                <td>
                    <div style="width: 1000px;">
                        @*<script type="text/javascript">
 
                            //实例化编辑器
                            //建议使用工厂方法getEditor创建和引用编辑器实例,如果在某个闭包下引用该编辑器,直接调用UE.getEditor('editor')就能拿到相关的实例
                            var _ueditor = UE.getEditor('editor');
                            _ueditor.ready(function () {
 
                            });
                            //重新实例化一个编辑器,防止在上面的editor编辑器中显示上传的图片或者文
 
                        </script>*@
                        <script id="editor" type="text/plain" style="width: auto; height: 400px;" data-bind="text:Contents">
 
                        </script>
                    </div>
                </td>
            </tr>
            <tr>
                <td align="right" style="width:100px;">备注:</td>
                <td>
                    <input name="" type="text" id="" style="width:70%;" data-bind="value:Title" />
 
                </td>
            </tr>
           
        </table>
        <div style="text-align:center">
            <button type="button" class="btn btn-primary " style="width:50%" data-bind="click:uptates">
                保存
            </button>
        </div>
    </div>
</div>