From 315832d15183bcfa2c20d4f96e42c0b69556d737 Mon Sep 17 00:00:00 2001 From: RuoYi Date: Tue, 25 Mar 2025 16:58:54 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8D=87=E7=BA=A7uni-ui=E5=88=B0=E6=9C=80?= =?UTF-8?q?=E6=96=B0=E7=89=88=E6=9C=AC1.5.7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- uni_modules/uni-calendar/changelog.md | 4 + .../components/uni-calendar/calendar.js | 2 - .../components/uni-calendar/uni-calendar.vue | 3 +- .../components/uni-calendar/util.js | 2 +- uni_modules/uni-calendar/package.json | 7 +- .../uni-card/components/uni-card/uni-card.vue | 4 +- uni_modules/uni-collapse/changelog.md | 2 + .../uni-collapse-item/uni-collapse-item.vue | 2 +- uni_modules/uni-collapse/package.json | 11 +- uni_modules/uni-combox/changelog.md | 2 + .../components/uni-combox/uni-combox.vue | 50 +- uni_modules/uni-combox/package.json | 16 +- uni_modules/uni-countdown/changelog.md | 4 + .../uni-countdown/uni-countdown.vue | 39 +- uni_modules/uni-countdown/package.json | 16 +- uni_modules/uni-data-checkbox/changelog.md | 6 + .../components/uni-data-checkbox/clientdb.js | 316 +++ .../uni-data-checkbox/uni-data-checkbox.vue | 128 +- uni_modules/uni-data-checkbox/package.json | 11 +- uni_modules/uni-data-picker/changelog.md | 4 + .../uni-data-picker/uni-data-picker.uvue | 381 +++ .../uni-data-picker/uni-data-picker.vue | 1102 ++++----- .../uni-data-pickerview/uni-data-picker.uts | 692 ++++++ .../uni-data-pickerview.css | 76 + .../uni-data-pickerview.uvue | 69 + .../uni-data-pickerview.vue | 646 ++--- uni_modules/uni-data-picker/package.json | 7 +- uni_modules/uni-data-picker/readme.md | 2 +- uni_modules/uni-data-select/changelog.md | 4 + .../uni-data-select/uni-data-select.vue | 115 +- uni_modules/uni-data-select/package.json | 5 +- uni_modules/uni-datetime-picker/changelog.md | 41 +- .../uni-datetime-picker/calendar.vue | 161 +- .../uni-datetime-picker/time-picker.vue | 40 +- .../uni-datetime-picker.vue | 2090 +++++++++-------- .../components/uni-datetime-picker/util.js | 184 +- uni_modules/uni-datetime-picker/package.json | 5 +- .../components/uni-drawer/uni-drawer.vue | 54 +- uni_modules/uni-easyinput/changelog.md | 18 + .../components/uni-easyinput/common.js | 2 - .../uni-easyinput/uni-easyinput.vue | 1213 +++++----- uni_modules/uni-easyinput/package.json | 5 +- uni_modules/uni-fab/changelog.md | 2 + .../uni-fab/components/uni-fab/uni-fab.vue | 6 +- uni_modules/uni-fab/package.json | 5 +- uni_modules/uni-file-picker/changelog.md | 14 + .../uni-file-picker/choose-and-upload-file.js | 71 +- .../uni-file-picker/uni-file-picker.vue | 23 +- .../uni-file-picker/upload-file.vue | 52 +- .../uni-file-picker/upload-image.vue | 76 +- .../components/uni-file-picker/utils.js | 1 + uni_modules/uni-file-picker/package.json | 5 +- uni_modules/uni-forms/changelog.md | 8 + .../uni-forms-item/uni-forms-item.vue | 19 +- .../components/uni-forms/uni-forms.vue | 21 +- uni_modules/uni-forms/package.json | 5 +- .../uni-grid-item/uni-grid-item.vue | 2 +- .../uni-grid/components/uni-grid/uni-grid.vue | 2 +- uni_modules/uni-icons/changelog.md | 20 + .../uni-icons/components/uni-icons/icons.js | 1169 --------- .../components/uni-icons/uni-icons.uvue | 91 + .../components/uni-icons/uni-icons.vue | 88 +- .../components/uni-icons/uniicons.css | 65 +- .../components/uni-icons/uniicons.ttf | Bin 35760 -> 35824 bytes .../components/uni-icons/uniicons_file.ts | 664 ++++++ .../components/uni-icons/uniicons_file_vue.js | 649 +++++ uni_modules/uni-icons/package.json | 29 +- .../uni-indexed-list-item.vue | 12 +- .../uni-indexed-list/uni-indexed-list.vue | 6 +- uni_modules/uni-list/changelog.md | 2 + .../uni-list-item/uni-list-item.vue | 2 +- uni_modules/uni-list/package.json | 11 +- uni_modules/uni-list/readme.md | 306 +-- uni_modules/uni-load-more/changelog.md | 6 + .../uni-load-more/uni-load-more.vue | 9 +- uni_modules/uni-load-more/package.json | 16 +- uni_modules/uni-nav-bar/changelog.md | 6 + .../components/uni-nav-bar/uni-nav-bar.vue | 2 +- .../components/uni-nav-bar/uni-status-bar.vue | 10 +- uni_modules/uni-nav-bar/package.json | 7 +- uni_modules/uni-notice-bar/changelog.md | 2 + .../uni-notice-bar/uni-notice-bar.vue | 5 + uni_modules/uni-notice-bar/package.json | 2 +- uni_modules/uni-number-box/changelog.md | 14 + .../uni-number-box/uni-number-box.vue | 33 +- uni_modules/uni-number-box/package.json | 14 +- uni_modules/uni-popup/changelog.md | 22 + .../uni-popup-dialog/uni-popup-dialog.vue | 103 +- .../uni-popup-share/uni-popup-share.vue | 13 +- .../components/uni-popup/uni-popup.uvue | 90 + .../components/uni-popup/uni-popup.vue | 77 +- uni_modules/uni-popup/package.json | 13 +- .../uni-rate/components/uni-rate/uni-rate.vue | 54 +- .../uni-row/components/uni-col/uni-col.vue | 2 +- .../uni-row/components/uni-row/uni-row.vue | 2 +- uni_modules/uni-search-bar/changelog.md | 14 + .../uni-search-bar/i18n/zh-Hans.json | 4 +- .../uni-search-bar/i18n/zh-Hant.json | 4 +- .../uni-search-bar/uni-search-bar.vue | 35 +- uni_modules/uni-search-bar/package.json | 14 +- .../uni-segmented-control/changelog.md | 6 + .../uni-segmented-control.vue | 31 +- .../uni-segmented-control/package.json | 14 +- uni_modules/uni-steps/changelog.md | 2 + .../components/uni-steps/uni-steps.vue | 29 +- uni_modules/uni-steps/package.json | 14 +- uni_modules/uni-swipe-action/changelog.md | 4 + .../uni-swipe-action-item.vue | 29 +- uni_modules/uni-swipe-action/package.json | 13 +- .../uni-swiper-dot/uni-swiper-dot.vue | 2 +- uni_modules/uni-table/changelog.md | 6 + .../components/uni-table/uni-table.vue | 19 +- .../components/uni-tbody/uni-tbody.vue | 11 +- .../uni-table/components/uni-td/uni-td.vue | 11 +- .../uni-table/components/uni-th/uni-th.vue | 18 +- .../components/uni-thead/uni-thead.vue | 202 +- .../uni-table/components/uni-tr/uni-tr.vue | 291 +-- uni_modules/uni-table/package.json | 7 +- uni_modules/uni-tag/changelog.md | 2 + .../uni-tag/components/uni-tag/uni-tag.vue | 32 +- uni_modules/uni-tag/package.json | 11 +- uni_modules/uni-tooltip/changelog.md | 6 + .../components/uni-tooltip/uni-tooltip.vue | 50 +- uni_modules/uni-tooltip/package.json | 16 +- uni_modules/uni-transition/changelog.md | 4 + .../uni-transition/uni-transition.vue | 9 +- uni_modules/uni-transition/package.json | 14 +- 127 files changed, 7327 insertions(+), 5066 deletions(-) create mode 100644 uni_modules/uni-data-checkbox/components/uni-data-checkbox/clientdb.js create mode 100644 uni_modules/uni-data-picker/components/uni-data-picker/uni-data-picker.uvue create mode 100644 uni_modules/uni-data-picker/components/uni-data-pickerview/uni-data-picker.uts create mode 100644 uni_modules/uni-data-picker/components/uni-data-pickerview/uni-data-pickerview.css create mode 100644 uni_modules/uni-data-picker/components/uni-data-pickerview/uni-data-pickerview.uvue delete mode 100644 uni_modules/uni-icons/components/uni-icons/icons.js create mode 100644 uni_modules/uni-icons/components/uni-icons/uni-icons.uvue create mode 100644 uni_modules/uni-icons/components/uni-icons/uniicons_file.ts create mode 100644 uni_modules/uni-icons/components/uni-icons/uniicons_file_vue.js create mode 100644 uni_modules/uni-popup/components/uni-popup/uni-popup.uvue diff --git a/uni_modules/uni-calendar/changelog.md b/uni_modules/uni-calendar/changelog.md index f291eec..30ca0df 100644 --- a/uni_modules/uni-calendar/changelog.md +++ b/uni_modules/uni-calendar/changelog.md @@ -1,3 +1,7 @@ +## 1.4.12(2024-09-21) +- 修复 calendar在选择日期范围后重新选择日期需要点两次的Bug +## 1.4.11(2024-01-10) +- 修复 回到今天时,月份显示不一致问题 ## 1.4.10(2023-04-10) - 修复 某些情况 monthSwitch 未触发的Bug ## 1.4.9(2023-02-02) diff --git a/uni_modules/uni-calendar/components/uni-calendar/calendar.js b/uni_modules/uni-calendar/components/uni-calendar/calendar.js index b8d7d6f..55eed81 100644 --- a/uni_modules/uni-calendar/components/uni-calendar/calendar.js +++ b/uni_modules/uni-calendar/components/uni-calendar/calendar.js @@ -351,10 +351,8 @@ var calendar = { s = '\u521d\u5341'; break case 20: s = '\u4e8c\u5341'; break - break case 30: s = '\u4e09\u5341'; break - break default : s = this.nStr2[Math.floor(d / 10)] s += this.nStr1[d % 10] diff --git a/uni_modules/uni-calendar/components/uni-calendar/uni-calendar.vue b/uni_modules/uni-calendar/components/uni-calendar/uni-calendar.vue index 9cc64bd..1e00254 100644 --- a/uni_modules/uni-calendar/components/uni-calendar/uni-calendar.vue +++ b/uni_modules/uni-calendar/components/uni-calendar/uni-calendar.vue @@ -328,11 +328,12 @@ const date = this.cale.getDate(new Date()) const todayYearMonth = `${date.year}-${date.month}` + this.init(date.fullDate) + if(nowYearMonth !== todayYearMonth) { this.monthSwitch() } - this.init(date.fullDate) this.change() }, /** diff --git a/uni_modules/uni-calendar/components/uni-calendar/util.js b/uni_modules/uni-calendar/components/uni-calendar/util.js index 671f61e..6e949d7 100644 --- a/uni_modules/uni-calendar/components/uni-calendar/util.js +++ b/uni_modules/uni-calendar/components/uni-calendar/util.js @@ -296,7 +296,7 @@ class Calendar { if (!this.range) return if (before && after) { - this.multipleStatus.before = '' + this.multipleStatus.before = fullDate this.multipleStatus.after = '' this.multipleStatus.data = [] } else { diff --git a/uni_modules/uni-calendar/package.json b/uni_modules/uni-calendar/package.json index fad841f..ec924e9 100644 --- a/uni_modules/uni-calendar/package.json +++ b/uni_modules/uni-calendar/package.json @@ -1,7 +1,7 @@ { "id": "uni-calendar", "displayName": "uni-calendar 日历", - "version": "1.4.10", + "version": "1.4.12", "description": "日历组件", "keywords": [ "uni-ui", @@ -44,7 +44,8 @@ "platforms": { "cloud": { "tcb": "y", - "aliyun": "y" + "aliyun": "y", + "alipay": "n" }, "client": { "App": { @@ -82,4 +83,4 @@ } } } -} \ No newline at end of file +} diff --git a/uni_modules/uni-card/components/uni-card/uni-card.vue b/uni_modules/uni-card/components/uni-card/uni-card.vue index 4b7db7b..b3ec4c2 100644 --- a/uni_modules/uni-card/components/uni-card/uni-card.vue +++ b/uni_modules/uni-card/components/uni-card/uni-card.vue @@ -21,9 +21,7 @@ - - {{ extra }} - + {{ extra }} diff --git a/uni_modules/uni-collapse/changelog.md b/uni_modules/uni-collapse/changelog.md index 292e4c7..455308a 100644 --- a/uni_modules/uni-collapse/changelog.md +++ b/uni_modules/uni-collapse/changelog.md @@ -1,3 +1,5 @@ +## 1.4.4(2024-03-20) +- 修复 titleBorder类型修正 ## 1.4.3(2022-01-25) - 修复 初始化的时候 ,open 属性失效的bug ## 1.4.2(2022-01-21) diff --git a/uni_modules/uni-collapse/components/uni-collapse-item/uni-collapse-item.vue b/uni_modules/uni-collapse/components/uni-collapse-item/uni-collapse-item.vue index b2aad1f..63d30e3 100644 --- a/uni_modules/uni-collapse/components/uni-collapse-item/uni-collapse-item.vue +++ b/uni_modules/uni-collapse/components/uni-collapse-item/uni-collapse-item.vue @@ -40,7 +40,7 @@ * @property {String} name 唯一标志符 * @property {Boolean} open = [true|false] 是否展开组件 * @property {Boolean} titleBorder = [true|false] 是否显示标题分隔线 - * @property {Boolean} border = [true|false] 是否显示分隔线 + * @property {String} border = ['auto'|'show'|'none'] 是否显示分隔线 * @property {Boolean} disabled = [true|false] 是否展开面板 * @property {Boolean} showAnimation = [true|false] 开启动画 * @property {Boolean} showArrow = [true|false] 是否显示右侧箭头 diff --git a/uni_modules/uni-collapse/package.json b/uni_modules/uni-collapse/package.json index 65349cf..65c5c2e 100644 --- a/uni_modules/uni-collapse/package.json +++ b/uni_modules/uni-collapse/package.json @@ -1,7 +1,7 @@ { "id": "uni-collapse", "displayName": "uni-collapse 折叠面板", - "version": "1.4.3", + "version": "1.4.4", "description": "Collapse 组件,可以折叠 / 展开的内容区域。", "keywords": [ "uni-ui", @@ -16,11 +16,7 @@ "directories": { "example": "../../temps/example_temps" }, - "dcloudext": { - "category": [ - "前端组件", - "通用组件" - ], +"dcloudext": { "sale": { "regular": { "price": "0.00" @@ -37,7 +33,8 @@ "data": "无", "permissions": "无" }, - "npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui" + "npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui", + "type": "component-vue" }, "uni_modules": { "dependencies": [ diff --git a/uni_modules/uni-combox/changelog.md b/uni_modules/uni-combox/changelog.md index 23c2748..a9c0f2c 100644 --- a/uni_modules/uni-combox/changelog.md +++ b/uni_modules/uni-combox/changelog.md @@ -1,3 +1,5 @@ +## 1.0.2(2024-09-21) +- 新增 clearAble属性 ## 1.0.1(2021-11-23) - 优化 label、label-width 属性 ## 1.0.0(2021-11-19) diff --git a/uni_modules/uni-combox/components/uni-combox/uni-combox.vue b/uni_modules/uni-combox/components/uni-combox/uni-combox.vue index 83454e5..cc702c2 100644 --- a/uni_modules/uni-combox/components/uni-combox/uni-combox.vue +++ b/uni_modules/uni-combox/components/uni-combox/uni-combox.vue @@ -4,24 +4,25 @@ {{label}} - - + + + + - + {{emptyTips}} - + {{item}} - - @@ -41,6 +42,10 @@ name: 'uniCombox', emits: ['input', 'update:modelValue'], props: { + clearAble: { + type: Boolean, + default: false + }, border: { type: Boolean, default: true @@ -83,8 +88,7 @@ data() { return { showSelector: false, - inputVal: '', - blurTimer:null, + inputVal: '' } }, computed: { @@ -95,9 +99,6 @@ return `width: ${this.labelWidth}` }, filterCandidates() { - if (this.inputVal !== 0 && !this.inputVal) { - return this.candidates - } return this.candidates.filter((item) => { return item.toString().indexOf(this.inputVal) > -1 }) @@ -132,16 +133,10 @@ this.showSelector = true }, onBlur() { - this.blurTimer = setTimeout(() => { + setTimeout(() => { this.showSelector = false }, 153) }, - onScroll(){ // 滚动时将blur的定时器关掉 - if(this.blurTimer) { - clearTimeout(this.blurTimer) - this.blurTimer = null - } - }, onSelectorClick(index) { this.inputVal = this.filterCandidates[index] this.showSelector = false @@ -153,12 +148,16 @@ this.$emit('input', this.inputVal) this.$emit('update:modelValue', this.inputVal) }) + }, + clean() { + this.inputVal = '' + this.onInput() } } } - diff --git a/uni_modules/uni-combox/package.json b/uni_modules/uni-combox/package.json index 4a05c3f..7af24fc 100644 --- a/uni_modules/uni-combox/package.json +++ b/uni_modules/uni-combox/package.json @@ -1,7 +1,7 @@ { "id": "uni-combox", "displayName": "uni-combox 组合框", - "version": "1.0.1", + "version": "1.0.2", "description": "可以选择也可以输入的表单项 ", "keywords": [ "uni-ui", @@ -17,11 +17,7 @@ "directories": { "example": "../../temps/example_temps" }, - "dcloudext": { - "category": [ - "前端组件", - "通用组件" - ], +"dcloudext": { "sale": { "regular": { "price": "0.00" @@ -38,7 +34,8 @@ "data": "无", "permissions": "无" }, - "npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui" + "npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui", + "type": "component-vue" }, "uni_modules": { "dependencies": [ @@ -49,7 +46,8 @@ "platforms": { "cloud": { "tcb": "y", - "aliyun": "y" + "aliyun": "y", + "alipay": "n" }, "client": { "App": { @@ -87,4 +85,4 @@ } } } -} \ No newline at end of file +} diff --git a/uni_modules/uni-countdown/changelog.md b/uni_modules/uni-countdown/changelog.md index f25beef..1337418 100644 --- a/uni_modules/uni-countdown/changelog.md +++ b/uni_modules/uni-countdown/changelog.md @@ -1,3 +1,7 @@ +## 1.2.4(2024-09-21) +- 新增 支持控制显示位数 默认显示2位 +## 1.2.3(2024-02-20) +- 新增 支持控制小时,分钟的显隐:showHour showMinute ## 1.2.2(2022-01-19) - 修复 在微信小程序中样式不生效的bug ## 1.2.1(2022-01-18) diff --git a/uni_modules/uni-countdown/components/uni-countdown/uni-countdown.vue b/uni_modules/uni-countdown/components/uni-countdown/uni-countdown.vue index d8d3faa..badd191 100644 --- a/uni_modules/uni-countdown/components/uni-countdown/uni-countdown.vue +++ b/uni_modules/uni-countdown/components/uni-countdown/uni-countdown.vue @@ -2,10 +2,10 @@ {{ d }} {{dayText}} - {{ h }} - {{ showColon ? ':' : hourText }} - {{ i }} - {{ showColon ? ':' : minuteText }} + {{ h }} + {{ showColon ? ':' : hourText }} + {{ i }} + {{ showColon ? ':' : minuteText }} {{ s }} {{secondText}} @@ -30,6 +30,8 @@ * @property {Number} second 秒 * @property {Number} timestamp 时间戳 * @property {Boolean} showDay = [true|false] 是否显示天数 + * @property {Boolean} showHour = [true|false] 是否显示小时 + * @property {Boolean} showMinute = [true|false] 是否显示分钟 * @property {Boolean} show-colon = [true|false] 是否以冒号为分隔符 * @property {String} splitorColor 分割符号颜色 * @event {Function} timeup 倒计时时间到触发事件 @@ -43,6 +45,14 @@ type: Boolean, default: true }, + showHour: { + type: Boolean, + default: true + }, + showMinute: { + type: Boolean, + default: true + }, showColon: { type: Boolean, default: true @@ -87,9 +97,9 @@ type: Number, default: 0 }, - zeroPad: { - type: Boolean, - default: true + filterShow : { + type:Object, + default:{} } }, data() { @@ -203,14 +213,13 @@ } else { this.timeUp() } - day = (day < 10 && this.zeroPad) ? `0${day}` : day - hour = (hour < 10 && this.zeroPad) ? `0${hour}` : hour - minute = (minute < 10 && this.zeroPad) ? `0${minute}` : minute - second = (second < 10 && this.zeroPad) ? `0${second}` : second - this.d = day - this.h = hour - this.i = minute - this.s = second + this.d = String(day).padStart(this.validFilterShow(this.filterShow.d), '0') + this.h = String(hour).padStart(this.validFilterShow(this.filterShow.h), '0') + this.i = String(minute).padStart(this.validFilterShow(this.filterShow.m), '0') + this.s = String(second).padStart(this.validFilterShow(this.filterShow.s), '0') + }, + validFilterShow(filter){ + return (filter && filter > 0) ? filter : 2; }, startData() { this.seconds = this.toSeconds(this.timestamp, this.day, this.hour, this.minute, this.second) diff --git a/uni_modules/uni-countdown/package.json b/uni_modules/uni-countdown/package.json index 70e99ee..9ec970b 100644 --- a/uni_modules/uni-countdown/package.json +++ b/uni_modules/uni-countdown/package.json @@ -1,7 +1,7 @@ { "id": "uni-countdown", "displayName": "uni-countdown 倒计时", - "version": "1.2.2", + "version": "1.2.4", "description": "CountDown 倒计时组件", "keywords": [ "uni-ui", @@ -16,11 +16,7 @@ "directories": { "example": "../../temps/example_temps" }, - "dcloudext": { - "category": [ - "前端组件", - "通用组件" - ], +"dcloudext": { "sale": { "regular": { "price": "0.00" @@ -37,7 +33,8 @@ "data": "无", "permissions": "无" }, - "npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui" + "npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui", + "type": "component-vue" }, "uni_modules": { "dependencies": ["uni-scss"], @@ -45,7 +42,8 @@ "platforms": { "cloud": { "tcb": "y", - "aliyun": "y" + "aliyun": "y", + "alipay": "n" }, "client": { "App": { @@ -83,4 +81,4 @@ } } } -} \ No newline at end of file +} diff --git a/uni_modules/uni-data-checkbox/changelog.md b/uni_modules/uni-data-checkbox/changelog.md index c7a468a..7c99f6c 100644 --- a/uni_modules/uni-data-checkbox/changelog.md +++ b/uni_modules/uni-data-checkbox/changelog.md @@ -1,3 +1,9 @@ +## 1.0.6(2024-10-22) +- 新增 当 multiple 为 false 且传递的 value 为 数组时,使用数组第一项用作反显 +## 1.0.5(2024-03-20) +- 修复 单选模式下选中样式不生效的bug +## 1.0.4(2024-01-27) +- 修复 修复错别字chagne为change ## 1.0.3(2022-09-16) - 可以使用 uni-scss 控制主题色 ## 1.0.2(2022-06-30) diff --git a/uni_modules/uni-data-checkbox/components/uni-data-checkbox/clientdb.js b/uni_modules/uni-data-checkbox/components/uni-data-checkbox/clientdb.js new file mode 100644 index 0000000..9a44a9e --- /dev/null +++ b/uni_modules/uni-data-checkbox/components/uni-data-checkbox/clientdb.js @@ -0,0 +1,316 @@ + +const events = { + load: 'load', + error: 'error' +} +const pageMode = { + add: 'add', + replace: 'replace' +} + +const attrs = [ + 'pageCurrent', + 'pageSize', + 'collection', + 'action', + 'field', + 'getcount', + 'orderby', + 'where' +] + +export default { + data() { + return { + loading: false, + listData: this.getone ? {} : [], + paginationInternal: { + current: this.pageCurrent, + size: this.pageSize, + count: 0 + }, + errorMessage: '' + } + }, + created() { + let db = null; + let dbCmd = null; + + if(this.collection){ + this.db = uniCloud.database(); + this.dbCmd = this.db.command; + } + + this._isEnded = false + + this.$watch(() => { + let al = [] + attrs.forEach(key => { + al.push(this[key]) + }) + return al + }, (newValue, oldValue) => { + this.paginationInternal.pageSize = this.pageSize + + let needReset = false + for (let i = 2; i < newValue.length; i++) { + if (newValue[i] != oldValue[i]) { + needReset = true + break + } + } + if (needReset) { + this.clear() + this.reset() + } + if (newValue[0] != oldValue[0]) { + this.paginationInternal.current = this.pageCurrent + } + + this._execLoadData() + }) + + // #ifdef H5 + if (process.env.NODE_ENV === 'development') { + this._debugDataList = [] + if (!window.unidev) { + window.unidev = { + clientDB: { + data: [] + } + } + } + unidev.clientDB.data.push(this._debugDataList) + } + // #endif + + // #ifdef MP-TOUTIAO + let changeName + let events = this.$scope.dataset.eventOpts + for (let i = 0; i < events.length; i++) { + let event = events[i] + if (event[0].includes('^load')) { + changeName = event[1][0][0] + } + } + if (changeName) { + let parent = this.$parent + let maxDepth = 16 + this._changeDataFunction = null + while (parent && maxDepth > 0) { + let fun = parent[changeName] + if (fun && typeof fun === 'function') { + this._changeDataFunction = fun + maxDepth = 0 + break + } + parent = parent.$parent + maxDepth--; + } + } + // #endif + + // if (!this.manual) { + // this.loadData() + // } + }, + // #ifdef H5 + beforeDestroy() { + if (process.env.NODE_ENV === 'development' && window.unidev) { + let cd = this._debugDataList + let dl = unidev.clientDB.data + for (let i = dl.length - 1; i >= 0; i--) { + if (dl[i] === cd) { + dl.splice(i, 1) + break + } + } + } + }, + // #endif + methods: { + loadData(args1, args2) { + let callback = null + if (typeof args1 === 'object') { + if (args1.clear) { + this.clear() + this.reset() + } + if (args1.current !== undefined) { + this.paginationInternal.current = args1.current + } + if (typeof args2 === 'function') { + callback = args2 + } + } else if (typeof args1 === 'function') { + callback = args1 + } + + this._execLoadData(callback) + }, + loadMore() { + if (this._isEnded) { + return + } + this._execLoadData() + }, + refresh() { + this.clear() + this._execLoadData() + }, + clear() { + this._isEnded = false + this.listData = [] + }, + reset() { + this.paginationInternal.current = 1 + }, + remove(id, { + action, + callback, + confirmTitle, + confirmContent + } = {}) { + if (!id || !id.length) { + return + } + uni.showModal({ + title: confirmTitle || '提示', + content: confirmContent || '是否删除该数据', + showCancel: true, + success: (res) => { + if (!res.confirm) { + return + } + this._execRemove(id, action, callback) + } + }) + }, + _execLoadData(callback) { + if (this.loading) { + return + } + this.loading = true + this.errorMessage = '' + + this._getExec().then((res) => { + this.loading = false + const { + data, + count + } = res.result + this._isEnded = data.length < this.pageSize + + callback && callback(data, this._isEnded) + this._dispatchEvent(events.load, data) + + if (this.getone) { + this.listData = data.length ? data[0] : undefined + } else if (this.pageData === pageMode.add) { + this.listData.push(...data) + if (this.listData.length) { + this.paginationInternal.current++ + } + } else if (this.pageData === pageMode.replace) { + this.listData = data + this.paginationInternal.count = count + } + + // #ifdef H5 + if (process.env.NODE_ENV === 'development') { + this._debugDataList.length = 0 + this._debugDataList.push(...JSON.parse(JSON.stringify(this.listData))) + } + // #endif + }).catch((err) => { + this.loading = false + this.errorMessage = err + callback && callback() + this.$emit(events.error, err) + }) + }, + _getExec() { + let exec = this.db + if (this.action) { + exec = exec.action(this.action) + } + + exec = exec.collection(this.collection) + + if (!(!this.where || !Object.keys(this.where).length)) { + exec = exec.where(this.where) + } + if (this.field) { + exec = exec.field(this.field) + } + if (this.orderby) { + exec = exec.orderBy(this.orderby) + } + + const { + current, + size + } = this.paginationInternal + exec = exec.skip(size * (current - 1)).limit(size).get({ + getCount: this.getcount + }) + + return exec + }, + _execRemove(id, action, callback) { + if (!this.collection || !id) { + return + } + + const ids = Array.isArray(id) ? id : [id] + if (!ids.length) { + return + } + + uni.showLoading({ + mask: true + }) + + let exec = this.db + if (action) { + exec = exec.action(action) + } + + exec.collection(this.collection).where({ + _id: dbCmd.in(ids) + }).remove().then((res) => { + callback && callback(res.result) + if (this.pageData === pageMode.replace) { + this.refresh() + } else { + this.removeData(ids) + } + }).catch((err) => { + uni.showModal({ + content: err.message, + showCancel: false + }) + }).finally(() => { + uni.hideLoading() + }) + }, + removeData(ids) { + let il = ids.slice(0) + let dl = this.listData + for (let i = dl.length - 1; i >= 0; i--) { + let index = il.indexOf(dl[i]._id) + if (index >= 0) { + dl.splice(i, 1) + il.splice(index, 1) + } + } + }, + _dispatchEvent(type, data) { + if (this._changeDataFunction) { + this._changeDataFunction(data, this._isEnded) + } else { + this.$emit(type, data, this._isEnded) + } + } + } +} diff --git a/uni_modules/uni-data-checkbox/components/uni-data-checkbox/uni-data-checkbox.vue b/uni_modules/uni-data-checkbox/components/uni-data-checkbox/uni-data-checkbox.vue index 341a4af..b5b9f8d 100644 --- a/uni_modules/uni-data-checkbox/components/uni-data-checkbox/uni-data-checkbox.vue +++ b/uni_modules/uni-data-checkbox/components/uni-data-checkbox/uni-data-checkbox.vue @@ -2,16 +2,21 @@ - diff --git a/uni_modules/uni-datetime-picker/components/uni-datetime-picker/time-picker.vue b/uni_modules/uni-datetime-picker/components/uni-datetime-picker/time-picker.vue index f03dff6..8716d42 100644 --- a/uni_modules/uni-datetime-picker/components/uni-datetime-picker/time-picker.vue +++ b/uni_modules/uni-datetime-picker/components/uni-datetime-picker/time-picker.vue @@ -81,10 +81,16 @@ - - + + + + diff --git a/uni_modules/uni-datetime-picker/components/uni-datetime-picker/util.js b/uni_modules/uni-datetime-picker/components/uni-datetime-picker/util.js index 3b1735b..bc9d481 100644 --- a/uni_modules/uni-datetime-picker/components/uni-datetime-picker/util.js +++ b/uni_modules/uni-datetime-picker/components/uni-datetime-picker/util.js @@ -13,7 +13,7 @@ class Calendar { this.startDate = startDate // 终止时间 this.endDate = endDate - // 是否范围选择 + // 是否范围选择 this.range = range // 多选状态 this.cleanMultipleStatus() @@ -49,44 +49,44 @@ class Calendar { this.endDate = endDate } - getPreMonthObj(date){ - date = fixIosDateFormat(date) - date = new Date(date) + getPreMonthObj(date) { + date = fixIosDateFormat(date) + date = new Date(date) - const oldMonth = date.getMonth() - date.setMonth(oldMonth - 1) - const newMonth = date.getMonth() - if(oldMonth !== 0 && newMonth - oldMonth === 0){ - date.setMonth(newMonth - 1) - } - return this.getDateObj(date) - } - getNextMonthObj(date){ - date = fixIosDateFormat(date) - date = new Date(date) + const oldMonth = date.getMonth() + date.setMonth(oldMonth - 1) + const newMonth = date.getMonth() + if (oldMonth !== 0 && newMonth - oldMonth === 0) { + date.setMonth(newMonth - 1) + } + return this.getDateObj(date) + } + getNextMonthObj(date) { + date = fixIosDateFormat(date) + date = new Date(date) - const oldMonth = date.getMonth() - date.setMonth(oldMonth + 1) - const newMonth = date.getMonth() - if(newMonth - oldMonth > 1){ - date.setMonth(newMonth - 1) - } - return this.getDateObj(date) - } + const oldMonth = date.getMonth() + date.setMonth(oldMonth + 1) + const newMonth = date.getMonth() + if (newMonth - oldMonth > 1) { + date.setMonth(newMonth - 1) + } + return this.getDateObj(date) + } /** * 获取指定格式Date对象 */ getDateObj(date) { - date = fixIosDateFormat(date) - date = new Date(date) + date = fixIosDateFormat(date) + date = new Date(date) return { fullDate: getDate(date), - year: date.getFullYear(), - month: addZero(date.getMonth() + 1), - date: addZero(date.getDate()), - day: date.getDay() + year: date.getFullYear(), + month: addZero(date.getMonth() + 1), + date: addZero(date.getDate()), + day: date.getDay() } } @@ -96,7 +96,7 @@ class Calendar { getPreMonthDays(amount, dateObj) { const result = [] for (let i = amount - 1; i >= 0; i--) { - const month = dateObj.month - 1 + const month = dateObj.month - 1 result.push({ date: new Date(dateObj.year, month, -i).getDate(), month, @@ -135,11 +135,11 @@ class Calendar { let multiples = this.multipleStatus.data let multiplesStatus = -1 if (this.range && multiples) { - multiplesStatus = multiples.findIndex((item) => { - return this.dateEqual(item, currentDate) - }) + multiplesStatus = multiples.findIndex((item) => { + return this.dateEqual(item, currentDate) + }) } - const checked = multiplesStatus !== -1 + const checked = multiplesStatus !== -1 result.push({ fullDate: currentDate, @@ -149,10 +149,11 @@ class Calendar { beforeMultiple: this.isLogicBefore(currentDate, this.multipleStatus.before, this.multipleStatus.after), afterMultiple: this.isLogicAfter(currentDate, this.multipleStatus.before, this.multipleStatus.after), month: dateObj.month, - disable: (this.startDate && !dateCompare(this.startDate, currentDate)) || (this.endDate && !dateCompare(currentDate,this.endDate)), + disable: (this.startDate && !dateCompare(this.startDate, currentDate)) || (this.endDate && !dateCompare( + currentDate, this.endDate)), isToday, userChecked: false, - extraInfo: info + extraInfo: info }) } return result @@ -162,7 +163,7 @@ class Calendar { */ _getNextMonthDays(amount, dateObj) { const result = [] - const month = dateObj.month + 1 + const month = dateObj.month + 1 for (let i = 1; i <= amount; i++) { result.push({ date: i, @@ -181,8 +182,8 @@ class Calendar { if (!date) { date = new Date() } - - return this.calendar.find(item => item.fullDate === this.getDateObj(date).fullDate) + const res = this.calendar.find(item => item.fullDate === this.getDateObj(date).fullDate) + return res ? res : this.getDateObj(date) } /** @@ -240,7 +241,7 @@ class Calendar { * 获取多选状态 */ setMultiple(fullDate) { - if (!this.range) return + if (!this.range) return let { before, @@ -259,6 +260,7 @@ class Calendar { } else { if (!before) { this.multipleStatus.before = fullDate + this.multipleStatus.after = undefined; this.lastHover = false } else { this.multipleStatus.after = fullDate @@ -279,9 +281,12 @@ class Calendar { * 鼠标 hover 更新多选状态 */ setHoverMultiple(fullDate) { - if (!this.range || this.lastHover) return - - const { before } = this.multipleStatus + //抖音小程序点击会触发hover事件,需要避免一下 + // #ifndef MP-TOUTIAO + if (!this.range || this.lastHover) return + const { + before + } = this.multipleStatus if (!before) { this.multipleStatus.before = fullDate @@ -294,6 +299,8 @@ class Calendar { } } this.getWeeks(fullDate) + // #endif + } /** @@ -324,22 +331,22 @@ class Calendar { } = this.getDateObj(dateData) const preMonthDayAmount = new Date(year, month - 1, 1).getDay() - const preMonthDays = this.getPreMonthDays(preMonthDayAmount, this.getDateObj(dateData)) + const preMonthDays = this.getPreMonthDays(preMonthDayAmount, this.getDateObj(dateData)) const currentMonthDayAmount = new Date(year, month, 0).getDate() - const currentMonthDays = this.getCurrentMonthDays(currentMonthDayAmount, this.getDateObj(dateData)) + const currentMonthDays = this.getCurrentMonthDays(currentMonthDayAmount, this.getDateObj(dateData)) - const nextMonthDayAmount = 42 - preMonthDayAmount - currentMonthDayAmount - const nextMonthDays = this._getNextMonthDays(nextMonthDayAmount, this.getDateObj(dateData)) + const nextMonthDayAmount = 42 - preMonthDayAmount - currentMonthDayAmount + const nextMonthDays = this._getNextMonthDays(nextMonthDayAmount, this.getDateObj(dateData)) const calendarDays = [...preMonthDays, ...currentMonthDays, ...nextMonthDays] const weeks = new Array(6) for (let i = 0; i < calendarDays.length; i++) { - const index = Math.floor(i / 7) - if(!weeks[index]){ - weeks[index] = new Array(7) - } + const index = Math.floor(i / 7) + if (!weeks[index]) { + weeks[index] = new Array(7) + } weeks[index][i % 7] = calendarDays[i] } @@ -348,56 +355,67 @@ class Calendar { } } -function getDateTime(date, hideSecond){ - return `${getDate(date)} ${getTime(date, hideSecond)}` +function getDateTime(date, hideSecond) { + return `${getDate(date)} ${getTime(date, hideSecond)}` } function getDate(date) { - date = fixIosDateFormat(date) - date = new Date(date) - const year = date.getFullYear() - const month = date.getMonth()+1 - const day = date.getDate() - return `${year}-${addZero(month)}-${addZero(day)}` + date = fixIosDateFormat(date) + date = new Date(date) + const year = date.getFullYear() + const month = date.getMonth() + 1 + const day = date.getDate() + return `${year}-${addZero(month)}-${addZero(day)}` } -function getTime(date, hideSecond){ - date = fixIosDateFormat(date) - date = new Date(date) - const hour = date.getHours() - const minute = date.getMinutes() - const second = date.getSeconds() - return hideSecond ? `${addZero(hour)}:${addZero(minute)}` : `${addZero(hour)}:${addZero(minute)}:${addZero(second)}` +function getTime(date, hideSecond) { + date = fixIosDateFormat(date) + date = new Date(date) + const hour = date.getHours() + const minute = date.getMinutes() + const second = date.getSeconds() + return hideSecond ? `${addZero(hour)}:${addZero(minute)}` : `${addZero(hour)}:${addZero(minute)}:${addZero(second)}` } function addZero(num) { - if(num < 10){ - num = `0${num}` - } - return num + if (num < 10) { + num = `0${num}` + } + return num } function getDefaultSecond(hideSecond) { - return hideSecond ? '00:00' : '00:00:00' + return hideSecond ? '00:00' : '00:00:00' } function dateCompare(startDate, endDate) { - startDate = new Date(fixIosDateFormat(startDate)) - endDate = new Date(fixIosDateFormat(endDate)) - return startDate <= endDate + startDate = new Date(fixIosDateFormat(startDate)) + endDate = new Date(fixIosDateFormat(endDate)) + return startDate <= endDate } -function checkDate(date){ - const dateReg = /((19|20)\d{2})(-|\/)\d{1,2}(-|\/)\d{1,2}/g - return date.match(dateReg) +function checkDate(date) { + const dateReg = /((19|20)\d{2})(-|\/)\d{1,2}(-|\/)\d{1,2}/g + return date.match(dateReg) } +//ios低版本15及以下,无法匹配 没有 ’秒‘ 时的情况,所以需要在末尾 秒 加上 问号 +const dateTimeReg = /^\d{4}-(0?[1-9]|1[012])-(0?[1-9]|[12][0-9]|3[01])( [0-5]?[0-9]:[0-5]?[0-9](:[0-5]?[0-9])?)?$/; -const dateTimeReg = /^\d{4}-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01])( [0-5][0-9]:[0-5][0-9]:[0-5][0-9])?$/ function fixIosDateFormat(value) { - if (typeof value === 'string' && dateTimeReg.test(value)) { - value = value.replace(/-/g, '/') - } - return value + if (typeof value === 'string' && dateTimeReg.test(value)) { + value = value.replace(/-/g, '/') + } + return value } -export {Calendar, getDateTime, getDate, getTime, addZero, getDefaultSecond, dateCompare, checkDate, fixIosDateFormat} \ No newline at end of file +export { + Calendar, + getDateTime, + getDate, + getTime, + addZero, + getDefaultSecond, + dateCompare, + checkDate, + fixIosDateFormat +} diff --git a/uni_modules/uni-datetime-picker/package.json b/uni_modules/uni-datetime-picker/package.json index 8abed63..a886f1b 100644 --- a/uni_modules/uni-datetime-picker/package.json +++ b/uni_modules/uni-datetime-picker/package.json @@ -1,7 +1,7 @@ { "id": "uni-datetime-picker", "displayName": "uni-datetime-picker 日期选择器", - "version": "2.2.22", + "version": "2.2.38", "description": "uni-datetime-picker 日期时间选择器,支持日历,支持范围选择", "keywords": [ "uni-datetime-picker", @@ -46,7 +46,8 @@ "platforms": { "cloud": { "tcb": "y", - "aliyun": "y" + "aliyun": "y", + "alipay": "n" }, "client": { "App": { diff --git a/uni_modules/uni-drawer/components/uni-drawer/uni-drawer.vue b/uni_modules/uni-drawer/components/uni-drawer/uni-drawer.vue index 03dd271..5b551e3 100644 --- a/uni_modules/uni-drawer/components/uni-drawer/uni-drawer.vue +++ b/uni_modules/uni-drawer/components/uni-drawer/uni-drawer.vue @@ -3,16 +3,16 @@ - - - + + + - - + diff --git a/uni_modules/uni-easyinput/changelog.md b/uni_modules/uni-easyinput/changelog.md index 765401a..84c72eb 100644 --- a/uni_modules/uni-easyinput/changelog.md +++ b/uni_modules/uni-easyinput/changelog.md @@ -1,3 +1,21 @@ +## 1.1.19(2024-07-18) +- 修复 初始值传入 null 导致input报错的bug +## 1.1.18(2024-04-11) +- 修复 easyinput组件双向绑定问题 +## 1.1.17(2024-03-28) +- 修复 在头条小程序下丢失事件绑定的问题 +## 1.1.16(2024-03-20) +- 修复 在密码输入情况下 清除和小眼睛覆盖bug 在edge浏览器下显示双眼睛bug +## 1.1.15(2024-02-21) +- 新增 左侧插槽:left +## 1.1.14(2024-02-19) +- 修复 onBlur的emit传值错误 +## 1.1.12(2024-01-29) +- 补充 adjust-position文档属性补充 +## 1.1.11(2024-01-29) +- 补充 adjust-position属性传递值:(Boolean)当键盘弹起时,是否自动上推页面 +## 1.1.10(2024-01-22) +- 去除 移除无用的log输出 ## 1.1.9(2023-04-11) - 修复 vue3 下 keyboardheightchange 事件报错的bug ## 1.1.8(2023-03-29) diff --git a/uni_modules/uni-easyinput/components/uni-easyinput/common.js b/uni_modules/uni-easyinput/components/uni-easyinput/common.js index 5549cc9..d2cf040 100644 --- a/uni_modules/uni-easyinput/components/uni-easyinput/common.js +++ b/uni_modules/uni-easyinput/components/uni-easyinput/common.js @@ -6,9 +6,7 @@ */ export const debounce = function(func, wait = 1000, immediate = true) { let timer; - console.log(1); return function() { - console.log(123); let context = this, args = arguments; if (timer) clearTimeout(timer); diff --git a/uni_modules/uni-easyinput/components/uni-easyinput/uni-easyinput.vue b/uni_modules/uni-easyinput/components/uni-easyinput/uni-easyinput.vue index 7f5113e..05ae27d 100644 --- a/uni_modules/uni-easyinput/components/uni-easyinput/uni-easyinput.vue +++ b/uni_modules/uni-easyinput/components/uni-easyinput/uni-easyinput.vue @@ -2,73 +2,26 @@ - - + + + + + + + + + + + - + + .is-textarea { + align-items: flex-start; + } + + .is-textarea-icon { + margin-top: 5px; + } + + .uni-easyinput__content-textarea { + position: relative; + overflow: hidden; + flex: 1; + line-height: 1.5; + font-size: 14px; + margin: 6px; + margin-left: 0; + height: 80px; + min-height: 80px; + /* #ifndef APP-NVUE */ + min-height: 80px; + width: auto; + /* #endif */ + } + + .input-padding { + padding-left: 10px; + } + + .content-clear-icon { + padding: 0 5px; + } + + .label-icon { + margin-right: 5px; + margin-top: -1px; + } + + // 显示边框 + .is-input-border { + /* #ifndef APP-NVUE */ + display: flex; + box-sizing: border-box; + /* #endif */ + flex-direction: row; + align-items: center; + border: 1px solid $uni-border-1; + border-radius: 4px; + /* #ifdef MP-ALIPAY */ + overflow: hidden; + /* #endif */ + } + + .uni-error-message { + position: absolute; + bottom: -17px; + left: 0; + line-height: 12px; + color: $uni-error; + font-size: 12px; + text-align: left; + } + + .uni-error-msg--boeder { + position: relative; + bottom: 0; + line-height: 22px; + } + + .is-input-error-border { + border-color: $uni-error; + + .uni-easyinput__placeholder-class { + color: mix(#fff, $uni-error, 50%); + } + } + + .uni-easyinput--border { + margin-bottom: 0; + padding: 10px 15px; + // padding-bottom: 0; + border-top: 1px #eee solid; + } + + .uni-easyinput-error { + padding-bottom: 0; + } + + .is-first-border { + /* #ifndef APP-NVUE */ + border: none; + /* #endif */ + /* #ifdef APP-NVUE */ + border-width: 0; + /* #endif */ + } + + .is-disabled { + background-color: #f7f6f6; + color: #d5d5d5; + + .uni-easyinput__placeholder-class { + color: #d5d5d5; + font-size: 12px; + } + } + \ No newline at end of file diff --git a/uni_modules/uni-easyinput/package.json b/uni_modules/uni-easyinput/package.json index bd128e1..2939256 100644 --- a/uni_modules/uni-easyinput/package.json +++ b/uni_modules/uni-easyinput/package.json @@ -1,7 +1,7 @@ { "id": "uni-easyinput", "displayName": "uni-easyinput 增强输入框", - "version": "1.1.9", + "version": "1.1.19", "description": "Easyinput 组件是对原生input组件的增强", "keywords": [ "uni-ui", @@ -46,7 +46,8 @@ "platforms": { "cloud": { "tcb": "y", - "aliyun": "y" + "aliyun": "y", + "alipay": "n" }, "client": { "App": { diff --git a/uni_modules/uni-fab/changelog.md b/uni_modules/uni-fab/changelog.md index 9bd4729..8a22807 100644 --- a/uni_modules/uni-fab/changelog.md +++ b/uni_modules/uni-fab/changelog.md @@ -1,3 +1,5 @@ +## 1.2.6(2024-10-12) +- 修复 微信小程序中的getSystemInfo警告 ## 1.2.5(2023-03-29) - 新增 pattern.icon 属性,可自定义图标 ## 1.2.4(2022-09-07) diff --git a/uni_modules/uni-fab/components/uni-fab/uni-fab.vue b/uni_modules/uni-fab/components/uni-fab/uni-fab.vue index 43b4531..0cc2ef3 100644 --- a/uni_modules/uni-fab/components/uni-fab/uni-fab.vue +++ b/uni_modules/uni-fab/components/uni-fab/uni-fab.vue @@ -163,9 +163,9 @@ return this.getPosition(2, 'horizontal', 'right') }, // 计算 nvue bottom - nvueBottom() { - const safeBottom = uni.getSystemInfoSync().windowBottom; - // #ifdef APP-NVUE + nvueBottom() { + // #ifdef APP-NVUE + const safeBottom = uni.getSystemInfoSync().windowBottom; return 30 + safeBottom // #endif // #ifndef APP-NVUE diff --git a/uni_modules/uni-fab/package.json b/uni_modules/uni-fab/package.json index 18c0810..1b8543c 100644 --- a/uni_modules/uni-fab/package.json +++ b/uni_modules/uni-fab/package.json @@ -1,7 +1,7 @@ { "id": "uni-fab", "displayName": "uni-fab 悬浮按钮", - "version": "1.2.5", + "version": "1.2.6", "description": "悬浮按钮 fab button ,点击可展开一个图标按钮菜单。", "keywords": [ "uni-ui", @@ -43,7 +43,8 @@ "platforms": { "cloud": { "tcb": "y", - "aliyun": "y" + "aliyun": "y", + "alipay": "n" }, "client": { "App": { diff --git a/uni_modules/uni-file-picker/changelog.md b/uni_modules/uni-file-picker/changelog.md index b8230e9..b81e7f9 100644 --- a/uni_modules/uni-file-picker/changelog.md +++ b/uni_modules/uni-file-picker/changelog.md @@ -1,3 +1,17 @@ +## 1.0.11(2024-07-19) +- 修复 vue3 使用value报错的bug +## 1.0.10(2024-07-09) +- 优化 vue3兼容性 +## 1.0.9(2024-07-09) +- 修复 value 属性不兼容vue3的bug +## 1.0.8(2024-03-20) +- 补充 删除文件时返回文件下标 +## 1.0.7(2024-02-21) +- 新增 微信小程序选择视频时改用chooseMedia,并返回视频缩略图 +## 1.0.6(2024-01-06) +- 新增 微信小程序不再调用chooseImage,而是调用chooseMedia +## 1.0.5(2024-01-03) +- 新增 上传文件至云存储携带本地文件名称 ## 1.0.4(2023-03-29) - 修复 手动上传删除一个文件后不能再上传的bug ## 1.0.3(2022-12-19) diff --git a/uni_modules/uni-file-picker/components/uni-file-picker/choose-and-upload-file.js b/uni_modules/uni-file-picker/components/uni-file-picker/choose-and-upload-file.js index 018590d..c4ff85d 100644 --- a/uni_modules/uni-file-picker/components/uni-file-picker/choose-and-upload-file.js +++ b/uni_modules/uni-file-picker/components/uni-file-picker/choose-and-upload-file.js @@ -11,6 +11,28 @@ function chooseImage(opts) { extension } = opts return new Promise((resolve, reject) => { + // 微信由于旧接口不再维护,针对微信小程序平台改用chooseMedia接口 + // #ifdef MP-WEIXIN + uni.chooseMedia({ + count, + sizeType, + sourceType, + mediaType: ['image'], + extension, + success(res) { + res.tempFiles.forEach(item => { + item.path = item.tempFilePath; + }) + resolve(normalizeChooseAndUploadFileRes(res, 'image')); + }, + fail(res) { + reject({ + errMsg: res.errMsg.replace('chooseImage:fail', ERR_MSG_FAIL), + }); + }, + }) + // #endif + // #ifndef MP-WEIXIN uni.chooseImage({ count, sizeType, @@ -25,11 +47,14 @@ function chooseImage(opts) { }); }, }); + // #endif + }); } function chooseVideo(opts) { const { + count, camera, compressed, maxDuration, @@ -37,6 +62,45 @@ function chooseVideo(opts) { extension } = opts; return new Promise((resolve, reject) => { + // 微信由于旧接口不再维护,针对微信小程序平台改用chooseMedia接口 + // #ifdef MP-WEIXIN + uni.chooseMedia({ + count, + compressed, + maxDuration, + sourceType, + extension, + mediaType: ['video'], + success(res) { + const { + tempFiles, + } = res; + resolve(normalizeChooseAndUploadFileRes({ + errMsg: 'chooseVideo:ok', + tempFiles: tempFiles.map(item => { + return { + name: item.name || '', + path: item.tempFilePath, + thumbTempFilePath: item.thumbTempFilePath, + size:item.size, + type: (res.tempFile && res.tempFile.type) || '', + width:item.width, + height:item.height, + duration:item.duration, + fileType: 'video', + cloudPath: '', + } + }), + }, 'video')); + }, + fail(res) { + reject({ + errMsg: res.errMsg.replace('chooseVideo:fail', ERR_MSG_FAIL), + }); + }, + }) + // #endif + // #ifndef MP-WEIXIN uni.chooseVideo({ camera, compressed, @@ -54,8 +118,7 @@ function chooseVideo(opts) { resolve(normalizeChooseAndUploadFileRes({ errMsg: 'chooseVideo:ok', tempFilePaths: [tempFilePath], - tempFiles: [ - { + tempFiles: [{ name: (res.tempFile && res.tempFile.name) || '', path: tempFilePath, size, @@ -74,6 +137,7 @@ function chooseVideo(opts) { }); }, }); + // #endif }); } @@ -211,8 +275,7 @@ function chooseAndUploadFile(opts = { }) { if (opts.type === 'image') { return uploadFiles(chooseImage(opts), opts); - } - else if (opts.type === 'video') { + } else if (opts.type === 'video') { return uploadFiles(chooseVideo(opts), opts); } return uploadFiles(chooseAll(opts), opts); diff --git a/uni_modules/uni-file-picker/components/uni-file-picker/uni-file-picker.vue b/uni_modules/uni-file-picker/components/uni-file-picker/uni-file-picker.vue index 7a13a6c..95eaf30 100644 --- a/uni_modules/uni-file-picker/components/uni-file-picker/uni-file-picker.vue +++ b/uni_modules/uni-file-picker/components/uni-file-picker/uni-file-picker.vue @@ -89,24 +89,18 @@ }, emits: ['select', 'success', 'fail', 'progress', 'delete', 'update:modelValue', 'input'], props: { - // #ifdef VUE3 modelValue: { type: [Array, Object], default () { return [] } }, - // #endif - - // #ifndef VUE3 value: { type: [Array, Object], default () { return [] } }, - // #endif - disabled: { type: Boolean, default: false @@ -191,6 +185,10 @@ default () { return ['album', 'camera'] } + }, + provider: { + type: String, + default: '' // 默认上传到 unicloud 内置存储 extStorage 扩展存储 } }, data() { @@ -200,22 +198,18 @@ } }, watch: { - // #ifndef VUE3 value: { handler(newVal, oldVal) { this.setValue(newVal, oldVal) }, immediate: true }, - // #endif - // #ifdef VUE3 modelValue: { handler(newVal, oldVal) { this.setValue(newVal, oldVal) }, immediate: true }, - // #endif }, computed: { filesList() { @@ -331,7 +325,6 @@ * 选择文件 */ choose() { - if (this.disabled) return if (this.files.length >= Number(this.limitLength) && this.showType !== 'grid' && this.returnType === 'array') { @@ -418,6 +411,13 @@ if (!this.autoUpload || this.noSpace) { res.tempFiles = [] } + res.tempFiles.forEach((fileItem, index) => { + this.provider && (fileItem.provider = this.provider); + const fileNameSplit = fileItem.name.split('.') + const ext = fileNameSplit.pop() + const fileName = fileNameSplit.join('.').replace(/[\s\/\?<>\\:\*\|":]/g, '_') + fileItem.cloudPath = fileName + '_' + Date.now() + '_' + index + '.' + ext + }) }, /** @@ -523,6 +523,7 @@ */ delFile(index) { this.$emit('delete', { + index, tempFile: this.files[index], tempFilePath: this.files[index].url }) diff --git a/uni_modules/uni-file-picker/components/uni-file-picker/upload-file.vue b/uni_modules/uni-file-picker/components/uni-file-picker/upload-file.vue index eb1840b..ab15bad 100644 --- a/uni_modules/uni-file-picker/components/uni-file-picker/upload-file.vue +++ b/uni_modules/uni-file-picker/components/uni-file-picker/upload-file.vue @@ -24,7 +24,7 @@ - + 点击重试 @@ -69,10 +69,10 @@ borderStyle: {} } } - }, - readonly:{ - type:Boolean, - default:false + }, + readonly:{ + type:Boolean, + default:false } }, computed: { @@ -114,7 +114,7 @@ let classles = '' for (let i in obj) { classles += `${i}:${obj[i]};` - } + } return classles }, borderLineStyle() { @@ -133,19 +133,19 @@ } else { width = width.indexOf('px') ? width : width + 'px' } - obj['border-width'] = width - - if (typeof style === 'number') { - style += 'px' - } else { - style = style.indexOf('px') ? style : style + 'px' + obj['border-width'] = width + + if (typeof style === 'number') { + style += 'px' + } else { + style = style.indexOf('px') ? style : style + 'px' } obj['border-top-style'] = style } let classles = '' for (let i in obj) { classles += `${i}:${obj[i]};` - } + } return classles } }, @@ -176,9 +176,9 @@ + diff --git a/uni_modules/uni-file-picker/components/uni-file-picker/upload-image.vue b/uni_modules/uni-file-picker/components/uni-file-picker/upload-image.vue index 51ace0b..0c1abe8 100644 --- a/uni_modules/uni-file-picker/components/uni-file-picker/upload-image.vue +++ b/uni_modules/uni-file-picker/components/uni-file-picker/upload-image.vue @@ -1,7 +1,7 @@