diff --git a/miniprogram/pages/index/index.ts b/miniprogram/pages/index/index.ts index 43192a1..6263177 100644 --- a/miniprogram/pages/index/index.ts +++ b/miniprogram/pages/index/index.ts @@ -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()