浏览代码

完善公司信息开发中 上下页切换完成

wuxw 7 年之前
父节点
当前提交
96ffc8671b

+ 44 - 0
WebService/src/main/java/com/java110/web/components/CompanyComponent.java

@@ -0,0 +1,44 @@
+package com.java110.web.components;
+
+import com.java110.core.context.IPageData;
+import com.java110.web.smo.ICompanyServiceSMO;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
+import org.springframework.stereotype.Component;
+
+/**
+ * 初始化公司组件
+ * Created by Administrator on 2019/3/28.
+ */
+@Component("company")
+public class CompanyComponent {
+
+
+    @Autowired
+    ICompanyServiceSMO companyServiceSMOImpl;
+    /**
+     * 获取商户类型
+     * @param pd
+     * @return
+     */
+    public ResponseEntity<String> getStoreType(IPageData pd){
+        ResponseEntity<String> responseEntity = null;
+        try{
+            responseEntity =  companyServiceSMOImpl.getStoreType(pd);
+        }catch (Exception e){
+            responseEntity = new ResponseEntity<String>(e.getMessage(), HttpStatus.INTERNAL_SERVER_ERROR);
+        }finally {
+            return responseEntity;
+        }
+    }
+
+
+    public ICompanyServiceSMO getCompanyServiceSMOImpl() {
+        return companyServiceSMOImpl;
+    }
+
+    public void setCompanyServiceSMOImpl(ICompanyServiceSMO companyServiceSMOImpl) {
+        this.companyServiceSMOImpl = companyServiceSMOImpl;
+    }
+}

+ 19 - 0
WebService/src/main/java/com/java110/web/smo/ICompanyServiceSMO.java

@@ -0,0 +1,19 @@
+package com.java110.web.smo;
+
+import com.java110.core.context.IPageData;
+import org.springframework.http.ResponseEntity;
+
+/**
+ *
+ * 初始化 公司接口类
+ * Created by Administrator on 2019/3/28.
+ */
+public interface ICompanyServiceSMO {
+
+    /**
+     * 查询商户类型
+     * @param pd
+     * @return
+     */
+    public ResponseEntity<String> getStoreType(IPageData pd);
+}

+ 54 - 0
WebService/src/main/java/com/java110/web/smo/impl/CompanyServiceSMOImpl.java

@@ -0,0 +1,54 @@
+package com.java110.web.smo.impl;
+
+import com.alibaba.fastjson.JSONObject;
+import com.java110.common.constant.ServiceConstant;
+import com.java110.common.util.Assert;
+import com.java110.core.context.IPageData;
+import com.java110.web.core.BaseComponentSMO;
+import com.java110.web.smo.ICompanyServiceSMO;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.HttpMethod;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
+import org.springframework.stereotype.Service;
+import org.springframework.web.client.RestTemplate;
+
+/**
+ * 初始化公司实现类
+ * Created by Administrator on 2019/3/28.
+ */
+@Service("companyServiceSMOImpl")
+public class CompanyServiceSMOImpl extends BaseComponentSMO implements ICompanyServiceSMO {
+
+    @Autowired
+    private RestTemplate restTemplate;
+
+    /**
+     * 查询 商户类别
+     * @param pd
+     * @return
+     */
+    @Override
+    public ResponseEntity<String> getStoreType(IPageData pd) {
+        ResponseEntity<String> responseEntity = null;
+        Assert.hasLength(pd.getUserId(),"用户还未登录请先登录");
+
+        responseEntity = this.callCenterService(restTemplate,pd,"", ServiceConstant.SERVICE_API_URL+"/api/query.store.type?type=all", HttpMethod.GET);
+
+        if(responseEntity.getStatusCode() == HttpStatus.OK){
+            Assert.jsonObjectHaveKey(responseEntity.getBody(),"storeType","查询中心服务异常,不是有效json或未包含storeType节点");
+            //将storeType 返回出去
+            responseEntity = new ResponseEntity<String>(JSONObject.parseObject(responseEntity.getBody()).getJSONArray("storeType").toJSONString(),HttpStatus.OK);
+        }
+        return responseEntity;
+    }
+
+
+    public RestTemplate getRestTemplate() {
+        return restTemplate;
+    }
+
+    public void setRestTemplate(RestTemplate restTemplate) {
+        this.restTemplate = restTemplate;
+    }
+}

+ 103 - 70
WebService/src/main/resources/components/company/company.html

