feat(模板市场): 优化模板市场页面布局和功能

-调整模板市场页面的样式,增加搜索功能
- 优化模板分类和展示逻辑
- 添加更多模板探索的提示信息
- 修复模板市场相关的一些小问题
This commit is contained in:
Huangzhe
2025-05-26 00:22:41 +08:00
parent fab2747d30
commit a1d1713f07
6 changed files with 91 additions and 67 deletions

View File

@@ -98,8 +98,8 @@ const router = createRouter({
{ {
path: '/templateMarket', path: '/templateMarket',
name: 'templateMarket', name: 'templateMarket',
meta:{ meta: {
pureBGC: true, pureBGC: true
}, },
component: () => import('@/views/Home/components/Market/Index.vue') component: () => import('@/views/Home/components/Market/Index.vue')
}, },
@@ -116,17 +116,19 @@ const router = createRouter({
name: 'ad', name: 'ad',
meta: { meta: {
pureBGC: true, pureBGC: true,
title: "伊调研", title: '伊调研',
shareAction : true, shareAction: true,
shareFunc : () => { shareFunc: () => {
if(window.ReactNativeWebView){ if (window.ReactNativeWebView) {
window.ReactNativeWebView.postMessage(JSON.stringify({ window.ReactNativeWebView.postMessage(
JSON.stringify({
type: 'shareModal', type: 'shareModal',
title: '分享标题', title: '分享标题',
description:'分享副标题', description: '分享副标题',
thumbImageUrl:'https://logo.png', thumbImageUrl: 'https://logo.png',
webpageUrl: window.location.href webpageUrl: window.location.href
})); })
);
} }
} }
}, },

View File

@@ -4,7 +4,7 @@ import { AnswerApi } from '@/views/Survey/views/Preview/js/api';
import { getLanguage } from '@/views/Survey/views/Preview/js/language'; import { getLanguage } from '@/views/Survey/views/Preview/js/language';
export const useQuestionStore = defineStore('questionStore', () => { export const useQuestionStore = defineStore('questionStore', () => {
const currentSn =ref<string>(''); const currentSn = ref<string>('');
const questionsData = ref(); const questionsData = ref();
@@ -52,8 +52,9 @@ export const useQuestionStore = defineStore('questionStore', () => {
let { data } = await AnswerApi.getQuetions({ let { data } = await AnswerApi.getQuetions({
id: urlParamSearch.get('sn'), id: urlParamSearch.get('sn'),
data: { data: {
is_preview: 0, is_preview: 1,
is_template: urlParamSearch.get('is_template') || 0, is_template: 0,
// is_template: urlParamSearch.get('is_template') || 0,
source: urlParamSearch.get('source') ?? '' source: urlParamSearch.get('source') ?? ''
} }
}); });
@@ -72,7 +73,7 @@ export const useQuestionStore = defineStore('questionStore', () => {
} }
return { return {
fetchQuestions:getQuestions, fetchQuestions: getQuestions,
currentSn, currentSn,
questionsData, questionsData,
styleInfo, styleInfo,

View File

@@ -5,9 +5,9 @@
* @param join 连接符 * @param join 连接符
* @returns 格式化后的时间 * @returns 格式化后的时间
*/ */
export function formatTime(time: string, split = ' ', join = ' '){ export function formatTime(time: string, split = ' ', join = ' ') {
// 如果时间不存在,返回自身的值 // 如果时间不存在,返回自身的值
if (!time) return time; if (!time) return time;
return time.split(split).join(join) return time.split(split).join(join);
} }

View File

@@ -1,8 +1,14 @@
<template> <template>
<section class="market-container">
<!-- 模板 --> <!-- 模板 -->
<div class="market"> <div class="market">
<search :value="searchValue"></search> <search v-model:value="searchValue" @change="fetchTemplate"></search>
<van-tabs style="margin-top: 15px" v-model:active="active" class="px-1" @change="getMarketInfo"> <van-tabs
v-model:active="active"
style="margin-top: 15px"
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>
@@ -16,12 +22,16 @@
<div class="more"> <div class="more">
<p>-更多模板期待您的探索-</p> <p>-更多模板期待您的探索-</p>
</div> </div>
</section>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { ref, onMounted } from 'vue'; import { ref, onMounted } from 'vue';
import MarketItem from '@/components/MarketItem/MarketItem.vue'; import MarketItem from '@/components/MarketItem/MarketItem.vue';
import { getListScene, getSurveyTemplates } from '@/api/home'; import { getListScene, getSurveyTemplates } from '@/api/home';
import Search from '@/components/Search/Index.vue'; import Search from '@/components/Search/Index.vue';
import { fetchSearchResult } from '@/hooks/request/useSearch';
const searchResult = ref([]);
const marketList = ref([]); const marketList = ref([]);
const active = ref(null); const active = ref(null);
@@ -65,6 +75,15 @@ const getMarketInfo = async (item: string | number, title?: string) => {
} }
}; };
/**
* 搜索模板
* @param keyword 搜索关键词
*/
function fetchTemplate() {
// const { templates } = fetchSearchResult(searchValue.value);
// searchResult.value = templates;
}
onMounted(() => { onMounted(() => {
getTableList(); getTableList();
}); });
@@ -84,11 +103,11 @@ onMounted(() => {
justify-content: space-between; justify-content: space-between;
} }
.market { .market-container {
padding: 10px; .market {
padding: 20px;
border-radius: 0 0 16px 16px; border-radius: 0 0 16px 16px;
background-color: white; background-color: red;
overflow: hidden;
.market_title { .market_title {
margin-bottom: 5px; margin-bottom: 5px;
@@ -117,6 +136,7 @@ onMounted(() => {
text-wrap: nowrap; text-wrap: nowrap;
} }
} }
}
} }
.more { .more {

View File

@@ -152,7 +152,7 @@ function copyItem(item: SurveyItem) {
<el-text style="max-width: 100px"> <el-text style="max-width: 100px">
<b v-html="survey.project_name"></b> <b v-html="survey.project_name"></b>
</el-text> </el-text>
<el-text v-if="survey.publish_number" class="wrap"> <el-text v-if="survey.is_publish_number" class="wrap">
{{ survey.publish_number }} {{ survey.publish_number }}
</el-text> </el-text>
<el-text v-if="survey.is_time" class="wrap" style="text-wrap: nowrap"> <el-text v-if="survey.is_time" class="wrap" style="text-wrap: nowrap">

View File

@@ -1,4 +1,5 @@
type SurveyItem = { type SurveyItem = {
is_publish_number: any
publish_number: string | number publish_number: string | number
answer_num_h5: number answer_num_h5: number
recycle_progress_h5: number recycle_progress_h5: number