feat: 格式化代码

This commit is contained in:
2025-08-27 18:37:50 +08:00
parent 9de068e7fc
commit 0e51fdcd69
21 changed files with 1502 additions and 1522 deletions

View File

@@ -1,8 +1,12 @@
<template>
<view class="container">
<view class="chat-ai">
<view class="loading-container" >
<image v-if="isLoading" class="loading-img" src="/static/msg_loading.svg" />
<view class="loading-container">
<image
v-if="isLoading"
class="loading-img"
src="/static/msg_loading.svg"
/>
<ChatMarkdown :key="textKey" :text="processedText" />
</view>
<slot name="content"></slot>
@@ -89,5 +93,4 @@ watch(
width: 32px;
height: 32px;
}
</style>

View File

@@ -6,26 +6,25 @@
</template>
<script setup>
import { defineProps } from "vue";
defineProps({
import { defineProps } from "vue";
defineProps({
text: {
type: String,
default: ''
}
})
default: "",
},
});
</script>
<style lang="scss" scoped>
.chat-mine {
.chat-mine {
margin: 6px 12px;
padding: 8px 16px;
background-color: #00A6FF;
box-shadow: 2px 2px 10px 0px rgba(0,0,0,0.1);
background-color: #00a6ff;
box-shadow: 2px 2px 10px 0px rgba(0, 0, 0, 0.1);
border-radius: 20px 4px 20px 20px;
border: 1px solid;
border-color: #FFFFFF;
border-color: #ffffff;
display: flex;
flex-direction: column;
@@ -36,11 +35,11 @@
font-family: PingFang SC, PingFang SC;
font-weight: 400;
font-size: 14px;
color: #FFFFFF;
color: #ffffff;
line-height: 22px;
text-align: justify;
font-style: normal;
text-transform: none;
}
}
}
</style>

View File

@@ -6,17 +6,17 @@
</template>
<script setup>
import { defineProps } from "vue";
defineProps({
import { defineProps } from "vue";
defineProps({
text: {
type: String,
default: ''
}
})
default: "",
},
});
</script>
<style lang="scss" scoped>
.chat-other {
.chat-other {
width: 100%;
margin: 6px 0;
padding: 0 12px;
@@ -31,6 +31,5 @@
font-size: 14px;
color: #333333;
}
}
}
</style>

View File

@@ -3,10 +3,7 @@
<view v-if="!visibleWaveBtn" class="area-input">
<!-- 语音/键盘切换 -->
<view class="input-container-voice" @click="toggleVoiceMode">
<image
v-if="!isVoiceMode"
src="/static/input_voice_icon.png"
></image>
<image v-if="!isVoiceMode" src="/static/input_voice_icon.png"></image>
<image v-else src="/static/input_keyboard_icon.png"></image>
</view>

View File