@@ -3,7 +3,7 @@
         <div class="col-lg-12">
             <div class="ibox">
                 <div class="ibox-title">
-                    <h5>公司信息</h5>
+                    <h5>填写公司信息</h5>
                     <div class="ibox-tools">
 
                     </div>
@@ -15,83 +15,116 @@
                     <p>
                         请仔细填写公司相关信息,有利于快速审核
                     </p>
-
-                    <form id="form" action="#" class="wizard-big">
-                        <h1>基本信息</h1>
-                        <fieldset>
-                            <h2>公司基本信息</h2>
-                            <div class="row">
-                                <div class="col-lg-8">
-                                    <div class="form-group">
-                                        <label>公司名称 *</label>
-                                        <input id="name" name="name" type="text" class="form-control required">
-                                    </div>
-                                    <div class="form-group">
-                                        <label>公司地址 *</label>
-                                        <input id="address" name="address" type="text" class="form-control required">
-                                    </div>
-                                    <div class="form-group">
-                                        <label>联系电话 *</label>
-                                        <input id="tel" name="tel" type="text" class="form-control required">
-                                    </div>
-                                    <div class="form-group">
-                                        <label>公司业务 *</label>
-                                        <input id="storeTypeCd" name="storeTypeCd" type="text" class="form-control required">
-                                    </div>
-                                    <div class="form-group">
-                                        <label>附近建筑 *</label>
-                                        <input id="nearbyLandmarks" name="nearbyLandmarks" type="text" class="form-control required">
+                    <form id="component" class="wizard-big wizard clearfix" role="application" novalidate="novalidate">
+                        <div class="steps clearfix">
+                            <ul role="tablist">
+                                <li role="tab" v-bind:class="{ current: step==1,disabled:step!=1 }" >
+                                    <a>
+                                        <span class="current-info audible">current step: </span>
+                                        <span class="number">1.</span> 基本信息
+                                    </a>
+                                </li>
+                                <li role="tab" v-bind:class="{ current: step==2,disabled:step!=2 }">
+                                    <a>
+                                        <span class="number">2.</span> 证件信息
+                                    </a>
+                                </li>
+                                <li role="tab" v-bind:class="{ current: step==3,disabled:step!=3 }">
+                                    <a>
+                                    <span class="number">3.</span> Warning
+                                    </a>
+                                </li>
+                                <li role="tab" v-bind:class="{ current: step==4,disabled:step!=4 }">
+                                    <a>
+                                    <span class="number">4.</span> Finish
+                                    </a>
+                                </li>
+                            </ul>
+                        </div>
+                        <div class="content clearfix">
+                            <h1 tabindex="-1" class="title current">基本信息</h1>
+                            <fieldset role="tabpanel" aria-labelledby="component-h-0" class="body current" v-bind:class="{no_display:step!=1}" aria-hidden="false">
+                                <h2>公司基本信息</h2>
+                                <div class="row">
+                                    <div class="col-lg-8">
+                                        <div class="form-group">
+                                            <label>公司名称 *</label>
+                                            <input id="name" name="name" type="text" class="form-control required" aria-required="true" />
+                                        </div>
+                                        <div class="form-group">
+                                            <label>公司地址 *</label>
+                                            <input id="address" name="address" type="text" class="form-control required" aria-required="true" />
+                                        </div>
+                                        <div class="form-group">
+                                            <label>联系电话 *</label>
+                                            <input id="tel" name="tel" type="text" class="form-control required" aria-required="true" />
+                                        </div>
+                                        <div class="form-group">
+                                            <label>公司业务 *</label>
+                                            <select id="storeTypeCd" name="storeTypeCd" class="form-control  required" aria-required="true">
+                                                <option v-for="storeType in storeTypes" value="storeType.storeTypeCd">{{storeType.name}}</option>
+                                            </select>
+                                        </div>
+                                        <div class="form-group">
+                                            <label>附近建筑 *</label>
+                                            <input id="nearbyLandmarks" name="nearbyLandmarks" type="text" class="form-control required" aria-required="true" />
+                                        </div>
                                     </div>
-                                </div>
-                                <div class="col-lg-4">
-                                    <div class="text-center">
-                                        <div style="margin-top: 20px">
-                                            <i class="fa fa-sign-in" style="font-size: 180px;color: #e5e5e5 "></i>
+                                    <div class="col-lg-4">
+                                        <div class="text-center">
+                                            <div style="margin-top: 20px;">
+                                                <i class="fa fa-sign-in" style="font-size: 180px; color: rgb(229, 229, 229);"></i>
+                                            </div>
                                         </div>
                                     </div>
                                 </div>
