@xtdev/xt-miniprogram-ui 1.0.10 → 1.0.12
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/libs/xt-button/index.js +52 -0
- package/libs/xt-button/index.json +6 -0
- package/libs/xt-button/index.wxml +9 -0
- package/libs/xt-button/index.wxss +76 -0
- package/libs/xt-card-cell/README.md +65 -0
- package/libs/xt-card-cell/index.wxss +1 -0
- package/libs/xt-dialog/README.md +152 -0
- package/libs/xt-dialog/index.js +126 -0
- package/libs/xt-dialog/index.json +4 -0
- package/libs/xt-dialog/index.wxml +51 -0
- package/libs/xt-dialog/index.wxss +121 -0
- package/libs/xt-icon/README.md +39 -0
- package/libs/xt-icon/index.wxss +24 -46
- package/libs/xt-search/README.md +55 -0
- package/libs/xt-search/index.js +0 -37
- package/libs/xt-search/index.wxml +7 -7
- package/libs/xt-search/index.wxss +3 -3
- package/libs/xt-stepper/README.md +52 -0
- package/libs/xt-stepper/index.js +158 -0
- package/libs/xt-stepper/index.json +4 -0
- package/libs/xt-stepper/index.wxml +11 -0
- package/libs/xt-stepper/index.wxss +83 -0
- package/libs/xt-steps/README.md +61 -0
- package/libs/xt-steps/index.js +37 -0
- package/libs/xt-steps/index.json +7 -0
- package/libs/xt-steps/index.wxml +32 -0
- package/libs/xt-steps/index.wxss +180 -0
- package/libs/xt-tag/README.md +65 -0
- package/libs/xt-tag/index.js +38 -0
- package/libs/xt-tag/index.json +6 -0
- package/libs/xt-tag/index.wxml +5 -0
- package/libs/xt-tag/index.wxss +36 -0
- package/libs/xt-toast/README.md +65 -0
- package/libs/xt-toast/index.js +77 -0
- package/libs/xt-toast/index.json +6 -0
- package/libs/xt-toast/index.wxml +7 -0
- package/libs/xt-toast/index.wxss +26 -0
- package/libs/xt-uploader/README.md +44 -0
- package/libs/xt-uploader/index.js +150 -0
- package/libs/xt-uploader/index.json +6 -0
- package/libs/xt-uploader/index.wxml +16 -0
- package/libs/xt-uploader/index.wxss +66 -0
- package/libs/xt-uploader/utils.js +164 -0
- package/package.json +1 -1
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
// src/xt-button/index.js
|
|
2
|
+
Component({
|
|
3
|
+
/**
|
|
4
|
+
* 组件的属性列表
|
|
5
|
+
*/
|
|
6
|
+
properties: {
|
|
7
|
+
// 左侧图标名称
|
|
8
|
+
icon: {
|
|
9
|
+
type: String,
|
|
10
|
+
},
|
|
11
|
+
// 按钮尺寸,可选值为 normal large small
|
|
12
|
+
size: {
|
|
13
|
+
type: String,
|
|
14
|
+
value: "normal",
|
|
15
|
+
},
|
|
16
|
+
// 按钮类型,可选值为 main secondary
|
|
17
|
+
type: {
|
|
18
|
+
type: String,
|
|
19
|
+
value: "secondary",
|
|
20
|
+
},
|
|
21
|
+
color: {
|
|
22
|
+
type: String,
|
|
23
|
+
},
|
|
24
|
+
disabled: {
|
|
25
|
+
type: Boolean,
|
|
26
|
+
value: false,
|
|
27
|
+
},
|
|
28
|
+
customClass: {
|
|
29
|
+
type: String,
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* 组件的初始数据
|
|
35
|
+
*/
|
|
36
|
+
data: {
|
|
37
|
+
sizeObj: {
|
|
38
|
+
small: { iconSize: 40 },
|
|
39
|
+
normal: { iconSize: 48 },
|
|
40
|
+
large: { iconSize: 48 },
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* 组件的方法列表
|
|
46
|
+
*/
|
|
47
|
+
methods: {
|
|
48
|
+
onClick(event) {
|
|
49
|
+
this.triggerEvent("click", event);
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
});
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
<!-- src/xt-button/index.wxml -->
|
|
2
|
+
<view class="xt-button">
|
|
3
|
+
<button disabled="{{disabled}}" class="xt-button-{{size}} xt-button-{{type}} {{disabled ? 'xt-button-disabled-'+type : ''}}" hover-class="xt-button-{{type}}-clicked">
|
|
4
|
+
<xt-icon wx:if="{{icon}}" icon="{{icon}}" size="{{sizeObj[size].iconSize}}" class="xt-buttion-icon-{{size}}"></xt-icon>
|
|
5
|
+
<view>
|
|
6
|
+
<slot />
|
|
7
|
+
</view>
|
|
8
|
+
</button>
|
|
9
|
+
</view>
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/* src/xt-button/index.wxss */
|
|
2
|
+
.xt-button button {
|
|
3
|
+
display : flex;
|
|
4
|
+
align-items : center;
|
|
5
|
+
justify-content: center;
|
|
6
|
+
border-radius : 120rpx;
|
|
7
|
+
box-sizing : border-box;
|
|
8
|
+
font-family : PingFang SC-Semibold,
|
|
9
|
+
PingFang SC;
|
|
10
|
+
font-weight: 800;
|
|
11
|
+
margin : 0 !important;
|
|
12
|
+
width : auto !important;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.xt-button-small {
|
|
16
|
+
padding : 16rpx 32rpx;
|
|
17
|
+
font-size : 34rpx;
|
|
18
|
+
line-height: 48rpx;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.xt-button-normal {
|
|
22
|
+
padding : 20rpx 48rpx;
|
|
23
|
+
font-size : 40rpx;
|
|
24
|
+
line-height: 56rpx;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.xt-button-large {
|
|
28
|
+
padding : 24rpx 64rpx;
|
|
29
|
+
font-size : 48rpx;
|
|
30
|
+
line-height: 68rpx;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.xt-button-main {
|
|
34
|
+
background-color: #6722AB;
|
|
35
|
+
color : #FFFFFF;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.xt-button-disabled-main {
|
|
39
|
+
background-color: #DDDDDD !important;
|
|
40
|
+
color : #fff !important
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/* hover-class需要放在class之后,否则background会被本身class的css覆盖 */
|
|
44
|
+
.xt-button-main-clicked {
|
|
45
|
+
background-color: #3D1466;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.xt-button-secondary {
|
|
49
|
+
background-color: #fff;
|
|
50
|
+
border : 2rpx #959595 solid;
|
|
51
|
+
color : #222222
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.xt-button-disabled-secondary {
|
|
55
|
+
background-color: #F5F5F5 !important;
|
|
56
|
+
border : 2rpx #DDDDDD solid;
|
|
57
|
+
color : #DDDDDD !important;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/* hover-class需要放在class之后,否则background会被本身class的css覆盖 */
|
|
61
|
+
.xt-button-secondary-clicked {
|
|
62
|
+
background-color: #DDDDDD;
|
|
63
|
+
border : 2rpx #DDDDDD solid;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.xt-buttion-icon-small {
|
|
67
|
+
margin-right: 8rpx;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.xt-buttion-icon-normal {
|
|
71
|
+
margin-right: 16rpx;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.xt-buttion-icon-large {
|
|
75
|
+
margin-right: 16rpx;
|
|
76
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
# 列表卡片
|
|
2
|
+
|
|
3
|
+
### 介绍
|
|
4
|
+
列表中的单个展示项
|
|
5
|
+
|
|
6
|
+
###效果图
|
|
7
|
+

|
|
8
|
+
|
|
9
|
+
### 引入
|
|
10
|
+
在app.json或页面配置json中引入
|
|
11
|
+
```
|
|
12
|
+
"usingComponents": {
|
|
13
|
+
"xt-card-cell": "@xtdev/xt-miniprogram-ui/xt-card-cell",
|
|
14
|
+
}
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## 代码演示
|
|
18
|
+
|
|
19
|
+
### 基础用法
|
|
20
|
+
|
|
21
|
+
```
|
|
22
|
+
<xt-card-cell item="{{item}}">
|
|
23
|
+
</xt-card-cell>
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
### 使用插槽
|
|
27
|
+
使用插槽替换卡片底部内容
|
|
28
|
+
```
|
|
29
|
+
<xt-card-cell item="{{item}}">
|
|
30
|
+
<view slot="card-footer">
|
|
31
|
+
<!-- 列表按钮 -->
|
|
32
|
+
<view class="footer">
|
|
33
|
+
<view class="default-btn">
|
|
34
|
+
查看详情
|
|
35
|
+
</view>
|
|
36
|
+
</view>
|
|
37
|
+
</view>
|
|
38
|
+
</xt-card-cell>
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
##API
|
|
42
|
+
|
|
43
|
+
#### xt-card-cell props
|
|
44
|
+
|
|
45
|
+
| 参数 | 说明 | 类型 |
|
|
46
|
+
| ----------- | ----------- | ---------- |
|
|
47
|
+
| item | 卡片内容 | `ItemProps` |
|
|
48
|
+
| contentSlot | 卡片底部插槽 | `slot` |
|
|
49
|
+
|
|
50
|
+
#### ItemProps
|
|
51
|
+
|
|
52
|
+
| 参数 | 说明 | 类型 |
|
|
53
|
+
| ----------- | ----------- | ----------- |
|
|
54
|
+
| title | 卡片标题 | `String` |
|
|
55
|
+
| subTitle | 卡片副标题 | `String` |
|
|
56
|
+
| subTitleColor | 卡片副标题颜色 | `String` |
|
|
57
|
+
| dataList | 卡片内容 | `datalistItem[]` |
|
|
58
|
+
|
|
59
|
+
#### datalistItem
|
|
60
|
+
|
|
61
|
+
| 参数 | 说明 | 类型 |
|
|
62
|
+
| ----------- | ----------- | ----------- |
|
|
63
|
+
| value | 值 | `String` \| `Number` |
|
|
64
|
+
| valueType | 值类型,可选值为 `text` `tel` | `String` |
|
|
65
|
+
| label | 字段描述 | `String` |
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
# Dialog弹出框
|
|
2
|
+
|
|
3
|
+
## 介绍
|
|
4
|
+
|
|
5
|
+
弹出模态框,常用于消息提示、消息确认,或在当前页面内完成特定的交互操作。
|
|
6
|
+
|
|
7
|
+
## 效果图
|
|
8
|
+
|
|
9
|
+

|
|
10
|
+
|
|
11
|
+
## 引入
|
|
12
|
+
|
|
13
|
+
在app.json或页面配置json中引入
|
|
14
|
+
|
|
15
|
+
```json
|
|
16
|
+
"usingComponents": {
|
|
17
|
+
"xt-dialog": "@xtdev/xt-miniprogram-ui/xt-dialog",
|
|
18
|
+
}
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## 代码演示
|
|
22
|
+
|
|
23
|
+
### 1 纯文本样式
|
|
24
|
+
|
|
25
|
+
<img src="https://img.tanjiu.cn/home/PWGNtJ6hkZebE48ZACEsPHkcesfxSKEj.png" alt="纯文本样式" style="zoom: 50%;" />
|
|
26
|
+
|
|
27
|
+
#### 1)单项操作
|
|
28
|
+
|
|
29
|
+
```html
|
|
30
|
+
<xt-dialog show="{{true}}" type="nomal" message="内容内容内容" confirmButtonText="我知道了" bind:confirm="onConfirm"></xt-dialog>
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
#### 2)双向操作
|
|
34
|
+
|
|
35
|
+
```html
|
|
36
|
+
<xt-dialog show="{{true}}" type="nomal" message="内容内容内容" confirmButtonText="确定" showCancelButton="{{true}}" cancelButtonText="取消" bind:confirm="onConfirm" bind:cancel="onCancel"></xt-dialog>
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### 2 标题样式
|
|
40
|
+
|
|
41
|
+
<img src="https://img.tanjiu.cn/home/22paHdnC7hPhTEBRRT7pfdkGECybNFzD.png" alt="标题样式" style="zoom:50%;" />
|
|
42
|
+
|
|
43
|
+
#### 1)单项操作
|
|
44
|
+
|
|
45
|
+
```html
|
|
46
|
+
<xt-dialog show="{{true}}" type="nomal" title="标题标题标题" message="内容内容内容" confirmButtonText="我知道了" bind:confirm="onConfirm"></xt-dialog>
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
#### 2)双向操作
|
|
50
|
+
|
|
51
|
+
```html
|
|
52
|
+
<xt-dialog show="{{true}}" type="nomal" title="标题标题标题" message="内容内容内容" confirmButtonText="确定" showCancelButton="{{true}}" cancelButtonText="取消" bind:confirm="onConfirm" bind:cancel="onCancel"></xt-dialog>
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### 3 图文样式
|
|
56
|
+
|
|
57
|
+
<img src="https://img.tanjiu.cn/home/5xpzpCFA62TFn5DWjFQK4GmyiBbxEGiC.png" alt="图文样式" style="zoom: 80%;" />
|
|
58
|
+
|
|
59
|
+
#### 1)单项操作
|
|
60
|
+
|
|
61
|
+
```html
|
|
62
|
+
<xt-dialog type="imageText" show="{{true}}" title="标题标题标题" message="内容内容内容内容内容" imageUrl="https://img.tanjiu.cn/home/CdrcxcSwjinKwJwaSadAzMYpnZtTj4WK.webp" confirmButtonText="我知道了" showCancelButton="{{false}}" bind:confirm="onImgTextConfirm"></xt-dialog>
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
#### 2)双项操作
|
|
66
|
+
|
|
67
|
+
```html
|
|
68
|
+
<xt-dialog type="imageText" show="{{true}}" title="标题标题标题" message="内容内容内容内容内容" imageUrl="https://img.tanjiu.cn/home/CdrcxcSwjinKwJwaSadAzMYpnZtTj4WK.webp" confirmButtonText="确定" showCancelButton="{{true}}" cancelButtonText="取消" bind:confirm="onImgTextConfirm" bind:cancel="onImgTextCancel"></xt-dialog>
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
### 4 输入样式
|
|
72
|
+
|
|
73
|
+
<img src="https://img.tanjiu.cn/home/X2bAjz2FQc6mNewfhbNBQfHm6zTmfYzd.png" alt="输入样式" style="zoom:50%;" />
|
|
74
|
+
|
|
75
|
+
```html
|
|
76
|
+
<xt-dialog type="inputText" show="{{showInputDialog}}" title="标题标题标题" message="" placeholder="请输入内容" confirmButtonText="确定" showCancelButton="{{true}}" cancelButtonText="取消" bind:inputConfirm="onInputConfirm" bind:cancel="onInputCancel"></xt-dialog>
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
### 5 选择器样式
|
|
80
|
+
|
|
81
|
+
<img src="https://img.tanjiu.cn/home/yKrCY5MnGFS3FcjJ6pJRz5fXmJEHrSay.png" alt="选择器样式" style="zoom:50%;" />
|
|
82
|
+
|
|
83
|
+
```html
|
|
84
|
+
<xt-dialog type="choose" show="{{true}}" title="标题标题标题" chooiceItems="{{chooiceItems}}" confirmButtonText="确定" showCancelButton="{{true}}" cancelButtonText="取消" bind:chooseConfirm="onChooseConfirm" bind:cancel="onChooseCancel"></xt-dialog>
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
#### 1)常规情况下的 chooiceItems 参数
|
|
88
|
+
|
|
89
|
+
```json
|
|
90
|
+
chooiceItems:[
|
|
91
|
+
{
|
|
92
|
+
value:0,
|
|
93
|
+
label:'内容内容内容内容内容内容'
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
value:1,
|
|
97
|
+
label:'内容内容内容内容内容内容'
|
|
98
|
+
}
|
|
99
|
+
]
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
#### 2)带辅助信息情况下的 chooiceItems 参数
|
|
103
|
+
|
|
104
|
+
```json
|
|
105
|
+
chooiceItems:[
|
|
106
|
+
{
|
|
107
|
+
value:0,
|
|
108
|
+
label:'内容内容内容内容内容内容',
|
|
109
|
+
remark:'辅助信息辅助信息辅助信息'
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
value:1,
|
|
113
|
+
label:'内容内容内容内容内容内容',
|
|
114
|
+
remark:'辅助信息辅助信息辅助信息'
|
|
115
|
+
}
|
|
116
|
+
]
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
## API
|
|
120
|
+
|
|
121
|
+
### xt-dialog props
|
|
122
|
+
|
|
123
|
+
| 参数 | 说明 | 类型 | 默认值 |
|
|
124
|
+
| ----------------- | ---------------------------------------------------------- | ------- | ---------- |
|
|
125
|
+
| show | 是否显示 | Boolean | true |
|
|
126
|
+
| type | 弹窗类型,可选值为`nomal` `imageText` `inputText` `choose` | String | nomal |
|
|
127
|
+
| title | 标题 | String | null |
|
|
128
|
+
| message | 内容 | String | '' |
|
|
129
|
+
| showConfirmButton | 是否展示确认按钮 | Boolean | true |
|
|
130
|
+
| showCancelButton | 是否展示取消按钮 | Boolean | false |
|
|
131
|
+
| confirmButtonText | 确认按钮的文案 | String | 确认 |
|
|
132
|
+
| cancelButtonText | 取消按钮的文案 | String | 取消 |
|
|
133
|
+
| placeholder | 输入框占位符,仅当type为'inputText'时有用 | String | 请输入内容 |
|
|
134
|
+
| imageUrl | 图片链接,仅当type为'imageText'时有用 | String | null |
|
|
135
|
+
| chooiceItems | 选项内容,仅当type为'choose'时有用 | Array | null |
|
|
136
|
+
|
|
137
|
+
### chooiceItems props []
|
|
138
|
+
|
|
139
|
+
| 参数 | 说明 | 类型 |
|
|
140
|
+
| ------ | -------------- | ----------------------- |
|
|
141
|
+
| value | 选项的value值 | Number\|String\|Boolean |
|
|
142
|
+
| label | 选项的文本描述 | String |
|
|
143
|
+
| remark | 选项的辅助信息 | String |
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
// src/xt-dialog/index.js
|
|
2
|
+
Component({
|
|
3
|
+
/**
|
|
4
|
+
* 组件的属性列表
|
|
5
|
+
*/
|
|
6
|
+
properties: {
|
|
7
|
+
show:{
|
|
8
|
+
type:Boolean,
|
|
9
|
+
value:true
|
|
10
|
+
},
|
|
11
|
+
type:{
|
|
12
|
+
type:String,
|
|
13
|
+
value:'nomal'
|
|
14
|
+
},
|
|
15
|
+
title:{
|
|
16
|
+
type:String,
|
|
17
|
+
value:null
|
|
18
|
+
},
|
|
19
|
+
message:{
|
|
20
|
+
type:String,
|
|
21
|
+
value:''
|
|
22
|
+
},
|
|
23
|
+
showConfirmButton:{
|
|
24
|
+
type:Boolean,
|
|
25
|
+
value:true
|
|
26
|
+
},
|
|
27
|
+
showCancelButton:{
|
|
28
|
+
type:Boolean,
|
|
29
|
+
value:false
|
|
30
|
+
},
|
|
31
|
+
confirmButtonText:{
|
|
32
|
+
type:String,
|
|
33
|
+
value:'我知道了'
|
|
34
|
+
},
|
|
35
|
+
cancelButtonText:{
|
|
36
|
+
type:String,
|
|
37
|
+
value:'取消'
|
|
38
|
+
},
|
|
39
|
+
placeholder:{
|
|
40
|
+
type:String,
|
|
41
|
+
value:'请输入内容'
|
|
42
|
+
},
|
|
43
|
+
imageUrl:{
|
|
44
|
+
type:String,
|
|
45
|
+
value:null
|
|
46
|
+
},
|
|
47
|
+
chooiceItems:{
|
|
48
|
+
type:Array,
|
|
49
|
+
value:[]
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* 组件的初始数据
|
|
55
|
+
*/
|
|
56
|
+
data: {
|
|
57
|
+
// 输入框的值
|
|
58
|
+
inpVal:'',
|
|
59
|
+
// 单选框选定的值
|
|
60
|
+
curChoosedItemVal: null,
|
|
61
|
+
},
|
|
62
|
+
|
|
63
|
+
lifetimes: {
|
|
64
|
+
attached(){
|
|
65
|
+
if(this.properties.type == 'inputText'){
|
|
66
|
+
this.setData({
|
|
67
|
+
inpVal: this.properties.message
|
|
68
|
+
})
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* 组件的方法列表
|
|
75
|
+
*/
|
|
76
|
+
methods: {
|
|
77
|
+
// 输入样式 - 输入框失焦
|
|
78
|
+
onInputBlur(e){
|
|
79
|
+
console.log('输入值',e);
|
|
80
|
+
this.setData({
|
|
81
|
+
inpVal: e.detail.value
|
|
82
|
+
})
|
|
83
|
+
},
|
|
84
|
+
|
|
85
|
+
// 选择样式 - 选择某一项
|
|
86
|
+
chooseItem(e){
|
|
87
|
+
let { chooseitem } = e.currentTarget.dataset;
|
|
88
|
+
this.setData({
|
|
89
|
+
curChoosedItemVal: chooseitem.value
|
|
90
|
+
})
|
|
91
|
+
console.log('触发选择',this.data.curChoosedItemVal);
|
|
92
|
+
},
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
// 点击确认按钮
|
|
98
|
+
confirmBtn(e){
|
|
99
|
+
let { confirmtype } = e.currentTarget.dataset;
|
|
100
|
+
// 常规样式&&图文样式
|
|
101
|
+
if(['nomalDialog','imageTextDialog'].includes(confirmtype)){
|
|
102
|
+
this.triggerEvent('confirm',{})
|
|
103
|
+
}
|
|
104
|
+
// 输入样式
|
|
105
|
+
if(confirmtype == 'inputDialog'){
|
|
106
|
+
this.triggerEvent('inputConfirm', this.data.inpVal)
|
|
107
|
+
}
|
|
108
|
+
// 选择样式
|
|
109
|
+
if(confirmtype == 'chooseDialog'){
|
|
110
|
+
if(this.data.curChoosedItemVal===null){
|
|
111
|
+
wx.showToast({
|
|
112
|
+
title: '请选择~',
|
|
113
|
+
icon:'none',
|
|
114
|
+
duration:3000
|
|
115
|
+
})
|
|
116
|
+
return
|
|
117
|
+
}
|
|
118
|
+
this.triggerEvent('chooseConfirm', this.data.curChoosedItemVal)
|
|
119
|
+
}
|
|
120
|
+
},
|
|
121
|
+
// 点击取消按钮
|
|
122
|
+
cancelBtn(){
|
|
123
|
+
this.triggerEvent('cancel',{})
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
})
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
<!--src/xt-dialog/index.wxml-->
|
|
2
|
+
<block wx:if="{{show}}">
|
|
3
|
+
<!-- 纯文本样式 && 标题样式 -->
|
|
4
|
+
<view class="dialog_mask" wx:if="{{type=='nomal'}}">
|
|
5
|
+
<view class="dialog_box">
|
|
6
|
+
<view class="title" wx:if="{{title}}">{{title}}</view>
|
|
7
|
+
<view class="content" style="font-weight:{{title?400:800}};">{{message}}</view>
|
|
8
|
+
<view class="default_btn" catchtap="confirmBtn" data-confirmtype="nomalDialog" wx:if="{{showConfirmButton}}">{{confirmButtonText}}</view>
|
|
9
|
+
<view class="cancel_btn" catchtap="cancelBtn" wx:if="{{showCancelButton}}">{{cancelButtonText}}</view>
|
|
10
|
+
</view>
|
|
11
|
+
</view>
|
|
12
|
+
<!-- 图文样式 -->
|
|
13
|
+
<view class="dialog_mask" wx:if="{{type=='imageText'}}">
|
|
14
|
+
<view class="dialog_box">
|
|
15
|
+
<view class="title" wx:if="{{title}}">{{title}}</view>
|
|
16
|
+
<image class="image" wx:if="{{imageUrl}}" src="{{imageUrl}}"></image>
|
|
17
|
+
<view class="content">{{message}}</view>
|
|
18
|
+
<view class="default_btn" catchtap="confirmBtn" data-confirmtype="imageTextDialog" wx:if="{{showConfirmButton}}">{{confirmButtonText}}</view>
|
|
19
|
+
<view class="cancel_btn" catchtap="cancelBtn" wx:if="{{showCancelButton}}">{{cancelButtonText}}</view>
|
|
20
|
+
</view>
|
|
21
|
+
</view>
|
|
22
|
+
<!-- 输入样式 -->
|
|
23
|
+
<view class="dialog_mask" wx:if="{{type=='inputText'}}">
|
|
24
|
+
<view class="dialog_box">
|
|
25
|
+
<view class="title" winp_boxx:if="{{title}}">{{title}}</view>
|
|
26
|
+
<view class="inp_wrapper">
|
|
27
|
+
<textarea class="inp_content" value="{{inpVal}}" maxlength="{{48}}" disable-default-padding adjust-position auto-height auto-focus placeholder="{{placeholder}}" placeholder-style="color: #999;" bindblur="onInputBlur"/>
|
|
28
|
+
</view>
|
|
29
|
+
<view class="default_btn" catchtap="confirmBtn" data-confirmtype="inputDialog" wx:if="{{showConfirmButton}}">{{confirmButtonText}}</view>
|
|
30
|
+
<view class="cancel_btn" catchtap="cancelBtn" wx:if="{{showCancelButton}}">{{cancelButtonText}}</view>
|
|
31
|
+
</view>
|
|
32
|
+
</view>
|
|
33
|
+
<!-- 选择样式 -->
|
|
34
|
+
<view class="dialog_mask" wx:if="{{type=='choose'}}">
|
|
35
|
+
<view class="dialog_box">
|
|
36
|
+
<view class="title" wx:if="{{title}}">{{title}}</view>
|
|
37
|
+
<view class="radio_box">
|
|
38
|
+
<view class="radio_item" wx:for="{{chooiceItems}}" wx:key="index" catchtap="chooseItem" data-chooseitem="{{item}}">
|
|
39
|
+
<image class="radio_icon" src="{{item.value!==curChoosedItemVal?'https://img.tanjiu.cn/home/SBaYKEs2iJiF3564zwRPtHAfB2Hfy7ZW.png':'https://img.tanjiu.cn/home/AD3tpDYJiGjGimY25sCSanJsEYXnEHFk.png'}}"></image>
|
|
40
|
+
<view class="radio_content">
|
|
41
|
+
<view class="radio_text">{{item.label}}</view>
|
|
42
|
+
<view class="radio_remark" wx:if="{{item.remark}}">{{item.remark}}</view>
|
|
43
|
+
</view>
|
|
44
|
+
</view>
|
|
45
|
+
</view>
|
|
46
|
+
<view class="default_btn" catchtap="confirmBtn" data-confirmtype="chooseDialog" wx:if="{{showConfirmButton}}">{{confirmButtonText}}</view>
|
|
47
|
+
<view class="cancel_btn" catchtap="cancelBtn" wx:if="{{showCancelButton}}">{{cancelButtonText}}</view>
|
|
48
|
+
</view>
|
|
49
|
+
</view>
|
|
50
|
+
</block>
|
|
51
|
+
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
/* src/xt-dialog/index.wxss */
|
|
2
|
+
|
|
3
|
+
.dialog_mask{
|
|
4
|
+
position: fixed;
|
|
5
|
+
top: 0;
|
|
6
|
+
left: 0;
|
|
7
|
+
z-index: 9999;
|
|
8
|
+
width: 100vw;
|
|
9
|
+
height: 100vh;
|
|
10
|
+
background-color: rgba(0, 0, 0, 0.6);
|
|
11
|
+
display: flex;
|
|
12
|
+
justify-content: center;
|
|
13
|
+
align-items: center;
|
|
14
|
+
}
|
|
15
|
+
.dialog_box{
|
|
16
|
+
padding: 64rpx 48rpx;
|
|
17
|
+
box-sizing: border-box;
|
|
18
|
+
border-radius: 16rpx;
|
|
19
|
+
text-align: center;
|
|
20
|
+
width: 654rpx;
|
|
21
|
+
/* margin: 100rpx auto; */
|
|
22
|
+
background-color: rgba(255, 255, 255);
|
|
23
|
+
}
|
|
24
|
+
.title{
|
|
25
|
+
line-height: 56rpx;
|
|
26
|
+
font-size: 40rpx;
|
|
27
|
+
font-family: PingFang SC-Semibold, PingFang SC;
|
|
28
|
+
font-weight: 800;
|
|
29
|
+
color: #000000;
|
|
30
|
+
margin-bottom: 32rpx;
|
|
31
|
+
}
|
|
32
|
+
.content{
|
|
33
|
+
line-height: 56rpx;
|
|
34
|
+
font-size: 40rpx;
|
|
35
|
+
font-family: PingFang SC-Regular, PingFang SC;
|
|
36
|
+
font-weight: 400;
|
|
37
|
+
color: #000000;
|
|
38
|
+
margin-bottom: 64rpx;
|
|
39
|
+
}
|
|
40
|
+
.image{
|
|
41
|
+
width: 558rpx;
|
|
42
|
+
height: 306rpx;
|
|
43
|
+
border-radius: 2rpx;
|
|
44
|
+
margin-bottom: 32rpx;
|
|
45
|
+
border-radius: 2rpx;
|
|
46
|
+
}
|
|
47
|
+
.default_btn{
|
|
48
|
+
width: 558rpx;
|
|
49
|
+
height: 96rpx;
|
|
50
|
+
line-height: 96rpx;
|
|
51
|
+
background: #6722AB;
|
|
52
|
+
border-radius: 120rpx;
|
|
53
|
+
color:#fff;
|
|
54
|
+
font-size: 40rpx;
|
|
55
|
+
font-family: PingFang SC-Semibold, PingFang SC;
|
|
56
|
+
font-weight: 800;
|
|
57
|
+
}
|
|
58
|
+
.cancel_btn{
|
|
59
|
+
margin-top: 24rpx;
|
|
60
|
+
width: 558rpx;
|
|
61
|
+
height: 94rpx;
|
|
62
|
+
border-radius: 120rpx;
|
|
63
|
+
border: 2rpx solid #999999;
|
|
64
|
+
line-height: 94rpx;
|
|
65
|
+
color:#000;
|
|
66
|
+
font-size: 40rpx;
|
|
67
|
+
font-family: PingFang SC-Semibold, PingFang SC;
|
|
68
|
+
font-weight: 800;
|
|
69
|
+
}
|
|
70
|
+
.inp_wrapper{
|
|
71
|
+
border-radius: 16rpx;
|
|
72
|
+
width: 558rpx;
|
|
73
|
+
box-sizing: border-box;
|
|
74
|
+
margin-bottom: 64rpx;
|
|
75
|
+
padding: 32rpx 24rpx;
|
|
76
|
+
background-color: #f5f5f5;
|
|
77
|
+
}
|
|
78
|
+
.inp_content{
|
|
79
|
+
box-sizing: border-box;
|
|
80
|
+
text-align: left;
|
|
81
|
+
width: 510rpx;
|
|
82
|
+
background-color: #f6f6f6;
|
|
83
|
+
font-size: 40rpx;
|
|
84
|
+
color: #000000;
|
|
85
|
+
}
|
|
86
|
+
.radio_box{
|
|
87
|
+
margin-bottom: 64rpx;
|
|
88
|
+
}
|
|
89
|
+
.radio_item{
|
|
90
|
+
display: flex;
|
|
91
|
+
align-items: baseline;
|
|
92
|
+
/* justify-content: space-between; */
|
|
93
|
+
margin-bottom: 32rpx;
|
|
94
|
+
}
|
|
95
|
+
.radio_item:last-child{
|
|
96
|
+
margin-bottom: 0;
|
|
97
|
+
}
|
|
98
|
+
.radio_icon{
|
|
99
|
+
margin-right: 16rpx;
|
|
100
|
+
width: 40rpx;
|
|
101
|
+
height: 40rpx;
|
|
102
|
+
}
|
|
103
|
+
.radio_content{
|
|
104
|
+
width: 502rpx;
|
|
105
|
+
text-align: left;
|
|
106
|
+
}
|
|
107
|
+
.radio_text{
|
|
108
|
+
line-height: 56rpx;
|
|
109
|
+
font-size: 40rpx;
|
|
110
|
+
font-family: PingFang SC-Regular, PingFang SC;
|
|
111
|
+
font-weight: 400;
|
|
112
|
+
color: #000000;
|
|
113
|
+
}
|
|
114
|
+
.radio_remark{
|
|
115
|
+
line-height: 44rpx;
|
|
116
|
+
font-size: 32rpx;
|
|
117
|
+
font-family: PingFang SC-Regular, PingFang SC;
|
|
118
|
+
font-weight: 400;
|
|
119
|
+
color: #999999;
|
|
120
|
+
margin-top: 16rpx;
|
|
121
|
+
}
|