From d405d00dd3f305b049ff8c3cbf4bbb8be809f9d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E6=96=87=E6=9D=B0?= <> Date: Fri, 8 Mar 2024 12:06:37 +0800 Subject: [PATCH] no message --- src/App.vue | 10 +++++ src/pages/booking/booking.vue | 1 - src/pages/booking/components/timePopup.vue | 13 +++---- src/pages/index/index.vue | 6 +-- src/pages/my/my.vue | 27 +++++++------ src/pages/siteDetail/siteDetail.vue | 12 +++--- src/utils/http.ts | 4 +- src/utils/index.ts | 45 ++++++++++++++++++++++ 8 files changed, 84 insertions(+), 34 deletions(-) diff --git a/src/App.vue b/src/App.vue index 8c63ce5..eb5375a 100644 --- a/src/App.vue +++ b/src/App.vue @@ -1,8 +1,18 @@ + diff --git a/src/pages/siteDetail/siteDetail.vue b/src/pages/siteDetail/siteDetail.vue index e1ffbfe..3e303ea 100644 --- a/src/pages/siteDetail/siteDetail.vue +++ b/src/pages/siteDetail/siteDetail.vue @@ -4,20 +4,20 @@ import { onLoad, onReady } from '@dcloudio/uni-app' import { getSiteDetailAPI } from '@/services/site' const bannerList = [ { - hrefUrl: '1005000', - id: '25', + id: '1', imgUrl: '/static/images/banner1.jpg', + hrefUrl: '1013001', type: '1', }, { - hrefUrl: '1005000', - id: '21', - imgUrl: '/static/images/banner2.jpg', + id: '2', + imgUrl: '/static/images/banner1.jpg', + hrefUrl: '1019000', type: '1', }, { hrefUrl: '1005000', - id: '321', + id: '3', imgUrl: '/static/images/banner3.jpg', type: '1', }, diff --git a/src/utils/http.ts b/src/utils/http.ts index 8cb9a33..ef90acf 100644 --- a/src/utils/http.ts +++ b/src/utils/http.ts @@ -11,8 +11,8 @@ * 4. 添加 token 请求头标识 */ import { useMemberStore } from '@/stores' -const baseURL = 'http://192.168.0.166:8808/api' -// const baseURL = 'http://222.71.165.188:8808/api' +// const baseURL = 'http://192.168.0.166:8808/api' +const baseURL = 'http://222.71.165.188:8808/api' // 添加拦截器 const httpInterceptor = { // 拦截前触发 diff --git a/src/utils/index.ts b/src/utils/index.ts index fb6a0a2..ef25c71 100644 --- a/src/utils/index.ts +++ b/src/utils/index.ts @@ -1,3 +1,11 @@ +/* + * @Author: 王文杰 + * @Date: 2024-01-04 12:54:56 + * @LastEditors: 王文杰 + * @LastEditTime: 2024-03-08 12:02:52 + * @FilePath: /app-nx-personal/src/utils/index.ts + * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE + */ /** * 日期格式化函数 * @param date 日期对象 @@ -21,3 +29,40 @@ export const formatDate = (date: Date, format = 'YYYY-MM-DD HH:mm:ss') => { .replace('mm', minutes) .replace('ss', seconds) } +/** + * 微信小程序发布后提醒用户更新版本 + * + * @return {[type]} [return description] + */ +export const updateManager = () => { + const updateManager = uni.getUpdateManager() // 小程序版本更新管理器 + updateManager.onCheckForUpdate((res) => { + // 检测新版本后的回调 + if (res.hasUpdate) { + // 如果有新版本提醒并进行强制升级 + uni.showModal({ + content: '新版本已经准备好,是否重启应用?', + showCancel: false, + confirmText: '确定', + success: (res) => { + if (res.confirm) { + updateManager.onUpdateReady((res) => { + // 新版本下载完成的回调 + updateManager.applyUpdate() // 强制当前小程序应用上新版本并重启 + }) + + updateManager.onUpdateFailed((res) => { + // 新版本下载失败的回调 + // 新版本下载失败,提示用户删除后通过冷启动重新打开 + uni.showModal({ + content: '下载失败,请删除当前小程序后重新打开', + showCancel: false, + confirmText: '知道了', + }) + }) + } + }, + }) + } + }) +}