增加了朋友圈转发功能;增加了AI聊天markdown信息支持;增加了新版本提示

This commit is contained in:
lik
2026-06-05 05:31:22 +08:00
parent 74e42671bc
commit 1d61e5f74e
7 changed files with 183 additions and 27 deletions

38
app.js
View File

@@ -58,7 +58,9 @@ App({
console.error('获取科室排名失败', err)
resolve([])
})
})
})
this.checkUpdate();
},
onShow(options) {
@@ -66,7 +68,9 @@ App({
wx.login({
success: res => {
if (res.code) {
request.post('https://api.huashengtec.com/user/wxsignin', { code: res.code })
request.post('https://api.huashengtec.com/user/wxsignin', {
code: res.code
})
.then((data) => {
if (data.code == 0) {
this.globalData.user = data.data.user
@@ -110,6 +114,36 @@ App({
this.globalData.chatSocket = socket
},
checkUpdate() {
// 获取小程序更新管理器实例
const updateManager = wx.getUpdateManager();
// 监听检查更新事件,当小程序有新版本时会触发此回调
updateManager.onCheckForUpdate(function (res) {
// 请求完新版本信息的回调
console.log(res.hasUpdate); // 打印是否有新版本
});
// 监听更新准备就绪事件,当新版本下载完成时会触发此回调
updateManager.onUpdateReady(function () {
wx.showModal({
title: '更新提示',
content: '新版本已经准备好,可以重启应用小程序了!',
success(res) {
if (res.confirm) {
// 用户确认更新,调用 applyUpdate 应用新版本并重启小程序
updateManager.applyUpdate();
}
}
});
});
// 监听更新失败事件,当新版本下载失败时会触发此回调
updateManager.onUpdateFailed(function () {
// 新版本下载失败,可以在这里处理失败逻辑,例如提示用户稍后再试
});
},
globalData: {
appId: '',
user: null,