提交 99dd98b7 编写于 作者: 雪洛's avatar 雪洛

feat: 移除无用的泛型

上级 2f1703ab
...@@ -55,13 +55,13 @@ ...@@ -55,13 +55,13 @@
num: 1, num: 1,
str: 'ABC' str: 'ABC'
} }
}).then<void>(res => { }).then(res => {
const result = res.result const result = res.result
this.callFunctionResult = result this.callFunctionResult = result
console.log(JSON.stringify(result)) console.log(JSON.stringify(result))
uni.hideLoading() uni.hideLoading()
this.notify(result['showMessage'] as string, '提示') this.notify(result['showMessage'] as string, '提示')
}).catch<void>((err : any | null) => { }).catch((err : any | null) => {
const error = err as UniCloudError const error = err as UniCloudError
this.callFunctionError = { this.callFunctionError = {
errCode: error.errCode, errCode: error.errCode,
...@@ -76,4 +76,4 @@ ...@@ -76,4 +76,4 @@
</script> </script>
<style> <style>
</style> </style>
\ No newline at end of file
...@@ -67,16 +67,15 @@ ...@@ -67,16 +67,15 @@
.add({ .add({
num: 1, num: 1,
tag: 'default-tag', tag: 'default-tag',
date: new Date(), date: new Date()
point: new db.Geo.Point(116, 38)
}) })
.then<void>(res => { .then(res => {
uni.hideLoading() uni.hideLoading()
console.log(res) console.log(res)
this.addId = res.id this.addId = res.id
this.notify(`新增成功,id: ${res.id}`, '提示') this.notify(`新增成功,id: ${res.id}`, '提示')
}) })
.catch<void>((err : any | null) => { .catch((err : any | null) => {
uni.hideLoading() uni.hideLoading()
const error = err as UniCloudError const error = err as UniCloudError
this.notify(error.errMsg, '错误') this.notify(error.errMsg, '错误')
...@@ -95,7 +94,7 @@ ...@@ -95,7 +94,7 @@
num: 3, num: 3,
tag: 'default-tag', tag: 'default-tag',
}]) }])
.then<void>((res) => { .then((res) => {
uni.hideLoading() uni.hideLoading()
console.log(res) console.log(res)
console.log('JSON.stringify(res.inserted)', JSON.stringify(res.inserted)) console.log('JSON.stringify(res.inserted)', JSON.stringify(res.inserted))
...@@ -103,7 +102,7 @@ ...@@ -103,7 +102,7 @@
this.batchAddinserted = res.inserted this.batchAddinserted = res.inserted
this.notify(`新增成功条数${res.inserted}, id列表: ${res.ids.join(',')}`, '提示') this.notify(`新增成功条数${res.inserted}, id列表: ${res.ids.join(',')}`, '提示')
}) })
.catch<void>((err : any | null) => { .catch((err : any | null) => {
uni.hideLoading() uni.hideLoading()
const error = err as UniCloudError const error = err as UniCloudError
this.notify(error.errMsg, '错误') this.notify(error.errMsg, '错误')
...@@ -123,13 +122,13 @@ ...@@ -123,13 +122,13 @@
.skip(1) .skip(1)
.limit(2) .limit(2)
.get() .get()
.then<void>(res => { .then(res => {
uni.hideLoading() uni.hideLoading()
console.log(res) console.log(res)
this.getData = res.data this.getData = res.data
this.notify(`获取成功,取到了${res.data.length}条数据`, '提示') this.notify(`获取成功,取到了${res.data.length}条数据`, '提示')
}) })
.catch<void>((err : any | null) => { .catch((err : any | null) => {
uni.hideLoading() uni.hideLoading()
const error = err as UniCloudError const error = err as UniCloudError
this.notify(error.errMsg, '错误') this.notify(error.errMsg, '错误')
...@@ -149,13 +148,13 @@ ...@@ -149,13 +148,13 @@
.skip(1) .skip(1)
.limit(2) .limit(2)
.get() .get()
.then<void>(res => { .then(res => {
uni.hideLoading() uni.hideLoading()
console.log(res) console.log(res)
this.getWithCommandData = res.data this.getWithCommandData = res.data
this.notify(`获取成功,取到了${res.data.length}条数据`, '提示') this.notify(`获取成功,取到了${res.data.length}条数据`, '提示')
}) })
.catch<void>((err : any | null) => { .catch((err : any | null) => {
uni.hideLoading() uni.hideLoading()
const error = err as UniCloudError const error = err as UniCloudError
this.notify(error.errMsg, '错误') this.notify(error.errMsg, '错误')
...@@ -173,13 +172,13 @@ ...@@ -173,13 +172,13 @@
.update({ .update({
num: 4 num: 4
}) })
.then<void>(res => { .then(res => {
uni.hideLoading() uni.hideLoading()
console.log(res) console.log(res)
this.updateUpdated = res.updated this.updateUpdated = res.updated
this.notify(`更新成功,更新了${res.updated}条数据`, '提示') this.notify(`更新成功,更新了${res.updated}条数据`, '提示')
}) })
.catch<void>((err : any | null) => { .catch((err : any | null) => {
uni.hideLoading() uni.hideLoading()
const error = err as UniCloudError const error = err as UniCloudError
this.notify(error.errMsg, '错误') this.notify(error.errMsg, '错误')
...@@ -195,13 +194,13 @@ ...@@ -195,13 +194,13 @@
'tag == "default-tag"' 'tag == "default-tag"'
) )
.remove() .remove()
.then<void>(res => { .then(res => {
uni.hideLoading() uni.hideLoading()
console.log(res) console.log(res)
this.removeDeleted = res.deleted this.removeDeleted = res.deleted
this.notify(`删除成功,删掉了${res.deleted}条数据`, '提示') this.notify(`删除成功,删掉了${res.deleted}条数据`, '提示')
}) })
.catch<void>((err : any | null) => { .catch((err : any | null) => {
uni.hideLoading() uni.hideLoading()
const error = err as UniCloudError const error = err as UniCloudError
this.notify(error.errMsg, '错误') this.notify(error.errMsg, '错误')
...@@ -246,11 +245,11 @@ ...@@ -246,11 +245,11 @@
tag: "default-tag" tag: "default-tag"
}]) }])
}) })
.then<void>((_) : void => { .then((_) : void => {
uni.hideLoading() uni.hideLoading()
this.notify('数据初始化成功', '提示') this.notify('数据初始化成功', '提示')
}) })
.catch<void>((err : any | null) => { .catch((err : any | null) => {
uni.hideLoading() uni.hideLoading()
console.error(err) console.error(err)
const error = err as UniCloudError const error = err as UniCloudError
...@@ -270,13 +269,13 @@ ...@@ -270,13 +269,13 @@
.getTemp() .getTemp()
db.collection(local, foreign) db.collection(local, foreign)
.get() .get()
.then<void>(res => { .then(res => {
uni.hideLoading() uni.hideLoading()
console.log(res) console.log(res)
this.lookupData = res.data this.lookupData = res.data
this.notify(`联表查询成功,取到了${res.data.length}条数据`, '提示') this.notify(`联表查询成功,取到了${res.data.length}条数据`, '提示')
}) })
.catch<void>((err : any | null) => { .catch((err : any | null) => {
uni.hideLoading() uni.hideLoading()
const error = err as UniCloudError const error = err as UniCloudError
this.notify(error.errMsg, '错误') this.notify(error.errMsg, '错误')
...@@ -287,4 +286,4 @@ ...@@ -287,4 +286,4 @@
</script> </script>
<style> <style>
</style> </style>
\ No newline at end of file
...@@ -38,7 +38,7 @@ ...@@ -38,7 +38,7 @@
filePath: tempFilePath, filePath: tempFilePath,
cloudPath: 'test.jpg' cloudPath: 'test.jpg'
}) })
.then<void>(function (res) { .then(function (res) {
uni.hideLoading() uni.hideLoading()
console.log(res) console.log(res)
uni.showModal({ uni.showModal({
...@@ -46,7 +46,7 @@ ...@@ -46,7 +46,7 @@
showCancel: false showCancel: false
}); });
}) })
.catch<void>(function (err : any | null) { .catch(function (err : any | null) {
uni.hideLoading() uni.hideLoading()
const error = err as UniCloudError const error = err as UniCloudError
uni.showModal({ uni.showModal({
...@@ -68,4 +68,4 @@ ...@@ -68,4 +68,4 @@
</script> </script>
<style> <style>
</style> </style>
\ No newline at end of file
...@@ -63,11 +63,11 @@ ...@@ -63,11 +63,11 @@
}) })
const title = this.todoTitle const title = this.todoTitle
const content = this.todoContent const content = this.todoContent
todo.add(title, content).then<void>((res : UTSJSONObject) : void => { todo.add(title, content).then((res : UTSJSONObject) : void => {
this.returnTodoTitle = res['title'] as string this.returnTodoTitle = res['title'] as string
this.returnTodoContent = res['content'] as string this.returnTodoContent = res['content'] as string
this.notify(res['showMessage'] as string, '提示') this.notify(res['showMessage'] as string, '提示')
}).catch<void>((err : any | null) : void => { }).catch((err : any | null) : void => {
const error = err as UniCloudError const error = err as UniCloudError
console.error(error) console.error(error)
}) })
...@@ -78,9 +78,9 @@ ...@@ -78,9 +78,9 @@
retry: true retry: true
} }
}) })
todoObj.randomFail().then<void>((res : UTSJSONObject) : void => { todoObj.randomFail().then((res : UTSJSONObject) : void => {
this.notify(res['showMessage'] as string, '提示') this.notify(res['showMessage'] as string, '提示')
}).catch<void>((err : any | null) : void => { }).catch((err : any | null) : void => {
const error = err as UniCloudError const error = err as UniCloudError
console.error(error) console.error(error)
}) })
...@@ -89,10 +89,10 @@ ...@@ -89,10 +89,10 @@
const todo = uniCloud.importObject('todo', { const todo = uniCloud.importObject('todo', {
customUI: this.isUniTest customUI: this.isUniTest
}) })
todo.fail().then<void>((res : UTSJSONObject) : void => { todo.fail().then((res : UTSJSONObject) : void => {
this.notify('todo.fail应调用失败,此处错误的触发了成功回调', '错误') this.notify('todo.fail应调用失败,此处错误的触发了成功回调', '错误')
console.log('todo.fail: ', res); console.log('todo.fail: ', res);
}).catch<void>((err : any | null) : void => { }).catch((err : any | null) : void => {
const error = err as UniCloudError const error = err as UniCloudError
this.failErrCode = error.errCode as string this.failErrCode = error.errCode as string
console.error(error) console.error(error)
...@@ -107,10 +107,10 @@ ...@@ -107,10 +107,10 @@
const todo = uniCloud.importObject('todo', { const todo = uniCloud.importObject('todo', {
customUI: this.isUniTest customUI: this.isUniTest
}) })
todo.success().then<void>((res : UTSJSONObject) : void => { todo.success().then((res : UTSJSONObject) : void => {
this.successErrCode = res['errCode'] as number this.successErrCode = res['errCode'] as number
this.notify(res['showMessage'] as string, '提示') this.notify(res['showMessage'] as string, '提示')
}).catch<void>((err : any | null) : void => { }).catch((err : any | null) : void => {
const error = err as UniCloudError const error = err as UniCloudError
console.error(error) console.error(error)
}) })
...@@ -121,4 +121,4 @@ ...@@ -121,4 +121,4 @@
<style> <style>
</style> </style>
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册