gxd-uni-library-editx 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (215) hide show
  1. package/.editorconfig +14 -0
  2. package/README.md +447 -0
  3. package/index.js +3 -0
  4. package/package.json +104 -0
  5. package/postcss.config.js +22 -0
  6. package/settings.js.tpl +68 -0
  7. package/src/XdAppClass.1.0.js +257 -0
  8. package/src/XdAppClass.js +150 -0
  9. package/src/components/XdAddress/XdAddress.vue +579 -0
  10. package/src/components/XdAddressSelect/XdAddressSelect.vue +243 -0
  11. package/src/components/XdBaiduMap/XdBaiduMap.vue +204 -0
  12. package/src/components/XdBaiduOverlay/XdBaiduOverlay.vue +345 -0
  13. package/src/components/XdBaiduSearch/XdBaiduSearch.vue +354 -0
  14. package/src/components/XdBar/XdBar.vue +339 -0
  15. package/src/components/XdButton/XdButton.vue +288 -0
  16. package/src/components/XdCartList/XdCartList.vue +791 -0
  17. package/src/components/XdCartNoStoreList/XdCartNoStoreList.vue +747 -0
  18. package/src/components/XdCity/XdCity.vue +620 -0
  19. package/src/components/XdCity/city.js +93 -0
  20. package/src/components/XdCity/testData.js +124 -0
  21. package/src/components/XdCityLocation/XdCityLocation.vue +314 -0
  22. package/src/components/XdCityLocation/jweixin.js +72 -0
  23. package/src/components/XdCityShow/XdCityShow.vue +354 -0
  24. package/src/components/XdClipImage/XdClipImage.vue +879 -0
  25. package/src/components/XdCoins/XdCoins.vue +66 -0
  26. package/src/components/XdConfirm/XdConfirm.vue +240 -0
  27. package/src/components/XdContentXss/XdContentXss.vue +71 -0
  28. package/src/components/XdDailog/XdDailog.vue +258 -0
  29. package/src/components/XdDate/XdDataItemOne.vue +236 -0
  30. package/src/components/XdDate/XdDate.vue +1081 -0
  31. package/src/components/XdDate/XdDateItem.vue +316 -0
  32. package/src/components/XdDate/XdDateTime.vue +929 -0
  33. package/src/components/XdDate/i18n/en.json +19 -0
  34. package/src/components/XdDate/i18n/index.js +8 -0
  35. package/src/components/XdDate/i18n/zh-Hans.json +19 -0
  36. package/src/components/XdDate/i18n/zh-Hant.json +19 -0
  37. package/src/components/XdDate/keypress.js +45 -0
  38. package/src/components/XdDate/util.js +418 -0
  39. package/src/components/XdDownDrawer/XdDownDrawer.vue +176 -0
  40. package/src/components/XdEditPwd/XdEditPwd.vue +305 -0
  41. package/src/components/XdEnterOrderList/XdEnterOrderList.vue +413 -0
  42. package/src/components/XdExpressTimeLine/XdExpressTimeLine.vue +280 -0
  43. package/src/components/XdFilter/XdFilter.vue +541 -0
  44. package/src/components/XdFontIcon/XdFontIcon.vue +165 -0
  45. package/src/components/XdFontIcon/css/icon.less +498 -0
  46. package/src/components/XdFooterBar/XdFooterBar.vue +291 -0
  47. package/src/components/XdFooterTabbar/XdFooterTabbar.vue +284 -0
  48. package/src/components/XdForm/XdForm.vue +481 -0
  49. package/src/components/XdForm/validate.js +486 -0
  50. package/src/components/XdFormCheckbox/XdFormCheckbox.vue +858 -0
  51. package/src/components/XdFormDate.vue +187 -0
  52. package/src/components/XdFormInput/XdFormInput.vue +535 -0
  53. package/src/components/XdFormInput/common.js +56 -0
  54. package/src/components/XdFormItem/XdFormItem.vue +583 -0
  55. package/src/components/XdFormSelect/XdFormSelect.vue +119 -0
  56. package/src/components/XdImage/XdImage.vue +113 -0
  57. package/src/components/XdItemCardUser/XdItemCardUser.vue +232 -0
  58. package/src/components/XdItemFilmImage/XdItemFilmImage.vue +146 -0
  59. package/src/components/XdItemFilmText/XdItemFilmText.vue +83 -0
  60. package/src/components/XdItemPhysical/XdItemPhysical.vue +410 -0
  61. package/src/components/XdItemPhysicalPack/XdItemPhysicalPack.vue +240 -0
  62. package/src/components/XdItemStore/XdItemStore.vue +236 -0
  63. package/src/components/XdItemUserInfo/XdItemUserInfo.vue +175 -0
  64. package/src/components/XdJson/XdJson.vue +398 -0
  65. package/src/components/XdKeyValue/XdKeyValue.vue +150 -0
  66. package/src/components/XdLabelNew/XdLabelNew.vue +193 -0
  67. package/src/components/XdLayout/XdLayout.vue +634 -0
  68. package/src/components/XdLoading/XdLoading.vue +165 -0
  69. package/src/components/XdMore/XdMore.vue +66 -0
  70. package/src/components/XdMpHtml/XdMpHtml.vue +458 -0
  71. package/src/components/XdMpHtml/node/node.vue +536 -0
  72. package/src/components/XdMpHtml/parser.js +1260 -0
  73. package/src/components/XdMpHtml/static/js/handler.js +1 -0
  74. package/src/components/XdMpHtml/static/js/uni.webview.min.js +1 -0
  75. package/src/components/XdMpHtml/static/local.html +1 -0
  76. package/src/components/XdMy/XdMy.vue +294 -0
  77. package/src/components/XdMySuccess/XdMySuccess.vue +603 -0
  78. package/src/components/XdNavTab/XdNavTab.vue +147 -0
  79. package/src/components/XdNoData/XdNoData.vue +87 -0
  80. package/src/components/XdNoticeBar/XdNoticeBar.vue +501 -0
  81. package/src/components/XdNumber/XdNumber.vue +210 -0
  82. package/src/components/XdNumberUni/XdNumberUni.vue +270 -0
  83. package/src/components/XdNumberUni/readme.md +42 -0
  84. package/src/components/XdOnlineConfirm/XdOnlineConfirm.vue +385 -0
  85. package/src/components/XdOnlineDetail/XdOnlineDetail.vue +332 -0
  86. package/src/components/XdOnlinePay/XdOnlinePay.vue +349 -0
  87. package/src/components/XdOnlineSchedule/XdOnlineSchedule.vue +453 -0
  88. package/src/components/XdOnlineSeat/XdOnlineSeat.vue +796 -0
  89. package/src/components/XdOnlineSeatMove/XdOnlineSeatMove.vue +1012 -0
  90. package/src/components/XdPayCombo/XdPayCombo.vue +118 -0
  91. package/src/components/XdPreviewImage/XdPreviewImage.vue +372 -0
  92. package/src/components/XdPwPay/XdPwPay.vue +214 -0
  93. package/src/components/XdRadio/XdRadio.vue +151 -0
  94. package/src/components/XdRangeSlider/XdRangeSlider.vue +355 -0
  95. package/src/components/XdRedName/XdRedName.vue +35 -0
  96. package/src/components/XdSearchBar/XdSearchBar.vue +286 -0
  97. package/src/components/XdSelect/XdSelect.vue +382 -0
  98. package/src/components/XdSelectCity/XdSelectCity.vue +270 -0
  99. package/src/components/XdSelectTime/XdSelectTime.vue +342 -0
  100. package/src/components/XdStar/XdStar.vue +261 -0
  101. package/src/components/XdStoreCashier/XdStoreCashier.vue +526 -0
  102. package/src/components/XdStoreItem/XdStoreItem.vue +400 -0
  103. package/src/components/XdStoreOrderDetail/XdStoreOrderDetail.vue +1571 -0
  104. package/src/components/XdStoreOrderList/XdStoreOrderList.vue +450 -0
  105. package/src/components/XdStoreProductInfo/XdStoreProductInfo.vue +940 -0
  106. package/src/components/XdStoreProductType/XdStoreProductType.vue +307 -0
  107. package/src/components/XdSuccess/XdSuccess.vue +527 -0
  108. package/src/components/XdSwipeSelect/XdSwipeSelect.vue +99 -0
  109. package/src/components/XdSwiper/XdSwiper.vue +124 -0
  110. package/src/components/XdSwitch/XdSwitch.vue +204 -0
  111. package/src/components/XdTab/XdTab.vue +220 -0
  112. package/src/components/XdTabScroll/XdTabScroll.vue +212 -0
  113. package/src/components/XdTag/XdTag.vue +423 -0
  114. package/src/components/XdTimeLine/XdTimeLine.vue +121 -0
  115. package/src/components/XdTips/XdTips.vue +212 -0
  116. package/src/components/XdTipsBlock/XdTipsBlock.vue +141 -0
  117. package/src/components/XdTitleSection/XdTitleSection.vue +152 -0
  118. package/src/components/XdTitleTab/XdTitleTab.vue +227 -0
  119. package/src/components/XdUnit/XdUnit.vue +206 -0
  120. package/src/components/XdUpload/XdUpload.vue +197 -0
  121. package/src/components/XdUploadImage/XdUploadImage.vue +145 -0
  122. package/src/components/Xdlogs/XdLogs.vue +144 -0
  123. package/src/components/autoload.js +211 -0
  124. package/src/components/swipeAction/UniSwipeAction.vue +43 -0
  125. package/src/components/swipeActionItem/UniSwipeActionItem.vue +386 -0
  126. package/src/components/swipeActionItem/bindingx.js +298 -0
  127. package/src/components/swipeActionItem/index.wxs +321 -0
  128. package/src/components/swipeActionItem/isPC.js +18 -0
  129. package/src/components/swipeActionItem/mpalipay.js +210 -0
  130. package/src/components/swipeActionItem/mpother.js +252 -0
  131. package/src/components/swipeActionItem/mpwxs.js +140 -0
  132. package/src/dome/dome/address.vue +415 -0
  133. package/src/dome/dome/auth/login.vue +166 -0
  134. package/src/dome/dome/baidu_show.vue +20 -0
  135. package/src/dome/dome/cake.vue +186 -0
  136. package/src/dome/dome/cart.vue +205 -0
  137. package/src/dome/dome/cart_store.vue +149 -0
  138. package/src/dome/dome/cashier/cashier.vue +73 -0
  139. package/src/dome/dome/cashier/check_cashier.vue +469 -0
  140. package/src/dome/dome/cashier/success.vue +127 -0
  141. package/src/dome/dome/city.vue +148 -0
  142. package/src/dome/dome/cityData.js +9 -0
  143. package/src/dome/dome/clip.vue +82 -0
  144. package/src/dome/dome/date/date.vue +273 -0
  145. package/src/dome/dome/date/selected.js +315 -0
  146. package/src/dome/dome/dcom/app1.vue +13 -0
  147. package/src/dome/dome/dcom/app2.vue +13 -0
  148. package/src/dome/dome/dcom/app3.vue +13 -0
  149. package/src/dome/dome/dcom/app4.vue +13 -0
  150. package/src/dome/dome/dcom/app5.vue +13 -0
  151. package/src/dome/dome/dcom/index.vue +1 -0
  152. package/src/dome/dome/debug/debug.vue +95 -0
  153. package/src/dome/dome/docache/docache.vue +88 -0
  154. package/src/dome/dome/express.vue +269 -0
  155. package/src/dome/dome/form.vue +312 -0
  156. package/src/dome/dome/icon.js +125 -0
  157. package/src/dome/dome/icon.vue +93 -0
  158. package/src/dome/dome/index.vue +725 -0
  159. package/src/dome/dome/item.vue +236 -0
  160. package/src/dome/dome/json/json.vue +88 -0
  161. package/src/dome/dome/layout.vue +105 -0
  162. package/src/dome/dome/line.vue +113 -0
  163. package/src/dome/dome/map/search.vue +70 -0
  164. package/src/dome/dome/my.vue +171 -0
  165. package/src/dome/dome/notice.vue +93 -0
  166. package/src/dome/dome/online/confirm.vue +92 -0
  167. package/src/dome/dome/online/detail.vue +80 -0
  168. package/src/dome/dome/online/pay.vue +78 -0
  169. package/src/dome/dome/online/schedule.vue +73 -0
  170. package/src/dome/dome/online/seat.vue +98 -0
  171. package/src/dome/dome/order/detail.vue +166 -0
  172. package/src/dome/dome/order/enter_order.vue +294 -0
  173. package/src/dome/dome/order/list.vue +219 -0
  174. package/src/dome/dome/order/order.js +18 -0
  175. package/src/dome/dome/order/success.vue +68 -0
  176. package/src/dome/dome/product.vue +179 -0
  177. package/src/dome/dome/store_cashier.vue +67 -0
  178. package/src/dome/dome/swiper.vue +32 -0
  179. package/src/dome/dome/webview.vue +61 -0
  180. package/src/install.js +183 -0
  181. package/src/main/address/address.vue +251 -0
  182. package/src/main/cart/cart.vue +149 -0
  183. package/src/main/cashier/cashier.vue +72 -0
  184. package/src/main/cashier/check_cashier.vue +483 -0
  185. package/src/main/city/city.vue +149 -0
  186. package/src/main/date/date.vue +260 -0
  187. package/src/main/order/order.js +19 -0
  188. package/src/main/order/order.vue +222 -0
  189. package/src/main/product/detail.vue +121 -0
  190. package/src/main/product/type.vue +108 -0
  191. package/src/main/search/search.vue +501 -0
  192. package/src/pages.json +337 -0
  193. package/src/plugins/CreatedComponentsPlugin.js +19 -0
  194. package/src/plugins/JsonRename.js +72 -0
  195. package/src/plugins/SetAppParams.js +171 -0
  196. package/src/project.js +18 -0
  197. package/src/utils/Cookie.js +68 -0
  198. package/src/utils/Runtime.js +105 -0
  199. package/src/utils/Storage.js +104 -0
  200. package/src/utils/XdNetwork.js +133 -0
  201. package/src/utils/helper.js +1321 -0
  202. package/src/utils/nourl.js +95 -0
  203. package/src/utils/project.js +17 -0
  204. package/src/utils/xd.auth.js +61 -0
  205. package/src/utils/xd.base.js +474 -0
  206. package/src/utils/xd.common.js +240 -0
  207. package/src/utils/xd.event.js +99 -0
  208. package/src/utils/xd.frame.js +96 -0
  209. package/src/utils/xd.path.js +96 -0
  210. package/src/utils/xdAppLog.js +170 -0
  211. package/src/utils/xdWxLog.js +302 -0
  212. package/src/utils/xdh5log.js +307 -0
  213. package/src/websetting.js +64 -0
  214. package/tsconfig.json +9 -0
  215. package/xd.less +180 -0
