limit-add.js
2.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
/*
*@time: 2016/2/15
*@author: chenglong
*/
var $ = require('jquery'),
common=require('../common/common'),
edit = require('../common/edit');
var uploadImg = new edit('#coverImgBox');
//
uploadImg.init();
exports.init = function () {
$('body').on('click', '#textDialog', function() {
common.dialog.confirm("添加文本","nihao",function(){
});
return false;
});
$('body').on('click', '#picDialog', function() {
common.dialog.confirm("添加图片",common.util.__template($("#picDialogTemp").html(),{name:"图片"}),function(){
var imgStr = '<img src="http://img11.static.yhbimg.com/goodsimg/2015/07/07/08/01315b5bbfd72bc5b59fa2fda6c28b9ae6.jpg">';
$('.quota-img').html(imgStr);
});
return false;
});
$('body').on('click', '#videoDialog', function() {
common.dialog.confirm("添加视频",common.util.__template($("#picDialogTemp").html(),{name:"视频"}),function(){
var imgStr = '<img src="http://img11.static.yhbimg.com/goodsimg/2015/07/07/08/01315b5bbfd72bc5b59fa2fda6c28b9ae6.jpg">';
$('.quota-video').html(imgStr);
});
return false;
});
// 添加品类表单验证
var limitAddForm = new edit("#limit-add-form");
limitAddForm.init();
$('.limit-add-btn').click(function () {
var $this = $(this);
limitAddForm.submit('/limit/product/new', function(option,that) {
option.beforeSend = function () {
$this.attr('disabled', 'disabled');
};
option.success=function(res){
console.log(res);
if (res.data.code === 200) {
limitAddForm.$tip('提交成功');
$this.removeAttr('disabled');
setTimeout(function () {
//window.location.href = '/erpproduct/sort/index';
}, 1000);
}
};
option.error=function(res){
console.log('error');
}
});
});
};