-                            </div>
-
-                        </fieldset>
-                        <h1>证件信息</h1>
-                        <fieldset>
-                            <h2>公司证件信息</h2>
-                            <div class="row">
-                                <div class="col-lg-6">
-                                    <div class="form-group">
-                                        <label>First name *</label>
-                                        <input id="name" name="name" type="text" class="form-control required">
+                            </fieldset>
+                            <h1 id="component-h-1" tabindex="-1" class="title">证件信息</h1>
+                            <fieldset id="component-p-1" role="tabpanel" aria-labelledby="component-h-1" class="body" aria-hidden="true"  v-bind:class="{no_display:step!=2}">
+                                <h2>公司证件信息</h2>
+                                <div class="row">
+                                    <div class="col-lg-6">
+                                        <div class="form-group">
+                                            <label>First name *</label>
+                                            <input id="name" name="name" type="text" class="form-control required" aria-required="true" />
+                                        </div>
+                                        <div class="form-group">
+                                            <label>Last name *</label>
+                                            <input id="surname" name="surname" type="text" class="form-control required" aria-required="true" />
+                                        </div>
                                     </div>
-                                    <div class="form-group">
-                                        <label>Last name *</label>
-                                        <input id="surname" name="surname" type="text" class="form-control required">
+                                    <div class="col-lg-6">
+                                        <div class="form-group">
+                                            <label>Email *</label>
+                                            <input id="email" name="email" type="text" class="form-control required email" aria-required="true" />
+                                        </div>
+                                        <div class="form-group">
+                                            <label>Address *</label>
+                                            <input id="address" name="address" type="text" class="form-control" />
+                                        </div>
                                     </div>
                                 </div>
-                                <div class="col-lg-6">
-                                    <div class="form-group">
-                                        <label>Email *</label>
-                                        <input id="email" name="email" type="text" class="form-control required email">
-                                    </div>
-                                    <div class="form-group">
-                                        <label>Address *</label>
-                                        <input id="address" name="address" type="text" class="form-control">
-                                    </div>
+                            </fieldset>
+                            <h1 id="component-h-2" tabindex="-1" class="title">Warning</h1>
+                            <fieldset id="component-p-2" role="tabpanel" aria-labelledby="component-h-2" class="body" aria-hidden="true"  v-bind:class="{no_display:step!=3}">
+                                <div class="text-center" style="margin-top: 120px;">
+                                    <h2>You did it Man :-)</h2>
                                 </div>
-                            </div>
-                        </fieldset>
-
-                        <h1>Warning</h1>
-                        <fieldset>
-                            <div class="text-center" style="margin-top: 120px">
-                                <h2>You did it Man :-)</h2>
-                            </div>
-                        </fieldset>
-
-                        <h1>Finish</h1>
-                        <fieldset>
-                            <h2>Terms and Conditions</h2>
-                            <input id="acceptTerms" name="acceptTerms" type="checkbox" class="required"> <label for="acceptTerms">I agree with the Terms and Conditions.</label>
-                        </fieldset>
+                            </fieldset>
+                            <h1 id="component-h-3" tabindex="-1" class="title">Finish</h1>
+                            <fieldset id="component-p-3" role="tabpanel" aria-labelledby="component-h-3" class="body" aria-hidden="true"  v-bind:class="{no_display:step!=4}">
+                                <h2>Terms and Conditions</h2>
+                                <input id="acceptTerms" name="acceptTerms" type="checkbox" class="required" aria-required="true" />
+                                <label for="acceptTerms">I agree with the Terms and Conditions.</label>
+                            </fieldset>
+                        </div>
+                        <div class="actions clearfix">
+                            <ul role="menu" aria-label="Pagination">
+                                <li class="disabled" aria-disabled="true"><a v-on:click="previous()" role="menuitem">上一步</a></li>
+                                <li v-bind:class="{no_display:step==4}"><a v-on:click="next()" role="menuitem">下一步</a></li>
+                                <li v-bind:class="{no_display:step!=4}"><a v-on:click="finish()" role="menuitem">提交审核</a></li>
+                            </ul>
+                        </div>
                     </form>
                 </div>
             </div>