@@ -38,9 +38,7 @@
<template v-if="item.msgType === MessageRole.AI">
<ChatCardAI
class="message-item-ai"
:key="`ai-${item.msgId}-${
item.msg ? item.msg.length : 0
}`"
:key="`ai-${item.msgId}-${item.msg ? item.msg.length : 0}`"
:text="item.msg || ''"
,
:isLoading="item.isLoading"
@@ -48,26 +46,21 @@
<template #content v-if="item.toolCall">
<QuickBookingComponent
v-if="
item.toolCall.componentName ===
CompName.quickBookingCard
item.toolCall.componentName === CompName.quickBookingCard
"
/>
<DiscoveryCardComponent
v-else-if="
item.toolCall.componentName ===
CompName.discoveryCard
item.toolCall.componentName === CompName.discoveryCard
"
/>
<CreateServiceOrder
v-else-if="
item.toolCall.componentName ===
CompName.createWorkOrderCard
item.toolCall.componentName === CompName.createWorkOrderCard
"
/>
<DetailCardCompontent
v-else-if="
item.toolCall.componentName === ''
"
v-else-if="item.toolCall.componentName === ''"
:toolCall="item.toolCall"
/>
</template>
@@ -84,18 +77,12 @@
</template>
<template v-else-if="item.msgType === MessageRole.ME">
<ChatCardMine
class="message-item-mine"
:text="item.msg"
>
<ChatCardMine class="message-item-mine" :text="item.msg">
</ChatCardMine>
</template>
<template v-else>
<ChatCardOther
class="message-item-other"
:text="item.msg"
>
<ChatCardOther class="message-item-other" :text="item.msg">
<ChatMoreTips
@replySent="handleReply"
:itemList="mainPageDataModel.guideWords"
@@ -107,12 +94,8 @@
/>
<RecommendPostsComponent
v-if="
mainPageDataModel.recommendTheme.length > 0
"
:recommendThemeList="
mainPageDataModel.recommendTheme
"
v-if="mainPageDataModel.recommendTheme.length > 0"
:recommendThemeList="mainPageDataModel.recommendTheme"
/>
</ChatCardOther>
</template>
@@ -353,6 +336,15 @@ onMounted(async () => {
addNoticeListener();
initTypewriterManager();
initWebSocket();
uni.getProvider({
service: "oauth",
success: (res) => {
console.log("getProvider success", res);
},
fail: (err) => {
console.log("getProvider fail", err);
},
});
} catch (error) {
console.error("页面初始化错误:", error);
}
@@ -527,7 +519,7 @@ const initTypewriterManager = () => {
typewriterManager = new TypewriterManager({
typingSpeed: 30,
cursorText: '',
cursorText: "",
});
// 设置回调函数

View File

@@ -1,21 +1,18 @@
<template>
<view>
<zero-markdown-view :markdown="text" :aiMode='true'></zero-markdown-view>
<zero-markdown-view :markdown="text" :aiMode="true"></zero-markdown-view>
</view>
</template>
<script setup>
import { defineProps } from "vue";
import { defineProps } from "vue";
defineProps({
defineProps({
text: {
type: String,
default: ''
}
})
default: "",
},
});
</script>
<style scoped>
</style>
<style scoped></style>

View File

@@ -16,9 +16,7 @@
<image :src="item.icon"></image>
<text>{{ item.title }}</text>
</view>
<text class="quick-access-item-content">{{
item.content
}}</text>
<text class="quick-access-item-content">{{ item.content }}</text>
</view>
</view>
</view>

View File

@@ -1,20 +1,18 @@
<template>
<view class="top-bg">
</view>
<view class="top-bg"> </view>
</template>
<script>
</script>
<script></script>
<style lang="scss" scoped>
.top-bg {
.top-bg {
width: 100%;
height: 270px;
overflow: hidden;
background: linear-gradient( 180deg, #42ADF9 0%, #6CD1FF 51%, #E9F3F7 99%);
background: linear-gradient(180deg, #42adf9 0%, #6cd1ff 51%, #e9f3f7 99%);
.top-bg-img {
width: 100%;
height: 100%;
}
}
}
</style>

View File

@@ -7,29 +7,27 @@
<uni-drawer ref="showLeft" mode="left" :width="320">
<DrawerHome @closeDrawer="closeDrawer('showLeft')" />
</uni-drawer>
</view>
</template>
<script setup>
import { defineEmits, ref } from 'vue'
import DrawerHome from "@/pages/drawer/DrawerHome.vue";
import { defineEmits, ref } from "vue";
import DrawerHome from "@/pages/drawer/DrawerHome.vue";
const showLeft = ref(false)
// 打开窗口
const showDrawer = (e) => {
showLeft.value.open()
}
// 关闭窗口
const closeDrawer = (e) => {
showLeft.value.close()
}
const showLeft = ref(false);
// 打开窗口
const showDrawer = (e) => {
showLeft.value.open();
};
// 关闭窗口
const closeDrawer = (e) => {
showLeft.value.close();
};
</script>
<style lang="scss" scoped>
.nav-bar {
.nav-bar {
display: flex;
align-items: center;
height: 44px;
@@ -44,5 +42,5 @@
width: 100%;
height: 100%;
}
}
}
</style>

View File

@@ -6,10 +6,7 @@
class="top-item-left"
:src="initPageImages.welcomeImageUrl"
></image>
<image
class="top-item-right"
:src="initPageImages.logoImageUrl"
></image>
<image class="top-item-right" :src="initPageImages.logoImageUrl"></image>
</view>
<ChatCardAI v-if="welcomeContent.length" :text="welcomeContent" />
</view>

View File

@@ -1,7 +1,7 @@
.chat-container {
width: 100vw;
height: 100vh;
background-color: #E9F3F7;
background-color: #e9f3f7;
display: flex;
flex-direction: column;
@@ -17,7 +17,7 @@
right: 0;
z-index: 0;
height: 270px;
background: linear-gradient( 180deg, #42ADF9 0%, #6CD1FF 51%, #E9F3F7 99%);
background: linear-gradient(180deg, #42adf9 0%, #6cd1ff 51%, #e9f3f7 99%);
}
.chat-content {
@@ -64,13 +64,13 @@
justify-content: center;
}
}
}
}
.footer-area {
.footer-area {
width: 100vw;
flex-shrink: 0;
padding: 4px 0 20px 0; /* 直接设置20px底部安全距离 */
background-color: #E9F3F7;
background-color: #e9f3f7;
touch-action: pan-x;
overflow-x: auto;
overflow-y: hidden;
@@ -82,14 +82,14 @@
/* 确保输入区域始终可见 */
// transform: translateZ(0);
// -webkit-transform: translateZ(0);
}
}
.area-input {
.area-input {
display: flex;
align-items: center;
border-radius: 22px;
background-color: #FFFFFF;
box-shadow: 0px 0px 20px 0px rgba(52,25,204,0.05);
background-color: #ffffff;
box-shadow: 0px 0px 20px 0px rgba(52, 25, 204, 0.05);
margin: 0 12px;
.input-container-voice {
@@ -131,23 +131,25 @@
margin-bottom: 2px;
align-items: center;
}
}
}
// 打字机光标闪烁动画
.typing-cursor {
// 打字机光标闪烁动画
.typing-cursor {
display: inline-block;
color: #42ADF9;
color: #42adf9;
font-weight: bold;
font-size: 1.2em;
animation: blink 1s infinite;
margin-left: 2px;
}
}
@keyframes blink {
0%, 50% {
@keyframes blink {
0%,
50% {
opacity: 1;
}
51%, 100% {
51%,
100% {
opacity: 0;
}
}
}

View File

@@ -1,35 +1,39 @@
<template>
<view class="drawer-home">
<view class="drawer-home-nav">
<uni-icons type="closeempty" size="22" color="#333333" class="close-icon" @click="closeDrawer"></uni-icons>
<uni-icons
type="closeempty"
size="22"
color="#333333"
class="close-icon"
@click="closeDrawer"
></uni-icons>
<text class="title">我的</text>
</view>
<MineSetting/>
<MineSetting />
</view>
</template>
<script setup>
import MineSetting from './MineSetting.vue'
import { defineEmits } from 'vue'
const emits = defineEmits(['closeDrawer'])
const closeDrawer = () => {
emits('closeDrawer')
}
import MineSetting from "./MineSetting.vue";
import { defineEmits } from "vue";
const emits = defineEmits(["closeDrawer"]);
const closeDrawer = () => {
emits("closeDrawer");
};
</script>
<style lang="scss" scoped>
.drawer-home {
.drawer-home {
width: 100%;
height: 100vh;
background-color: #fff;
padding-top: 44px;
}
}
.drawer-home-nav {
.drawer-home-nav {
position: relative;
padding: 12px;
display: flex;
@@ -46,5 +50,5 @@
position: absolute;
left: 12px; /* 距离左边12px */
}
}
}
</style>

View File

@@ -36,60 +36,64 @@
</template>
<script setup>
import { ref, onMounted } from 'vue'
import { getLoginUserPhone } from '@/request/api/LoginApi'
import { ref, onMounted } from "vue";
import { getLoginUserPhone } from "@/request/api/LoginApi";
// 假数据
const userInfo = ref({
avatar: '/static/default-avatar.png',
nickname: '微信用户',
phone: ''
})
avatar: "/static/default-avatar.png",
nickname: "微信用户",
phone: "",
});
// 功能菜单列表(带 type 区分操作类型)
const menuList = ref([
// { label: '修改手机号', type: 'navigate', url: '/pages/change-phone/change-phone' },
{ label: '账号注销', type: 'navigate', url: '/pages/cancel-account/cancel-account' },
{
label: "账号注销",
type: "navigate",
url: "/pages/cancel-account/cancel-account",
},
// { label: '营业资质&协议', type: 'navigate', url: '/pages/agreement/agreement' },
{ label: '联系客服', type: 'action', action: 'contactService' }
])
{ label: "联系客服", type: "action", action: "contactService" },
]);
// 生命周期钩子
onMounted(() => {
getLoginUserPhoneInfo()
})
getLoginUserPhoneInfo();
});
const getLoginUserPhoneInfo = async () => {
const res = await getLoginUserPhone()
const res = await getLoginUserPhone();
if (res.code === 0) {
userInfo.value.phone = res.data
userInfo.value.phone = res.data;
}
}
};
// 处理菜单点击
const handleMenuClick = (item) => {
if (item.type === 'navigate' && item.url) {
uni.navigateTo({ url: item.url })
} else if (item.type === 'action') {
if (item.action === 'contactService') {
uni.showToast({ title: '联系客服功能待实现', icon: 'none' })
if (item.type === "navigate" && item.url) {
uni.navigateTo({ url: item.url });
} else if (item.type === "action") {
if (item.action === "contactService") {
uni.showToast({ title: "联系客服功能待实现", icon: "none" });
}
}
}
};
// 退出登录
const handleLogout = () => {
uni.showModal({
title: '温馨提示',
content: '确定要退出登录吗?',
title: "温馨提示",
content: "确定要退出登录吗?",
success: (res) => {
if (res.confirm) {
uni.clearStorageSync()
uni.reLaunch({ url: '/pages/login/index' })
uni.clearStorageSync();
uni.reLaunch({ url: "/pages/login/index" });
}
}
})
}
},
});
};
</script>
<style scoped>

View File

@@ -12,32 +12,31 @@
</template>
<script setup>
import { ref, nextTick, defineEmits } from 'vue'
import { onMounted } from 'vue'
import { SCROLL_TO_BOTTOM } from '@/constant/constant'
import { ref, nextTick, defineEmits } from "vue";
import { onMounted } from "vue";
import { SCROLL_TO_BOTTOM } from "@/constant/constant";
const props = defineProps({
question: {
type: String,
default: ''
}
})
default: "",
},
});
const tags = ref([])
const emits = defineEmits(['replySent']);
const tags = ref([]);
const emits = defineEmits(["replySent"]);
const handleClick = (item) => {
emits('replySent', item)
}
emits("replySent", item);
};
onMounted(() => {
tags.value = props.question.split(/[&|;]/).filter(tag => tag.trim() !== '')
tags.value = props.question.split(/[&|;]/).filter((tag) => tag.trim() !== "");
nextTick(() => {
setTimeout(() => {
uni.$emit(SCROLL_TO_BOTTOM, true)
}, 300)
uni.$emit(SCROLL_TO_BOTTOM, true);
}, 300);
});
})
});
</script>
<style scoped lang="scss">
@@ -59,7 +58,7 @@ onMounted(() => {
}
.tag-text {
color: #00A6FF; /* 蓝色文字,可根据设计调整 */
color: #00a6ff; /* 蓝色文字,可根据设计调整 */
font-size: 14px;
}
</style>

View File

@@ -1,12 +1,15 @@
<template>
<view class="container">
<swiper class="swiper" circular
<swiper
class="swiper"
circular
:indicator-dots="activityList.length > 1"
indicator-color="#FFFFFF"
indicator-active-color="#00A6FF"
:autoplay="autoplay"
:interval="interval"
:duration="duration">
:duration="duration"
>
<swiper-item v-for="item in activityList" :key="item.id">
<view class="swiper-item" @click="handleClick(item)">
<image :src="item.activityCover" mode="aspectFill"></image>
@@ -14,33 +17,31 @@
</view>
</swiper-item>
</swiper>
</view>
</template>
<script setup>
import { ref } from 'vue'
import { SEND_COMMAND_TEXT } from '@/constant/constant'
import { ref } from "vue";
import { SEND_COMMAND_TEXT } from "@/constant/constant";
const autoplay = ref(true)
const interval = ref(3000)
const duration = ref(500)
const autoplay = ref(true);
const interval = ref(3000);
const duration = ref(500);
const props = defineProps({
const props = defineProps({
activityList: {
type: Array,
default: []
}
})
const handleClick = (item) => {
uni.$emit(SEND_COMMAND_TEXT, '快速预定')
}
default: [],
},
});
const handleClick = (item) => {
uni.$emit(SEND_COMMAND_TEXT, "快速预定");
};
</script>
<style scoped lang="scss">
.container {
.container {
margin-bottom: 6px;
.uni-margin-wrap {
@@ -77,6 +78,5 @@
line-height: 1.5;
}
}
}
}
</style>

View File

@@ -22,7 +22,6 @@
<text class="calendar-text">日历</text>
</view>
</view>
</view>
</template>

View File

@@ -8,23 +8,21 @@
<template v-if="toolCall.commodityList">
<DetailCardGoodsContentList :commodityList="toolCall.commodityList" />
</template>
</view>
</template>
<script setup>
import { defineProps } from 'vue'
import ModuleTitle from '@/components/ModuleTitle/index.vue'
import ImageSwiper from '@/components/ImageSwiper/index.vue'
import DetailCardGoodsContentList from './DetailCardGoodsContentList.vue'
import { defineProps } from "vue";
import ModuleTitle from "@/components/ModuleTitle/index.vue";
import ImageSwiper from "@/components/ImageSwiper/index.vue";
import DetailCardGoodsContentList from "./DetailCardGoodsContentList.vue";
const props = defineProps({
const props = defineProps({
toolCall: {
type: Object,
default: {}
}
})
default: {},
},
});
</script>
<style scoped lang="scss">
@@ -32,5 +30,4 @@
width: 100%;
padding: 12px 0;
}
</style>

View File

@@ -7,37 +7,36 @@
</template>
<script setup>
import { ref, nextTick } from 'vue'
import { onMounted } from 'vue'
import { discoveryCradComponent } from '@/request/api/MainPageDataApi'
import RecommendPostsList from '../recommend/RecommendPostsList.vue'
import { SCROLL_TO_BOTTOM } from '@/constant/constant'
import { ref, nextTick } from "vue";
import { onMounted } from "vue";
import { discoveryCradComponent } from "@/request/api/MainPageDataApi";
import RecommendPostsList from "../recommend/RecommendPostsList.vue";
import { SCROLL_TO_BOTTOM } from "@/constant/constant";
const themeDTOList = ref([])
const themeDTOList = ref([]);
const loadDiscoveryCradComponent = async () => {
const res = await discoveryCradComponent()
if(res.code === 0 && res.data) {
themeDTOList.value = res.data.themeDTOList
const loadDiscoveryCradComponent = async () => {
const res = await discoveryCradComponent();
if (res.code === 0 && res.data) {
themeDTOList.value = res.data.themeDTOList;
nextTick(() => {
setTimeout(() => {
uni.$emit(SCROLL_TO_BOTTOM, true)
}, 300)
uni.$emit(SCROLL_TO_BOTTOM, true);
}, 300);
});
}
}
onMounted(() => {
loadDiscoveryCradComponent()
})
};
onMounted(() => {
loadDiscoveryCradComponent();
});
</script>
<style scoped lang="scss">
.container {
.container {
width: 100%;
flex: 1;
margin-bottom: 12px;
}
}
</style>

View File

@@ -7,23 +7,21 @@
</template>
<script setup>
import RecommendPostsList from './RecommendPostsList.vue';
import RecommendPostsList from "./RecommendPostsList.vue";
import { defineProps } from 'vue'
const props = defineProps({
import { defineProps } from "vue";
const props = defineProps({
recommendThemeList: {
type: Array,
default: []
}
})
default: [],
},
});
</script>
<style scoped lang="scss">
.container {
.container {
width: 100%;
flex: 1;
margin-bottom: 12px;
}
}
</style>