From 61481937a54e0d0316299dfc41a8d22a1c74c590 Mon Sep 17 00:00:00 2001 From: hdx Date: Wed, 10 Jan 2024 19:13:47 +0800 Subject: [PATCH] =?UTF-8?q?unicloud-db-contacts:=20=E7=AE=80=E5=8C=96?= =?UTF-8?q?=E5=8F=98=E9=87=8F=E5=91=BD=E5=90=8D,=20=E6=9B=B4=E6=96=B0=20un?= =?UTF-8?q?i-loading=20=E7=BB=84=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/component/mixin-datacom/datacom.uvue | 2 +- pages/component/unicloud-db-contacts/add.uvue | 7 +- .../unicloud-db-contacts/detail.uvue | 14 +- .../component/unicloud-db-contacts/edit.uvue | 20 +- .../component/unicloud-db-contacts/list.uvue | 17 +- uni_modules/uni-loading/changelog.md | 6 + .../components/uni-loading/circle.uvue | 286 +++++++++++------- .../components/uni-loading/icon.uvue | 14 +- .../components/uni-loading/uni-loading.uvue | 4 +- uni_modules/uni-loading/package.json | 2 +- 10 files changed, 224 insertions(+), 148 deletions(-) diff --git a/pages/component/mixin-datacom/datacom.uvue b/pages/component/mixin-datacom/datacom.uvue index 82e9e165..7b69ec78 100644 --- a/pages/component/mixin-datacom/datacom.uvue +++ b/pages/component/mixin-datacom/datacom.uvue @@ -40,7 +40,7 @@ const data = res.data // const count = res.count this.mixinDatacomResData = data - }).catch((err) => { + }).catch((err: any | null) => { this.mixinDatacomError = err as UniCloudError }).finally(() => { this.mixinDatacomLoading = false diff --git a/pages/component/unicloud-db-contacts/add.uvue b/pages/component/unicloud-db-contacts/add.uvue index 700ce261..76476e4d 100644 --- a/pages/component/unicloud-db-contacts/add.uvue +++ b/pages/component/unicloud-db-contacts/add.uvue @@ -40,18 +40,19 @@ return { collection: COLLECTION_NAME, genderList: GenderList as GenderType[], - $uniCloudElement: null as UniCloudDBElement | null + uniCloudElement: null as UniCloudDBElement | null } }, onReady() { - this.$uniCloudElement = this.$refs['udb'] as UniCloudDBElement + this.uniCloudElement = this.$refs['udb'] as UniCloudDBElement }, methods: { onFormSubmit: function (e : FormSubmitEvent) { const formData = e.detail.value const genderString = formData['gender'] as string formData['gender'] = (genderString.length > 0) ? parseInt(genderString) : -1 - this.$uniCloudElement!.add(formData, { + console.log('formData', formData) + this.uniCloudElement!.add(formData, { showToast: false, needLoading: true, loadingTitle: "正在保存...", diff --git a/pages/component/unicloud-db-contacts/detail.uvue b/pages/component/unicloud-db-contacts/detail.uvue index 869b2a2f..29da10e9 100644 --- a/pages/component/unicloud-db-contacts/detail.uvue +++ b/pages/component/unicloud-db-contacts/detail.uvue @@ -39,14 +39,14 @@ return { collection: '', where: '', - $whereID: '', - $uniCloudElement: null as UniCloudDBElement | null + whereID: '', + uniCloudElement: null as UniCloudDBElement | null } }, - onLoad(options : Map) { + onLoad(options) { this.collection = COLLECTION_NAME; - this.$whereID = options.get('id') as string; - this.where = `_id=='${this.$whereID}'`; + this.whereID = options['id'] as string; + this.where = `_id=='${this.whereID}'`; }, onShow() { // TODO 后续通过 EventChannel 实现 @@ -57,7 +57,7 @@ uni.$off(UNICLOUD_DB_CONTACTS_UPDATE, this.onDataChange); }, onReady() { - this.$uniCloudElement = this.$refs['udb'] as UniCloudDBElement + this.uniCloudElement = this.$refs['udb'] as UniCloudDBElement }, methods: { displayGender(value : number | null) : string { @@ -74,7 +74,7 @@ }) }, onDataChange(_ : string) { - this.$uniCloudElement!.loadData() + this.uniCloudElement!.loadData() } } } diff --git a/pages/component/unicloud-db-contacts/edit.uvue b/pages/component/unicloud-db-contacts/edit.uvue index b266532e..509b9d7d 100644 --- a/pages/component/unicloud-db-contacts/edit.uvue +++ b/pages/component/unicloud-db-contacts/edit.uvue @@ -49,31 +49,31 @@ collection: '', where: '', genderList: GenderList as GenderType[], - $whereID: '', - $uniCloudElement: null as UniCloudDBElement | null + whereID: '', + uniCloudElement: null as UniCloudDBElement | null } }, - onLoad(options : Map) { + onLoad(options) { this.collection = COLLECTION_NAME; - this.$whereID = options.get('id') as string; - this.where = `_id=='${this.$whereID}'`; + this.whereID = options['id'] as string; + this.where = `_id=='${this.whereID}'`; }, onReady() { - this.$uniCloudElement = this.$refs['udb'] as UniCloudDBElement + this.uniCloudElement = this.$refs['udb'] as UniCloudDBElement }, methods: { onFormSubmit: function (e : FormSubmitEvent) { const formData = e.detail.value const genderString = formData['gender'] as string formData['gender'] = (genderString.length > 0) ? parseInt(genderString) : -1 - this.$uniCloudElement!.update(this.$whereID, formData, { + this.uniCloudElement!.update(this.whereID, formData, { showToast: false, needLoading: true, needConfirm: false, loadingTitle: "正在保存...", success: (_ : UniCloudDBUpdateResult) => { // TODO 后续通过 EventChannel 实现 - uni.$emit(UNICLOUD_DB_CONTACTS_UPDATE, this.$whereID) + uni.$emit(UNICLOUD_DB_CONTACTS_UPDATE, this.whereID) setTimeout(() => { uni.navigateBack() }, 500) @@ -88,7 +88,7 @@ }) }, remove(id : string | null, name : string | null) { - this.$uniCloudElement!.remove(id!, { + this.uniCloudElement!.remove(id!, { needConfirm: true, needLoading: true, loadingTitle: "正在删除...", @@ -96,7 +96,7 @@ confirmContent: name, success: (_ : UniCloudDBRemoveResult) => { // TODO 后续通过 EventChannel 实现 - uni.$emit(UNICLOUD_DB_CONTACTS_DELETE, this.$whereID) + uni.$emit(UNICLOUD_DB_CONTACTS_DELETE, this.whereID) setTimeout(() => { uni.navigateBack({ delta: 2 diff --git a/pages/component/unicloud-db-contacts/list.uvue b/pages/component/unicloud-db-contacts/list.uvue index c0d8cba1..9e5acaf2 100644 --- a/pages/component/unicloud-db-contacts/list.uvue +++ b/pages/component/unicloud-db-contacts/list.uvue @@ -29,14 +29,14 @@ data() { return { collection: COLLECTION_NAME, - $uniCloudElement: null as UniCloudDBElement | null + uniCloudElement: null as UniCloudDBElement | null } }, onReady() { // TODO 后续通过 EventChannel 实现 uni.$on(UNICLOUD_DB_CONTACTS_DELETE, this.onDataChange); - this.$uniCloudElement = this.$refs['udb'] as UniCloudDBElement - this.$uniCloudElement!.loadData() + this.uniCloudElement = this.$refs['udb'] as UniCloudDBElement + this.uniCloudElement!.loadData() }, onUnload() { // TODO 后续通过 EventChannel 实现 @@ -50,7 +50,7 @@ uni.$off(UNICLOUD_DB_CONTACTS_UPDATE, this.onDataChange); }, onPullDownRefresh() { - this.$uniCloudElement!.loadData({ + this.uniCloudElement!.loadData({ clear: true, success: (_ : UniCloudDBGetResult) => { uni.stopPullDownRefresh() @@ -59,7 +59,7 @@ }, methods: { loadMore() { - this.$uniCloudElement!.loadMore() + this.uniCloudElement!.loadMore() }, gotoAddPage() { // TODO 后续通过 EventChannel 实现 @@ -76,7 +76,7 @@ }) }, onDataChange(_ : string) { - this.$uniCloudElement!.loadData({ + this.uniCloudElement!.loadData({ clear: true }) } @@ -97,6 +97,11 @@ .udb { flex: 1; + /* TODO */ + /* #ifdef WEB */ + display: flex; + /* #endif */ + flex-direction: column; } .list-view { diff --git a/uni_modules/uni-loading/changelog.md b/uni_modules/uni-loading/changelog.md index 1b603b4c..07008070 100644 --- a/uni_modules/uni-loading/changelog.md +++ b/uni_modules/uni-loading/changelog.md @@ -1,3 +1,9 @@ +## 1.0.4(2024-01-10) +- 优化 兼容 uvue h5 项目 +## 1.0.3(2023-12-22) +- 更新 示例项目 +## 1.0.2(2023-12-22) +- 优化 circle 部分动画逻辑,使动画更顺滑 ## 1.0.1(2023-12-20) - 修复 组件在高版本HBuilderX中运行出错的bug ## 1.0.0(2023-12-19) diff --git a/uni_modules/uni-loading/components/uni-loading/circle.uvue b/uni_modules/uni-loading/components/uni-loading/circle.uvue index 3e657ca0..b911892c 100644 --- a/uni_modules/uni-loading/components/uni-loading/circle.uvue +++ b/uni_modules/uni-loading/components/uni-loading/circle.uvue @@ -1,113 +1,187 @@ diff --git a/uni_modules/uni-loading/components/uni-loading/icon.uvue b/uni_modules/uni-loading/components/uni-loading/icon.uvue index 71fb1958..8f8cce54 100644 --- a/uni_modules/uni-loading/components/uni-loading/icon.uvue +++ b/uni_modules/uni-loading/components/uni-loading/icon.uvue @@ -1,20 +1,10 @@