From 3b2d5368808bee45215457479500b2cbc778f46b Mon Sep 17 00:00:00 2001 From: Miao_Spring <539943419@qq.com> Date: Mon, 13 Nov 2023 12:32:47 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=8D=E5=BA=94=E8=AF=A5push=E8=BF=99?= =?UTF-8?q?=E4=B9=88=E5=A4=9A=E6=AC=A1=E7=9A=84=EF=BC=8C=E5=8F=AA=E6=98=AF?= =?UTF-8?q?=E5=8F=91=E7=8E=B0=E5=BF=98=E8=AE=B0commit=E4=BA=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- miniprogram/pages/index/index.ts | 40 +++++++++----------------------- project.private.config.json | 2 +- 2 files changed, 12 insertions(+), 30 deletions(-) diff --git a/miniprogram/pages/index/index.ts b/miniprogram/pages/index/index.ts index 6263177..31b2012 100644 --- a/miniprogram/pages/index/index.ts +++ b/miniprogram/pages/index/index.ts @@ -185,7 +185,7 @@ Page({ arr: ["山梨酸钾"], }, - sessionKey: "", + session_key: "", userInfo: {}, hasUserInfo: false, canIUse: wx.canIUse('button.open-type.getUserInfo'), @@ -195,15 +195,13 @@ Page({ // 启动时获取session async onLoad() { - // wx.authorize() await this.updateSession() setInterval(()=>{ this.updateSession() },60*1000*5) - // console.log(this.data.sessionKey) + this.readStorageData() this.updateLib() this.updateHistory() - this.readStorageData() }, //开始界面的按钮相关动画 @@ -682,7 +680,7 @@ Page({ wx.request({ url: 'http://' + serverAddr + '/getLib', //仅为示例,并非真实的接口地址 data: { - sessionKey:this.data.sessionKey + session_key:this.data.session_key }, method: "GET", header: { @@ -741,7 +739,7 @@ Page({ wx.request({ url: 'http://' + serverAddr + '/getHistory', //仅为示例,并非真实的接口地址 data: { - sessionKey:this.data.sessionKey + session_key:this.data.session_key }, method: "POST", header: { @@ -779,7 +777,7 @@ Page({ console.log(res) var data = res.data this.setData( - { "sessionKey": data } + { "session_key": data } ) resolve() // setTimeout(this.updateSession,1000*60*5) @@ -794,7 +792,7 @@ Page({ }) }, - // 上传照片并 + // 上传照片并展示收到的结果 uploadImg(tempImagePath: any) { wx.getFileSystemManager().readFile({ filePath: tempImagePath, @@ -806,7 +804,7 @@ Page({ url: 'http://' + serverAddr + '/rcvImg', //仅为示例,并非真实的接口地址 data: { imgBase64: imgBase64, - sessionKey:this.data.sessionKey + session_key:this.data.session_key }, method: "POST", header: { @@ -853,7 +851,7 @@ Page({ data: { history : this.data.data_history, collection:this.data.data_collect, - sessionKey:this.data.sessionKey + session_key:this.data.session_key }, method: "POST", header: { @@ -1017,7 +1015,7 @@ Page({ var list = ['data_history', 'data_collect', 'data_lib'] for (var k of list) { this.data[k]=wx.getStorageSync(k) - console.log(wx.getStorageSync(k)) + // console.log(wx.getStorageSync(k)) } this.setData( { @@ -1114,7 +1112,7 @@ Page({ m1 = parseInt(date1[1]), d0 = parseInt(date0[2]), d1 = parseInt(date1[2]) - console.log(date0, date1, y0, y1, m0, m1, d0, d1) + // console.log(date0, date1, y0, y1, m0, m1, d0, d1) var res = 0 if (y1 != y0) { if (y1 > y0) { @@ -1136,7 +1134,7 @@ Page({ } } res = -res - console.log(res) + // console.log(res) return res }, @@ -1185,22 +1183,6 @@ Page({ }) } }) - // wx.request({ - // url: 'http://'+serverAddr+'/rcvImg', //仅为示例,并非真实的接口地址 - // data: { - // a:123212 - // }, - // method:"POST", - // header: { - // 'content-type': 'application/json' // 默认值 - // }, - // success (res) { - // console.log(res) - // }, - // fail(res){ - // console.log(res) - // } - // }) } }) } diff --git a/project.private.config.json b/project.private.config.json index 8320aef..f15bfd8 100644 --- a/project.private.config.json +++ b/project.private.config.json @@ -2,7 +2,7 @@ "description": "项目私有配置文件。此文件中的内容将覆盖 project.config.json 中的相同字段。项目的改动优先同步到此文件中。详见文档:https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html", "projectname": "wxProject-w4w", "setting": { - "compileHotReLoad": true, + "compileHotReLoad": false, "urlCheck": false } } \ No newline at end of file