From 41eddb7e9bac960a6f08be80ac4e3250c9138f39 Mon Sep 17 00:00:00 2001 From: "@fawn-nine" <1271023382@qq.com> Date: Fri, 8 Dec 2023 14:08:44 +0800 Subject: [PATCH] =?UTF-8?q?=E6=97=B6=E8=BE=B0=E5=8F=96=E7=A9=B4=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E4=B8=80=E6=AC=A1=E5=AE=9A=E6=97=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/acupoint/acupoint.vue | 14 +++++++ pages/peanut/home.vue | 29 ++++++++++++++- pages/timeAcupoint/timeAcupoint.vue | 57 +++++++++++++++++++++++++---- utils/getHours.js | 1 + 4 files changed, 92 insertions(+), 9 deletions(-) diff --git a/pages/acupoint/acupoint.vue b/pages/acupoint/acupoint.vue index b0686d1..c5c77e6 100644 --- a/pages/acupoint/acupoint.vue +++ b/pages/acupoint/acupoint.vue @@ -174,6 +174,20 @@ this.getTitles(id) }, setOneCateIndex(item, index) { + if(this.userMes.tgdzPower == 0){ + let that = this + uni.showModal({ + content: "购买 针灸六经法要上册和下册 后方可使用此功能", + confirmText: '好的', + showCancel: false, + success: function(res) { + if (res.confirm) { + // console.log('用户点击确定'); + } + } + }) + return + } if(item.title == "时辰取穴"){ uni.navigateTo({ url: "../timeAcupoint/timeAcupoint" diff --git a/pages/peanut/home.vue b/pages/peanut/home.vue index 92c7c83..534cd6c 100644 --- a/pages/peanut/home.vue +++ b/pages/peanut/home.vue @@ -325,7 +325,8 @@ page:1, totalPage:0, tjProList:[], - status : 3 + status : 3, + userMsg:{}, // 用户信息 }; }, onPageScroll(e) { @@ -352,6 +353,7 @@ uni.hideTabBar(); this.getData(); this.getTags() + this.getUserInfo() }, // 页面加载完毕 onReady() { @@ -363,6 +365,7 @@ this.tjProList = [] this.getData() this.getTags() + this.getUserInfo() // this.requestIapOrder() uni.stopPullDownRefresh() @@ -403,6 +406,17 @@ methods: { ...mapMutations(['setUserInfo']), // ...mapMutations(['setLoadingShow']), + // 获取用户详情 + getUserInfo() { + // 用户详情 + // if (this.userInfo.id != undefined) { + this.$http + .post('book/user/info/' + this.userInfo.id) + .then(res => { + this.userMsg = res.user + }); + // } + }, // 获取商品标签 getTags() { this.loadingNow = false @@ -662,6 +676,19 @@ // 跳转 onPageJump(url) { + console.log(this.userMsg,'this.userMsg') + if(url == '../luck/luck' && this.userMsg.wylqPower == 0){ + uni.showModal({ + content: "购买 中医时间医学·火病原理 后方可使用此功能", + confirmText: '好的', + showCancel: false, + success: function(res) { + if (res.confirm) { + } + } + }) + return + } uni.navigateTo({ url: url }); diff --git a/pages/timeAcupoint/timeAcupoint.vue b/pages/timeAcupoint/timeAcupoint.vue index 0899eae..30b3c0c 100644 --- a/pages/timeAcupoint/timeAcupoint.vue +++ b/pages/timeAcupoint/timeAcupoint.vue @@ -165,25 +165,66 @@ showCalendar: false, quxue: [], // 时辰取穴 tiangandizhi: {}, - yuanXue: [ - '腕骨', '丘墟', '丘墟', '太溪', '大陵', '京骨', '阳池', '太渊', '合谷', '太白', '冲阳', '神门' - ], + pageTime:{ // 页面得时间,载入时赋值 + hour:0, + minute:0, + increments:0 // 分钟数距离整点的差额 + }, + myInterval:null, // 定时器 } }, onLoad() { let da = new Date().toISOString().slice(0, 10) this.timestamp = new Date(da).getTime() - console.log('初始时间', this.dateToString, this.date) + // console.log('初始时间', this.dateToString, this.date) this.getXueWei(this.dateToString) - this.getTGDZ(this.dateToString) - // console.log('全局hours',this.$getHours.hourNumber) + this.getTGDZ(this.dateToString) + + }, + onUnload() { + this.pageTime.hour = 0 + this.pageTime.minute = 0 + this.pageTime.increments = 0 + // clearInterval(this.myInterval) + clearTimeout(this.myInterval); + console.log('隐藏页面',this.myInterval) + }, + onShow() { + // console.log('全局hours',this.$getHours.hourNumber,this.$getHours.minuteNumber) + var mydate = new Date() + this.pageTime.hour = mydate.getHours() + this.pageTime.minute = mydate.getMinutes() + console.log('全局hours', this.pageTime.hour,this.pageTime.minute) + this.pageTime.increments = 5 - this.pageTime.minute + console.log('距离整点', this.pageTime.increments, this.pageTime.increments * 60000, '毫秒后执行') + if(this.pageTime.increments > 0){ + + this.myInterval = setTimeout(() => { + this.autoChange() + }, this.pageTime.increments * 60000) + }else{ + // 正好是0分 + this.myInterval = setTimeout(() => { + this.autoChange() + }, 60 * 60000) + } }, - onHide() { - + clearTimeout(this.myInterval); + console.log('清除定时器',this.myInterval) + //this.myInterval = null + }, methods: { scroll: function(e) {}, + autoChange(){ + console.log() + let da = new Date().toISOString().slice(0, 10) + this.timestamp = new Date(da).getTime() + this.dateToString = formatDateTime(new Date()), // 字符串格式的日期 + this.getXueWei(this.dateToString) + this.getTGDZ(this.dateToString) + }, showTotalFun() { uni.navigateTo({ url: "./totalTable" diff --git a/utils/getHours.js b/utils/getHours.js index 2965f1d..5188453 100644 --- a/utils/getHours.js +++ b/utils/getHours.js @@ -7,6 +7,7 @@ const nowHour = new Date; const nowHour = new Date; // #endif nowHour.hourNumber = nowHour.getHours() // 当前的小时数 +nowHour.minuteNumber = nowHour.getMinutes() var myHour = { playBgm({mute=false}){