136 lines
5.1 KiB
Plaintext
136 lines
5.1 KiB
Plaintext
@model dccdc.Models.InfectionRepositoryModel
|
|
|
|
@{
|
|
ViewBag.Title = "数据修改";
|
|
}
|
|
|
|
|
|
@section scripts{
|
|
<script src="@Url.Content("~/Scripts/ajaxfileupload.js?v1.0.4")"></script>
|
|
<script type="text/javascript" src="@Url.Content("~/ueditor/ueditor.config.js")"></script>
|
|
<script type="text/javascript" src="@Url.Content("~/ueditor/ueditor.all.js")"></script>
|
|
<script type="text/javascript">
|
|
var editor;
|
|
|
|
editor = UE.getEditor("myEditor", { autoHeightEnabled: false, initialFrameHeight: 300, initialFrameWidth: 600});
|
|
$(function () {
|
|
@*
|
|
$("#save").bind("click", function () {
|
|
$.ajax("@Url.Action("SaveWeiXinNR")", {
|
|
type: "post", dataType: "json", data: {
|
|
id: $("#id").val(),
|
|
parm_name: $("#parm_name").val(), Parm_value: editor.getContent()
|
|
}, success: function (data) {
|
|
$.ligerDialog.alert(data.Message);
|
|
}
|
|
});
|
|
});
|
|
});
|
|
*@
|
|
|
|
var filechange = function (event) {
|
|
var files = event.target.files, file;
|
|
if (files && files.length > 0) {
|
|
// 获取目前上传的文件
|
|
file = files[0];// 文件大小校验的动作
|
|
//if (file.size > 1024 * 1024 * 2) {
|
|
// alert('图片大小不能超过 2MB!');
|
|
// return false;
|
|
//}
|
|
// 获取 window 的 URL 工具
|
|
var URL = window.URL || window.webkitURL;
|
|
// 通过 file 生成目标 url
|
|
var imgURL = URL.createObjectURL(file);
|
|
//用attr将img的src属性改成获得的url
|
|
$("#img-change").attr("src", imgURL);
|
|
// 使用下面这句可以在内存中释放对此 url 的伺服,跑了之后那个 URL 就无效了
|
|
// URL.revokeObjectURL(imgURL);
|
|
}
|
|
};
|
|
$("#submitid").click(function () {
|
|
if ($("#title").val().trim() == "") {
|
|
$.ligerDialog.alert("请输入标题!");
|
|
return;
|
|
}
|
|
if (editor.getContent().trim() == "") {
|
|
$.ligerDialog.alert("请输入内容!");
|
|
return;
|
|
}
|
|
|
|
//if ($("#file").val() == "") {
|
|
// $.ligerDialog.alert("请先选择上传文件");
|
|
// return;
|
|
//}
|
|
var state = 0;
|
|
if ($("#file").val() == "") {
|
|
if ($("#img-change").attr("src").length == 0) {
|
|
//$.ligerDialog.alert("请先选择上传文件");
|
|
//return;
|
|
} else {
|
|
state = 1;
|
|
}
|
|
}
|
|
$.ajaxFileUpload({
|
|
url: "@Url.Action("repositoryModifyData")",
|
|
type: "post",
|
|
dataType: "json",
|
|
data: {
|
|
id: $("#id").val(),
|
|
title: $("#title").val(),
|
|
content: editor.getContent(),
|
|
state: state
|
|
|
|
},
|
|
fileElementId: "file", // 上传文件的id、name属性名
|
|
success: function (data) {
|
|
$.ligerDialog.alert(data.Message, function () { window.parent.init(); });
|
|
},
|
|
error: function (e) {
|
|
$.ligerDialog.warn(e.responseText);
|
|
}
|
|
});
|
|
});
|
|
});
|
|
</script>
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
<div id="edit">
|
|
<table class="t1" style="width: 100%">
|
|
<tr style="display:none">
|
|
<td class="ltd" width="100px">编号:</td>
|
|
<td class="rtd">@Html.TextBoxFor(m => m.id, new { id = "id", style = "width:140px", Class = "l-text" })</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="ltd" width="100px">标题:</td>
|
|
<td class="rtd">@Html.TextBoxFor(m => m.title, new { id = "title", style = "width:340px", Class = "l-text" })</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="ltd" width="100px">内容:</td>
|
|
|
|
<td class="rtd"><script type="text/plain" id="myEditor">
|
|
@Html.Raw( ViewBag.content)
|
|
</script></td>
|
|
</tr>
|
|
<tr>
|
|
<td class="ltd" width="100px">图片文件:</td>
|
|
<td class="rtd"><input type="file" name="file" id="file" onchange="filechange(event)" /></td>
|
|
</tr>
|
|
<tr>
|
|
<td class="ltd" style="width:100px"></td>
|
|
<td class="rtd" style="width:400px"><img src="@ViewBag.src" width="100px" height="100px" id="img-change"></td>
|
|
</tr>
|
|
<tr>
|
|
<td colspan="2">
|
|
<div align="center">
|
|
<input type="submit" id="submitid" value="提交" class="l-button" />
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
|