aI问答支持流式输出,效果非常好
This commit is contained in:
157
unpackage/dist/dev/mp-weixin/pages/ai_qa/ai_qa.js
vendored
Normal file
157
unpackage/dist/dev/mp-weixin/pages/ai_qa/ai_qa.js
vendored
Normal file
@@ -0,0 +1,157 @@
|
||||
"use strict";
|
||||
const common_vendor = require("../../common/vendor.js");
|
||||
function getSystemInfo() {
|
||||
if (typeof common_vendor.wx$1 !== "undefined" && common_vendor.wx$1.getWindowInfo) {
|
||||
try {
|
||||
const windowInfo = common_vendor.wx$1.getWindowInfo();
|
||||
return {
|
||||
statusBarHeight: windowInfo.statusBarHeight || 20,
|
||||
windowWidth: windowInfo.windowWidth,
|
||||
windowHeight: windowInfo.windowHeight
|
||||
};
|
||||
} catch (e) {
|
||||
common_vendor.index.__f__("warn", "at pages/ai_qa/ai_qa.vue:113", "[AIQa] wx.getWindowInfo fallback:", e);
|
||||
}
|
||||
}
|
||||
try {
|
||||
const systemInfo = common_vendor.index.getSystemInfoSync();
|
||||
return {
|
||||
statusBarHeight: systemInfo.statusBarHeight || 20,
|
||||
windowWidth: systemInfo.windowWidth,
|
||||
windowHeight: systemInfo.windowHeight
|
||||
};
|
||||
} catch (e) {
|
||||
common_vendor.index.__f__("error", "at pages/ai_qa/ai_qa.vue:125", "[AIQa] getSystemInfoSync:", e);
|
||||
return { statusBarHeight: 20, windowWidth: 375, windowHeight: 667 };
|
||||
}
|
||||
}
|
||||
const _sfc_main = {
|
||||
data() {
|
||||
const systemInfo = getSystemInfo();
|
||||
const statusBarHeightRpx = systemInfo.statusBarHeight * 2;
|
||||
const navbarHeightRpx = 44 * 2;
|
||||
const totalNavbarHeight = statusBarHeightRpx + navbarHeightRpx;
|
||||
return {
|
||||
contentTop: totalNavbarHeight + "rpx",
|
||||
contentBottom: "96rpx"
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
computedContentTop() {
|
||||
const s = getSystemInfo();
|
||||
return s.statusBarHeight * 2 + 44 * 2 + "rpx";
|
||||
}
|
||||
},
|
||||
onLoad() {
|
||||
this.updateNavbarPosition();
|
||||
setTimeout(() => this.preloadSubpackage(), 100);
|
||||
},
|
||||
onShow() {
|
||||
this.$nextTick(() => {
|
||||
this.updateNavbarPosition();
|
||||
setTimeout(() => this.updateNavbarPosition(), 50);
|
||||
});
|
||||
},
|
||||
onReady() {
|
||||
this.$nextTick(() => {
|
||||
const query = common_vendor.index.createSelectorQuery().in(this);
|
||||
query.select(".uni-navbar__content").boundingClientRect((data) => {
|
||||
if (data && data.height) {
|
||||
const adjusted = Math.max(data.height * 2 - 4, 0);
|
||||
this.$set(this, "contentTop", adjusted + "rpx");
|
||||
}
|
||||
}).exec();
|
||||
const queryTabbar = common_vendor.index.createSelectorQuery().in(this);
|
||||
queryTabbar.select(".tabbar").boundingClientRect((tabbarData) => {
|
||||
if (tabbarData && tabbarData.height) {
|
||||
const adjustedBottom = Math.max(tabbarData.height * 2 - 4, 0);
|
||||
this.$set(this, "contentBottom", adjustedBottom + "rpx");
|
||||
}
|
||||
}).exec();
|
||||
setTimeout(() => {
|
||||
const q2 = common_vendor.index.createSelectorQuery().in(this);
|
||||
q2.select(".uni-navbar__content").boundingClientRect((data) => {
|
||||
if (data && data.height) {
|
||||
this.$set(this, "contentTop", Math.max(data.height * 2 - 4, 0) + "rpx");
|
||||
}
|
||||
}).exec();
|
||||
const qt2 = common_vendor.index.createSelectorQuery().in(this);
|
||||
qt2.select(".tabbar").boundingClientRect((d) => {
|
||||
if (d && d.height) {
|
||||
this.$set(this, "contentBottom", Math.max(d.height * 2 - 4, 0) + "rpx");
|
||||
}
|
||||
}).exec();
|
||||
}, 200);
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
preloadSubpackage() {
|
||||
if (typeof common_vendor.wx$1 !== "undefined" && common_vendor.wx$1.loadSubpackage) {
|
||||
common_vendor.wx$1.loadSubpackage({
|
||||
name: "pages-subpackage",
|
||||
success: () => {
|
||||
},
|
||||
fail: (err) => common_vendor.index.__f__("error", "at pages/ai_qa/ai_qa.vue:201", "[AIQa] loadSubpackage:", err)
|
||||
});
|
||||
}
|
||||
},
|
||||
updateNavbarPosition() {
|
||||
const s = getSystemInfo();
|
||||
const total = s.statusBarHeight * 2 + 44 * 2;
|
||||
this.$set(this, "contentTop", total + "rpx");
|
||||
this.$forceUpdate();
|
||||
},
|
||||
goBack() {
|
||||
const pages = getCurrentPages();
|
||||
if (pages.length <= 1)
|
||||
return;
|
||||
common_vendor.index.navigateBack({
|
||||
fail: (err) => common_vendor.index.__f__("error", "at pages/ai_qa/ai_qa.vue:218", "[AIQa] goBack:", err)
|
||||
});
|
||||
},
|
||||
navigateToQa(slug) {
|
||||
common_vendor.index.navigateTo({
|
||||
url: `/pages-subpackage/ai_qa/${slug}/${slug}`,
|
||||
fail: (err) => {
|
||||
common_vendor.index.__f__("error", "at pages/ai_qa/ai_qa.vue:225", "[AIQa] navigate:", err);
|
||||
common_vendor.index.showToast({ title: "页面跳转失败", icon: "none" });
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
if (!Array) {
|
||||
const _easycom_uni_nav_bar2 = common_vendor.resolveComponent("uni-nav-bar");
|
||||
_easycom_uni_nav_bar2();
|
||||
}
|
||||
const _easycom_uni_nav_bar = () => "../../uni_modules/uni-nav-bar/components/uni-nav-bar/uni-nav-bar.js";
|
||||
if (!Math) {
|
||||
_easycom_uni_nav_bar();
|
||||
}
|
||||
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
||||
return {
|
||||
a: common_vendor.o($options.goBack, "e4"),
|
||||
b: common_vendor.p({
|
||||
fixed: true,
|
||||
statusBar: true,
|
||||
title: "AI问答",
|
||||
leftIcon: "left",
|
||||
color: "#333",
|
||||
backgroundColor: "#FFFFFF"
|
||||
}),
|
||||
c: common_vendor.o(($event) => $options.navigateToQa("general_qa"), "35"),
|
||||
d: common_vendor.o(($event) => $options.navigateToQa("after_sales_qa"), "c0"),
|
||||
e: common_vendor.o(($event) => $options.navigateToQa("demand_qa"), "c8"),
|
||||
f: common_vendor.o(($event) => $options.navigateToQa("price_qa"), "2e"),
|
||||
g: common_vendor.o(($event) => $options.navigateToQa("trust_qa"), "24"),
|
||||
h: common_vendor.o(($event) => $options.navigateToQa("decision_qa"), "b4"),
|
||||
i: common_vendor.o(($event) => $options.navigateToQa("competitor_qa"), "81"),
|
||||
j: common_vendor.o(($event) => $options.navigateToQa("objection_qa"), "0b"),
|
||||
k: common_vendor.o(($event) => $options.navigateToQa("sharp_qa"), "05"),
|
||||
l: $options.computedContentTop || $data.contentTop,
|
||||
m: $data.contentBottom || "96rpx"
|
||||
};
|
||||
}
|
||||
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-63bac443"]]);
|
||||
wx.createPage(MiniProgramPage);
|
||||
//# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/ai_qa/ai_qa.js.map
|
||||
6
unpackage/dist/dev/mp-weixin/pages/ai_qa/ai_qa.json
vendored
Normal file
6
unpackage/dist/dev/mp-weixin/pages/ai_qa/ai_qa.json
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"navigationStyle": "custom",
|
||||
"usingComponents": {
|
||||
"uni-nav-bar": "../../uni_modules/uni-nav-bar/components/uni-nav-bar/uni-nav-bar"
|
||||
}
|
||||
}
|
||||
1
unpackage/dist/dev/mp-weixin/pages/ai_qa/ai_qa.wxml
vendored
Normal file
1
unpackage/dist/dev/mp-weixin/pages/ai_qa/ai_qa.wxml
vendored
Normal file
@@ -0,0 +1 @@
|
||||
<view class="page data-v-63bac443"><uni-nav-bar wx:if="{{b}}" class="data-v-63bac443" bindclickLeft="{{a}}" u-i="63bac443-0" bind:__l="__l" u-p="{{b}}"></uni-nav-bar><view class="content data-v-63bac443"><scroll-view class="content-scroll data-v-63bac443" scroll-y="true" style="{{'top:' + l + ';' + ('bottom:' + m)}}"><view class="category-section two-column data-v-63bac443"><view class="category-header data-v-63bac443"><text class="category-icon data-v-63bac443">💬</text><text class="category-title data-v-63bac443">基础问答</text></view><view class="function-grid data-v-63bac443"><view class="function-item data-v-63bac443" bindtap="{{c}}"><view class="function-icon data-v-63bac443">🙋</view><text class="function-name data-v-63bac443">通用问答</text><text class="function-desc data-v-63bac443">日常接待与通用话术</text></view><view class="function-item data-v-63bac443" bindtap="{{d}}"><view class="function-icon data-v-63bac443">🛠️</view><text class="function-name data-v-63bac443">售后问答</text><text class="function-desc data-v-63bac443">安装、质保与售后流程</text></view></view></view><view class="category-section sales-analysis data-v-63bac443"><view class="category-header data-v-63bac443"><text class="category-icon data-v-63bac443">🎯</text><text class="category-title data-v-63bac443">需求与信任</text></view><view class="function-grid data-v-63bac443"><view class="function-item full-row-item data-v-63bac443" bindtap="{{e}}"><view class="function-icon data-v-63bac443">📌</view><text class="function-name data-v-63bac443">需求类问答</text><text class="function-desc data-v-63bac443">是否匹配需求、场景方案</text></view><view class="function-item full-row-item data-v-63bac443" bindtap="{{f}}"><view class="function-icon data-v-63bac443">💳</view><text class="function-name data-v-63bac443">价格类问答</text><text class="function-desc data-v-63bac443">价格、优惠与性价比</text></view><view class="function-item full-row-item data-v-63bac443" bindtap="{{g}}"><view class="function-icon data-v-63bac443">🤝</view><text class="function-name data-v-63bac443">信任类问答</text><text class="function-desc data-v-63bac443">质量、售后与案例资质</text></view><view class="function-item full-row-item data-v-63bac443" bindtap="{{h}}"><view class="function-icon data-v-63bac443">⚡</view><text class="function-name data-v-63bac443">决策类问答</text><text class="function-desc data-v-63bac443">再考虑、犹豫与促单</text></view></view></view><view class="category-section two-column data-v-63bac443"><view class="category-header data-v-63bac443"><text class="category-icon data-v-63bac443">⚔️</text><text class="category-title data-v-63bac443">对比与难点</text></view><view class="function-grid data-v-63bac443"><view class="function-item data-v-63bac443" bindtap="{{i}}"><view class="function-icon data-v-63bac443">🔀</view><text class="function-name data-v-63bac443">竞品类问答</text><text class="function-desc data-v-63bac443">与竞品对比与选型</text></view><view class="function-item data-v-63bac443" bindtap="{{j}}"><view class="function-icon data-v-63bac443">🚧</view><text class="function-name data-v-63bac443">抗拒点问答</text><text class="function-desc data-v-63bac443">拖延、借口与隐性拒绝</text></view><view class="function-item full-span data-v-63bac443" bindtap="{{k}}"><view class="function-icon data-v-63bac443">📍</view><text class="function-name data-v-63bac443">针尖问答</text><text class="function-desc data-v-63bac443">尖锐与刁难型问题</text></view></view></view></scroll-view></view></view>
|
||||
124
unpackage/dist/dev/mp-weixin/pages/ai_qa/ai_qa.wxss
vendored
Normal file
124
unpackage/dist/dev/mp-weixin/pages/ai_qa/ai_qa.wxss
vendored
Normal file
@@ -0,0 +1,124 @@
|
||||
|
||||
page.data-v-63bac443 {
|
||||
background-color: #F5F5F5;
|
||||
}
|
||||
.page.data-v-63bac443 {
|
||||
min-height: 100vh;
|
||||
background-color: #F5F5F5;
|
||||
}
|
||||
.content.data-v-63bac443 {
|
||||
padding-top: 0 !important;
|
||||
margin-top: 0 !important;
|
||||
position: relative;
|
||||
min-height: 100vh;
|
||||
top: 0;
|
||||
}
|
||||
.data-v-63bac443 .uni-navbar__placeholder {
|
||||
display: none !important;
|
||||
height: 0 !important;
|
||||
}
|
||||
.data-v-63bac443 .uni-navbar__placeholder-view {
|
||||
display: none !important;
|
||||
height: 0 !important;
|
||||
}
|
||||
.data-v-63bac443 [class*="tabbar"][class*="placeholder"] {
|
||||
display: none !important;
|
||||
height: 0 !important;
|
||||
}
|
||||
.data-v-63bac443 [class*="safe-area"][class*="bottom"],.data-v-63bac443 [class*="bottom"][class*="safe"] {
|
||||
display: none !important;
|
||||
height: 0 !important;
|
||||
}
|
||||
.content-scroll.data-v-63bac443 {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
right: 0;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
padding: 0 !important;
|
||||
margin: 0 !important;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.category-section.data-v-63bac443 {
|
||||
margin: 20rpx 30rpx;
|
||||
background: #FFFFFF;
|
||||
border-radius: 16rpx;
|
||||
overflow: hidden;
|
||||
box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.04);
|
||||
}
|
||||
.category-section.data-v-63bac443:first-child {
|
||||
margin-top: 0;
|
||||
}
|
||||
.category-header.data-v-63bac443 {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 30rpx;
|
||||
background: #FFFFFF;
|
||||
border-bottom: 1rpx solid #F0F0F0;
|
||||
}
|
||||
.category-icon.data-v-63bac443 {
|
||||
font-size: 32rpx;
|
||||
margin-right: 20rpx;
|
||||
}
|
||||
.category-title.data-v-63bac443 {
|
||||
font-size: 32rpx;
|
||||
font-weight: 500;
|
||||
color: #333;
|
||||
}
|
||||
.function-grid.data-v-63bac443 {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
padding: 10rpx;
|
||||
}
|
||||
.two-column .function-item.full-span.data-v-63bac443 {
|
||||
flex: 1 1 100%;
|
||||
margin-top: 10rpx;
|
||||
}
|
||||
.two-column .function-item.data-v-63bac443 {
|
||||
flex: 1;
|
||||
background: #FFFFFF;
|
||||
border-radius: 12rpx;
|
||||
padding: 24rpx 16rpx;
|
||||
margin: 0 5rpx;
|
||||
text-align: center;
|
||||
box-shadow: 0 2rpx 4rpx rgba(0, 0, 0, 0.04);
|
||||
transition: all 0.3s ease;
|
||||
border: 1rpx solid #F0F0F0;
|
||||
}
|
||||
.sales-analysis .function-item.full-row-item.data-v-63bac443 {
|
||||
flex: 1;
|
||||
width: calc(50% - 10rpx);
|
||||
background: #FFFFFF;
|
||||
border-radius: 12rpx;
|
||||
padding: 24rpx 16rpx;
|
||||
margin: 0 5rpx;
|
||||
text-align: center;
|
||||
box-shadow: 0 2rpx 4rpx rgba(0, 0, 0, 0.04);
|
||||
border: 1rpx solid #F0F0F0;
|
||||
}
|
||||
.sales-analysis .function-item.new-line-item.data-v-63bac443 {
|
||||
flex-basis: 100%;
|
||||
width: calc(50% - 10rpx);
|
||||
margin-top: 10rpx;
|
||||
}
|
||||
.function-item.data-v-63bac443:active {
|
||||
transform: scale(0.95);
|
||||
}
|
||||
.function-icon.data-v-63bac443 {
|
||||
font-size: 48rpx;
|
||||
margin-bottom: 12rpx;
|
||||
}
|
||||
.function-name.data-v-63bac443 {
|
||||
display: block;
|
||||
font-size: 28rpx;
|
||||
font-weight: 500;
|
||||
color: #333;
|
||||
margin-bottom: 8rpx;
|
||||
}
|
||||
.function-desc.data-v-63bac443 {
|
||||
display: block;
|
||||
font-size: 24rpx;
|
||||
color: #666;
|
||||
line-height: 1.4;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user