graceNvuePage.vue 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  1. <template>
  2. <view class="gui-sbody" :style="{flex:flexVal}">
  3. <!-- 占位 view -->
  4. <view :style="{width:'750rpx', height:(headerHeight+statusBarHeight)+ 'px'}" v-if="customHeader"></view>
  5. <!-- 页面主体 -->
  6. <view class="gui-page-body" :style="{flex:flexVal}"><slot name="gBody"></slot></view>
  7. <!-- 头部导航 -->
  8. <view v-if="customHeader">
  9. <view class="gui-page-header"
  10. :style="{backgroundColor:headerBG, borderBottomWidth:borderWidth, borderBottomColor:borderColor}">
  11. <!-- 沉浸式状态栏 -->
  12. <view class="gui-page-status-bar" :style="{height:statusBarHeight+'px', backgroundColor:statusBarBG}"></view>
  13. <!-- 头部核心 -->
  14. <view class="gui-page-header-nav" ref="gracePageHeader">
  15. <view class="gui-header-main gui-flex-auto">
  16. <slot name="gHeader"></slot>
  17. </view>
  18. </view>
  19. </view>
  20. </view>
  21. <!-- 页面底部 -->
  22. <view class="gui-page-footer" :style="{backgroundColor:footerBg}">
  23. <slot name="gFooter"></slot>
  24. </view>
  25. <!-- 右下角悬浮按钮 -->
  26. <view class="gui-page-rb-area" :style="{right:rbRight+'rpx', bottom:rbBottom+'rpx', width:rbWidth+'rpx'}"><slot name="gRTArea"></slot></view>
  27. <!-- 全屏 loading -->
  28. <view class="grace-page-loading" @tap.stop="" @touchmove.stop.prevent="" :style="{backgroundColor:loadingBG}" v-if="isLoading">
  29. <view class="grace-page-loading-point">
  30. <view class="grace-page-loading-points" ref="loadingPoints1" :style="{background:loadingPointBg}"></view>
  31. <view class="grace-page-loading-points" ref="loadingPoints2" :style="{background:loadingPointBg}"></view>
  32. <view class="grace-page-loading-points" ref="loadingPoints3" :style="{background:loadingPointBg}"></view>
  33. </view>
  34. </view>
  35. </view>
  36. </template>
  37. <script>
  38. var animation = weex.requireModule('animation');
  39. const dom = weex.requireModule('dom');
  40. export default{
  41. props:{
  42. customHeader : { type : Boolean, default : true },
  43. headerHeight : { type : Number, default : 44 },
  44. headerIndex : { type : Number, default : 999 },
  45. headerBG : { type : String, default : '#FFFFFF'},
  46. statusBarBG : { type : String, default : '#FFFFFF'},
  47. footerIndex : { type : Number, default : 999},
  48. rbWidth : { type : Number, default : 100},
  49. rbBottom : { type : Number, default : 100 },
  50. rbRight : { type : Number, default : 20 },
  51. footerBg : { type : String, default : '' },
  52. flexVal : { type : String, default : ''},
  53. borderWidth : { type : String, default : '0' },
  54. borderColor : { type : String, default : '#D1D1D1' },
  55. loadingBG : { type : String, default : 'rgba(255,255,255, 0.1)'},
  56. isLoading : { type : Boolean, default : false },
  57. loadingPointBg : {type : String, default : '#3688FF'}
  58. },
  59. data() {
  60. return {
  61. statusBarHeight : 44,
  62. iphoneXButtomHeight:0,
  63. BoundingWidth : '0px',
  64. animateCount : 0
  65. }
  66. },
  67. watch:{
  68. isLoading:function(val){
  69. this.animateCount = 0;
  70. if(val){ setTimeout(() => { this.ldAnimation(); }, 800);}
  71. }
  72. },
  73. methods:{
  74. ldAnimation : function(){
  75. if(!this.isLoading){return ;}
  76. this.animateCount++;
  77. var animations1 = this.$refs.loadingPoints1;
  78. var animations2 = this.$refs.loadingPoints2;
  79. var animations3 = this.$refs.loadingPoints3;
  80. animation.transition(animations1, {
  81. styles: { opacity:0.3, transform: 'scale(1)'},
  82. duration: 500,
  83. timingFunction: 'linear',
  84. needLayout:false,
  85. delay: 0
  86. });
  87. animation.transition(animations2, {
  88. styles: { opacity:0.3, transform: 'scale(1)'},
  89. duration: 500,
  90. timingFunction: 'linear',
  91. needLayout:false,
  92. delay: 100
  93. });
  94. animation.transition(animations3, {
  95. styles: { opacity:0.3, transform: 'scale(1)'},
  96. duration: 500,
  97. timingFunction: 'linear',
  98. needLayout:false,
  99. delay: 200
  100. },() => {this.ldAnimation2();});
  101. },
  102. ldAnimation2 : function(){
  103. if(!this.isLoading){return ;}
  104. var animations1 = this.$refs.loadingPoints1;
  105. var animations2 = this.$refs.loadingPoints2;
  106. var animations3 = this.$refs.loadingPoints3;
  107. animation.transition(animations1, {
  108. styles: { opacity:1, transform: 'scale(1.3)'},
  109. duration: 500,
  110. timingFunction: 'linear',
  111. needLayout:false,
  112. delay: 0
  113. });
  114. animation.transition(animations2, {
  115. styles: { opacity:1, transform: 'scale(1.3)'},
  116. duration: 500,
  117. timingFunction: 'linear',
  118. needLayout:false,
  119. delay: 100
  120. });
  121. animation.transition(animations3, {
  122. styles: { opacity:1, transform: 'scale(1.3)'},
  123. duration: 500,
  124. timingFunction: 'linear',
  125. needLayout:false,
  126. delay: 200
  127. },() => {this.ldAnimation();});
  128. },
  129. getHeaderHeight:function(){
  130. return this.headerHeight + this.statusBarHeight;
  131. }
  132. },
  133. created:function(){
  134. if(this.isLoading){this.ldAnimation();}
  135. try {
  136. var system = uni.getSystemInfoSync();
  137. this.statusBarHeight = system.statusBarHeight;
  138. } catch (e){
  139. return null;
  140. }
  141. }
  142. }
  143. </script>
  144. <style scoped>
  145. .gui-sbody{width:750rpx;}
  146. .gui-page-header{width:750rpx; left:0; top:0; border-style:solid; position: fixed;}
  147. .gui-page-status-bar{width:750rpx; height:0;}
  148. .gui-page-header-nav{width:750rpx; flex-direction:row; flex-wrap:nowrap;}
  149. .gui-header-main{width:750rpx;}
  150. .gui-page-body{width:750rpx;}
  151. .gui-page-footer{width:750rpx; position:fixed; left:0; bottom:0; }
  152. .gui-page-rb-area{width:100rpx; position:fixed; right:20rpx; bottom:100rpx;}
  153. .grace-pf{position:fixed;}
  154. .grace-page-loading{width:750rpx; position:fixed; left:0; top:0; bottom:0; flex:1; flex-direction:column; justify-content:center; align-items:center;}
  155. .grace-page-loading-point{flex-direction:row; flex-wrap:nowrap; justify-content:center;}
  156. .grace-page-loading-points{width:20rpx; height:20rpx; background-color:#3688FF; border-radius:50rpx; margin:10rpx; opacity:0.5;}
  157. </style>