hy-app 0.1.1
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/README.md +42 -0
- package/api/http.ts +138 -0
- package/api/index.ts +1 -0
- package/common/index.ts +1 -0
- package/common/versionControl.ts +102 -0
- package/components/dialog/TheDialog.vue +128 -0
- package/components/dialog/index.ts +38 -0
- package/components/hy-address-picker/hy-address-picker.vue +262 -0
- package/components/hy-address-picker/props.ts +27 -0
- package/components/hy-address-picker/typing.d.ts +98 -0
- package/components/hy-avatar/hy-avatar.vue +217 -0
- package/components/hy-avatar/props.ts +20 -0
- package/components/hy-avatar/typing.d.ts +64 -0
- package/components/hy-back-top/hy-back-top.vue +71 -0
- package/components/hy-back-top/props.ts +23 -0
- package/components/hy-back-top/typing.d.ts +49 -0
- package/components/hy-badge/hy-badge.vue +155 -0
- package/components/hy-badge/props.ts +19 -0
- package/components/hy-badge/typing.d.ts +60 -0
- package/components/hy-button/hy-button.vue +394 -0
- package/components/hy-button/props.ts +36 -0
- package/components/hy-button/typing.d.ts +125 -0
- package/components/hy-card/hy-card.vue +198 -0
- package/components/hy-card/props.ts +29 -0
- package/components/hy-card/typing.d.ts +112 -0
- package/components/hy-cell/hy-cell.vue +268 -0
- package/components/hy-cell/props.ts +20 -0
- package/components/hy-cell/typing.d.ts +98 -0
- package/components/hy-check-button/hy-check-button.vue +71 -0
- package/components/hy-check-button/props.ts +20 -0
- package/components/hy-check-button/typing.d.ts +79 -0
- package/components/hy-checkbox/hy-checkbox.vue +299 -0
- package/components/hy-checkbox/props.ts +28 -0
- package/components/hy-checkbox/typing.d.ts +77 -0
- package/components/hy-datetime-picker/hy-datetime-picker.vue +584 -0
- package/components/hy-datetime-picker/props.ts +36 -0
- package/components/hy-datetime-picker/typing.d.ts +135 -0
- package/components/hy-divider/hy-divider.vue +164 -0
- package/components/hy-divider/props.ts +21 -0
- package/components/hy-divider/typing.d.ts +64 -0
- package/components/hy-empty/hy-empty.vue +122 -0
- package/components/hy-empty/props.ts +21 -0
- package/components/hy-empty/typing.d.ts +68 -0
- package/components/hy-folding-panel/hy-folding-panel.vue +94 -0
- package/components/hy-folding-panel/props.ts +17 -0
- package/components/hy-folding-panel/typing.d.ts +59 -0
- package/components/hy-form/hy-form.vue +372 -0
- package/components/hy-form/props.ts +15 -0
- package/components/hy-form/typing.d.ts +51 -0
- package/components/hy-grid/hy-grid.vue +126 -0
- package/components/hy-grid/props.ts +16 -0
- package/components/hy-grid/typing.d.ts +62 -0
- package/components/hy-icon/hy-icon.vue +207 -0
- package/components/hy-icon/props.ts +24 -0
- package/components/hy-icon/typing.d.ts +80 -0
- package/components/hy-input/hy-input.vue +402 -0
- package/components/hy-input/props.ts +41 -0
- package/components/hy-input/typing.d.ts +148 -0
- package/components/hy-line/hy-line.vue +44 -0
- package/components/hy-line/props.ts +12 -0
- package/components/hy-line/typing.d.ts +32 -0
- package/components/hy-line-progress/hy-line-progress.vue +118 -0
- package/components/hy-line-progress/props.ts +12 -0
- package/components/hy-line-progress/typing.d.ts +28 -0
- package/components/hy-list/hy-list.vue +250 -0
- package/components/hy-list/props.ts +18 -0
- package/components/hy-list/typing.d.ts +50 -0
- package/components/hy-login/ThePhoneLogin.vue +106 -0
- package/components/hy-login/TheUserLogin.vue +391 -0
- package/components/hy-login/hy-login.vue +283 -0
- package/components/hy-login/props.ts +32 -0
- package/components/hy-login/typing.d.ts +60 -0
- package/components/hy-modal/hy-modal.vue +240 -0
- package/components/hy-modal/props.ts +24 -0
- package/components/hy-modal/typing.d.ts +70 -0
- package/components/hy-navbar/hy-navbar.vue +194 -0
- package/components/hy-navbar/props.ts +24 -0
- package/components/hy-navbar/typing.d.ts +81 -0
- package/components/hy-notice-bar/hy-column-notice.vue +130 -0
- package/components/hy-notice-bar/hy-notice-bar.vue +82 -0
- package/components/hy-notice-bar/hy-row-notice.vue +182 -0
- package/components/hy-notice-bar/props.ts +19 -0
- package/components/hy-notice-bar/typing.d.ts +56 -0
- package/components/hy-number-step/hy-number-step.vue +428 -0
- package/components/hy-number-step/props.ts +29 -0
- package/components/hy-number-step/typing.d.ts +104 -0
- package/components/hy-overlay/hy-overlay.vue +54 -0
- package/components/hy-overlay/props.ts +10 -0
- package/components/hy-overlay/typing.d.ts +24 -0
- package/components/hy-picker/hy-picker.vue +499 -0
- package/components/hy-picker/props.ts +30 -0
- package/components/hy-picker/typing.d.ts +115 -0
- package/components/hy-popup/hy-popup.vue +269 -0
- package/components/hy-popup/props.ts +21 -0
- package/components/hy-popup/typing.d.ts +68 -0
- package/components/hy-price/hy-price.vue +86 -0
- package/components/hy-price/props.ts +13 -0
- package/components/hy-price/typing.d.ts +36 -0
- package/components/hy-qrcode/hy-qrcode.vue +153 -0
- package/components/hy-qrcode/props.ts +20 -0
- package/components/hy-qrcode/qrcode.js +1364 -0
- package/components/hy-qrcode/typing.d.ts +64 -0
- package/components/hy-radio/hy-radio.vue +319 -0
- package/components/hy-radio/props.ts +28 -0
- package/components/hy-radio/typing.d.ts +85 -0
- package/components/hy-rate/hy-rate.vue +261 -0
- package/components/hy-rate/props.ts +18 -0
- package/components/hy-rate/typing.d.ts +60 -0
- package/components/hy-read-more/hy-read-more.vue +134 -0
- package/components/hy-read-more/props.ts +20 -0
- package/components/hy-read-more/typing.d.ts +44 -0
- package/components/hy-safe-bottom/hy-safe-bottom.vue +64 -0
- package/components/hy-scroll-list/hy-scroll-list.vue +146 -0
- package/components/hy-scroll-list/props.ts +12 -0
- package/components/hy-scroll-list/typing.d.ts +28 -0
- package/components/hy-search/hy-search.vue +294 -0
- package/components/hy-search/props.ts +29 -0
- package/components/hy-search/typing.d.ts +109 -0
- package/components/hy-slider/hy-slider.vue +511 -0
- package/components/hy-slider/props.ts +21 -0
- package/components/hy-slider/typing.d.ts +68 -0
- package/components/hy-steps/hy-steps.vue +352 -0
- package/components/hy-steps/props.ts +15 -0
- package/components/hy-steps/typing.d.ts +58 -0
- package/components/hy-subsection/hy-subsection.vue +272 -0
- package/components/hy-subsection/props.ts +16 -0
- package/components/hy-subsection/typing.d.ts +44 -0
- package/components/hy-swiper/hy-swiper-indicator.vue +105 -0
- package/components/hy-swiper/hy-swiper.vue +242 -0
- package/components/hy-swiper/props.ts +30 -0
- package/components/hy-swiper/typing.d.ts +107 -0
- package/components/hy-switch/hy-switch.vue +168 -0
- package/components/hy-switch/props.ts +16 -0
- package/components/hy-switch/typing.d.ts +48 -0
- package/components/hy-tabs/hy-tabs.vue +416 -0
- package/components/hy-tabs/props.ts +26 -0
- package/components/hy-tabs/typing.d.ts +86 -0
- package/components/hy-tag/hy-tag.vue +374 -0
- package/components/hy-tag/props.ts +22 -0
- package/components/hy-tag/typing.d.ts +76 -0
- package/components/hy-textarea/hy-textarea.vue +229 -0
- package/components/hy-textarea/props.ts +26 -0
- package/components/hy-textarea/typing.d.ts +27 -0
- package/components/hy-tooltip/hy-tooltip.vue +332 -0
- package/components/hy-tooltip/props.ts +17 -0
- package/components/hy-tooltip/typing.d.ts +52 -0
- package/components/hy-transition/hy-transition.vue +150 -0
- package/components/hy-transition/index.scss +113 -0
- package/components/hy-transition/props.ts +10 -0
- package/components/hy-transition/typing.d.ts +36 -0
- package/components/hy-upload/hy-upload.vue +557 -0
- package/components/hy-upload/props.ts +29 -0
- package/components/hy-upload/typing.d.ts +147 -0
- package/components/hy-warn/hy-warn.vue +228 -0
- package/components/hy-warn/props.ts +14 -0
- package/components/hy-warn/typing.d.ts +40 -0
- package/components/hy-waterfall/hy-waterfall.vue +51 -0
- package/components/hy-waterfall/props.ts +10 -0
- package/components/hy-waterfall/typing.d.ts +20 -0
- package/components/index.ts +162 -0
- package/components/message/TheMessage.vue +169 -0
- package/components/message/index.ts +54 -0
- package/components/u-form/form.js +22 -0
- package/components/u-form/hy-form.vue +324 -0
- package/components/u-form/props.js +49 -0
- package/components/u-form/schema.js +1451 -0
- package/components/u-form/u-form.vue +267 -0
- package/components/u-form/utils.js +65 -0
- package/components/u-form-item/formItem.js +24 -0
- package/components/u-form-item/hy-form-item.vue +360 -0
- package/components/u-form-item/props.js +57 -0
- package/components/u-form-item/u-form-item.vue +294 -0
- package/components/yk-dialog/yk-dialog.vue +129 -0
- package/components/yk-tabbar/props.ts +49 -0
- package/components/yk-tabbar/yk-tabbar.vue +224 -0
- package/config/color.ts +6 -0
- package/config/icon.ts +366 -0
- package/config/index.ts +2 -0
- package/global/index.ts +6 -0
- package/global/register-properties.ts +37 -0
- package/index.ts +8 -0
- package/libs/css/common.scss +0 -0
- package/libs/css/iconfont.css +379 -0
- package/libs/css/iconfont.ttf +0 -0
- package/libs/css/mixin.scss +15 -0
- package/package.json +42 -0
- package/public/icons/error.png +0 -0
- package/public/icons/success.png +0 -0
- package/public/icons/warning.png +0 -0
- package/store/index.ts +1 -0
- package/store/userInfo.ts +25 -0
- package/theme.scss +94 -0
- package/typing/index.ts +7 -0
- package/typing/modules/common.d.ts +50 -0
- package/typing/modules/dialog.ts +17 -0
- package/typing/modules/enum.ts +67 -0
- package/typing/modules/form.ts +161 -0
- package/typing/modules/http.ts +68 -0
- package/typing/modules/icon.d.ts +366 -0
- package/typing/modules/img.ts +15 -0
- package/typing/modules/rect.ts +10 -0
- package/utils/address.json +5890 -0
- package/utils/base64.ts +119 -0
- package/utils/index.ts +3 -0
- package/utils/inside.ts +310 -0
- package/utils/utils.ts +446 -0
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view class="hy-navbar" :style="customStyle">
|
|
3
|
+
<view
|
|
4
|
+
class="hy-navbar__placeholder"
|
|
5
|
+
v-if="fixed && placeholder"
|
|
6
|
+
:style="{
|
|
7
|
+
height: addUnit(getPx(height) + statusBarHeight)
|
|
8
|
+
}"
|
|
9
|
+
></view>
|
|
10
|
+
<view
|
|
11
|
+
:class="[fixed && 'hy-navbar--fixed']"
|
|
12
|
+
:style="{ paddingTop: addUnit(safeAreaInsets?.top) }"
|
|
13
|
+
>
|
|
14
|
+
<view
|
|
15
|
+
:class="[border && 'hy-border-bottom', 'hy-navbar__content']"
|
|
16
|
+
:style="{
|
|
17
|
+
height: addUnit(height),
|
|
18
|
+
backgroundColor: bgColor
|
|
19
|
+
}"
|
|
20
|
+
>
|
|
21
|
+
<view
|
|
22
|
+
class="hy-navbar__content__left"
|
|
23
|
+
hover-class="hy-navbar__content__left--hover"
|
|
24
|
+
hover-start-time="150"
|
|
25
|
+
@tap="leftClick"
|
|
26
|
+
>
|
|
27
|
+
<slot name="left">
|
|
28
|
+
<HyIcon
|
|
29
|
+
v-if="leftIcon"
|
|
30
|
+
:name="leftIcon"
|
|
31
|
+
:size="leftIconSize"
|
|
32
|
+
:color="leftIconColor"
|
|
33
|
+
></HyIcon>
|
|
34
|
+
<text
|
|
35
|
+
v-if="leftText"
|
|
36
|
+
:style="{
|
|
37
|
+
color: leftIconColor
|
|
38
|
+
}"
|
|
39
|
+
class="hy-navbar__content__left__text"
|
|
40
|
+
>{{ leftText }}</text
|
|
41
|
+
>
|
|
42
|
+
</slot>
|
|
43
|
+
</view>
|
|
44
|
+
<slot name="center">
|
|
45
|
+
<view class="hy-navbar__content__center">
|
|
46
|
+
<text
|
|
47
|
+
class="hy-navbar__content__center--title"
|
|
48
|
+
:style="[
|
|
49
|
+
{
|
|
50
|
+
width: addUnit(titleWidth),
|
|
51
|
+
color: titleColor
|
|
52
|
+
},
|
|
53
|
+
titleStyle
|
|
54
|
+
]"
|
|
55
|
+
>{{ title }}</text
|
|
56
|
+
>
|
|
57
|
+
<text
|
|
58
|
+
class="hy-navbar__content__center--sub"
|
|
59
|
+
:style="[
|
|
60
|
+
{
|
|
61
|
+
width: addUnit(titleWidth),
|
|
62
|
+
color: titleColor
|
|
63
|
+
},
|
|
64
|
+
titleStyle
|
|
65
|
+
]"
|
|
66
|
+
>{{ sub }}</text
|
|
67
|
+
>
|
|
68
|
+
</view>
|
|
69
|
+
</slot>
|
|
70
|
+
<view
|
|
71
|
+
class="hy-navbar__content__right"
|
|
72
|
+
v-if="$slots.right || rightIcon || rightText"
|
|
73
|
+
@tap="rightClick"
|
|
74
|
+
>
|
|
75
|
+
<slot name="right">
|
|
76
|
+
<HyIcon v-if="rightIcon" :name="rightIcon" size="20"></HyIcon>
|
|
77
|
+
<text v-if="rightText" class="hy-navbar__content__right__text">{{
|
|
78
|
+
rightText
|
|
79
|
+
}}</text>
|
|
80
|
+
</slot>
|
|
81
|
+
</view>
|
|
82
|
+
</view>
|
|
83
|
+
</view>
|
|
84
|
+
</view>
|
|
85
|
+
</template>
|
|
86
|
+
|
|
87
|
+
<script setup lang="ts">
|
|
88
|
+
import defaultProps from "./props";
|
|
89
|
+
import IProps from "./typing";
|
|
90
|
+
import { addUnit, getPx } from "../../utils";
|
|
91
|
+
|
|
92
|
+
// 组件
|
|
93
|
+
import HyIcon from "../hy-icon/hy-icon.vue";
|
|
94
|
+
|
|
95
|
+
const props = withDefaults(defineProps<IProps>(), defaultProps);
|
|
96
|
+
const emit = defineEmits(["leftClick", "rightClick"]);
|
|
97
|
+
|
|
98
|
+
const { safeAreaInsets } = uni.getSystemSetting();
|
|
99
|
+
const { statusBarHeight } = uni.getWindowInfo();
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* @description 点击左侧区域
|
|
103
|
+
* */
|
|
104
|
+
const leftClick = () => {
|
|
105
|
+
// 如果配置了autoBack,自动返回上一页
|
|
106
|
+
emit("leftClick");
|
|
107
|
+
if (config.interceptor.navbarLeftClick != null) {
|
|
108
|
+
config.interceptor.navbarLeftClick();
|
|
109
|
+
} else {
|
|
110
|
+
if (this.autoBack) {
|
|
111
|
+
uni.navigateBack();
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
};
|
|
115
|
+
/**
|
|
116
|
+
* @description 点击右侧区域
|
|
117
|
+
* */
|
|
118
|
+
const rightClick = () => {
|
|
119
|
+
emit("rightClick");
|
|
120
|
+
};
|
|
121
|
+
</script>
|
|
122
|
+
|
|
123
|
+
<style lang="scss" scoped>
|
|
124
|
+
@import "../../libs/css/mixin.scss";
|
|
125
|
+
@import "../../theme.scss";
|
|
126
|
+
|
|
127
|
+
.hy-navbar {
|
|
128
|
+
&--fixed {
|
|
129
|
+
position: fixed;
|
|
130
|
+
left: 0;
|
|
131
|
+
right: 0;
|
|
132
|
+
top: 0;
|
|
133
|
+
z-index: 11;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
&__content {
|
|
137
|
+
@include flex(row);
|
|
138
|
+
align-items: center;
|
|
139
|
+
height: 44px;
|
|
140
|
+
background-color: #9acafc;
|
|
141
|
+
position: relative;
|
|
142
|
+
justify-content: center;
|
|
143
|
+
|
|
144
|
+
&__left,
|
|
145
|
+
&__right {
|
|
146
|
+
padding: 0 13px;
|
|
147
|
+
position: absolute;
|
|
148
|
+
top: 0;
|
|
149
|
+
bottom: 0;
|
|
150
|
+
@include flex(row);
|
|
151
|
+
align-items: center;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
&__left {
|
|
155
|
+
left: 0;
|
|
156
|
+
|
|
157
|
+
&--hover {
|
|
158
|
+
opacity: 0.7;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
&__text {
|
|
162
|
+
font-size: 15px;
|
|
163
|
+
margin-left: 3px;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
&__center {
|
|
168
|
+
display: flex;
|
|
169
|
+
flex-direction: column;
|
|
170
|
+
text-align: center;
|
|
171
|
+
&--title {
|
|
172
|
+
font-size: $hy-font-size-subtitle;
|
|
173
|
+
color: $hy-color-title;
|
|
174
|
+
}
|
|
175
|
+
&--sub {
|
|
176
|
+
font-size: $hy-font-size-hint;
|
|
177
|
+
color: $hy-color-hint;
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
&__right {
|
|
182
|
+
right: 0;
|
|
183
|
+
|
|
184
|
+
&__text {
|
|
185
|
+
font-size: 15px;
|
|
186
|
+
margin-left: 3px;
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
.hy-border-bottom {
|
|
192
|
+
border-bottom: $hy-border-line;
|
|
193
|
+
}
|
|
194
|
+
</style>
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import IProps from "./typing";
|
|
2
|
+
import { IconConfig } from "../../config";
|
|
3
|
+
|
|
4
|
+
const defaultProps: IProps = {
|
|
5
|
+
safeAreaInsetTop: true,
|
|
6
|
+
placeholder: false,
|
|
7
|
+
fixed: true,
|
|
8
|
+
border: false,
|
|
9
|
+
leftIcon: IconConfig.LEFT,
|
|
10
|
+
leftText: "",
|
|
11
|
+
rightText: "",
|
|
12
|
+
rightIcon: "",
|
|
13
|
+
title: "",
|
|
14
|
+
sub: "",
|
|
15
|
+
titleColor: "",
|
|
16
|
+
bgColor: "#ffffff",
|
|
17
|
+
titleWidth: "400rpx",
|
|
18
|
+
height: "44px",
|
|
19
|
+
leftIconSize: 20,
|
|
20
|
+
leftIconColor: "",
|
|
21
|
+
autoBack: false
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export default defaultProps;
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { CSSProperties } from "vue";
|
|
2
|
+
import { IconConfig } from "../../config";
|
|
3
|
+
|
|
4
|
+
export default interface IProps {
|
|
5
|
+
/**
|
|
6
|
+
* @description 是否开启顶部安全区适配 (默认 true )
|
|
7
|
+
* */
|
|
8
|
+
safeAreaInsetTop?: boolean;
|
|
9
|
+
/**
|
|
10
|
+
* @description 固定在顶部时,是否生成一个等高元素,以防止塌陷 (默认 false )
|
|
11
|
+
* */
|
|
12
|
+
placeholder?: boolean;
|
|
13
|
+
/**
|
|
14
|
+
* @description 导航栏是否固定在顶部 (默认 true )
|
|
15
|
+
* */
|
|
16
|
+
fixed?: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* @description 导航栏底部是否显示下边框 (默认 false )
|
|
19
|
+
* */
|
|
20
|
+
border?: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* @description 左边返回图标的名称,只能为uview-pls自带的图标 (默认 'left' )
|
|
23
|
+
* */
|
|
24
|
+
leftIcon?: string;
|
|
25
|
+
/**
|
|
26
|
+
* @description 左边的提示文字
|
|
27
|
+
* */
|
|
28
|
+
leftText?: string;
|
|
29
|
+
/**
|
|
30
|
+
* @description 右边的提示文字
|
|
31
|
+
* */
|
|
32
|
+
rightText?: string;
|
|
33
|
+
/**
|
|
34
|
+
* @description 右边返回图标的名称,只能为uview-plus自带的图标
|
|
35
|
+
* */
|
|
36
|
+
rightIcon?: string;
|
|
37
|
+
/**
|
|
38
|
+
* @description 导航栏标题,如设置为空字符,将会隐藏标题占位区域
|
|
39
|
+
* */
|
|
40
|
+
title?: string;
|
|
41
|
+
/**
|
|
42
|
+
* @description 导航栏副标题
|
|
43
|
+
* */
|
|
44
|
+
sub?: string;
|
|
45
|
+
/**
|
|
46
|
+
* @description 文字颜色 (默认 '' )
|
|
47
|
+
* */
|
|
48
|
+
titleColor?: string;
|
|
49
|
+
/**
|
|
50
|
+
* @description 导航栏背景设置 (默认 '#ffffff' )
|
|
51
|
+
* */
|
|
52
|
+
bgColor?: string;
|
|
53
|
+
/**
|
|
54
|
+
* @description 导航栏标题的最大宽度,内容超出会以省略号隐藏 (默认 '400rpx' )
|
|
55
|
+
* */
|
|
56
|
+
titleWidth?: string | number;
|
|
57
|
+
/**
|
|
58
|
+
* @description 导航栏高度(不包括状态栏高度在内,内部自动加上)(默认 '44px' )
|
|
59
|
+
* */
|
|
60
|
+
height?: string | number;
|
|
61
|
+
/**
|
|
62
|
+
* @description 左侧返回图标的大小(默认 20px )
|
|
63
|
+
* */
|
|
64
|
+
leftIconSize?: string | number;
|
|
65
|
+
/**
|
|
66
|
+
* @description 左侧返回图标的颜色(默认 #303133 )
|
|
67
|
+
* */
|
|
68
|
+
leftIconColor?: string;
|
|
69
|
+
/**
|
|
70
|
+
* @description 点击左侧区域(返回图标),是否自动返回上一页(默认 false )
|
|
71
|
+
* */
|
|
72
|
+
autoBack?: boolean;
|
|
73
|
+
/**
|
|
74
|
+
* @description 标题的样式,对象或字符串
|
|
75
|
+
* */
|
|
76
|
+
titleStyle?: CSSProperties;
|
|
77
|
+
/**
|
|
78
|
+
* @description 定义需要用到的外部样式
|
|
79
|
+
* */
|
|
80
|
+
customStyle?: CSSProperties;
|
|
81
|
+
}
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view class="hy-notice" @tap="clickHandler">
|
|
3
|
+
<slot name="icon">
|
|
4
|
+
<view class="hy-notice__left-icon" v-if="icon">
|
|
5
|
+
<HyIcon :name="icon" :color="color" size="19"></HyIcon>
|
|
6
|
+
<!-- <HyIcon :name="icon" :color="color" size="19"></HyIcon>-->
|
|
7
|
+
</view>
|
|
8
|
+
</slot>
|
|
9
|
+
<swiper
|
|
10
|
+
:disable-touch="disableTouch"
|
|
11
|
+
:vertical="step ? false : true"
|
|
12
|
+
circular
|
|
13
|
+
:interval="duration"
|
|
14
|
+
:autoplay="true"
|
|
15
|
+
class="hy-notice__swiper"
|
|
16
|
+
@change="noticeChange"
|
|
17
|
+
>
|
|
18
|
+
<swiper-item
|
|
19
|
+
v-for="(item, index) in text"
|
|
20
|
+
:key="index"
|
|
21
|
+
class="hy-notice__swiper__item"
|
|
22
|
+
:style="{ justifyContent: justifyContent }"
|
|
23
|
+
>
|
|
24
|
+
<text class="hy-notice__swiper__item__text" :style="[textStyle]">{{
|
|
25
|
+
item
|
|
26
|
+
}}</text>
|
|
27
|
+
</swiper-item>
|
|
28
|
+
</swiper>
|
|
29
|
+
<view
|
|
30
|
+
class="hy-notice__right-icon"
|
|
31
|
+
v-if="['link', 'closable'].includes(mode)"
|
|
32
|
+
>
|
|
33
|
+
<HyIcon
|
|
34
|
+
v-if="mode === 'link'"
|
|
35
|
+
:name="IconConfig.RIGHT"
|
|
36
|
+
:size="17"
|
|
37
|
+
:color="color"
|
|
38
|
+
></HyIcon>
|
|
39
|
+
<HyIcon
|
|
40
|
+
v-if="mode === 'closable'"
|
|
41
|
+
:name="IconConfig.CLOSE"
|
|
42
|
+
:size="16"
|
|
43
|
+
:color="color"
|
|
44
|
+
@click="close"
|
|
45
|
+
></HyIcon>
|
|
46
|
+
</view>
|
|
47
|
+
</view>
|
|
48
|
+
</template>
|
|
49
|
+
|
|
50
|
+
<script setup lang="ts">
|
|
51
|
+
import { CSSProperties, toRefs, computed, ref } from "vue";
|
|
52
|
+
import IProps from "./typing";
|
|
53
|
+
import defaultProps from "./props";
|
|
54
|
+
import { addUnit } from "../../utils";
|
|
55
|
+
import { IconConfig } from "../../config";
|
|
56
|
+
|
|
57
|
+
import HyIcon from "../hy-icon/hy-icon.vue";
|
|
58
|
+
|
|
59
|
+
const props = withDefaults(defineProps<IProps>(), defaultProps);
|
|
60
|
+
const { text, fontSize, color } = toRefs(props);
|
|
61
|
+
const emit = defineEmits(["click", "close"]);
|
|
62
|
+
|
|
63
|
+
const index = ref(0);
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* @description 文字内容的样式
|
|
67
|
+
* */
|
|
68
|
+
const textStyle = computed<CSSProperties>(() => {
|
|
69
|
+
let style: CSSProperties = {};
|
|
70
|
+
style.color = color.value;
|
|
71
|
+
style.fontSize = addUnit(fontSize.value);
|
|
72
|
+
return style;
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
const noticeChange = (e: any) => {
|
|
76
|
+
index.value = e.detail.current;
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* @description 点击通告栏
|
|
81
|
+
* */
|
|
82
|
+
const clickHandler = (index: number) => {
|
|
83
|
+
emit("click", index);
|
|
84
|
+
};
|
|
85
|
+
/**
|
|
86
|
+
* @description 点击关闭按钮
|
|
87
|
+
* */
|
|
88
|
+
const close = () => {
|
|
89
|
+
emit("close");
|
|
90
|
+
};
|
|
91
|
+
</script>
|
|
92
|
+
|
|
93
|
+
<style lang="scss" scoped>
|
|
94
|
+
@import "../../libs/css/mixin.scss";
|
|
95
|
+
@import "../../theme.scss";
|
|
96
|
+
|
|
97
|
+
.hy-notice {
|
|
98
|
+
@include flex;
|
|
99
|
+
align-items: center;
|
|
100
|
+
justify-content: space-between;
|
|
101
|
+
|
|
102
|
+
&__left-icon {
|
|
103
|
+
align-items: center;
|
|
104
|
+
margin-right: 5px;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
&__right-icon {
|
|
108
|
+
margin-left: 5px;
|
|
109
|
+
align-items: center;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
&__swiper {
|
|
113
|
+
height: 16px;
|
|
114
|
+
@include flex;
|
|
115
|
+
align-items: center;
|
|
116
|
+
flex: 1;
|
|
117
|
+
|
|
118
|
+
&__item {
|
|
119
|
+
@include flex;
|
|
120
|
+
align-items: center;
|
|
121
|
+
overflow: hidden;
|
|
122
|
+
|
|
123
|
+
&__text {
|
|
124
|
+
font-size: 14px;
|
|
125
|
+
color: $hy-warning;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
</style>
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view
|
|
3
|
+
class="u-notice-bar"
|
|
4
|
+
v-if="show"
|
|
5
|
+
:style="[
|
|
6
|
+
{
|
|
7
|
+
backgroundColor: bgColor
|
|
8
|
+
},
|
|
9
|
+
customStyle
|
|
10
|
+
]"
|
|
11
|
+
>
|
|
12
|
+
<template v-if="direction === 'column' || (direction === 'row' && step)">
|
|
13
|
+
<HyColumnNotice
|
|
14
|
+
:color="color"
|
|
15
|
+
:bgColor="bgColor"
|
|
16
|
+
:text="text"
|
|
17
|
+
:mode="mode"
|
|
18
|
+
:step="step"
|
|
19
|
+
:icon="icon"
|
|
20
|
+
:disable-touch="disableTouch"
|
|
21
|
+
:fontSize="fontSize"
|
|
22
|
+
:duration="duration"
|
|
23
|
+
:justifyContent="justifyContent"
|
|
24
|
+
@close="close"
|
|
25
|
+
@click="click"
|
|
26
|
+
></HyColumnNotice>
|
|
27
|
+
</template>
|
|
28
|
+
<template v-else>
|
|
29
|
+
<HyRowNotice
|
|
30
|
+
:color="color"
|
|
31
|
+
:bgColor="bgColor"
|
|
32
|
+
:text="text"
|
|
33
|
+
:mode="mode"
|
|
34
|
+
:fontSize="fontSize"
|
|
35
|
+
:speed="speed"
|
|
36
|
+
:url="url"
|
|
37
|
+
:linkType="linkType"
|
|
38
|
+
:icon="icon"
|
|
39
|
+
@close="close"
|
|
40
|
+
@click="click"
|
|
41
|
+
></HyRowNotice>
|
|
42
|
+
</template>
|
|
43
|
+
</view>
|
|
44
|
+
</template>
|
|
45
|
+
|
|
46
|
+
<script setup lang="ts">
|
|
47
|
+
import { ref } from "vue";
|
|
48
|
+
import defaultProps from "./props";
|
|
49
|
+
import IProps from "./typing";
|
|
50
|
+
// 组件
|
|
51
|
+
import HyRowNotice from "./hy-row-notice.vue";
|
|
52
|
+
import HyColumnNotice from "./hy-column-notice.vue";
|
|
53
|
+
|
|
54
|
+
const show = ref(true);
|
|
55
|
+
|
|
56
|
+
const props = withDefaults(defineProps<IProps>(), defaultProps);
|
|
57
|
+
const emit = defineEmits(["click", "close"]);
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* @description 点击通告栏
|
|
61
|
+
* */
|
|
62
|
+
const click = (index: number) => {
|
|
63
|
+
emit("click", index);
|
|
64
|
+
};
|
|
65
|
+
/**
|
|
66
|
+
* @description 点击关闭按钮
|
|
67
|
+
* */
|
|
68
|
+
const close = () => {
|
|
69
|
+
show.value = false;
|
|
70
|
+
emit("close");
|
|
71
|
+
};
|
|
72
|
+
</script>
|
|
73
|
+
|
|
74
|
+
<style lang="scss" scoped>
|
|
75
|
+
@import "../../libs/css/mixin.scss";
|
|
76
|
+
|
|
77
|
+
.u-notice-bar {
|
|
78
|
+
overflow: hidden;
|
|
79
|
+
padding: 9px 12px;
|
|
80
|
+
flex: 1;
|
|
81
|
+
}
|
|
82
|
+
</style>
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view class="hy-notice" @tap="clickHandler">
|
|
3
|
+
<slot name="icon">
|
|
4
|
+
<view class="hy-notice__left-icon" v-if="icon">
|
|
5
|
+
<HyIcon :name="icon" :color="color" size="19"></HyIcon>
|
|
6
|
+
</view>
|
|
7
|
+
</slot>
|
|
8
|
+
<view class="hy-notice__content" ref="hy-notice__content">
|
|
9
|
+
<view
|
|
10
|
+
ref="hy-notice__content__text"
|
|
11
|
+
class="hy-notice__content__text"
|
|
12
|
+
:style="animationStyle"
|
|
13
|
+
>
|
|
14
|
+
<text
|
|
15
|
+
v-for="(item, index) in innerText"
|
|
16
|
+
:key="index"
|
|
17
|
+
:style="textStyle"
|
|
18
|
+
>{{ item }}</text
|
|
19
|
+
>
|
|
20
|
+
</view>
|
|
21
|
+
</view>
|
|
22
|
+
<view
|
|
23
|
+
class="hy-notice__right-icon"
|
|
24
|
+
v-if="['link', 'closable'].includes(mode)"
|
|
25
|
+
>
|
|
26
|
+
<HyIcon
|
|
27
|
+
v-if="mode === 'link'"
|
|
28
|
+
:name="IconConfig.RIGHT"
|
|
29
|
+
:size="17"
|
|
30
|
+
:color="color"
|
|
31
|
+
></HyIcon>
|
|
32
|
+
<HyIcon
|
|
33
|
+
v-if="mode === 'closable'"
|
|
34
|
+
@click="close"
|
|
35
|
+
:name="IconConfig.CLOSE"
|
|
36
|
+
:size="16"
|
|
37
|
+
:color="color"
|
|
38
|
+
></HyIcon>
|
|
39
|
+
</view>
|
|
40
|
+
</view>
|
|
41
|
+
</template>
|
|
42
|
+
|
|
43
|
+
<script setup lang="ts">
|
|
44
|
+
import { ref, watch, toRefs, computed, CSSProperties } from "vue";
|
|
45
|
+
import IProps from "./typing";
|
|
46
|
+
import defaultProps from "./props";
|
|
47
|
+
import { addUnit, getRect, sleep } from "../../utils";
|
|
48
|
+
import { IconConfig } from "../../config";
|
|
49
|
+
|
|
50
|
+
import HyIcon from "../hy-icon/hy-icon.vue";
|
|
51
|
+
|
|
52
|
+
const props = withDefaults(defineProps<IProps>(), defaultProps);
|
|
53
|
+
const { text, speed, fontSize, color } = toRefs(props);
|
|
54
|
+
const emit = defineEmits(["click", "close"]);
|
|
55
|
+
|
|
56
|
+
const animationDuration = ref<string>("0"); // 动画执行时间
|
|
57
|
+
const animationPlayState = ref<string>("paused"); // 动画的开始和结束执行
|
|
58
|
+
const initValue = ref<string>("");
|
|
59
|
+
|
|
60
|
+
watch(
|
|
61
|
+
() => text.value,
|
|
62
|
+
async (newValue) => {
|
|
63
|
+
if (Array.isArray(newValue)) initValue.value = newValue.join(",");
|
|
64
|
+
let boxWidth = 0,
|
|
65
|
+
textWidth = 0;
|
|
66
|
+
// 进行一定的延时
|
|
67
|
+
await sleep();
|
|
68
|
+
// 查询盒子和文字的宽度
|
|
69
|
+
textWidth = (await getRect(".hy-notice__content__text")).width;
|
|
70
|
+
boxWidth = (await getRect(".hy-notice__content")).width;
|
|
71
|
+
// 根据t=s/v(时间=路程/速度),这里为何不需要加上#u-notice-box的宽度,因为中设置了.u-notice-content样式中设置了padding-left: 100%
|
|
72
|
+
// 恰巧计算出来的结果中已经包含了#u-notice-box的宽度
|
|
73
|
+
animationDuration.value = `${textWidth / speed.value}s`;
|
|
74
|
+
// 这里必须这样开始动画,否则在APP上动画速度不会改变
|
|
75
|
+
animationPlayState.value = "paused";
|
|
76
|
+
await sleep(10);
|
|
77
|
+
animationPlayState.value = "running";
|
|
78
|
+
},
|
|
79
|
+
{ immediate: true }
|
|
80
|
+
);
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* @description 文字内容的样式
|
|
84
|
+
* */
|
|
85
|
+
const textStyle = computed<CSSProperties>(() => {
|
|
86
|
+
let style: CSSProperties = {};
|
|
87
|
+
style.whiteSpace = "nowrap !important";
|
|
88
|
+
style.color = color.value;
|
|
89
|
+
style.fontSize = addUnit(fontSize.value);
|
|
90
|
+
return style;
|
|
91
|
+
});
|
|
92
|
+
/**
|
|
93
|
+
* @description 动画的样式
|
|
94
|
+
* */
|
|
95
|
+
const animationStyle = computed<CSSProperties>(() => {
|
|
96
|
+
let style: CSSProperties = {};
|
|
97
|
+
style.animationDuration = animationDuration.value;
|
|
98
|
+
style.animationPlayState = animationPlayState.value;
|
|
99
|
+
return style;
|
|
100
|
+
});
|
|
101
|
+
// 内部对用户传入的数据进一步分割,放到多个text标签循环,否则如果用户传入的字符串很长(100个字符以上)
|
|
102
|
+
// 放在一个text标签中进行滚动,在低端安卓机上,动画可能会出现抖动现象,需要分割到多个text中可解决此问题
|
|
103
|
+
const innerText = computed(() => {
|
|
104
|
+
let result = [],
|
|
105
|
+
// 每组text标签的字符长度
|
|
106
|
+
len = 20;
|
|
107
|
+
const textArr = initValue.value.split("");
|
|
108
|
+
for (let i = 0; i < textArr.length; i += len) {
|
|
109
|
+
// 对拆分的后的text进行slice分割,得到的为数组再进行join拼接为字符串
|
|
110
|
+
result.push(textArr.slice(i, i + len).join(""));
|
|
111
|
+
}
|
|
112
|
+
return result;
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* @description 点击通告栏
|
|
117
|
+
* */
|
|
118
|
+
const clickHandler = (index: number) => {
|
|
119
|
+
emit("click", index);
|
|
120
|
+
};
|
|
121
|
+
/**
|
|
122
|
+
* @description 点击关闭按钮
|
|
123
|
+
* */
|
|
124
|
+
const close = () => {
|
|
125
|
+
emit("close");
|
|
126
|
+
};
|
|
127
|
+
</script>
|
|
128
|
+
|
|
129
|
+
<style lang="scss" scoped>
|
|
130
|
+
@import "../../libs/css/mixin.scss";
|
|
131
|
+
@import "../../theme.scss";
|
|
132
|
+
|
|
133
|
+
.hy-notice {
|
|
134
|
+
@include flex;
|
|
135
|
+
align-items: center;
|
|
136
|
+
justify-content: space-between;
|
|
137
|
+
|
|
138
|
+
&__left-icon {
|
|
139
|
+
align-items: center;
|
|
140
|
+
margin-right: 5px;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
&__right-icon {
|
|
144
|
+
margin-left: 5px;
|
|
145
|
+
align-items: center;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
&__content {
|
|
149
|
+
text-align: right;
|
|
150
|
+
flex: 1;
|
|
151
|
+
@include flex;
|
|
152
|
+
flex-wrap: nowrap;
|
|
153
|
+
overflow: hidden;
|
|
154
|
+
|
|
155
|
+
&__text {
|
|
156
|
+
font-size: 14px;
|
|
157
|
+
color: $hy-warning;
|
|
158
|
+
/* #ifndef APP-NVUE */
|
|
159
|
+
// 这一句很重要,为了能让滚动左右连接起来
|
|
160
|
+
padding-left: 100%;
|
|
161
|
+
word-break: keep-all;
|
|
162
|
+
white-space: nowrap;
|
|
163
|
+
animation: hy-loop-animation 10s linear infinite both;
|
|
164
|
+
/* #endif */
|
|
165
|
+
@include flex(row);
|
|
166
|
+
line-height: 100%;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
/* #ifndef APP-NVUE */
|
|
172
|
+
@keyframes hy-loop-animation {
|
|
173
|
+
0% {
|
|
174
|
+
transform: translate3d(0, 0, 0);
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
100% {
|
|
178
|
+
transform: translate3d(-100%, 0, 0);
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
/* #endif */
|
|
182
|
+
</style>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import IProps from "./typing";
|
|
2
|
+
import { IconConfig } from "../../config";
|
|
3
|
+
|
|
4
|
+
const defaultProps: IProps = {
|
|
5
|
+
text: [],
|
|
6
|
+
direction: "row",
|
|
7
|
+
step: false,
|
|
8
|
+
icon: IconConfig.NOTIFICATION_FILL,
|
|
9
|
+
mode: "",
|
|
10
|
+
color: "#f9ae3d",
|
|
11
|
+
bgColor: "#fdf6ec",
|
|
12
|
+
speed: 80,
|
|
13
|
+
fontSize: 14,
|
|
14
|
+
duration: 2000,
|
|
15
|
+
disableTouch: true,
|
|
16
|
+
justifyContent: "flex-start"
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export default defaultProps;
|