From 79ab6080122219f76d096bbae5f56488770fa4da Mon Sep 17 00:00:00 2001 From: Janie <109517022+Janie06@users.noreply.github.com> Date: Tue, 28 Mar 2023 15:06:12 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A6=96=E9=A0=81Cookie=E6=8C=89=E9=88=95?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=88=A4=E6=96=B7=E3=80=81fix=E8=A8=82?= =?UTF-8?q?=E5=96=AE=E5=85=A7=E5=AE=B9=E9=A0=81=E8=A4=87=E8=A3=BD=E6=8C=89?= =?UTF-8?q?=E9=88=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- FrontEnd/components/booking/BookingInfo.vue | 23 ++++++----- FrontEnd/components/home/CookieUnderModal.vue | 40 ++++++++++++++++--- 2 files changed, 46 insertions(+), 17 deletions(-) diff --git a/FrontEnd/components/booking/BookingInfo.vue b/FrontEnd/components/booking/BookingInfo.vue index 5786237..9ae78c0 100644 --- a/FrontEnd/components/booking/BookingInfo.vue +++ b/FrontEnd/components/booking/BookingInfo.vue @@ -122,21 +122,22 @@ import { runInThisContext } from 'vm'; mybookingStatusMap, mypaymentStatusMap, bookingColor, - copyEvent(id) { - var str = document.getElementById(id); - window.getSelection().selectAllChildren(str); - document.execCommand("Copy") - }, + // copyEvent(id) { + // var str = document.getElementById(id); + // window.getSelection().selectAllChildren(str); + // document.execCommand("Copy") + // }, async copy(copyText){ - if (navigator.clipboard == undefined) { - console.log('clipboard is undefined'); - }else{ - window.navigator.clipboard.writeText(copyText); - } + window.navigator.clipboard.writeText(copyText); + // if (navigator.clipboard == undefined) { + // console.log('clipboard is undefined'); + // }else{ + // window.navigator.clipboard.writeText(copyText); + // } } }, updated() { - console.log(this.BookingOrder); + //console.log(this.BookingOrder); }, }; diff --git a/FrontEnd/components/home/CookieUnderModal.vue b/FrontEnd/components/home/CookieUnderModal.vue index 5d32829..65c8401 100644 --- a/FrontEnd/components/home/CookieUnderModal.vue +++ b/FrontEnd/components/home/CookieUnderModal.vue @@ -145,18 +145,46 @@ export default { }; }, created(){ - if(process.client){ - let storeCache = this.$cookies.get("storeCache"); - if(storeCache!=undefined){ - this.isCookieHasBeenClicked = JSON.parse(storeCache); + //this.$cookies.set("storeCache",JSON.stringify(true),1); //一開始先設cookie為顯示 + if(process.client){ //若是在client端 + let storeCache = this.$cookies.get("storeCache"); //取storeCache(false) 有顯示 + if(storeCache == undefined){ + this.isCookieHasBeenClicked = true; } + if(storeCache == true){ + this.isCookieHasBeenClicked = false; + }else{ + this.isCookieHasBeenClicked = true; + } + // if(storeCache == undefined){ // + // this.$cookies.set("storeCache",JSON.stringify(true),1); + + // }else if(storeCache == false){ + // this.$cookies.set("storeCache",JSON.stringify(true),1); + + // }else{ + // this.isCookieHasBeenClicked = JSON.parse(storeCache); + // } + + // if(storeCache != undefined){ + // this.isCookieHasBeenClicked = JSON.parse(storeCache); + // } } }, + watch: { + isCookieHasBeenClicked: { + handler: function () { + if(this.isCookieHasBeenClicked == false){ + this.$cookies.set("storeCache",JSON.stringify(true), 1); + } + }, + }, + }, methods:{ closeCookie(){ - if(process.client){ + console.log(process.client ? true : false); + if(process.client){ //在client端的時候 this.isCookieHasBeenClicked = false; - this.$cookies.set("storeCache",JSON.stringify(false),1); } } }