116 lines
2.2 KiB
Vue
116 lines
2.2 KiB
Vue
<template>
|
|
<!-- 模板 -->
|
|
<div class="market">
|
|
<div class="market_title fw-bold">模板市场</div>
|
|
<van-tabs v-model:active="active" @change="getMarketInfo">
|
|
<van-tab v-for="item in marketList" :key="item.title" :title="item.title"> </van-tab>
|
|
</van-tabs>
|
|
<market-item :info="marketInfo"></market-item>
|
|
</div>
|
|
<div class="more">
|
|
<p>-更多模板期待您的探索-</p>
|
|
</div>
|
|
</template>
|
|
<script setup>
|
|
import { ref, onMounted } from 'vue';
|
|
import MarketItem from './components/MarketItem.vue';
|
|
import { getListScene, getSurveyTemplates } from '@/api/home';
|
|
|
|
const marketList = ref([]);
|
|
const active = ref(null);
|
|
const marketInfo = ref([]);
|
|
|
|
const getTableList = async() => {
|
|
const res = await getListScene();
|
|
if (res.data.code === 0) {
|
|
res.data.data.forEach((item) => {
|
|
if (item.parentCode && item.parentCode === 1) {
|
|
marketList.value.push(item);
|
|
}
|
|
});
|
|
|
|
getMarketInfo(marketList.value[0]);
|
|
}
|
|
};
|
|
const getMarketInfo = async(item) => {
|
|
const code = marketList.value.filter((market, index) => item === index)[0].code;
|
|
const params = {
|
|
page: 1,
|
|
per_page: 10,
|
|
group_id: 0,
|
|
is_public: 1,
|
|
scene_code_info: code,
|
|
sort: 'quote_nums, desc'
|
|
};
|
|
const res = await getSurveyTemplates(params);
|
|
if (res.data.code === 0) {
|
|
marketInfo.value = res.data.data;
|
|
}
|
|
};
|
|
|
|
onMounted(() => {
|
|
getTableList();
|
|
});
|
|
</script>
|
|
|
|
<style scoped>
|
|
::v-deep .van-tabs__line {
|
|
background-color: #70b937;
|
|
}
|
|
|
|
::v-deep .van-tab--active {
|
|
color: #000;
|
|
font-size: 13px;
|
|
}
|
|
|
|
::v-deep .van-row {
|
|
justify-content: space-between;
|
|
}
|
|
|
|
.market {
|
|
margin-top: 10px;
|
|
padding: 15px 15px 0;
|
|
border-radius: 10px;
|
|
background: #fff;
|
|
|
|
.market_title {
|
|
color: #000;
|
|
font-size: 15px;
|
|
}
|
|
|
|
& > :first-child {
|
|
display: flex;
|
|
align-items: end;
|
|
justify-content: space-between;
|
|
|
|
span {
|
|
color: grey;
|
|
font-size: 10px;
|
|
}
|
|
}
|
|
|
|
.market_table {
|
|
display: flex;
|
|
flex-flow: row nowrap;
|
|
overflow: scroll;
|
|
height: 20px;
|
|
font-size: 13px;
|
|
|
|
/* padding: 10px 0; */
|
|
|
|
& > div {
|
|
padding: 0 20px;
|
|
text-wrap: nowrap;
|
|
}
|
|
}
|
|
}
|
|
|
|
.more {
|
|
margin: 20px;
|
|
color: #919191;
|
|
font-weight: 400;
|
|
font-size: 13px;
|
|
text-align: center;
|
|
}
|
|
</style>
|