+ 63 - 79
WebService/src/main/resources/components/company/company.js

@@ -4,87 +4,71 @@
 **/
 
 (function(vc){
+    vc.extends({
+        data:{
+            storeTypes:[],
+            step:1,
+            companyInfo:{
+                tel:""
+            }
+        },
+         _initMethod:function(){
+             vc.component.initStoreType();
+         },
+         _initEvent:function(){
+//              vc.component.$on('errorInfoEvent',function(_errorInfo){
+//                     vc.component.registerInfo.errorInfo = _errorInfo;
+//                     console.log('errorInfoEvent 事件被监听',_errorInfo)
+//                 });
 
+         },
+        watch:{
+            'companyInfo':{
+                deep: true,
+                handler:function(){
+                    console.log('通知号码信息',vc.component.companyInfo.tel);
+                    vc.component.$emit('validate_tel_change_event',vc.component.companyInfo);
+                }
+            }
+        },
+        methods:{
+            initStoreType:function(){
+                var param = {
+                                    params:{
+                                        msg:"123"
+                                    }
 
-})(window.vc);
-
-(function(){
-    $(document).ready(function(){
-                $("#wizard").steps();
-                $("#form").steps({
-                    bodyTag: "fieldset",
-                    onStepChanging: function (event, currentIndex, newIndex)
-                    {
-                        // Always allow going backward even if the current step contains invalid fields!
-                        if (currentIndex > newIndex)
-                        {
-                            return true;
-                        }
-
-                        // Forbid suppressing "Warning" step if the user is to young
-                        if (newIndex === 3 && Number($("#age").val()) < 18)
-                        {
-                            return false;
-                        }
-
-                        var form = $(this);
-
-                        // Clean up if user went backward before
-                        if (currentIndex < newIndex)
-                        {
-                            // To remove error styles
-                            $(".body:eq(" + newIndex + ") label.error", form).remove();
-                            $(".body:eq(" + newIndex + ") .error", form).removeClass("error");
-                        }
-
-                        // Disable validation on fields that are disabled or hidden.
-                        form.validate().settings.ignore = ":disabled,:hidden";
-
-                        // Start validation; Prevent going forward if false
-                        return form.valid();
-                    },
-                    onStepChanged: function (event, currentIndex, priorIndex)
-                    {
-                        // Suppress (skip) "Warning" step if the user is old enough.
-                        if (currentIndex === 2 && Number($("#age").val()) >= 18)
-                        {
-                            $(this).steps("next");
-                        }
-
-                        // Suppress (skip) "Warning" step if the user is old enough and wants to the previous step.
-                        if (currentIndex === 2 && priorIndex === 3)
-                        {
-                            $(this).steps("previous");
-                        }
-                    },
-                    onFinishing: function (event, currentIndex)
-                    {
-                        var form = $(this);
+                               }
+                vc.http.get('company','getStoreType',
+                             JSON.stringify(param),
+                             function(json,res){
+                                if(res.status == 200){
+                                    vc.component.storeTypes = JSON.parse(json);
+                                    return ;
+                                }
+                                //vc.component.$emit('errorInfoEvent',json);
+                             },function(errInfo,error){
+                                console.log('请求失败处理',errInfo,error);
+                                vc.component.$emit('errorInfoEvent',errInfo);
+                             });
+            },
+            next:function(){
+                if(vc.component.step<4){
+                    vc.component.step = vc.component.step+1;
+                }
+            },
+            previous:function(){
+                if(vc.component.step>1){
+                    vc.component.step = vc.component.step-1;;
+                }
+            },
+            finish:function(){
+                //这里写提交代码
+                console.log("提交审核");
+            }
+        }
 
-                        // Disable validation on fields that are disabled.
-                        // At this point it's recommended to do an overall check (mean ignoring only disabled fields)
-                        form.validate().settings.ignore = ":disabled";
+    });
 
-                        // Start validation; Prevent form submission if false
-                        return form.valid();
-                    },
-                    onFinished: function (event, currentIndex)
-                    {
-                        var form = $(this);
+})(window.vc);
 
-                        // Submit form input
-                        form.submit();
-                    }
-                }).validate({
-                            errorPlacement: function (error, element)
-                            {
-                                element.before(error);
-                            },
-                            rules: {
-                                confirm: {
-                                    equalTo: "#password"
-                                }
-                            }
-                        });
-           });
-})();

