fix:更新AI对话聊天
This commit is contained in:
parent
2d9709cc36
commit
aebf40b7e7
@ -1,5 +1,5 @@
|
|||||||
NODE_ENV= development
|
NODE_ENV= development
|
||||||
VITE_HTTP_BASE_URL = http://10.39.13.78:8001/api/
|
VITE_HTTP_BASE_URL = http://10.39.13.78:8002/api/
|
||||||
# VITE_HTTP_BASE_URL = https://test-weapp-api.linyikj.com.cn/api/
|
# VITE_HTTP_BASE_URL = https://test-weapp-api.linyikj.com.cn/api/
|
||||||
# VITE_HTTP_BASE_URL = https://weapp-api.linyikj.com.cn/api/
|
# VITE_HTTP_BASE_URL = https://weapp-api.linyikj.com.cn/api/
|
||||||
VITE_ACCESS_TOKEN_KEY= 'ACCESS_TOKEN_CUSTOMER'
|
VITE_ACCESS_TOKEN_KEY= 'ACCESS_TOKEN_CUSTOMER'
|
||||||
1
dist/build/mp-weixin/components/hs-scroll-indicator/hs-scroll-indicator.js
vendored
Normal file
1
dist/build/mp-weixin/components/hs-scroll-indicator/hs-scroll-indicator.js
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
"use strict";const l=require("../../common/vendor.js"),o=l.defineComponent({__name:"hs-scroll-indicator",props:["scroll_view"],setup(o){const e=o;let n=l.index.getWindowInfo();const t=l.ref(0);return l.watch((()=>{var l;return null==(l=null==e?void 0:e.scroll_view)?void 0:l.scrollLeft}),(l=>{let o=null==e?void 0:e.scroll_view,r=(null==o?void 0:o.scrollWidth)-(null==n?void 0:n.windowWidth),i=(null==o?void 0:o.scrollLeft)/r*100;t.value=i/100*25})),(l,o)=>({a:`${t.value}%`})}}),e=l._export_sfc(o,[["__scopeId","data-v-808db072"]]);wx.createComponent(e);
|
||||||
4
dist/build/mp-weixin/components/hs-scroll-indicator/hs-scroll-indicator.json
vendored
Normal file
4
dist/build/mp-weixin/components/hs-scroll-indicator/hs-scroll-indicator.json
vendored
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
{
|
||||||
|
"component": true,
|
||||||
|
"usingComponents": {}
|
||||||
|
}
|
||||||
1
dist/build/mp-weixin/components/hs-scroll-indicator/hs-scroll-indicator.wxml
vendored
Normal file
1
dist/build/mp-weixin/components/hs-scroll-indicator/hs-scroll-indicator.wxml
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
<view class="scroll_indicator_container data-v-808db072"><view class="scroll_indicator data-v-808db072"><view class="indicator data-v-808db072" style="{{'left:' + a}}"></view></view></view>
|
||||||
1
dist/build/mp-weixin/components/hs-scroll-indicator/hs-scroll-indicator.wxss
vendored
Normal file
1
dist/build/mp-weixin/components/hs-scroll-indicator/hs-scroll-indicator.wxss
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
.scroll_indicator_container.data-v-808db072{width:100%}.scroll_indicator.data-v-808db072{background-color:#eee;width:60rpx;margin:0 auto;margin-top:15rpx}.scroll_indicator .indicator.data-v-808db072{background-color:#304483;border-radius:100rpx;width:35rpx;height:8rpx;position:relative}
|
||||||
1
dist/build/mp-weixin/pages/ai/chat.js
vendored
Normal file
1
dist/build/mp-weixin/pages/ai/chat.js
vendored
Normal file
File diff suppressed because one or more lines are too long
8
dist/build/mp-weixin/pages/ai/chat.json
vendored
Normal file
8
dist/build/mp-weixin/pages/ai/chat.json
vendored
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
{
|
||||||
|
"navigationBarTitleText": "客服服务",
|
||||||
|
"enablePullDownRefresh": true,
|
||||||
|
"backgroundTextStyle": "dark",
|
||||||
|
"usingComponents": {
|
||||||
|
"uni-icons": "../../uni_modules/uni-icons/components/uni-icons/uni-icons"
|
||||||
|
}
|
||||||
|
}
|
||||||
1
dist/build/mp-weixin/pages/ai/chat.wxml
vendored
Normal file
1
dist/build/mp-weixin/pages/ai/chat.wxml
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
<view class="chat-container data-v-d335cb2c"><view class="chat-messages data-v-d335cb2c"><view wx:for="{{a}}" wx:for-item="message" wx:key="F" id="{{message.G}}" class="{{['message-item', 'data-v-d335cb2c', message.H]}}"><view wx:if="{{message.a}}" class="message-avatar data-v-d335cb2c"><image class="data-v-d335cb2c" src="/static/svg/ai_icon.svg" mode="aspectFit"/></view><view class="message-content-wrapper data-v-d335cb2c"><view class="message-content data-v-d335cb2c"><view wx:if="{{message.b}}" class="message-images data-v-d335cb2c"><view wx:for="{{message.c}}" wx:for-item="image" wx:key="c" class="{{['message-image-item', 'data-v-d335cb2c', message.e && 'single-image']}}"><image src="{{image.a}}" mode="{{message.d}}" class="message-image data-v-d335cb2c" bindtap="{{image.b}}"/></view></view><view wx:elif="{{message.f}}" class="message-images data-v-d335cb2c"><view wx:for="{{message.g}}" wx:for-item="image" wx:key="c" class="{{['message-image-item', 'data-v-d335cb2c', message.i && 'single-image']}}"><image src="{{image.a}}" mode="{{message.h}}" class="message-image data-v-d335cb2c" bindtap="{{image.b}}"/></view></view><view wx:elif="{{message.j}}" class="message-images data-v-d335cb2c"><view wx:for="{{message.k}}" wx:for-item="image" wx:key="c" class="{{['message-image-item', 'data-v-d335cb2c', message.m && 'single-image']}}"><image src="{{image.a}}" mode="{{message.l}}" class="message-image data-v-d335cb2c" bindtap="{{image.b}}"/></view></view><block wx:if="{{message.n}}"><view wx:for="{{message.o}}" wx:for-item="line" wx:key="b" class="message-text-line data-v-d335cb2c"><text class="data-v-d335cb2c">{{line.a}}</text></view></block></view><view wx:if="{{message.p}}" class="quick-questions data-v-d335cb2c"><view wx:for="{{message.q}}" wx:for-item="question" wx:key="b" class="question-btn data-v-d335cb2c" bindtap="{{question.c}}"><text class="data-v-d335cb2c">{{question.a}}</text></view></view><view wx:if="{{message.r}}" class="confirmation-buttons data-v-d335cb2c"><view class="{{['confirmation-btn', 'data-v-d335cb2c', message.s && 'selected', message.t && 'disabled']}}" bindtap="{{message.v}}"><text class="data-v-d335cb2c">是</text></view><view class="{{['confirmation-btn', 'data-v-d335cb2c', message.w && 'selected', message.x && 'disabled']}}" bindtap="{{message.y}}"><text class="data-v-d335cb2c">否</text></view></view><view wx:if="{{message.z}}" class="message-meta data-v-d335cb2c"><view wx:if="{{message.A}}" class="copy-button data-v-d335cb2c" bindtap="{{message.B}}"><image src="/static/svg/copy.svg" mode="aspectFit" class="copy-icon data-v-d335cb2c"/></view><text class="message-time data-v-d335cb2c">{{message.C}}</text><view wx:if="{{message.D}}" class="copy-button data-v-d335cb2c" bindtap="{{message.E}}"><image src="/static/svg/copy.svg" mode="aspectFit" class="copy-icon data-v-d335cb2c"/></view></view></view></view><view wx:if="{{b}}" class="message-item ai-message data-v-d335cb2c"><view class="message-avatar data-v-d335cb2c"><image class="data-v-d335cb2c" src="/static/svg/ai_icon.svg" mode="aspectFit"/></view><view class="message-content loading data-v-d335cb2c"><text class="data-v-d335cb2c">{{c}}</text></view></view></view><view class="chat-input-area data-v-d335cb2c"><view wx:if="{{d}}" class="image-preview-area data-v-d335cb2c"><view class="image-preview-list data-v-d335cb2c"><view wx:for="{{e}}" wx:for-item="image" wx:key="d" class="image-preview-item data-v-d335cb2c"><image src="{{image.a}}" mode="aspectFill" class="preview-image data-v-d335cb2c"/><view class="remove-image data-v-d335cb2c" bindtap="{{image.c}}"><uni-icons wx:if="{{f}}" class="data-v-d335cb2c" u-i="{{image.b}}" bind:__l="__l" u-p="{{f}}"/></view></view><view wx:if="{{g}}" class="image-preview-item add-more-button data-v-d335cb2c" bindtap="{{i}}"><uni-icons wx:if="{{h}}" class="data-v-d335cb2c" u-i="d335cb2c-1" bind:__l="__l" u-p="{{h}}"/><text class="add-more-text data-v-d335cb2c">添加图片</text></view></view></view><view class="input-container data-v-d335cb2c"><input class="message-input data-v-d335cb2c" placeholder="请输入您的问题..." confirm-type="{{'send'}}" bindfocus="{{j}}" bindblur="{{k}}" bindconfirm="{{l}}" value="{{m}}" bindinput="{{n}}"/><view wx:if="{{o}}" class="upload-button data-v-d335cb2c" bindtap="{{q}}"><uni-icons wx:if="{{p}}" class="data-v-d335cb2c" u-i="d335cb2c-2" bind:__l="__l" u-p="{{p}}"/></view><view wx:if="{{r}}" class="send-button data-v-d335cb2c" bindtap="{{t}}"><uni-icons wx:if="{{s}}" class="data-v-d335cb2c" u-i="d335cb2c-3" bind:__l="__l" u-p="{{s}}"/></view><view wx:if="{{v}}" class="send-button disabled data-v-d335cb2c"><uni-icons wx:if="{{w}}" class="data-v-d335cb2c" u-i="d335cb2c-4" bind:__l="__l" u-p="{{w}}"/></view></view></view></view>
|
||||||
1
dist/build/mp-weixin/pages/ai/chat.wxss
vendored
Normal file
1
dist/build/mp-weixin/pages/ai/chat.wxss
vendored
Normal file
File diff suppressed because one or more lines are too long
1
dist/build/mp-weixin/static/svg/copy.svg
vendored
Normal file
1
dist/build/mp-weixin/static/svg/copy.svg
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1774320583868" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="22494" xmlns:xlink="http://www.w3.org/1999/xlink" width="64" height="64"><path d="M768 682.666667V170.666667a85.333333 85.333333 0 0 0-85.333333-85.333334H170.666667a85.333333 85.333333 0 0 0-85.333334 85.333334v512a85.333333 85.333333 0 0 0 85.333334 85.333333h512a85.333333 85.333333 0 0 0 85.333333-85.333333zM170.666667 170.666667h512v512H170.666667z m682.666666 85.333333v512a85.333333 85.333333 0 0 1-85.333333 85.333333H256a85.333333 85.333333 0 0 0 85.333333 85.333334h426.666667a170.666667 170.666667 0 0 0 170.666667-170.666667V341.333333a85.333333 85.333333 0 0 0-85.333334-85.333333z" p-id="22495"></path></svg>
|
||||||
|
After Width: | Height: | Size: 873 B |
2
dist/dev/mp-weixin/app.js
vendored
2
dist/dev/mp-weixin/app.js
vendored
@ -14,7 +14,7 @@ if (!Math) {
|
|||||||
"./pages/transfer/index.js";
|
"./pages/transfer/index.js";
|
||||||
"./pages/forward/index.js";
|
"./pages/forward/index.js";
|
||||||
"./pages/me/index.js";
|
"./pages/me/index.js";
|
||||||
"./pages/ai/index.js";
|
"./pages/ai/chat.js";
|
||||||
"./pages/web_view/index.js";
|
"./pages/web_view/index.js";
|
||||||
"./WORKORDER/list/index.js";
|
"./WORKORDER/list/index.js";
|
||||||
"./WORKORDER/add/index.js";
|
"./WORKORDER/add/index.js";
|
||||||
|
|||||||
2
dist/dev/mp-weixin/app.json
vendored
2
dist/dev/mp-weixin/app.json
vendored
@ -5,7 +5,7 @@
|
|||||||
"pages/transfer/index",
|
"pages/transfer/index",
|
||||||
"pages/forward/index",
|
"pages/forward/index",
|
||||||
"pages/me/index",
|
"pages/me/index",
|
||||||
"pages/ai/index",
|
"pages/ai/chat",
|
||||||
"pages/web_view/index"
|
"pages/web_view/index"
|
||||||
],
|
],
|
||||||
"subPackages": [
|
"subPackages": [
|
||||||
|
|||||||
@ -3,7 +3,7 @@ const common_vendor = require("../vendor.js");
|
|||||||
const common_store_useWeAppAuthStore = require("../store/useWeAppAuthStore.js");
|
const common_store_useWeAppAuthStore = require("../store/useWeAppAuthStore.js");
|
||||||
const http = new common_vendor.Request();
|
const http = new common_vendor.Request();
|
||||||
http.setConfig((config) => {
|
http.setConfig((config) => {
|
||||||
config.baseURL = "http://10.39.13.78:8001/api/";
|
config.baseURL = "http://10.39.13.78:8002/api/";
|
||||||
config.header = {
|
config.header = {
|
||||||
...config.header
|
...config.header
|
||||||
};
|
};
|
||||||
|
|||||||
4
dist/dev/mp-weixin/common/vendor.js
vendored
4
dist/dev/mp-weixin/common/vendor.js
vendored
@ -11045,6 +11045,7 @@ const onLoad = /* @__PURE__ */ createHook(ON_LOAD);
|
|||||||
const onUnload = /* @__PURE__ */ createHook(ON_UNLOAD);
|
const onUnload = /* @__PURE__ */ createHook(ON_UNLOAD);
|
||||||
const onPageScroll = /* @__PURE__ */ createHook(ON_PAGE_SCROLL);
|
const onPageScroll = /* @__PURE__ */ createHook(ON_PAGE_SCROLL);
|
||||||
const onReachBottom = /* @__PURE__ */ createHook(ON_REACH_BOTTOM);
|
const onReachBottom = /* @__PURE__ */ createHook(ON_REACH_BOTTOM);
|
||||||
|
const onPullDownRefresh = /* @__PURE__ */ createHook(ON_PULL_DOWN_REFRESH);
|
||||||
const onShareTimeline = /* @__PURE__ */ createHook(ON_SHARE_TIMELINE);
|
const onShareTimeline = /* @__PURE__ */ createHook(ON_SHARE_TIMELINE);
|
||||||
const onShareAppMessage = /* @__PURE__ */ createHook(ON_SHARE_APP_MESSAGE);
|
const onShareAppMessage = /* @__PURE__ */ createHook(ON_SHARE_APP_MESSAGE);
|
||||||
var toString = Object.prototype.toString;
|
var toString = Object.prototype.toString;
|
||||||
@ -14669,17 +14670,20 @@ exports.isRef = isRef;
|
|||||||
exports.mixin = mixin;
|
exports.mixin = mixin;
|
||||||
exports.mpMixin = mpMixin;
|
exports.mpMixin = mpMixin;
|
||||||
exports.n = n;
|
exports.n = n;
|
||||||
|
exports.nextTick$1 = nextTick$1;
|
||||||
exports.o = o;
|
exports.o = o;
|
||||||
exports.onHide = onHide;
|
exports.onHide = onHide;
|
||||||
exports.onLaunch = onLaunch;
|
exports.onLaunch = onLaunch;
|
||||||
exports.onLoad = onLoad;
|
exports.onLoad = onLoad;
|
||||||
exports.onMounted = onMounted;
|
exports.onMounted = onMounted;
|
||||||
exports.onPageScroll = onPageScroll;
|
exports.onPageScroll = onPageScroll;
|
||||||
|
exports.onPullDownRefresh = onPullDownRefresh;
|
||||||
exports.onReachBottom = onReachBottom;
|
exports.onReachBottom = onReachBottom;
|
||||||
exports.onShareAppMessage = onShareAppMessage;
|
exports.onShareAppMessage = onShareAppMessage;
|
||||||
exports.onShareTimeline = onShareTimeline;
|
exports.onShareTimeline = onShareTimeline;
|
||||||
exports.onShow = onShow;
|
exports.onShow = onShow;
|
||||||
exports.onUnload = onUnload;
|
exports.onUnload = onUnload;
|
||||||
|
exports.onUnmounted = onUnmounted;
|
||||||
exports.openType = openType;
|
exports.openType = openType;
|
||||||
exports.p = p;
|
exports.p = p;
|
||||||
exports.props = props$k;
|
exports.props = props$k;
|
||||||
|
|||||||
926
dist/dev/mp-weixin/pages/ai/chat.js
vendored
Normal file
926
dist/dev/mp-weixin/pages/ai/chat.js
vendored
Normal file
@ -0,0 +1,926 @@
|
|||||||
|
"use strict";
|
||||||
|
const common_vendor = require("../../common/vendor.js");
|
||||||
|
require("../../common/libraries/request.js");
|
||||||
|
const common_store_useWeAppAuthStore = require("../../common/store/useWeAppAuthStore.js");
|
||||||
|
require("../../common/store/useWorkStore.js");
|
||||||
|
const common_libraries_upload = require("../../common/libraries/upload.js");
|
||||||
|
require("../../gen/Apis.js");
|
||||||
|
require("../../common/libraries/setTabBar.js");
|
||||||
|
require("../../common/libraries/apiLoading.js");
|
||||||
|
if (!Array) {
|
||||||
|
const _easycom_uni_icons2 = common_vendor.resolveComponent("uni-icons");
|
||||||
|
_easycom_uni_icons2();
|
||||||
|
}
|
||||||
|
const _easycom_uni_icons = () => "../../uni_modules/uni-icons/components/uni-icons/uni-icons.js";
|
||||||
|
if (!Math) {
|
||||||
|
_easycom_uni_icons();
|
||||||
|
}
|
||||||
|
const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
|
||||||
|
__name: "chat",
|
||||||
|
setup(__props) {
|
||||||
|
common_vendor.dayjs.extend(common_vendor.relativeTime);
|
||||||
|
common_vendor.dayjs.locale("zh-cn");
|
||||||
|
const auth = common_store_useWeAppAuthStore.useWeAppAuthStore();
|
||||||
|
const inputMessage = common_vendor.ref("");
|
||||||
|
const selectedImages = common_vendor.ref([]);
|
||||||
|
const isInputFocused = common_vendor.ref(false);
|
||||||
|
const messages = common_vendor.ref([
|
||||||
|
{
|
||||||
|
role: "ai",
|
||||||
|
content: "您好!我是物业客服,有什么可以帮助您的吗?",
|
||||||
|
quickQuestions: []
|
||||||
|
}
|
||||||
|
]);
|
||||||
|
const loading = common_vendor.ref(false);
|
||||||
|
const loadingText = common_vendor.ref("正在输入中...");
|
||||||
|
let socketTask = null;
|
||||||
|
let isConnected = common_vendor.ref(false);
|
||||||
|
const API_BASE_URL = "https://kf-api-test.linyikj.com.cn";
|
||||||
|
const WS_BASE_URL = "wss://kf-api-test.linyikj.com.cn";
|
||||||
|
const currentPage = common_vendor.ref(1);
|
||||||
|
const pageSize = common_vendor.ref(10);
|
||||||
|
const hasMore = common_vendor.ref(true);
|
||||||
|
const isLoadingHistory = common_vendor.ref(false);
|
||||||
|
const conversationId = common_vendor.ref("");
|
||||||
|
const currentOffset = common_vendor.ref(0);
|
||||||
|
const quickQuestionsData = common_vendor.ref([]);
|
||||||
|
const lastMessageContent = common_vendor.ref("");
|
||||||
|
const getQuickQuestions = async () => {
|
||||||
|
try {
|
||||||
|
const response = await common_vendor.index.request({
|
||||||
|
url: `${API_BASE_URL}/api/public/quick-questions`,
|
||||||
|
method: "GET"
|
||||||
|
});
|
||||||
|
if (response.statusCode === 200) {
|
||||||
|
const result = response.data;
|
||||||
|
let quickQuestions = [];
|
||||||
|
if (result.data && Array.isArray(result.data)) {
|
||||||
|
quickQuestions = result.data.map(
|
||||||
|
(item) => item.question || item.title || item.text || item
|
||||||
|
);
|
||||||
|
} else if (result.questions && Array.isArray(result.questions)) {
|
||||||
|
quickQuestions = result.questions.map(
|
||||||
|
(item) => item.question || item.title || item.text || item
|
||||||
|
);
|
||||||
|
} else if (Array.isArray(result)) {
|
||||||
|
quickQuestions = result.map((item) => item.question || item.title || item.text || item);
|
||||||
|
}
|
||||||
|
console.log("获取到开场白按钮数据:", quickQuestions);
|
||||||
|
return quickQuestions;
|
||||||
|
} else {
|
||||||
|
console.error("获取开场白数据失败,状态码:", response.statusCode);
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error("获取开场白数据异常:", error);
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
};
|
||||||
|
const formatMessageContent = (content) => {
|
||||||
|
if (!content || typeof content !== "string") {
|
||||||
|
return [""];
|
||||||
|
}
|
||||||
|
return content.split("\n").filter((line) => line.trim() !== "");
|
||||||
|
};
|
||||||
|
const previewImage = (currentImage, images) => {
|
||||||
|
common_vendor.index.previewImage({
|
||||||
|
current: currentImage,
|
||||||
|
urls: images
|
||||||
|
});
|
||||||
|
};
|
||||||
|
const copyMessage = (content) => {
|
||||||
|
if (!content) {
|
||||||
|
common_vendor.index.showToast({
|
||||||
|
title: "暂无内容可复制",
|
||||||
|
icon: "none"
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
common_vendor.index.setClipboardData({
|
||||||
|
data: content,
|
||||||
|
success: () => {
|
||||||
|
common_vendor.index.showToast({
|
||||||
|
title: "复制成功",
|
||||||
|
icon: "success"
|
||||||
|
});
|
||||||
|
},
|
||||||
|
fail: () => {
|
||||||
|
common_vendor.index.showToast({
|
||||||
|
title: "复制失败",
|
||||||
|
icon: "none"
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
const formatTime = (timeStr) => {
|
||||||
|
if (!timeStr)
|
||||||
|
return "";
|
||||||
|
try {
|
||||||
|
const date = common_vendor.dayjs(timeStr);
|
||||||
|
if (!date.isValid()) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
return date.fromNow();
|
||||||
|
} catch (e) {
|
||||||
|
console.error("时间格式化错误:", e);
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
};
|
||||||
|
const scrollToBottom = () => {
|
||||||
|
common_vendor.nextTick$1(() => {
|
||||||
|
common_vendor.index.pageScrollTo({
|
||||||
|
scrollTop: 999999,
|
||||||
|
duration: 300
|
||||||
|
});
|
||||||
|
});
|
||||||
|
};
|
||||||
|
const getHistoryMessages = async (page = 1) => {
|
||||||
|
var _a, _b;
|
||||||
|
const userPhone = (_b = (_a = auth.data) == null ? void 0 : _a.user) == null ? void 0 : _b.phone;
|
||||||
|
if (!userPhone) {
|
||||||
|
console.log("用户未登录,无法获取历史记录");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (isLoadingHistory.value) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
isLoadingHistory.value = true;
|
||||||
|
const offset = (page - 1) * pageSize.value;
|
||||||
|
currentOffset.value = offset;
|
||||||
|
console.log("分页信息 - 页码:", page, "每页数量:", pageSize.value, "计算出的offset:", offset);
|
||||||
|
const response = await common_vendor.index.request({
|
||||||
|
url: `${API_BASE_URL}/api/public/customer/init`,
|
||||||
|
method: "POST",
|
||||||
|
data: {
|
||||||
|
platform: "property",
|
||||||
|
platform_user_id: userPhone,
|
||||||
|
//userPhone
|
||||||
|
limit: pageSize.value,
|
||||||
|
offset
|
||||||
|
}
|
||||||
|
});
|
||||||
|
if (response.statusCode === 200) {
|
||||||
|
const result = response.data;
|
||||||
|
let historyMessages = [];
|
||||||
|
if (result.conversation && result.conversation.id) {
|
||||||
|
conversationId.value = result.conversation.id;
|
||||||
|
console.log("获取到会话ID:", conversationId.value);
|
||||||
|
} else if (result.conversation_id) {
|
||||||
|
conversationId.value = result.conversation_id;
|
||||||
|
console.log("获取到会话ID:", conversationId.value);
|
||||||
|
} else if (result.conversations && result.conversations.id) {
|
||||||
|
conversationId.value = result.conversations.id;
|
||||||
|
console.log("获取到会话ID:", conversationId.value);
|
||||||
|
}
|
||||||
|
if (result.messages && Array.isArray(result.messages)) {
|
||||||
|
historyMessages = result.messages.map((item) => {
|
||||||
|
const message = {
|
||||||
|
role: item.sender_type === "customer" ? "user" : "ai",
|
||||||
|
content: item.message || item.content || "",
|
||||||
|
created_at: item.created_at || item.timestamp || new Date().toISOString()
|
||||||
|
};
|
||||||
|
if (item.message_type) {
|
||||||
|
message.message_type = item.message_type;
|
||||||
|
}
|
||||||
|
let imageUrlData = null;
|
||||||
|
if (item.image_url && Array.isArray(item.image_url)) {
|
||||||
|
imageUrlData = item.image_url;
|
||||||
|
} else if (item.images && Array.isArray(item.images)) {
|
||||||
|
imageUrlData = item.images;
|
||||||
|
} else if (item.metadata && item.metadata.image_url && Array.isArray(item.metadata.image_url)) {
|
||||||
|
imageUrlData = item.metadata.image_url;
|
||||||
|
}
|
||||||
|
if (imageUrlData) {
|
||||||
|
message.image_url = imageUrlData;
|
||||||
|
message.images = imageUrlData;
|
||||||
|
}
|
||||||
|
if (item.metadata) {
|
||||||
|
message.metadata = item.metadata;
|
||||||
|
}
|
||||||
|
return message;
|
||||||
|
});
|
||||||
|
console.log("从messages字段获取到历史记录:", historyMessages.length);
|
||||||
|
} else if (result.data && Array.isArray(result.data)) {
|
||||||
|
historyMessages = result.data.map((item) => {
|
||||||
|
const message = {
|
||||||
|
role: item.sender_type === "customer" ? "user" : "ai",
|
||||||
|
content: item.message || item.content || "",
|
||||||
|
created_at: item.created_at || item.timestamp || new Date().toISOString()
|
||||||
|
};
|
||||||
|
if (item.message_type) {
|
||||||
|
message.message_type = item.message_type;
|
||||||
|
}
|
||||||
|
let imageUrlData = null;
|
||||||
|
if (item.image_url && Array.isArray(item.image_url)) {
|
||||||
|
imageUrlData = item.image_url;
|
||||||
|
} else if (item.images && Array.isArray(item.images)) {
|
||||||
|
imageUrlData = item.images;
|
||||||
|
} else if (item.metadata && item.metadata.image_url && Array.isArray(item.metadata.image_url)) {
|
||||||
|
imageUrlData = item.metadata.image_url;
|
||||||
|
}
|
||||||
|
if (imageUrlData) {
|
||||||
|
message.image_url = imageUrlData;
|
||||||
|
message.images = imageUrlData;
|
||||||
|
}
|
||||||
|
if (item.metadata) {
|
||||||
|
message.metadata = item.metadata;
|
||||||
|
}
|
||||||
|
return message;
|
||||||
|
});
|
||||||
|
console.log("从data字段获取到历史记录:", historyMessages.length);
|
||||||
|
} else if (result.list && Array.isArray(result.list)) {
|
||||||
|
historyMessages = result.list.map((item) => {
|
||||||
|
const message = {
|
||||||
|
role: item.sender_type === "customer" ? "user" : "ai",
|
||||||
|
content: item.message || item.content || "",
|
||||||
|
created_at: item.created_at || item.timestamp || new Date().toISOString()
|
||||||
|
};
|
||||||
|
if (item.message_type) {
|
||||||
|
message.message_type = item.message_type;
|
||||||
|
}
|
||||||
|
let imageUrlData = null;
|
||||||
|
if (item.image_url && Array.isArray(item.image_url)) {
|
||||||
|
imageUrlData = item.image_url;
|
||||||
|
} else if (item.images && Array.isArray(item.images)) {
|
||||||
|
imageUrlData = item.images;
|
||||||
|
} else if (item.metadata && item.metadata.image_url && Array.isArray(item.metadata.image_url)) {
|
||||||
|
imageUrlData = item.metadata.image_url;
|
||||||
|
}
|
||||||
|
if (imageUrlData) {
|
||||||
|
message.image_url = imageUrlData;
|
||||||
|
message.images = imageUrlData;
|
||||||
|
}
|
||||||
|
if (item.metadata) {
|
||||||
|
message.metadata = item.metadata;
|
||||||
|
}
|
||||||
|
return message;
|
||||||
|
});
|
||||||
|
console.log("从list字段获取到历史记录:", historyMessages.length);
|
||||||
|
}
|
||||||
|
if (page === 1) {
|
||||||
|
if (historyMessages.length > 0) {
|
||||||
|
messages.value = historyMessages;
|
||||||
|
console.log("第一页历史记录已加载,总共", historyMessages.length, "条消息");
|
||||||
|
} else {
|
||||||
|
console.log("没有历史记录");
|
||||||
|
messages.value = [];
|
||||||
|
}
|
||||||
|
const isFirstPageLastPage = !hasMore.value;
|
||||||
|
if (checkShouldShowQuickQuestions(isFirstPageLastPage)) {
|
||||||
|
addQuickQuestionsToFirstAIMessage(isFirstPageLastPage);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (historyMessages.length > 0) {
|
||||||
|
setTimeout(() => {
|
||||||
|
messages.value.unshift(...historyMessages);
|
||||||
|
console.log(
|
||||||
|
"加载更多历史记录,新增",
|
||||||
|
historyMessages.length,
|
||||||
|
"条消息,总共",
|
||||||
|
messages.value.length,
|
||||||
|
"条"
|
||||||
|
);
|
||||||
|
}, 300);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const totalItems = result.total || result.count || result.total_count || 0;
|
||||||
|
hasMore.value = totalItems > messages.value.length;
|
||||||
|
currentPage.value = page;
|
||||||
|
if (page > 1 && !hasMore.value) {
|
||||||
|
console.log("分页加载完成,当前页:", page, "hasMore:", hasMore.value, "展示开场白");
|
||||||
|
setTimeout(() => {
|
||||||
|
addQuickQuestionsToFirstAIMessage(true);
|
||||||
|
}, 500);
|
||||||
|
}
|
||||||
|
console.log(
|
||||||
|
"第",
|
||||||
|
page,
|
||||||
|
"页数据加载完成,offset:",
|
||||||
|
offset,
|
||||||
|
", limit:",
|
||||||
|
pageSize.value,
|
||||||
|
", 总数据:",
|
||||||
|
totalItems,
|
||||||
|
", 当前已加载:",
|
||||||
|
messages.value.length,
|
||||||
|
", 是否有更多:",
|
||||||
|
hasMore.value
|
||||||
|
);
|
||||||
|
if (page === 1) {
|
||||||
|
setTimeout(() => {
|
||||||
|
scrollToBottom();
|
||||||
|
}, 100);
|
||||||
|
console.log("[Customer] 历史记录加载完成,开始建立WebSocket连接");
|
||||||
|
initWebSocket();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
console.error("获取历史记录失败,状态码:", response.statusCode);
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error("获取历史记录异常:", error);
|
||||||
|
} finally {
|
||||||
|
isLoadingHistory.value = false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
common_vendor.onPullDownRefresh(async () => {
|
||||||
|
if (isLoadingHistory.value || !hasMore.value) {
|
||||||
|
console.log("正在加载或没有更多数据");
|
||||||
|
common_vendor.index.stopPullDownRefresh();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
console.log("触发下拉分页,加载更多历史记录");
|
||||||
|
const nextPage = currentPage.value + 1;
|
||||||
|
try {
|
||||||
|
await getHistoryMessages(nextPage);
|
||||||
|
await new Promise((resolve) => setTimeout(resolve, 500));
|
||||||
|
} catch (error) {
|
||||||
|
console.error("加载历史记录失败:", error);
|
||||||
|
} finally {
|
||||||
|
common_vendor.index.stopPullDownRefresh();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
const initWebSocket = () => {
|
||||||
|
if (socketTask) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
const wsUrl = `${WS_BASE_URL}/ws/socket.io/?EIO=4&transport=websocket`;
|
||||||
|
console.log("正在建立Socket.IO连接");
|
||||||
|
console.log("连接URL:", wsUrl);
|
||||||
|
socketTask = common_vendor.index.connectSocket({
|
||||||
|
url: wsUrl,
|
||||||
|
header: {
|
||||||
|
"content-type": "application/json"
|
||||||
|
}
|
||||||
|
});
|
||||||
|
common_vendor.index.onSocketOpen((res) => {
|
||||||
|
console.log("[Customer] WebSocket connected", res);
|
||||||
|
isConnected.value = true;
|
||||||
|
const connectPacket = '40/customer,{"jwt":""}';
|
||||||
|
common_vendor.index.sendSocketMessage({
|
||||||
|
data: connectPacket,
|
||||||
|
success: () => {
|
||||||
|
console.log("[Customer] Socket.IO连接包发送成功");
|
||||||
|
if (conversationId.value) {
|
||||||
|
setTimeout(() => {
|
||||||
|
const joinMessage = `42/customer,["join_conversation",{"conversation_id":"${conversationId.value}"}]`;
|
||||||
|
console.log("[Customer] 加入会话房间:", joinMessage);
|
||||||
|
common_vendor.index.sendSocketMessage({
|
||||||
|
data: joinMessage,
|
||||||
|
success: () => {
|
||||||
|
console.log("[Customer] 成功加入会话房间");
|
||||||
|
},
|
||||||
|
fail: (error) => {
|
||||||
|
console.error("[Customer] 加入会话房间失败:", error);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}, 200);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
fail: (error) => {
|
||||||
|
console.error("[Customer] Socket.IO连接包发送失败:", error);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
common_vendor.index.onSocketError((error) => {
|
||||||
|
console.error("[Customer] WebSocket error:", error);
|
||||||
|
isConnected.value = false;
|
||||||
|
socketTask = null;
|
||||||
|
});
|
||||||
|
common_vendor.index.onSocketClose((res) => {
|
||||||
|
console.log("[Customer] WebSocket disconnected", res);
|
||||||
|
isConnected.value = false;
|
||||||
|
socketTask = null;
|
||||||
|
});
|
||||||
|
common_vendor.index.onSocketMessage((res) => {
|
||||||
|
console.log("收到WebSocket原始消息:", res);
|
||||||
|
console.log("消息数据类型:", typeof res.data);
|
||||||
|
console.log("消息内容:", res.data);
|
||||||
|
const data = res.data;
|
||||||
|
if (typeof data === "string") {
|
||||||
|
if (data.startsWith("42/customer,")) {
|
||||||
|
const payload = data.substring("42/customer,".length);
|
||||||
|
try {
|
||||||
|
const parsedData = JSON.parse(payload);
|
||||||
|
console.log("解析Socket.IO事件:", parsedData);
|
||||||
|
handleSocketEvent(parsedData);
|
||||||
|
} catch (e) {
|
||||||
|
console.error("解析Socket.IO数据失败:", e, "原始数据:", payload);
|
||||||
|
}
|
||||||
|
} else if (data.startsWith("40/customer")) {
|
||||||
|
console.log("Socket.IO连接确认");
|
||||||
|
} else if (data.startsWith("2")) {
|
||||||
|
common_vendor.index.sendSocketMessage({
|
||||||
|
data: "3"
|
||||||
|
});
|
||||||
|
} else if (data.startsWith("0")) {
|
||||||
|
console.log("Socket.IO握手成功");
|
||||||
|
} else {
|
||||||
|
try {
|
||||||
|
const jsonData = JSON.parse(data);
|
||||||
|
console.log("解析JSON消息:", jsonData);
|
||||||
|
handleJsonMessage(jsonData);
|
||||||
|
} catch (e) {
|
||||||
|
console.log("非JSON格式的字符串消息:", data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (typeof data === "object") {
|
||||||
|
console.log("收到对象类型消息:", data);
|
||||||
|
handleObjectMessage(data);
|
||||||
|
} else {
|
||||||
|
console.log("收到其他类型消息,类型:", typeof data);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} catch (error) {
|
||||||
|
console.error("初始化Socket.IO异常:", error);
|
||||||
|
isConnected.value = false;
|
||||||
|
socketTask = null;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
const handleSocketEvent = (parsedData) => {
|
||||||
|
if (Array.isArray(parsedData) && parsedData.length >= 2) {
|
||||||
|
const eventType = parsedData[0];
|
||||||
|
const eventData = parsedData[1];
|
||||||
|
console.log("[Customer] Socket.IO事件类型:", eventType, "事件数据:", eventData);
|
||||||
|
if (eventType === "new_message") {
|
||||||
|
processMessage(eventData);
|
||||||
|
} else if (eventType === "join_conversation_response") {
|
||||||
|
console.log("[Customer] Joined room:", eventData);
|
||||||
|
} else if (eventType === "message") {
|
||||||
|
processMessage(eventData);
|
||||||
|
} else if (eventType === "typing") {
|
||||||
|
processTypingIndicator(eventData);
|
||||||
|
} else {
|
||||||
|
console.log("[Customer] 未处理的Socket.IO事件类型:", eventType);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
const handleJsonMessage = (jsonData) => {
|
||||||
|
console.log("[Customer] 处理JSON消息:", jsonData);
|
||||||
|
if (jsonData.type === "message" || jsonData.event === "new_message") {
|
||||||
|
processMessage(jsonData.data || jsonData);
|
||||||
|
} else if (jsonData.type === "typing" || jsonData.event === "typing") {
|
||||||
|
processTypingIndicator(jsonData.data || jsonData);
|
||||||
|
} else if (jsonData.message || jsonData.content) {
|
||||||
|
processMessage(jsonData);
|
||||||
|
} else {
|
||||||
|
console.log("[Customer] 未识别的JSON消息结构:", jsonData);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
const handleObjectMessage = (objData) => {
|
||||||
|
console.log("[Customer] 处理对象消息:", objData);
|
||||||
|
if (objData.message || objData.content || objData.text) {
|
||||||
|
processMessage(objData);
|
||||||
|
} else if (objData.is_typing !== void 0) {
|
||||||
|
processTypingIndicator(objData);
|
||||||
|
} else {
|
||||||
|
console.log("[Customer] 未识别的对象消息结构:", objData);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
const processTypingIndicator = (typingData) => {
|
||||||
|
console.log("[Customer] 处理typing指示器:", typingData);
|
||||||
|
if (typingData.is_typing && typingData.user_type === "staff") {
|
||||||
|
loading.value = true;
|
||||||
|
loadingText.value = "客服正在输入...";
|
||||||
|
} else {
|
||||||
|
loading.value = false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
const checkShouldShowQuickQuestions = (isLastPage = false) => {
|
||||||
|
if (quickQuestionsData.value.length === 0) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (messages.value.length === 0) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (isLastPage && messages.value.length > 0) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
const addQuickQuestionsToFirstAIMessage = (isLastPage = false) => {
|
||||||
|
if (quickQuestionsData.value.length === 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!checkShouldShowQuickQuestions(isLastPage)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const existingWelcomeMessage = messages.value.find(
|
||||||
|
(msg) => msg.role === "ai" && msg.quickQuestions && msg.quickQuestions.length > 0
|
||||||
|
);
|
||||||
|
if (existingWelcomeMessage) {
|
||||||
|
console.log("[Customer] 开场白已存在,跳过添加");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const welcomeMessage = {
|
||||||
|
role: "ai",
|
||||||
|
content: "您好!我是物业客服,有什么可以帮助您的吗?",
|
||||||
|
quickQuestions: quickQuestionsData.value,
|
||||||
|
created_at: new Date().toISOString()
|
||||||
|
};
|
||||||
|
console.log("[Customer] 创建开场白消息,是否最后一页:", isLastPage);
|
||||||
|
if (messages.value.length === 0) {
|
||||||
|
messages.value = [welcomeMessage];
|
||||||
|
console.log("[Customer] 设置开场白为第一条消息");
|
||||||
|
} else if (isLastPage) {
|
||||||
|
messages.value.unshift(welcomeMessage);
|
||||||
|
console.log("[Customer] 已加载到最后一页,在第一条消息前面插入开场白");
|
||||||
|
}
|
||||||
|
};
|
||||||
|
const processMessage = (messageData) => {
|
||||||
|
console.log("[Customer] 处理消息数据:", messageData);
|
||||||
|
if (messageData.sender_type === "customer" || messageData.role === "user") {
|
||||||
|
console.log("[Customer] 过滤掉客户消息");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
let messageContent = "";
|
||||||
|
if (typeof messageData === "string") {
|
||||||
|
messageContent = messageData;
|
||||||
|
} else {
|
||||||
|
messageContent = messageData.message || messageData.content || messageData.text || messageData.body || "收到回复";
|
||||||
|
}
|
||||||
|
if (typeof messageContent === "string") {
|
||||||
|
messageContent = messageContent.replace(/↵/g, "\n").replace(/\\n/g, "\n");
|
||||||
|
}
|
||||||
|
console.log("[Customer] 收到新消息内容:", messageContent);
|
||||||
|
if (messageContent === lastMessageContent.value) {
|
||||||
|
console.log("[Customer] 消息与HTTP返回的消息相同,跳过显示");
|
||||||
|
lastMessageContent.value = "";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
loading.value = false;
|
||||||
|
const newMessage = {
|
||||||
|
role: "ai",
|
||||||
|
content: messageContent,
|
||||||
|
created_at: messageData.created_at || messageData.timestamp || messageData.time || new Date().toISOString()
|
||||||
|
};
|
||||||
|
if (messageData.suggested_questions && Array.isArray(messageData.suggested_questions) && messageData.suggested_questions.length > 0) {
|
||||||
|
newMessage.quickQuestions = messageData.suggested_questions;
|
||||||
|
} else if (messageData.quickQuestions && Array.isArray(messageData.quickQuestions) && messageData.quickQuestions.length > 0) {
|
||||||
|
newMessage.quickQuestions = messageData.quickQuestions;
|
||||||
|
}
|
||||||
|
if (messageData.need_confirmation !== void 0) {
|
||||||
|
newMessage.needConfirmation = messageData.need_confirmation;
|
||||||
|
}
|
||||||
|
if (messageData.confirmation_type !== void 0) {
|
||||||
|
newMessage.confirmationType = messageData.confirmation_type;
|
||||||
|
}
|
||||||
|
messages.value.push(newMessage);
|
||||||
|
scrollToBottom();
|
||||||
|
};
|
||||||
|
const handleQuickQuestion = (question) => {
|
||||||
|
inputMessage.value = question;
|
||||||
|
handleSendMessage();
|
||||||
|
};
|
||||||
|
const handleConfirmation = (message, confirmation) => {
|
||||||
|
if (message.selectedConfirmation !== void 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
message.selectedConfirmation = confirmation;
|
||||||
|
setTimeout(() => {
|
||||||
|
inputMessage.value = confirmation;
|
||||||
|
handleSendMessage();
|
||||||
|
}, 300);
|
||||||
|
};
|
||||||
|
const chooseImage = async () => {
|
||||||
|
const maxImages = 9;
|
||||||
|
if (selectedImages.value.length >= maxImages) {
|
||||||
|
common_vendor.index.showToast({
|
||||||
|
title: "最多选择9张图片",
|
||||||
|
icon: "none"
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
const remainingCount = maxImages - selectedImages.value.length;
|
||||||
|
const uploadResult = await common_libraries_upload.upload(remainingCount, 2, ["image"]);
|
||||||
|
if (uploadResult && Array.isArray(uploadResult) && uploadResult.length > 0) {
|
||||||
|
const imageUrls = uploadResult.map((item) => item.url);
|
||||||
|
selectedImages.value.push(...imageUrls);
|
||||||
|
common_vendor.index.showToast({
|
||||||
|
title: "图片上传成功",
|
||||||
|
icon: "success"
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error("选择图片失败:", error);
|
||||||
|
common_vendor.index.showToast({
|
||||||
|
title: "选择图片失败",
|
||||||
|
icon: "none"
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
const removeImage = (index) => {
|
||||||
|
selectedImages.value.splice(index, 1);
|
||||||
|
};
|
||||||
|
const handleSendMessage = async () => {
|
||||||
|
var _a, _b, _c, _d, _e, _f;
|
||||||
|
const message = inputMessage.value.trim();
|
||||||
|
const hasImages = selectedImages.value.length > 0;
|
||||||
|
if (!message && !hasImages || loading.value)
|
||||||
|
return;
|
||||||
|
const userPhone = (_b = (_a = auth.data) == null ? void 0 : _a.user) == null ? void 0 : _b.phone;
|
||||||
|
const projectId = (_d = (_c = auth.data) == null ? void 0 : _c.selected_house) == null ? void 0 : _d.asset_projects_id;
|
||||||
|
const projectName = (_f = (_e = auth.data) == null ? void 0 : _e.selected_house) == null ? void 0 : _f.full_name;
|
||||||
|
if (!userPhone || !projectId) {
|
||||||
|
common_vendor.index.showToast({
|
||||||
|
title: "请先登录并绑定房屋",
|
||||||
|
icon: "none"
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!isConnected.value) {
|
||||||
|
initWebSocket();
|
||||||
|
await new Promise((resolve) => setTimeout(resolve, 1e3));
|
||||||
|
}
|
||||||
|
const uploadedImages = selectedImages.value;
|
||||||
|
let messageType = "text";
|
||||||
|
if (hasImages && message) {
|
||||||
|
messageType = "mixed";
|
||||||
|
} else if (hasImages && !message) {
|
||||||
|
messageType = "image";
|
||||||
|
}
|
||||||
|
const userMessage = {
|
||||||
|
role: "user",
|
||||||
|
content: message || "",
|
||||||
|
// 纯图片时传空字符串
|
||||||
|
created_at: new Date().toISOString(),
|
||||||
|
message_type: messageType,
|
||||||
|
image_url: uploadedImages.length > 0 ? uploadedImages : void 0,
|
||||||
|
images: uploadedImages.length > 0 ? uploadedImages : void 0
|
||||||
|
};
|
||||||
|
messages.value.push(userMessage);
|
||||||
|
inputMessage.value = "";
|
||||||
|
selectedImages.value = [];
|
||||||
|
scrollToBottom();
|
||||||
|
if (message && message.includes("查询")) {
|
||||||
|
loadingText.value = "正在查询中请稍后...";
|
||||||
|
} else {
|
||||||
|
loadingText.value = "正在输入中...";
|
||||||
|
}
|
||||||
|
loading.value = true;
|
||||||
|
try {
|
||||||
|
const response = await common_vendor.index.request({
|
||||||
|
url: `${API_BASE_URL}/api/public/chat`,
|
||||||
|
method: "POST",
|
||||||
|
data: {
|
||||||
|
platform: "property",
|
||||||
|
message: message || "",
|
||||||
|
// 纯图片时传空字符串
|
||||||
|
tenant_project_id: projectId,
|
||||||
|
tenant_project_name: projectName || "",
|
||||||
|
platform_user_id: userPhone,
|
||||||
|
conversation_id: conversationId.value,
|
||||||
|
message_type: messageType,
|
||||||
|
image_url: uploadedImages.length > 0 ? uploadedImages : void 0
|
||||||
|
},
|
||||||
|
header: {
|
||||||
|
"Content-Type": "application/json"
|
||||||
|
}
|
||||||
|
});
|
||||||
|
if (response.statusCode === 200) {
|
||||||
|
const result = response.data;
|
||||||
|
console.log("[Customer] HTTP接口响应数据:", result);
|
||||||
|
let httpReplyMessage = null;
|
||||||
|
let suggestedQuestions = [];
|
||||||
|
let needConfirmation = false;
|
||||||
|
let confirmationType = null;
|
||||||
|
if (result.reply && typeof result.reply === "string") {
|
||||||
|
httpReplyMessage = result.reply;
|
||||||
|
suggestedQuestions = result.suggested_questions || [];
|
||||||
|
needConfirmation = result.need_confirmation || false;
|
||||||
|
confirmationType = result.confirmation_type || null;
|
||||||
|
} else if (result.reply && result.reply.message) {
|
||||||
|
httpReplyMessage = result.reply.message;
|
||||||
|
suggestedQuestions = result.reply.suggested_questions || result.suggested_questions || [];
|
||||||
|
needConfirmation = result.reply.need_confirmation || result.need_confirmation || false;
|
||||||
|
confirmationType = result.reply.confirmation_type || result.confirmation_type || null;
|
||||||
|
} else if (result.reply && result.reply.content) {
|
||||||
|
httpReplyMessage = result.reply.content;
|
||||||
|
suggestedQuestions = result.reply.suggested_questions || result.suggested_questions || [];
|
||||||
|
needConfirmation = result.reply.need_confirmation || result.need_confirmation || false;
|
||||||
|
confirmationType = result.reply.confirmation_type || result.confirmation_type || null;
|
||||||
|
} else if (result.message) {
|
||||||
|
httpReplyMessage = result.message;
|
||||||
|
suggestedQuestions = result.suggested_questions || [];
|
||||||
|
needConfirmation = result.need_confirmation || false;
|
||||||
|
confirmationType = result.confirmation_type || null;
|
||||||
|
} else if (result.content) {
|
||||||
|
httpReplyMessage = result.content;
|
||||||
|
suggestedQuestions = result.suggested_questions || [];
|
||||||
|
needConfirmation = result.need_confirmation || false;
|
||||||
|
confirmationType = result.confirmation_type || null;
|
||||||
|
} else if (result.answer) {
|
||||||
|
httpReplyMessage = result.answer;
|
||||||
|
suggestedQuestions = result.suggested_questions || [];
|
||||||
|
needConfirmation = result.need_confirmation || false;
|
||||||
|
confirmationType = result.confirmation_type || null;
|
||||||
|
} else if (result.response) {
|
||||||
|
httpReplyMessage = result.response;
|
||||||
|
suggestedQuestions = result.suggested_questions || [];
|
||||||
|
needConfirmation = result.need_confirmation || false;
|
||||||
|
confirmationType = result.confirmation_type || null;
|
||||||
|
} else if (typeof result === "string") {
|
||||||
|
httpReplyMessage = result;
|
||||||
|
}
|
||||||
|
if (httpReplyMessage) {
|
||||||
|
console.log("[Customer] HTTP接口返回回答消息:", httpReplyMessage);
|
||||||
|
console.log("[Customer] 建议问题:", suggestedQuestions);
|
||||||
|
console.log("[Customer] 需要确认:", needConfirmation, "确认类型:", confirmationType);
|
||||||
|
let formattedMessage = httpReplyMessage;
|
||||||
|
if (typeof formattedMessage === "string") {
|
||||||
|
formattedMessage = formattedMessage.replace(/↵/g, "\n").replace(/\\n/g, "\n");
|
||||||
|
}
|
||||||
|
lastMessageContent.value = formattedMessage;
|
||||||
|
loading.value = false;
|
||||||
|
messages.value.push({
|
||||||
|
role: "ai",
|
||||||
|
content: formattedMessage,
|
||||||
|
created_at: new Date().toISOString(),
|
||||||
|
quickQuestions: suggestedQuestions.length > 0 ? suggestedQuestions : void 0,
|
||||||
|
needConfirmation,
|
||||||
|
confirmationType
|
||||||
|
});
|
||||||
|
scrollToBottom();
|
||||||
|
} else {
|
||||||
|
console.log("[Customer] 消息发送成功,等待WebSocket回复");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
throw new Error("请求失败");
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error("发送消息失败:", error);
|
||||||
|
common_vendor.index.showToast({
|
||||||
|
title: "发送失败,请稍后重试",
|
||||||
|
icon: "none"
|
||||||
|
});
|
||||||
|
messages.value.push({
|
||||||
|
role: "ai",
|
||||||
|
content: "抱歉,网络连接出现问题,请稍后再试。"
|
||||||
|
});
|
||||||
|
loading.value = false;
|
||||||
|
scrollToBottom();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
common_vendor.onUnmounted(() => {
|
||||||
|
if (socketTask || isConnected.value) {
|
||||||
|
common_vendor.index.closeSocket();
|
||||||
|
socketTask = null;
|
||||||
|
isConnected.value = false;
|
||||||
|
console.log("页面卸载,WebSocket连接已关闭");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
common_vendor.onLoad(async () => {
|
||||||
|
quickQuestionsData.value = await getQuickQuestions();
|
||||||
|
console.log("页面加载时已获取开场白按钮数据:", quickQuestionsData.value.length);
|
||||||
|
getHistoryMessages(1);
|
||||||
|
});
|
||||||
|
return (_ctx, _cache) => {
|
||||||
|
return common_vendor.e({
|
||||||
|
a: common_vendor.f(messages.value, (message, index, i0) => {
|
||||||
|
return common_vendor.e({
|
||||||
|
a: message.role === "ai"
|
||||||
|
}, message.role === "ai" ? {} : {}, {
|
||||||
|
b: message.image_url && message.image_url.length > 0
|
||||||
|
}, message.image_url && message.image_url.length > 0 ? {
|
||||||
|
c: common_vendor.f(message.image_url, (image, imgIndex, i1) => {
|
||||||
|
return {
|
||||||
|
a: image,
|
||||||
|
b: common_vendor.o(($event) => previewImage(image, message.image_url), imgIndex),
|
||||||
|
c: imgIndex
|
||||||
|
};
|
||||||
|
}),
|
||||||
|
d: message.image_url.length === 1 ? "widthFix" : "aspectFill",
|
||||||
|
e: message.image_url.length === 1 ? 1 : ""
|
||||||
|
} : message.images && message.images.length > 0 ? {
|
||||||
|
g: common_vendor.f(message.images, (image, imgIndex, i1) => {
|
||||||
|
return {
|
||||||
|
a: image,
|
||||||
|
b: common_vendor.o(($event) => previewImage(image, message.images), imgIndex),
|
||||||
|
c: imgIndex
|
||||||
|
};
|
||||||
|
}),
|
||||||
|
h: message.images.length === 1 ? "widthFix" : "aspectFill",
|
||||||
|
i: message.images.length === 1 ? 1 : ""
|
||||||
|
} : message.metadata && message.metadata.image_url && message.metadata.image_url.length > 0 ? {
|
||||||
|
k: common_vendor.f(message.metadata.image_url, (image, imgIndex, i1) => {
|
||||||
|
return {
|
||||||
|
a: image,
|
||||||
|
b: common_vendor.o(($event) => previewImage(image, message.metadata.image_url), imgIndex),
|
||||||
|
c: imgIndex
|
||||||
|
};
|
||||||
|
}),
|
||||||
|
l: message.metadata.image_url.length === 1 ? "widthFix" : "aspectFill",
|
||||||
|
m: message.metadata.image_url.length === 1 ? 1 : ""
|
||||||
|
} : {}, {
|
||||||
|
f: message.images && message.images.length > 0,
|
||||||
|
j: message.metadata && message.metadata.image_url && message.metadata.image_url.length > 0,
|
||||||
|
n: message.content && message.content.trim()
|
||||||
|
}, message.content && message.content.trim() ? {
|
||||||
|
o: common_vendor.f(formatMessageContent(message.content), (line, lineIndex, i1) => {
|
||||||
|
return {
|
||||||
|
a: common_vendor.t(line),
|
||||||
|
b: "text-" + lineIndex
|
||||||
|
};
|
||||||
|
})
|
||||||
|
} : {}, {
|
||||||
|
p: message.quickQuestions && message.quickQuestions.length > 0
|
||||||
|
}, message.quickQuestions && message.quickQuestions.length > 0 ? {
|
||||||
|
q: common_vendor.f(message.quickQuestions, (question, qIndex, i1) => {
|
||||||
|
return {
|
||||||
|
a: common_vendor.t(question),
|
||||||
|
b: qIndex,
|
||||||
|
c: common_vendor.o(($event) => handleQuickQuestion(question), qIndex)
|
||||||
|
};
|
||||||
|
})
|
||||||
|
} : {}, {
|
||||||
|
r: message.needConfirmation
|
||||||
|
}, message.needConfirmation ? {
|
||||||
|
s: message.selectedConfirmation === "是" ? 1 : "",
|
||||||
|
t: message.selectedConfirmation !== void 0 ? 1 : "",
|
||||||
|
v: common_vendor.o(($event) => handleConfirmation(message, "是"), index),
|
||||||
|
w: message.selectedConfirmation === "否" ? 1 : "",
|
||||||
|
x: message.selectedConfirmation !== void 0 ? 1 : "",
|
||||||
|
y: common_vendor.o(($event) => handleConfirmation(message, "否"), index)
|
||||||
|
} : {}, {
|
||||||
|
z: message.created_at && !message.quickQuestions
|
||||||
|
}, message.created_at && !message.quickQuestions ? common_vendor.e({
|
||||||
|
A: message.role === "ai"
|
||||||
|
}, message.role === "ai" ? {
|
||||||
|
B: common_vendor.o(($event) => copyMessage(message.content), index)
|
||||||
|
} : {}, {
|
||||||
|
C: common_vendor.t(formatTime(message.created_at)),
|
||||||
|
D: message.role === "user"
|
||||||
|
}, message.role === "user" ? {
|
||||||
|
E: common_vendor.o(($event) => copyMessage(message.content), index)
|
||||||
|
} : {}) : {}, {
|
||||||
|
F: index,
|
||||||
|
G: `msg-${index}`,
|
||||||
|
H: common_vendor.n(message.role === "user" ? "user-message" : "ai-message")
|
||||||
|
});
|
||||||
|
}),
|
||||||
|
b: loading.value
|
||||||
|
}, loading.value ? {
|
||||||
|
c: common_vendor.t(loadingText.value)
|
||||||
|
} : {}, {
|
||||||
|
d: selectedImages.value.length > 0
|
||||||
|
}, selectedImages.value.length > 0 ? common_vendor.e({
|
||||||
|
e: common_vendor.f(selectedImages.value, (image, index, i0) => {
|
||||||
|
return {
|
||||||
|
a: image,
|
||||||
|
b: "b15798f7-0-" + i0,
|
||||||
|
c: common_vendor.o(($event) => removeImage(index), index),
|
||||||
|
d: index
|
||||||
|
};
|
||||||
|
}),
|
||||||
|
f: common_vendor.p({
|
||||||
|
type: "closeempty",
|
||||||
|
size: "14",
|
||||||
|
color: "#fff"
|
||||||
|
}),
|
||||||
|
g: selectedImages.value.length < 9
|
||||||
|
}, selectedImages.value.length < 9 ? {
|
||||||
|
h: common_vendor.p({
|
||||||
|
type: "plus",
|
||||||
|
size: "30",
|
||||||
|
color: "#999"
|
||||||
|
}),
|
||||||
|
i: common_vendor.o(chooseImage)
|
||||||
|
} : {}) : {}, {
|
||||||
|
j: common_vendor.o(($event) => isInputFocused.value = true),
|
||||||
|
k: common_vendor.o(($event) => isInputFocused.value = false),
|
||||||
|
l: common_vendor.o(handleSendMessage),
|
||||||
|
m: inputMessage.value,
|
||||||
|
n: common_vendor.o(($event) => inputMessage.value = $event.detail.value),
|
||||||
|
o: !inputMessage.value.trim() && !isInputFocused.value && selectedImages.value.length === 0
|
||||||
|
}, !inputMessage.value.trim() && !isInputFocused.value && selectedImages.value.length === 0 ? {
|
||||||
|
p: common_vendor.p({
|
||||||
|
type: "camera",
|
||||||
|
size: "24",
|
||||||
|
color: "#666"
|
||||||
|
}),
|
||||||
|
q: common_vendor.o(chooseImage)
|
||||||
|
} : {}, {
|
||||||
|
r: (inputMessage.value.trim() || isInputFocused.value || selectedImages.value.length > 0) && !loading.value
|
||||||
|
}, (inputMessage.value.trim() || isInputFocused.value || selectedImages.value.length > 0) && !loading.value ? {
|
||||||
|
s: common_vendor.p({
|
||||||
|
type: "paperplane-filled",
|
||||||
|
size: "20",
|
||||||
|
color: "#fff"
|
||||||
|
}),
|
||||||
|
t: common_vendor.o(handleSendMessage)
|
||||||
|
} : {}, {
|
||||||
|
v: loading.value
|
||||||
|
}, loading.value ? {
|
||||||
|
w: common_vendor.p({
|
||||||
|
type: "spinner-cycle",
|
||||||
|
size: "20",
|
||||||
|
color: "#ccc"
|
||||||
|
})
|
||||||
|
} : {});
|
||||||
|
};
|
||||||
|
}
|
||||||
|
});
|
||||||
|
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-b15798f7"], ["__file", "/Users/zsq/Sources/github/2025property-pay/pay-customer/src/pages/ai/chat.vue"]]);
|
||||||
|
wx.createPage(MiniProgramPage);
|
||||||
6
dist/dev/mp-weixin/pages/ai/chat.json
vendored
Normal file
6
dist/dev/mp-weixin/pages/ai/chat.json
vendored
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"navigationBarTitleText": "客服服务",
|
||||||
|
"usingComponents": {
|
||||||
|
"uni-icons": "../../uni_modules/uni-icons/components/uni-icons/uni-icons"
|
||||||
|
}
|
||||||
|
}
|
||||||
1
dist/dev/mp-weixin/pages/ai/chat.wxml
vendored
Normal file
1
dist/dev/mp-weixin/pages/ai/chat.wxml
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
<view class="chat-container data-v-b15798f7"><view class="chat-messages data-v-b15798f7"><view wx:for="{{a}}" wx:for-item="message" wx:key="F" id="{{message.G}}" class="{{['message-item', 'data-v-b15798f7', message.H]}}"><view wx:if="{{message.a}}" class="message-avatar data-v-b15798f7"><image class="data-v-b15798f7" src="/static/svg/ai_icon.svg" mode="aspectFit"/></view><view class="message-content-wrapper data-v-b15798f7"><view class="message-content data-v-b15798f7"><view wx:if="{{message.b}}" class="message-images data-v-b15798f7"><view wx:for="{{message.c}}" wx:for-item="image" wx:key="c" class="{{['message-image-item', 'data-v-b15798f7', message.e && 'single-image']}}"><image src="{{image.a}}" mode="{{message.d}}" class="message-image data-v-b15798f7" bindtap="{{image.b}}"/></view></view><view wx:elif="{{message.f}}" class="message-images data-v-b15798f7"><view wx:for="{{message.g}}" wx:for-item="image" wx:key="c" class="{{['message-image-item', 'data-v-b15798f7', message.i && 'single-image']}}"><image src="{{image.a}}" mode="{{message.h}}" class="message-image data-v-b15798f7" bindtap="{{image.b}}"/></view></view><view wx:elif="{{message.j}}" class="message-images data-v-b15798f7"><view wx:for="{{message.k}}" wx:for-item="image" wx:key="c" class="{{['message-image-item', 'data-v-b15798f7', message.m && 'single-image']}}"><image src="{{image.a}}" mode="{{message.l}}" class="message-image data-v-b15798f7" bindtap="{{image.b}}"/></view></view><block wx:if="{{message.n}}"><view wx:for="{{message.o}}" wx:for-item="line" wx:key="b" class="message-text-line data-v-b15798f7"><text class="data-v-b15798f7">{{line.a}}</text></view></block></view><view wx:if="{{message.p}}" class="quick-questions data-v-b15798f7"><view wx:for="{{message.q}}" wx:for-item="question" wx:key="b" class="question-btn data-v-b15798f7" bindtap="{{question.c}}"><text class="data-v-b15798f7">{{question.a}}</text></view></view><view wx:if="{{message.r}}" class="confirmation-buttons data-v-b15798f7"><view class="{{['confirmation-btn', 'data-v-b15798f7', message.s && 'selected', message.t && 'disabled']}}" bindtap="{{message.v}}"><text class="data-v-b15798f7">是</text></view><view class="{{['confirmation-btn', 'data-v-b15798f7', message.w && 'selected', message.x && 'disabled']}}" bindtap="{{message.y}}"><text class="data-v-b15798f7">否</text></view></view><view wx:if="{{message.z}}" class="message-meta data-v-b15798f7"><view wx:if="{{message.A}}" class="copy-button data-v-b15798f7" bindtap="{{message.B}}"><image src="/static/svg/copy.svg" mode="aspectFit" class="copy-icon data-v-b15798f7"/></view><text class="message-time data-v-b15798f7">{{message.C}}</text><view wx:if="{{message.D}}" class="copy-button data-v-b15798f7" bindtap="{{message.E}}"><image src="/static/svg/copy.svg" mode="aspectFit" class="copy-icon data-v-b15798f7"/></view></view></view></view><view wx:if="{{b}}" class="message-item ai-message data-v-b15798f7"><view class="message-avatar data-v-b15798f7"><image class="data-v-b15798f7" src="/static/svg/ai_icon.svg" mode="aspectFit"/></view><view class="message-content loading data-v-b15798f7"><text class="data-v-b15798f7">{{c}}</text></view></view></view><view class="chat-input-area data-v-b15798f7"><view wx:if="{{d}}" class="image-preview-area data-v-b15798f7"><view class="image-preview-list data-v-b15798f7"><view wx:for="{{e}}" wx:for-item="image" wx:key="d" class="image-preview-item data-v-b15798f7"><image src="{{image.a}}" mode="aspectFill" class="preview-image data-v-b15798f7"/><view class="remove-image data-v-b15798f7" bindtap="{{image.c}}"><uni-icons wx:if="{{f}}" class="data-v-b15798f7" u-i="{{image.b}}" bind:__l="__l" u-p="{{f}}"/></view></view><view wx:if="{{g}}" class="image-preview-item add-more-button data-v-b15798f7" bindtap="{{i}}"><uni-icons wx:if="{{h}}" class="data-v-b15798f7" u-i="b15798f7-1" bind:__l="__l" u-p="{{h}}"/><text class="add-more-text data-v-b15798f7">添加图片</text></view></view></view><view class="input-container data-v-b15798f7"><input class="message-input data-v-b15798f7" placeholder="请输入您的问题..." confirm-type="{{'send'}}" bindfocus="{{j}}" bindblur="{{k}}" bindconfirm="{{l}}" value="{{m}}" bindinput="{{n}}"/><view wx:if="{{o}}" class="upload-button data-v-b15798f7" bindtap="{{q}}"><uni-icons wx:if="{{p}}" class="data-v-b15798f7" u-i="b15798f7-2" bind:__l="__l" u-p="{{p}}"/></view><view wx:if="{{r}}" class="send-button data-v-b15798f7" bindtap="{{t}}"><uni-icons wx:if="{{s}}" class="data-v-b15798f7" u-i="b15798f7-3" bind:__l="__l" u-p="{{s}}"/></view><view wx:if="{{v}}" class="send-button disabled data-v-b15798f7"><uni-icons wx:if="{{w}}" class="data-v-b15798f7" u-i="b15798f7-4" bind:__l="__l" u-p="{{w}}"/></view></view></view></view>
|
||||||
375
dist/dev/mp-weixin/pages/ai/chat.wxss
vendored
Normal file
375
dist/dev/mp-weixin/pages/ai/chat.wxss
vendored
Normal file
@ -0,0 +1,375 @@
|
|||||||
|
.chat-container.data-v-b15798f7 {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
min-height: 100vh;
|
||||||
|
width: 100vw;
|
||||||
|
background-color: #f5f5f5;
|
||||||
|
}
|
||||||
|
.chat-messages.data-v-b15798f7 {
|
||||||
|
width: 100%;
|
||||||
|
padding: 30rpx 20rpx;
|
||||||
|
padding-bottom: calc(200rpx + env(safe-area-inset-bottom));
|
||||||
|
box-sizing: border-box;
|
||||||
|
flex: 1;
|
||||||
|
}
|
||||||
|
.message-item.data-v-b15798f7 {
|
||||||
|
display: flex;
|
||||||
|
width: 100%;
|
||||||
|
box-sizing: border-box;
|
||||||
|
margin-bottom: 30rpx;
|
||||||
|
animation: fadeIn-b15798f7 0.3s ease-in;
|
||||||
|
}
|
||||||
|
.message-item.user-message.data-v-b15798f7 {
|
||||||
|
justify-content: flex-end;
|
||||||
|
align-items: flex-start;
|
||||||
|
}
|
||||||
|
.message-item.user-message .message-content-wrapper.data-v-b15798f7 {
|
||||||
|
align-items: flex-end;
|
||||||
|
}
|
||||||
|
.message-item.user-message .message-content.data-v-b15798f7 {
|
||||||
|
background-color: #1c64f2;
|
||||||
|
color: #fff;
|
||||||
|
margin-right: 0;
|
||||||
|
flex-shrink: 0;
|
||||||
|
}
|
||||||
|
.message-item.user-message .message-content .message-images.data-v-b15798f7 {
|
||||||
|
margin-bottom: 0;
|
||||||
|
}
|
||||||
|
.message-item.user-message .message-content .message-images .message-image-item.data-v-b15798f7 {
|
||||||
|
border-radius: 8rpx;
|
||||||
|
}
|
||||||
|
.message-item.user-message .message-time.data-v-b15798f7 {
|
||||||
|
color: #999;
|
||||||
|
font-size: 22rpx;
|
||||||
|
margin-top: 6rpx;
|
||||||
|
text-align: right;
|
||||||
|
min-width: 80rpx;
|
||||||
|
}
|
||||||
|
.message-item.user-message .message-meta.data-v-b15798f7 {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: flex-end;
|
||||||
|
margin-top: 6rpx;
|
||||||
|
gap: 8rpx;
|
||||||
|
flex-direction: row;
|
||||||
|
}
|
||||||
|
.message-item.ai-message.data-v-b15798f7 {
|
||||||
|
align-items: flex-start;
|
||||||
|
}
|
||||||
|
.message-item.ai-message .message-content-wrapper.data-v-b15798f7 {
|
||||||
|
align-items: flex-start;
|
||||||
|
}
|
||||||
|
.message-item.ai-message .message-content.data-v-b15798f7 {
|
||||||
|
background-color: #fff;
|
||||||
|
color: #333;
|
||||||
|
margin-left: 12rpx;
|
||||||
|
margin-right: 0;
|
||||||
|
flex-shrink: 0;
|
||||||
|
}
|
||||||
|
.message-item.ai-message .message-time.data-v-b15798f7 {
|
||||||
|
color: #999;
|
||||||
|
font-size: 22rpx;
|
||||||
|
min-width: 80rpx;
|
||||||
|
}
|
||||||
|
.message-item.ai-message .message-meta.data-v-b15798f7 {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: flex-start;
|
||||||
|
margin-top: 6rpx;
|
||||||
|
gap: 8rpx;
|
||||||
|
margin-left: 12rpx;
|
||||||
|
flex-direction: row;
|
||||||
|
}
|
||||||
|
.message-item.ai-message .message-avatar.data-v-b15798f7 {
|
||||||
|
margin-right: 0;
|
||||||
|
flex-shrink: 0;
|
||||||
|
}
|
||||||
|
@keyframes fadeIn-b15798f7 {
|
||||||
|
from {
|
||||||
|
opacity: 0;
|
||||||
|
transform: translateY(10rpx);
|
||||||
|
}
|
||||||
|
to {
|
||||||
|
opacity: 1;
|
||||||
|
transform: translateY(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.message-avatar.data-v-b15798f7 {
|
||||||
|
width: 60rpx;
|
||||||
|
height: 60rpx;
|
||||||
|
border-radius: 50%;
|
||||||
|
overflow: hidden;
|
||||||
|
flex-shrink: 0;
|
||||||
|
}
|
||||||
|
.message-avatar image.data-v-b15798f7 {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
.message-avatar .user-avatar-image.data-v-b15798f7 {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
border-radius: 50%;
|
||||||
|
}
|
||||||
|
.message-avatar .user-avatar.data-v-b15798f7 {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
color: #fff;
|
||||||
|
font-size: 24rpx;
|
||||||
|
font-weight: 500;
|
||||||
|
}
|
||||||
|
.message-content-wrapper.data-v-b15798f7 {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
max-width: calc(100vw - 100rpx);
|
||||||
|
}
|
||||||
|
.message-content.data-v-b15798f7 {
|
||||||
|
padding: 20rpx 24rpx;
|
||||||
|
border-radius: 16rpx;
|
||||||
|
font-size: 28rpx;
|
||||||
|
line-height: 1.5;
|
||||||
|
word-wrap: break-word;
|
||||||
|
word-break: break-all;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
.message-content.loading.data-v-b15798f7 {
|
||||||
|
opacity: 0.7;
|
||||||
|
}
|
||||||
|
.message-content.data-v-b15798f7:has(.message-images) {
|
||||||
|
padding: 12rpx;
|
||||||
|
}
|
||||||
|
.user-message .message-content.data-v-b15798f7:has(.message-images) {
|
||||||
|
padding: 8rpx;
|
||||||
|
background-color: transparent;
|
||||||
|
}
|
||||||
|
.message-content view.data-v-b15798f7 {
|
||||||
|
display: block;
|
||||||
|
width: 100%;
|
||||||
|
word-wrap: break-word;
|
||||||
|
word-break: break-all;
|
||||||
|
}
|
||||||
|
.message-content view.data-v-b15798f7:not(:last-child) {
|
||||||
|
margin-bottom: 8rpx;
|
||||||
|
}
|
||||||
|
.message-content text.data-v-b15798f7 {
|
||||||
|
display: inline;
|
||||||
|
word-wrap: break-word;
|
||||||
|
word-break: break-all;
|
||||||
|
}
|
||||||
|
.quick-questions.data-v-b15798f7 {
|
||||||
|
margin-top: 16rpx;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 12rpx;
|
||||||
|
padding-left: 12rpx;
|
||||||
|
}
|
||||||
|
.question-btn.data-v-b15798f7 {
|
||||||
|
background-color: #f0f7ff;
|
||||||
|
border: 1px solid #d0e3ff;
|
||||||
|
border-radius: 12rpx;
|
||||||
|
padding: 16rpx 20rpx;
|
||||||
|
font-size: 26rpx;
|
||||||
|
color: #1c64f2;
|
||||||
|
line-height: 1.4;
|
||||||
|
transition: all 0.2s ease;
|
||||||
|
}
|
||||||
|
.question-btn.data-v-b15798f7:active {
|
||||||
|
background-color: #e6f2ff;
|
||||||
|
transform: scale(0.98);
|
||||||
|
}
|
||||||
|
.question-btn text.data-v-b15798f7 {
|
||||||
|
display: block;
|
||||||
|
word-wrap: break-word;
|
||||||
|
word-break: break-all;
|
||||||
|
}
|
||||||
|
.confirmation-buttons.data-v-b15798f7 {
|
||||||
|
margin-top: 16rpx;
|
||||||
|
display: flex;
|
||||||
|
gap: 16rpx;
|
||||||
|
justify-content: flex-start;
|
||||||
|
padding-left: 12rpx;
|
||||||
|
}
|
||||||
|
.confirmation-btn.data-v-b15798f7 {
|
||||||
|
width: 38rpx;
|
||||||
|
border-radius: 12rpx;
|
||||||
|
padding: 16rpx 32rpx;
|
||||||
|
font-size: 28rpx;
|
||||||
|
line-height: 1.4;
|
||||||
|
text-align: center;
|
||||||
|
transition: all 0.2s ease;
|
||||||
|
background-color: #fff;
|
||||||
|
color: #000;
|
||||||
|
border: 1px solid #e5e5e5;
|
||||||
|
}
|
||||||
|
.confirmation-btn.data-v-b15798f7:active:not(.disabled) {
|
||||||
|
transform: scale(0.98);
|
||||||
|
}
|
||||||
|
.confirmation-btn.selected.data-v-b15798f7 {
|
||||||
|
background-color: #1c64f2;
|
||||||
|
color: #fff;
|
||||||
|
border-color: #1c64f2;
|
||||||
|
}
|
||||||
|
.confirmation-btn.disabled.data-v-b15798f7 {
|
||||||
|
opacity: 0.6;
|
||||||
|
cursor: not-allowed;
|
||||||
|
}
|
||||||
|
.confirmation-btn text.data-v-b15798f7 {
|
||||||
|
display: block;
|
||||||
|
font-weight: 500;
|
||||||
|
}
|
||||||
|
.chat-input-area.data-v-b15798f7 {
|
||||||
|
position: fixed;
|
||||||
|
bottom: 0;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
background-color: #fff;
|
||||||
|
border-top: 1px solid #e5e5e5;
|
||||||
|
padding: 20rpx 20rpx;
|
||||||
|
padding-bottom: calc(20rpx + env(safe-area-inset-bottom));
|
||||||
|
z-index: 100;
|
||||||
|
}
|
||||||
|
.input-container.data-v-b15798f7 {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
background-color: #f5f5f5;
|
||||||
|
border-radius: 50rpx;
|
||||||
|
padding: 10rpx 20rpx;
|
||||||
|
}
|
||||||
|
.message-input.data-v-b15798f7 {
|
||||||
|
flex: 1;
|
||||||
|
height: 70rpx;
|
||||||
|
font-size: 28rpx;
|
||||||
|
padding: 0 20rpx;
|
||||||
|
background-color: transparent;
|
||||||
|
}
|
||||||
|
.send-button.data-v-b15798f7 {
|
||||||
|
width: 70rpx;
|
||||||
|
height: 70rpx;
|
||||||
|
background: linear-gradient(135deg, #1c64f2 0%, #0e4aa7 100%);
|
||||||
|
border-radius: 50%;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
margin-left: 20rpx;
|
||||||
|
}
|
||||||
|
.send-button.disabled.data-v-b15798f7 {
|
||||||
|
opacity: 0.5;
|
||||||
|
pointer-events: none;
|
||||||
|
}
|
||||||
|
.upload-button.data-v-b15798f7 {
|
||||||
|
width: 70rpx;
|
||||||
|
height: 70rpx;
|
||||||
|
background-color: #f5f5f5;
|
||||||
|
border-radius: 50%;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
margin-left: 20rpx;
|
||||||
|
}
|
||||||
|
.image-preview-area.data-v-b15798f7 {
|
||||||
|
margin-bottom: 20rpx;
|
||||||
|
padding: 0 20rpx;
|
||||||
|
}
|
||||||
|
.image-preview-list.data-v-b15798f7 {
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
gap: 16rpx;
|
||||||
|
}
|
||||||
|
.image-preview-item.data-v-b15798f7 {
|
||||||
|
position: relative;
|
||||||
|
width: 120rpx;
|
||||||
|
height: 120rpx;
|
||||||
|
border-radius: 12rpx;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
.image-preview-item.add-more-button.data-v-b15798f7 {
|
||||||
|
background-color: #f5f5f5;
|
||||||
|
border: 2rpx dashed #ddd;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
.image-preview-item.add-more-button.data-v-b15798f7:active {
|
||||||
|
background-color: #e8e8e8;
|
||||||
|
}
|
||||||
|
.preview-image.data-v-b15798f7 {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
.add-more-text.data-v-b15798f7 {
|
||||||
|
font-size: 22rpx;
|
||||||
|
color: #999;
|
||||||
|
margin-top: 8rpx;
|
||||||
|
}
|
||||||
|
.remove-image.data-v-b15798f7 {
|
||||||
|
position: absolute;
|
||||||
|
top: 8rpx;
|
||||||
|
right: 8rpx;
|
||||||
|
width: 40rpx;
|
||||||
|
height: 40rpx;
|
||||||
|
background-color: rgba(0, 0, 0, 0.6);
|
||||||
|
border-radius: 50%;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
.message-images.data-v-b15798f7 {
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
gap: 12rpx;
|
||||||
|
margin-bottom: 12rpx;
|
||||||
|
max-width: 500rpx;
|
||||||
|
}
|
||||||
|
.user-message .message-images.data-v-b15798f7 {
|
||||||
|
margin-bottom: 0;
|
||||||
|
}
|
||||||
|
.message-image-item.data-v-b15798f7 {
|
||||||
|
border-radius: 12rpx;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
.message-image-item.single-image.data-v-b15798f7 {
|
||||||
|
max-width: 500rpx;
|
||||||
|
width: 500rpx !important;
|
||||||
|
height: auto !important;
|
||||||
|
}
|
||||||
|
.user-message .message-image-item.single-image.data-v-b15798f7 {
|
||||||
|
max-width: 450rpx;
|
||||||
|
width: 450rpx !important;
|
||||||
|
}
|
||||||
|
.message-image-item.data-v-b15798f7:not(.single-image) {
|
||||||
|
width: 200rpx;
|
||||||
|
height: 200rpx;
|
||||||
|
}
|
||||||
|
.message-image.data-v-b15798f7 {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
.message-text-line.data-v-b15798f7 {
|
||||||
|
margin-bottom: 4rpx;
|
||||||
|
}
|
||||||
|
.message-text-line.data-v-b15798f7:last-child {
|
||||||
|
margin-bottom: 0;
|
||||||
|
}
|
||||||
|
.copy-button.data-v-b15798f7 {
|
||||||
|
width: 32rpx;
|
||||||
|
height: 32rpx;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
border-radius: 4rpx;
|
||||||
|
transition: background-color 0.2s ease;
|
||||||
|
}
|
||||||
|
.copy-button.data-v-b15798f7:active {
|
||||||
|
background-color: rgba(0, 0, 0, 0.05);
|
||||||
|
}
|
||||||
|
.copy-button .copy-icon.data-v-b15798f7 {
|
||||||
|
width: 26rpx;
|
||||||
|
height: 26rpx;
|
||||||
|
opacity: 0.7;
|
||||||
|
}
|
||||||
27
dist/dev/mp-weixin/pages/ai/index.js
vendored
27
dist/dev/mp-weixin/pages/ai/index.js
vendored
@ -1,27 +0,0 @@
|
|||||||
"use strict";
|
|
||||||
const common_vendor = require("../../common/vendor.js");
|
|
||||||
require("../../common/libraries/request.js");
|
|
||||||
require("../../common/store/useWeAppAuthStore.js");
|
|
||||||
require("../../common/store/useWorkStore.js");
|
|
||||||
require("../../gen/Apis.js");
|
|
||||||
require("../../common/libraries/setTabBar.js");
|
|
||||||
require("../../common/libraries/apiLoading.js");
|
|
||||||
const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
|
|
||||||
__name: "index",
|
|
||||||
setup(__props) {
|
|
||||||
common_vendor.onShow(async (e) => {
|
|
||||||
const curPages = getCurrentPages()[0];
|
|
||||||
if (typeof curPages.getTabBar === "function" && curPages.getTabBar()) {
|
|
||||||
curPages.getTabBar().setData({
|
|
||||||
selected: 1
|
|
||||||
// 表示当前菜单的索引,该值在不同的页面表示不同
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return (_ctx, _cache) => {
|
|
||||||
return {};
|
|
||||||
};
|
|
||||||
}
|
|
||||||
});
|
|
||||||
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__file", "/Users/zsq/Sources/github/2025property-pay/pay-customer/src/pages/ai/index.vue"]]);
|
|
||||||
wx.createPage(MiniProgramPage);
|
|
||||||
4
dist/dev/mp-weixin/pages/ai/index.json
vendored
4
dist/dev/mp-weixin/pages/ai/index.json
vendored
@ -1,4 +0,0 @@
|
|||||||
{
|
|
||||||
"navigationBarTitleText": "智能管家",
|
|
||||||
"usingComponents": {}
|
|
||||||
}
|
|
||||||
1
dist/dev/mp-weixin/pages/ai/index.wxml
vendored
1
dist/dev/mp-weixin/pages/ai/index.wxml
vendored
@ -1 +0,0 @@
|
|||||||
<web-view src="http://10.39.13.99/chat/mVJwj0fNMlJHsXme" style="width:100%;height:100%;min-height:700px"></web-view>
|
|
||||||
26
dist/dev/mp-weixin/pages/ai/index.wxss
vendored
26
dist/dev/mp-weixin/pages/ai/index.wxss
vendored
@ -1,26 +0,0 @@
|
|||||||
#dify-chatbot-bubble-button {
|
|
||||||
background-color: #1c64f2 !important;
|
|
||||||
}
|
|
||||||
#dify-chatbot-bubble-window {
|
|
||||||
width: 24rem !important;
|
|
||||||
height: 40rem !important;
|
|
||||||
}
|
|
||||||
page {
|
|
||||||
background-color: #f8f8f8;
|
|
||||||
}
|
|
||||||
.contact_btn {
|
|
||||||
border: none !important;
|
|
||||||
background-color: transparent;
|
|
||||||
padding: 0;
|
|
||||||
line-height: 1;
|
|
||||||
color: inherit;
|
|
||||||
font-size: inherit;
|
|
||||||
display: inline-flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
outline: none;
|
|
||||||
box-shadow: none;
|
|
||||||
}
|
|
||||||
button:after {
|
|
||||||
border: none !important;
|
|
||||||
}
|
|
||||||
@ -1,6 +1,5 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
const common_vendor = require("../../../common/vendor.js");
|
const common_vendor = require("../../../common/vendor.js");
|
||||||
const common_libraries_naviHelper = require("../../../common/libraries/naviHelper.js");
|
|
||||||
require("../../../common/libraries/getPageConfig.js");
|
require("../../../common/libraries/getPageConfig.js");
|
||||||
require("../../../common/store/useWeAppAuthStore.js");
|
require("../../../common/store/useWeAppAuthStore.js");
|
||||||
require("../../../gen/Apis.js");
|
require("../../../gen/Apis.js");
|
||||||
@ -20,16 +19,18 @@ const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
|
|||||||
__name: "AiInput",
|
__name: "AiInput",
|
||||||
setup(__props) {
|
setup(__props) {
|
||||||
const handleInputChange = () => {
|
const handleInputChange = () => {
|
||||||
common_libraries_naviHelper.showToast("该功能在当前项目暂未开放,敬请期待!");
|
common_vendor.index.navigateTo({
|
||||||
|
url: "/pages/ai/chat"
|
||||||
|
});
|
||||||
};
|
};
|
||||||
return (_ctx, _cache) => {
|
return (_ctx, _cache) => {
|
||||||
return {
|
return {
|
||||||
a: common_vendor.o(handleInputChange),
|
a: common_vendor.p({
|
||||||
b: common_vendor.p({
|
|
||||||
type: "arrow-right",
|
type: "arrow-right",
|
||||||
size: "20",
|
size: "20",
|
||||||
color: "#666"
|
color: "#666"
|
||||||
})
|
}),
|
||||||
|
b: common_vendor.o(handleInputChange)
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1 +1 @@
|
|||||||
<view class="ai_contents data-v-b68fefb8"><view class="ai_contents_center data-v-b68fefb8"><view class="ai_contents_header data-v-b68fefb8"><image class="data-v-b68fefb8" src="/static/svg/ai_icon.svg" mode="heightFix"/><text class="data-v-b68fefb8">HI,遇到什么问题了,可以问我哦~ </text></view><button class="data-v-b68fefb8" open-type="contact"><view class="ai_contents_input data-v-b68fefb8"><view class="ai_input data-v-b68fefb8"> 点击联系在线客服 </view><uni-icons wx:if="{{b}}" class="data-v-b68fefb8" bindclick="{{a}}" u-i="b68fefb8-0" bind:__l="__l" u-p="{{b}}"></uni-icons></view></button><view class="ai_footer data-v-b68fefb8"><scroll-view class="data-v-b68fefb8" scroll-x="true" style="height:80rpx"><view class="items data-v-b68fefb8"><view class="items_center data-v-b68fefb8"><image class="data-v-b68fefb8" src="/static/svg/FWJF.svg" mode="heightFix"/> 房屋缴费 </view></view><view class="items data-v-b68fefb8"><view class="items_center data-v-b68fefb8"><image class="data-v-b68fefb8" src="/static/svg/GDCX.svg" mode="heightFix"/> 工单查询 </view></view><view class="items data-v-b68fefb8"><view class="items_center data-v-b68fefb8"><image class="data-v-b68fefb8" src="/static/svg/FWJF.svg" mode="heightFix"/> 房屋绑定 </view></view><view class="items data-v-b68fefb8"><view class="items_center data-v-b68fefb8"><image class="data-v-b68fefb8" src="/static/svg/QBGL.svg" mode="heightFix"/> 钱包 </view></view></scroll-view></view></view></view>
|
<view class="ai_contents data-v-b68fefb8"><view class="ai_contents_center data-v-b68fefb8"><view class="ai_contents_header data-v-b68fefb8"><image class="data-v-b68fefb8" src="/static/svg/ai_icon.svg" mode="heightFix"/><text class="data-v-b68fefb8">HI,遇到什么问题了,可以问我哦~ </text></view><view class="ai_contents_input data-v-b68fefb8" bindtap="{{b}}"><view class="ai_input data-v-b68fefb8"> 点击联系在线客服 </view><uni-icons wx:if="{{a}}" class="data-v-b68fefb8" u-i="b68fefb8-0" bind:__l="__l" u-p="{{a}}"></uni-icons></view><view class="ai_footer data-v-b68fefb8"><scroll-view class="data-v-b68fefb8" scroll-x="true" style="height:80rpx"><view class="items data-v-b68fefb8"><view class="items_center data-v-b68fefb8"><image class="data-v-b68fefb8" src="/static/svg/FWJF.svg" mode="heightFix"/> 房屋缴费 </view></view><view class="items data-v-b68fefb8"><view class="items_center data-v-b68fefb8"><image class="data-v-b68fefb8" src="/static/svg/GDCX.svg" mode="heightFix"/> 工单查询 </view></view><view class="items data-v-b68fefb8"><view class="items_center data-v-b68fefb8"><image class="data-v-b68fefb8" src="/static/svg/FWJF.svg" mode="heightFix"/> 房屋绑定 </view></view><view class="items data-v-b68fefb8"><view class="items_center data-v-b68fefb8"><image class="data-v-b68fefb8" src="/static/svg/QBGL.svg" mode="heightFix"/> 钱包 </view></view></scroll-view></view></view></view>
|
||||||
@ -42,8 +42,8 @@
|
|||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
border-radius: 100rpx;
|
border-radius: 100rpx;
|
||||||
padding: 0 20rpx;
|
padding: 15rpx 20rpx;
|
||||||
width: 100%;
|
margin: 5rpx 30rpx;
|
||||||
}
|
}
|
||||||
.ai_contents .ai_contents_input .ai_input.data-v-b68fefb8 {
|
.ai_contents .ai_contents_input .ai_input.data-v-b68fefb8 {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
|
|||||||
1
dist/dev/mp-weixin/static/svg/copy.svg
vendored
Normal file
1
dist/dev/mp-weixin/static/svg/copy.svg
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1774320583868" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="22494" xmlns:xlink="http://www.w3.org/1999/xlink" width="64" height="64"><path d="M768 682.666667V170.666667a85.333333 85.333333 0 0 0-85.333333-85.333334H170.666667a85.333333 85.333333 0 0 0-85.333334 85.333334v512a85.333333 85.333333 0 0 0 85.333334 85.333333h512a85.333333 85.333333 0 0 0 85.333333-85.333333zM170.666667 170.666667h512v512H170.666667z m682.666666 85.333333v512a85.333333 85.333333 0 0 1-85.333333 85.333333H256a85.333333 85.333333 0 0 0 85.333333 85.333334h426.666667a170.666667 170.666667 0 0 0 170.666667-170.666667V341.333333a85.333333 85.333333 0 0 0-85.333334-85.333333z" p-id="22495"></path></svg>
|
||||||
|
After Width: | Height: | Size: 873 B |
@ -35,9 +35,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path": "pages/ai/index",
|
"path": "pages/ai/chat",
|
||||||
"style": {
|
"style": {
|
||||||
"navigationBarTitleText": "智能管家"
|
"navigationBarTitleText": "客服服务"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@ -5,20 +5,16 @@
|
|||||||
<image src="/static/svg/ai_icon.svg" mode="heightFix" />
|
<image src="/static/svg/ai_icon.svg" mode="heightFix" />
|
||||||
<text>HI,遇到什么问题了,可以问我哦~ </text>
|
<text>HI,遇到什么问题了,可以问我哦~ </text>
|
||||||
</view>
|
</view>
|
||||||
<button open-type="contact">
|
<view class="ai_contents_input" @click="handleInputChange">
|
||||||
<view class="ai_contents_input">
|
|
||||||
<view class="ai_input">
|
<view class="ai_input">
|
||||||
点击联系在线客服
|
点击联系在线客服
|
||||||
<!-- <input placeholder="点击输入聊天内容" placeholder-style="font-size: 26rpx;color:#999;" /> -->
|
|
||||||
</view>
|
</view>
|
||||||
<uni-icons
|
<uni-icons
|
||||||
@click="handleInputChange"
|
|
||||||
type="arrow-right"
|
type="arrow-right"
|
||||||
size="20"
|
size="20"
|
||||||
color="#666"
|
color="#666"
|
||||||
></uni-icons>
|
></uni-icons>
|
||||||
</view>
|
</view>
|
||||||
</button>
|
|
||||||
<view class="ai_footer">
|
<view class="ai_footer">
|
||||||
<scroll-view scroll-x="true" style="height: 80rpx">
|
<scroll-view scroll-x="true" style="height: 80rpx">
|
||||||
<view class="items">
|
<view class="items">
|
||||||
@ -55,7 +51,10 @@
|
|||||||
import { showToast } from '@/common/libraries/naviHelper'
|
import { showToast } from '@/common/libraries/naviHelper'
|
||||||
import { getStyleColorInfo, getStyleColorValueInfo } from '@/common/libraries/getPageConfig'
|
import { getStyleColorInfo, getStyleColorValueInfo } from '@/common/libraries/getPageConfig'
|
||||||
const handleInputChange = () => {
|
const handleInputChange = () => {
|
||||||
showToast('该功能在当前项目暂未开放,敬请期待!')
|
uni.navigateTo({
|
||||||
|
url: '/pages/ai/chat'
|
||||||
|
})
|
||||||
|
// showToast('该功能在当前项目暂未开放,敬请期待!')
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@ -113,8 +112,8 @@ const handleInputChange = () => {
|
|||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
border-radius: 100rpx;
|
border-radius: 100rpx;
|
||||||
padding: 0 20rpx;
|
padding: 15rpx 20rpx;
|
||||||
width: 100%;
|
margin: 5rpx 30rpx;
|
||||||
.ai_input {
|
.ai_input {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
font-size: 28rpx;
|
font-size: 28rpx;
|
||||||
|
|||||||
1
src/static/svg/copy.svg
Normal file
1
src/static/svg/copy.svg
Normal file
@ -0,0 +1 @@
|
|||||||
|
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1774320583868" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="22494" xmlns:xlink="http://www.w3.org/1999/xlink" width="64" height="64"><path d="M768 682.666667V170.666667a85.333333 85.333333 0 0 0-85.333333-85.333334H170.666667a85.333333 85.333333 0 0 0-85.333334 85.333334v512a85.333333 85.333333 0 0 0 85.333334 85.333333h512a85.333333 85.333333 0 0 0 85.333333-85.333333zM170.666667 170.666667h512v512H170.666667z m682.666666 85.333333v512a85.333333 85.333333 0 0 1-85.333333 85.333333H256a85.333333 85.333333 0 0 0 85.333333 85.333334h426.666667a170.666667 170.666667 0 0 0 170.666667-170.666667V341.333333a85.333333 85.333333 0 0 0-85.333334-85.333333z" p-id="22495"></path></svg>
|
||||||
|
After Width: | Height: | Size: 873 B |
Loading…
x
Reference in New Issue
Block a user