resolve conflict for mergerequest codereview by guanning
Showing
1 changed file
with
0 additions
and
45 deletions
1 | -/** | ||
2 | - * 购买咨询的提交页 | ||
3 | - * @author: liangzhifeng<zhifeng.liang@yoho.cn> | ||
4 | - * @date: 2015/12/01 | ||
5 | - */ | ||
6 | -var $ = require('jquery'), | ||
7 | - tip = require('../../plugin/tip'); | ||
8 | - | ||
9 | -var $consultForm = $('.consult-form'); | ||
10 | - | ||
11 | -// 提交表单请求 | ||
12 | -$consultForm.on('submit', function() { | ||
13 | - if (isSubmiting) { | ||
14 | - return false; | ||
15 | - } | ||
16 | - | ||
17 | - // 简单的表单校验 | ||
18 | - if (!$(content).val()) { | ||
19 | - tip.show('咨询内容不能为空'); | ||
20 | - return false; | ||
21 | - } | ||
22 | - | ||
23 | - isSubmiting = true; | ||
24 | - loading.showLoadingMask(); | ||
25 | - $.ajax({ | ||
26 | - method: 'POST', | ||
27 | - url: '/product/detail/consultsubmit', | ||
28 | - data: $(this).serialize() | ||
29 | - }).then(function(res) { | ||
30 | - if ($.type(res) !== 'object') { | ||
31 | - res = {}; | ||
32 | - } | ||
33 | - if (res.code !== 200) { | ||
34 | - tip.show(res.message || '网络出了点问题~'); | ||
35 | - isSubmiting = false; | ||
36 | - loading.hideLoadingMask(); | ||
37 | - } else { | ||
38 | - window.location.href = '/product/detail/index'; | ||
39 | - } | ||
40 | - }).fail(function() { | ||
41 | - tip.show('网络出了点问题~'); | ||
42 | - isSubmiting = false; | ||
43 | - }); | ||
44 | - return false; | ||
45 | -}); |
-
Please register or login to post a comment