完成适配移动端

This commit is contained in:
2025-02-22 22:11:19 +08:00
parent 98758e89e2
commit 1f79c93859
62 changed files with 549 additions and 2973 deletions

View File

@@ -1,26 +1,48 @@
<template>
<!-- 主体部分 -->
<div class="xl:w-screen-xl m-auto py-4 mt-20">
<div class="xl:w-screen-xl m-auto py-4 mt-12 px-4 sm:px-0 sm:mt-20">
<el-page-header :icon="ArrowLeft" @back="goBack">
<template #content>
<span class="text-large font-600 mr-3"> 客户案例 </span>
<span class="text-large font-600 line-clamp-1"> 客户案例 </span>
</template>
<template #extra>
<el-space class="flex items-center">
<el-input v-model="where.keywords" style="width: 400px" :placeholder="`搜索关键词`" :suffix-icon="Search"
@change="reload"/>
<el-input
v-model="where.keywords"
:placeholder="`搜索关键词`"
class="hidden-sm-and-down"
:suffix-icon="Search"
:style="{ width: inputWidth }"
@focus="handleFocus"
@blur="handleBlur"
@change="reload"
/>
<el-button class="hidden-sm-and-up" :icon="Search" @click="showSearch = true"></el-button>
</el-space>
<el-dialog
v-model="showSearch"
fullscreen
>
<el-input
v-model="where.keywords"
:placeholder="`搜索关键词`"
size="large"
class="w-full my-5"
:suffix-icon="Search"
@change="reload"
/>
</el-dialog>
</template>
<el-row :gutter="24" id="container" class="clearfix">
<el-col v-for="(item,index) in list" :key="index" :span="8" class="left mb-8">
<el-col v-for="(item,index) in list" :key="index" :xs="24" :sm="8" class="left mb-8">
<el-card shadow="hover" :body-style="{ padding: '0px' }" class="cursor-pointer" @mouseover="showDomain(item)"
@mouseleave="hideDomain">
<nuxt-link :to="`/market/${item.websiteId}`">
<div class="flex-1 px-4 py-5 sm:p-4 !p-4">
<div class="text-gray-700 dark:text-white text-base font-semibold flex gap-1.5">
<el-avatar
:src="item.websiteLogo" shape="square" :size="55" style="background-color: white;"/>
:src="item.websiteLogo" shape="square" :size="55" style="background-color: white;"/>
<div class="flex-1 text-lg cursor-pointer flex flex-col">
{{ item.websiteName }}
<div class="flex justify-between items-center">
@@ -58,6 +80,8 @@ const router = useRouter();
const list = ref<CmsWebsite[]>([]);
const total = ref(0);
const id = ref<number>();
const inputWidth = ref<string>('180px');
const showSearch = ref<boolean>(false);
// 搜索表单
const where = reactive<CmsWebsiteParam>({
@@ -75,6 +99,13 @@ const where = reactive<CmsWebsiteParam>({
const goBack = () => {
router.back();
}
const handleFocus = () => {
inputWidth.value = '400px'; // 聚焦时宽度
}
const handleBlur = () => {
inputWidth.value = '180px'; // 聚焦时宽度
}
const showDomain = (item: CmsWebsite) => {
id.value = Number(item.websiteId);
};
@@ -91,7 +122,7 @@ const reload = async () => {
total.value = response.count;
}
}).catch(() => {
})
}).finally(() => showSearch.value = false)
}
/**
@@ -104,14 +135,17 @@ const search = (data: CmsArticleParam) => {
}
watch(
() => route.params.id,
() => {
reload();
},
{immediate: true}
() => route.params.id,
() => {
reload();
},
{immediate: true}
);
</script>
<style lang="scss">
.el-input {
transition: width 0.3s ease;
}
</style>