fix: UI 优化和功能修复
- 修复了搜索组件的样式和交互问题 - 优化了 Market 组件的布局和样式 - 修正了 theme.scss 中的拼写错误 (seach -> search) - 优化了 SurveyItem 组件的样式和功能 - 改进了 Analysis 组件的图表显示 - 增强了 HomeSearch 的用户体验 - 修复了 useSurveySearch 中的数据加载逻辑
This commit is contained in:
@@ -4,6 +4,6 @@ $gap: 10px;
|
|||||||
$nav-header-color: #f2f2f2;
|
$nav-header-color: #f2f2f2;
|
||||||
$nav-color: #eefde8;
|
$nav-color: #eefde8;
|
||||||
|
|
||||||
%seach-gradient {
|
%search-gradient {
|
||||||
background: linear-gradient(to bottom, #f8fef5, #f3f3f3);
|
background: linear-gradient(to bottom, #f8fef5, #f3f3f3);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ const changeChart = (i: number) => {
|
|||||||
margin: '16px 0'
|
margin: '16px 0'
|
||||||
}"
|
}"
|
||||||
>
|
>
|
||||||
<span ref="pieChart" style="width: 100%; height: v-bind(chartHeight)"></span>
|
<span ref="pieChart" style="width: 100%; height: v-bind(chartHeight + 'px')"></span>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -132,9 +132,10 @@ onMounted(() => {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
$gap: 10px;
|
@use '@/assets/css/theme' as *;
|
||||||
|
|
||||||
.mark_container {
|
.mark_container {
|
||||||
|
background-color: $nav-header-color;
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-gap: $gap;
|
grid-gap: $gap;
|
||||||
grid-template-columns: repeat(2, 1fr);
|
grid-template-columns: repeat(2, 1fr);
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
:placeholder="placeholder"
|
:placeholder="placeholder"
|
||||||
style="--van-search-padding: 0"
|
style="--van-search-padding: 0"
|
||||||
@search="handleSearchAction"
|
@search="handleSearchAction"
|
||||||
|
@cancel="handleCancelClick"
|
||||||
>
|
>
|
||||||
</van-search>
|
</van-search>
|
||||||
<p class="search" @click="handleSearchAction">搜索</p>
|
<p class="search" @click="handleSearchAction">搜索</p>
|
||||||
@@ -32,18 +33,23 @@ const placeholder = defineModel('placeholder', {
|
|||||||
default: '请输入搜索关键词'
|
default: '请输入搜索关键词'
|
||||||
});
|
});
|
||||||
|
|
||||||
const emit = defineEmits(['search']);
|
const emit = defineEmits(['search', 'cancel']);
|
||||||
|
|
||||||
function handleSearchAction() {
|
function handleSearchAction() {
|
||||||
emit('search');
|
emit('search');
|
||||||
searchMethod.value && searchMethod.value();
|
searchMethod.value && searchMethod.value();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function handleCancelClick() {
|
||||||
|
emit('cancel');
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
@use '@/assets/css/theme';
|
@use '@/assets/css/theme';
|
||||||
|
|
||||||
.search-container {
|
.search-container {
|
||||||
|
position: relative;
|
||||||
:deep(.van-search) {
|
:deep(.van-search) {
|
||||||
padding: 0;
|
padding: 0;
|
||||||
//margin: 0 10px;
|
//margin: 0 10px;
|
||||||
@@ -63,7 +69,7 @@ function handleSearchAction() {
|
|||||||
&::after {
|
&::after {
|
||||||
content: '|';
|
content: '|';
|
||||||
position: absolute;
|
position: absolute;
|
||||||
right: 9vh;
|
right: 18%;
|
||||||
top: 1vh;
|
top: 1vh;
|
||||||
//transform: translateY(-50%);
|
//transform: translateY(-50%);
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
|
|||||||
@@ -83,7 +83,7 @@ function handleSearchClick() {
|
|||||||
.search {
|
.search {
|
||||||
margin: 0 -10px 0 -10px;
|
margin: 0 -10px 0 -10px;
|
||||||
padding: 10px;
|
padding: 10px;
|
||||||
@extend %seach-gradient;
|
@extend %search-gradient;
|
||||||
}
|
}
|
||||||
|
|
||||||
.slider {
|
.slider {
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
<template>
|
<template>
|
||||||
<!-- 模板 -->
|
<!-- 模板 -->
|
||||||
<div class="market">
|
<div class="market">
|
||||||
<search></search>
|
<search :value="searchValue"></search>
|
||||||
<van-tabs v-model:active="active" class="px-1" @change="getMarketInfo">
|
<van-tabs style="margin-top: 15px" v-model:active="active" class="px-1" @change="getMarketInfo">
|
||||||
<section>
|
<section>
|
||||||
<van-tab v-for="item in marketList" :key="item.title" :title="item.h5Title">
|
<van-tab v-for="item in marketList" :key="item.title" :title="item.h5Title">
|
||||||
<template #title>
|
<template #title>
|
||||||
@@ -29,7 +29,7 @@ const marketIndex = ref(0);
|
|||||||
const marketInfo = ref([]);
|
const marketInfo = ref([]);
|
||||||
// 当前激活的 item 信息
|
// 当前激活的 item 信息
|
||||||
const marketItem = ref();
|
const marketItem = ref();
|
||||||
|
const searchValue = ref('');
|
||||||
const getTableList = async () => {
|
const getTableList = async () => {
|
||||||
const res = await getListScene();
|
const res = await getListScene();
|
||||||
if (res.data.code === 0) {
|
if (res.data.code === 0) {
|
||||||
@@ -85,7 +85,7 @@ onMounted(() => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.market {
|
.market {
|
||||||
padding-top: 10px;
|
padding: 10px;
|
||||||
border-radius: 0 0 16px 16px;
|
border-radius: 0 0 16px 16px;
|
||||||
background-color: white;
|
background-color: white;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
|||||||
@@ -90,7 +90,9 @@ function updatePageCount(value: number) {
|
|||||||
watch(keyword, async () => {
|
watch(keyword, async () => {
|
||||||
dirty.value = true;
|
dirty.value = true;
|
||||||
// 重新获取数据
|
// 重新获取数据
|
||||||
await handleSearch();
|
// await handleSearch();
|
||||||
|
// 重置状态
|
||||||
|
loading.value = false
|
||||||
});
|
});
|
||||||
|
|
||||||
// 索引变动之后,立刻进行搜索 (没有进行防抖)
|
// 索引变动之后,立刻进行搜索 (没有进行防抖)
|
||||||
|
|||||||
@@ -12,6 +12,10 @@ import { banners } from '@/views/HomeSearch/Hooks/useSurveySearch';
|
|||||||
|
|
||||||
const searchKeyword = keyword as Ref<string>;
|
const searchKeyword = keyword as Ref<string>;
|
||||||
|
|
||||||
|
function handleSearchCancel() {
|
||||||
|
loading.value = false;
|
||||||
|
}
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
// 当页面取消挂载时,重置页面展示的状态
|
// 当页面取消挂载时,重置页面展示的状态
|
||||||
loading.value = false;
|
loading.value = false;
|
||||||
@@ -21,12 +25,17 @@ onMounted(() => {
|
|||||||
<template>
|
<template>
|
||||||
<section class="search-container">
|
<section class="search-container">
|
||||||
<div class="search">
|
<div class="search">
|
||||||
<search :focus="true" v-model:value="searchKeyword" :search="updateKeyword" />
|
<search
|
||||||
|
@cancel="handleSearchCancel"
|
||||||
|
:focus="true"
|
||||||
|
v-model:value="searchKeyword"
|
||||||
|
:search="updateKeyword"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
<!-- 广告区域 -->
|
<!-- 广告区域 -->
|
||||||
<image-slider :banners="banners" v-if="banners?.length > 0 && keyword" />
|
<image-slider :banners="banners" v-if="banners?.length > 0 && keyword" />
|
||||||
|
|
||||||
<section class="result" v-if="loading">
|
<section class="result" v-if="loading && searchKeyword">
|
||||||
<!-- 我的任务区域 -->
|
<!-- 我的任务区域 -->
|
||||||
<layout v-if="visible.mineSurvey" title="我的任务">
|
<layout v-if="visible.mineSurvey" title="我的任务">
|
||||||
<template #title>
|
<template #title>
|
||||||
@@ -69,7 +78,7 @@ onMounted(() => {
|
|||||||
padding: 10px;
|
padding: 10px;
|
||||||
padding-bottom: 20px;
|
padding-bottom: 20px;
|
||||||
// background: linear-gradient(to bottom, #f8fef5, #f3f3f3);
|
// background: linear-gradient(to bottom, #f8fef5, #f3f3f3);
|
||||||
@extend %seach-gradient;
|
@extend %search-gradient;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 搜索结果外部布局
|
// 搜索结果外部布局
|
||||||
|
|||||||
@@ -1,7 +1,11 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="survey-search">
|
<div class="survey-search">
|
||||||
<!-- <nav-search v-model:value="searchValue" @search="blurs" /> -->
|
<nav-search v-model:value="searchValue" @search="blurs" />
|
||||||
<nav-search v-model:value="searchValue" @click="() => $router.push({ name: 'search' })" />
|
<!-- <nav-search
|
||||||
|
placeholder="请输入关键词"
|
||||||
|
v-model:value="searchValue"
|
||||||
|
@click="() => $router.push({ name: 'search' })"
|
||||||
|
/> -->
|
||||||
</div>
|
</div>
|
||||||
<div class="new-survey-container">
|
<div class="new-survey-container">
|
||||||
<div style="margin-bottom: 80px">
|
<div style="margin-bottom: 80px">
|
||||||
@@ -66,8 +70,8 @@ onMounted(() => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.survey-search {
|
.survey-search {
|
||||||
@extend %seach-gradient;
|
@extend %search-gradient;
|
||||||
padding: 0 10px;
|
padding: 10px 10px;
|
||||||
position: sticky;
|
position: sticky;
|
||||||
top: 0;
|
top: 0;
|
||||||
z-index: 1000;
|
z-index: 1000;
|
||||||
|
|||||||
@@ -217,12 +217,9 @@ function copyItem(item: SurveyItem) {
|
|||||||
</el-text>
|
</el-text>
|
||||||
</el-button>
|
</el-button>
|
||||||
</div>
|
</div>
|
||||||
<el-dropdown
|
<!-- 移除 PC 端不能操作 -->
|
||||||
v-if="survey.source === 1"
|
<!-- v-if="survey.source === 1" -->
|
||||||
placement="top-end"
|
<el-dropdown placement="top-end" trigger="click" active-color="#71b73c">
|
||||||
trigger="click"
|
|
||||||
active-color="#71b73c"
|
|
||||||
>
|
|
||||||
<van-icon class-prefix="mobilefont" name="gengduo" size="0.7rem"></van-icon>
|
<van-icon class-prefix="mobilefont" name="gengduo" size="0.7rem"></van-icon>
|
||||||
<template #dropdown>
|
<template #dropdown>
|
||||||
<el-dropdown-menu
|
<el-dropdown-menu
|
||||||
@@ -259,8 +256,8 @@ function copyItem(item: SurveyItem) {
|
|||||||
|
|
||||||
.survey_item_status {
|
.survey_item_status {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: -16px;
|
top: -20px;
|
||||||
right: -10px;
|
right: -20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.survey_item_info_title {
|
.survey_item_info_title {
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ useFetchAnalysis(sn.value);
|
|||||||
|
|
||||||
<template>
|
<template>
|
||||||
<search-bar
|
<search-bar
|
||||||
|
placeholder="请输入关键词"
|
||||||
v-if="!disableSearch"
|
v-if="!disableSearch"
|
||||||
:value="''"
|
:value="''"
|
||||||
style="margin: 15px 10px 5px 10px"
|
style="margin: 15px 10px 5px 10px"
|
||||||
|
|||||||
Reference in New Issue
Block a user