添加向服务端上传历史记录与收藏的相关函数

This commit is contained in:
539943419 committed 2023-11-13 12:21:49 +08:00
1 parent 77cd23b6a9
commit 89c70bcb2a
1 file changed
+28 -3
+28 -3
View File
@@ -197,9 +197,9 @@ Page({
async onLoad() {
// wx.authorize()
await this.updateSession()
// setInterval(()=>{
// this.updateSession()
// },60*1000*5)
setInterval(()=>{
this.updateSession()
},60*1000*5)
// console.log(this.data.sessionKey)
this.updateLib()
this.updateHistory()
@@ -584,6 +584,7 @@ Page({
}
)
this.save2storage()
this.uploadHistoryAndCollection()
this.exit_setRemark()
},
@@ -609,6 +610,7 @@ Page({
}
)
this.save2storage()
this.uploadHistoryAndCollection()
this.exit_editRemark()
},
@@ -637,6 +639,7 @@ Page({
}
)
this.save2storage()
this.uploadHistoryAndCollection()
this.exit_removeCollectionVerify()
},
@@ -843,6 +846,28 @@ Page({
})
},
// 向云发送历史记录和收藏记录数据
uploadHistoryAndCollection(){
wx.request({
url: 'http://' + serverAddr + '/uploadHistoryAndCollection', //仅为示例,并非真实的接口地址
data: {
history : this.data.data_history,
collection:this.data.data_collect,
sessionKey:this.data.sessionKey
},
method: "POST",
header: {
'content-type': 'application/json' // 默认值
},
success: res => {
console.log(res)
},
fail: res => {
console.log(res)
}
})
},
//拍照
takePhoto() {
const ctx = wx.createCameraContext()