From 8d57f72f74802f1205a75a04058b87a5098a6578 Mon Sep 17 00:00:00 2001 From: zoujiandong <10130823232@qq.com> Date: Thu, 7 Sep 2023 10:04:35 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BC=B9=E6=A1=86=E6=9B=B4=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Pages/index/index.js | 26 +++++++++++++++++++++++--- Pages/index/index.wxml | 1 + Pages/login/index.js | 28 ++++++++++++++++++++++++---- Pages/login/index.wxml | 1 + 4 files changed, 49 insertions(+), 7 deletions(-) diff --git a/Pages/index/index.js b/Pages/index/index.js index 8524254..2afd403 100644 --- a/Pages/index/index.js +++ b/Pages/index/index.js @@ -7,6 +7,16 @@ Page({ loading: true, showEntryTip:false, showEntryTip_second:false, + beforeClose(action){ + return new Promise((resolve) => { + if (action === 'confirm') { + resolve(true); + } else { + // 拦截取消操作 + resolve(false); + } + }) + }, static_host: api.getStaticHost() }, onConfirmEntry(){ @@ -14,15 +24,16 @@ Page({ }, onCloseEntry(){ this.setData({ - showEntryTip_second:true + showEntryTip_second:true, + showEntryTip:true }) }, onConfirmEntry_second(){ this.setData({ showEntryTip_second:false, - showEntryTip:false, + //showEntryTip:false, }); - wx.setStorageSync('hasEntry', true); + //wx.setStorageSync('hasEntry', true); }, onCloseEntry_second(){ @@ -41,6 +52,9 @@ Page({ let from = option.from; let usertype = wx.getStorageSync('usertype'); console.log("index onload: ", from, usertype) + this.setData({ + beforeClose: this.data.beforeClose.bind(this), + }) if(from === "navbar"){ //切换身份 }else{ @@ -60,11 +74,17 @@ Page({ } this.setData({ loading: false }); let isEntry=wx.getStorageSync('hasEntry'); + + console.log("onshow:"+isEntry) if(!isEntry){ this.setData({ showEntryTip:true }); + }else{ + this.setData({ + showEntryTip:false + }); } }, diff --git a/Pages/index/index.wxml b/Pages/index/index.wxml index 3836330..6b83382 100644 --- a/Pages/index/index.wxml +++ b/Pages/index/index.wxml @@ -38,6 +38,7 @@ confirm-button-color="#3CC7C0" bind:confirm="onConfirmEntry" bind:cancel="onCloseEntry" + before-close="{{beforeClose}}" > 亲爱的用户,感谢您信任并使用肝胆相照互联网医院医师端!我们依据最新法律法规的要求,制定了《隐私协议》。请您仔细阅《隐私协议》,并确认了解我们对您的个人信息处理原则。 diff --git a/Pages/login/index.js b/Pages/login/index.js index 5a628a8..0bbfb07 100644 --- a/Pages/login/index.js +++ b/Pages/login/index.js @@ -6,6 +6,16 @@ Page({ data: { showEntryTip:false, showEntryTip_second:false, + beforeClose(action){ + return new Promise((resolve) => { + if (action === 'confirm') { + resolve(true); + } else { + // 拦截取消操作 + resolve(false); + } + }) + }, navbarData: { showCapsule: 1, //是否显示左上角图标 1表示显示 0表示不显示 title: '登录', //导航栏 中间的标题 @@ -15,6 +25,9 @@ Page({ }, onLoad(){ let usertype = wx.getStorageSync('usertype'); + this.setData({ + beforeClose: this.data.beforeClose.bind(this), + }) if(!usertype){ wx.navigateTo({ url: "/Pages/index/index" @@ -25,7 +38,10 @@ Page({ this.setData({ showEntryTip:true, }); - + }else{ + this.setData({ + showEntryTip:false + }); } }, onChange(event) { @@ -42,17 +58,21 @@ Page({ _navback() { wx.navigateBack() }, + onConfirmEntry(){ + wx.setStorageSync('hasEntry', true); + }, onCloseEntry(){ this.setData({ - showEntryTip_second:true + showEntryTip_second:true, + showEntryTip:true }) }, onConfirmEntry_second(){ this.setData({ showEntryTip_second:false, - showEntryTip:false, + // showEntryTip:false, }); - wx.setStorageSync('hasEntry', true); + //wx.setStorageSync('hasEntry', true); }, onCloseEntry_second(){ diff --git a/Pages/login/index.wxml b/Pages/login/index.wxml index 7a90d19..b890e15 100644 --- a/Pages/login/index.wxml +++ b/Pages/login/index.wxml @@ -50,6 +50,7 @@ confirm-button-color="#3CC7C0" bind:confirm="onConfirmEntry" bind:cancel="onCloseEntry" + before-close="{{beforeClose}}" > 亲爱的用户,感谢您信任并使用肝胆相照互联网医院医师端!我们依据最新法律法规的要求,制定了《隐私协议》。请您仔细阅《隐私协议》,并确认了解我们对您的个人信息处理原则。