From 89c70bcb2aa8f86c9a6c77bed44f81215ee85b5d Mon Sep 17 00:00:00 2001 From: Miao_Spring <539943419@qq.com> Date: Mon, 13 Nov 2023 12:21:49 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=90=91=E6=9C=8D=E5=8A=A1?= =?UTF-8?q?=E7=AB=AF=E4=B8=8A=E4=BC=A0=E5=8E=86=E5=8F=B2=E8=AE=B0=E5=BD=95?= =?UTF-8?q?=E4=B8=8E=E6=94=B6=E8=97=8F=E7=9A=84=E7=9B=B8=E5=85=B3=E5=87=BD?= =?UTF-8?q?=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- miniprogram/pages/index/index.ts | 31 ++++++++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-) 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()