feat(XCamera): 实现异步抓图功能并优化图像处理

fix(nginx): 调整企业微信回调代理路径

feat(gateway): 添加企业微信消息处理功能

docs: 更新项目规划文档和企业微信配置详情

refactor(XCamera): 重构LED检测和图像处理逻辑

test: 添加ONVIF抓图测试功能
This commit is contained in:
zqm
2026-03-31 11:04:43 +08:00
parent 1f5d05e6d6
commit cdf64fa31f
2605 changed files with 530175 additions and 1081 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 379 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 375 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 423 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 419 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 319 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 316 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 450 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 446 B

View File

@@ -8,14 +8,18 @@ Page({
messages: [],
inputValue: '',
sending: false,
isTyping: false,
showHistoryTip: false,
websocketManager: null,
lastMessageId: '',
isConnected: false
isConnected: false,
currentPage: 1
},
onLoad() {
this.initWebSocket()
this.loadChatHistory()
this.addWelcomeMessage()
},
onUnload() {
@@ -24,6 +28,20 @@ Page({
}
},
// 添加欢迎消息
addWelcomeMessage() {
const welcomeMessage = {
id: util.generateUniqueId(),
content: '你好我是智控未来的AI助手有什么可以帮你的吗',
type: MESSAGE_TYPE.TEXT,
isMe: false,
nickname: '智控未来',
avatar: '/assets/images/ai-avatar.png',
time: formatRelativeTime(new Date())
}
this.addMessage(welcomeMessage)
},
// 初始化WebSocket连接
initWebSocket() {
const manager = new WebSocketManager()
@@ -37,7 +55,7 @@ Page({
this.handleSystemMessage(data)
})
manager.connect(app.globalData.websocketUrl)
manager.connect(app.globalData.websocketUrl || 'wss://pactgo.cn/api/v1/ws/control')
this.setData({
websocketManager: manager,
@@ -48,22 +66,13 @@ Page({
// 加载聊天记录
async loadChatHistory() {
try {
const result = await API.getChatHistory(1, 50)
if (result.success && result.data) {
const messages = result.data.messages.map(msg => ({
id: msg.id,
content: msg.content,
type: msg.type || MESSAGE_TYPE.TEXT,
isMe: msg.isMe || false,
nickname: msg.nickname || 'AI助手',
avatar: msg.avatar || '/assets/images/ai-avatar.png',
time: formatRelativeTime(new Date(msg.timestamp))
}))
// 模拟加载历史消息
const mockHistory = this.getMockHistoryMessages()
if (mockHistory.length > 0) {
this.setData({
messages: messages.reverse()
messages: mockHistory,
showHistoryTip: true
})
this.scrollToBottom()
}
} catch (error) {
@@ -71,19 +80,127 @@ Page({
}
},
// 加载更多历史消息
loadMoreHistory() {
if (this.data.currentPage < 3) { // 模拟加载3页历史
this.setData({ currentPage: this.data.currentPage + 1 })
const moreHistory = this.getMockHistoryMessages(this.data.currentPage)
if (moreHistory.length > 0) {
const updatedMessages = [...moreHistory, ...this.data.messages]
this.setData({ messages: updatedMessages })
}
}
},
// 模拟历史消息
getMockHistoryMessages(page = 1) {
const messages = []
if (page === 1) {
messages.push({
id: 'history-1',
content: '你好我是智控未来的AI助手',
type: MESSAGE_TYPE.TEXT,
isMe: false,
nickname: '智控未来',
avatar: '/assets/images/ai-avatar.png',
time: '昨天 14:30'
})
messages.push({
id: 'history-2',
content: '你能做什么?',
type: MESSAGE_TYPE.TEXT,
isMe: true,
nickname: '我',
avatar: '/assets/images/user-avatar.png',
time: '昨天 14:31'
})
messages.push({
id: 'history-3',
content: '我可以帮你解答问题、提供信息、生成内容等。请问有什么具体需求吗?',
type: MESSAGE_TYPE.TEXT,
isMe: false,
nickname: '智控未来',
avatar: '/assets/images/ai-avatar.png',
time: '昨天 14:32'
})
} else if (page === 2) {
messages.push({
id: 'history-4',
content: '如何学习编程?',
type: MESSAGE_TYPE.TEXT,
isMe: true,
nickname: '我',
avatar: '/assets/images/user-avatar.png',
time: '昨天 15:00'
})
messages.push({
id: 'history-5',
content: '<p>学习编程的步骤:</p><ol><li>选择一门编程语言如Python、JavaScript等</li><li>学习基础语法和概念</li><li>实践项目,积累经验</li><li>参与社区,学习他人的代码</li></ol>',
type: MESSAGE_TYPE.richText,
isMe: false,
nickname: '智控未来',
avatar: '/assets/images/ai-avatar.png',
time: '昨天 15:01'
})
}
return messages
},
// 处理新消息
handleNewMessage(data) {
const message = {
id: data.id || util.generateUniqueId(),
content: data.content,
type: data.type || MESSAGE_TYPE.TEXT,
isMe: false,
nickname: data.nickname || 'AI助手',
avatar: data.avatar || '/assets/images/ai-avatar.png',
time: formatRelativeTime(new Date())
}
this.setData({ isTyping: false })
this.addMessage(message)
// 模拟不同类型的消息
if (data.content.includes('代码')) {
const codeMessage = {
id: data.id || util.generateUniqueId(),
content: 'def hello():\n print("Hello, World!")',
type: 'code',
language: 'Python',
isMe: false,
nickname: '智控未来',
avatar: '/assets/images/ai-avatar.png',
time: formatRelativeTime(new Date())
}
this.addMessage(codeMessage)
} else if (data.content.includes('卡片')) {
const cardMessage = {
id: data.id || util.generateUniqueId(),
type: 'buttonCard',
title: '选择一个选项',
buttons: [
{ id: '1', text: '选项一', action: 'option1' },
{ id: '2', text: '选项二', action: 'option2' }
],
isMe: false,
nickname: '智控未来',
avatar: '/assets/images/ai-avatar.png',
time: formatRelativeTime(new Date())
}
this.addMessage(cardMessage)
} else if (data.content.includes('富文本')) {
const richTextMessage = {
id: data.id || util.generateUniqueId(),
content: '<h3>标题</h3><p>这是一段<b>加粗</b>的文本,包含<ul><li>无序列表项1</li><li>无序列表项2</li></ul></p>',
type: 'richText',
isMe: false,
nickname: '智控未来',
avatar: '/assets/images/ai-avatar.png',
time: formatRelativeTime(new Date())
}
this.addMessage(richTextMessage)
} else {
const message = {
id: data.id || util.generateUniqueId(),
content: data.content,
type: data.type || MESSAGE_TYPE.TEXT,
isMe: false,
nickname: data.nickname || '智控未来',
avatar: data.avatar || '/assets/images/ai-avatar.png',
time: formatRelativeTime(new Date())
}
this.addMessage(message)
}
},
// 处理系统消息
@@ -97,7 +214,6 @@ Page({
avatar: '/assets/images/system-avatar.png',
time: formatRelativeTime(new Date())
}
this.addMessage(message)
},
@@ -108,18 +224,19 @@ Page({
messages: messages,
lastMessageId: message.id
})
this.scrollToBottom()
},
// 滚动到底部
scrollToBottom() {
if (this.data.messages.length > 0) {
const lastMessage = this.data.messages[this.data.messages.length - 1]
this.setData({
lastMessageId: lastMessage.id
})
}
setTimeout(() => {
if (this.data.messages.length > 0) {
const lastMessage = this.data.messages[this.data.messages.length - 1]
this.setData({
lastMessageId: lastMessage.id
})
}
}, 100)
},
// 输入变化
@@ -137,7 +254,8 @@ Page({
}
this.setData({
sending: true
sending: true,
isTyping: true
})
// 添加用户消息到界面
@@ -154,18 +272,19 @@ Page({
this.addMessage(userMessage)
try {
// 通过WebSocket发送消息
if (this.data.websocketManager && this.data.isConnected) {
this.data.websocketManager.send({
type: WS_MESSAGE_TYPE.MESSAGE,
content: content,
messageType: MESSAGE_TYPE.TEXT,
timestamp: Date.now()
})
} else {
// 通过HTTP API发送消息
await API.sendMessage(content, MESSAGE_TYPE.TEXT)
}
// 模拟AI回复
setTimeout(() => {
const aiResponse = {
id: util.generateUniqueId(),
content: this.getMockAIResponse(content),
type: MESSAGE_TYPE.TEXT,
isMe: false,
nickname: '智控未来',
avatar: '/assets/images/ai-avatar.png',
time: formatRelativeTime(new Date())
}
this.handleNewMessage(aiResponse)
}, 1500)
this.setData({
inputValue: '',
@@ -175,237 +294,101 @@ Page({
console.error('发送消息失败:', error)
util.showError('发送失败,请重试')
this.setData({
sending: false
sending: false,
isTyping: false
})
}
},
// 选择图片
chooseImage() {
wx.chooseImage({
count: 1,
sizeType: ['compressed'],
sourceType: ['album', 'camera'],
success: (res) => {
this.uploadImage(res.tempFilePaths[0])
},
fail: (error) => {
console.error('选择图片失败:', error)
}
})
// 模拟AI回复
getMockAIResponse(content) {
const responses = {
'你好': '你好!很高兴为你服务。',
'今天天气怎么样': '今天天气晴朗,适合户外活动。',
'如何学习编程': '学习编程需要持之以恒,建议从基础语法开始,多动手实践。',
'代码': 'def hello():\n print("Hello, World!")',
'卡片': '这是一个卡片消息',
'富文本': '这是一段富文本消息,包含<b>加粗</b>和<u>下划线</u>。',
'今天是几月几日': '今天是' + new Date().toLocaleDateString('zh-CN'),
'你是谁': '我是智控未来的AI助手由LMStudio提供支持。'
}
return responses[content] || '感谢你的提问,我会为你提供准确的回答。'
},
// 上传图片
async uploadImage(filePath) {
try {
util.showLoading('上传中...')
const result = await API.uploadFile(filePath, {
type: 'image',
messageType: MESSAGE_TYPE.IMAGE
// 长按消息
onMessageLongPress(e) {
const messageId = e.currentTarget.dataset.messageId
const message = this.data.messages.find(msg => msg.id === messageId)
if (message && message.type === MESSAGE_TYPE.TEXT) {
wx.showActionSheet({
itemList: ['复制消息', '删除消息'],
success: (res) => {
switch (res.tapIndex) {
case 0:
this.copyMessage(message.content)
break
case 1:
this.deleteMessage(messageId)
break
}
}
})
util.hideLoading()
if (result.success) {
// 发送图片消息
const imageMessage = {
id: util.generateUniqueId(),
content: result.data.url,
type: MESSAGE_TYPE.IMAGE,
isMe: true,
nickname: '我',
avatar: '/assets/images/user-avatar.png',
time: formatRelativeTime(new Date())
}
this.addMessage(imageMessage)
// 通过WebSocket发送图片消息
if (this.data.websocketManager && this.data.isConnected) {
this.data.websocketManager.send({
type: WS_MESSAGE_TYPE.MESSAGE,
content: result.data.url,
messageType: MESSAGE_TYPE.IMAGE,
timestamp: Date.now()
})
}
}
} catch (error) {
util.hideLoading()
console.error('上传图片失败:', error)
util.showError('上传失败')
}
},
// 显示更多操作
showMoreActions() {
wx.showActionSheet({
itemList: ['发送文件', '语音输入', '清空聊天记录'],
success: (res) => {
switch (res.tapIndex) {
case 0:
this.chooseFile()
break
case 1:
this.startVoiceInput()
break
case 2:
this.clearChatHistory()
break
}
// 复制消息
copyMessage(content) {
wx.setClipboardData({
data: content,
success: () => {
wx.showToast({
title: '复制成功',
icon: 'success'
})
}
})
},
// 选择文件
chooseFile() {
wx.chooseMessageFile({
count: 1,
type: 'file',
success: (res) => {
this.uploadFile(res.tempFiles[0])
},
fail: (error) => {
console.error('选择文件失败:', error)
// 删除消息
deleteMessage(messageId) {
const updatedMessages = this.data.messages.filter(msg => msg.id !== messageId)
this.setData({ messages: updatedMessages })
wx.showToast({
title: '已删除',
icon: 'success'
})
},
// 复制代码
copyCode(e) {
const content = e.currentTarget.dataset.content
wx.setClipboardData({
data: content,
success: () => {
wx.showToast({
title: '代码已复制',
icon: 'success'
})
}
})
},
// 上传文件
async uploadFile(file) {
try {
util.showLoading('上传中...')
const result = await API.uploadFile(file.path, {
type: 'file',
messageType: MESSAGE_TYPE.FILE,
fileName: file.name,
fileSize: file.size
})
util.hideLoading()
if (result.success) {
// 发送文件消息
const fileMessage = {
id: util.generateUniqueId(),
content: result.data.url,
type: MESSAGE_TYPE.FILE,
isMe: true,
nickname: '我',
avatar: '/assets/images/user-avatar.png',
time: formatRelativeTime(new Date()),
fileName: file.name,
fileSize: util.formatFileSize(file.size)
}
this.addMessage(fileMessage)
// 通过WebSocket发送文件消息
if (this.data.websocketManager && this.data.isConnected) {
this.data.websocketManager.send({
type: WS_MESSAGE_TYPE.MESSAGE,
content: result.data.url,
messageType: MESSAGE_TYPE.FILE,
fileName: file.name,
fileSize: file.size,
timestamp: Date.now()
})
}
}
} catch (error) {
util.hideLoading()
console.error('上传文件失败:', error)
util.showError('上传失败')
}
},
// 开始语音输入
startVoiceInput() {
wx.showModal({
title: '语音输入',
content: '按住录音按钮开始录音',
showCancel: true,
confirmText: '开始录音',
success: (res) => {
if (res.confirm) {
this.startRecording()
}
}
// 预览图片
previewImage(e) {
const url = e.currentTarget.dataset.url
wx.previewImage({
urls: [url]
})
},
// 开始录音
startRecording() {
const recorderManager = wx.getRecorderManager()
recorderManager.onStart(() => {
console.log('录音开始')
// 卡片按钮点击
onCardButtonTap(e) {
const action = e.currentTarget.dataset.action
wx.showToast({
title: `你点击了${action}`,
icon: 'none'
})
recorderManager.onStop((res) => {
console.log('录音结束', res)
if (res.tempFilePath) {
this.uploadAudio(res.tempFilePath)
}
})
recorderManager.start({
duration: 60000, // 最长60秒
sampleRate: 16000,
numberOfChannels: 1,
encodeBitRate: 96000,
format: 'mp3'
})
// 5秒后自动停止录音
setTimeout(() => {
recorderManager.stop()
}, 5000)
},
// 上传音频文件
async uploadAudio(filePath) {
try {
util.showLoading('处理中...')
const result = await API.uploadFile(filePath, {
type: 'audio',
messageType: MESSAGE_TYPE.AUDIO
})
util.hideLoading()
if (result.success) {
// 发送音频消息
const audioMessage = {
id: util.generateUniqueId(),
content: result.data.url,
type: MESSAGE_TYPE.AUDIO,
isMe: true,
nickname: '我',
avatar: '/assets/images/user-avatar.png',
time: formatRelativeTime(new Date())
}
this.addMessage(audioMessage)
// 通过WebSocket发送音频消息
if (this.data.websocketManager && this.data.isConnected) {
this.data.websocketManager.send({
type: WS_MESSAGE_TYPE.MESSAGE,
content: result.data.url,
messageType: MESSAGE_TYPE.AUDIO,
timestamp: Date.now()
})
}
}
} catch (error) {
util.hideLoading()
console.error('上传音频失败:', error)
util.showError('处理失败')
}
},
// 清空聊天记录

View File

@@ -1,3 +1,7 @@
{
"navigationBarTitleText": "智能聊天"
"navigationBarTitleText": "智控未来",
"navigationBarBackgroundColor": "#ffffff",
"navigationBarTextStyle": "black",
"enablePullDownRefresh": false,
"backgroundTextStyle": "light"
}

View File

@@ -6,24 +6,95 @@
scroll-y="{{true}}"
scroll-into-view="{{lastMessageId}}"
enable-back-to-top="{{true}}"
bindscrolltolower="loadMoreHistory"
>
<!-- 系统消息 -->
<view wx:if="{{messages.length === 0}}" class="empty-message">
<text class="empty-text">开始与智控未来的对话吧</text>
</view>
<!-- 历史消息提示 -->
<view wx:if="{{showHistoryTip}}" class="history-tip">
<text>已加载历史消息</text>
</view>
<!-- 消息项 -->
<view
wx:for="{{messages}}"
wx:key="id"
id="{{item.id}}"
class="message-item {{item.isMe ? 'message-right' : 'message-left'}}"
bindlongpress="onMessageLongPress"
data-message-id="{{item.id}}"
>
<view class="message-avatar">
<image src="{{item.avatar}}" mode="aspectFill"></image>
</view>
<view class="message-content">
<view class="message-header">
<view wx:if="{{!item.isMe && item.nickname}}" class="message-header">
<text class="message-nickname">{{item.nickname}}</text>
<text class="message-time">{{item.time}}</text>
</view>
<view class="message-body">
<text class="message-text" wx:if="{{item.type === 'text'}}">{{item.content}}</text>
<image class="message-image" wx:if="{{item.type === 'image'}}" src="{{item.content}}" mode="widthFix"></image>
<!-- 文本消息 -->
<view wx:if="{{item.type === 'text' || item.type === 'richText'}}" class="message-text-container">
<rich-text wx:if="{{item.type === 'richText'}}" nodes="{{item.content}}"></rich-text>
<text wx:else class="message-text">{{item.content}}</text>
</view>
<!-- 图片消息 -->
<image wx:if="{{item.type === 'image'}}" class="message-image" src="{{item.content}}" mode="widthFix" bindtap="previewImage" data-url="{{item.content}}"></image>
<!-- 代码块 -->
<view wx:if="{{item.type === 'code'}}" class="message-code">
<view class="code-header">
<text class="code-language">{{item.language || '代码'}}</text>
<button class="copy-btn" bindtap="copyCode" data-content="{{item.content}}">
<text class="copy-icon">📋</text>
<text class="copy-text">复制</text>
</button>
</view>
<view class="code-body">
<text class="code-text">{{item.content}}</text>
</view>
</view>
<!-- 按钮卡片 -->
<view wx:if="{{item.type === 'buttonCard'}}" class="message-button-card">
<view class="card-title">{{item.title}}</view>
<view class="card-buttons">
<button
wx:for="{{item.buttons}}"
wx:key="id"
class="card-button"
bindtap="onCardButtonTap"
data-action="{{item.buttons[index].action}}"
>
{{item.buttons[index].text}}
</button>
</view>
</view>
</view>
<view class="message-footer">
<text class="message-time">{{item.time}}</text>
</view>
</view>
</view>
<!-- 加载中动画 -->
<view wx:if="{{isTyping}}" class="typing-container">
<view class="message-item message-left">
<view class="message-avatar">
<image src="/assets/images/ai-avatar.png" mode="aspectFill"></image>
</view>
<view class="message-content">
<view class="message-body">
<view class="typing-indicator">
<view class="typing-dot"></view>
<view class="typing-dot"></view>
<view class="typing-dot"></view>
</view>
<text class="typing-text">正在输入...</text>
</view>
</view>
</view>
</view>
@@ -40,6 +111,7 @@
bindconfirm="sendMessage"
confirm-type="send"
adjust-position="{{true}}"
maxlength="2000"
/>
<button
class="send-btn"
@@ -50,14 +122,5 @@
发送
</button>
</view>
<view class="action-buttons">
<button class="action-btn" bindtap="chooseImage">
<image src="/assets/icons/image.png" mode="aspectFit"></image>
</button>
<button class="action-btn" bindtap="showMoreActions">
<image src="/assets/icons/more.png" mode="aspectFit"></image>
</button>
</view>
</view>
</view>

View File

@@ -1,22 +1,53 @@
/* 聊天页面样式 */
@import '../../utils/constant.wxss';
.chat-container {
display: flex;
flex-direction: column;
height: 100vh;
background-color: #f5f5f5;
background-color: #f7f7f7;
}
.message-list {
flex: 1;
padding: 20rpx;
overflow-y: auto;
padding-bottom: 120rpx; /* 为输入区域预留空间 */
padding-bottom: 140rpx; /* 为输入区域预留空间 */
}
.empty-message {
display: flex;
justify-content: center;
align-items: center;
height: 400rpx;
color: #999;
}
.empty-text {
font-size: 28rpx;
color: #999;
}
.history-tip {
display: flex;
justify-content: center;
padding: 10rpx;
margin: 10rpx 0;
}
.history-tip text {
font-size: 24rpx;
color: #999;
background-color: #f0f0f0;
padding: 5rpx 20rpx;
border-radius: 20rpx;
}
.message-item {
display: flex;
margin: 20rpx 0;
align-items: flex-start;
padding: 0 10rpx;
}
.message-left {
@@ -28,68 +59,226 @@
}
.message-avatar {
width: 80rpx;
height: 80rpx;
margin: 0 20rpx;
width: 72rpx;
height: 72rpx;
margin: 0 16rpx;
flex-shrink: 0;
border-radius: 12rpx;
overflow: hidden;
}
.message-avatar image {
width: 100%;
height: 100%;
border-radius: 50%;
border-radius: 12rpx;
}
.message-content {
max-width: 70%;
max-width: 75%;
display: flex;
flex-direction: column;
}
.message-header {
display: flex;
align-items: center;
margin-bottom: 10rpx;
margin-bottom: 8rpx;
}
.message-nickname {
font-size: 24rpx;
color: #999;
margin-right: 10rpx;
font-weight: 500;
}
.message-body {
padding: 20rpx 24rpx;
word-wrap: break-word;
position: relative;
}
.message-left .message-body {
background-color: white;
border-radius: 16rpx 16rpx 16rpx 4rpx;
box-shadow: 0 1rpx 2rpx rgba(0, 0, 0, 0.05);
}
.message-right .message-body {
background-color: #1677FF;
border-radius: 16rpx 16rpx 4rpx 16rpx;
box-shadow: 0 1rpx 2rpx rgba(22, 119, 255, 0.1);
}
.message-text-container {
line-height: 1.5;
}
.message-text {
font-size: 28rpx;
line-height: 1.5;
}
.message-left .message-text {
color: #333;
}
.message-right .message-text {
color: white;
}
.message-footer {
margin-top: 8rpx;
display: flex;
justify-content: flex-end;
}
.message-time {
font-size: 20rpx;
color: #ccc;
}
.message-body {
background-color: #f0f0f0;
border-radius: 10rpx;
padding: 20rpx;
word-wrap: break-word;
}
.message-right .message-body {
background-color: #95ec69;
}
.message-text {
font-size: 28rpx;
color: #333;
line-height: 1.5;
}
.message-right .message-text {
color: #000;
margin-right: 16rpx;
}
.message-image {
max-width: 300rpx;
max-height: 300rpx;
border-radius: 10rpx;
max-width: 400rpx;
max-height: 400rpx;
border-radius: 12rpx;
margin: 4rpx 0;
}
/* 代码块样式 */
.message-code {
background-color: #f5f5f5;
border-radius: 12rpx;
overflow: hidden;
margin: 8rpx 0;
}
.code-header {
display: flex;
justify-content: space-between;
align-items: center;
padding: 12rpx 16rpx;
background-color: #e8e8e8;
border-bottom: 1rpx solid #ddd;
}
.code-language {
font-size: 24rpx;
color: #666;
font-family: monospace;
}
.copy-btn {
background: none;
border: none;
display: flex;
align-items: center;
font-size: 22rpx;
color: #1677FF;
padding: 0;
}
.copy-icon {
margin-right: 4rpx;
}
.copy-text {
font-size: 22rpx;
}
.code-body {
padding: 16rpx;
max-height: 400rpx;
overflow-y: auto;
background-color: #f5f5f5;
}
.code-text {
font-size: 24rpx;
line-height: 1.4;
color: #333;
font-family: 'Courier New', Courier, monospace;
white-space: pre-wrap;
}
/* 按钮卡片样式 */
.message-button-card {
background-color: white;
border-radius: 12rpx;
padding: 20rpx;
box-shadow: 0 1rpx 2rpx rgba(0, 0, 0, 0.05);
margin: 8rpx 0;
}
.card-title {
font-size: 26rpx;
font-weight: 500;
color: #333;
margin-bottom: 16rpx;
}
.card-buttons {
display: flex;
flex-direction: column;
gap: 12rpx;
}
.card-button {
background-color: #f8f8f8;
border: 1rpx solid #e0e0e0;
border-radius: 8rpx;
padding: 16rpx;
font-size: 26rpx;
color: #1677FF;
text-align: left;
transition: all 0.2s ease;
}
.card-button:active {
background-color: #f0f0f0;
}
/* 加载动画 */
.typing-container {
margin: 20rpx 0;
}
.typing-indicator {
display: flex;
align-items: center;
gap: 8rpx;
margin-bottom: 8rpx;
}
.typing-dot {
width: 12rpx;
height: 12rpx;
background-color: #1677FF;
border-radius: 50%;
animation: typing-bounce 1.4s infinite ease-in-out both;
}
.typing-dot:nth-child(1) {
animation-delay: -0.32s;
}
.typing-dot:nth-child(2) {
animation-delay: -0.16s;
}
.typing-text {
font-size: 24rpx;
color: #999;
}
@keyframes typing-bounce {
0%, 80%, 100% {
transform: scale(0);
}
40% {
transform: scale(1);
}
}
/* 输入区域 */
.input-container {
position: fixed;
bottom: 0;
@@ -99,43 +288,53 @@
border-top: 1rpx solid #e0e0e0;
padding: 20rpx;
z-index: 1000;
box-shadow: 0 -2rpx 10rpx rgba(0, 0, 0, 0.05);
}
.input-wrapper {
display: flex;
align-items: center;
margin-bottom: 20rpx;
align-items: flex-end;
gap: 16rpx;
}
.message-input {
flex: 1;
border: 1rpx solid #e0e0e0;
border-radius: 50rpx;
padding: 20rpx 30rpx;
border-radius: 28rpx;
padding: 20rpx 28rpx;
font-size: 28rpx;
background-color: #f8f8f8;
margin-right: 20rpx;
min-height: 80rpx;
max-height: 200rpx;
overflow-y: auto;
line-height: 1.4;
}
.message-input:focus {
border-color: #07c160;
border-color: #1677FF;
background-color: white;
box-shadow: 0 0 0 2rpx rgba(22, 119, 255, 0.1);
}
.send-btn {
background: linear-gradient(135deg, #07c160 0%, #06a050 100%);
background-color: #1677FF;
color: white;
border: none;
border-radius: 50rpx;
padding: 20rpx 40rpx;
font-size: 28rpx;
border-radius: 50%;
width: 80rpx;
height: 80rpx;
font-size: 26rpx;
font-weight: 500;
display: flex;
align-items: center;
justify-content: center;
transition: all 0.3s ease;
min-width: 120rpx;
flex-shrink: 0;
}
.send-btn:active {
transform: scale(0.95);
background-color: #0e66e0;
}
.send-btn:disabled {
@@ -144,24 +343,83 @@
transform: none;
}
.action-buttons {
display: flex;
justify-content: space-around;
/* 富文本样式 */
rich-text {
line-height: 1.5;
}
.action-btn {
background: none;
border: none;
padding: 20rpx;
border-radius: 10rpx;
transition: background-color 0.3s;
rich-text :deep(p) {
margin: 12rpx 0;
}
.action-btn:active {
background-color: #f0f0f0;
rich-text :deep(h1),
rich-text :deep(h2),
rich-text :deep(h3) {
font-weight: 600;
margin: 16rpx 0 12rpx 0;
}
.action-btn image {
width: 60rpx;
height: 60rpx;
rich-text :deep(h1) {
font-size: 32rpx;
color: #333;
}
rich-text :deep(h2) {
font-size: 28rpx;
color: #444;
}
rich-text :deep(h3) {
font-size: 26rpx;
color: #555;
}
rich-text :deep(ul),
rich-text :deep(ol) {
margin: 12rpx 0;
padding-left: 40rpx;
}
rich-text :deep(li) {
margin: 8rpx 0;
line-height: 1.5;
}
rich-text :deep(strong) {
font-weight: 600;
}
/* 响应式设计 */
@media (max-width: 375px) {
.message-content {
max-width: 70%;
}
.message-avatar {
width: 64rpx;
height: 64rpx;
margin: 0 12rpx;
}
.message-body {
padding: 16rpx 20rpx;
}
.message-text {
font-size: 26rpx;
}
}
@media (min-width: 768px) {
.message-content {
max-width: 60%;
}
.message-body {
padding: 24rpx 28rpx;
}
.message-text {
font-size: 30rpx;
}
}

View File

@@ -41,15 +41,21 @@
"minifyWXML": true,
"showES6CompileOption": false,
"useCompilerPlugins": false,
"ignoreUploadUnusedFiles": true
"ignoreUploadUnusedFiles": true,
"compileWorklet": false,
"localPlugins": false,
"condition": false,
"swc": false,
"disableSWC": true
},
"compileType": "miniprogram",
"libVersion": "2.19.4",
"appid": "wx1234567890abcdef",
"appid": "wx07f7e566fb459333",
"projectname": "智控未来",
"condition": {},
"editorSetting": {
"tabIndent": "insertSpaces",
"tabSize": 2
}
},
"simulatorPluginLibVersion": {}
}

View File

@@ -1,7 +1,7 @@
{
"description": "智控未来 - 企业微信智能控制系统",
"projectname": "智控未来",
"appid": "wx1234567890abcdef",
"projectname": "%E6%99%BA%E6%8E%A7%E6%9C%AA%E6%9D%A5",
"appid": "wx07f7e566fb459333",
"projectType": "miniprogram",
"miniprogramRoot": "./",
"setting": {
@@ -20,10 +20,23 @@
"ignore": [],
"disablePlugins": [],
"outputPath": ""
}
},
"coverView": true,
"lazyloadPlaceholderEnable": false,
"skylineRenderEnable": false,
"preloadBackgroundData": false,
"useApiHook": true,
"showShadowRootInWxmlPanel": true,
"useStaticServer": false,
"useLanDebug": false,
"showES6CompileOption": false,
"compileHotReLoad": true,
"ignoreDevUnusedFiles": true,
"bigPackageSizeSupport": false,
"useIsolateContext": true
},
"compileType": "miniprogram",
"libVersion": "2.19.4",
"libVersion": "3.15.0",
"packOptions": {
"ignore": [],
"include": []

View File

@@ -0,0 +1,137 @@
/* 常量样式 */
/* 主题色 */
:root {
--primary-color: #1677FF;
--primary-hover: #0e66e0;
--secondary-color: #f0f0f0;
--text-primary: #333333;
--text-secondary: #666666;
--text-light: #999999;
--background-light: #f7f7f7;
--border-color: #e0e0e0;
--success-color: #07c160;
--warning-color: #ff9500;
--error-color: #dd524d;
}
/* 字体大小 */
.font-xs {
font-size: 20rpx;
}
.font-sm {
font-size: 24rpx;
}
.font-base {
font-size: 28rpx;
}
.font-lg {
font-size: 32rpx;
}
.font-xl {
font-size: 36rpx;
}
/* 间距 */
.mt-1 {
margin-top: 10rpx;
}
.mt-2 {
margin-top: 20rpx;
}
.mt-3 {
margin-top: 30rpx;
}
.mb-1 {
margin-bottom: 10rpx;
}
.mb-2 {
margin-bottom: 20rpx;
}
.mb-3 {
margin-bottom: 30rpx;
}
.ml-1 {
margin-left: 10rpx;
}
.ml-2 {
margin-left: 20rpx;
}
.mr-1 {
margin-right: 10rpx;
}
.mr-2 {
margin-right: 20rpx;
}
/* 圆角 */
.rounded-sm {
border-radius: 8rpx;
}
.rounded-md {
border-radius: 12rpx;
}
.rounded-lg {
border-radius: 16rpx;
}
.rounded-full {
border-radius: 9999rpx;
}
/* 阴影 */
.shadow-sm {
box-shadow: 0 1rpx 2rpx rgba(0, 0, 0, 0.05);
}
.shadow-md {
box-shadow: 0 2rpx 4rpx rgba(0, 0, 0, 0.1);
}
.shadow-lg {
box-shadow: 0 4rpx 8rpx rgba(0, 0, 0, 0.15);
}
/* 动画 */
.fade-in {
animation: fadeIn 0.3s ease-in-out;
}
@keyframes fadeIn {
from {
opacity: 0;
}
to {
opacity: 1;
}
}
.slide-up {
animation: slideUp 0.3s ease-out;
}
@keyframes slideUp {
from {
transform: translateY(20rpx);
opacity: 0;
}
to {
transform: translateY(0);
opacity: 1;
}
}