@zscreate/zhxy-app-component 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/components/dying318-picker/Demo.vue +342 -0
- package/components/dying318-picker/Picker.nvue +441 -0
- package/components/dying318-picker/Picker.vue +442 -0
- package/components/dying318-picker/Pickers.vue +321 -0
- package/components/dying318-picker/README.md +479 -0
- package/components/easydrag-sort/easydrag-sort.vue +248 -0
- package/components/evan-form/evan-form.vue +102 -0
- package/components/evan-form/utils.js +125 -0
- package/components/evan-form-item/evan-form-item.vue +1457 -0
- package/components/evan-form-item/mixins/computedMixin.js +44 -0
- package/components/evan-form-item/mixins/pubSubMixin.js +104 -0
- package/components/evan-form-item/mixins/validateByApiMinxins.js +21 -0
- package/components/evan-form-item/mixins/validateFormMixin.js +71 -0
- package/components/evan-form-item/mixins/valueChangeMixin.js +64 -0
- package/components/evan-form-item/modules/edit.png +0 -0
- package/components/evan-form-item/utilForForm.js +35 -0
- package/components/evan-form-item/utils.js +51 -0
- package/components/form-container/data.js +709 -0
- package/components/form-container/form-container.vue +897 -0
- package/components/jin-edit/jin-edit.vue +327 -0
- package/components/jin-edit/jin-icons.vue +48 -0
- package/components/jin-edit/readme.md +65 -0
- package/components/l-file/l-file.vue +260 -0
- package/components/lb-picker/index.vue +286 -0
- package/components/signatrue-write/signatrue-write.vue +220 -0
- package/components/t-color-picker/t-color-picker.vue +784 -0
- package/components/uni-datetime-picker/changelog.md +76 -0
- package/components/uni-datetime-picker/components/uni-datetime-picker/calendar-item.vue +182 -0
- package/components/uni-datetime-picker/components/uni-datetime-picker/calendar.js +546 -0
- package/components/uni-datetime-picker/components/uni-datetime-picker/calendar.vue +1024 -0
- package/components/uni-datetime-picker/components/uni-datetime-picker/i18n/en.json +19 -0
- package/components/uni-datetime-picker/components/uni-datetime-picker/i18n/index.js +8 -0
- package/components/uni-datetime-picker/components/uni-datetime-picker/i18n/zh-Hans.json +19 -0
- package/components/uni-datetime-picker/components/uni-datetime-picker/i18n/zh-Hant.json +19 -0
- package/components/uni-datetime-picker/components/uni-datetime-picker/keypress.js +45 -0
- package/components/uni-datetime-picker/components/uni-datetime-picker/time-picker.vue +927 -0
- package/components/uni-datetime-picker/components/uni-datetime-picker/uni-datetime-picker.vue +966 -0
- package/components/uni-datetime-picker/components/uni-datetime-picker/util.js +437 -0
- package/components/uni-datetime-picker/components/uni-datetime-picker/year-mont-picker.vue +901 -0
- package/components/uni-datetime-picker/components/uni-datetime-picker/year-picker.vue +271 -0
- package/components/uni-datetime-picker/package.json +89 -0
- package/components/uni-datetime-picker/readme.md +159 -0
- package/components/uni-icons/icons.js +96 -0
- package/components/uni-icons/uni-icons.vue +57 -0
- package/components/uni-popup/message.js +29 -0
- package/components/uni-popup/popup.js +25 -0
- package/components/uni-popup/uni-popup-dialog.vue +243 -0
- package/components/uni-popup/uni-popup-message.vue +116 -0
- package/components/uni-popup/uni-popup-share.vue +165 -0
- package/components/uni-popup/uni-popup.vue +297 -0
- package/components/uni-rate/uni-rate.vue +140 -0
- package/components/uni-transition/uni-transition.vue +279 -0
- package/components/uploadFile/uploadFile.vue +124 -0
- package/components/viewcomponents/applicateGrid.vue +96 -0
- package/components/viewcomponents/card.vue +166 -0
- package/components/viewcomponents/formCard.vue +82 -0
- package/components/viewcomponents/infocell.vue +122 -0
- package/components/viewcomponents/navsearch.vue +59 -0
- package/components/viewcomponents/newscontent.vue +85 -0
- package/components/xp-picker/util.js +105 -0
- package/components/xp-picker/xp-picker.vue +330 -0
- package/index.js +9 -0
- package/package.json +29 -0
- package/static/iconfont.css +32 -0
- package/static/mttf.ttf +0 -0
- package/static/uni.ttf +0 -0
- package/utils/js-interp.js +6501 -0
- package/utils/js-interp.md +10 -0
- package/utils/moment.js +4601 -0
- package/utils/util.js +106 -0
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view class="uni-popup-share">
|
|
3
|
+
<view class="uni-share-title"><text class="uni-share-title-text">{{title}}</text></view>
|
|
4
|
+
<view class="uni-share-content">
|
|
5
|
+
<view class="uni-share-content-box">
|
|
6
|
+
<view class="uni-share-content-item" v-for="(item,index) in bottomData" :key="index" @click.stop="select(item,index)">
|
|
7
|
+
<image class="uni-share-image" :src="item.icon" mode="aspectFill"></image>
|
|
8
|
+
<text class="uni-share-text">{{item.text}}</text>
|
|
9
|
+
</view>
|
|
10
|
+
|
|
11
|
+
</view>
|
|
12
|
+
</view>
|
|
13
|
+
<view class="uni-share-button-box">
|
|
14
|
+
<button class="uni-share-button" @click="close">取消</button>
|
|
15
|
+
</view>
|
|
16
|
+
</view>
|
|
17
|
+
</template>
|
|
18
|
+
|
|
19
|
+
<script>
|
|
20
|
+
export default {
|
|
21
|
+
name: 'UniPopupShare',
|
|
22
|
+
props: {
|
|
23
|
+
title: {
|
|
24
|
+
type: String,
|
|
25
|
+
default: '分享到'
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
inject: ['popup'],
|
|
29
|
+
data() {
|
|
30
|
+
return {
|
|
31
|
+
bottomData: [{
|
|
32
|
+
text: '微信',
|
|
33
|
+
icon: 'https://img-cdn-qiniu.dcloud.net.cn/uni-ui/grid-2.png',
|
|
34
|
+
name: 'wx'
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
text: '支付宝',
|
|
38
|
+
icon: 'https://img-cdn-qiniu.dcloud.net.cn/uni-ui/grid-8.png',
|
|
39
|
+
name: 'wx'
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
text: 'QQ',
|
|
43
|
+
icon: 'https://img-cdn-qiniu.dcloud.net.cn/uni-ui/gird-3.png',
|
|
44
|
+
name: 'qq'
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
text: '新浪',
|
|
48
|
+
icon: 'https://img-cdn-qiniu.dcloud.net.cn/uni-ui/grid-1.png',
|
|
49
|
+
name: 'sina'
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
text: '百度',
|
|
53
|
+
icon: 'https://img-cdn-qiniu.dcloud.net.cn/uni-ui/grid-7.png',
|
|
54
|
+
name: 'copy'
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
text: '其他',
|
|
58
|
+
icon: 'https://img-cdn-qiniu.dcloud.net.cn/uni-ui/grid-5.png',
|
|
59
|
+
name: 'more'
|
|
60
|
+
}
|
|
61
|
+
]
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
created() {},
|
|
65
|
+
methods: {
|
|
66
|
+
/**
|
|
67
|
+
* 选择内容
|
|
68
|
+
*/
|
|
69
|
+
select(item, index) {
|
|
70
|
+
this.$emit('select', {
|
|
71
|
+
item,
|
|
72
|
+
index
|
|
73
|
+
}, () => {
|
|
74
|
+
this.popup.close()
|
|
75
|
+
})
|
|
76
|
+
},
|
|
77
|
+
/**
|
|
78
|
+
* 关闭窗口
|
|
79
|
+
*/
|
|
80
|
+
close() {
|
|
81
|
+
this.popup.close()
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
</script>
|
|
86
|
+
<style lang="scss" scoped>
|
|
87
|
+
.uni-popup-share {
|
|
88
|
+
background-color: #fff;
|
|
89
|
+
}
|
|
90
|
+
.uni-share-title {
|
|
91
|
+
/* #ifndef APP-NVUE */
|
|
92
|
+
display: flex;
|
|
93
|
+
/* #endif */
|
|
94
|
+
flex-direction: row;
|
|
95
|
+
align-items: center;
|
|
96
|
+
justify-content: center;
|
|
97
|
+
height: 40px;
|
|
98
|
+
}
|
|
99
|
+
.uni-share-title-text {
|
|
100
|
+
font-size: 14px;
|
|
101
|
+
color: #666;
|
|
102
|
+
}
|
|
103
|
+
.uni-share-content {
|
|
104
|
+
/* #ifndef APP-NVUE */
|
|
105
|
+
display: flex;
|
|
106
|
+
/* #endif */
|
|
107
|
+
flex-direction: row;
|
|
108
|
+
justify-content: center;
|
|
109
|
+
padding-top: 10px;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
.uni-share-content-box {
|
|
113
|
+
/* #ifndef APP-NVUE */
|
|
114
|
+
display: flex;
|
|
115
|
+
/* #endif */
|
|
116
|
+
flex-direction: row;
|
|
117
|
+
flex-wrap: wrap;
|
|
118
|
+
width: 360px;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
.uni-share-content-item {
|
|
122
|
+
width: 90px;
|
|
123
|
+
/* #ifndef APP-NVUE */
|
|
124
|
+
display: flex;
|
|
125
|
+
/* #endif */
|
|
126
|
+
flex-direction: column;
|
|
127
|
+
justify-content: center;
|
|
128
|
+
padding: 10px 0;
|
|
129
|
+
align-items: center;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
.uni-share-content-item:active {
|
|
133
|
+
background-color: #f5f5f5;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
.uni-share-image {
|
|
137
|
+
width: 30px;
|
|
138
|
+
height: 30px;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
.uni-share-text {
|
|
142
|
+
margin-top: 10px;
|
|
143
|
+
font-size: 14px;
|
|
144
|
+
color: #3B4144;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
.uni-share-button-box {
|
|
148
|
+
/* #ifndef APP-NVUE */
|
|
149
|
+
display: flex;
|
|
150
|
+
/* #endif */
|
|
151
|
+
flex-direction: row;
|
|
152
|
+
padding: 10px 15px;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
.uni-share-button {
|
|
156
|
+
flex: 1;
|
|
157
|
+
border-radius: 50px;
|
|
158
|
+
color: #666;
|
|
159
|
+
font-size: 16px;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
.uni-share-button::after {
|
|
163
|
+
border-radius: 50px;
|
|
164
|
+
}
|
|
165
|
+
</style>
|
|
@@ -0,0 +1,297 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view v-if="showPopup" class="uni-popup" :class="[popupstyle]" @touchmove.stop.prevent="clear">
|
|
3
|
+
<uni-transition v-if="maskShow" :mode-class="['fade']" :styles="maskClass" :duration="duration" :show="showTrans"
|
|
4
|
+
@click="onTap" />
|
|
5
|
+
<uni-transition :mode-class="ani" :styles="transClass" :duration="duration" :show="showTrans" @click="onTap">
|
|
6
|
+
<view class="uni-popup__wrapper-box" @click.stop="clear">
|
|
7
|
+
<slot />
|
|
8
|
+
</view>
|
|
9
|
+
</uni-transition>
|
|
10
|
+
</view>
|
|
11
|
+
</template>
|
|
12
|
+
|
|
13
|
+
<script>
|
|
14
|
+
import uniTransition from '../uni-transition/uni-transition.vue'
|
|
15
|
+
import popup from './popup.js'
|
|
16
|
+
/**
|
|
17
|
+
* PopUp 弹出层
|
|
18
|
+
* @description 弹出层组件,为了解决遮罩弹层的问题
|
|
19
|
+
* @tutorial https://ext.dcloud.net.cn/plugin?id=329
|
|
20
|
+
* @property {String} type = [top|center|bottom] 弹出方式
|
|
21
|
+
* @value top 顶部弹出
|
|
22
|
+
* @value center 中间弹出
|
|
23
|
+
* @value bottom 底部弹出
|
|
24
|
+
* @value message 消息提示
|
|
25
|
+
* @value dialog 对话框
|
|
26
|
+
* @value share 底部分享示例
|
|
27
|
+
* @property {Boolean} animation = [ture|false] 是否开启动画
|
|
28
|
+
* @property {Boolean} maskClick = [ture|false] 蒙版点击是否关闭弹窗
|
|
29
|
+
* @event {Function} change 打开关闭弹窗触发,e={show: false}
|
|
30
|
+
*/
|
|
31
|
+
|
|
32
|
+
export default {
|
|
33
|
+
name: 'UniPopup',
|
|
34
|
+
components: {
|
|
35
|
+
uniTransition
|
|
36
|
+
},
|
|
37
|
+
props: {
|
|
38
|
+
// 开启动画
|
|
39
|
+
animation: {
|
|
40
|
+
type: Boolean,
|
|
41
|
+
default: true
|
|
42
|
+
},
|
|
43
|
+
// 弹出层类型,可选值,top: 顶部弹出层;bottom:底部弹出层;center:全屏弹出层
|
|
44
|
+
// message: 消息提示 ; dialog : 对话框
|
|
45
|
+
type: {
|
|
46
|
+
type: String,
|
|
47
|
+
default: 'center'
|
|
48
|
+
},
|
|
49
|
+
// maskClick
|
|
50
|
+
maskClick: {
|
|
51
|
+
type: Boolean,
|
|
52
|
+
default: true
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
provide() {
|
|
56
|
+
return {
|
|
57
|
+
popup: this
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
mixins: [popup],
|
|
61
|
+
watch: {
|
|
62
|
+
/**
|
|
63
|
+
* 监听type类型
|
|
64
|
+
*/
|
|
65
|
+
type: {
|
|
66
|
+
handler: function(newVal) {
|
|
67
|
+
this[this.config[newVal]]()
|
|
68
|
+
},
|
|
69
|
+
immediate: true
|
|
70
|
+
},
|
|
71
|
+
/**
|
|
72
|
+
* 监听遮罩是否可点击
|
|
73
|
+
* @param {Object} val
|
|
74
|
+
*/
|
|
75
|
+
maskClick(val) {
|
|
76
|
+
this.mkclick = val
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
data() {
|
|
80
|
+
return {
|
|
81
|
+
duration: 300,
|
|
82
|
+
ani: [],
|
|
83
|
+
showPopup: false,
|
|
84
|
+
showTrans: false,
|
|
85
|
+
maskClass: {
|
|
86
|
+
'position': 'fixed',
|
|
87
|
+
'bottom': 0,
|
|
88
|
+
'top': 0,
|
|
89
|
+
'left': 0,
|
|
90
|
+
'right': 0,
|
|
91
|
+
'backgroundColor': 'rgba(0, 0, 0, 0.4)'
|
|
92
|
+
},
|
|
93
|
+
transClass: {
|
|
94
|
+
'position': 'fixed',
|
|
95
|
+
'left': 0,
|
|
96
|
+
'right': 0,
|
|
97
|
+
},
|
|
98
|
+
maskShow: true,
|
|
99
|
+
mkclick: true,
|
|
100
|
+
popupstyle: 'top'
|
|
101
|
+
}
|
|
102
|
+
},
|
|
103
|
+
created() {
|
|
104
|
+
this.mkclick = this.maskClick
|
|
105
|
+
if (this.animation) {
|
|
106
|
+
this.duration = 300
|
|
107
|
+
} else {
|
|
108
|
+
this.duration = 0
|
|
109
|
+
}
|
|
110
|
+
},
|
|
111
|
+
methods: {
|
|
112
|
+
clear(e) {
|
|
113
|
+
// TODO nvue 取消冒泡
|
|
114
|
+
e.stopPropagation()
|
|
115
|
+
},
|
|
116
|
+
open() {
|
|
117
|
+
this.showPopup = true
|
|
118
|
+
this.$nextTick(() => {
|
|
119
|
+
new Promise(resolve => {
|
|
120
|
+
clearTimeout(this.timer)
|
|
121
|
+
this.timer = setTimeout(() => {
|
|
122
|
+
this.showTrans = true
|
|
123
|
+
// fixed by mehaotian 兼容 app 端
|
|
124
|
+
this.$nextTick(() => {
|
|
125
|
+
resolve();
|
|
126
|
+
})
|
|
127
|
+
}, 50);
|
|
128
|
+
}).then(res => {
|
|
129
|
+
// 自定义打开事件
|
|
130
|
+
clearTimeout(this.msgtimer)
|
|
131
|
+
this.msgtimer = setTimeout(() => {
|
|
132
|
+
this.customOpen && this.customOpen()
|
|
133
|
+
}, 100)
|
|
134
|
+
this.$emit('change', {
|
|
135
|
+
show: true,
|
|
136
|
+
type: this.type
|
|
137
|
+
})
|
|
138
|
+
})
|
|
139
|
+
})
|
|
140
|
+
},
|
|
141
|
+
close(type) {
|
|
142
|
+
this.showTrans = false
|
|
143
|
+
this.$nextTick(() => {
|
|
144
|
+
this.$emit('change', {
|
|
145
|
+
show: false,
|
|
146
|
+
type: this.type
|
|
147
|
+
})
|
|
148
|
+
clearTimeout(this.timer)
|
|
149
|
+
// 自定义关闭事件
|
|
150
|
+
this.customOpen && this.customClose()
|
|
151
|
+
this.timer = setTimeout(() => {
|
|
152
|
+
this.showPopup = false
|
|
153
|
+
}, 300)
|
|
154
|
+
})
|
|
155
|
+
},
|
|
156
|
+
onTap() {
|
|
157
|
+
if (!this.mkclick) return
|
|
158
|
+
this.close()
|
|
159
|
+
},
|
|
160
|
+
/**
|
|
161
|
+
* 顶部弹出样式处理
|
|
162
|
+
*/
|
|
163
|
+
top() {
|
|
164
|
+
this.popupstyle = 'top'
|
|
165
|
+
this.ani = ['slide-top']
|
|
166
|
+
this.transClass = {
|
|
167
|
+
'position': 'fixed',
|
|
168
|
+
'left': 0,
|
|
169
|
+
'right': 0,
|
|
170
|
+
'z-index':9999
|
|
171
|
+
}
|
|
172
|
+
},
|
|
173
|
+
/**
|
|
174
|
+
* 底部弹出样式处理
|
|
175
|
+
*/
|
|
176
|
+
bottom() {
|
|
177
|
+
this.popupstyle = 'bottom'
|
|
178
|
+
this.ani = ['slide-bottom']
|
|
179
|
+
this.transClass = {
|
|
180
|
+
'position': 'fixed',
|
|
181
|
+
'left': 0,
|
|
182
|
+
'right': 0,
|
|
183
|
+
'bottom': 0,
|
|
184
|
+
'z-index':9999
|
|
185
|
+
}
|
|
186
|
+
},
|
|
187
|
+
/**
|
|
188
|
+
* 中间弹出样式处理
|
|
189
|
+
*/
|
|
190
|
+
center() {
|
|
191
|
+
this.popupstyle = 'center'
|
|
192
|
+
this.ani = ['zoom-out', 'fade']
|
|
193
|
+
this.transClass = {
|
|
194
|
+
'position': 'fixed',
|
|
195
|
+
/* #ifndef APP-NVUE */
|
|
196
|
+
'display': 'flex',
|
|
197
|
+
'flexDirection': 'column',
|
|
198
|
+
/* #endif */
|
|
199
|
+
'bottom': 0,
|
|
200
|
+
'left': 0,
|
|
201
|
+
'right': 0,
|
|
202
|
+
'top': 0,
|
|
203
|
+
'justifyContent': 'center',
|
|
204
|
+
'alignItems': 'center'
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
</script>
|
|
210
|
+
<style lang="scss" scoped>
|
|
211
|
+
.uni-popup {
|
|
212
|
+
position: fixed;
|
|
213
|
+
/* #ifndef APP-NVUE */
|
|
214
|
+
z-index: 9999;
|
|
215
|
+
/* #endif */
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
.uni-popup__mask {
|
|
219
|
+
position: absolute;
|
|
220
|
+
top: 0;
|
|
221
|
+
bottom: 0;
|
|
222
|
+
left: 0;
|
|
223
|
+
right: 0;
|
|
224
|
+
background-color: $uni-bg-color-mask;
|
|
225
|
+
opacity: 0;
|
|
226
|
+
z-index: 9999;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
.mask-ani {
|
|
230
|
+
transition-property: opacity;
|
|
231
|
+
transition-duration: 0.2s;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
.uni-top-mask {
|
|
235
|
+
opacity: 1;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
.uni-bottom-mask {
|
|
239
|
+
opacity: 1;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
.uni-center-mask {
|
|
243
|
+
opacity: 1;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
.uni-popup__wrapper {
|
|
247
|
+
/* #ifndef APP-NVUE */
|
|
248
|
+
display: block;
|
|
249
|
+
/* #endif */
|
|
250
|
+
position: absolute;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
.top {
|
|
254
|
+
/* #ifdef H5 */
|
|
255
|
+
top: var(--window-top);
|
|
256
|
+
/* #endif */
|
|
257
|
+
/* #ifndef H5 */
|
|
258
|
+
top: 0;
|
|
259
|
+
/* #endif */
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
.bottom {
|
|
263
|
+
bottom: 0;
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
.uni-popup__wrapper-box {
|
|
267
|
+
/* #ifndef APP-NVUE */
|
|
268
|
+
display: block;
|
|
269
|
+
/* #endif */
|
|
270
|
+
position: relative;
|
|
271
|
+
/* iphonex 等安全区设置,底部安全区适配 */
|
|
272
|
+
/* #ifndef APP-NVUE */
|
|
273
|
+
// padding-bottom: constant(safe-area-inset-bottom);
|
|
274
|
+
// padding-bottom: env(safe-area-inset-bottom);
|
|
275
|
+
/* #endif */
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
.content-ani {
|
|
279
|
+
// transition: transform 0.3s;
|
|
280
|
+
transition-property: transform, opacity;
|
|
281
|
+
transition-duration: 0.2s;
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
|
|
285
|
+
.uni-top-content {
|
|
286
|
+
transform: translateY(0);
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
.uni-bottom-content {
|
|
290
|
+
transform: translateY(0);
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
.uni-center-content {
|
|
294
|
+
transform: scale(1);
|
|
295
|
+
opacity: 1;
|
|
296
|
+
}
|
|
297
|
+
</style>
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view class="uni-rate">
|
|
3
|
+
<view :key="index" :style="{ marginLeft: margin + 'px' }" @click="_onClick(index)" class="uni-rate__icon" v-for="(star, index) in stars">
|
|
4
|
+
<uni-icons :color="color" :size="size" :type="isFill ? 'star-filled' : 'star'" />
|
|
5
|
+
<!-- #ifdef APP-NVUE -->
|
|
6
|
+
<view :style="{ width: star.activeWitch.replace('%','')*size/100+'px'}" class="uni-rate__icon-on">
|
|
7
|
+
<uni-icons style="text-align: left;" :color="activeColor" :size="size" type="star-filled" />
|
|
8
|
+
</view>
|
|
9
|
+
<!-- #endif -->
|
|
10
|
+
<!-- #ifndef APP-NVUE -->
|
|
11
|
+
<view :style="{ width: star.activeWitch,top:-size/2+'px' }" class="uni-rate__icon-on">
|
|
12
|
+
<uni-icons :color="activeColor" :size="size" type="star-filled" />
|
|
13
|
+
</view>
|
|
14
|
+
<!-- #endif -->
|
|
15
|
+
</view>
|
|
16
|
+
</view>
|
|
17
|
+
</template>
|
|
18
|
+
|
|
19
|
+
<script>
|
|
20
|
+
import uniIcons from "../uni-icons/uni-icons.vue";
|
|
21
|
+
export default {
|
|
22
|
+
name: "UniRate",
|
|
23
|
+
components: {
|
|
24
|
+
uniIcons
|
|
25
|
+
},
|
|
26
|
+
props: {
|
|
27
|
+
isFill: {
|
|
28
|
+
// 星星的类型,是否镂空
|
|
29
|
+
type: [Boolean, String],
|
|
30
|
+
default: true
|
|
31
|
+
},
|
|
32
|
+
color: {
|
|
33
|
+
// 星星的颜色
|
|
34
|
+
type: String,
|
|
35
|
+
default: "#ececec"
|
|
36
|
+
},
|
|
37
|
+
activeColor: {
|
|
38
|
+
// 星星选中状态颜色
|
|
39
|
+
type: String,
|
|
40
|
+
default: "#ffca3e"
|
|
41
|
+
},
|
|
42
|
+
size: {
|
|
43
|
+
// 星星的大小
|
|
44
|
+
type: [Number, String],
|
|
45
|
+
default: 24
|
|
46
|
+
},
|
|
47
|
+
value: {
|
|
48
|
+
// 当前评分
|
|
49
|
+
type: [Number, String],
|
|
50
|
+
default: 0
|
|
51
|
+
},
|
|
52
|
+
max: {
|
|
53
|
+
// 最大评分
|
|
54
|
+
type: [Number, String],
|
|
55
|
+
default: 5
|
|
56
|
+
},
|
|
57
|
+
margin: {
|
|
58
|
+
// 星星的间距
|
|
59
|
+
type: [Number, String],
|
|
60
|
+
default: 0
|
|
61
|
+
},
|
|
62
|
+
disabled: {
|
|
63
|
+
// 是否可点击
|
|
64
|
+
type: [Boolean, String],
|
|
65
|
+
default: false
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
data() {
|
|
69
|
+
return {
|
|
70
|
+
valueSync: ""
|
|
71
|
+
};
|
|
72
|
+
},
|
|
73
|
+
computed: {
|
|
74
|
+
stars() {
|
|
75
|
+
const value = this.valueSync ? this.valueSync : 0;
|
|
76
|
+
const starList = [];
|
|
77
|
+
const floorValue = Math.floor(value);
|
|
78
|
+
const ceilValue = Math.ceil(value);
|
|
79
|
+
// console.log("ceilValue: " + ceilValue);
|
|
80
|
+
// console.log("floorValue: " + floorValue);
|
|
81
|
+
for (let i = 0; i < this.max; i++) {
|
|
82
|
+
if (floorValue > i) {
|
|
83
|
+
starList.push({
|
|
84
|
+
activeWitch: "100%"
|
|
85
|
+
});
|
|
86
|
+
} else if (ceilValue - 1 === i) {
|
|
87
|
+
starList.push({
|
|
88
|
+
activeWitch: (value - floorValue) * 100 + "%"
|
|
89
|
+
});
|
|
90
|
+
} else {
|
|
91
|
+
starList.push({
|
|
92
|
+
activeWitch: "0"
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
return starList;
|
|
97
|
+
}
|
|
98
|
+
},
|
|
99
|
+
created() {
|
|
100
|
+
this.valueSync = Number(this.value);
|
|
101
|
+
},
|
|
102
|
+
methods: {
|
|
103
|
+
_onClick(index) {
|
|
104
|
+
if (this.disabled) {
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
this.valueSync = index + 1;
|
|
108
|
+
this.$emit("change", {
|
|
109
|
+
value: this.valueSync
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
};
|
|
114
|
+
</script>
|
|
115
|
+
|
|
116
|
+
<style lang="scss" scoped>
|
|
117
|
+
.uni-rate {
|
|
118
|
+
/* #ifndef APP-NVUE */
|
|
119
|
+
display: flex;
|
|
120
|
+
/* #endif */
|
|
121
|
+
line-height: 0;
|
|
122
|
+
font-size: 0;
|
|
123
|
+
flex-direction: row;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
.uni-rate__icon {
|
|
127
|
+
position: relative;
|
|
128
|
+
line-height: 0;
|
|
129
|
+
font-size: 0;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
.uni-rate__icon-on {
|
|
133
|
+
overflow: hidden;
|
|
134
|
+
position: absolute;
|
|
135
|
+
top: 0;
|
|
136
|
+
left: 0;
|
|
137
|
+
line-height: 1;
|
|
138
|
+
text-align: left;
|
|
139
|
+
}
|
|
140
|
+
</style>
|