|
@@ -69,8 +69,16 @@
|
69
|
69
|
}
|
70
|
70
|
#uploadFile {
|
71
|
71
|
display: inline-block;
|
72
|
|
- width: 100px;
|
73
|
|
- height: 100px;
|
|
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%;
|
74
|
82
|
}
|
75
|
83
|
</style>
|
76
|
84
|
</head>
|
|
@@ -203,18 +211,37 @@
|
203
|
211
|
/>
|
204
|
212
|
</div>
|
205
|
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>
|
206
|
228
|
<div class="form-group">
|
207
|
229
|
<label for="loginnameInput" class="col-sm-2 control-label"
|
208
|
230
|
>上传图片</label
|
209
|
231
|
>
|
210
|
232
|
<div class="col-sm-10">
|
|
233
|
+ <div class="upimg addimg"></div>
|
211
|
234
|
<input type="file" id="uploadFile" />
|
212
|
235
|
</div>
|
213
|
236
|
</div>
|
214
|
237
|
</form>
|
215
|
238
|
</div>
|
216
|
239
|
<div class="modal-footer">
|
217
|
|
- <div type="button" class="btn btn-default" data-dismiss="modal">
|
|
240
|
+ <div
|
|
241
|
+ type="button"
|
|
242
|
+ class="btn btn-default add_cancel"
|
|
243
|
+ data-dismiss="modal"
|
|
244
|
+ >
|
218
|
245
|
取消
|
219
|
246
|
</div>
|
220
|
247
|
<div type="button" class="btn btn-primary add_save">确定</div>
|
|
@@ -247,7 +274,7 @@
|
247
|
274
|
<form class="form-horizontal" id="userModifyForm">
|
248
|
275
|
<div class="form-group">
|
249
|
276
|
<label for="m_scnameInput" class="col-sm-2 control-label"
|
250
|
|
- >用户姓名</label
|
|
277
|
+ >服务名称</label
|
251
|
278
|
>
|
252
|
279
|
<div class="col-sm-10">
|
253
|
280
|
<input
|
|
@@ -255,7 +282,7 @@
|
255
|
282
|
class="form-control"
|
256
|
283
|
id="m_scnameInput"
|
257
|
284
|
name="scname"
|
258
|
|
- placeholder="请输入用户姓名"
|
|
285
|
+ placeholder="请输入服务名称"
|
259
|
286
|
/>
|
260
|
287
|
</div>
|
261
|
288
|
</div>
|
|
@@ -304,7 +331,11 @@
|
304
|
331
|
</form>
|
305
|
332
|
</div>
|
306
|
333
|
<div class="modal-footer">
|
307
|
|
- <div type="button" class="btn btn-default" data-dismiss="modal">
|
|
334
|
+ <div
|
|
335
|
+ type="button"
|
|
336
|
+ class="btn btn-default mo_cancel"
|
|
337
|
+ data-dismiss="modal"
|
|
338
|
+ >
|
308
|
339
|
取消
|
309
|
340
|
</div>
|
310
|
341
|
<div type="button" class="btn btn-primary modify_save">确定</div>
|
|
@@ -335,7 +366,11 @@
|
335
|
366
|
</div>
|
336
|
367
|
<div class="modal-body">确定删除选中信息?</div>
|
337
|
368
|
<div class="modal-footer">
|
338
|
|
- <div type="button" class="btn btn-default" data-dismiss="modal">
|
|
369
|
+ <div
|
|
370
|
+ type="button"
|
|
371
|
+ class="btn btn-default del_cancel"
|
|
372
|
+ data-dismiss="modal"
|
|
373
|
+ >
|
339
|
374
|
取消
|
340
|
375
|
</div>
|
341
|
376
|
<div type="button" class="btn btn-primary del_save">保存</div>
|
|
@@ -373,7 +408,10 @@
|
373
|
408
|
ltype: Number($.getQueryletiable("ltype")) || 1,
|
374
|
409
|
scname: $.getQueryletiable("scname") || "",
|
375
|
410
|
total: 0,
|
376
|
|
- list: []
|
|
411
|
+ list: [],
|
|
412
|
+ scpic: "",
|
|
413
|
+ scorder: 0,
|
|
414
|
+ createid: 0
|
377
|
415
|
};
|
378
|
416
|
//默认中英文单选框 1
|
379
|
417
|
$('.header_left input:radio[name="user_radio"]').each(function (
|
|
@@ -403,6 +441,7 @@
|
403
|
441
|
if (data.code === 0) {
|
404
|
442
|
Search.total = data.obj.total;
|
405
|
443
|
Search.list = data.obj.list;
|
|
444
|
+ Search.scorder = data.obj.total;
|
406
|
445
|
console.log(Search);
|
407
|
446
|
setTableHtml();
|
408
|
447
|
setPageList();
|
|
@@ -556,6 +595,8 @@
|
556
|
595
|
//添加弹窗
|
557
|
596
|
$(".user_main .header_box .user_add_btn").click(function () {
|
558
|
597
|
$("#userAddModal").modal("show");
|
|
598
|
+ Search.scorder++;
|
|
599
|
+ $("#scorderInput").val(Search.scorder);
|
559
|
600
|
});
|
560
|
601
|
//获取图片地址
|
561
|
602
|
$("#uploadFile").on("change", function () {
|
|
@@ -571,26 +612,29 @@
|
571
|
612
|
alert("图片太大,不能超过10M!");
|
572
|
613
|
return false;
|
573
|
614
|
}
|
574
|
|
- var formData = new FormData();
|
575
|
|
- formData.append("file", file);
|
576
|
|
- formData.append("savefolder", "servicecase");
|
577
|
|
- console.log(formData);
|
|
615
|
+ const form = new FormData();
|
|
616
|
+ form.append("file", file);
|
|
617
|
+ form.append("savefolder", "servicecase");
|
578
|
618
|
$.ajax({
|
579
|
619
|
type: "POST",
|
580
|
620
|
url: $.baseUrl + "file/upload",
|
581
|
|
- dataType: "json",
|
582
|
|
- contentType: "application/json; charset=utf-8",
|
583
|
|
- data: JSON.stringify(formData),
|
|
621
|
+ contentType: false,
|
|
622
|
+ processData: false,
|
|
623
|
+ data: form,
|
584
|
624
|
success: function (data) {
|
585
|
625
|
if (data.code === 0) {
|
586
|
|
- console.log(data);
|
|
626
|
+ Search.scpic = data.obj;
|
|
627
|
+ $(".addimg").html("<img src='" + $.showImageUrl + scpic + "'>");
|
587
|
628
|
} else {
|
588
|
629
|
alert(data.msg);
|
589
|
630
|
}
|
590
|
631
|
}
|
591
|
632
|
});
|
592
|
633
|
});
|
593
|
|
-
|
|
634
|
+ //添加 取消add_cancel
|
|
635
|
+ $(".add_cancel").on("click", function () {
|
|
636
|
+ console.log(1);
|
|
637
|
+ });
|
594
|
638
|
//确定添加
|
595
|
639
|
$("#userAddModal .add_save").on("click", function () {
|
596
|
640
|
// 添加表单验证
|
|
@@ -607,44 +651,14 @@
|
607
|
651
|
scname: {
|
608
|
652
|
validators: {
|
609
|
653
|
notEmpty: {
|
610
|
|
- message: "请输入用户姓名"
|
|
654
|
+ message: "请输入服务名称"
|
611
|
655
|
}
|
612
|
656
|
}
|
613
|
657
|
},
|
614
|
|
- loginname: {
|
|
658
|
+ scorder: {
|
615
|
659
|
validators: {
|
616
|
660
|
notEmpty: {
|
617
|
|
- message: "请输入登录账号"
|
618
|
|
- },
|
619
|
|
- stringLength: {
|
620
|
|
- //长度限制
|
621
|
|
- min: 4,
|
622
|
|
- max: 18,
|
623
|
|
- message: "登录账号长度必须在4~18个字符之间"
|
624
|
|
- }
|
625
|
|
- }
|
626
|
|
- },
|
627
|
|
- loginpwd: {
|
628
|
|
- validators: {
|
629
|
|
- notEmpty: {
|
630
|
|
- message: "请输入登录密码"
|
631
|
|
- },
|
632
|
|
- stringLength: {
|
633
|
|
- //长度限制
|
634
|
|
- min: 6,
|
635
|
|
- max: 16,
|
636
|
|
- message: "登录密码长度必须在6~16个字符之间"
|
637
|
|
- }
|
638
|
|
- }
|
639
|
|
- },
|
640
|
|
- userphone: {
|
641
|
|
- validators: {
|
642
|
|
- // notEmpty: {
|
643
|
|
- // message: "请输入手机号",
|
644
|
|
- // },
|
645
|
|
- regexp: {
|
646
|
|
- regexp: /^1\d{10}$/,
|
647
|
|
- message: "请输入正确的11位手机号"
|
|
661
|
+ message: "请输入排序"
|
648
|
662
|
}
|
649
|
663
|
}
|
650
|
664
|
}
|
|
@@ -654,24 +668,31 @@
|
654
|
668
|
$("#UserAddForm").data("bootstrapValidator").validate();
|
655
|
669
|
//校验表单是否通过
|
656
|
670
|
let flag = $("#UserAddForm").data("bootstrapValidator").isValid();
|
|
671
|
+ if (!Search.scpic) {
|
|
672
|
+ //请上传图片
|
|
673
|
+ alert("请上传图片!");
|
|
674
|
+ return;
|
|
675
|
+ }
|
657
|
676
|
if (flag) {
|
658
|
|
- let _url = $.baseUrl + "user/save";
|
|
677
|
+ let _url = $.baseUrl + "sc/save";
|
659
|
678
|
$.ajax({
|
660
|
679
|
type: "POST",
|
661
|
680
|
url: _url,
|
662
|
681
|
dataType: "json",
|
663
|
682
|
contentType: "application/json; charset=utf-8",
|
664
|
683
|
data: JSON.stringify({
|
665
|
|
- scname: $("#UserAddForm #scnameInput").val(),
|
666
|
|
- loginname: $("#UserAddForm #loginnameInput").val(),
|
667
|
|
- loginpwd: $("#UserAddForm #loginpwdInput").val(),
|
|
684
|
+ scname: Search.scname,
|
|
685
|
+ scpic: Search.scpic,
|
|
686
|
+ ltype: Search.ltype,
|
668
|
687
|
createid: $.userInfo.userid,
|
669
|
|
- userphone: $("#UserAddForm #userphoneInput").val()
|
|
688
|
+ scorder: Search.scorder
|
670
|
689
|
}),
|
671
|
690
|
success: function (data) {
|
672
|
691
|
if (data.code === 0) {
|
673
|
692
|
window.location.href =
|
674
|
|
- "/index.html?page=1<ype=" +
|
|
693
|
+ "/sections/service.html?page=" +
|
|
694
|
+ Search.page +
|
|
695
|
+ "<ype=" +
|
675
|
696
|
Search.ltype +
|
676
|
697
|
"&scname=" +
|
677
|
698
|
Search.scname;
|