1
This commit is contained in:
141
pages/product/index.vue
Normal file
141
pages/product/index.vue
Normal file
@@ -0,0 +1,141 @@
|
||||
<template>
|
||||
|
||||
<!-- 主体部分 -->
|
||||
<div class="xl:w-screen-xl m-auto py-4 mt-12 px-4 sm:px-0 sm:mt-2">
|
||||
<el-page-header :icon="ArrowLeft" @back="goBack">
|
||||
<template #content>
|
||||
<div class="text-large font-600"> 产品中心 </div>
|
||||
</template>
|
||||
<!-- 应用列表 -->
|
||||
<el-row id="container" :gutter="24" class="clearfix">
|
||||
<el-col v-for="(item,index) in list" :key="index" :sm="6" :xs="12" class="left mb-8">
|
||||
<el-card :body-style="{ padding: '0px' }" class="h-[180px] items-center flex justify-center" shadow="hover" @mouseleave="hideMenu" @mouseover="showMenu(item)">
|
||||
<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 flex-col items-center gap-1.5">
|
||||
<nuxt-link :to="`/market/${item.websiteId}`" target="_blank">
|
||||
<el-avatar
|
||||
:size="55" :src="item.websiteLogo" shape="square" style="background-color: white;"/>
|
||||
</nuxt-link>
|
||||
<div class="flex-1 cursor-pointer flex flex-col text-center">
|
||||
<nuxt-link :to="`/market/${item.websiteId}`" target="_blank">
|
||||
<el-button type="text"><span class="text-lg text-gray-800">{{ item.websiteName }}</span></el-button>
|
||||
</nuxt-link>
|
||||
<div v-if="id == item.websiteId" class="flex text-gray-400 text-sm font-normal py2 justify-between items-center">
|
||||
<div>
|
||||
<nuxt-link :to="`/market/${item.websiteId}`"><span class="text-gray-400 hover:text-green-700">详情</span></nuxt-link>
|
||||
<el-divider direction="vertical" />
|
||||
<nuxt-link :to="`/market/${item.websiteId}`"><span class="text-gray-400 hover:text-green-700">评论</span></nuxt-link>
|
||||
<el-divider direction="vertical" />
|
||||
<nuxt-link :to="`/product/code/${item.websiteId}`"><span class="text-gray-400 hover:text-green-700">源码</span></nuxt-link>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</el-card>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-page-header>
|
||||
|
||||
<Pagination :total="total" @done="search"/>
|
||||
</div>
|
||||
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import {ArrowLeft} from '@element-plus/icons-vue'
|
||||
import {pageCmsWebsiteAll} from "~/api/cms/cmsWebsite";
|
||||
import type {CmsWebsite, CmsWebsiteParam} from "~/api/cms/cmsWebsite/model";
|
||||
|
||||
const route = useRoute();
|
||||
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 loading = ref<boolean>(false)
|
||||
const where = ref<CmsWebsiteParam>({
|
||||
|
||||
});
|
||||
|
||||
const goBack = () => {
|
||||
router.back();
|
||||
}
|
||||
const showDomain = (item: CmsWebsite) => {
|
||||
id.value = Number(item.websiteId);
|
||||
};
|
||||
|
||||
const hideDomain = () => {
|
||||
id.value = 0;
|
||||
};
|
||||
|
||||
const showMenu = (item: CmsWebsite) => {
|
||||
id.value = Number(item.websiteId);
|
||||
};
|
||||
|
||||
const hideMenu = () => {
|
||||
id.value = 0;
|
||||
};
|
||||
|
||||
// 加载页面数据
|
||||
const reload = async (where: any) => {
|
||||
if (loading.value) return;
|
||||
loading.value = true;
|
||||
pageCmsWebsiteAll({
|
||||
...where,
|
||||
market: true,
|
||||
official: true,
|
||||
sort: 'websiteId',
|
||||
order: 'asc',
|
||||
limit: where.limit || 12
|
||||
}).then(response => {
|
||||
if (response?.list) {
|
||||
list.value = response?.list.map(d => {
|
||||
if (d.domain == '' || d.domain == null) {
|
||||
d.domain = `${d.websiteCode}.wsdns.cn`;
|
||||
}
|
||||
return d;
|
||||
});
|
||||
total.value = response.count;
|
||||
}
|
||||
loading.value = false;
|
||||
}).catch(() => {
|
||||
loading.value = false;
|
||||
}).finally(() => {
|
||||
showSearch.value = false
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 搜索
|
||||
* @param data
|
||||
*/
|
||||
const search = (data: CmsWebsiteParam) => {
|
||||
navigateTo({
|
||||
path: '/market',
|
||||
query: {
|
||||
market: 1,
|
||||
page: data.page,
|
||||
limit: 12
|
||||
}
|
||||
})
|
||||
window.scrollTo(0, 0)
|
||||
}
|
||||
|
||||
watch(
|
||||
() => route.query,
|
||||
(query) => {
|
||||
where.value = query;
|
||||
console.log(where.value,'>>>>>')
|
||||
reload(query);
|
||||
},
|
||||
{immediate: true}
|
||||
);
|
||||
</script>
|
||||
<style lang="scss">
|
||||
</style>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user