官网 管理后台
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

school.html 28KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824
  1. <!DOCTYPE html>
  2. <html lang="zh-cn">
  3. <head>
  4. <meta charset="UTF-8" />
  5. <meta http-equiv="X-UA-Compatible" content="IE=edge" />
  6. <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  7. <title>河南星火燎原软件科技有限公司</title>
  8. <link rel="shortcut icon" href="../favicon.ico" type="image/x-icon" />
  9. <link rel="stylesheet" href="../librarys/bootstrap@3.4.1/bootstrap.css" />
  10. <link
  11. rel="stylesheet"
  12. href="../librarys/bootstrapValidator@0.5.3/bootstrapValidator.css"
  13. />
  14. <link rel="stylesheet" href="../css/comm.css" />
  15. <link rel="stylesheet" href="../css/header.css" />
  16. <style>
  17. body {
  18. background-color: #fff;
  19. }
  20. .user_main {
  21. margin: 20px auto;
  22. width: 1000px;
  23. }
  24. .user_main .header_box {
  25. display: flex;
  26. justify-content: space-between;
  27. align-items: center;
  28. margin-bottom: 10px;
  29. }
  30. .header_left .user_radio {
  31. cursor: pointer;
  32. }
  33. .header_left #searchschoolname {
  34. display: inline-block;
  35. margin-left: 16px;
  36. width: 240px;
  37. }
  38. .header_left .searchBtn {
  39. margin-left: 16px;
  40. }
  41. .user_main .table.table-bordered th {
  42. text-align: center;
  43. background-color: #f7f7f7;
  44. }
  45. .user_main .table.table-bordered td {
  46. text-align: center;
  47. background-color: #fff;
  48. line-height: 40px;
  49. }
  50. .user_main .table.table-bordered .action_btn {
  51. margin: 0 10px;
  52. cursor: pointer;
  53. }
  54. .user_main .table.table-bordered .action_show {
  55. display: block;
  56. }
  57. .user_main .table.table-bordered .action_hide {
  58. display: none;
  59. }
  60. .ser_img {
  61. width: 40px;
  62. height: 40px;
  63. cursor: pointer;
  64. }
  65. .showimgurl,
  66. .showimgurl img {
  67. width: 100%;
  68. height: 100%;
  69. }
  70. </style>
  71. </head>
  72. <body>
  73. <div class="top_header_root" data-header_page="school">
  74. <div class="header_html_root">
  75. <div class="header_html_item" data-url="index">用户信息</div>
  76. <div class="header_html_item" data-url="history">发展历程</div>
  77. <div class="header_html_item" data-url="service">服务案例</div>
  78. <div class="header_html_item" data-url="school">学校图标</div>
  79. <div class="header_html_item" data-url="trial">申请试用</div>
  80. <div class="header_html_item" data-url="news">新闻资讯</div>
  81. <div class="header_html_item" data-url="log">登录日志</div>
  82. </div>
  83. </div>
  84. <div class="user_main">
  85. <div class="header_box">
  86. <div class="header_left">
  87. <div class="radio-inline">
  88. <input
  89. id="s_1"
  90. class="user_radio"
  91. name="user_radio"
  92. type="radio"
  93. value="1"
  94. />
  95. <label for="s_1" class="user_radio">中文</label>
  96. </div>
  97. <div class="radio-inline">
  98. <input
  99. id="s_2"
  100. class="user_radio"
  101. name="user_radio"
  102. type="radio"
  103. value="2"
  104. />
  105. <label for="s_2" class="user_radio">英文</label>
  106. </div>
  107. <input
  108. type="text"
  109. id="searchschoolname"
  110. class="form-control"
  111. placeholder="请输入学校名称"
  112. />
  113. <div type="button" class="btn btn-primary searchBtn">搜索</div>
  114. </div>
  115. <div type="button" class="btn btn-primary user_add_btn">添加</div>
  116. </div>
  117. <table class="table table-bordered">
  118. <thead>
  119. <tr>
  120. <th style="width: 60px">序号</th>
  121. <th>学校名称</th>
  122. <th style="width: 140px">学校图标</th>
  123. <th>创建人</th>
  124. <th style="width: 160px">创建时间</th>
  125. <th style="width: 140px">操作</th>
  126. </tr>
  127. </thead>
  128. <tbody class="userTableBody"></tbody>
  129. </table>
  130. <div class="user_page page_box">
  131. <!-- <div class="page_prev disabled">&lt;</div>
  132. <div data-page="1" class="page_num selected">1</div>
  133. <div class="page_num">2</div>
  134. <div class="page_next">&gt;</div> -->
  135. </div>
  136. </div>
  137. <!-- 查看图片 -->
  138. <div
  139. class="modal fade"
  140. id="showImg"
  141. tabindex="-1"
  142. role="dialog"
  143. aria-labelledby="imgTitle"
  144. >
  145. <div class="modal-dialog" role="document">
  146. <div class="modal-content">
  147. <div class="modal-header">
  148. <button
  149. type="button"
  150. class="close"
  151. data-dismiss="modal"
  152. aria-label="Close"
  153. >
  154. <span aria-hidden="true">&times;</span>
  155. </button>
  156. <h4 class="modal-title" id="imgTitle">查看图片</h4>
  157. </div>
  158. <div class="modal-body">
  159. <div class="showimgurl"></div>
  160. </div>
  161. </div>
  162. </div>
  163. </div>
  164. <!-- 添加用户弹窗 -->
  165. <div
  166. class="modal fade"
  167. id="userAddModal"
  168. tabindex="-1"
  169. role="dialog"
  170. aria-labelledby="AddTitle"
  171. >
  172. <div class="modal-dialog" role="document">
  173. <div class="modal-content">
  174. <div class="modal-header">
  175. <button
  176. type="button"
  177. class="close"
  178. data-dismiss="modal"
  179. aria-label="Close"
  180. >
  181. <span aria-hidden="true">&times;</span>
  182. </button>
  183. <h4 class="modal-title" id="AddTitle">添加学校</h4>
  184. </div>
  185. <div class="modal-body">
  186. <form class="form-horizontal" id="UserAddForm">
  187. <div class="form-group">
  188. <label for="schoolnameInput" class="col-sm-2 control-label"
  189. >学校名称</label
  190. >
  191. <div class="col-sm-10">
  192. <input
  193. type="text"
  194. class="form-control"
  195. id="schoolnameInput"
  196. name="schoolname"
  197. placeholder="请输入学校名称"
  198. />
  199. </div>
  200. </div>
  201. <div class="form-group">
  202. <label for="loginnameInput" class="col-sm-2 control-label"
  203. >学校图标</label
  204. >
  205. <div class="col-sm-10">
  206. <input type="file" id="uploadFile" />
  207. </div>
  208. </div>
  209. </form>
  210. </div>
  211. <div class="modal-footer">
  212. <div type="button" class="btn btn-default" data-dismiss="modal">
  213. 取消
  214. </div>
  215. <div type="button" class="btn btn-primary add_save">确定</div>
  216. </div>
  217. </div>
  218. </div>
  219. </div>
  220. <!-- 修改用户弹窗 -->
  221. <div
  222. class="modal fade"
  223. id="userModifyModal"
  224. tabindex="-1"
  225. role="dialog"
  226. aria-labelledby="modifyTitle"
  227. >
  228. <div class="modal-dialog" role="document">
  229. <div class="modal-content">
  230. <div class="modal-header">
  231. <button
  232. type="button"
  233. class="close"
  234. data-dismiss="modal"
  235. aria-label="Close"
  236. >
  237. <span aria-hidden="true">&times;</span>
  238. </button>
  239. <h4 class="modal-title" id="modifyTitle">修改服务案例</h4>
  240. </div>
  241. <div class="modal-body">
  242. <form class="form-horizontal" id="userModifyForm">
  243. <div class="form-group">
  244. <label for="m_schoolnameInput" class="col-sm-2 control-label"
  245. >用户姓名</label
  246. >
  247. <div class="col-sm-10">
  248. <input
  249. type="text"
  250. class="form-control"
  251. id="m_schoolnameInput"
  252. name="schoolname"
  253. placeholder="请输入用户姓名"
  254. />
  255. </div>
  256. </div>
  257. <div class="form-group">
  258. <label for="m_loginnameInput" class="col-sm-2 control-label"
  259. >登录账号</label
  260. >
  261. <div class="col-sm-10">
  262. <input
  263. type="text"
  264. class="form-control"
  265. id="m_loginnameInput"
  266. name="loginname"
  267. placeholder="请输入登录账号"
  268. />
  269. </div>
  270. </div>
  271. <div class="form-group">
  272. <label for="m_loginpwdInput" class="col-sm-2 control-label"
  273. >登录密码</label
  274. >
  275. <div class="col-sm-10">
  276. <input
  277. type="password"
  278. class="form-control"
  279. id="m_loginpwdInput"
  280. name="loginpwd"
  281. placeholder="请输入登录密码"
  282. />
  283. </div>
  284. </div>
  285. <div class="form-group">
  286. <label for="m_userphoneInput" class="col-sm-2 control-label"
  287. >手机号</label
  288. >
  289. <div class="col-sm-10">
  290. <input
  291. type="text"
  292. class="form-control"
  293. id="m_userphoneInput"
  294. name="userphone"
  295. placeholder="请输入手机号"
  296. />
  297. </div>
  298. </div>
  299. </form>
  300. </div>
  301. <div class="modal-footer">
  302. <div type="button" class="btn btn-default" data-dismiss="modal">
  303. 取消
  304. </div>
  305. <div type="button" class="btn btn-primary modify_save">确定</div>
  306. </div>
  307. </div>
  308. </div>
  309. </div>
  310. <!-- 删除用户弹窗 -->
  311. <div
  312. class="modal fade"
  313. id="userDelModal"
  314. tabindex="-1"
  315. role="dialog"
  316. aria-labelledby="delTitle"
  317. >
  318. <div class="modal-dialog tip_modal" role="document">
  319. <div class="modal-content">
  320. <div class="modal-header">
  321. <button
  322. type="button"
  323. class="close"
  324. data-dismiss="modal"
  325. aria-label="Close"
  326. >
  327. <span aria-hidden="true">&times;</span>
  328. </button>
  329. <h4 class="modal-title" id="delTitle">提示</h4>
  330. </div>
  331. <div class="modal-body">确定删除选中信息?</div>
  332. <div class="modal-footer">
  333. <div type="button" class="btn btn-default" data-dismiss="modal">
  334. 取消
  335. </div>
  336. <div type="button" class="btn btn-primary del_save">保存</div>
  337. </div>
  338. </div>
  339. </div>
  340. </div>
  341. <script src="../librarys/jquery@1.12.4/jquery.min.js"></script>
  342. <script src="../librarys/bootstrap@3.4.1/bootstrap.js"></script>
  343. <script src="../librarys/bootstrapValidator@0.5.3/bootstrapValidator.js"></script>
  344. <script src="../utils/index.js"></script>
  345. <script>
  346. $(function () {
  347. let page_url = $(".top_header_root").data("header_page");
  348. //导航跳转
  349. $(
  350. '.header_html_root .header_html_item[data-url="' + page_url + '"]'
  351. ).addClass("selected");
  352. $(".header_html_root").on("click", ".header_html_item", function () {
  353. let _url = $(this).data("url");
  354. if (_url === "index") {
  355. window.location.href = "/index.html";
  356. } else {
  357. window.location.href = "/sections/" + _url + ".html";
  358. }
  359. });
  360. //检测登录
  361. if (!$.isLogin()) {
  362. window.location.href = "/sections/login.html";
  363. return;
  364. }
  365. let Search = {
  366. page: Number($.getQueryletiable("page")) || 1,
  367. size: 10,
  368. ltype: Number($.getQueryletiable("ltype")) || 1,
  369. schoolname: $.getQueryletiable("schoolname") || "",
  370. total: 0,
  371. list: []
  372. };
  373. //默认中英文单选框 1
  374. $('.header_left input:radio[name="user_radio"]').each(function (
  375. _index,
  376. radioItem
  377. ) {
  378. if (Number($(radioItem).val()) === Search.ltype) {
  379. $(radioItem).attr("checked", true);
  380. } else {
  381. $(radioItem).attr("checked", false);
  382. }
  383. });
  384. // 获取用户列表
  385. function getUserList() {
  386. $.ajax({
  387. type: "POST",
  388. url: $.baseUrl + "sl/list",
  389. dataType: "json",
  390. contentType: "application/json; charset=utf-8",
  391. data: JSON.stringify({
  392. page: Search.page,
  393. size: Search.size,
  394. ltype: Search.ltype,
  395. schoolname: Search.schoolname
  396. }),
  397. success: function (data) {
  398. if (data.code === 0) {
  399. Search.total = data.obj.total;
  400. Search.list = data.obj.list;
  401. console.log(Search);
  402. setTableHtml();
  403. setPageList();
  404. } else {
  405. Search.total = 0;
  406. Search.list = [];
  407. alert(data.msg);
  408. }
  409. }
  410. });
  411. }
  412. // 设置页码信息
  413. function setPageList() {
  414. let pageBoxHtml =
  415. '<div class="page_prev ' +
  416. (Search.page === 1 ? "disabled" : "") +
  417. '">&lt;</div>';
  418. for (
  419. let _pageIndex = 0;
  420. _pageIndex < Math.ceil(Search.total / Search.size);
  421. _pageIndex++
  422. ) {
  423. pageBoxHtml +=
  424. '<div data-page="' +
  425. (_pageIndex + 1) +
  426. '" class="page_num ' +
  427. (_pageIndex + 1 === Search.page ? "selected" : "") +
  428. '">' +
  429. (_pageIndex + 1) +
  430. "</div>";
  431. }
  432. pageBoxHtml +=
  433. '<div class="page_next ' +
  434. (Search.page === Math.ceil(Search.total / Search.size)
  435. ? "disabled"
  436. : "") +
  437. '">&gt;</div>';
  438. if (Search.total > 0) {
  439. $(".user_page.page_box").html(pageBoxHtml);
  440. $(".user_page.page_box").on("click", ".page_prev", function () {
  441. if (Search.page > 1) {
  442. Search.page--;
  443. window.location.href =
  444. "/index.html?page=" +
  445. Search.page +
  446. "&ltype=" +
  447. Search.ltype +
  448. "&schoolname=" +
  449. Search.schoolname;
  450. }
  451. });
  452. $(".user_page.page_box").on("click", ".page_num", function () {
  453. Search.page = $(this).data("page");
  454. window.location.href =
  455. "/index.html?page=" +
  456. Search.page +
  457. "&ltype=" +
  458. Search.ltype +
  459. "&schoolname=" +
  460. Search.schoolname;
  461. });
  462. $(".user_page.page_box").on("click", ".page_next", function () {
  463. if (Search.page < Math.ceil(Search.total / Search.size)) {
  464. Search.page++;
  465. window.location.href =
  466. "/index.html?page=" +
  467. Search.page +
  468. "&ltype=" +
  469. Search.ltype +
  470. "&schoolname=" +
  471. Search.schoolname;
  472. }
  473. });
  474. } else {
  475. $(".user_page.page_box").html("");
  476. }
  477. }
  478. // 设置表格信息
  479. function setTableHtml() {
  480. let userTableBodyHtml = "";
  481. $.each(Search.list, function (_userIndex, _userItem) {
  482. userTableBodyHtml +=
  483. "<tr><td>" +
  484. (_userIndex + 1 + (Search.page - 1) * Search.size) +
  485. "</td><td>" +
  486. (_userItem.schoolname ? _userItem.schoolname : "") +
  487. "</td><td><img class='ser_img' src='" +
  488. (_userItem.schoollogo
  489. ? $.showImageUrl + _userItem.schoollogo
  490. : "") +
  491. "' data-img='" +
  492. (_userItem.schoollogo
  493. ? $.showImageUrl + _userItem.schoollogo
  494. : "") +
  495. "' data-title='" +
  496. (_userItem.schoolname ? _userItem.schoolname : "") +
  497. "'></td><td>" +
  498. (_userItem.createname ? _userItem.createname : "") +
  499. "</td><td>" +
  500. $.dateFormat(_userItem.createtime) +
  501. '</td><td><div class="' +
  502. (_userItem.ltype === 1 ? "action_show" : "action_hide") +
  503. '"><span class="my_theme_color action_btn modify_btn" data-userid="' +
  504. _userItem.userid +
  505. '">修改</span><span class="my_theme_color">|</span><span class="del_color action_btn del_btn" data-userid="' +
  506. _userItem.userid +
  507. '">删除</span></div></td></tr>';
  508. });
  509. //点击图片放大 ser_img
  510. $(".userTableBody").on("click", ".ser_img", function () {
  511. let _url = $(this).data("img");
  512. let title = $(this).data("title");
  513. if (_url) {
  514. $("#showImg").modal("show");
  515. $(".showimgurl").html("<img src='" + _url + "'>");
  516. }
  517. if (title) {
  518. $("#imgTitle").text(title);
  519. }
  520. });
  521. $(".userTableBody").html(userTableBodyHtml);
  522. let del_userid = null;
  523. //删除弹窗
  524. $(".userTableBody").on("click", ".del_btn", function () {
  525. $("#userDelModal").modal("show");
  526. del_userid = $(this).data("userid");
  527. });
  528. //确定删除
  529. $("#userDelModal .del_save").on("click", function () {
  530. $.ajax({
  531. type: "POST",
  532. url: $.baseUrl + "user/del",
  533. dataType: "json",
  534. contentType: "application/json; charset=utf-8",
  535. data: JSON.stringify({
  536. userid: del_userid
  537. }),
  538. success: function (data) {
  539. $("#userDelModal").modal("hide");
  540. if (data.code === 0) {
  541. window.location.href =
  542. "/index.html?page=" +
  543. Search.page +
  544. "&ltype=" +
  545. Search.ltype +
  546. "&schoolname=" +
  547. Search.schoolname;
  548. } else {
  549. alert(data.msg);
  550. }
  551. }
  552. });
  553. });
  554. }
  555. //添加弹窗
  556. $(".user_main .header_box .user_add_btn").click(function () {
  557. $("#userAddModal").modal("show");
  558. });
  559. //获取图片地址
  560. $("#uploadFile").on("change", function () {
  561. let file = this.files[0]; //这是我们上传的文件
  562. let size = file.size / 1024 / 1024;
  563. let str = file.name.split(".");
  564. let suffix = str[str.length - 1];
  565. if (suffix !== "png" && suffix !== "jpg" && suffix !== "jpeg") {
  566. alert("请上传png、jpg、jpeg类型的文件");
  567. return false;
  568. }
  569. if (size > 10) {
  570. alert("图片太大,不能超过10M!");
  571. return false;
  572. }
  573. var formData = new FormData();
  574. formData.append("file", file);
  575. formData.append("savefolder", "schoolcase");
  576. console.log(formData);
  577. $.ajax({
  578. type: "POST",
  579. url: $.baseUrl + "file/upload",
  580. dataType: "json",
  581. contentType: "application/json; charset=utf-8",
  582. data: JSON.stringify(formData),
  583. success: function (data) {
  584. if (data.code === 0) {
  585. console.log(data);
  586. } else {
  587. alert(data.msg);
  588. }
  589. }
  590. });
  591. });
  592. //确定添加
  593. $("#userAddModal .add_save").on("click", function () {
  594. // 添加表单验证
  595. $("#UserAddForm").bootstrapValidator({
  596. // 默认的提示消息
  597. message: "请输入内容",
  598. // 表单框里右侧的icon
  599. feedbackIcons: {
  600. valid: "glyphicon glyphicon-ok",
  601. invalid: "glyphicon glyphicon-remove",
  602. validating: "glyphicon glyphicon-refresh"
  603. },
  604. fields: {
  605. schoolname: {
  606. validators: {
  607. notEmpty: {
  608. message: "请输入用户姓名"
  609. }
  610. }
  611. },
  612. loginname: {
  613. validators: {
  614. notEmpty: {
  615. message: "请输入登录账号"
  616. },
  617. stringLength: {
  618. //长度限制
  619. min: 4,
  620. max: 18,
  621. message: "登录账号长度必须在4~18个字符之间"
  622. }
  623. }
  624. },
  625. loginpwd: {
  626. validators: {
  627. notEmpty: {
  628. message: "请输入登录密码"
  629. },
  630. stringLength: {
  631. //长度限制
  632. min: 6,
  633. max: 16,
  634. message: "登录密码长度必须在6~16个字符之间"
  635. }
  636. }
  637. },
  638. userphone: {
  639. validators: {
  640. // notEmpty: {
  641. // message: "请输入手机号",
  642. // },
  643. regexp: {
  644. regexp: /^1\d{10}$/,
  645. message: "请输入正确的11位手机号"
  646. }
  647. }
  648. }
  649. }
  650. });
  651. //先校验,在调是否通过校验的方法
  652. $("#UserAddForm").data("bootstrapValidator").validate();
  653. //校验表单是否通过
  654. let flag = $("#UserAddForm").data("bootstrapValidator").isValid();
  655. if (flag) {
  656. let _url = $.baseUrl + "user/save";
  657. $.ajax({
  658. type: "POST",
  659. url: _url,
  660. dataType: "json",
  661. contentType: "application/json; charset=utf-8",
  662. data: JSON.stringify({
  663. schoolname: $("#UserAddForm #schoolnameInput").val(),
  664. loginname: $("#UserAddForm #loginnameInput").val(),
  665. loginpwd: $("#UserAddForm #loginpwdInput").val(),
  666. createid: $.userInfo.userid,
  667. userphone: $("#UserAddForm #userphoneInput").val()
  668. }),
  669. success: function (data) {
  670. if (data.code === 0) {
  671. window.location.href =
  672. "/index.html?page=1&ltype=" +
  673. Search.ltype +
  674. "&schoolname=" +
  675. Search.schoolname;
  676. } else {
  677. alert(data.msg);
  678. }
  679. }
  680. });
  681. }
  682. });
  683. let modify_userid = null;
  684. //修改
  685. $(".userTableBody").on("click", ".modify_btn", function () {
  686. modify_userid = $(this).data("userid");
  687. $("#userModifyModal").modal("show");
  688. $.each(Search.list, function (_index, _userItem) {
  689. if (_userItem.userid === modify_userid) {
  690. console.log("modify_userid", _userItem);
  691. $("#userModifyForm #m_schoolnameInput").val(_userItem.schoolname);
  692. $("#userModifyForm #m_loginnameInput").val(_userItem.loginname);
  693. $("#userModifyForm #m_loginpwdInput").val(_userItem.loginpwd);
  694. $("#userModifyForm #m_userphoneInput").val(_userItem.userphone);
  695. }
  696. });
  697. });
  698. //确定修改
  699. $("#userModifyModal .modify_save").on("click", function () {
  700. // 添加表单验证
  701. $("#userModifyForm").bootstrapValidator({
  702. // 默认的提示消息
  703. message: "请输入内容",
  704. // 表单框里右侧的icon
  705. feedbackIcons: {
  706. valid: "glyphicon glyphicon-ok",
  707. invalid: "glyphicon glyphicon-remove",
  708. validating: "glyphicon glyphicon-refresh"
  709. },
  710. fields: {
  711. schoolname: {
  712. validators: {
  713. notEmpty: {
  714. message: "请输入用户姓名"
  715. }
  716. }
  717. },
  718. loginname: {
  719. validators: {
  720. notEmpty: {
  721. message: "请输入登录账号"
  722. },
  723. stringLength: {
  724. //长度限制
  725. min: 4,
  726. max: 18,
  727. message: "登录账号长度必须在4~18个字符之间"
  728. }
  729. }
  730. },
  731. loginpwd: {
  732. validators: {
  733. notEmpty: {
  734. message: "请输入登录密码"
  735. },
  736. stringLength: {
  737. //长度限制
  738. min: 6,
  739. max: 16,
  740. message: "登录密码长度必须在6~16个字符之间"
  741. }
  742. }
  743. },
  744. userphone: {
  745. validators: {
  746. // notEmpty: {
  747. // message: "请输入手机号",
  748. // },
  749. regexp: {
  750. regexp: /^1\d{10}$/,
  751. message: "请输入正确的11位手机号"
  752. }
  753. }
  754. }
  755. }
  756. });
  757. //先校验,在调是否通过校验的方法
  758. $("#userModifyForm").data("bootstrapValidator").validate();
  759. //校验表单是否通过
  760. let flag = $("#userModifyForm").data("bootstrapValidator").isValid();
  761. if (flag) {
  762. let _url = $.baseUrl + "user/update";
  763. $.ajax({
  764. type: "POST",
  765. url: _url,
  766. dataType: "json",
  767. contentType: "application/json; charset=utf-8",
  768. data: JSON.stringify({
  769. schoolname: $("#userModifyForm #m_schoolnameInput").val(),
  770. loginname: $("#userModifyForm #m_loginnameInput").val(),
  771. loginpwd: $("#userModifyForm #m_loginpwdInput").val(),
  772. userid: modify_userid,
  773. userphone: $("#userModifyForm #m_userphoneInput").val()
  774. }),
  775. success: function (data) {
  776. if (data.code === 0) {
  777. window.location.href =
  778. "/index.html?page=" +
  779. Search.page +
  780. "&ltype=" +
  781. Search.ltype +
  782. "&schoolname=" +
  783. Search.schoolname;
  784. } else {
  785. alert(data.msg);
  786. }
  787. }
  788. });
  789. }
  790. });
  791. //切换中英文
  792. $(".header_left").on(
  793. "click",
  794. 'input:radio[name="user_radio"]',
  795. function () {
  796. window.location.href =
  797. "/sections/school.html?page=" +
  798. Search.page +
  799. "&ltype=" +
  800. $('.header_left input:radio[name="user_radio"]:checked').val() +
  801. "&schoolname=" +
  802. Search.schoolname;
  803. }
  804. );
  805. $("#searchschoolname").val(Search.schoolname);
  806. $("#searchschoolname").on("change", function () {
  807. Search.schoolname = $(this).val();
  808. });
  809. //搜索
  810. $(".header_left .searchBtn").click(function () {
  811. window.location.href =
  812. "/sections/school.html?page=" +
  813. Search.page +
  814. "&ltype=" +
  815. Search.ltype +
  816. "&schoolname=" +
  817. Search.schoolname;
  818. });
  819. getUserList();
  820. });
  821. </script>
  822. </body>
  823. </html>