From 85b460b57cd7e9ad935042df74f40e1bbdfa3408 Mon Sep 17 00:00:00 2001 From: liukangdong <898885815@qq.com> Date: 星期二, 22 十月 2024 09:13:36 +0800 Subject: [PATCH] ll --- h5_meeting/pages/index/index.vue | 21 +++++++++++++++------ h5_meeting/utils/config.js | 5 +++-- h5_meeting/utils/service.js | 13 +++++++------ h5_meeting/pages/index/config.vue | 7 +++++-- 4 files changed, 30 insertions(+), 16 deletions(-) diff --git a/h5_meeting/pages/index/config.vue b/h5_meeting/pages/index/config.vue index 58301ed..4765cd6 100644 --- a/h5_meeting/pages/index/config.vue +++ b/h5_meeting/pages/index/config.vue @@ -28,17 +28,20 @@ </template> <script> + import { baseUrl } from '@/utils/config.js' export default { data() { return { param: { - baseUrl: 'http://192.168.5.13/gateway_interface/' + baseUrl, + time: 60 } }; }, onLoad(){ const param = uni.getStorageSync('param') || { - baseUrl: 'http://192.168.5.13/gateway_interface/' + baseUrl: baseUrl, + time: 60 } this.param = { ...param } }, diff --git a/h5_meeting/pages/index/index.vue b/h5_meeting/pages/index/index.vue index 6f01181..fded8ae 100644 --- a/h5_meeting/pages/index/index.vue +++ b/h5_meeting/pages/index/index.vue @@ -98,20 +98,24 @@ 4: '鍗冲皢寮�濮�', 5: '宸叉挙閿�', }, - meetingInfo: {} + meetingInfo: {}, + timer: null } }, onShow() { this.initDatetime() - this.param = uni.getStorageSync('param') || {} if (!this.param.code) { return uni.navigateTo({ url: '/pages/index/config' }) } - this.getData() }, - onReady() {}, + onReady() {}, + onHide(){ + if(this.timer){ + clearInterval(this.timer) + } + }, methods: { getData() { this.showQrbg = false @@ -173,8 +177,13 @@ this.timer = setInterval(() => { this.time = dayjs().format('HH:mm') this.date = dayjs().format('YYYY-MM-DD') + ' ' + weeks[new Date().getDay()] - }, 1000) - setInterval(() => { + }, 1000) + this.param = uni.getStorageSync('param') || {} + if(this.timer){ + clearInterval(this.timer) + } + this.getData() + this.timer = setInterval(() => { this.getData() }, this.param.time ? this.param.time * 1000 : 60 * 1000) } diff --git a/h5_meeting/utils/config.js b/h5_meeting/utils/config.js index dfeed15..dda51c1 100644 --- a/h5_meeting/utils/config.js +++ b/h5_meeting/utils/config.js @@ -1,6 +1,7 @@ -export const baseUrl = 'gateway_interface/' -// export const baseUrl = 'http://192.168.5.13/gateway_interface/' +// export const baseUrl = 'gateway_interface/' +export const baseUrl = 'http://192.168.5.13/gateway_interface/' +// export const baseUrl = 'http://10.50.250.253:8088/gateway_interface/' export const statusMap = { 0: '寰呯‘璁�', diff --git a/h5_meeting/utils/service.js b/h5_meeting/utils/service.js index 6d8ff54..2001939 100644 --- a/h5_meeting/utils/service.js +++ b/h5_meeting/utils/service.js @@ -8,13 +8,14 @@ // uni.showLoading({ // title:"鍔犺浇涓�..." // }) - uni.showLoading({ - title: '鍔犺浇涓�', - mask: true - }) + // uni.showLoading({ + // title: '鍔犺浇涓�', + // mask: true + // }) const param = uni.getStorageSync('param') || {} uni.request({ url: (param.baseUrl || baseUrl) + options.url, + // url: baseUrl + options.url, data: options.data || {}, method: options.method || 'GET', header: options.header || { @@ -25,7 +26,7 @@ success: (res) => { let data = res.data // 鎺у埗鍙版樉绀烘暟鎹俊鎭� - uni.hideLoading() + // uni.hideLoading() // 鐧诲綍杩囨湡 if (data.code === 5112) { setTimeout(() => { @@ -63,7 +64,7 @@ console.log('msg', baseUrl + options.url) // 杩斿洖閿欒娑堟伅 reject(err) - uni.hideLoading() + // uni.hideLoading() }, catch: (e) => { console.log(e) -- Gitblit v1.9.3