@kaiyinchem/ky-uniui 1.0.3
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 +10 -0
- package/components/ky-btn.vue +453 -0
- package/components/ky-cell.vue +457 -0
- package/components/ky-checkbox.vue +93 -0
- package/components/ky-countnum.vue +232 -0
- package/components/ky-countto.vue +130 -0
- package/components/ky-empty.vue +53 -0
- package/components/ky-fetch.vue +339 -0
- package/components/ky-head.vue +292 -0
- package/components/ky-highlight-keywords.vue +229 -0
- package/components/ky-loading.vue +64 -0
- package/components/ky-nologin.vue +47 -0
- package/components/ky-phone.vue +86 -0
- package/components/ky-picker.vue +211 -0
- package/components/ky-pop.vue +642 -0
- package/components/ky-price.vue +97 -0
- package/components/ky-radio.vue +80 -0
- package/components/ky-search-history.vue +231 -0
- package/components/ky-smscode.vue +70 -0
- package/components/ky-swiper.vue +348 -0
- package/components/ky-switch.vue +159 -0
- package/components/ky-tab.vue +214 -0
- package/components/ky-upload.vue +191 -0
- package/package.json +28 -0
- package/style/var.css +85 -0
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
<!--价格展示组件,2022-10-10-->
|
|
2
|
+
<template>
|
|
3
|
+
<view class="ky-price-wrap">
|
|
4
|
+
<view v-if="Number(data.unitPrice) > 0 && Number(data.priceType) !== 3" class="ky-price-main">
|
|
5
|
+
<view class="ky-price-text price-color">
|
|
6
|
+
<text class="ky-price-symbol">¥</text>
|
|
7
|
+
<text :style="{ 'font-size': fontSize + 'rpx' }" class="ky-price-num">{{ data.unitPrice }}</text>
|
|
8
|
+
<text v-if="data.unitName || data.unit || data.skuUnitName" class="ky-price-name">/{{ data.unitName || data.unit || data.skuUnitName }}</text>
|
|
9
|
+
</view>
|
|
10
|
+
<view v-if="Number(data.priceTrend) < 0" class="ky-price-trend price-trend-down">
|
|
11
|
+
<text class="iconfont"></text>
|
|
12
|
+
<text>{{ data.priceTrend }}%</text>
|
|
13
|
+
</view>
|
|
14
|
+
<view v-if="Number(data.priceTrend) > 0" class="ky-price-trend price-trend-up">
|
|
15
|
+
<text class="iconfont"></text>
|
|
16
|
+
<text>{{ data.priceTrend }}%</text>
|
|
17
|
+
</view>
|
|
18
|
+
<view v-if="Number(data.priceTrend) === 0" class="ky-price-trend price-trend-none gray-color">
|
|
19
|
+
<text class="iconfont" style="transform: rotate(90deg);"></text>
|
|
20
|
+
<text>{{ data.priceTrend }}%</text>
|
|
21
|
+
</view>
|
|
22
|
+
</view>
|
|
23
|
+
<view
|
|
24
|
+
v-if="Number(data.unitPrice) <= 0 || Number(data.priceType) === 3"
|
|
25
|
+
:style="{ 'font-size': (fontSize * 0.8) + 'rpx' }"
|
|
26
|
+
>
|
|
27
|
+
<text v-if="Number(data.unitPrice) <= 0 && Number(data.priceType) !== 3" class="ky-price-invalid gray-color">暂无报价</text>
|
|
28
|
+
<text v-else class="ky-price-callphone price-color">来电询价</text>
|
|
29
|
+
</view>
|
|
30
|
+
</view>
|
|
31
|
+
</template>
|
|
32
|
+
|
|
33
|
+
<script>
|
|
34
|
+
export default {
|
|
35
|
+
props: {
|
|
36
|
+
/**
|
|
37
|
+
* 价格对象data
|
|
38
|
+
* @property { Number } data.unitPrice 价格
|
|
39
|
+
*/
|
|
40
|
+
data: {
|
|
41
|
+
type: Object,
|
|
42
|
+
default: () => {
|
|
43
|
+
return {
|
|
44
|
+
unitPrice: 0, // 单位价格
|
|
45
|
+
unitName: '', // 单位名称
|
|
46
|
+
priceTrend: NaN, // 价格涨跌,百分比
|
|
47
|
+
priceType: 0, // 价格类型,为3显示来电询价
|
|
48
|
+
skuUnitName: '',
|
|
49
|
+
unit: ''
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
fontSize: {
|
|
54
|
+
type: Number,
|
|
55
|
+
default: 28
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
data() {
|
|
59
|
+
return {
|
|
60
|
+
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
</script>
|
|
65
|
+
|
|
66
|
+
<style scoped lang="scss">
|
|
67
|
+
.ky-price-wrap {
|
|
68
|
+
display: flex;
|
|
69
|
+
align-items: center;
|
|
70
|
+
.ky-price-main {
|
|
71
|
+
display: flex;
|
|
72
|
+
align-items: center;
|
|
73
|
+
.ky-price-num {
|
|
74
|
+
font-weight: bold;
|
|
75
|
+
font-size: 32rpx;
|
|
76
|
+
}
|
|
77
|
+
.ky-price-name, .ky-price-symbol {
|
|
78
|
+
font-size: 24rpx;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
.ky-price-trend {
|
|
82
|
+
display: flex;
|
|
83
|
+
align-items: center;
|
|
84
|
+
margin-left: 12rpx;
|
|
85
|
+
.iconfont {
|
|
86
|
+
display: inline-block;
|
|
87
|
+
margin-right: 12rpx;
|
|
88
|
+
}
|
|
89
|
+
&.price-trend-down {
|
|
90
|
+
color: #07d007;
|
|
91
|
+
}
|
|
92
|
+
&.price-trend-up {
|
|
93
|
+
color: #ff201c;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
</style>
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
<!--radio组件 2020-9-28 zzc添加-->
|
|
2
|
+
<template>
|
|
3
|
+
<view
|
|
4
|
+
:class="{ small: size === 'small', large: size === 'large', normal: size === 'normal' }"
|
|
5
|
+
class="ky-radiocheck"
|
|
6
|
+
@click="$emit('click')"
|
|
7
|
+
>
|
|
8
|
+
<text v-if="!active" class="no iconfont" ></text>
|
|
9
|
+
<text v-else class="primary-color yes iconfont"></text>
|
|
10
|
+
<text v-if="label" :class="{ 'primary-color': active }" class="check-label">{{ label }}</text>
|
|
11
|
+
</view>
|
|
12
|
+
</template>
|
|
13
|
+
|
|
14
|
+
<script>
|
|
15
|
+
export default {
|
|
16
|
+
emits: ['click'],
|
|
17
|
+
props: {
|
|
18
|
+
checked: {
|
|
19
|
+
type: [Boolean, Number],
|
|
20
|
+
default: false,
|
|
21
|
+
},
|
|
22
|
+
label: {
|
|
23
|
+
type: String,
|
|
24
|
+
default: ''
|
|
25
|
+
},
|
|
26
|
+
// small, normal, large
|
|
27
|
+
size: {
|
|
28
|
+
type: String,
|
|
29
|
+
default: 'normal'
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
data() {
|
|
33
|
+
return {
|
|
34
|
+
active: false
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
mounted() {
|
|
38
|
+
this.active = this.checked
|
|
39
|
+
},
|
|
40
|
+
watch: {
|
|
41
|
+
checked(v) {
|
|
42
|
+
this.active = v
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
}
|
|
46
|
+
</script>
|
|
47
|
+
|
|
48
|
+
<style scoped lang="scss">
|
|
49
|
+
.ky-radiocheck {
|
|
50
|
+
display: flex;
|
|
51
|
+
align-items: center;
|
|
52
|
+
&.small {
|
|
53
|
+
.iconfont {
|
|
54
|
+
font-size: 34rpx;
|
|
55
|
+
}
|
|
56
|
+
.check-label {
|
|
57
|
+
font-size: 24rpx;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
&.large {
|
|
61
|
+
.iconfont {
|
|
62
|
+
font-size: 60rpx;
|
|
63
|
+
}
|
|
64
|
+
.check-label {
|
|
65
|
+
font-size: 32rpx;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
.iconfont {
|
|
69
|
+
display: inline-block;
|
|
70
|
+
font-size: 40rpx;
|
|
71
|
+
&.no {
|
|
72
|
+
color: var(--border-2);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
.check-label {
|
|
76
|
+
display: inline-block;
|
|
77
|
+
margin-left: 12rpx;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
</style>
|
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view class="ky-search-history">
|
|
3
|
+
<!-- #ifdef MP-WEIXIN -->
|
|
4
|
+
<view class="ky-search-top">
|
|
5
|
+
<view class="ky-search-box">
|
|
6
|
+
<view class="ky-search-main flex-start">
|
|
7
|
+
<text class="iconfont gray-color"></text>
|
|
8
|
+
<input
|
|
9
|
+
v-model="str"
|
|
10
|
+
:placeholder="placeholder"
|
|
11
|
+
:auto-focus="autoFocus"
|
|
12
|
+
type="text"
|
|
13
|
+
class="ky-search-input"
|
|
14
|
+
@confirm="handleSearch"
|
|
15
|
+
@focus="handleFocus"
|
|
16
|
+
@input="handleInput"
|
|
17
|
+
/>
|
|
18
|
+
<text v-if="str" class="iconfont gray-color ky-search-clear" @click.stop="handleClear"></text>
|
|
19
|
+
</view>
|
|
20
|
+
<ky-btn width="150rpx" height="75rpx" radius="0" size="small" @click="handleSearch">搜索</ky-btn>
|
|
21
|
+
</view>
|
|
22
|
+
</view>
|
|
23
|
+
<!-- #endif -->
|
|
24
|
+
|
|
25
|
+
<!--历史展示-->
|
|
26
|
+
<view v-if="historyList.length && state" class="ky-search-history-wrap white-bg">
|
|
27
|
+
<view class="ky-search-history-main">
|
|
28
|
+
<view class="ky-search-history-head">
|
|
29
|
+
<text class="ky-search-history-title">搜索历史</text>
|
|
30
|
+
<text class="iconfont" @click="clearHistory"></text>
|
|
31
|
+
</view>
|
|
32
|
+
<view class="ky-search-history-list">
|
|
33
|
+
<view v-for="(item, index) in historyList" :key="index" class="ky-search-history-item" @click="selectKeyword(item)">
|
|
34
|
+
<text class="ky-search-history-name">{{ item }}</text>
|
|
35
|
+
<text class="iconfont" @click.stop="clearSignle(index)"></text>
|
|
36
|
+
</view>
|
|
37
|
+
</view>
|
|
38
|
+
</view>
|
|
39
|
+
</view>
|
|
40
|
+
<!--end历史展示-->
|
|
41
|
+
</view>
|
|
42
|
+
</template>
|
|
43
|
+
|
|
44
|
+
<script>
|
|
45
|
+
export default {
|
|
46
|
+
emits: ['select', 'search'],
|
|
47
|
+
props: {
|
|
48
|
+
keyword: {
|
|
49
|
+
type: String,
|
|
50
|
+
default: ''
|
|
51
|
+
},
|
|
52
|
+
visible: {
|
|
53
|
+
type: Boolean,
|
|
54
|
+
default: false,
|
|
55
|
+
},
|
|
56
|
+
autoFocus: {
|
|
57
|
+
type: Boolean,
|
|
58
|
+
default: false,
|
|
59
|
+
},
|
|
60
|
+
// 本地存储的键名
|
|
61
|
+
keyName: {
|
|
62
|
+
type: String,
|
|
63
|
+
default: ''
|
|
64
|
+
},
|
|
65
|
+
placeholder: {
|
|
66
|
+
type: String,
|
|
67
|
+
default: '请输入关键词'
|
|
68
|
+
},
|
|
69
|
+
},
|
|
70
|
+
data() {
|
|
71
|
+
return {
|
|
72
|
+
str: '',
|
|
73
|
+
historyList: [],
|
|
74
|
+
state: false,
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
watch: {
|
|
78
|
+
keyword(val) {
|
|
79
|
+
this.str = val
|
|
80
|
+
},
|
|
81
|
+
visible(val) {
|
|
82
|
+
this.state = val
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
computed: {
|
|
86
|
+
keyStr() {
|
|
87
|
+
return `${this.keyName}KeywordsHistory`
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
mounted() {
|
|
91
|
+
const loaclKeywords = uni.getStorageSync(this.keyStr) || []
|
|
92
|
+
this.str = this.keyword
|
|
93
|
+
this.state = this.visible
|
|
94
|
+
this.historyList = loaclKeywords.reverse()
|
|
95
|
+
},
|
|
96
|
+
methods: {
|
|
97
|
+
show() {
|
|
98
|
+
this.state = true
|
|
99
|
+
},
|
|
100
|
+
hide() {
|
|
101
|
+
this.state = false
|
|
102
|
+
},
|
|
103
|
+
save() {
|
|
104
|
+
const hasSame = this.historyList.some(e => e === this.str)
|
|
105
|
+
if (!hasSame) {
|
|
106
|
+
this.historyList.push(this.str)
|
|
107
|
+
this.$db.set(this.keyStr, this.historyList)
|
|
108
|
+
}
|
|
109
|
+
this.state = false
|
|
110
|
+
uni.hideKeyboard()
|
|
111
|
+
},
|
|
112
|
+
handleClear() {
|
|
113
|
+
this.str = undefined
|
|
114
|
+
this.state = false
|
|
115
|
+
},
|
|
116
|
+
handleSearch() {
|
|
117
|
+
this.$emit('search', this.str)
|
|
118
|
+
},
|
|
119
|
+
handleInput() {
|
|
120
|
+
this.$emit('update:keyword', this.str)
|
|
121
|
+
},
|
|
122
|
+
handleFocus() {
|
|
123
|
+
if (!this.str) {
|
|
124
|
+
this.state = true
|
|
125
|
+
}
|
|
126
|
+
},
|
|
127
|
+
selectKeyword(str) {
|
|
128
|
+
this.str = str
|
|
129
|
+
this.$emit('select', str)
|
|
130
|
+
},
|
|
131
|
+
clearSignle(index) {
|
|
132
|
+
this.historyList.splice(index, 1)
|
|
133
|
+
this.$db.set(this.keyStr, this.historyList)
|
|
134
|
+
},
|
|
135
|
+
clearHistory() {
|
|
136
|
+
this.$confirm({ content: '确定清除全部历史吗?' }, (res) => {
|
|
137
|
+
if (res.confirm) {
|
|
138
|
+
this.historyList = []
|
|
139
|
+
this.$db.set(this.keyStr, [])
|
|
140
|
+
}
|
|
141
|
+
})
|
|
142
|
+
},
|
|
143
|
+
},
|
|
144
|
+
}
|
|
145
|
+
</script>
|
|
146
|
+
|
|
147
|
+
<style scoped lang="scss">
|
|
148
|
+
.ky-search-top {
|
|
149
|
+
position: fixed;
|
|
150
|
+
top: 0;
|
|
151
|
+
left: 0;
|
|
152
|
+
right: 0;
|
|
153
|
+
background-color: var(--bg-white);
|
|
154
|
+
padding: 24rpx;
|
|
155
|
+
z-index: 100;
|
|
156
|
+
display: flex;
|
|
157
|
+
align-items: center;
|
|
158
|
+
.ky-search-box {
|
|
159
|
+
border-radius: 12rpx;
|
|
160
|
+
overflow: hidden;
|
|
161
|
+
display: flex;
|
|
162
|
+
align-items: center;
|
|
163
|
+
flex: 1;
|
|
164
|
+
}
|
|
165
|
+
.ky-search-main {
|
|
166
|
+
flex: 1;
|
|
167
|
+
background-color: var(--bg-gray);
|
|
168
|
+
height: 78rpx;
|
|
169
|
+
border-bottom-right-radius: 0;
|
|
170
|
+
border-top-right-radius: 0;
|
|
171
|
+
overflow: hidden;
|
|
172
|
+
.iconfont {
|
|
173
|
+
display: inline-block;
|
|
174
|
+
margin-left: 24rpx;
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
.ky-search-input {
|
|
179
|
+
flex: 1;
|
|
180
|
+
margin-left: 24rpx;
|
|
181
|
+
}
|
|
182
|
+
.ky-search-clear {
|
|
183
|
+
padding: 0 24rpx;display: inline-block;font-size: 32rpx;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
.ky-search-history-wrap {
|
|
189
|
+
position: fixed;
|
|
190
|
+
left: 0;
|
|
191
|
+
right: 0;
|
|
192
|
+
top: 0;
|
|
193
|
+
/* #ifdef MP-WEIXIN */
|
|
194
|
+
top: 118rpx;
|
|
195
|
+
/* #endif */
|
|
196
|
+
/* #ifdef H5 */
|
|
197
|
+
top: 44px;
|
|
198
|
+
/* #endif */
|
|
199
|
+
z-index: 100;
|
|
200
|
+
bottom: 0;
|
|
201
|
+
width: 100%;
|
|
202
|
+
height: 100%;
|
|
203
|
+
.ky-search-history-main {
|
|
204
|
+
padding: 36rpx;
|
|
205
|
+
}
|
|
206
|
+
.ky-search-history-head {
|
|
207
|
+
display: flex;
|
|
208
|
+
justify-content: space-between;
|
|
209
|
+
align-items: center;
|
|
210
|
+
margin-bottom: 12rpx;
|
|
211
|
+
.ky-search-history-title {
|
|
212
|
+
font-size: 32rpx;
|
|
213
|
+
}
|
|
214
|
+
.iconfont {
|
|
215
|
+
color: var(--color-gray);
|
|
216
|
+
font-size: 32rpx;
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
.ky-search-history-item {
|
|
220
|
+
display: flex;
|
|
221
|
+
justify-content: space-between;
|
|
222
|
+
padding: 24rpx 0;
|
|
223
|
+
border-bottom: 1px solid var(--border-1);;
|
|
224
|
+
}
|
|
225
|
+
.iconfont {
|
|
226
|
+
font-size: 24rpx;
|
|
227
|
+
color: var(--color-gray);
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
</style>
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<ky-btn
|
|
3
|
+
:disabled="isGetCode"
|
|
4
|
+
@click="getSmsCode"
|
|
5
|
+
type="text"
|
|
6
|
+
size="small"
|
|
7
|
+
>
|
|
8
|
+
{{ isGetCode ? `重发${countDownTime}s` : '获取验证码' }}
|
|
9
|
+
</ky-btn>
|
|
10
|
+
</template>
|
|
11
|
+
|
|
12
|
+
<script>
|
|
13
|
+
const code_type = {
|
|
14
|
+
login: '登录',
|
|
15
|
+
reg: '注册',
|
|
16
|
+
find: '找回密码',
|
|
17
|
+
change: '修改密码'
|
|
18
|
+
}
|
|
19
|
+
export default {
|
|
20
|
+
props: {
|
|
21
|
+
mobile: {
|
|
22
|
+
required: true
|
|
23
|
+
},
|
|
24
|
+
service_type: {
|
|
25
|
+
type: String,
|
|
26
|
+
default: '',
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
data() {
|
|
30
|
+
return {
|
|
31
|
+
countDownTime: 60,
|
|
32
|
+
timeInterval: null,
|
|
33
|
+
isGetCode: false,
|
|
34
|
+
is_success: false,
|
|
35
|
+
errMsg: ''
|
|
36
|
+
};
|
|
37
|
+
},
|
|
38
|
+
methods: {
|
|
39
|
+
async getSmsCode() {
|
|
40
|
+
this.$db.del('isToLogin')
|
|
41
|
+
this.code = ''
|
|
42
|
+
if (!this.mobile || !/^1\d{10}$/.test(this.mobile)) {
|
|
43
|
+
this.$toast('请输入正确的手机号码')
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
try {
|
|
47
|
+
await this.$api.user.GetSmsCode(this.mobile)
|
|
48
|
+
this.isGetCode = true;
|
|
49
|
+
this.is_success = true
|
|
50
|
+
this.$toast('验证码已发送')
|
|
51
|
+
this.timeInterval = setInterval(() => {
|
|
52
|
+
if (this.countDownTime === 0) {
|
|
53
|
+
clearInterval(this.timeInterval);
|
|
54
|
+
this.countDownTime = 60
|
|
55
|
+
this.isGetCode = false
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
this.countDownTime -= 1
|
|
59
|
+
}, 1000)
|
|
60
|
+
} catch (e) {
|
|
61
|
+
console.log(e)
|
|
62
|
+
this.errMsg = e.errMsg
|
|
63
|
+
this.is_success = false
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
</script>
|
|
69
|
+
|
|
70
|
+
<style lang="scss"></style>
|