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

@@ -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() !== '')
nextTick(() => {
setTimeout(() => {
uni.$emit(SCROLL_TO_BOTTOM, true)
}, 300)
});
})
tags.value = props.question.split(/[&|;]/).filter((tag) => tag.trim() !== "");
nextTick(() => {
setTimeout(() => {
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,82 +1,82 @@
<template>
<view class="container">
<swiper class="swiper" circular
:indicator-dots="activityList.length > 1"
indicator-color="#FFFFFF"
indicator-active-color="#00A6FF"
:autoplay="autoplay"
:interval="interval"
: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>
<view class="corner-btn">快速预定</view>
</view>
</swiper-item>
</swiper>
</view>
<view class="container">
<swiper
class="swiper"
circular
:indicator-dots="activityList.length > 1"
indicator-color="#FFFFFF"
indicator-active-color="#00A6FF"
:autoplay="autoplay"
:interval="interval"
: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>
<view class="corner-btn">快速预定</view>
</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({
activityList: {
type: Array,
default: []
}
})
const handleClick = (item) => {
uni.$emit(SEND_COMMAND_TEXT, '快速预定')
}
const props = defineProps({
activityList: {
type: Array,
default: [],
},
});
const handleClick = (item) => {
uni.$emit(SEND_COMMAND_TEXT, "快速预定");
};
</script>
<style scoped lang="scss">
.container {
margin-bottom: 6px;
.uni-margin-wrap {
width: 100%;
}
.swiper {
height: 120px;
border-radius: 8px;
}
.swiper-item {
position: relative;
display: block;
height: 120px;
line-height: 120px;
text-align: center;
image {
width: 100%;
height: 100%;
border-radius: 8px;
display: block;
}
.corner-btn {
position: absolute;
right: 12px;
bottom: 12px;
background-color: #ffeb00;
color: #333;
font-size: 14px;
font-weight: 500;
padding: 4px 12px;
border-radius: 20px;
line-height: 1.5;
}
}
}
</style>
.container {
margin-bottom: 6px;
.uni-margin-wrap {
width: 100%;
}
.swiper {
height: 120px;
border-radius: 8px;
}
.swiper-item {
position: relative;
display: block;
height: 120px;
line-height: 120px;
text-align: center;
image {
width: 100%;
height: 100%;
border-radius: 8px;
display: block;
}
.corner-btn {
position: absolute;
right: 12px;
bottom: 12px;
background-color: #ffeb00;
color: #333;
font-size: 14px;
font-weight: 500;
padding: 4px 12px;
border-radius: 20px;
line-height: 1.5;
}
}
}
</style>

View File

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

View File

@@ -71,4 +71,4 @@ onMounted(() => {
width: 100%;
}
}
</style>
</style>

View File

@@ -1,36 +1,33 @@
<template>
<view class="container">
<template v-if="toolCall.picture && toolCall.picture.length > 0">
<ModuleTitle :title="图片详情" />
<ImageSwiper :images="toolCall.picture" />
</template>
<view class="container">
<template v-if="toolCall.picture && toolCall.picture.length > 0">
<ModuleTitle :title="图片详情" />
<ImageSwiper :images="toolCall.picture" />
</template>
<template v-if="toolCall.commodityList">
<DetailCardGoodsContentList :commodityList="toolCall.commodityList" />
</template>
</view>
<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'
const props = defineProps({
toolCall: {
type: Object,
default: {}
}
})
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({
toolCall: {
type: Object,
default: {},
},
});
</script>
<style scoped lang="scss">
.container {
width: 100%;
padding: 12px 0;
width: 100%;
padding: 12px 0;
}
</style>

View File

@@ -1,43 +1,42 @@
<template>
<view class="container">
<view v-for="item in themeDTOList" :key="item.title">
<RecommendPostsList :recommendTheme="item" />
</view>
</view>
<view class="container">
<view v-for="item in themeDTOList" :key="item.title">
<RecommendPostsList :recommendTheme="item" />
</view>
</view>
</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
nextTick(() => {
setTimeout(() => {
uni.$emit(SCROLL_TO_BOTTOM, true)
}, 300)
});
}
}
const loadDiscoveryCradComponent = async () => {
const res = await discoveryCradComponent();
if (res.code === 0 && res.data) {
themeDTOList.value = res.data.themeDTOList;
onMounted(() => {
loadDiscoveryCradComponent()
})
nextTick(() => {
setTimeout(() => {
uni.$emit(SCROLL_TO_BOTTOM, true);
}, 300);
});
}
};
onMounted(() => {
loadDiscoveryCradComponent();
});
</script>
<style scoped lang="scss">
.container {
width: 100%;
flex: 1;
margin-bottom: 12px;
}
</style>
.container {
width: 100%;
flex: 1;
margin-bottom: 12px;
}
</style>

View File

@@ -1,18 +1,18 @@
<template>
<view class="container">
<ModuleTitle :title="recommendTheme.themeName" />
<view class="container-scroll">
<view
v-for="(item, index) in recommendTheme.recommendPostsList"
:key="index"
>
<view class="mk-card-item" @click="sendReply(item)">
<image :src="item.coverPhoto" mode="widthFix"></image>
<text>{{ item.topic }}</text>
</view>
</view>
<view class="container">
<ModuleTitle :title="recommendTheme.themeName" />
<view class="container-scroll">
<view
v-for="(item, index) in recommendTheme.recommendPostsList"
:key="index"
>
<view class="mk-card-item" @click="sendReply(item)">
<image :src="item.coverPhoto" mode="widthFix"></image>
<text>{{ item.topic }}</text>
</view>
</view>
</view>
</view>
</template>
<script setup>
@@ -20,48 +20,48 @@ import ModuleTitle from "@/components/ModuleTitle/index.vue";
import { RECOMMEND_POSTS_TITLE } from "@/constant/constant";
import { defineProps } from "vue";
const props = defineProps({
recommendTheme: {
type: Object,
default: {},
},
recommendTheme: {
type: Object,
default: {},
},
});
const sendReply = (item) => {
const topic = item.userInputContent || item.topic.replace(/^#/, "");
uni.$emit(RECOMMEND_POSTS_TITLE, topic);
const topic = item.userInputContent || item.topic.replace(/^#/, "");
uni.$emit(RECOMMEND_POSTS_TITLE, topic);
};
</script>
<style lang="scss" scoped>
.container {
.container-scroll {
display: flex;
flex-direction: row;
overflow-x: auto;
margin-top: 4px;
.container-scroll {
display: flex;
flex-direction: row;
overflow-x: auto;
margin-top: 4px;
.mk-card-item {
display: flex;
flex-direction: column;
align-items: start;
width: 188px;
height: 154px;
background-color: #ffffff;
border-radius: 10px;
margin-right: 8px;
.mk-card-item {
display: flex;
flex-direction: column;
align-items: start;
width: 188px;
height: 154px;
background-color: #ffffff;
border-radius: 10px;
margin-right: 8px;
image {
width: 188px;
height: 112px;
}
text {
padding: 12px;
text-align: center;
font-weight: 500;
font-size: 12px;
color: #333333;
}
}
image {
width: 188px;
height: 112px;
}
text {
padding: 12px;
text-align: center;
font-weight: 500;
font-size: 12px;
color: #333333;
}
}
}
}
</style>

View File

@@ -1,29 +1,27 @@
<template>
<view class="container">
<view v-for="item in recommendThemeList" :key="item.themeName">
<RecommendPostsList :recommendTheme="item" />
</view>
</view>
<view class="container">
<view v-for="item in recommendThemeList" :key="item.themeName">
<RecommendPostsList :recommendTheme="item" />
</view>
</view>
</template>
<script setup>
import RecommendPostsList from './RecommendPostsList.vue';
import { defineProps } from 'vue'
const props = defineProps({
recommendThemeList: {
type: Array,
default: []
}
})
import RecommendPostsList from "./RecommendPostsList.vue";
import { defineProps } from "vue";
const props = defineProps({
recommendThemeList: {
type: Array,
default: [],
},
});
</script>
<style scoped lang="scss">
.container {
width: 100%;
flex: 1;
margin-bottom: 12px;
}
</style>
.container {
width: 100%;
flex: 1;
margin-bottom: 12px;
}
</style>