Edit.cshtml 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221
  1. @using MySystem.BsModels;
  2. @{PageInfo editData = ViewBag.data as PageInfo;}
  3. @{
  4. string RightInfo = ViewBag.RightInfo as string;
  5. string right = ViewBag.right as string;
  6. }
  7. <!DOCTYPE html>
  8. <html>
  9. <head>
  10. <meta charset="utf-8">
  11. <title>单页内容(修改)</title>
  12. <meta name="renderer" content="webkit">
  13. <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  14. <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
  15. <link rel="stylesheet" href="/layuiadmin/layui/css/layui.css" media="all">
  16. <script src="/admin/js/jquery-1.10.1.min.js"></script>
  17. <script src="/admin/js/LAreaData2.js"></script>
  18. </head>
  19. <body>
  20. <div class="layui-form" lay-filter="layuiadmin-form-useradmin" id="layuiadmin-form-useradmin">
  21. <input type="hidden" name="Id" value="@editData.Id" />
  22. <div class="layui-card">
  23. <div class="layui-card-body">
  24. <div class="layui-tab" lay-filter="mytabbar">
  25. <ul class="layui-tab-title">
  26. <li class="layui-this" lay-id="1">基本信息</li>
  27. </ul>
  28. <div class="layui-tab-content mt20">
  29. <div class="layui-tab-item layui-show">
  30. <div class="layui-form-item">
  31. <label class="layui-form-label">标题</label>
  32. <div class="layui-input-block">
  33. <input class="layui-input" type="text" id="Title" name="Title" value="@editData.Title" maxlength="200" lay-verify="" autocomplete="off" placeholder="请输入标题">
  34. </div>
  35. </div>
  36. <div class="layui-form-item layui-form-text">
  37. <label class="layui-form-label">内容</label>
  38. <div class="layui-input-block">
  39. <textarea class="layui-textarea" id="Contents" name="Contents" placeholder="请输入内容" style="width:100%;height:500px;">@(MySystem.OssHelper.Instance.CheckOSSPic(editData.Contents))</textarea>
  40. </div>
  41. </div>
  42. </div>
  43. </div>
  44. </div>
  45. <div class="layui-form-item layui-hide">
  46. <input type="button" lay-submit lay-filter="LAY-list-front-submit" id="LAY-list-front-submit" value="确认">
  47. </div>
  48. </div>
  49. </div>
  50. </div>
  51. <script src="/layuiadmin/layui/layui.js"></script>
  52. <script src="/other/oss/upload-min@(MySystem.OssHelper.Instance.OssStatus ? "-oss" : "").js"></script>
  53. <script src="/other/mybjq/kindeditor-min.js"></script>
  54. <script src="/other/mybjq/lang/zh_CN.js"></script>
  55. <script>
  56. //内容
  57. @(Html.Raw(Library.Control.kindeditorVar("Contents")))
  58. //编辑器
  59. KindEditor.ready(function (K) {
  60. //内容
  61. @(Html.Raw(Library.Control.kindeditor("Contents", 1)))
  62. });
  63. var ids = "";
  64. function getChildren(obj) {
  65. $.each(obj, function (index, value) {
  66. var id = obj[index].id;
  67. ids += id + ",";
  68. var children = obj[index].children;
  69. if (children) {
  70. getChildren(children);
  71. }
  72. });
  73. }
  74. function AreasProvinceInit(tagId, areasVal, form) {
  75. for (var i = 0; i < provs_data.length; i++) {
  76. var sel = "";
  77. if (areasVal.indexOf(provs_data[i].text) > -1) {
  78. sel = " selected=selected";
  79. }
  80. $("#" + tagId + "Province").append('<option value="' + provs_data[i].value + '"' + sel + '>' + provs_data[i].text + '</option>');
  81. }
  82. form.render();
  83. }
  84. function AreasProvinceSelected(tagId, areasVal, form, value) {
  85. $("#" + tagId + "City").html('<option value="">市</option>');
  86. var list = citys_data[value];
  87. for (var i = 0; i < list.length; i++) {
  88. var sel = "";
  89. if (areasVal.indexOf(list[i].text) > -1) {
  90. sel = " selected=selected";
  91. }
  92. $("#" + tagId + "City").append('<option value="' + list[i].value + '"' + sel + '>' + list[i].text + '</option>');
  93. }
  94. $("#" + tagId + "Area").html('<option value="">县/区</option>');
  95. form.render();
  96. $("#" + tagId + "").val($("#" + tagId + "Province option:selected").text() + "," + $("#" + tagId + "City option:selected").text() + "," + $("#" + tagId + "Area option:selected").text());
  97. }
  98. function AreasCitySelected(tagId, areasVal, form, value) {
  99. $("#" + tagId + "Area").html('<option value="">县/区</option>');
  100. var list = dists_data[value];
  101. for (var i = 0; i < list.length; i++) {
  102. var sel = "";
  103. if (areasVal.indexOf(list[i].text) > -1) {
  104. sel = " selected=selected";
  105. }
  106. $("#" + tagId + "Area").append('<option value="' + list[i].value + '"' + sel + '>' + list[i].text + '</option>');
  107. }
  108. form.render();
  109. $("#" + tagId + "").val($("#" + tagId + "Province option:selected").text() + "," + $("#" + tagId + "City option:selected").text() + "," + $("#" + tagId + "Area option:selected").text());
  110. }
  111. function AreasAreaSelected(tagId, form) {
  112. form.render();
  113. $("#" + tagId + "").val($("#" + tagId + "Province option:selected").text() + "," + $("#" + tagId + "City option:selected").text() + "," + $("#" + tagId + "Area option:selected").text());
  114. }
  115. function movePrev(obj, tagId) {
  116. $(obj).parent().prev().insertAfter($(obj).parent());
  117. checkPics(tagId);
  118. }
  119. function moveNext(obj, tagId) {
  120. $(obj).parent().next().insertBefore($(obj).parent());
  121. checkPics(tagId);
  122. }
  123. function deletePic(obj, tagId) {
  124. $(obj).parent().remove();
  125. checkPics(tagId);
  126. }
  127. function checkPics(tagId) {
  128. var pics = "";
  129. var texts = "";
  130. $("#" + tagId + "Image div img").each(function (i) {
  131. pics += $(this).attr("src").replace(osshost, '') + "|";
  132. });
  133. $("#" + tagId + "Image div input").each(function (i) {
  134. texts += $(this).val() + "|";
  135. });
  136. if (pics == "") {
  137. $("#" + tagId).val("");
  138. } else {
  139. pics = pics.substring(0, pics.length - 1);
  140. texts = texts.substring(0, pics.length - 1);
  141. $("#" + tagId).val(pics + "#cut#" + texts);
  142. }
  143. }
  144. function checkBox(tagId) {
  145. var text = "";
  146. $("input[type=checkbox][name=" + tagId + "List]:checked").each(function (i) {
  147. text += $(this).val() + ",";
  148. });
  149. $("#" + tagId).val(text);
  150. }
  151. function showBigPic(picpath) {
  152. parent.layer.open({
  153. type: 1,
  154. title: false,
  155. closeBtn: 0,
  156. shadeClose: true,
  157. area: ['auto', 'auto'],
  158. content: '<img src="' + picpath + '" style="max-width:800px; max-height:800px;" />'
  159. });
  160. }
  161. var tree;
  162. var element;
  163. var upload;
  164. layui.config({
  165. base: '/layuiadmin/' //静态资源所在路径
  166. }).extend({
  167. index: 'lib/index' //主入口模块
  168. }).use(['index', 'form', 'upload', 'layedit', 'laydate', 'element', 'croppers', 'transfer', 'tree', 'util'], function () {
  169. var $ = layui.$
  170. , form = layui.form
  171. , layer = layui.layer
  172. , layedit = layui.layedit
  173. , laydate = layui.laydate
  174. , croppers = layui.croppers
  175. , transfer = layui.transfer
  176. , util = layui.util;
  177. tree = layui.tree;
  178. element = layui.element;
  179. upload = layui.upload;
  180. //Hash地址的定位
  181. var layid = location.hash.replace(/^#test=/, '');
  182. element.tabChange('test', layid);
  183. element.on('tab(test)', function (elem) {
  184. location.hash = 'test=' + $(this).attr('lay-id');
  185. });
  186. //日期
  187. //上传文件
  188. //穿梭框
  189. //TreeView,比如权限管理
  190. //省市区
  191. })
  192. </script>
  193. </body>
  194. </html>