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.
- package/.editorconfig +14 -0
- package/README.md +447 -0
- package/index.js +3 -0
- package/package.json +104 -0
- package/postcss.config.js +22 -0
- package/settings.js.tpl +68 -0
- package/src/XdAppClass.1.0.js +257 -0
- package/src/XdAppClass.js +150 -0
- package/src/components/XdAddress/XdAddress.vue +579 -0
- package/src/components/XdAddressSelect/XdAddressSelect.vue +243 -0
- package/src/components/XdBaiduMap/XdBaiduMap.vue +204 -0
- package/src/components/XdBaiduOverlay/XdBaiduOverlay.vue +345 -0
- package/src/components/XdBaiduSearch/XdBaiduSearch.vue +354 -0
- package/src/components/XdBar/XdBar.vue +339 -0
- package/src/components/XdButton/XdButton.vue +288 -0
- package/src/components/XdCartList/XdCartList.vue +791 -0
- package/src/components/XdCartNoStoreList/XdCartNoStoreList.vue +747 -0
- package/src/components/XdCity/XdCity.vue +620 -0
- package/src/components/XdCity/city.js +93 -0
- package/src/components/XdCity/testData.js +124 -0
- package/src/components/XdCityLocation/XdCityLocation.vue +314 -0
- package/src/components/XdCityLocation/jweixin.js +72 -0
- package/src/components/XdCityShow/XdCityShow.vue +354 -0
- package/src/components/XdClipImage/XdClipImage.vue +879 -0
- package/src/components/XdCoins/XdCoins.vue +66 -0
- package/src/components/XdConfirm/XdConfirm.vue +240 -0
- package/src/components/XdContentXss/XdContentXss.vue +71 -0
- package/src/components/XdDailog/XdDailog.vue +258 -0
- package/src/components/XdDate/XdDataItemOne.vue +236 -0
- package/src/components/XdDate/XdDate.vue +1081 -0
- package/src/components/XdDate/XdDateItem.vue +316 -0
- package/src/components/XdDate/XdDateTime.vue +929 -0
- package/src/components/XdDate/i18n/en.json +19 -0
- package/src/components/XdDate/i18n/index.js +8 -0
- package/src/components/XdDate/i18n/zh-Hans.json +19 -0
- package/src/components/XdDate/i18n/zh-Hant.json +19 -0
- package/src/components/XdDate/keypress.js +45 -0
- package/src/components/XdDate/util.js +418 -0
- package/src/components/XdDownDrawer/XdDownDrawer.vue +176 -0
- package/src/components/XdEditPwd/XdEditPwd.vue +305 -0
- package/src/components/XdEnterOrderList/XdEnterOrderList.vue +413 -0
- package/src/components/XdExpressTimeLine/XdExpressTimeLine.vue +280 -0
- package/src/components/XdFilter/XdFilter.vue +541 -0
- package/src/components/XdFontIcon/XdFontIcon.vue +165 -0
- package/src/components/XdFontIcon/css/icon.less +498 -0
- package/src/components/XdFooterBar/XdFooterBar.vue +291 -0
- package/src/components/XdFooterTabbar/XdFooterTabbar.vue +284 -0
- package/src/components/XdForm/XdForm.vue +481 -0
- package/src/components/XdForm/validate.js +486 -0
- package/src/components/XdFormCheckbox/XdFormCheckbox.vue +858 -0
- package/src/components/XdFormDate.vue +187 -0
- package/src/components/XdFormInput/XdFormInput.vue +535 -0
- package/src/components/XdFormInput/common.js +56 -0
- package/src/components/XdFormItem/XdFormItem.vue +583 -0
- package/src/components/XdFormSelect/XdFormSelect.vue +119 -0
- package/src/components/XdImage/XdImage.vue +113 -0
- package/src/components/XdItemCardUser/XdItemCardUser.vue +232 -0
- package/src/components/XdItemFilmImage/XdItemFilmImage.vue +146 -0
- package/src/components/XdItemFilmText/XdItemFilmText.vue +83 -0
- package/src/components/XdItemPhysical/XdItemPhysical.vue +410 -0
- package/src/components/XdItemPhysicalPack/XdItemPhysicalPack.vue +240 -0
- package/src/components/XdItemStore/XdItemStore.vue +236 -0
- package/src/components/XdItemUserInfo/XdItemUserInfo.vue +175 -0
- package/src/components/XdJson/XdJson.vue +398 -0
- package/src/components/XdKeyValue/XdKeyValue.vue +150 -0
- package/src/components/XdLabelNew/XdLabelNew.vue +193 -0
- package/src/components/XdLayout/XdLayout.vue +634 -0
- package/src/components/XdLoading/XdLoading.vue +165 -0
- package/src/components/XdMore/XdMore.vue +66 -0
- package/src/components/XdMpHtml/XdMpHtml.vue +458 -0
- package/src/components/XdMpHtml/node/node.vue +536 -0
- package/src/components/XdMpHtml/parser.js +1260 -0
- package/src/components/XdMpHtml/static/js/handler.js +1 -0
- package/src/components/XdMpHtml/static/js/uni.webview.min.js +1 -0
- package/src/components/XdMpHtml/static/local.html +1 -0
- package/src/components/XdMy/XdMy.vue +294 -0
- package/src/components/XdMySuccess/XdMySuccess.vue +603 -0
- package/src/components/XdNavTab/XdNavTab.vue +147 -0
- package/src/components/XdNoData/XdNoData.vue +87 -0
- package/src/components/XdNoticeBar/XdNoticeBar.vue +501 -0
- package/src/components/XdNumber/XdNumber.vue +210 -0
- package/src/components/XdNumberUni/XdNumberUni.vue +270 -0
- package/src/components/XdNumberUni/readme.md +42 -0
- package/src/components/XdOnlineConfirm/XdOnlineConfirm.vue +385 -0
- package/src/components/XdOnlineDetail/XdOnlineDetail.vue +332 -0
- package/src/components/XdOnlinePay/XdOnlinePay.vue +349 -0
- package/src/components/XdOnlineSchedule/XdOnlineSchedule.vue +453 -0
- package/src/components/XdOnlineSeat/XdOnlineSeat.vue +796 -0
- package/src/components/XdOnlineSeatMove/XdOnlineSeatMove.vue +1012 -0
- package/src/components/XdPayCombo/XdPayCombo.vue +118 -0
- package/src/components/XdPreviewImage/XdPreviewImage.vue +372 -0
- package/src/components/XdPwPay/XdPwPay.vue +214 -0
- package/src/components/XdRadio/XdRadio.vue +151 -0
- package/src/components/XdRangeSlider/XdRangeSlider.vue +355 -0
- package/src/components/XdRedName/XdRedName.vue +35 -0
- package/src/components/XdSearchBar/XdSearchBar.vue +286 -0
- package/src/components/XdSelect/XdSelect.vue +382 -0
- package/src/components/XdSelectCity/XdSelectCity.vue +270 -0
- package/src/components/XdSelectTime/XdSelectTime.vue +342 -0
- package/src/components/XdStar/XdStar.vue +261 -0
- package/src/components/XdStoreCashier/XdStoreCashier.vue +526 -0
- package/src/components/XdStoreItem/XdStoreItem.vue +400 -0
- package/src/components/XdStoreOrderDetail/XdStoreOrderDetail.vue +1571 -0
- package/src/components/XdStoreOrderList/XdStoreOrderList.vue +450 -0
- package/src/components/XdStoreProductInfo/XdStoreProductInfo.vue +940 -0
- package/src/components/XdStoreProductType/XdStoreProductType.vue +307 -0
- package/src/components/XdSuccess/XdSuccess.vue +527 -0
- package/src/components/XdSwipeSelect/XdSwipeSelect.vue +99 -0
- package/src/components/XdSwiper/XdSwiper.vue +124 -0
- package/src/components/XdSwitch/XdSwitch.vue +204 -0
- package/src/components/XdTab/XdTab.vue +220 -0
- package/src/components/XdTabScroll/XdTabScroll.vue +212 -0
- package/src/components/XdTag/XdTag.vue +423 -0
- package/src/components/XdTimeLine/XdTimeLine.vue +121 -0
- package/src/components/XdTips/XdTips.vue +212 -0
- package/src/components/XdTipsBlock/XdTipsBlock.vue +141 -0
- package/src/components/XdTitleSection/XdTitleSection.vue +152 -0
- package/src/components/XdTitleTab/XdTitleTab.vue +227 -0
- package/src/components/XdUnit/XdUnit.vue +206 -0
- package/src/components/XdUpload/XdUpload.vue +197 -0
- package/src/components/XdUploadImage/XdUploadImage.vue +145 -0
- package/src/components/Xdlogs/XdLogs.vue +144 -0
- package/src/components/autoload.js +211 -0
- package/src/components/swipeAction/UniSwipeAction.vue +43 -0
- package/src/components/swipeActionItem/UniSwipeActionItem.vue +386 -0
- package/src/components/swipeActionItem/bindingx.js +298 -0
- package/src/components/swipeActionItem/index.wxs +321 -0
- package/src/components/swipeActionItem/isPC.js +18 -0
- package/src/components/swipeActionItem/mpalipay.js +210 -0
- package/src/components/swipeActionItem/mpother.js +252 -0
- package/src/components/swipeActionItem/mpwxs.js +140 -0
- package/src/dome/dome/address.vue +415 -0
- package/src/dome/dome/auth/login.vue +166 -0
- package/src/dome/dome/baidu_show.vue +20 -0
- package/src/dome/dome/cake.vue +186 -0
- package/src/dome/dome/cart.vue +205 -0
- package/src/dome/dome/cart_store.vue +149 -0
- package/src/dome/dome/cashier/cashier.vue +73 -0
- package/src/dome/dome/cashier/check_cashier.vue +469 -0
- package/src/dome/dome/cashier/success.vue +127 -0
- package/src/dome/dome/city.vue +148 -0
- package/src/dome/dome/cityData.js +9 -0
- package/src/dome/dome/clip.vue +82 -0
- package/src/dome/dome/date/date.vue +273 -0
- package/src/dome/dome/date/selected.js +315 -0
- package/src/dome/dome/dcom/app1.vue +13 -0
- package/src/dome/dome/dcom/app2.vue +13 -0
- package/src/dome/dome/dcom/app3.vue +13 -0
- package/src/dome/dome/dcom/app4.vue +13 -0
- package/src/dome/dome/dcom/app5.vue +13 -0
- package/src/dome/dome/dcom/index.vue +1 -0
- package/src/dome/dome/debug/debug.vue +95 -0
- package/src/dome/dome/docache/docache.vue +88 -0
- package/src/dome/dome/express.vue +269 -0
- package/src/dome/dome/form.vue +312 -0
- package/src/dome/dome/icon.js +125 -0
- package/src/dome/dome/icon.vue +93 -0
- package/src/dome/dome/index.vue +725 -0
- package/src/dome/dome/item.vue +236 -0
- package/src/dome/dome/json/json.vue +88 -0
- package/src/dome/dome/layout.vue +105 -0
- package/src/dome/dome/line.vue +113 -0
- package/src/dome/dome/map/search.vue +70 -0
- package/src/dome/dome/my.vue +171 -0
- package/src/dome/dome/notice.vue +93 -0
- package/src/dome/dome/online/confirm.vue +92 -0
- package/src/dome/dome/online/detail.vue +80 -0
- package/src/dome/dome/online/pay.vue +78 -0
- package/src/dome/dome/online/schedule.vue +73 -0
- package/src/dome/dome/online/seat.vue +98 -0
- package/src/dome/dome/order/detail.vue +166 -0
- package/src/dome/dome/order/enter_order.vue +294 -0
- package/src/dome/dome/order/list.vue +219 -0
- package/src/dome/dome/order/order.js +18 -0
- package/src/dome/dome/order/success.vue +68 -0
- package/src/dome/dome/product.vue +179 -0
- package/src/dome/dome/store_cashier.vue +67 -0
- package/src/dome/dome/swiper.vue +32 -0
- package/src/dome/dome/webview.vue +61 -0
- package/src/install.js +183 -0
- package/src/main/address/address.vue +251 -0
- package/src/main/cart/cart.vue +149 -0
- package/src/main/cashier/cashier.vue +72 -0
- package/src/main/cashier/check_cashier.vue +483 -0
- package/src/main/city/city.vue +149 -0
- package/src/main/date/date.vue +260 -0
- package/src/main/order/order.js +19 -0
- package/src/main/order/order.vue +222 -0
- package/src/main/product/detail.vue +121 -0
- package/src/main/product/type.vue +108 -0
- package/src/main/search/search.vue +501 -0
- package/src/pages.json +337 -0
- package/src/plugins/CreatedComponentsPlugin.js +19 -0
- package/src/plugins/JsonRename.js +72 -0
- package/src/plugins/SetAppParams.js +171 -0
- package/src/project.js +18 -0
- package/src/utils/Cookie.js +68 -0
- package/src/utils/Runtime.js +105 -0
- package/src/utils/Storage.js +104 -0
- package/src/utils/XdNetwork.js +133 -0
- package/src/utils/helper.js +1321 -0
- package/src/utils/nourl.js +95 -0
- package/src/utils/project.js +17 -0
- package/src/utils/xd.auth.js +61 -0
- package/src/utils/xd.base.js +474 -0
- package/src/utils/xd.common.js +240 -0
- package/src/utils/xd.event.js +99 -0
- package/src/utils/xd.frame.js +96 -0
- package/src/utils/xd.path.js +96 -0
- package/src/utils/xdAppLog.js +170 -0
- package/src/utils/xdWxLog.js +302 -0
- package/src/utils/xdh5log.js +307 -0
- package/src/websetting.js +64 -0
- package/tsconfig.json +9 -0
- package/xd.less +180 -0
|
@@ -0,0 +1,339 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view class="xd-custom-bar" v-if="initDone">
|
|
3
|
+
<view
|
|
4
|
+
class="xd-custom-bar__fixed"
|
|
5
|
+
:style="{
|
|
6
|
+
backgroundColor: uiBgImage ? '': uiBgColor,
|
|
7
|
+
backgroundImage: 'url('+ uiBgImage +')',
|
|
8
|
+
height: barNavHeight + barStatusHeight + 'rpx'
|
|
9
|
+
}"
|
|
10
|
+
>
|
|
11
|
+
<!-- 状态栏 -->
|
|
12
|
+
<view :style="{ height: barStatusHeight+'rpx'}"></view>
|
|
13
|
+
<!-- 状态栏 -->
|
|
14
|
+
<!-- 导航栏内容 -->
|
|
15
|
+
<view
|
|
16
|
+
class="xd-custom-bar__fixed-content"
|
|
17
|
+
:style="{
|
|
18
|
+
height: barNavHeight + 'rpx',
|
|
19
|
+
lineHeight: barNavHeight + 'rpx',
|
|
20
|
+
width : barWidth + 'px',
|
|
21
|
+
paddingLeft: isSlotTopBar ? 0: (paddingLeftAndright + 'px')
|
|
22
|
+
}"
|
|
23
|
+
>
|
|
24
|
+
<!--返回上一个界元素-->
|
|
25
|
+
<view class="xd-custom-bar__fixed-content-icon" @click.stop="back" v-if="!isSlotTopBar">
|
|
26
|
+
<xd-font-icon
|
|
27
|
+
v-if="noPrevToIndex && showBack && isPrev !== null"
|
|
28
|
+
:icon="isPrev ? 'iconxiangzuo_xian' : 'iconshouye_mian'"
|
|
29
|
+
:color="uiTextColor"
|
|
30
|
+
:size="uiIconSize"
|
|
31
|
+
></xd-font-icon>
|
|
32
|
+
</view>
|
|
33
|
+
<!--返回上一个界元素-->
|
|
34
|
+
<view class="xd-custom-bar__fixed-content-slot" v-if="isSlotTopBar">
|
|
35
|
+
<slot>{{title}}</slot>
|
|
36
|
+
</view>
|
|
37
|
+
<template v-else>
|
|
38
|
+
<view
|
|
39
|
+
v-if="textAlign === 'left'"
|
|
40
|
+
class="xd-custom-bar__fixed-content-left"
|
|
41
|
+
:style="{
|
|
42
|
+
color: uiTextColor,
|
|
43
|
+
fontSize: uiFontSize + 'rpx'
|
|
44
|
+
}">{{title}}</view>
|
|
45
|
+
<view
|
|
46
|
+
v-else
|
|
47
|
+
class="xd-custom-bar__fixed-content-center"
|
|
48
|
+
:style="{
|
|
49
|
+
color: uiTextColor,
|
|
50
|
+
width: barWidth - (paddingLeftAndright + menuButtonInfoWidth) + 'px',
|
|
51
|
+
fontSize: uiFontSize + 'rpx'
|
|
52
|
+
}">{{title}}</view>
|
|
53
|
+
</template>
|
|
54
|
+
<view class="xd-custom-bar__fixed-content-icon" v-if="paddingRight && !isSlotTopBar"></view>
|
|
55
|
+
</view>
|
|
56
|
+
<!-- 导航栏内容 -->
|
|
57
|
+
</view>
|
|
58
|
+
</view>
|
|
59
|
+
</template>
|
|
60
|
+
|
|
61
|
+
<script>
|
|
62
|
+
import XdFontIcon from "@/components/XdFontIcon/XdFontIcon";
|
|
63
|
+
import {Base64} from 'js-base64';
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* XdBar 全局UI
|
|
67
|
+
* @description header tabbar 当前组件一定要放在页面跟节点下(不可放在组件当中使用,应该是编译问题导致)
|
|
68
|
+
* @tutorial
|
|
69
|
+
* @property {String} title 标题名称(可选)默认:''
|
|
70
|
+
* @property {Boolean} showBack 是否显示返回按钮(可选)默认:true
|
|
71
|
+
* @property {String} bgColor 背景颜色,默认使用全局主色调(可选)默认:主色掉
|
|
72
|
+
* @property {String} bgImage 背景图片,默认无
|
|
73
|
+
* @property {String} color 文字颜色(可选)使用主色调时候文字颜色为 #333
|
|
74
|
+
*
|
|
75
|
+
* @event {Function} click 按钮点击事件e
|
|
76
|
+
*/
|
|
77
|
+
|
|
78
|
+
export default {
|
|
79
|
+
name: "XdBar",
|
|
80
|
+
components: {
|
|
81
|
+
XdFontIcon
|
|
82
|
+
},
|
|
83
|
+
props: {
|
|
84
|
+
barNavHeight: {
|
|
85
|
+
type: Number,
|
|
86
|
+
default: 100
|
|
87
|
+
},
|
|
88
|
+
|
|
89
|
+
isSlotTopBar: {
|
|
90
|
+
type: Boolean,
|
|
91
|
+
default: false
|
|
92
|
+
},
|
|
93
|
+
|
|
94
|
+
barStatusHeight:{
|
|
95
|
+
type: Number,
|
|
96
|
+
default: 0
|
|
97
|
+
},
|
|
98
|
+
title: {
|
|
99
|
+
type: String,
|
|
100
|
+
default: ''
|
|
101
|
+
},
|
|
102
|
+
showBack: {
|
|
103
|
+
type: Boolean,
|
|
104
|
+
default: true
|
|
105
|
+
},
|
|
106
|
+
bgColor: {
|
|
107
|
+
type: String,
|
|
108
|
+
default: ''
|
|
109
|
+
},
|
|
110
|
+
bgImage: {
|
|
111
|
+
type: String,
|
|
112
|
+
},
|
|
113
|
+
color: {
|
|
114
|
+
type: String,
|
|
115
|
+
default: '#fff'
|
|
116
|
+
},
|
|
117
|
+
textAlign: {
|
|
118
|
+
type: String,
|
|
119
|
+
default: 'center' //center,left
|
|
120
|
+
}
|
|
121
|
+
},
|
|
122
|
+
data() {
|
|
123
|
+
return {
|
|
124
|
+
initDone: false, //是否加载完成
|
|
125
|
+
isIpad: null,
|
|
126
|
+
|
|
127
|
+
//返回键显示相关数据
|
|
128
|
+
isPrev: null, //是否可以返回页面
|
|
129
|
+
noPrevToIndex: false, //是否设置无返回页面是否跳转到首页
|
|
130
|
+
xdRedirectUrl: null, //返回上一个地址
|
|
131
|
+
|
|
132
|
+
//胶囊的计算
|
|
133
|
+
paddingLeftAndright: 0, //px 计算左右padding默认值
|
|
134
|
+
menuButtonInfoWidth: 0, //胶囊宽度
|
|
135
|
+
barWidth: 0, //bar宽度
|
|
136
|
+
paddingRight: true,
|
|
137
|
+
|
|
138
|
+
//样式风格
|
|
139
|
+
uiBgColor: '', //自定义背景颜色
|
|
140
|
+
uiTextColor: '#fff', //自定义标题文本与返回ICON颜色
|
|
141
|
+
uiBgImage:'', //背景图片
|
|
142
|
+
uiIconSize: 40,
|
|
143
|
+
uiFontSize: 34,
|
|
144
|
+
};
|
|
145
|
+
},
|
|
146
|
+
created(){
|
|
147
|
+
this.noPrevToIndex = this.$settings['noPrevPageToIndex'] === undefined ?
|
|
148
|
+
false : this.$settings['noPrevPageToIndex'];
|
|
149
|
+
|
|
150
|
+
//背景颜色设置
|
|
151
|
+
this.uiBgColor = this.bgColor || this.$mainColor;
|
|
152
|
+
if(this.color) this.uiTextColor = this.color;
|
|
153
|
+
this.uiBgImage = this.bgImage;
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* @description 设置样式
|
|
157
|
+
*/
|
|
158
|
+
this.setNavBar();
|
|
159
|
+
uni.onWindowResize(() => {
|
|
160
|
+
this.setNavBar()
|
|
161
|
+
});
|
|
162
|
+
},
|
|
163
|
+
mounted() {
|
|
164
|
+
this.checkPrevPages();
|
|
165
|
+
},
|
|
166
|
+
methods: {
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* @description 检查上一个页面
|
|
170
|
+
*/
|
|
171
|
+
checkPrevPages(){
|
|
172
|
+
//判断是否有上一个页面
|
|
173
|
+
let pages = getCurrentPages();//当前页
|
|
174
|
+
let beforePageStatus = false;
|
|
175
|
+
if (pages.length >= 2) {
|
|
176
|
+
beforePageStatus = true;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
//有项目内跳转地址
|
|
180
|
+
let xdRedirect = false;
|
|
181
|
+
if(this.$xdUniHelper.getParmater('xdRedirect')) {
|
|
182
|
+
try {
|
|
183
|
+
if(Base64.decode(this.$xdUniHelper.getParmater('xdRedirect'))) xdRedirect = true;
|
|
184
|
+
} catch (e) {
|
|
185
|
+
xdRedirect = false;
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
//项目外地址
|
|
190
|
+
let xdProjectCallback = false;
|
|
191
|
+
if (this.$xdUniHelper.getParmater('xdProjectCallback')) {
|
|
192
|
+
try {
|
|
193
|
+
if (Base64.decode(this.$xdUniHelper.getParmater('xdProjectCallback'))) xdProjectCallback = true;
|
|
194
|
+
} catch (e) {
|
|
195
|
+
xdProjectCallback = false;
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
this.isPrev = beforePageStatus || xdRedirect || xdProjectCallback;
|
|
199
|
+
},
|
|
200
|
+
|
|
201
|
+
setNavBar() {
|
|
202
|
+
// 获取手机系统信息
|
|
203
|
+
const info = uni.getSystemInfoSync();
|
|
204
|
+
|
|
205
|
+
//导航宽度
|
|
206
|
+
this.barWidth = info['safeArea'].width;
|
|
207
|
+
|
|
208
|
+
// 获取胶囊的位置
|
|
209
|
+
// #ifndef H5 || APP-PLUS || MP-ALIPAY
|
|
210
|
+
const menuButtonInfo = uni.getMenuButtonBoundingClientRect();
|
|
211
|
+
this.paddingLeftAndright = info['safeArea'].width - menuButtonInfo.right;
|
|
212
|
+
this.menuButtonInfoWidth = menuButtonInfo.width;
|
|
213
|
+
this.barWidth = info['safeArea'].width - (this.paddingLeftAndright + this.menuButtonInfoWidth);
|
|
214
|
+
this.paddingRight = false;
|
|
215
|
+
// #endif
|
|
216
|
+
|
|
217
|
+
|
|
218
|
+
this.initDone = true;
|
|
219
|
+
},
|
|
220
|
+
|
|
221
|
+
back(){
|
|
222
|
+
if(!this.showBack) return;
|
|
223
|
+
|
|
224
|
+
//临时兼容
|
|
225
|
+
if(this.noPrevToIndex === 'back') {
|
|
226
|
+
//其他正常跳转
|
|
227
|
+
this.$emit('click');
|
|
228
|
+
this.$emit('back');
|
|
229
|
+
return;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
//有上一个路径的返回到上一个路径
|
|
233
|
+
if(this.$xdUniHelper.getParmater('xdRedirect')) {
|
|
234
|
+
try {
|
|
235
|
+
this.$xdUniHelper.redirectTo({
|
|
236
|
+
url: Base64.decode(this.$xdUniHelper.getParmater('xdRedirect'))
|
|
237
|
+
}, false);
|
|
238
|
+
return;
|
|
239
|
+
}catch (e) {}
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
|
|
243
|
+
//有上一个路径的返回到上一个路径
|
|
244
|
+
if (this.$xdUniHelper.getParmater('xdProjectCallback')) {
|
|
245
|
+
try {
|
|
246
|
+
window.location.href = Base64.decode(this.$xdUniHelper.getParmater('xdProjectCallback'));
|
|
247
|
+
return;
|
|
248
|
+
} catch (e) {
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
|
|
253
|
+
//无上一个页面返回到首页
|
|
254
|
+
if(this.noPrevToIndex && !this.isPrev) {
|
|
255
|
+
this.$xdUniHelper.redirectTo({
|
|
256
|
+
url: this.$settings.index
|
|
257
|
+
}, false);
|
|
258
|
+
return;
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
|
|
262
|
+
//未开启无返回页面跳首页功能不处理
|
|
263
|
+
if (!this.noPrevToIndex && !this.isPrev) return;
|
|
264
|
+
|
|
265
|
+
//其他正常跳转
|
|
266
|
+
this.$emit('click');
|
|
267
|
+
this.$emit('back');
|
|
268
|
+
},
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
</script>
|
|
272
|
+
|
|
273
|
+
<style lang="less">
|
|
274
|
+
.xd-custom-bar {
|
|
275
|
+
overflow: hidden;
|
|
276
|
+
|
|
277
|
+
&__fixed {
|
|
278
|
+
position: fixed;
|
|
279
|
+
top: 0;
|
|
280
|
+
left: 0;
|
|
281
|
+
z-index: 99;
|
|
282
|
+
width: 100%;
|
|
283
|
+
background-size: 100%;
|
|
284
|
+
background-position: top center;
|
|
285
|
+
background-repeat: no-repeat;
|
|
286
|
+
|
|
287
|
+
&-content {
|
|
288
|
+
display: flex;
|
|
289
|
+
justify-content: space-between;
|
|
290
|
+
align-items: center;
|
|
291
|
+
box-sizing: border-box;
|
|
292
|
+
|
|
293
|
+
&-slot {
|
|
294
|
+
width: 100%;
|
|
295
|
+
display: block;
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
&-icon {
|
|
299
|
+
display: flex;
|
|
300
|
+
width: 30px;
|
|
301
|
+
height: 100%;
|
|
302
|
+
padding-left: 5px;
|
|
303
|
+
justify-content: flex-start;
|
|
304
|
+
align-items: center;
|
|
305
|
+
flex-shrink: 0;
|
|
306
|
+
|
|
307
|
+
& > view {
|
|
308
|
+
font-size: 20px;
|
|
309
|
+
color: #fff;
|
|
310
|
+
text-align: center;
|
|
311
|
+
vertical-align: middle;
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
&-left {
|
|
316
|
+
flex: 1;
|
|
317
|
+
width: 0;
|
|
318
|
+
& > view:last-child {
|
|
319
|
+
.uni-max-cut(1, 90);
|
|
320
|
+
.uni-break-word();
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
&-center {
|
|
325
|
+
display: flex;
|
|
326
|
+
justify-content: center;
|
|
327
|
+
align-items: center;
|
|
328
|
+
text-align: center;
|
|
329
|
+
& > view:last-child {
|
|
330
|
+
.uni-max-cut(1, 90);
|
|
331
|
+
.uni-break-word();
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
}
|
|
338
|
+
</style>
|
|
339
|
+
|
|
@@ -0,0 +1,288 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<button
|
|
3
|
+
:disabled="disabled"
|
|
4
|
+
@click.stop="handleClick"
|
|
5
|
+
:style="{
|
|
6
|
+
opacity: disabled ? 0.4 : 1,
|
|
7
|
+
background: getBgColor(uiType),
|
|
8
|
+
fontSize: getInfo(uiSize,'fontSize','btnFontSieList'),
|
|
9
|
+
height: getInfo(uiSize,'height','btnHeightList'),
|
|
10
|
+
lineHeight: getInfo(uiSize,'height','btnHeightList'),
|
|
11
|
+
borderRadius: getRadius(uiSize),
|
|
12
|
+
color: getTextColor,
|
|
13
|
+
width: width ? width : 'auto',
|
|
14
|
+
boxShadow: getBoxShadow,
|
|
15
|
+
border: uiType === 'default'? '2rpx solid #dcdfe6!important': 0,
|
|
16
|
+
padding: '0 ' + btnPaddingtList[uiSize] + 'rpx'
|
|
17
|
+
}"
|
|
18
|
+
:class="getClassName"
|
|
19
|
+
type="default"
|
|
20
|
+
plain="true"
|
|
21
|
+
><slot>按钮</slot></button>
|
|
22
|
+
</template>
|
|
23
|
+
|
|
24
|
+
<script>
|
|
25
|
+
import helper from "@/utils/helper";
|
|
26
|
+
import {
|
|
27
|
+
getParentsStyle, //获取页面风格单个键值值
|
|
28
|
+
getParentsStyles //获取页面风格列表
|
|
29
|
+
} from '@/utils/xd.base';
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* XdButton 按钮UI
|
|
33
|
+
* @description 按钮组件
|
|
34
|
+
* @tutorial
|
|
35
|
+
* @property {Boolean} disabled 是否禁用 默认值:false
|
|
36
|
+
* @property {String} bgColor 按钮背景颜色 (可选)默认:空
|
|
37
|
+
* @property {String} color 按钮文字颜色 (可选) 默认:#fff
|
|
38
|
+
* @property {String} width 按钮宽度 (可选)默认:空
|
|
39
|
+
* @property {String} type 按钮颜色类型(primary,default,subPrimary,danger,info,warning,success)
|
|
40
|
+
* @property {String|Number} fontSize 按钮文字大小 (可选)默认:空
|
|
41
|
+
* @property {String} radius 按钮圆角 (可选)默认:空
|
|
42
|
+
* @property {String} size 按钮大小 default(默认), large(最大), medium(中), small(小), 'mini'
|
|
43
|
+
* @property {String|null} boxShadow 启动文字阴影功能,其值与css原生属性保存一直,例如:0,0,10px rgba(0,0,0,0.5) null:关闭阴影效果
|
|
44
|
+
* @property {String} gradualColor 启动ICON线性渐变 其值与css原生属性保存一直, 例如:rgba(30,87,153,1) 0%,rgba(41,137,216,1) 50%,rgba(32,124,202,1) 51%,rgba(125,185,232,1) 100%
|
|
45
|
+
* @property {Boolean} isGradual 是否启用线性渐变 默认值:false
|
|
46
|
+
* @property {String} gradualType 线性渐变类型 默认值:to right (to right 左右),(to right 左右),(135deg 左上到右下),(45deg 左下到右上(角度))
|
|
47
|
+
* @event {Function} click 按钮点击事件e
|
|
48
|
+
*/
|
|
49
|
+
|
|
50
|
+
export default {
|
|
51
|
+
name: "XdButton",
|
|
52
|
+
props:{
|
|
53
|
+
bgColor: {
|
|
54
|
+
type: String,
|
|
55
|
+
default: ''
|
|
56
|
+
},
|
|
57
|
+
|
|
58
|
+
color: {
|
|
59
|
+
type: String,
|
|
60
|
+
default: '#fff'
|
|
61
|
+
},
|
|
62
|
+
|
|
63
|
+
disabled:{
|
|
64
|
+
type: Boolean,
|
|
65
|
+
default: false
|
|
66
|
+
},
|
|
67
|
+
|
|
68
|
+
width: {
|
|
69
|
+
type: String,
|
|
70
|
+
default: '' //rpx
|
|
71
|
+
},
|
|
72
|
+
|
|
73
|
+
type: {
|
|
74
|
+
type: String,
|
|
75
|
+
default: 'default', //primary,default,subPrimary,danger,info,warning,success
|
|
76
|
+
},
|
|
77
|
+
|
|
78
|
+
fontSize: {
|
|
79
|
+
type: String|Number,
|
|
80
|
+
default: '' , //rpx
|
|
81
|
+
},
|
|
82
|
+
|
|
83
|
+
radius: {
|
|
84
|
+
type: String,
|
|
85
|
+
default: ''//rpx
|
|
86
|
+
},
|
|
87
|
+
|
|
88
|
+
size: {
|
|
89
|
+
type: String,
|
|
90
|
+
default: 'medium' //'default', 'large', 'medium', 'small', 'mini'
|
|
91
|
+
},
|
|
92
|
+
|
|
93
|
+
/**仅支持线性渐变******/
|
|
94
|
+
boxShadow: {
|
|
95
|
+
type: String|null,
|
|
96
|
+
default: ''
|
|
97
|
+
},
|
|
98
|
+
|
|
99
|
+
//rgba(30,87,153,1) 0%,rgba(41,137,216,1) 50%,rgba(32,124,202,1) 51%,rgba(125,185,232,1) 100%
|
|
100
|
+
gradualColor: {
|
|
101
|
+
type: String,
|
|
102
|
+
default: 'rgba(30,87,153,1) 0%,rgba(41,137,216,1) 50%,rgba(32,124,202,1) 51%,rgba(125,185,232,1) 100%',
|
|
103
|
+
},
|
|
104
|
+
|
|
105
|
+
isGradual: {
|
|
106
|
+
type: Boolean,
|
|
107
|
+
default: false,
|
|
108
|
+
},
|
|
109
|
+
|
|
110
|
+
gradualType: {
|
|
111
|
+
type: String,
|
|
112
|
+
//to right 左右
|
|
113
|
+
//to bottom 上下
|
|
114
|
+
//135deg 左上到右下(角度)
|
|
115
|
+
//45deg 左下到右上(角度)
|
|
116
|
+
default: 'to bottom',
|
|
117
|
+
}
|
|
118
|
+
/**仅支持线性渐变******/
|
|
119
|
+
},
|
|
120
|
+
data(){
|
|
121
|
+
return {
|
|
122
|
+
uiType: 'primary',
|
|
123
|
+
uiSize: 'default',
|
|
124
|
+
btnTypeList: ['primary','default', 'subPrimary', 'danger', 'info', 'warning', 'success', 'text'],
|
|
125
|
+
btnSizeList: ['default', 'large' ,'medium', 'small', 'mini'],
|
|
126
|
+
btnHeightList: {
|
|
127
|
+
default: 100,
|
|
128
|
+
large: 110,
|
|
129
|
+
medium: 80,
|
|
130
|
+
small: 60,
|
|
131
|
+
mini: 50,
|
|
132
|
+
},
|
|
133
|
+
btnPaddingtList: {
|
|
134
|
+
default: 75,
|
|
135
|
+
large: 82.5,
|
|
136
|
+
medium: 60,
|
|
137
|
+
small: 45,
|
|
138
|
+
mini: 30,
|
|
139
|
+
},
|
|
140
|
+
btnFontSieList: {
|
|
141
|
+
default: 36,
|
|
142
|
+
large: 40,
|
|
143
|
+
medium: 36,
|
|
144
|
+
small: 26,
|
|
145
|
+
mini: 24,
|
|
146
|
+
},
|
|
147
|
+
btnShadowList: {
|
|
148
|
+
default: 10,
|
|
149
|
+
large: 10,
|
|
150
|
+
medium: 8,
|
|
151
|
+
small: 6,
|
|
152
|
+
mini: 4,
|
|
153
|
+
},
|
|
154
|
+
btnOpacityList: {
|
|
155
|
+
default: .45,
|
|
156
|
+
large: .40,
|
|
157
|
+
medium: .25,
|
|
158
|
+
small: .25,
|
|
159
|
+
mini: .45,
|
|
160
|
+
},
|
|
161
|
+
btnBtnColor: {
|
|
162
|
+
subPrimary:'',
|
|
163
|
+
primary: '#EC4D71',
|
|
164
|
+
default: '#fff',
|
|
165
|
+
danger: '#ec5c5c',
|
|
166
|
+
info:'#B8B7BE',
|
|
167
|
+
warning: '#E6A23C',
|
|
168
|
+
success:'#67C23A',
|
|
169
|
+
text: '#F5F5F5'
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
},
|
|
173
|
+
computed: {
|
|
174
|
+
getClassName() {
|
|
175
|
+
let btn = `xd-button xd-button__${this.uiType} xd-button-size__${this.size}`;
|
|
176
|
+
if(this.disabled) {
|
|
177
|
+
btn = `${btn} xd-button__disabled`;
|
|
178
|
+
}
|
|
179
|
+
return btn
|
|
180
|
+
},
|
|
181
|
+
|
|
182
|
+
getTextColor(){
|
|
183
|
+
if(this.uiType === 'default') return '#333';
|
|
184
|
+
if(this.uiType === 'text') return '#B8B7BE';
|
|
185
|
+
return this.color || '#fff';
|
|
186
|
+
},
|
|
187
|
+
|
|
188
|
+
getBoxShadow(){
|
|
189
|
+
if(this.uiType === 'default' || this.uiType === 'text'|| this.boxShadow === null) return `0 0 0 rgba(0,0,0,0)`
|
|
190
|
+
let color = this.$color(this.getColor(this.uiType)).alpha(0.4).toString();
|
|
191
|
+
if(this.boxShadow) return this.boxShadow;
|
|
192
|
+
return `0 ${this.btnShadowList[this.uiSize]}rpx ${this.btnShadowList[this.uiSize] - 2}rpx ${color}`;
|
|
193
|
+
},
|
|
194
|
+
},
|
|
195
|
+
async created(){
|
|
196
|
+
let style = await getParentsStyles(this.$parent);
|
|
197
|
+
this.btnBtnColor = {
|
|
198
|
+
subPrimary: style.$subMainColor,
|
|
199
|
+
primary: style.$mainColor,
|
|
200
|
+
default: style.$defaultColor,
|
|
201
|
+
danger: style.$dangerColor,
|
|
202
|
+
info: style.$infoColor,
|
|
203
|
+
warning: style.$warningColor,
|
|
204
|
+
success: style.$successColor,
|
|
205
|
+
text: '#333'
|
|
206
|
+
};
|
|
207
|
+
|
|
208
|
+
|
|
209
|
+
this.uiType = this.existKey(this.type);
|
|
210
|
+
this.uiSize = this.existKey(this.size, 'btnSizeList');
|
|
211
|
+
this.$set(this.btnBtnColor, 'primary', style.$subMainColor);
|
|
212
|
+
this.$set(this.btnBtnColor, 'subPrimary', this.$color(this.btnBtnColor.primary).alpha(0.4).lighten(0.35).hex());
|
|
213
|
+
},
|
|
214
|
+
methods:{
|
|
215
|
+
handleClick(e){
|
|
216
|
+
this.$emit('click',e);
|
|
217
|
+
this.$emit('tap', e);
|
|
218
|
+
},
|
|
219
|
+
|
|
220
|
+
getInfo(type, dataKey, list='btnHeightList'){
|
|
221
|
+
if (this[dataKey]) {
|
|
222
|
+
let temp = this[dataKey];
|
|
223
|
+
if (helper.checkVarType(this[dataKey]) === 'string') {
|
|
224
|
+
temp = Number(this[dataKey]);
|
|
225
|
+
}
|
|
226
|
+
return temp + 'rpx';
|
|
227
|
+
}
|
|
228
|
+
return this[list][type] + 'rpx'
|
|
229
|
+
},
|
|
230
|
+
|
|
231
|
+
getRadius(type){
|
|
232
|
+
if(this.radius) return this.radius;
|
|
233
|
+
if(this.uiSize === 'large') return '20rpx';
|
|
234
|
+
return Math.floor(this.btnHeightList[type] / 2) + 'rpx';
|
|
235
|
+
},
|
|
236
|
+
|
|
237
|
+
getColor(){
|
|
238
|
+
let bgc = '';
|
|
239
|
+
if (this.isGradual && this.gradualColor && this.gradualType) {
|
|
240
|
+
let reg = /(rgba\((.*?)\))/g;
|
|
241
|
+
let arr = this.gradualColor.match(reg);
|
|
242
|
+
if(arr === null){
|
|
243
|
+
let strArr = this.gradualColor.split(',');
|
|
244
|
+
strArr = strArr[strArr.length - 1];
|
|
245
|
+
return strArr.split(' ').filter(item=>{
|
|
246
|
+
return !!item;
|
|
247
|
+
})[0];
|
|
248
|
+
}
|
|
249
|
+
else {
|
|
250
|
+
return arr[arr.length - 1];
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
}
|
|
254
|
+
return this.bgColor || bgc || this.btnBtnColor[this.uiType];
|
|
255
|
+
},
|
|
256
|
+
|
|
257
|
+
getBgColor(){
|
|
258
|
+
let bgc = this.getColor();
|
|
259
|
+
if (this.isGradual && this.gradualColor && this.gradualType) {
|
|
260
|
+
bgc =`linear-gradient(${this.gradualType}, ${this.gradualColor})`;
|
|
261
|
+
}
|
|
262
|
+
return bgc;
|
|
263
|
+
},
|
|
264
|
+
|
|
265
|
+
existKey(key, type='btnTypeList'){
|
|
266
|
+
if(this[type].includes(key)) return key;
|
|
267
|
+
else return this[type][0];
|
|
268
|
+
},
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
</script>
|
|
272
|
+
|
|
273
|
+
<style lang="less" scoped>
|
|
274
|
+
.xd-button {
|
|
275
|
+
z-index: 0;
|
|
276
|
+
padding: 0 unit(50, rpx);
|
|
277
|
+
border: 0 !important;
|
|
278
|
+
opacity: 1;
|
|
279
|
+
transition: opacity .1s;
|
|
280
|
+
box-sizing: border-box;
|
|
281
|
+
|
|
282
|
+
&:hover {
|
|
283
|
+
opacity: 0.7;
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
|
|
288
|
+
</style>
|