Compare commits
15 Commits
94ab8c5c04
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 5d0198b17a | |||
| 607c09abe7 | |||
| 736c2feb4f | |||
| 8161e7512b | |||
| 99b82810c2 | |||
| d2e650a434 | |||
| d6c7ca7aec | |||
| 1408a97027 | |||
| d49bf738f8 | |||
| 8ea6546f04 | |||
| f70920a25c | |||
| d666dce813 | |||
| 7aa8c72005 | |||
| 19b6b5b321 | |||
| f632e9c821 |
@@ -3,19 +3,7 @@
|
||||
"clientId": "6",
|
||||
"appId": "wx5e79df5996572539",
|
||||
"name": "智念",
|
||||
"placeholder": "快告诉智念您在想什么~",
|
||||
"loginDesc": "您好,欢迎来到智念科技",
|
||||
"logo": "https://oss.nianxx.cn/mp/static/version_101/login/dh_logo.png",
|
||||
"ipLargeImage": "https://oss.nianxx.cn/mp/static/version_101/zn/zn_large.png",
|
||||
"ipLargeImageWidth": 395,
|
||||
"ipLargeImageHeight": 335,
|
||||
"ipLargeTotalFrames": 71,
|
||||
"ipLargeColumns": 1,
|
||||
"ipSmallImage": "https://oss.nianxx.cn/mp/static/version_101/dh/dh_small.png",
|
||||
"ipSmallImageWidth": 128,
|
||||
"ipSmallImageHeight": 128,
|
||||
"ipSmallTotalFrames": 117,
|
||||
"ipSmallColumns": 1,
|
||||
"theme": {
|
||||
"theme-color-800": "#0B7034",
|
||||
"theme-color-700": "#0B5C2D",
|
||||
@@ -24,23 +12,24 @@
|
||||
"theme-color-50": "#F0F8F3"
|
||||
}
|
||||
},
|
||||
"nianhelper": {
|
||||
"clientId": "11",
|
||||
"appId": "wx6fcf7b3db3deee6c",
|
||||
"name": "智念助手",
|
||||
"logo": "https://one-feel-config-images-bucket.oss-cn-chengdu.aliyuncs.com/znjqzs.png",
|
||||
"theme": {
|
||||
"theme-color-800": "#174BB6",
|
||||
"theme-color-700": "#145EE1",
|
||||
"theme-color-500": "#2D91FF",
|
||||
"theme-color-100": "#D9EEFF",
|
||||
"theme-color-50": "#EEF8FF"
|
||||
}
|
||||
},
|
||||
"duohua": {
|
||||
"clientId": "2",
|
||||
"appId": "wx23f86d809ae80259",
|
||||
"name": "朵朵",
|
||||
"placeholder": "快告诉朵朵您在想什么~",
|
||||
"loginDesc": "您好,欢迎来到朵花温泉",
|
||||
"logo": "https://oss.nianxx.cn/mp/static/version_101/login/dh_logo.png",
|
||||
"ipLargeImage": "https://oss.nianxx.cn/mp/static/version_101/dh/dh_large.png",
|
||||
"ipLargeImageWidth": 263,
|
||||
"ipLargeImageHeight": 210,
|
||||
"ipLargeTotalFrames": 147,
|
||||
"ipLargeColumns": 1,
|
||||
"ipSmallImage": "https://oss.nianxx.cn/mp/static/version_101/dh/dh_small.png",
|
||||
"ipSmallImageWidth": 128,
|
||||
"ipSmallImageHeight": 128,
|
||||
"ipSmallTotalFrames": 117,
|
||||
"ipSmallColumns": 1,
|
||||
"theme": {
|
||||
"theme-color-800": "#0B7034",
|
||||
"theme-color-700": "#0B5C2D",
|
||||
@@ -53,19 +42,7 @@
|
||||
"clientId": "4",
|
||||
"appId": "wx0be424e1d22065a9",
|
||||
"name": "沐沐",
|
||||
"placeholder": "快告诉沐沐您在想什么~",
|
||||
"loginDesc": "您好,欢迎来到天沐温泉",
|
||||
"logo": "https://oss.nianxx.cn/mp/static/version_101/login/tm_logo.png",
|
||||
"ipLargeImage": "https://oss.nianxx.cn/mp/static/version_101/tm/tm_large.png",
|
||||
"ipLargeImageWidth": 395,
|
||||
"ipLargeImageHeight": 335,
|
||||
"ipLargeTotalFrames": 71,
|
||||
"ipLargeColumns": 1,
|
||||
"ipSmallImage": "https://oss.nianxx.cn/mp/static/version_101/tm/tm_small.png",
|
||||
"ipSmallImageWidth": 128,
|
||||
"ipSmallImageHeight": 128,
|
||||
"ipSmallTotalFrames": 148,
|
||||
"ipSmallColumns": 1,
|
||||
"theme": {
|
||||
"theme-color-800": "#174BB6",
|
||||
"theme-color-700": "#145EE1",
|
||||
@@ -74,4 +51,4 @@
|
||||
"theme-color-50": "#EEF8FF"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
376
package-lock.json
generated
@@ -19,24 +19,18 @@
|
||||
"clientId": "2",
|
||||
"appId": "wx5e79df5996572539",
|
||||
"name": "智念",
|
||||
"placeholder": "快告诉智念您在想什么~",
|
||||
"loginDesc": "您好,欢迎来到智念科技",
|
||||
"logo": "https://oss.nianxx.cn/mp/static/version_101/login/dh_logo.png"
|
||||
},
|
||||
"duohua": {
|
||||
"clientId": "2",
|
||||
"appId": "wx23f86d809ae80259",
|
||||
"name": "朵花",
|
||||
"placeholder": "快告诉朵朵您在想什么~",
|
||||
"loginDesc": "您好,欢迎来到朵花温泉",
|
||||
"logo": "https://oss.nianxx.cn/mp/static/version_101/login/dh_logo.png"
|
||||
},
|
||||
"tianmu": {
|
||||
"clientId": "4",
|
||||
"appId": "wx0be424e1d22065a9",
|
||||
"name": "天沐",
|
||||
"placeholder": "快告诉沐沐您在想什么~",
|
||||
"loginDesc": "您好,欢迎来到天沐温泉",
|
||||
"logo": "https://oss.nianxx.cn/mp/static/version_101/login/tm_logo.png"
|
||||
}
|
||||
}
|
||||
@@ -44,11 +38,12 @@
|
||||
|
||||
## 支持的客户端
|
||||
|
||||
| 客户端名称 | 显示名称 | AppID |
|
||||
| ---------- | -------- | ------------------ |
|
||||
| `zhinian` | 智念 | wx5e79df5996572539 |
|
||||
| `duohua` | 朵花 | wx23f86d809ae80259 |
|
||||
| `tianmu` | 天沐 | wx0be424e1d22065a9 |
|
||||
| 客户端名称 | 显示名称 | AppID |
|
||||
| ------------ | -------- | ------------------ |
|
||||
| `zhinian` | 智念 | wx5e79df5996572539 |
|
||||
| `duohua` | 朵花 | wx23f86d809ae80259 |
|
||||
| `tianmu` | 天沐 | wx0be424e1d22065a9 |
|
||||
| `nianhelper` | 念念 | wx6fcf7b3db3deee6c |
|
||||
|
||||
## 使用方法
|
||||
|
||||
@@ -58,6 +53,9 @@
|
||||
# 切换到智念客户端
|
||||
npm run switch-client zhinian
|
||||
|
||||
# 切换到念念助手客户端
|
||||
npm run switch-client nianhelper
|
||||
|
||||
# 切换到朵花客户端
|
||||
npm run switch-client duohua
|
||||
|
||||
@@ -85,17 +83,14 @@ node scripts/update-appid.js tianmu
|
||||
## 更新的文件
|
||||
|
||||
1. **src/manifest.json**
|
||||
|
||||
- 更新 `mp-weixin.appid` 字段
|
||||
- 保持文件中的注释不变
|
||||
|
||||
2. **project.config.json**
|
||||
|
||||
- 更新根级别的 `appid` 字段
|
||||
- 保持 JSON 格式化
|
||||
|
||||
3. **src/constant/base.js**
|
||||
|
||||
- 更新 `getCurrentConfig()` 函数返回的客户端配置
|
||||
|
||||
4. **client-configs.json**
|
||||
@@ -160,8 +155,6 @@ A: 在 `client-configs.json` 中添加新的客户端配置:
|
||||
"clientId": "客户端ID",
|
||||
"appId": "微信小程序AppID",
|
||||
"name": "客户端显示名称",
|
||||
"placeholder": "输入框占位符文本",
|
||||
"loginDesc": "登录页面描述文本",
|
||||
"logo": "@/pages/login/images/logo.png",
|
||||
}
|
||||
```
|
||||
|
||||
|
Before Width: | Height: | Size: 4.1 KiB |
@@ -50,7 +50,13 @@
|
||||
{{ dateInfo.label }}
|
||||
</text>
|
||||
<text class="date-number">{{ dateInfo.day }}</text>
|
||||
<text class="date-price" v-if="dateInfo.price !== null && dateInfo.price !== undefined">¥{{ dateInfo.price }}</text>
|
||||
<text
|
||||
class="date-price"
|
||||
v-if="
|
||||
dateInfo.price !== null && dateInfo.price !== undefined
|
||||
"
|
||||
>¥{{ dateInfo.price }}</text
|
||||
>
|
||||
</template>
|
||||
</view>
|
||||
</view>
|
||||
@@ -253,7 +259,7 @@ const generateCalendarGrid = (year, month) => {
|
||||
// 填充日期
|
||||
for (let day = 1; day <= daysInMonth; day++) {
|
||||
const dateStr = `${year}-${String(month).padStart(2, "0")}-${String(
|
||||
day
|
||||
day,
|
||||
).padStart(2, "0")}`;
|
||||
const priceItem = getPriceItem(dateStr);
|
||||
grid.push({
|
||||
@@ -344,7 +350,11 @@ const getDateCellClass = (dateInfo) => {
|
||||
if (dateInfo.selected) classes.push("date-cell-selected");
|
||||
if (dateInfo.inRange) classes.push("date-cell-in-range");
|
||||
// 标注无价格但可选的日期(用于视觉区分)
|
||||
if (dateInfo.price === null || dateInfo.price === undefined || dateInfo.price === "-") {
|
||||
if (
|
||||
dateInfo.price === null ||
|
||||
dateInfo.price === undefined ||
|
||||
dateInfo.price === "-"
|
||||
) {
|
||||
classes.push("date-cell-no-price");
|
||||
}
|
||||
|
||||
@@ -404,13 +414,19 @@ const handleRangeSelection = (dateInfo) => {
|
||||
if (!rangeStart.value || (rangeStart.value && rangeEnd.value)) {
|
||||
// 开始新的范围选择:当作为价格区间选择器时,开始日必须有价格且有库存
|
||||
if (props.rangeRequirePrice) {
|
||||
const hasPrice = dateInfo.price !== null && dateInfo.price !== undefined && dateInfo.price !== "-";
|
||||
const hasPrice =
|
||||
dateInfo.price !== null &&
|
||||
dateInfo.price !== undefined &&
|
||||
dateInfo.price !== "-";
|
||||
if (!hasPrice) {
|
||||
uni.showToast({ title: "所选日期不可预订,请重新选择", icon: "none" });
|
||||
return;
|
||||
}
|
||||
if (dateInfo.stock !== undefined && Number(dateInfo.stock) <= 0) {
|
||||
uni.showToast({ title: "所选日期库存不足,请选择其他日期", icon: "none" });
|
||||
uni.showToast({
|
||||
title: "所选日期库存不足,请选择其他日期",
|
||||
icon: "none",
|
||||
});
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -421,11 +437,16 @@ const handleRangeSelection = (dateInfo) => {
|
||||
return;
|
||||
}
|
||||
|
||||
// 否则为结束日期(完成选择)——结束日允许无价格(如为紧接有价日的下一天),但区间内的夜晚必须有价格
|
||||
// 否则为结束日期(完成选择)
|
||||
if (rangeStart.value === dateInfo.date) {
|
||||
uni.showToast({ title: "离店日期不能与入住日期相同", icon: "none" });
|
||||
return;
|
||||
}
|
||||
|
||||
rangeEnd.value = dateInfo.date;
|
||||
isRangeSelecting.value = false;
|
||||
|
||||
// 允许选择相同日期,但确保开始日期不大于结束日期
|
||||
// 确保开始日期不大于结束日期
|
||||
if (new Date(rangeStart.value) > new Date(rangeEnd.value)) {
|
||||
[rangeStart.value, rangeEnd.value] = [rangeEnd.value, rangeStart.value];
|
||||
}
|
||||
@@ -433,7 +454,11 @@ const handleRangeSelection = (dateInfo) => {
|
||||
// 检查日期跨度是否超过28天
|
||||
const daysBetween = calculateDaysBetween(rangeStart.value, rangeEnd.value);
|
||||
if (daysBetween > 28) {
|
||||
uni.showToast({ title: "预定时间不能超过28天", icon: "none", duration: 3000 });
|
||||
uni.showToast({
|
||||
title: "预定时间不能超过28天",
|
||||
icon: "none",
|
||||
duration: 3000,
|
||||
});
|
||||
rangeStart.value = null;
|
||||
rangeEnd.value = null;
|
||||
isRangeSelecting.value = false;
|
||||
@@ -443,9 +468,14 @@ const handleRangeSelection = (dateInfo) => {
|
||||
// 如果作为价格区间选择器,验证夜晚(不包含离店日)是否都有价格/库存
|
||||
if (props.rangeRequirePrice) {
|
||||
const nights = generateNightsRange(rangeStart.value, rangeEnd.value);
|
||||
const missing = nights.find((d) => d.price === null || d.price === undefined || d.price === "-");
|
||||
const missing = nights.find(
|
||||
(d) => d.price === null || d.price === undefined || d.price === "-",
|
||||
);
|
||||
if (missing) {
|
||||
uni.showToast({ title: "所选区间包含无价格日期,请重新选择", icon: "none" });
|
||||
uni.showToast({
|
||||
title: "所选区间包含无价格日期,请重新选择",
|
||||
icon: "none",
|
||||
});
|
||||
rangeStart.value = null;
|
||||
rangeEnd.value = null;
|
||||
return;
|
||||
@@ -456,7 +486,10 @@ const handleRangeSelection = (dateInfo) => {
|
||||
return item && item.stock !== undefined && Number(item.stock) <= 0;
|
||||
});
|
||||
if (badStock) {
|
||||
uni.showToast({ title: "所选区间包含库存不足的日期,请重新选择", icon: "none" });
|
||||
uni.showToast({
|
||||
title: "所选区间包含库存不足的日期,请重新选择",
|
||||
icon: "none",
|
||||
});
|
||||
rangeStart.value = null;
|
||||
rangeEnd.value = null;
|
||||
return;
|
||||
@@ -551,7 +584,7 @@ watch(
|
||||
popup.value?.close();
|
||||
}
|
||||
},
|
||||
{ immediate: true }
|
||||
{ immediate: true },
|
||||
);
|
||||
|
||||
// 生命周期钩子
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
class="checkbox-icon"
|
||||
:type="isChecked"
|
||||
:checked="isChecked"
|
||||
:color="iconColor"
|
||||
size="24"
|
||||
color="opacity"
|
||||
/>
|
||||
<slot></slot>
|
||||
</view>
|
||||
@@ -28,11 +28,6 @@ const isChecked = computed(() => {
|
||||
return props.modelValue ? "checkbox-filled" : "circle";
|
||||
});
|
||||
|
||||
// 计算图标颜色
|
||||
const iconColor = computed(() => {
|
||||
return props.modelValue ? "#1890FF" : "#00A6FF";
|
||||
});
|
||||
|
||||
// 切换选中状态
|
||||
const onChange = () => {
|
||||
emit("update:modelValue", !props.modelValue);
|
||||
|
||||
@@ -5,5 +5,6 @@
|
||||
|
||||
.checkbox-icon {
|
||||
margin-right: 6px;
|
||||
color: $theme-color-500;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
.command-wrapper {
|
||||
background-color: #00a6ff;
|
||||
background-color: $theme-color-500;
|
||||
border-radius: 20px 4px 20px 20px;
|
||||
padding: 8px 24px;
|
||||
width: max-content;
|
||||
|
||||
@@ -188,7 +188,7 @@ const addForm = () => {
|
||||
font-weight: 600;
|
||||
margin-bottom: 20rpx;
|
||||
color: #333;
|
||||
border-left: 6rpx solid #00a6ff;
|
||||
border-left: 6rpx solid $theme-color-500;
|
||||
padding-left: 16rpx;
|
||||
}
|
||||
|
||||
@@ -214,7 +214,7 @@ const addForm = () => {
|
||||
.add-btn {
|
||||
width: 100%;
|
||||
height: 80rpx;
|
||||
background: #00a6ff;
|
||||
background: $theme-color-500;
|
||||
color: #fff;
|
||||
border: none;
|
||||
border-radius: 8rpx;
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
<template>
|
||||
<view class="form-wrapper">
|
||||
<view class="form-header">
|
||||
<uni-icons class="minus" color="#00A6FF" size="22" type="minus" />
|
||||
<uni-icons class="minus uni-color" color="opacity" size="22" type="minus" />
|
||||
<text class="form-title">{{ title }}</text>
|
||||
<uni-icons
|
||||
v-if="showDeleteIcon"
|
||||
class="delete"
|
||||
color="#00A6FF"
|
||||
class="delete uni-color"
|
||||
color="opacity"
|
||||
size="22"
|
||||
type="trash"
|
||||
@click="handleDelete"
|
||||
|
||||
@@ -29,6 +29,10 @@ $form-transition: all 0.2s ease;
|
||||
padding: 10px 12px;
|
||||
min-height: 44px;
|
||||
|
||||
.uni-color {
|
||||
color: $theme-color-500;
|
||||
}
|
||||
|
||||
.minus,
|
||||
.delete {
|
||||
height: 22px;
|
||||
@@ -50,7 +54,7 @@ $form-transition: all 0.2s ease;
|
||||
margin-left: 8px;
|
||||
font-size: $uni-font-size-lg;
|
||||
font-weight: 500;
|
||||
color: $form-primary-color;
|
||||
color: $theme-color-500;
|
||||
flex: 1;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
@@ -110,7 +114,7 @@ $form-transition: all 0.2s ease;
|
||||
}
|
||||
|
||||
&:focus {
|
||||
border-bottom-color: $form-primary-color;
|
||||
border-bottom-color: $theme-color-500;
|
||||
|
||||
&::placeholder {
|
||||
opacity: 0.5;
|
||||
|
||||
@@ -48,6 +48,6 @@
|
||||
);
|
||||
font-size: $uni-font-size-sm;
|
||||
font-weight: 500;
|
||||
color: #00a6ff;
|
||||
color: $theme-color-500;
|
||||
border-radius: $uni-border-radius-50px;
|
||||
}
|
||||
|
||||
@@ -107,7 +107,7 @@ defineExpose({
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
background-color: #00a6ff;
|
||||
background-color: $theme-color-500;
|
||||
height: 44px;
|
||||
border-radius: $uni-border-radius-50px;
|
||||
}
|
||||
|
||||
@@ -8,6 +8,6 @@
|
||||
border-radius: 10px;
|
||||
padding: 8px 16px;
|
||||
font-size: $uni-font-size-sm;
|
||||
color: #00a6ff;
|
||||
color: $theme-color-500;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
@@ -1,22 +1,25 @@
|
||||
<template>
|
||||
<view class="bg-white rounded-12 overflow-hidden mb-12">
|
||||
<view
|
||||
class="border-box font-size-16 font-500 color-000 line-height-24 p-12"
|
||||
<view class="border-box font-size-16 font-500 color-000 line-height-24 p-12"
|
||||
>使用日期</view
|
||||
>
|
||||
<view class="flex flex-items-center border-box ">
|
||||
<view class="flex flex-items-center border-box">
|
||||
<scroll-view class="date-scroll" scroll-x>
|
||||
<view class="date-list">
|
||||
<block v-for="(item) in dates" :key="item.date">
|
||||
<block v-for="item in openDateRangeList" :key="item.date">
|
||||
<view
|
||||
class="date-item"
|
||||
:class="{ selected: isSameDate(selectedDate, item.date) }"
|
||||
@click="onDateClick(item)"
|
||||
>
|
||||
<view class="label font-size-12">{{ item.label }}</view>
|
||||
<view class="md font-size-16 font-600">{{ formatMD(item.date) }}</view>
|
||||
<view class="status font-size-12">可订</view>
|
||||
<view v-if="isSameDate(selectedDate, item.date)" class="check">✔</view>
|
||||
<view class="label font-size-12">{{ item.weekDesc }}</view>
|
||||
<view class="md font-size-16 font-600">{{
|
||||
formatMD(item.date)
|
||||
}}</view>
|
||||
<view class="status font-size-12">{{ item.canOrder }}</view>
|
||||
<view v-if="isSameDate(selectedDate, item.date)" class="check"
|
||||
>✔</view
|
||||
>
|
||||
</view>
|
||||
</block>
|
||||
</view>
|
||||
@@ -26,50 +29,35 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, onMounted, watch } from 'vue';
|
||||
import { ref, watch } from "vue";
|
||||
const props = defineProps({
|
||||
selectedDate: { type: String, default: null },
|
||||
days: { type: Number, default: 14 }
|
||||
openDateRangeList: { type: Array, default: () => [] },
|
||||
});
|
||||
const emit = defineEmits(['update:selectedDate']);
|
||||
|
||||
const dates = ref([]);
|
||||
const emit = defineEmits(["update:selectedDate"]);
|
||||
const selectedDate = ref(props.selectedDate);
|
||||
|
||||
watch(() => props.selectedDate, (v) => {
|
||||
selectedDate.value = v;
|
||||
});
|
||||
|
||||
const initDates = (days = props.days) => {
|
||||
const arr = [];
|
||||
const today = new Date();
|
||||
for (let i = 0; i < days; i++) {
|
||||
const d = new Date(today);
|
||||
d.setDate(today.getDate() + i);
|
||||
const iso = d.toISOString().slice(0, 10);
|
||||
arr.push({ date: iso, day: i, disabled: false, label: getLabel(i, d) });
|
||||
}
|
||||
dates.value = arr;
|
||||
}
|
||||
|
||||
const getLabel = (i, d) => {
|
||||
if (i === 0) return '今天';
|
||||
if (i === 1) return '明天';
|
||||
const week = ['周日', '周一', '周二', '周三', '周四', '周五', '周六'];
|
||||
return week[d.getDay()];
|
||||
}
|
||||
|
||||
const formatMD = (dateStr) => {
|
||||
const d = new Date(dateStr);
|
||||
const mm = String(d.getMonth() + 1).padStart(2, '0');
|
||||
const dd = String(d.getDate()).padStart(2, '0');
|
||||
return `${mm}-${dd}`;
|
||||
}
|
||||
watch(
|
||||
() => props.selectedDate,
|
||||
(v) => {
|
||||
selectedDate.value = v;
|
||||
},
|
||||
);
|
||||
|
||||
const isSameDate = (a, b) => {
|
||||
if (!a || !b) return false;
|
||||
return a === b;
|
||||
}
|
||||
};
|
||||
|
||||
// 格式化展示日期,将 2026-04-13 转换为 04-13
|
||||
const formatMD = (dateStr) => {
|
||||
if (!dateStr || typeof dateStr !== "string") return "";
|
||||
const parts = dateStr.split("-");
|
||||
if (parts.length >= 3) {
|
||||
return `${parts[1]}-${parts[2]}`;
|
||||
}
|
||||
return dateStr;
|
||||
};
|
||||
|
||||
const onDateClick = (item) => {
|
||||
const date = item.date;
|
||||
@@ -78,11 +66,11 @@ const onDateClick = (item) => {
|
||||
} else {
|
||||
selectedDate.value = date;
|
||||
}
|
||||
emit('update:selectedDate', selectedDate.value);
|
||||
}
|
||||
onMounted(() => initDates());
|
||||
console.log("selectedDate:", selectedDate.value);
|
||||
emit("update:selectedDate", selectedDate.value);
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
@import "./styles/index.scss";
|
||||
</style>
|
||||
</style>
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
/**
|
||||
* 客户端配置管理模块
|
||||
*
|
||||
*
|
||||
* 功能说明:
|
||||
* 所有配置从根目录的 client-configs.json 文件中读取
|
||||
*/
|
||||
|
||||
// 直接导入配置文件
|
||||
import rawConfigs from '../../client-configs.json' with { type: 'json' };
|
||||
import rawConfigs from "../../client-configs.json" with { type: "json" };
|
||||
|
||||
// 所有用户端的配置 - 处理后的配置
|
||||
export const CLIENT_CONFIGS = rawConfigs;
|
||||
@@ -16,7 +16,6 @@ export const getCurrentConfig = () => CLIENT_CONFIGS.zhinian;
|
||||
export const clientId = getCurrentConfig().clientId;
|
||||
export const appId = getCurrentConfig().appId;
|
||||
|
||||
|
||||
/// 客户端类型
|
||||
export const ClientType = {
|
||||
// 智念
|
||||
@@ -25,17 +24,21 @@ export const ClientType = {
|
||||
DUOHUA: "DUOHUA",
|
||||
// 天沐
|
||||
TIANMU: "TIANMU",
|
||||
// 念念助手
|
||||
NIANHELPER: "NIANHELPER",
|
||||
};
|
||||
|
||||
/// 获取当前客户端类型
|
||||
export const currentClientType = () => {
|
||||
switch (getCurrentConfig().name) {
|
||||
case '智念':
|
||||
case "智念":
|
||||
return ClientType.ZHINIAN;
|
||||
case '朵朵':
|
||||
case "朵朵":
|
||||
return ClientType.DUOHUA;
|
||||
case '沐沐':
|
||||
case "沐沐":
|
||||
return ClientType.TIANMU;
|
||||
case "念念":
|
||||
return ClientType.NIANHELPER;
|
||||
default:
|
||||
return ClientType.ZHINIAN;
|
||||
}
|
||||
|
||||
@@ -16,7 +16,12 @@
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<UseDateRange v-if="reservationEnabled" v-model:selectedDate="reservationDate"/>
|
||||
<!-- 使用日期 -->
|
||||
<UseDateRange
|
||||
v-if="orderData.reservationEnabled"
|
||||
:openDateRangeList="orderData.openDateRangeList"
|
||||
v-model:selectedDate="reservationDate"
|
||||
/>
|
||||
|
||||
<!-- 联系方式 -->
|
||||
<view class="bg-white rounded-12 overflow-hidden">
|
||||
@@ -57,9 +62,9 @@ const props = defineProps({
|
||||
type: String,
|
||||
default: null,
|
||||
},
|
||||
reservationEnabled: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
orderData: {
|
||||
type: Object,
|
||||
default: () => ({}),
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
@@ -70,7 +70,7 @@
|
||||
v-model="quantity"
|
||||
:userFormList="userFormList"
|
||||
v-model:reservationDate="selectedReservationDate"
|
||||
:reservationEnabled="orderData.reservationEnabled"
|
||||
:orderData="orderData"
|
||||
/>
|
||||
|
||||
<!-- 酒店类型 -->
|
||||
@@ -220,7 +220,7 @@ const handlePayClick = ThrottleUtils.createThrottle(async (goodsData) => {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 校验用户姓名
|
||||
if (!validateUserForms()) {
|
||||
return;
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<view class="order-detail-wrapper border-box flex-full overflow-hidden scroll-y">
|
||||
<OrderStatusInfo :orderData="orderData" />
|
||||
|
||||
<VoucherList v-if="orderData.orderStatus === '2'" :orderData="orderData" @selected="handleSelectedVoucher" />
|
||||
<VoucherList v-if="orderData.orderType != 0 && orderData.orderStatus === '2'" :orderData="orderData" @selected="handleSelectedVoucher" />
|
||||
|
||||
<AmtSection :orderData="orderData" @click="refundVisible = true" />
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/long-answer/index",
|
||||
"path": "pages/ChatMain/ChatLongAnswer/index",
|
||||
"style": {
|
||||
"navigationStyle": "custom"
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
mode="aspectFit"
|
||||
/>
|
||||
<ChatMarkdown :key="textKey" :text="processedText" />
|
||||
<DotLoading v-if="isLoading" />
|
||||
<ChatLoading v-if="isLoading" />
|
||||
</view>
|
||||
<slot name="content"></slot>
|
||||
</view>
|
||||
@@ -20,7 +20,7 @@
|
||||
<script setup>
|
||||
import { defineProps, computed, ref, watch } from "vue";
|
||||
import ChatMarkdown from "../ChatMarkdown/index.vue";
|
||||
import DotLoading from "../../loading/DotLoading.vue";
|
||||
import ChatLoading from "../ChatLoading/index.vue";
|
||||
|
||||
const props = defineProps({
|
||||
text: {
|
||||
@@ -73,7 +73,7 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, computed, watch, nextTick, onMounted, defineExpose } from "vue";
|
||||
import { ref, computed, watch, nextTick, onMounted, defineExpose, onUnmounted } from "vue";
|
||||
import RecordingWaveBtn from "@/components/Speech/RecordingWaveBtn.vue";
|
||||
import { getCurrentConfig } from "@/constant/base";
|
||||
|
||||
@@ -97,12 +97,41 @@ const emit = defineEmits([
|
||||
|
||||
const textareaRef = ref(null);
|
||||
const recordingWaveBtnRef = ref(null);
|
||||
const placeholder = computed(() => getCurrentConfig().placeholder);
|
||||
const placeholder = computed(() => {
|
||||
const config = getCurrentConfig();
|
||||
return `快告诉${config.name}您在想什么~`;
|
||||
});
|
||||
const inputMessage = ref(props.modelValue || "");
|
||||
const isFocused = ref(false);
|
||||
const keyboardHeight = ref(0);
|
||||
const isVoiceMode = ref(false);
|
||||
const visibleWaveBtn = ref(false);
|
||||
const isRecording = ref(false);
|
||||
let watchDogTimer = null;
|
||||
|
||||
const resetUI = () => {
|
||||
isRecording.value = false;
|
||||
visibleWaveBtn.value = false;
|
||||
try {
|
||||
if (recordingWaveBtnRef.value) {
|
||||
recordingWaveBtnRef.value.stopAnimation();
|
||||
}
|
||||
} catch (e) {
|
||||
console.error("resetUI stopAnimation error", e);
|
||||
}
|
||||
if (watchDogTimer) {
|
||||
clearTimeout(watchDogTimer);
|
||||
watchDogTimer = null;
|
||||
}
|
||||
};
|
||||
|
||||
const startWatchDog = (timeout = 10000) => {
|
||||
if (watchDogTimer) clearTimeout(watchDogTimer);
|
||||
watchDogTimer = setTimeout(() => {
|
||||
console.warn("recording watchdog triggered, forcing UI reset");
|
||||
resetUI();
|
||||
}, timeout);
|
||||
};
|
||||
|
||||
// 保持和父组件同步
|
||||
watch(
|
||||
@@ -127,42 +156,65 @@ const toggleVoiceMode = () => {
|
||||
|
||||
// 处理语音按钮长按开始
|
||||
const handleVoiceTouchStart = () => {
|
||||
manager.start({ lang: "zh_CN" });
|
||||
try {
|
||||
manager.start({ lang: "zh_CN" });
|
||||
isRecording.value = true;
|
||||
visibleWaveBtn.value = true;
|
||||
|
||||
visibleWaveBtn.value = true;
|
||||
|
||||
// 启动音频条动画
|
||||
nextTick(() => {
|
||||
if (recordingWaveBtnRef.value) {
|
||||
recordingWaveBtnRef.value.startAnimation();
|
||||
}
|
||||
});
|
||||
// 启动音频条动画
|
||||
nextTick(() => {
|
||||
if (recordingWaveBtnRef.value) {
|
||||
recordingWaveBtnRef.value.startAnimation();
|
||||
}
|
||||
});
|
||||
startWatchDog(10000);
|
||||
} catch (err) {
|
||||
console.error("record start error:", err);
|
||||
// 保底清理
|
||||
resetUI();
|
||||
}
|
||||
};
|
||||
|
||||
// 处理语音按钮长按结束
|
||||
const handleVoiceTouchEnd = () => {
|
||||
manager.stop();
|
||||
|
||||
// 停止音频条动画
|
||||
if (recordingWaveBtnRef.value) {
|
||||
recordingWaveBtnRef.value.stopAnimation();
|
||||
// 如果本地状态不是录音中,也确保 UI 恢复
|
||||
if (!isRecording.value) {
|
||||
if (recordingWaveBtnRef.value) {
|
||||
recordingWaveBtnRef.value.stopAnimation();
|
||||
}
|
||||
visibleWaveBtn.value = false;
|
||||
if (watchDogTimer) {
|
||||
clearTimeout(watchDogTimer);
|
||||
watchDogTimer = null;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
visibleWaveBtn.value = false;
|
||||
try {
|
||||
manager.stop();
|
||||
} catch (err) {
|
||||
console.error("record stop error:", err);
|
||||
} finally {
|
||||
// 无论 stop 是否抛错,都保证 UI 恢复
|
||||
resetUI();
|
||||
}
|
||||
};
|
||||
|
||||
// 处理发送原语音
|
||||
const initRecord = () => {
|
||||
manager.onRecognize = (res) => {
|
||||
let text = res.result;
|
||||
let text = res.result || "";
|
||||
inputMessage.value = text;
|
||||
};
|
||||
// 识别结束事件
|
||||
manager.onStop = (res) => {
|
||||
console.log(res, 37);
|
||||
let text = res.result;
|
||||
let text = (res && res.result) || "";
|
||||
|
||||
if (text == "") {
|
||||
// 保证 UI 恢复(防止未走 handleVoiceTouchEnd)
|
||||
resetUI();
|
||||
|
||||
if (text === "") {
|
||||
console.log("没有说话");
|
||||
return;
|
||||
}
|
||||
@@ -171,6 +223,12 @@ const initRecord = () => {
|
||||
// 在语音识别完成后发送消息
|
||||
emit("send", text);
|
||||
};
|
||||
|
||||
// 错误处理,确保 UI 重置
|
||||
manager.onError = (err) => {
|
||||
console.error("record manager error", err);
|
||||
resetUI();
|
||||
};
|
||||
};
|
||||
|
||||
// 监听键盘高度变化
|
||||
@@ -188,6 +246,18 @@ onMounted(() => {
|
||||
initRecord();
|
||||
});
|
||||
|
||||
onUnmounted(() => {
|
||||
try {
|
||||
manager.stop && manager.stop();
|
||||
} catch (e) {
|
||||
// ignore
|
||||
}
|
||||
manager.onRecognize = null;
|
||||
manager.onStop = null;
|
||||
manager.onError = null;
|
||||
resetUI();
|
||||
});
|
||||
|
||||
const sendMessage = () => {
|
||||
if (props.isSessionActive) {
|
||||
// 如果会话进行中,调用停止请求函数
|
||||
195
src/pages/ChatMain/ChatLongAnswer/index.vue
Normal file
@@ -0,0 +1,195 @@
|
||||
<template>
|
||||
<view class="flex flex-col bg-liner h-screen overflow-hidden">
|
||||
<!-- ✅ 顶部固定导航 -->
|
||||
<view class="flex-shrink-0">
|
||||
<TopNavBar :title="title" background="transparent" />
|
||||
</view>
|
||||
|
||||
<!-- ✅ 滚动区域 -->
|
||||
<scroll-view class="flex-full overflow-hidden chat-scroll" scroll-y :scroll-into-view="scrollIntoViewId" scroll-with-animation @scroll="onScroll" @touchstart="onTouchStart" @touchend="onTouchEnd" @touchcancel="onTouchEnd">
|
||||
<view class="pt-12 px-12 pb-24 border-box">
|
||||
<!-- ✅ 内容,支持markdown -->
|
||||
<ChatMarkdown :text="answerText" />
|
||||
|
||||
<!-- ✅ 底部锚点(必须存在) -->
|
||||
<view id="bottom-anchor"></view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import TopNavBar from "@/components/TopNavBar/index.vue";
|
||||
import ChatMarkdown from "../ChatMarkdown/index.vue";
|
||||
import { defineProps, ref, nextTick } from "vue";
|
||||
import { onLoad, onUnload } from "@dcloudio/uni-app";
|
||||
import StreamManager from "@/utils/StreamManager.js";
|
||||
|
||||
const props = defineProps({
|
||||
answerText: {
|
||||
type: String,
|
||||
default: "",
|
||||
},
|
||||
});
|
||||
|
||||
const answerText = ref(props.answerText || "");
|
||||
const title = ref("");
|
||||
|
||||
let unsubscribe = null;
|
||||
|
||||
/** ✅ scroll-into-view 控制 */
|
||||
const scrollIntoViewId = ref("");
|
||||
|
||||
/** 滚动控制状态 */
|
||||
const isNearBottom = ref(true);
|
||||
const scrollViewHeight = ref(0);
|
||||
const SCROLL_THRESHOLD = 150; // px
|
||||
|
||||
/** 用户交互状态,用户滚动/触摸时临时禁用自动滚动 */
|
||||
const userInteracting = ref(false);
|
||||
let interactionTimer = null;
|
||||
|
||||
/** 是否已完成(从 URL 参数判断),完成状态下不初始初自动滚到底部 */
|
||||
let isFinishedOnInit = false;
|
||||
|
||||
/** ✅ 防抖 */
|
||||
let scrollTimer = null;
|
||||
|
||||
const measureScrollViewHeight = () => {
|
||||
try {
|
||||
// 使用 uni.createSelectorQuery 获取 scroll-view 的准确高度
|
||||
uni.createSelectorQuery()
|
||||
.select(".chat-scroll")
|
||||
.boundingClientRect((rect) => {
|
||||
if (rect && rect.height) {
|
||||
scrollViewHeight.value = rect.height;
|
||||
}
|
||||
})
|
||||
.exec();
|
||||
} catch (e) { }
|
||||
}
|
||||
|
||||
/** 生成展示用标题:去除前导 `#` 并截取前 6 字符(超过加省略号) */
|
||||
const computeTitle = (text = "") => {
|
||||
const t = (text || "").replace(/^#+\s*/, "");
|
||||
return t.length > 8 ? t.substring(0, 8) + "..." : t;
|
||||
}
|
||||
|
||||
const onScroll = (e) => {
|
||||
try {
|
||||
const { scrollTop = 0, scrollHeight = 0 } = e.detail || {};
|
||||
|
||||
// 计算距离底部的距离(使用准确的 scroll-view 高度)
|
||||
const viewHeight = scrollViewHeight.value;
|
||||
const distanceToBottom = scrollHeight - scrollTop - viewHeight;
|
||||
|
||||
// 判断是否在底部附近(允许 SCROLL_THRESHOLD 的误差范围)
|
||||
// 注意:只更新 isNearBottom,不在滚动时强制改变 userInteracting
|
||||
const atBottom = distanceToBottom <= SCROLL_THRESHOLD;
|
||||
isNearBottom.value = atBottom;
|
||||
} catch (e) { }
|
||||
}
|
||||
|
||||
const onTouchStart = () => {
|
||||
// 触摸开始时,立即标记为用户交互状态
|
||||
userInteracting.value = true;
|
||||
clearTimeout(interactionTimer);
|
||||
}
|
||||
|
||||
const onTouchEnd = () => {
|
||||
// 触摸结束后延迟一段时间再取消交互状态
|
||||
// 这样即使用户快速滚动,也不会被中途打断
|
||||
clearTimeout(interactionTimer);
|
||||
interactionTimer = setTimeout(() => {
|
||||
userInteracting.value = false;
|
||||
}, 600);
|
||||
}
|
||||
|
||||
const scrollToBottom = () => {
|
||||
if (scrollTimer) return;
|
||||
if (isFinishedOnInit) return;
|
||||
|
||||
scrollTimer = setTimeout(() => {
|
||||
// ❗关键:强制触发滚动(小程序必须这样)
|
||||
// 如果用户正在交互,则跳过本次自动滚动
|
||||
if (userInteracting.value) {
|
||||
scrollTimer = null;
|
||||
return;
|
||||
}
|
||||
|
||||
scrollIntoViewId.value = "";
|
||||
|
||||
nextTick(() => {
|
||||
// 再次 nextTick + 延迟,兼容 markdown 渲染延迟
|
||||
setTimeout(() => {
|
||||
scrollIntoViewId.value = "bottom-anchor";
|
||||
// 测量高度以便后续滚动判断准确
|
||||
measureScrollViewHeight();
|
||||
}, 50);
|
||||
});
|
||||
|
||||
scrollTimer = null;
|
||||
}, 100);
|
||||
}
|
||||
|
||||
onLoad(({ message = "", streamId = "", finished = "0" }) => {
|
||||
// 记录初始完成状态
|
||||
isFinishedOnInit = finished === "1";
|
||||
|
||||
console.log("LongAnswer onLoad with params:", { message, streamId, finished });
|
||||
|
||||
// 初次测量 scroll-view 高度
|
||||
nextTick(() => {
|
||||
measureScrollViewHeight();
|
||||
});
|
||||
|
||||
if (streamId) {
|
||||
// ✅ 流式数据
|
||||
unsubscribe = StreamManager.subscribe(
|
||||
streamId,
|
||||
(text = "", finished = false) => {
|
||||
answerText.value = text || "";
|
||||
title.value = computeTitle(answerText.value);
|
||||
|
||||
nextTick(() => {
|
||||
// 每次接收数据都重新测量高度(content size 可能变化,比如加载图)
|
||||
measureScrollViewHeight();
|
||||
|
||||
// 流式完成时强制滚动到底部
|
||||
if (finished) {
|
||||
scrollToBottom();
|
||||
}
|
||||
// 流式中的数据更新:只有在用户未交互且接近底部时才自动滚动
|
||||
else if (!userInteracting.value && isNearBottom.value) {
|
||||
scrollToBottom();
|
||||
}
|
||||
});
|
||||
}
|
||||
);
|
||||
} else {
|
||||
// ✅ 非流式
|
||||
answerText.value = decodeURIComponent(message || "");
|
||||
title.value = computeTitle(answerText.value);
|
||||
|
||||
nextTick(() => {
|
||||
// 只有在初始化为非完成状态时才自动滚到底部
|
||||
scrollToBottom();
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
onUnload(() => {
|
||||
try {
|
||||
unsubscribe && unsubscribe();
|
||||
} catch (e) { }
|
||||
// 清理定时器,避免内存泄漏
|
||||
try { clearTimeout(scrollTimer); } catch (e) { }
|
||||
try { clearTimeout(interactionTimer); } catch (e) { }
|
||||
scrollTimer = null;
|
||||
interactionTimer = null;
|
||||
});
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
@@ -185,6 +185,7 @@ import {
|
||||
NOTICE_EVENT_LOGIN_SUCCESS,
|
||||
} from "@/constant/constant";
|
||||
import { MessageRole, MessageType, CompName, Command } from "@/model/ChatModel";
|
||||
|
||||
import ChatTopWelcome from "../ChatTopWelcome/index.vue";
|
||||
import NoticeMessage from "../NoticeMessage/index.vue";
|
||||
import ChatTopNavBar from "../ChatTopNavBar/index.vue";
|
||||
@@ -193,15 +194,17 @@ import ChatCardMine from "../ChatCardMine/index.vue";
|
||||
import ChatCardOther from "../ChatCardOther/index.vue";
|
||||
import ChatQuickAccess from "../ChatQuickAccess/index.vue";
|
||||
import ChatInputArea from "../ChatInputArea/index.vue";
|
||||
import QuickBookingComponent from "../../module/QuickBookingComponent/index.vue";
|
||||
import DiscoveryCardComponent from "../../module/DiscoveryCardComponent/index.vue";
|
||||
import ActivityListComponent from "../../module/ActivityListComponent/index.vue";
|
||||
import RecommendPostsComponent from "../../module/RecommendPostsComponent/index.vue";
|
||||
import AttachListComponent from "../../module/AttachListComponent/index.vue";
|
||||
import DetailCardCompontent from "../../module/DetailCardCompontent/index.vue";
|
||||
import OpenMapComponent from "../../module/OpenMapComponent/index.vue";
|
||||
import AnswerComponent from "../../module/AnswerComponent/index.vue";
|
||||
import GeneratorPhotoComponent from "../../module/GeneratorPhotoComponent/index.vue";
|
||||
|
||||
import QuickBookingComponent from "../../ChatModule/QuickBookingComponent/index.vue";
|
||||
import DiscoveryCardComponent from "../../ChatModule/DiscoveryCardComponent/index.vue";
|
||||
import ActivityListComponent from "../../ChatModule/ActivityListComponent/index.vue";
|
||||
import RecommendPostsComponent from "../../ChatModule/RecommendPostsComponent/index.vue";
|
||||
import AttachListComponent from "../../ChatModule/AttachListComponent/index.vue";
|
||||
import DetailCardCompontent from "../../ChatModule/DetailCardCompontent/index.vue";
|
||||
import OpenMapComponent from "../../ChatModule/OpenMapComponent/index.vue";
|
||||
import AnswerComponent from "../../ChatModule/AnswerComponent/index.vue";
|
||||
import GeneratorPhotoComponent from "../../ChatModule/GeneratorPhotoComponent/index.vue";
|
||||
|
||||
import CreateServiceOrder from "@/components/CreateServiceOrder/index.vue";
|
||||
import Feedback from "@/components/Feedback/index.vue";
|
||||
import AddCarCrad from "@/components/AddCarCrad/index.vue";
|
||||
@@ -212,7 +215,7 @@ import {
|
||||
recentConversation,
|
||||
} from "@/request/api/ConversationApi";
|
||||
import WebSocketManager from "@/utils/WebSocketManager";
|
||||
import { ThrottleUtils, IdUtils } from "@/utils";
|
||||
import { IdUtils } from "@/utils";
|
||||
import { checkToken } from "@/hooks/useGoLogin";
|
||||
import { useAppStore } from "@/store";
|
||||
import { getAccessToken } from "@/constant/token";
|
||||
@@ -52,16 +52,14 @@ const initPageImages = computed(() => {
|
||||
return props.mainPageDataModel?.initPageImages || {};
|
||||
});
|
||||
|
||||
const config = getCurrentConfig();
|
||||
|
||||
const spriteStyle = computed(() => {
|
||||
const images = initPageImages.value;
|
||||
return {
|
||||
ipLargeImage: images.ipLargeImage ?? config.ipLargeImage,
|
||||
frameWidth: images.ipLargeImageWidth ?? config.ipLargeImageWidth,
|
||||
frameHeight: images.ipLargeImageHeight ?? config.ipLargeImageHeight,
|
||||
totalFrames: images.ipLargeTotalFrames ?? config.ipLargeTotalFrames,
|
||||
columns: images.ipLargeColumns ?? config.ipLargeColumns,
|
||||
ipLargeImage: images.ipLargeImage,
|
||||
frameWidth: images.ipLargeImageWidth,
|
||||
frameHeight: images.ipLargeImageHeight,
|
||||
totalFrames: images.ipLargeTotalFrames,
|
||||
columns: images.ipLargeColumns,
|
||||
displayWidth: 158,
|
||||
};
|
||||
});
|
||||
|
Before Width: | Height: | Size: 178 KiB After Width: | Height: | Size: 178 KiB |
@@ -14,7 +14,7 @@
|
||||
<!-- 超过3行时显示...提示 -->
|
||||
<view v-if="!finish" class="flex flex-row flex-items-center mt-8">
|
||||
<text class="font-size-12 font-400 font-color-600">正在生成</text>
|
||||
<DotLoading />
|
||||
<ChatLoading />
|
||||
</view>
|
||||
<view v-if="isOverflow" class="flex flex-row flex-items-center mt-8" @click="lookDetailAction">
|
||||
<text class="font-size-12 font-400 theme-color-500 mr-4">查看详情</text>
|
||||
@@ -29,8 +29,8 @@
|
||||
<script setup>
|
||||
import { defineProps, computed, ref, watch, onBeforeUnmount } from "vue";
|
||||
|
||||
import ChatMarkdown from "../../chat/ChatMarkdown/index.vue";
|
||||
import DotLoading from "../../loading/DotLoading.vue";
|
||||
import ChatMarkdown from "../../ChatMain/ChatMarkdown/index.vue";
|
||||
import ChatLoading from "../../ChatMain/ChatLoading/index.vue";
|
||||
import StreamManager from '@/utils/StreamManager.js';
|
||||
|
||||
const isOverflow = ref(false)
|
||||
@@ -124,7 +124,8 @@ const lookDetailAction = () => {
|
||||
} catch (e) {}
|
||||
});
|
||||
|
||||
uni.navigateTo({ url: `/pages/long-answer/index?streamId=${encodeURIComponent(streamId)}` });
|
||||
// 传递 finished 参数,完成状态下不自动滚到底部
|
||||
uni.navigateTo({ url: `/pages/ChatMain/ChatLongAnswer/index?streamId=${encodeURIComponent(streamId)}&finished=${props.finish ? '1' : '0'}` });
|
||||
}
|
||||
|
||||
</script>
|
||||
|
Before Width: | Height: | Size: 532 KiB After Width: | Height: | Size: 532 KiB |
|
Before Width: | Height: | Size: 5.9 KiB After Width: | Height: | Size: 5.9 KiB |
@@ -33,7 +33,7 @@
|
||||
}
|
||||
|
||||
.date-item.active {
|
||||
background-color: #00a6ff;
|
||||
background-color: $theme-color-500;
|
||||
}
|
||||
.date-item.active .label,
|
||||
.date-item.active .date {
|
||||
@@ -185,7 +185,7 @@
|
||||
.confirm-btn {
|
||||
width: 160px;
|
||||
height: 48px;
|
||||
background: linear-gradient(179deg, #00a6ff 0%, #0256ff 100%);
|
||||
background: linear-gradient(179deg, $theme-color-500 0%, $theme-color-700 100%);
|
||||
color: #fff;
|
||||
border: none;
|
||||
border-radius: 24px;
|
||||
|
||||
@@ -25,10 +25,10 @@ import { ref, onUnmounted } from "vue";
|
||||
import { getUrlParams } from "@/utils/UrlParams";
|
||||
import { useAppStore } from "@/store";
|
||||
import { checkToken } from "@/hooks/useGoLogin";
|
||||
import ChatMainList from "./components/chat/ChatMainList/index.vue";
|
||||
import ChatMainList from "../ChatMain/ChatMainList/index.vue";
|
||||
import MoreService from "../ChatModule/MoreService/index.vue";
|
||||
import DrawerSection from "../DrawerSection/index.vue";
|
||||
import Calender from "@/components/Calender/index.vue";
|
||||
import MoreService from "./components/module/MoreService/index.vue";
|
||||
import DrawerSection from "./components/DrawerSection/index.vue";
|
||||
|
||||
const appStore = useAppStore();
|
||||
|
||||
|
||||
|
Before Width: | Height: | Size: 139 KiB |
|
Before Width: | Height: | Size: 387 KiB |
|
Before Width: | Height: | Size: 11 KiB |
|
Before Width: | Height: | Size: 171 KiB |
|
Before Width: | Height: | Size: 29 KiB |
@@ -1,104 +0,0 @@
|
||||
<template>
|
||||
<view class="flex flex-col bg-liner h-screen overflow-hidden">
|
||||
<!-- ✅ 顶部固定导航 -->
|
||||
<view class="flex-shrink-0">
|
||||
<TopNavBar :title="title" background="transparent" />
|
||||
</view>
|
||||
|
||||
<!-- ✅ 滚动区域 -->
|
||||
<scroll-view class="flex-full overflow-hidden" scroll-y :scroll-into-view="scrollIntoViewId" scroll-with-animation>
|
||||
<view class="pt-12 px-12 pb-24 border-box">
|
||||
<!-- ✅ 答案内容,支持markdown -->
|
||||
<ChatMarkdown :text="answerText" />
|
||||
|
||||
<!-- ✅ 底部锚点(必须存在) -->
|
||||
<view id="bottom-anchor"></view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import TopNavBar from "@/components/TopNavBar/index.vue";
|
||||
import ChatMarkdown from "../index/components/chat/ChatMarkdown/index.vue";
|
||||
import { defineProps, ref, nextTick } from "vue";
|
||||
import { onLoad, onUnload } from "@dcloudio/uni-app";
|
||||
import StreamManager from "@/utils/StreamManager.js";
|
||||
|
||||
const props = defineProps({
|
||||
answerText: {
|
||||
type: String,
|
||||
default: "",
|
||||
},
|
||||
});
|
||||
|
||||
const answerText = ref(props.answerText || "");
|
||||
const title = ref("");
|
||||
|
||||
let unsubscribe = null;
|
||||
|
||||
/** ✅ scroll-into-view 控制 */
|
||||
const scrollIntoViewId = ref("");
|
||||
|
||||
/** ✅ 防抖 */
|
||||
let scrollTimer = null;
|
||||
|
||||
function scrollToBottom() {
|
||||
if (scrollTimer) return;
|
||||
|
||||
scrollTimer = setTimeout(() => {
|
||||
// ❗关键:强制触发滚动(小程序必须这样)
|
||||
scrollIntoViewId.value = "";
|
||||
|
||||
nextTick(() => {
|
||||
// 再次 nextTick + 延迟,兼容 markdown 渲染延迟
|
||||
setTimeout(() => {
|
||||
scrollIntoViewId.value = "bottom-anchor";
|
||||
}, 50);
|
||||
});
|
||||
|
||||
scrollTimer = null;
|
||||
}, 100);
|
||||
}
|
||||
|
||||
onLoad(({ message = "", streamId = "" }) => {
|
||||
if (streamId) {
|
||||
// ✅ 流式数据
|
||||
unsubscribe = StreamManager.subscribe(
|
||||
streamId,
|
||||
(text = "", finished = false) => {
|
||||
answerText.value = text || "";
|
||||
|
||||
if (answerText.value.length > 6) {
|
||||
title.value = answerText.value.substring(0, 6) + "...";
|
||||
}
|
||||
|
||||
nextTick(() => {
|
||||
scrollToBottom();
|
||||
});
|
||||
}
|
||||
);
|
||||
} else {
|
||||
// ✅ 非流式
|
||||
answerText.value = decodeURIComponent(message || "");
|
||||
|
||||
if (answerText.value.length > 6) {
|
||||
title.value = answerText.value.substring(0, 6) + "...";
|
||||
}
|
||||
|
||||
nextTick(() => {
|
||||
scrollToBottom();
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
onUnload(() => {
|
||||
try {
|
||||
unsubscribe && unsubscribe();
|
||||
} catch (e) { }
|
||||
});
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
@@ -4,15 +4,15 @@ import { devUrl, wssDevUrl } from "./baseUrl";
|
||||
import { getServiceUrl } from "../api/GetServiceUrlApi";
|
||||
|
||||
/// 版本号, 每次发版本前增加
|
||||
const versionValue = "1.0.4";
|
||||
const versionValue = "1.1.1";
|
||||
|
||||
/// 是否是测试版本, 测试版本为true, 发布版本为false
|
||||
const developVersion = true;
|
||||
const developVersion = false;
|
||||
|
||||
// 获取服务地址
|
||||
const getEvnUrl = async () => {
|
||||
/// 智念客户端不需要获取环境地址
|
||||
if (isZhiNian || developVersion) {
|
||||
/// 不需要获取环境地址
|
||||
if (developVersion) {
|
||||
const appStore = useAppStore();
|
||||
appStore.setServerConfig({
|
||||
baseUrl: devUrl, // 服务器基础地址
|
||||
|
||||