@xtdev/xt-miniprogram-ui 1.2.59 → 1.2.60

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.
Files changed (82) hide show
  1. package/package.json +1 -1
  2. package/libs/package.json +0 -1
  3. package/libs/xt-button/README.md +0 -60
  4. package/libs/xt-button/index.js +0 -116
  5. package/libs/xt-button/index.json +0 -7
  6. package/libs/xt-button/index.wxml +0 -31
  7. package/libs/xt-button/index.wxss +0 -70
  8. package/libs/xt-card-cell/README.md +0 -67
  9. package/libs/xt-card-cell/index.js +0 -43
  10. package/libs/xt-card-cell/index.json +0 -6
  11. package/libs/xt-card-cell/index.wxml +0 -34
  12. package/libs/xt-card-cell/index.wxss +0 -89
  13. package/libs/xt-cell/README.md +0 -41
  14. package/libs/xt-cell/index.js +0 -42
  15. package/libs/xt-cell/index.json +0 -7
  16. package/libs/xt-cell/index.wxml +0 -12
  17. package/libs/xt-cell/index.wxss +0 -50
  18. package/libs/xt-date-picker/README.md +0 -77
  19. package/libs/xt-date-picker/index.js +0 -443
  20. package/libs/xt-date-picker/index.json +0 -7
  21. package/libs/xt-date-picker/index.wxml +0 -58
  22. package/libs/xt-date-picker/index.wxss +0 -118
  23. package/libs/xt-date-picker-loop/README.md +0 -77
  24. package/libs/xt-date-picker-loop/index.js +0 -684
  25. package/libs/xt-date-picker-loop/index.json +0 -8
  26. package/libs/xt-date-picker-loop/index.wxml +0 -61
  27. package/libs/xt-date-picker-loop/index.wxss +0 -117
  28. package/libs/xt-dialog/README.md +0 -157
  29. package/libs/xt-dialog/index.js +0 -142
  30. package/libs/xt-dialog/index.json +0 -5
  31. package/libs/xt-dialog/index.wxml +0 -64
  32. package/libs/xt-dialog/index.wxss +0 -129
  33. package/libs/xt-form/index.js +0 -83
  34. package/libs/xt-form/index.json +0 -5
  35. package/libs/xt-form/index.wxml +0 -67
  36. package/libs/xt-form/index.wxss +0 -141
  37. package/libs/xt-icon/README.md +0 -39
  38. package/libs/xt-icon/index.js +0 -25
  39. package/libs/xt-icon/index.json +0 -5
  40. package/libs/xt-icon/index.wxml +0 -2
  41. package/libs/xt-icon/index.wxss +0 -159
  42. package/libs/xt-popover/README.md +0 -71
  43. package/libs/xt-popover/index.js +0 -209
  44. package/libs/xt-popover/index.json +0 -7
  45. package/libs/xt-popover/index.wxml +0 -43
  46. package/libs/xt-popover/index.wxss +0 -135
  47. package/libs/xt-search/README.md +0 -55
  48. package/libs/xt-search/index.js +0 -88
  49. package/libs/xt-search/index.json +0 -7
  50. package/libs/xt-search/index.wxml +0 -17
  51. package/libs/xt-search/index.wxss +0 -82
  52. package/libs/xt-stepper/README.md +0 -52
  53. package/libs/xt-stepper/index.js +0 -158
  54. package/libs/xt-stepper/index.json +0 -5
  55. package/libs/xt-stepper/index.wxml +0 -11
  56. package/libs/xt-stepper/index.wxss +0 -77
  57. package/libs/xt-steps/README.md +0 -79
  58. package/libs/xt-steps/index.js +0 -37
  59. package/libs/xt-steps/index.json +0 -7
  60. package/libs/xt-steps/index.wxml +0 -34
  61. package/libs/xt-steps/index.wxss +0 -186
  62. package/libs/xt-tabs/README.md +0 -98
  63. package/libs/xt-tabs/index.js +0 -35
  64. package/libs/xt-tabs/index.json +0 -6
  65. package/libs/xt-tabs/index.wxml +0 -10
  66. package/libs/xt-tabs/index.wxss +0 -76
  67. package/libs/xt-tag/README.md +0 -65
  68. package/libs/xt-tag/index.js +0 -38
  69. package/libs/xt-tag/index.json +0 -7
  70. package/libs/xt-tag/index.wxml +0 -5
  71. package/libs/xt-tag/index.wxss +0 -36
  72. package/libs/xt-toast/README.md +0 -65
  73. package/libs/xt-toast/index.js +0 -85
  74. package/libs/xt-toast/index.json +0 -7
  75. package/libs/xt-toast/index.wxml +0 -6
  76. package/libs/xt-toast/index.wxss +0 -27
  77. package/libs/xt-uploader/README.md +0 -46
  78. package/libs/xt-uploader/index.js +0 -233
  79. package/libs/xt-uploader/index.json +0 -7
  80. package/libs/xt-uploader/index.wxml +0 -15
  81. package/libs/xt-uploader/index.wxss +0 -68
  82. package/libs/xt-uploader/utils.js +0 -69
