123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247 |
- @using Bowin.Web.Controls.Mvc;
- @using EMISOnline.Entities;
- @using EMISOnline.Web.Controls;
- @model EMISOnline.Entities.EM_CourseChapter
- @{
- ViewBag.Title = "List";
- }
- <div class="easyui-panel" data-options="border:false,fit:true" style="position: relative;">
- <div class="search_keyword">
- <div class="search_input">
- <ul>
- <li style="float: right;">
- @Html.Button(new ButtonOptions() { ID = "btnAdd", Text = "新增章节" })
- @Html.Button(new ButtonOptions() { ID = "btnSave", Text = "保 存" })
- @Html.Button(new ButtonOptions() { ID = "btnDelete", Text = "删除章节" })
- </li>
- </ul>
- </div>
- </div>
- <div style="float: left; width: 20%">
- 章节目录
- @Html.Tree(new TreeOptions() { ID = "ChaperTree", Name = "ChaperTree", IsCascadeCheck = false, ItemSourceUrl = "~/CourseBuild/GetChaperTree?CoursematerialID=" + Request["CoursematerialID"] })
- </div>
- <div style="float: left; width: 80%">
- @using (Ajax.BeginForm(new AjaxOptions
- {
- OnSuccess = "FormSuccess",
- OnBegin = "EMISFunction.FormSubmit",
- OnComplete = "EMISFunction.FormComplete",
- }))
- {
- @Html.Hidden("CourseChapterID")
- @Html.Hidden("CoursematerialID", Request["CoursematerialID"])
- @Html.Hidden("type")
- <div class="gobal-from">
- <table cellpadding="0" cellspacing="0">
- <tr>
- <th style="width: 100px;">
- 所属章节:
- </th>
- <td>
- <input id="ParentCourseChapterID" name="ParentCourseChapterID" class="easyui-combotree" data-options="url:'@Url.Content("~/CourseBuild/GetChaperTree?CoursematerialID=")@ViewBag.CoursematerialID'"/>
- @* @Html.DropdownList(new DropdownListOptions { CssClass = "easyui-combotree", ItemSourceUrl = "~/CourseBuild/GetChaperTree?CoursematerialID=F6FCCB89-0CF0-4F73-9B45-AD26733CA2B2", ID = "ParentCourseChapterID", Name = "ParentCourseChapterID" }, new Dictionary<string, string> { { "class", "easyui-combotree" } })*@
- </td>
- </tr>
- <tr>
- <th>
- 章节名称:
- </th>
- <td>
- @Html.TextBoxFor(model => model.Name, new TextBoxOptions { Required = true, IsRequired = true })
- </td>
- </tr>
- <tr>
- <th>
- 序号:
- </th>
- <td>
- @Html.TextBoxFor(model => model.OrderID, new TextBoxOptions { })
- </td>
- </tr>
- <tr id="tr_videotype" style="display: none;">
- <th>
- 视频分类:
- </th>
- <td>
- @Html.RadioButtonFor(model => model.VideoTypeID, (int)EMISOnline.ViewModel.EM_OnlineVideoType.Local, new { onclick = "switchVideo(" + ((int)EMISOnline.ViewModel.EM_OnlineVideoType.Local).ToString() + ")" })
- 本地视频
- @Html.RadioButtonFor(model => model.VideoTypeID, (int)EMISOnline.ViewModel.EM_OnlineVideoType.Outer, new { onclick = "switchVideo(" + ((int)EMISOnline.ViewModel.EM_OnlineVideoType.Outer).ToString() + ")" })
- 外部视频
- </td>
- </tr>
- <tr id="tr_video" style="display: none;">
- <th>
- 章节视频:
- </th>
- <td>
- @Html.Selector(new SelectorOptions()
- {
- DataUrl = Url.Content("~/CourseBuild/GetVideoList"),
- ID = "txtCourseVideoID",
- Name = "CourseVideoID",
- IsSingleSelect = true,
- QueryParams = "id:1",
- TextName = "Name",
- Title = "视频列表",
- Colums = "Key:CourseVideoID,视频标题:Name:250:query,播放地址:PlayUrl:466",
- DataValue = "CourseVideoID",
- DataText = "Name",
- Width = 400
- })
- </td>
- </tr>
- <tr id="tr_outervideo" style="display: none;">
- <th>
- 章节视频地址:
- </th>
- <td>
- @Html.TextBoxFor(x => x.OuterVideoUrl, new { style = "width: 400px;" })
- </td>
- </tr>
- </table>
- </div>
- }
- </div>
- </div>
- <script type="text/javascript" src="@Url.Content("~/Scripts/Bowin.Control.Core/Controls/Selector.js")"></script>
- <script type="text/javascript" src="@Url.Content("~/Scripts/NewEMIS.Comm.js")"></script>
- <script type="text/javascript">
- $(function () {
- $("#CourseChapterID").val("00000000-0000-0000-0000-000000000000");
- $("#ChaperTree").tree({
- onClick: function (node) {
- if (node.id != "") {
- $("#ParentCourseChapterID").combotree("setValue", node.attributes.parentId);
- $("#Name").val(node.text);
- $("#OrderID").val(node.attributes.orderId);
- $("#CourseChapterID").val(node.id);
- $("#txtCourseVideoID").triggerbox({ "data": [{ "text": "", "value": ""}] });
- if (node.attributes != null && node.attributes.parentId != "") {
- $('[name=VideoTypeID][value="' + node.attributes.videoTypeID.toString() + '"]').attr('checked', 'checked');
- $("input[type='text'][name='OuterVideoUrl']").val(node.attributes.outerVideoUrl);
- $("#tr_videotype").show();
- $.post("@Url.Content("~/CourseBuild/GetChaperVideo")?CourseChapterID=" + node.id, function (data) {
- if (data != null && data != "") {
- if (node.attributes.videoTypeID == 0) {
- $("#tr_video").show();
- $("#tr_outervideo").hide();
- $("#txtCourseVideoID").triggerbox({ "data": [{ "text": data.Name, "value": data.CourseVideoID}] });
- } else {
- $("#tr_video").hide();
- $("#tr_outervideo").show();
- }
- } else if (node.attributes.videoTypeID != 0) {
- $("#tr_video").hide();
- $("#tr_outervideo").show();
- }
- });
- }
- else {
- $("#txtCourseVideoID").triggerbox({ "data": [{ "text": "", "value": ""}] });
- $("input[type='text'][name='OuterVideoUrl']").val("");
- $("#tr_video").hide();
- $("#tr_outervideo").hide();
- $("#tr_videotype").hide();
- }
- }
- else {
- $("#ParentCourseChapterID").combotree("setValue", "");
- $("#Name").val("");
- $("#OrderID").val("");
- $("#CourseChapterID").val("00000000-0000-0000-0000-000000000000");
- $('[name=VideoTypeID][value="@ViewBag.DefaultVideoTypeID"]').attr('checked', 'checked');
- $("#txtCourseVideoID").triggerbox({ "data": [{ "text": "", "value": ""}] });
- $("input[type='text'][name='OuterVideoUrl']").val("");
- $("#tr_video").hide();
- $("#tr_outervideo").hide();
- $("#tr_videotype").hide();
- }
- }
- });
- $("#btnSave").click(function () {
- if ($("#Name").val() == "") {
- alertMsg("章节名称不能为空!");
- return;
- }
- $("#type").val(1);
- $(document.forms[0]).submit();
- });
- $("#btnAdd").click(function () {
- $("#ParentCourseChapterID").combotree("setValue", "");
- $("#Name").val("");
- $("#OrderID").val("");
- $("#CourseChapterID").val("00000000-0000-0000-0000-000000000000");
- $('[name=VideoTypeID][value="@ViewBag.DefaultVideoTypeID"]').attr('checked', 'checked');
- $("#txtCourseVideoID").triggerbox({ "data": [{ "text": "", "value": ""}] });
- $("input[type='text'][name='OuterVideoUrl']").val("");
- $("#tr_video").hide();
- $("#tr_outervideo").hide();
- $("#tr_videotype").hide();
- });
- $("#btnDelete").click(function () {
- if ($("#CourseChapterID").val() == "00000000-0000-0000-0000-000000000000") {
- alertMsg("请选择章节!");
- return;
- }
- $("#type").val(2);
- $(document.forms[0]).submit();
- });
- $("#ParentCourseChapterID").combotree({
- onSelect: function (node) {
- if (node.attributes != null) {
- $("#tr_videotype").show();
- if ($("#CourseChapterID").val() != "00000000-0000-0000-0000-000000000000") {
- $('[name=VideoTypeID][value="'+node.attributes.videoTypeID.toString()+'"]').attr('checked', 'checked');
- if (node.attributes.videoTypeID == @ViewBag.DefaultVideoTypeID) {
- $("#tr_video").show();
- $("#tr_outervideo").hide();
- } else {
- $("#tr_video").hide();
- $("#tr_outervideo").show();
- }
- } else {
- $("#tr_video").show();
- $("#tr_outervideo").hide();
- }
- }
- else {
- $('[name=VideoTypeID][value="@ViewBag.DefaultVideoTypeID"]').attr('checked', 'checked');
- $("#txtCourseVideoID").triggerbox({ "data": [{ "text": "", "value": ""}] });
- $("input[type='text'][name='OuterVideoUrl']").val("");
- $("#tr_video").hide();
- $("#tr_outervideo").hide();
- $("#tr_videotype").hide();
- }
- }
- });
- });
- function FormSuccess(data) {
- $('a').removeAttr('disabled', 'disabled');
- $('#loading').hide();
- $.messager.alert('系统信息', data.Message, null, function () {
- if (data.IsSuccess) {
- window.location.reload();
- }
- });
- }
- function switchVideo(videoType) {
- if (videoType == @ViewBag.DefaultVideoTypeID) {
- $("#tr_video").show();
- $("#tr_outervideo").hide();
- } else {
- $("#tr_video").hide();
- $("#tr_outervideo").show();
- }
- }
- </script>
|