时辰取穴添加一次定时

This commit is contained in:
@fawn-nine
2023-12-08 14:08:44 +08:00
parent abd8171ee5
commit 41eddb7e9b
4 changed files with 92 additions and 9 deletions

View File

@@ -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"

View File

@@ -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
});

View File

@@ -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)
},
},
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"

View File

@@ -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}){