+ 3 - 0
WebService/src/main/resources/static/css/common.css

@@ -3,4 +3,7 @@
 }
 .no_margin{
     margin:0px 0px
+}
+.no_display{
+    display:none
 }

+ 4 - 0
WebService/src/main/resources/static/css/plugins/steps/jquery.steps.css

@@ -377,4 +377,8 @@
 .tabcontrol > .content > .body ul > li
 {
     display: list-item;
+}
+
+.wizard > .actions > ul > li.no_display{
+    display:none
 }

+ 2 - 3
WebService/src/main/resources/views/init_company.html

@@ -13,19 +13,18 @@
 
     <vc:create name="commonTop"></vc:create>
     <link href="/css/plugins/steps/jquery.steps.css" rel="stylesheet"/>
-    <script src="/js/plugins/validate/jquery.validate.min.js"></script>
+
 
 </head>
 
 <body class="gray-bg">
-<div id="component" >
+<div >
     <vc:create name="company"></vc:create>
 
 </div>
 
 
 <vc:create name="commonBottom"></vc:create>
-<script src="/js/plugins/steps/jquery.steps.min.js"></script>
 </body>
 
 </html>

+ 10 - 1
java110-service/src/main/java/com/java110/service/configuration/ServiceConfiguration.java

@@ -12,10 +12,19 @@ import org.springframework.context.annotation.Configuration;
 public class ServiceConfiguration {
     @Bean
     public FilterRegistrationBean jwtFilter() {
+        StringBuffer exclusions = new StringBuffer();
+        exclusions.append("/callComponent/login/*,");
+        exclusions.append("/callComponent/register/*,");
+        exclusions.append("/callComponent/validate-code/*,");
+        exclusions.append("/callComponent/validate-tel/*,");
+        exclusions.append("/flow/login,");
+        exclusions.append("/flow/register");
         final FilterRegistrationBean registrationBean = new FilterRegistrationBean();
         registrationBean.setFilter(new JwtFilter());
         registrationBean.addUrlPatterns("/");
-        registrationBean.addUrlPatterns("/console/*");
+        registrationBean.addUrlPatterns("/callComponent/*");
+        registrationBean.addUrlPatterns("/flow/*");
+        registrationBean.addInitParameter("excludedUri",exclusions.toString());
 
         return registrationBean;
     }

+ 34 - 5
java110-service/src/main/java/com/java110/service/filter/JwtFilter.java

@@ -10,10 +10,7 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.web.filter.GenericFilterBean;
 
-import javax.servlet.FilterChain;
-import javax.servlet.ServletException;
-import javax.servlet.ServletRequest;
-import javax.servlet.ServletResponse;
+import javax.servlet.*;
 import javax.servlet.http.Cookie;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
@@ -24,16 +21,34 @@ import java.util.Map;
 /**
  * Created by wuxw on 2018/5/2.
  */
-public class JwtFilter extends GenericFilterBean {
+public class JwtFilter implements Filter {
 
     private final static Logger logger = LoggerFactory.getLogger(JwtFilter.class);
 
+    private  String[] excludedUris;
+
+    @Override
+    public void destroy() {
+        // TODO Auto-generated method stub
+    }
+
+
+    @Override
+    public void init(FilterConfig filterConfig) throws ServletException {
+        excludedUris = filterConfig.getInitParameter("excludedUri").split(",");
+    }
 
     public void doFilter(final ServletRequest req, final ServletResponse res, final FilterChain chain)
             throws IOException, ServletException {
 
         final HttpServletRequest request = (HttpServletRequest) req;
         final HttpServletResponse response = (HttpServletResponse) res;
+        String uri = request.getServletPath();
+        //如果是 不能过滤的地址选择跳过
+        if(isExcludedUri(uri)){
+            chain.doFilter(request, response);
+            return ;
+        }
         String token = "";
         try {
             //获取token
@@ -97,4 +112,18 @@ public class JwtFilter extends GenericFilterBean {
         }
     }
 
+    private boolean isExcludedUri(String uri) {
+        if (excludedUris == null || excludedUris.length <= 0) {
+            return false;
+        }
+        for (String ex : excludedUris) {
+            uri = uri.trim();
+            ex = ex.trim();
+            if (uri.toLowerCase().matches(ex.toLowerCase().replace("*",".*")))
+                return true;
+        }
+        return false;
+    }
+
+
 }