Authored by 梁志锋

我要咨询页面提交功能实现 code review by zhaobiao

@@ -10,9 +10,6 @@ var $ = require('jquery'), @@ -10,9 +10,6 @@ var $ = require('jquery'),
10 var $consultForm = $('.consult-form'), 10 var $consultForm = $('.consult-form'),
11 $submit = $('#submit'), 11 $submit = $('#submit'),
12 $content = $('#content'), 12 $content = $('#content'),
13 - $footer = $('#yoho-footer'),  
14 - $navTitle = $('.nav-title'),  
15 - navTitle = $navTitle.html(),  
16 productId = $('#product_id').val(), 13 productId = $('#product_id').val(),
17 isSubmiting; 14 isSubmiting;
18 15
@@ -39,6 +36,7 @@ $content.on('focus', function() { @@ -39,6 +36,7 @@ $content.on('focus', function() {
39 // 提交表单请求 36 // 提交表单请求
40 $consultForm.on('submit', function() { 37 $consultForm.on('submit', function() {
41 var content; 38 var content;
  39 +
42 if (isSubmiting) { 40 if (isSubmiting) {
43 return false; 41 return false;
44 } 42 }
@@ -3,7 +3,7 @@ @@ -3,7 +3,7 @@
3 <form class="consult-form" url="{{formUrl}}"> 3 <form class="consult-form" url="{{formUrl}}">
4 <textarea id="content" name="content">请输入咨询内容</textarea> 4 <textarea id="content" name="content">请输入咨询内容</textarea>
5 <input type="hidden" id="product_id" value="{{productId}}"> 5 <input type="hidden" id="product_id" value="{{productId}}">
6 - <a type="submit">提交</a> 6 + <a type="submit" id="submit">提交</a>
7 </form> 7 </form>
8 </div> 8 </div>
9 {{> layout/footer}} 9 {{> layout/footer}}
@@ -95,7 +95,7 @@ @@ -95,7 +95,7 @@
95 {{else}} 95 {{else}}
96 <div class="nodata"> 96 <div class="nodata">
97 <span>暂无商品评价和咨询</span> 97 <span>暂无商品评价和咨询</span>
98 - <a href="/product/detail/consultform" class="go-consult">我要咨询<span class="iconfont">&#xe604;</span></a> 98 + <a href="{{link}}" class="go-consult">我要咨询<span class="iconfont">&#xe604;</span></a>
99 </div> 99 </div>
100 {{/if}} 100 {{/if}}
101 {{/if}} 101 {{/if}}
@@ -130,10 +130,10 @@ @@ -130,10 +130,10 @@
130 </div> 130 </div>
131 {{/cartInfo}} 131 {{/cartInfo}}
132 {{#if introUrl}} 132 {{#if introUrl}}
133 - <input id="introUrl" type="hidden" value={{introUrl}}> 133 + <input id="introUrl" type="hidden" value='{{introUrl}}'>
134 {{/if}} 134 {{/if}}
135 {{#if id}} 135 {{#if id}}
136 - <input id="productId" type="hidden" value={{id}}> 136 + <input id="productId" type="hidden" value='{{id}}'>
137 {{/if}} 137 {{/if}}
138 138
139 </div> 139 </div>
1 <script> 1 <script>
2 seajs.use('js/common'); 2 seajs.use('js/common');
3 </script> 3 </script>
  4 +
  5 +<script>
  6 + seajs.use('js/product/detail/consultform');
  7 +</script>
  8 +
  9 +
4 {{!-- 逛(PLUS+STAR) --}} 10 {{!-- 逛(PLUS+STAR) --}}
5 {{#if psList}} 11 {{#if psList}}
6 <script> 12 <script>
@@ -59,7 +59,7 @@ @@ -59,7 +59,7 @@
59 <span class="iconfont">&#xe63d;</span>暂无咨询 59 <span class="iconfont">&#xe63d;</span>暂无咨询
60 </div> 60 </div>
61 <div class="consult-content-footer"> 61 <div class="consult-content-footer">
62 - <a href="/product/detail/consultform"> 62 + <a href="{{link}}">
63 我要咨询 63 我要咨询
64 <span class="iconfont">&#xe604;</span></a> 64 <span class="iconfont">&#xe604;</span></a>
65 </div> 65 </div>