From 298a18e933d90ede49c809e7dc54fcd6c32eea08 Mon Sep 17 00:00:00 2001
From: limqhz <540344226@qq.com>
Date: Sun, 26 May 2024 20:25:06 +0800
Subject: [PATCH] =?UTF-8?q?202404=20=E5=85=A5=E5=9C=BA=E9=9C=80=E8=A6=81?=
=?UTF-8?q?=E6=9F=A5=E7=9C=8B=E5=85=8D=E8=B4=A3=E5=A3=B0=E6=98=8E?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
pages/basketballGym/index.js | 36 ++++++++++++++++++++++--------------
pages/disclaimers/index.js | 21 ++++++++++++++-------
pages/disclaimers/index.wxml | 10 ++++++----
pages/disclaimers/index.wxss | 20 ++++++++++----------
pages/myEnterBook/index.js | 17 +++++++++++++----
utils/api.js | 6 +++++-
utils/util.js | 31 ++++++++++++++++++++++++++++++-
7 files changed, 100 insertions(+), 41 deletions(-)
diff --git a/pages/basketballGym/index.js b/pages/basketballGym/index.js
index effc592..c32ba4f 100644
--- a/pages/basketballGym/index.js
+++ b/pages/basketballGym/index.js
@@ -1,6 +1,7 @@
// pages/basketballGym/index.js
// import QRCode from './qrcode';
import drawQrcode from './weapp.qrcode.js';
+import {getTimeoutStorage} from "../../utils/util";
const app = getApp();
import {
getCurrentPageUrl
@@ -291,21 +292,28 @@ Page({
// 我要进场
enter() {
- app.$api.venueJoin({
- venueId: id
- }).then(res => {
- this.setData({
- flg: res.join.flg,
- msg: res.join.msg,
- payMoney: res.join.money
+ let isRead = getTimeoutStorage('isReaded');
+ console.log('isRead======' + isRead)
+ if (isRead == 'ojbk') {
+ app.$api.venueJoin({
+ venueId: id
+ }).then(res => {
+ this.setData({
+ flg: res.join.flg,
+ msg: res.join.msg,
+ payMoney: res.join.money
+ })
+ if (res.join.flg == 0) {
+ this.showBarcode('000')
+ }
+ }, err => {
+ console.log(err);
})
- if (res.join.flg == 0) {
- this.showBarcode('000')
- }
- }, err => {
- console.log(err);
- })
-
+ }else {
+ wx.navigateTo({
+ url: '/pages/disclaimers/index'
+ })
+ }
},
// 我要出场
diff --git a/pages/disclaimers/index.js b/pages/disclaimers/index.js
index ce4297c..7371168 100644
--- a/pages/disclaimers/index.js
+++ b/pages/disclaimers/index.js
@@ -1,13 +1,14 @@
// pages/notice/index.js
const app = getApp();
-let id = ''
+
+import {setTimeOutStorage} from "../../utils/util";
Page({
/**
* 页面的初始数据
*/
data: {
- announcement: {},
+ disclaimers: {},
isGoHome: false,
},
@@ -15,13 +16,11 @@ Page({
* 生命周期函数--监听页面加载
*/
onLoad: function(options) {
- id = options.id;
- app.$api.announcementDetail({
- id: id
+ app.$api.disclaimersDetail({
}).then(res => {
- res.announcement.description = res.announcement.description.replace(/section/g, "div");
+ res.disclaimers.description = res.disclaimers.description.replace(/section/g, "div");
this.setData({
- announcement: res.announcement
+ disclaimers: res.disclaimers
})
}, err => {
@@ -80,5 +79,13 @@ Page({
return {
title: '智慧云馆'
}
+ },
+
+ backToOpen () {
+ wx.navigateBack({
+ success (res){
+ setTimeOutStorage('isReaded','ojbk',1200000)
+ }
+ })
}
})
diff --git a/pages/disclaimers/index.wxml b/pages/disclaimers/index.wxml
index d92f5ac..ae99657 100644
--- a/pages/disclaimers/index.wxml
+++ b/pages/disclaimers/index.wxml
@@ -1,11 +1,13 @@
-
+
- {{announcement.title}}
- {{announcement.time}}
+
-
+
+
diff --git a/pages/disclaimers/index.wxss b/pages/disclaimers/index.wxss
index 9828ce5..5e72df4 100644
--- a/pages/disclaimers/index.wxss
+++ b/pages/disclaimers/index.wxss
@@ -2,14 +2,13 @@
.container {
/* min-height: calc(1100 - 200rpx); */
- background: #fff;
}
.body {
padding-bottom: 40rpx;
padding-left: 30rpx;
padding-right: 30rpx;
- background: #fff;
+ color: aliceblue;
}
.title {
@@ -18,14 +17,6 @@
font-weight: bold;
}
-.date {
- height: 20rpx;
- margin-top: 36rpx;
- font-size: 20rpx;
- color: #cfcfcf;
- line-height: 20rpx;
-}
-
.rich-box {
margin-top: 40rpx;
@@ -36,3 +27,12 @@
.rich-box .wscnph {
width: 100%;
}
+
+.footer-btn {
+ flex: 1;
+ background: #ffda2e;
+ color: #1a191e;
+ font-size: 32rpx;
+ text-align: center;
+ line-height: 100rpx;
+}
diff --git a/pages/myEnterBook/index.js b/pages/myEnterBook/index.js
index 3b92f95..df71dc7 100644
--- a/pages/myEnterBook/index.js
+++ b/pages/myEnterBook/index.js
@@ -1,5 +1,6 @@
// pages/myBookings/index.js
const app = getApp();
+import {getTimeoutStorage} from "../../utils/util";
let ticketId = 0;
Page({
@@ -76,10 +77,18 @@ Page({
},
openDoor(){
- wx.showToast({
- title:'开门成功',
- icon : "success"
- })
+ let isRead = getTimeoutStorage('isReaded');
+ console.log('isRead======' + isRead)
+ if (isRead == 'ojbk') {
+ wx.showToast({
+ title:'足球场开门成功',
+ icon : "success"
+ })
+ }else {
+ wx.navigateTo({
+ url: '/pages/disclaimers/index'
+ })
+ }
},
// 获取数据
diff --git a/utils/api.js b/utils/api.js
index ae1f66a..63a9654 100644
--- a/utils/api.js
+++ b/utils/api.js
@@ -1,6 +1,6 @@
//testURL
// const BASE_URL = 'http://127.0.0.1:8093';
-// const BASE_URL = 'http://192.168.31.173:8093';
+// const BASE_URL = 'http://192.168.1.3:8093';
//prodURL
const BASE_URL = 'https://api.hongyutiyu.top';
// const platformId = 1;
@@ -334,6 +334,10 @@ export default {
aboutUs(params) {
return fetchGet('/about/uss', params, false);
},
+ // 免责声明
+ disclaimersDetail(params) {
+ return fetchGet('/notice/disclaimers', params, false);
+ },
// 上传图像
uploadAvatar(params) {
return fetchPost('/upload/avatar', params, true, true);
diff --git a/utils/util.js b/utils/util.js
index 7218c71..96b30da 100644
--- a/utils/util.js
+++ b/utils/util.js
@@ -26,7 +26,36 @@ const getCurrentPageUrl = () => {
return url;
}
+const setTimeOutStorage = (key,value,timeout) => {
+ let timestamp = Date.parse(new Date());
+ wx.setStorageSync(key,
+ {
+ 'value': value,
+ 'timeout': timestamp + timeout
+ })
+}
+
+const getTimeoutStorage = (key) => {
+ // 当前时间
+ let timestamp = Date.parse(new Date());
+ // 缓存中的过期时间
+ let data = wx.getStorageSync(key);
+ let data_expiration = data.timeout;
+ let value = data.value;
+ // 如果缓存中没有data_expiration,说明也没有token,还未登录
+ if (data_expiration) {
+ // 如果超时了,清除缓存,重新登录
+ if (timestamp > data_expiration) {
+ wx.removeStorageSync(key);
+ return null;
+ }
+ }
+ return value;
+}
+
module.exports = {
formatTime: formatTime,
- getCurrentPageUrl: getCurrentPageUrl
+ getCurrentPageUrl: getCurrentPageUrl,
+ setTimeOutStorage: setTimeOutStorage,
+ getTimeoutStorage: getTimeoutStorage
}