Преглед на файлове

加入统一消息提示功能 请用 vc.messege('错误内容')

wuxw преди 7 години
родител
ревизия
0894b9328a

+ 2 - 0
Api/src/main/java/com/java110/api/listener/floor/QueryFloorsListener.java

@@ -69,6 +69,8 @@ public class QueryFloorsListener extends AbstractServiceApiDataFlowListener {
             apiFloorVo.setApiFloorDataVoList(BeanConvertUtil.covertBeanList(floorDtoList, ApiFloorDataVo.class));
         }
 
+        apiFloorVo.setRecords(total / row + 1);
+
         ResponseEntity<String> responseEntity = new ResponseEntity<String>(JSONObject.toJSONString(apiFloorVo), HttpStatus.OK);
         dataFlowContext.setResponseEntity(responseEntity);
     }

+ 2 - 0
WebService/src/main/resources/components/body-top/bodyTop.html

@@ -0,0 +1,2 @@
+<vc:create name="loading"></vc:create>
+<vc:create name="message"></vc:create>

+ 2 - 1
WebService/src/main/resources/components/floor/listFloor.html

@@ -61,7 +61,8 @@
                         </tr>
                         </tfoot>
                     </table>
-
+                    <!-- 分页 -->
+                    <vc:create name="pagination"></vc:create>
                 </div>
             </div>
         </div>

+ 15 - 5
WebService/src/main/resources/components/floor/listFloor.js

@@ -6,23 +6,27 @@
             listFloorInfo:{
                 floors:[],
                 total:0,
+                records:1,
                 errorInfo:""
             }
         },
         _initMethod:function(){
-            vc.component._listFloorData();
+            vc.component._listFloorData(DEFAULT_PAGE,DEFAULT_ROWS);
         },
         _initEvent:function(){
             vc.on('listFloor','listFloorData',function(){
-                vc.component._listFloorData();
+                vc.component._listFloorData(DEFAULT_PAGE,DEFAULT_ROWS);
+            });
+            vc.on('pagination','page_event',function(_currentPage){
+                vc.component._listFloorData(_currentPage,DEFAULT_ROWS);
             });
         },
         methods:{
-            _listFloorData:function(){
+            _listFloorData:function(_page,_rows){
                 var param = {
                     params:{
-                        page:DEFAULT_PAGE,
-                        rows:DEFAULT_ROWS,
+                        page:_page,
+                        rows:_rows,
                         communityId:vc.getCurrentCommunity().communityId
                     }
                 }
@@ -35,7 +39,13 @@
                                 var listFloorData =JSON.parse(json);
 
                                 vc.component.listFloorInfo.total = listFloorData.total;
+                                vc.component.listFloorInfo.records = listFloorData.records;
                                 vc.component.listFloorInfo.floors = listFloorData.apiFloorDataVoList;
+
+                                vc.emit('pagination','init',{
+                                    total:vc.component.listFloorInfo.records,
+                                    currentPage:_page
+                                });
                              },function(errInfo,error){
                                 console.log('请求失败处理');
                              }

+ 11 - 0
WebService/src/main/resources/components/message/message.html

@@ -0,0 +1,11 @@
+<div id="message" style="width: 100%;z-index: 2300;position: absolute;" v-bind:class="{no_display:messageInfo.hide}" >
+    <!--<div class="spinner-border text-success" role="status">
+        <span class="sr-only">Loading...</span>
+    </div>-->
+    <div  style="width: 300px; margin: 30px auto; text-align: center;">
+        <div class="alert alert-info" role="alert" style="display: inline-block;width: auto; height: auto;color:red;padding: 0.5em 10px;">
+            <i class="glyphicon glyphicon-warning-sign"></i>
+            <span style="margin-left:10px">{{messageInfo.errorInfo}}</span>
+        </div>
+    </div>
+</div>

+ 41 - 0
WebService/src/main/resources/components/message/message.js

@@ -0,0 +1,41 @@
+(function(vc){
+
+    var vm = new Vue({
+        el:'#message',
+        data:{
+            messageInfo:{
+                hide:true,
+                errorInfo:'网络超时,请检查网络!'
+            }
+        },
+        mounted:function(){
+
+        },
+        methods:{
+            //验证码定时
+            messageTimer:function(){
+                  var num = 10;
+                var _timer = vc.createTimer(function(){
+                    num --;
+                    if(num === 1){
+                        vc.clearTimer(_timer);
+                        vm.messageInfo.hide=true;
+                    }
+                },1000);
+            }
+        }
+    });
+
+    vm.$on('message_openMessage',function(_msg){
+        console.log("开始加载");
+        vm.messageInfo.hide = false;
+        vm.messageInfo.errorInfo = _msg.msg;
+    });
+    /**
+        加载遮罩层
+    **/
+    vc.message = function(_msg){
+       vm.$emit('message_openMessage',{msg:_msg});
+       vm.messageTimer();
+    }
+})(window.vc)

+ 5 - 0
WebService/src/main/resources/components/pagination/pagination.js

@@ -14,6 +14,11 @@
                     vc.component.paginationInfo.total = _paginationInfo.total;
                     vc.component.paginationInfo.currentPage = _paginationInfo.currentPage;
                 });
+
+             vc.on('pagination','init',function(_paginationInfo){
+                 vc.component.paginationInfo.total = _paginationInfo.total;
+                 vc.component.paginationInfo.currentPage = _paginationInfo.currentPage;
+             });
         },
         methods:{
             previous:function(){

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

@@ -27,7 +27,6 @@
     width: 100%;
     height: 100%;
     z-index: 2300;
-
     position: absolute;
 }
 .java110_loading>div{

+ 1 - 1
WebService/src/main/resources/views/floorFlow.html

@@ -9,7 +9,7 @@
     <vc:create name="commonTop"></vc:create>
 </head>
 <body>
-<vc:create name="loading"></vc:create>
+<vc:create name="bodyTop"></vc:create>
 <div id="wrapper">
     <vc:create name="menu"></vc:create>
 

+ 11 - 0
java110-bean/src/main/java/com/java110/vo/MorePageVo.java

@@ -18,6 +18,9 @@ public class MorePageVo extends Vo implements Serializable {
     // 行数
     private int rows;
 
+    //页数
+    private int records;
+
     // 总记录数
     private int total;
 
@@ -45,4 +48,12 @@ public class MorePageVo extends Vo implements Serializable {
     public void setTotal(int total) {
         this.total = total;
     }
+
+    public int getRecords() {
+        return records;
+    }
+
+    public void setRecords(int records) {
+        this.records = records;
+    }
 }