@@ -0,0 +1,634 @@
1
+ <template>
2
+ <view class="xd-Layout" id="xd-Layout">
3
+
4
+ <view
5
+ v-if="initStatus && tabbarData !== null "
6
+ class="xd-Layout__animation"
7
+ :class="{
8
+ animation: startAnimation,
9
+ nohasanimation: !isAnimation
10
+ }"
11
+ >
12
+ <view class="xd-Layout__top-height"
13
+ :style="{
14
+ height: (topHeight +navBarHeight + statusBarHeight) +'rpx',
15
+ backgroundColor: bgImage ? '' : background,
16
+ backgroundImage: 'url('+ (isUseBgImage ? bgImage: '') +')',
17
+ backgroundPosition: 'top center',
18
+ backgroundSize: '100%',
19
+ backgroundRepeat: 'no-repeat',
20
+
21
+ }"
22
+ ></view>
23
+ <view class="xd-Layout__bar"
24
+ v-if="showBar"
25
+ :style="{
26
+ height: navBarHeight + statusBarHeight + 'rpx'
27
+ }
28
+ ">
29
+ <xd-bar
30
+ :bar-nav-height="navBarHeight"
31
+ :bar-status-height="statusBarHeight"
32
+ :title="title"
33
+ :show-back="showBack"
34
+ :color="barTextColor"
35
+ :bg-color="barBgColor"
36
+ :bg-image="bgImage"
37
+ :is-slot-top-bar="isSlotTopBar"
38
+ :text-align="barTextAlign || tabbarData.barTextAlign "
39
+ @back="backEvent"
40
+ >
41
+ <slot name="topBar" v-if="isSlotTopBar"></slot>
42
+ </xd-bar>
43
+ </view>
44
+ <!--top-->
45
+ <view class="xd-Layout__top animation-top"
46
+ v-show="contentStatus"
47
+ :style="{
48
+ height: topHeight + 'rpx',
49
+ top: (navBarHeight + statusBarHeight) + 'rpx',
50
+ zIndex: (view ? 1490: 1001)
51
+ }"
52
+
53
+ >
54
+ <slot name="top"></slot>
55
+ </view>
56
+ <!--top-->
57
+ <!--body-->
58
+
59
+ <view
60
+ class="xd-Layout__body animation-body"
61
+ ref="xd-Layout__body"
62
+ :style="{
63
+ minHeight: getMinHeight,
64
+ backgroundColor: bgImage ? '' : background,
65
+ backgroundImage: 'url('+ (isUseBgImage ? bgImage: '') +')',
66
+ backgroundPosition: isUseBgImage ?
67
+ ('center -'+ (topHeight + navBarHeight + statusBarHeight) +'rpx'): 'center top',
68
+ zIndex: (view ? 1500: 999)
69
+ }"
70
+ >
71
+ <view v-show="contentStatus">
72
+ <slot></slot>
73
+ </view>
74
+ </view>
75
+ <!--body-->
76
+ <!--bottom-->
77
+ <view class="xd-Layout__bottom animation-bottom"
78
+ v-if="bottomHeight"
79
+ v-show="contentStatus"
80
+ :style="{
81
+ height: bottomHeight + 'rpx',
82
+ bottom: getBottom + 'rpx',
83
+ background: background,
84
+ zIndex: (view ? 1600: 1000)
85
+ }"
86
+ >
87
+ <slot name="footer"></slot>
88
+ </view>
89
+ <!--bottom-->
90
+ <!--tabbar-->
91
+ <view class="xd-Layout__tabbar"
92
+ v-if="showFooter && tabbarData !== null"
93
+ :style="{
94
+ height: footerHeight + 'rpx',
95
+ background: tabbarBackground,
96
+ zIndex: (view ? 1601: 1001)
97
+ }"
98
+ >
99
+ <slot name="footerBar"></slot>
100
+ </view>
101
+ <!--tabbar-->
102
+ <view class="xd-Layout__footer-height" :style="{height: (bottomHeight + footerHeight) + 'rpx' }"></view>
103
+ </view>
104
+ <xd-logs v-if="isLogs" :logs="uiLogs" :error-logs="uiErrorLogs"></xd-logs>
105
+ <xd-confirm></xd-confirm>
106
+ <xd-loading></xd-loading>
107
+ <xd-tips></xd-tips>
108
+ <view class="xd-Layout__padding" id="xd-Layout__padding"></view>
109
+ </view>
110
+ </template>
111
+
112
+ <script>
113
+ import XdBar from "@/components/XdBar/XdBar";
114
+ import XdFooterTabbar from "@/components/XdFooterTabbar/XdFooterTabbar";
115
+ import XdFontIcon from "@/components/XdFontIcon/XdFontIcon";
116
+ import XdConfirm from "@/components/XdConfirm/XdConfirm";
117
+ import XdLoading from "@/components/XdLoading/XdLoading";
118
+ import XdTips from "@/components/XdTips/XdTips";
119
+ import XdLogs from "@/components/Xdlogs/XdLogs";
120
+ import {mapState} from 'vuex';
121
+
122
+
123
+ /**
124
+ * XdLayout 全局Ui
125
+ * @description Layout
126
+ * 内容区域高度:(100vh - barHeight - searchHeight - topHeight - bottomHeight - footerHeight)
127
+ * 内容区域支持普通view和scoll-view标签,使用scoll-view做滚动有性能问题
128
+ * 使用view标签移除onPullUpRefresh,onScroll事件,可以使用页面级onReachBottom和onPageScroll
129
+ * @tutorial
130
+ * @property {Number} topHeight 顶部自定义高度 默认:0
131
+ * @property {Number} bottomHeight 底部自定义高度 默认:0
132
+ * @property {Boolean} showBack 显示返回按钮 默认:true
133
+ * @property {Boolean} showBar 显示bar文字颜色 默认:true
134
+ * @property {String} title 当前页面标题名称 默认不显示标题
135
+ * @property {String} barTextColor bar标题颜色 默认:''
136
+ * @property {String} background bar背景颜色 默认:#fff
137
+ * @property {Boolean} showFooter 是否展示底部tabbar 默认:true
138
+ * @property {Boolean} isAnimation 是否支持动画 默认:true
139
+ * @property {Boolean} isUseBgImage 内容区域是否使用背景图片 默认:false
140
+ *
141
+ * @event {Function} onDone 初始化完成事件 {bottom: 0, top: 0}
142
+ * @event {Function} onBack 点击返回键事件
143
+ *
144
+ * 支持插槽(3个插槽) 默认,top, footer,bar
145
+ */
146
+
147
+ export default {
148
+ name: "XdLayout",
149
+ components: {
150
+ XdTips,
151
+ XdConfirm,
152
+ XdLoading,
153
+ XdFontIcon,
154
+ XdFooterTabbar,
155
+ XdBar,
156
+ XdLogs
157
+ },
158
+ props: {
159
+ topHeight: {
160
+ type: Number,
161
+ default: 0,
162
+ },
163
+
164
+ footerHeight: {
165
+ type: Number,
166
+ default: 0,
167
+ },
168
+
169
+ isSlotTopBar:{
170
+ type: Boolean,
171
+ default: false
172
+ },
173
+
174
+
175
+ bottomHeight: {
176
+ type: Number,
177
+ default: 0,
178
+ },
179
+
180
+ showBack: {
181
+ type: Boolean,
182
+ default: true
183
+ },
184
+
185
+ showBar: {
186
+ type: Boolean,
187
+ default: true
188
+ },
189
+
190
+ title: {
191
+ type: String,
192
+ default: '',
193
+ },
194
+
195
+ barTextAlign:{
196
+ type: String,
197
+ default: 'center', //center,left
198
+ },
199
+
200
+ barTextColor: {
201
+ type: String,
202
+ default: '#fff',
203
+ },
204
+
205
+ barBackgroundColotr: {
206
+ type: String,
207
+ default: '',
208
+ },
209
+
210
+ barBackgroundImage: {
211
+ type: String,
212
+ default: '',
213
+ },
214
+
215
+ background:{
216
+ type: String,
217
+ default: '#fff',
218
+ },
219
+
220
+ showFooter: {
221
+ type: Boolean,
222
+ default: true,
223
+ },
224
+
225
+ isAnimation:{
226
+ type: Boolean,
227
+ default: true,
228
+ },
229
+
230
+ isUseBgImage:{
231
+ type: Boolean,
232
+ default: false,
233
+ }
234
+ },
235
+ data() {
236
+ return {
237
+ startTime: new Date().getTime(),
238
+ startAnimation : false, //开始动画效果
239
+ doneAnimation: false, //完成动画效果
240
+ defaultImage: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyhpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNi1jMTQ1IDc5LjE2MzQ5OSwgMjAxOC8wOC8xMy0xNjo0MDoyMiAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENDIDIwMTkgKE1hY2ludG9zaCkiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6MDM4QTUyMkNDRUQyMTFFQzkzRTZDOUJBNTFBNTA3RDUiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6MDM4QTUyMkRDRUQyMTFFQzkzRTZDOUJBNTFBNTA3RDUiPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJRD0ieG1wLmlpZDozMkE3N0VGRkNFRDAxMUVDOTNFNkM5QkE1MUE1MDdENSIgc3RSZWY6ZG9jdW1lbnRJRD0ieG1wLmRpZDozMkE3N0YwMENFRDAxMUVDOTNFNkM5QkE1MUE1MDdENSIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/PliHXlsAAAAQSURBVHjaYvj//z8DQIABAAj8Av7bok0WAAAAAElFTkSuQmCC',
241
+ bgImage: '',
242
+ barBgColor: '', //bar背景颜色
243
+ systemInfoSyn: null,
244
+
245
+ //底部
246
+ tabbarBackground: '#fff',
247
+ tabbarData: null, //底部数据
248
+
249
+ //加载完成
250
+ initStatus: false,
251
+ contentStatus: false,
252
+
253
+
254
+ time: 0,
255
+ createTime: 0,
256
+ mountedTime: 0,
257
+
258
+ //需要计算的变量
259
+ navBarHeight : 110, //顶部高度(rpx)
260
+ statusBarHeight: 0, //状态栏高度(rpx)
261
+ safeHeight: null, //底部安全高度
262
+
263
+ //logs
264
+ uiLogs: {},
265
+ uiErrorLogs: {},
266
+ isLogs: false,
267
+
268
+ view: false,
269
+ observer: null,
270
+
271
+ }
272
+ },
273
+ computed: {
274
+ ...mapState([
275
+ 'errorLogs',
276
+ 'logs'
277
+ ]),
278
+
279
+ getBottom(){
280
+ return this.footerHeight
281
+ },
282
+
283
+ getMinHeight(){
284
+ if(this.initStatus) {
285
+ let temp = uni.getSystemInfoSync();
286
+
287
+ // #ifdef H5
288
+ if(temp.model === 'PC' && parent.window) {
289
+ temp.screenHeight = (parent.window.innerHeight || parent.window.document.documentElement.clientHeight || parent.window.document.body.clientHeight) - 160;
290
+ }
291
+ //#endif
292
+
293
+ let bar = this.navBarHeight;
294
+ let nav = this.statusBarHeight;
295
+ let bottom = this.bottomHeight;
296
+ let top = this.topHeight;
297
+ let footerBar = this.footerHeight;
298
+ let safeBottom = this.safeHeight;
299
+ let min = this.getPX(bar + nav + bottom + top + footerBar + safeBottom);
300
+ return `${temp.screenHeight - min}px`;
301
+ }
302
+ else {
303
+ return 0
304
+ }
305
+ },
306
+ },
307
+ watch:{
308
+ errorLogs(value){
309
+ this.uiErrorLogs = value;
310
+ },
311
+ logs(value){
312
+ this.uiLogs = value;
313
+ }
314
+ },
315
+
316
+ created() {
317
+ //切换页面之后数据清空
318
+ this.uiErrorLogs = this.errorLogs;
319
+ this.uiLogs = this.logs;
320
+ this.isLogs = this.$settings.isLogs;
321
+
322
+ //判断是否是打包环境
323
+ if (process.env.VUE_APP_CUSTOM_ENV) {
324
+ this.view = process.env.VUE_APP_CUSTOM_ENV.view === 'preview';
325
+ }
326
+
327
+ //配置文件
328
+ if(this.$webSetting) {
329
+ //顶部背景图片
330
+ if(this.$webSetting.barBackgroundImage) this.bgImage = this.$webSetting.barBackgroundImage;
331
+ if(this.barBackgroundImage) this.bgImage = this.barBackgroundImage;
332
+
333
+ //顶部背景颜色
334
+ if(this.$webSetting.barBackground) this.barBgColor = this.$webSetting.barBackground;
335
+ if(this.barBackgroundColotr) this.barBgColor = this.barBackgroundColotr;
336
+
337
+ this.tabbarData = this.$webSetting;
338
+ this.tabbarBackground = this.$webSetting.backgroundColor;
339
+ }
340
+
341
+ //获取胶囊相关数据
342
+ this.setMenuButtonBounding();
343
+
344
+ //重缓存中获取底部安全距离
345
+ if(uni.getStorageSync('xd-layout')) {
346
+ this.safeHeight = uni.getStorageSync('xd-layout')['safeHeight'];
347
+ this.getSafeBottom();
348
+ }
349
+
350
+
351
+
352
+
353
+ },
354
+ mounted(){
355
+ this.$nextTick(()=>{
356
+ const query = uni.createSelectorQuery().in(this);
357
+ let box = query.select('#xd-Layout');
358
+ let config = {attributes: true, childList: true, subtree: true};
359
+ this.observer = new MutationObserver(mutations => {
360
+ this.doChange()
361
+ });
362
+ this.observer.observe(box._component.$el, config)
363
+ })
364
+ },
365
+
366
+ beforeMount() {
367
+ if (this.safeHeight === null) this.getSafeBottom();
368
+ },
369
+
370
+ beforeDestroy(){
371
+ this.observer.disconnect();
372
+ },
373
+
374
+ methods: {
375
+ /**
376
+ * @description 获取胶囊相关数据
377
+ */
378
+ setMenuButtonBounding(){
379
+ this.systemInfoSyn = uni.getSystemInfoSync();
380
+
381
+ //ifdef APP-PLUS
382
+ this.navBarHeight = 80
383
+ //endif
384
+
385
+ //#ifdef H5
386
+ if (!this.showBar && this.title) {
387
+ document.title = this.title;
388
+ }
389
+ //#endif
390
+
391
+ // #ifdef H5
392
+ if (!this.showBar) this.navBarHeight = 0;
393
+ // #endif
394
+
395
+ // 设置状态栏高度
396
+ this.statusBarHeight = this.getRpx(this.systemInfoSyn.statusBarHeight);
397
+
398
+ // h5 app mp-alipay
399
+ // #ifndef H5 || APP-PLUS || MP-ALIPAY
400
+ // 获取胶囊的位置
401
+ const menuButtonInfo = uni.getMenuButtonBoundingClientRect();
402
+ // (胶囊底部高度 - 状态栏的高度) + (胶囊顶部高度 - 状态栏内的高度) = 导航栏的高度
403
+ this.navBarHeight = this.getRpx((menuButtonInfo.bottom - this.systemInfoSyn.statusBarHeight) + (menuButtonInfo.top - this.systemInfoSyn.statusBarHeight));
404
+ // #endif
405
+
406
+ if(!this.showFooter) {
407
+ this.tabbarHeigth = 0;
408
+ }
409
+
410
+ this.createTime = new Date().getTime() - this.startTime;
411
+ },
412
+
413
+ /**
414
+ * @description 获取底部安全距离数据
415
+ */
416
+ getSafeBottom(){
417
+ //已缓存安全距离
418
+ if(this.safeHeight !== null) {
419
+ this.time = new Date().getTime() - this.startTime;
420
+ this.initStatus = true;
421
+ this.layoutDone();
422
+ return
423
+ }
424
+
425
+ //未缓存安全距离
426
+ this.$nextTick(()=>{
427
+ this.$xdUniHelper.getWindowHeight(['#xd-Layout__padding'], this)
428
+ .then(res=>{
429
+ this.safeHeight = Math.max(
430
+ this.getRpx(res['#xd-Layout__padding']['height']),
431
+ this.systemInfoSyn.safeAreaInsets.bottom
432
+ );
433
+
434
+ this.time = new Date().getTime() - this.startTime;
435
+ this.initStatus = true;
436
+ //保存计算属性
437
+ uni.setStorageSync('xd-layout', {
438
+ safeHeight: this.safeHeight
439
+ });
440
+ this.layoutDone();
441
+ })
442
+ .catch()
443
+ })
444
+
445
+ },
446
+
447
+ /**
448
+ * @description 框架完成加载设置事件
449
+ */
450
+ layoutDone(){
451
+ this.$nextTick(()=>{
452
+ this.contentStatus = true;
453
+ this.doneEvent();
454
+ this.initAnimation()
455
+ })
456
+ },
457
+
458
+ /**
459
+ * @description 打包框架数据
460
+ * @returns {Object}
461
+ */
462
+ getLayoutInfo(){
463
+ return {
464
+ bodyMinHeightPx: parseFloat(this.getMinHeight),
465
+ bodyMinHeightRpx: this.getRpx(parseFloat(this.getMinHeight)),
466
+ safeHeightRpx: this.safeHeight, //底部安全高度
467
+ safeHeightPx:this.getPX(this.safeHeight), //底部安全高度
468
+ bodyMinHeight: this.getMinHeight, //底部安全高度
469
+ bottom: this.bottomHeight + this.tabbarHeigth , //底部已被占有高度(rpx)
470
+ top: this.navBarHeight + this.statusBarHeight + this.topHeight, //距离顶部已被占有高度(rpx)
471
+ topHeight: this.topHeight,
472
+ bottomHeight: this.bottomHeight,
473
+ }
474
+ },
475
+
476
+ /**
477
+ * @description rpx转px
478
+ * @param num
479
+ * @returns {number}
480
+ */
481
+ getPX(num){
482
+ return this.$xdUniHelper.multiplyFloatNumber(num,this.$rpxNum);
483
+ },
484
+
485
+ /**
486
+ * @description px转rpx
487
+ * @param num
488
+ * @returns {number}
489
+ */
490
+ getRpx(num){
491
+ return this.$xdUniHelper.multiplyFloatNumber(num,this.$pxNum);
492
+ },
493
+
494
+ initAnimation() {
495
+ //启动动画效果
496
+ if (this.isAnimation) {
497
+ //页面已加载时间
498
+ let useTime = new Date().getTime() - this.startTime;
499
+ let max = 50;
500
+
501
+ //初始化使用事件小于50毫秒
502
+ if (useTime < max) {
503
+ setTimeout(() => {
504
+ this.startAnimation = true;
505
+ }, (max - useTime) < 10 ? 10 : (max - useTime));
506
+ }
507
+
508
+ //大于50毫秒直接开始动画
509
+ else {
510
+ this.startAnimation = true;
511
+ }
512
+ }
513
+ //关闭动画效果
514
+ else {
515
+ this.$nextTick(()=>{
516
+ this.doneAnimation = true;
517
+ })
518
+ }
519
+ },
520
+
521
+ backEvent() {
522
+ this.$emit('onBack');
523
+ this.$emit('back');
524
+ },
525
+
526
+ doChange(){
527
+ console.log('onChange', this.getLayoutInfo());
528
+ this.$emit('onChange', this.getLayoutInfo());
529
+ },
530
+
531
+ doneEvent(){
532
+ this.$emit('onDone', this.getLayoutInfo());
533
+ this.$emit('done', this.getLayoutInfo());
534
+ },
535
+
536
+ }
537
+ }
538
+ </script>
539
+
540
+ <style scoped lang="less">
541
+ .xd-Layout {
542
+ background-size: 100%;
543
+ background-position: top center;
544
+ min-height: 100vh;
545
+ background-repeat: no-repeat;
546
+
547
+ &__padding {
548
+ .safe-area();
549
+ position: fixed;
550
+ top:-9999px;
551
+ left: -9999px;
552
+ width: 100%;
553
+ height: 0;
554
+ }
555
+
556
+ &__bar {
557
+ position: fixed;
558
+ z-index: 1300;
559
+ background: #fff;
560
+ top: 0;
561
+ right: 0;
562
+ }
563
+
564
+ &__body {
565
+ z-index: 999;
566
+ position: relative;
567
+ margin-left: 100vh;
568
+ background-size: 100%;
569
+ background-position: top center;
570
+ background-repeat: no-repeat;
571
+ }
572
+
573
+ &__top {
574
+ position: fixed;
575
+ z-index: 1001;
576
+ right: 0;
577
+ left: 100vw;
578
+ width: 100%;
579
+ }
580
+
581
+ &__bottom {
582
+ position: fixed;
583
+ z-index: 1000;
584
+ width: 100%;
585
+ left: 100vw;
586
+ right: 0;
587
+ .safe-area();
588
+ }
589
+
590
+ &__footer {
591
+ &-height {
592
+ .safe-area();
593
+ }
594
+ }
595
+
596
+ &__tabbar {
597
+ position: fixed;
598
+ left: 0;
599
+ right: 0;
600
+ bottom: 0;
601
+ z-index: 1200;
602
+ .safe-area();
603
+ }
604
+
605
+ /**动画效果**/
606
+ &__animation {
607
+ margin-left: 100vw;
608
+ width: 100vw;
609
+ background-size: 100%;
610
+ min-height: 100vh;
611
+ background-repeat: no-repeat;
612
+
613
+ &.nohasanimation {
614
+ margin-left: 0
615
+ }
616
+
617
+ &.animation {
618
+ transition:margin-left .3s ease;
619
+ margin-left: 0;
620
+
621
+ & .animation-top, & .animation-bottom {
622
+ transition:left .3s ease;
623
+ left: 0;
624
+ }
625
+
626
+ & .animation-body {
627
+ transition:margin-left .3s ease;
628
+ margin-left: 0;
629
+ }
630
+ }
631
+
632
+ }
633
+ }
634
+ </style>