@@ -1,233 +0,0 @@
1
- // src/xt-uploader/index.js
2
- const utils = require("./utils");
3
- // 节流函数
4
- function _throttle(fn, wait = 500, isImmediate = false){
5
- var flag = true;
6
- return function(){
7
- if(flag == true){
8
- var context = this
9
- var args = arguments
10
- flag = false
11
- isImmediate && fn.apply(context,args)
12
- setTimeout(() => {
13
- !isImmediate && fn.apply(context,args)
14
- flag = true
15
- },wait)
16
- }
17
- }
18
- }
19
-
20
- Component({
21
- /**
22
- * 组件的属性列表
23
- */
24
- properties: {
25
- title: {
26
- type: String,
27
- value: "",
28
- },
29
- fileList: {
30
- type: Array,
31
- value: [],
32
- },
33
- max: {
34
- type: Number,
35
- value: 9,
36
- },
37
- uploadDesc: {
38
- type: String,
39
- value: "",
40
- },
41
- // ["album", "camera"]
42
- sourceType: {
43
- type: Array,
44
- value: ["album", "camera"],
45
- },
46
- customUpload: {
47
- type: Boolean,
48
- value: false,
49
- },
50
- disabled: {
51
- type: Boolean,
52
- value: false,
53
- },
54
- uploadApi: {
55
- type: Object,
56
- value: {},
57
- },
58
- },
59
-
60
- /**
61
- * 组件的初始数据
62
- */
63
- data: {},
64
-
65
- /**
66
- * 组件的方法列表
67
- */
68
- methods: {
69
- // 预览
70
- onPreviewImage(e) {
71
- const url = e.target.dataset.url;
72
- // const index = e.target.dataset.index;
73
- wx.previewImage({
74
- urls: this.properties.fileList,
75
- current: url,
76
- });
77
- },
78
- // 删除
79
- onDelete(e) {
80
- const url = e.currentTarget.dataset.url;
81
- const index = e.currentTarget.dataset.index;
82
- this.properties.fileList.splice(index, 1);
83
- this.triggerEvent("delete", {
84
- fileList: this.properties.fileList,
85
- url,
86
- index,
87
- });
88
- },
89
- // 上传成功
90
- onUploadSuccess(files, url) {
91
- this.triggerEvent("upload", { fileList: files, url });
92
- },
93
- // 上传失败
94
- onUploadError(errMsg) {
95
- this.triggerEvent("error", { errMsg });
96
- },
97
- // 点击上传
98
- startTakePhoto: _throttle(function (e) {
99
- console.log("onStartTakePhoto", e);
100
- const _this = this;
101
- const {
102
- customUpload,
103
- uploadApi,
104
- max,
105
- sourceType,
106
- fileList,
107
- } = this.properties;
108
- if (customUpload) {
109
- this.triggerEvent("upload", {});
110
- return;
111
- }
112
- if (!uploadApi || !uploadApi.url) {
113
- wx.showToast({
114
- title: "请传入上传接口",
115
- icon: "error",
116
- });
117
- return;
118
- }
119
- // ios企微环境下不支持该API
120
- const { platform, environment } = this.getSystemInfo();
121
- console.log(platform, environment);
122
- let chooseImgApi = (environment !== "wxwork" || platform !== "ios") ? wx.chooseMedia : wx.chooseImage;
123
- chooseImgApi({
124
- count: max - fileList.length,
125
- mediaType: ["image"],
126
- sizeType: ["compressed"],
127
- sourceType,
128
- success(res) {
129
- console.log(res, "0000");
130
- // tempFilePath可以作为img标签的src属性显示图片
131
- const tempFilePaths = res.tempFiles;
132
- if (Array.isArray(tempFilePaths) && tempFilePaths.length) {
133
- Promise.allSettled(
134
- tempFilePaths.map((temp) =>
135
- _this.uploadImage_v(temp.tempFilePath || temp.path)
136
- )
137
- ).then((uploadRes) => {
138
- wx.hideLoading();
139
- console.log("----uploadRes", uploadRes);
140
- // 上传成功
141
- const successUrls = uploadRes
142
- .filter((result) => result.status == "fulfilled")
143
- .map((result) => result.value);
144
- if (successUrls.length) {
145
- const files = fileList.concat(successUrls);
146
- _this.onUploadSuccess(files, successUrls);
147
- }
148
- // 上传失败
149
- const errorList = uploadRes.filter(
150
- (result) => result.status == "rejected"
151
- );
152
- if (errorList.length) {
153
- _this.onUploadError(errorList[0].value);
154
- }
155
- });
156
- }
157
- },
158
- fail(error) {
159
- _this.onUploadError(error && error.errMsg);
160
- console.log("-----选取失败", error && error.errMsg);
161
- },
162
- });
163
- }, 1500, true),
164
- getSystemInfo() {
165
- const environment = wx.getSystemInfoSync().environment || "wechat";
166
- const platform = wx.getSystemInfoSync().platform;
167
- return {
168
- environment,
169
- platform,
170
- };
171
- },
172
- // 上传文件
173
- uploadImage_v(filePaths) {
174
- return new Promise((resolve, reject) => {
175
- const { url, fileDir, ...header } = this.properties.uploadApi;
176
- wx.showLoading({title: "上传中", mask: true});
177
- utils.newHttp(
178
- url,
179
- "GET",
180
- {
181
- dir: fileDir || "microComponents",
182
- },
183
- header,
184
- (res) => {
185
- const { host, signature, accessKeyId, policy, dir } = res.data;
186
- if (host) {
187
- let path = filePaths;
188
- let name = utils.random_string(32) + utils.get_suffix(path);
189
- wx.uploadFile({
190
- url: host,
191
- filePath: filePaths,
192
- name: "file",
193
- formData: {
194
- key: dir + "/" + name,
195
- policy,
196
- success_action_status: "200",
197
- OSSAccessKeyId: accessKeyId,
198
- signature,
199
- },
200
- header: {
201
- // "Content-Type": "multipart/form-data",
202
- },
203
- success: (res) => {
204
- if (res.statusCode == 200) {
205
- let url = host + dir + "/" + name;
206
- resolve(url);
207
- // fileList.push(url);
208
- // _this.onUploadSuccess(url);
209
- // wx.showToast({
210
- // icon: "success",
211
- // title: "上传成功",
212
- // });
213
- }
214
- },
215
- fail: (err) => {
216
- reject(err.errMsg || "网络错误,请重试");
217
- // _this.onUploadError(err.errMsg || "网络错误,请重试");
218
- // wx.showToast({
219
- // icon: "error",
220
- // title: err.errMsg || "网络错误,请重试",
221
- // });
222
- },
223
- });
224
- } else {
225
- reject(res.message);
226
- // _this.onUploadError(res.message);
227
- }
228
- }
229
- );
230
- });
231
- },
232
- },
233
- });
@@ -1,7 +0,0 @@
1
- {
2
- "component": true,
3
- "styleIsolation": "apply-shared",
4
- "usingComponents": {
5
- "xt-icon": "../xt-icon/index"
6
- }
7
- }
@@ -1,15 +0,0 @@
1
- <!-- src/xt-uploader/index.wxml -->
2
- <view class="xt-uploader">
3
- <view class="title_text" wx:if="{{title}}">{{title}}</view>
4
- <view class="file_box">
5
- <view wx:for="{{fileList}}" wx:key="index" class="file_item">
6
- <image class="file_img" src="{{item}}" mode="aspectFit" bindtap="onPreviewImage" data-url="{{item}}" data-index="{{index}}" />
7
- <!-- 删除 -->
8
- <xt-icon icon="shanchu" size="48" class="close_box" bindtap="onDelete" data-url="{{item}}" data-index="{{index}}" wx:if="{{!disabled}}"></xt-icon>
9
- </view>
10
- <view class="file_item" wx:if="{{!disabled && fileList.length<max}}" bindtap="startTakePhoto">
11
- <image src="https://img.tanjiu.cn/home/DDDsrH7PpNhneQsXGFmGGPcSM3QYXG8N.png" class="camera_icon" />
12
- <view wx:if="{{uploadDesc}}" class="upload_desc">{{uploadDesc}}</view>
13
- </view>
14
- </view>
15
- </view>
@@ -1,68 +0,0 @@
1
- /* src/xt-uploader/index.wxss */
2
- .xt-uploader {
3
- background-color : #fff;
4
- /* padding : 32rpx;
5
- padding-bottom : 0; */
6
- }
7
-
8
- .title_text {
9
- line-height: 48rpx;
10
- font-size : 34rpx;
11
- font-family: PingFang SC-Semibold,
12
- PingFang SC;
13
- font-weight : 800;
14
- color : #000000;
15
- margin-bottom: 16rpx;
16
- }
17
-
18
- .file_box {
19
- display : flex;
20
- flex-wrap: wrap;
21
- }
22
-
23
- .file_item {
24
- width : 196rpx;
25
- height : 196rpx;
26
- border-radius : 8rpx;
27
- overflow : hidden;
28
- position : relative;
29
- display : flex;
30
- flex-direction : column;
31
- justify-content : center;
32
- align-items : center;
33
- background-color: #F5F5F5;
34
- margin-bottom : 16rpx;
35
- flex-shrink: 0;
36
- }
37
-
38
- .file_item:not(:last-child) {
39
- margin-right: 16rpx;
40
- }
41
-
42
- .camera_icon {
43
- width : 80rpx;
44
- height: 80rpx;
45
- }
46
-
47
- .file_img {
48
- width : 196rpx;
49
- height: 196rpx;
50
- }
51
-
52
- .close_box {
53
- position : absolute;
54
- line-height: 48rpx;
55
- top : 0;
56
- right : 0;
57
- color : rgba(0, 0, 0, 0.5);
58
- }
59
-
60
- .upload_desc {
61
- line-height: 40rpx;
62
- font-size : 28rpx;
63
- font-family: PingFang SC-Regular,
64
- PingFang SC;
65
- font-weight: 400;
66
- color : #727272;
67
- margin-top : 8rpx;
68
- }
@@ -1,69 +0,0 @@
1
- // import md5 from "md5";
2
-
3
- function newhttpRequest(url, method, params, header, callBack) {
4
- wx.request({
5
- url,
6
- method: method,
7
- header: {
8
- "content-type": "application/json",
9
- // Authorization: md5(pass),
10
- token: "openApi",
11
- ...header,
12
- },
13
- data: params,
14
- success(res) {
15
- if (res.data) {
16
- var result = {
17
- data: res.data.data || res.data.retdata || res,
18
- message: res.data.message || res.data.errMsg,
19
- code:
20
- res.data.code ||
21
- res.data.errCode ||
22
- (res.data.code == 0 || res.data.errCode == 0 ? 0 : null),
23
- };
24
- callBack(result);
25
- }
26
- },
27
- fail(err) {
28
- var result = {
29
- success: false,
30
- data: {},
31
- message: err.errMsg || err.msg,
32
- };
33
- wx.showToast({
34
- title: result.message || "请检查网络是否通畅,稍后重试!",
35
- icon: "none",
36
- });
37
- console.log("err = ", err);
38
- callBack(result);
39
- },
40
- });
41
- }
42
-
43
- function random_string(len) {
44
- len = len || 32;
45
- let chars = "ABCDEFGHJKMNPQRSTWXYZabcdefhijkmnprstwxyz2345678";
46
- let maxPos = chars.length;
47
- let pwd = "";
48
- for (let i = 0; i < len; i++) {
49
- pwd += chars.charAt(Math.floor(Math.random() * maxPos));
50
- }
51
- return pwd;
52
- }
53
-
54
- // 解密
55
- function get_suffix(filename) {
56
- console.log(filename, "filename");
57
- let pos = filename.lastIndexOf(".");
58
- let suffix = "";
59
- if (pos != -1) {
60
- suffix = filename.substring(pos);
61
- }
62
- return suffix;
63
- }
64
-
65
- module.exports = {
66
- newHttp: newhttpRequest,
67
- random_string,
68
- get_suffix,
69
- };