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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
@model sbcLabSystem.Data.Domain.Backstage.Menus
@{
    ViewBag.Title = "邮件模板明细";
    Layout = "~/Views/Shared/Master.cshtml";
}
@section scripts{
<script src="@Url.Content("~/Scripts/ueditor.config.js")"></script>
<script src="@Url.Content("~/Scripts/ueditor.all.min.js")"></script>
<script src="@Url.Content("~/Scripts/ueditor.parse.min.js")"></script>
}
<script type="text/javascript">
    $(function () {
        var viewModel = ko.mapping.fromJS(@Html.Raw(Json.Encode(Model)));   
        viewModel.Campus = ko.computed(function () {
            if (viewModel.Url != "")
            {
                return viewModel.Url().split(",")
            }
        },viewModel)
        viewModel.uptates = function () {
            var name = viewModel.Name();
            if (name != "" && name != null) {
                var html = _ueditor.getContent();
                var a = viewModel.Campus().join(",")    
                viewModel.Contents(html);
                viewModel.Url(a);
                $.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("EmileTemplate", "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="" class="form-control" type="text" id=""  data-bind="value:Name" />
 
                </td>
            </tr>
            <tr>
                <td align="right" style="width:100px;">发送对象:</td>
                <td>   
                    <label style="margin-left:20px;">
                        <input type="checkbox" value="管理员" data-bind="checked:Campus"> 管理员
                    </label>
                    <label style="margin-left:20px;">
                        <input type="checkbox" value="负责人" data-bind="checked:Campus">实验室负责人
                    </label>
                    <label style="margin-left:20px;">
                        <input type="checkbox" value="操作人" data-bind="checked:Campus">实验室操作人
                    </label>
                </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>