官网 管理后台
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.

service.html 28KB

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