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

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