增加了朋友圈转发功能;增加了AI聊天markdown信息支持;增加了新版本提示
This commit is contained in:
38
app.js
38
app.js
@@ -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,
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
{
|
||||
"navigationBarTitleText": "AI陪诊助手",
|
||||
"usingComponents": {
|
||||
"t-icon": "tdesign-miniprogram/icon/icon"
|
||||
"t-icon": "tdesign-miniprogram/icon/icon",
|
||||
"t-chat-markdown": "tdesign-miniprogram/chat-markdown/chat-markdown"
|
||||
}
|
||||
}
|
||||
@@ -39,7 +39,12 @@
|
||||
<image class="avatar ai-avatar" src="/images/home-w.png" mode="aspectFill" />
|
||||
<view class="message-content">
|
||||
<view class="message-bubble">
|
||||
<text class="message-text" wx:if="{{item.contentType === 'text'}}">{{item.content}}</text>
|
||||
<t-chat-markdown
|
||||
wx:if="{{item.contentType === 'text' && item.type === 'ai'}}"
|
||||
class="message-markdown"
|
||||
content="{{item.content}}"
|
||||
/>
|
||||
<text class="message-text" wx:elif="{{item.contentType === 'text'}}">{{item.content}}</text>
|
||||
<image
|
||||
wx:if="{{item.contentType === 'image'}}"
|
||||
class="message-image"
|
||||
@@ -60,7 +65,12 @@
|
||||
</view>
|
||||
<view class="message-content">
|
||||
<view class="message-bubble">
|
||||
<text class="message-text" wx:if="{{item.contentType === 'text'}}">{{item.content}}</text>
|
||||
<t-chat-markdown
|
||||
wx:if="{{item.contentType === 'text' && item.type === 'ai'}}"
|
||||
class="message-markdown"
|
||||
content="{{item.content}}"
|
||||
/>
|
||||
<text class="message-text" wx:elif="{{item.contentType === 'text'}}">{{item.content}}</text>
|
||||
<image
|
||||
wx:if="{{item.contentType === 'image'}}"
|
||||
class="message-image"
|
||||
|
||||
@@ -179,6 +179,14 @@
|
||||
color: #FFFFFF;
|
||||
}
|
||||
|
||||
/* Markdown 渲染区域 */
|
||||
.message-markdown {
|
||||
width: 100%;
|
||||
font-size: 28rpx;
|
||||
color: #333333;
|
||||
line-height: 1.6;
|
||||
}
|
||||
|
||||
.message-image {
|
||||
max-width: 400rpx;
|
||||
border-radius: 8rpx;
|
||||
|
||||
@@ -3,6 +3,19 @@ Page({
|
||||
services: []
|
||||
},
|
||||
|
||||
onShareAppMessage() {
|
||||
return {
|
||||
title: '暖橙陪诊', // 转发标题
|
||||
path: '/pages/escort/itemlist',
|
||||
}
|
||||
},
|
||||
|
||||
onShareTimeline: function () {
|
||||
return {
|
||||
title: '暖橙陪诊',
|
||||
}
|
||||
},
|
||||
|
||||
onLoad(options) {
|
||||
const app = getApp()
|
||||
this.setData({
|
||||
|
||||
@@ -1,27 +1,96 @@
|
||||
Page({
|
||||
data: {
|
||||
escortServices: [
|
||||
{ id: 1, name: '陪诊', icon: 'heart', iconColor: '#E11D48', bgColor: '#FFF1F2' },
|
||||
{ id: 2, name: '代问诊', icon: 'chat-heart', iconColor: '#EA580C', bgColor: '#FFF7ED' },
|
||||
{ id: 3, name: '代办理', icon: 'fact-check', iconColor: '#059669', bgColor: '#ECFDF5' },
|
||||
{ id: 8, name: '其他助诊', icon: 'app', iconColor: '#2563EB', bgColor: '#EFF6FF' }
|
||||
escortServices: [{
|
||||
id: 1,
|
||||
name: '陪诊',
|
||||
icon: 'heart',
|
||||
iconColor: '#E11D48',
|
||||
bgColor: '#FFF1F2'
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
name: '代问诊',
|
||||
icon: 'chat-heart',
|
||||
iconColor: '#EA580C',
|
||||
bgColor: '#FFF7ED'
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
name: '代办理',
|
||||
icon: 'fact-check',
|
||||
iconColor: '#059669',
|
||||
bgColor: '#ECFDF5'
|
||||
},
|
||||
{
|
||||
id: 8,
|
||||
name: '其他助诊',
|
||||
icon: 'app',
|
||||
iconColor: '#2563EB',
|
||||
bgColor: '#EFF6FF'
|
||||
}
|
||||
],
|
||||
otherServices: [
|
||||
{ id: 1, name: '代探望', icon: 'apple', url: '', type: '', iconColor: '#7C3AED', bgColor: '#F5F3FF' },
|
||||
{ id: 2, name: '企业陪诊', icon: 'city-8', url: '', type: '', iconColor: '#D97706', bgColor: '#FFFBEB' },
|
||||
{ id: 3, name: '陪诊师入驻', icon: 'usergroup', url: '', type: '', iconColor: '#4F46E5', bgColor: '#EEF2FF' },
|
||||
{ id: 4, name: '商务合作', icon: 'command', url: '', type: '', iconColor: '#0D9488', bgColor: '#F0FDFA' },
|
||||
otherServices: [{
|
||||
id: 1,
|
||||
name: '代探望',
|
||||
icon: 'apple',
|
||||
url: '',
|
||||
type: '',
|
||||
iconColor: '#7C3AED',
|
||||
bgColor: '#F5F3FF'
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
name: '企业陪诊',
|
||||
icon: 'city-8',
|
||||
url: '',
|
||||
type: '',
|
||||
iconColor: '#D97706',
|
||||
bgColor: '#FFFBEB'
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
name: '陪诊师入驻',
|
||||
icon: 'usergroup',
|
||||
url: '',
|
||||
type: '',
|
||||
iconColor: '#4F46E5',
|
||||
bgColor: '#EEF2FF'
|
||||
},
|
||||
{
|
||||
id: 4,
|
||||
name: '商务合作',
|
||||
icon: 'command',
|
||||
url: '',
|
||||
type: '',
|
||||
iconColor: '#0D9488',
|
||||
bgColor: '#F0FDFA'
|
||||
},
|
||||
],
|
||||
tools: [
|
||||
{ id: 1, name: '预约记录', icon: 'assignment', url: 'pages/escort/recordlist', type: 'page', iconColor: '#0891B2', bgColor: '#ECFEFF' },
|
||||
{ id: 2, name: '健康档案', icon: 'attach', url: '', type: '', iconColor: '#DB2777', bgColor: '#FDF2F8' }
|
||||
tools: [{
|
||||
id: 1,
|
||||
name: '预约记录',
|
||||
icon: 'assignment',
|
||||
url: 'pages/escort/recordlist',
|
||||
type: 'page',
|
||||
iconColor: '#0891B2',
|
||||
bgColor: '#ECFEFF'
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
name: '健康档案',
|
||||
icon: 'attach',
|
||||
url: '',
|
||||
type: '',
|
||||
iconColor: '#DB2777',
|
||||
bgColor: '#FDF2F8'
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
onShareAppMessage() {
|
||||
return {
|
||||
title: '暖橙陪诊', // 转发标题
|
||||
path: '/pages/home/index',
|
||||
path: '/pages/home/index',
|
||||
}
|
||||
},
|
||||
|
||||
@@ -29,11 +98,10 @@ Page({
|
||||
return {
|
||||
title: '暖橙陪诊',
|
||||
}
|
||||
},
|
||||
|
||||
async onLoad() {
|
||||
},
|
||||
|
||||
async onLoad() {},
|
||||
|
||||
goToAiChat() {
|
||||
wx.switchTab({
|
||||
url: '/pages/ai/aichat'
|
||||
@@ -70,16 +138,25 @@ Page({
|
||||
}
|
||||
switch (item.type) {
|
||||
case 'page':
|
||||
wx.navigateTo({ url: '/' + item.url });
|
||||
wx.navigateTo({
|
||||
url: '/' + item.url
|
||||
});
|
||||
break;
|
||||
case 'tab':
|
||||
wx.switchTab({ url: '/' + item.url });
|
||||
wx.switchTab({
|
||||
url: '/' + item.url
|
||||
});
|
||||
break;
|
||||
case 'website':
|
||||
wx.navigateTo({ url: '/pages/home/webview?url=' + encodeURIComponent(item.url) });
|
||||
wx.navigateTo({
|
||||
url: '/pages/home/webview?url=' + encodeURIComponent(item.url)
|
||||
});
|
||||
break;
|
||||
case 'wxapp':
|
||||
wx.navigateToMiniProgram({ shortLink: item.url, env: 'release' })
|
||||
wx.navigateToMiniProgram({
|
||||
shortLink: item.url,
|
||||
env: 'release'
|
||||
})
|
||||
break;
|
||||
default:
|
||||
wx.showToast({
|
||||
@@ -88,4 +165,4 @@ Page({
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -8,6 +8,19 @@ Page({
|
||||
|
||||
},
|
||||
|
||||
onShareAppMessage() {
|
||||
return {
|
||||
title: '暖橙陪诊', // 转发标题
|
||||
path: '/pages/mine/about',
|
||||
}
|
||||
},
|
||||
|
||||
onShareTimeline: function () {
|
||||
return {
|
||||
title: '暖橙陪诊',
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user