初始化
This commit is contained in:
86
pages/market/components/CardList.vue
Normal file
86
pages/market/components/CardList.vue
Normal file
@@ -0,0 +1,86 @@
|
||||
<template>
|
||||
<div class="xl:w-screen-xl sm:flex xl:p-0 p-4 m-auto relative">
|
||||
<el-row :gutter="24" class="flex">
|
||||
<template v-for="(item,index) in data?.list" :key="index">
|
||||
<el-col :xs="24" :sm="12" :md="8" :lg="6" :xl="6" class="mb-5 min-w-xs">
|
||||
<el-card shadow="hover" :body-style="{ padding: '0px' }" class="hover:bg-gray-50 cursor-pointer" @click="openSpmUrl(`/item`, item,item.companyId,true)">
|
||||
<el-image
|
||||
:src="item.image"
|
||||
:fit="fit" :lazy="true" class="w-full md:h-[150px] h-[199px] cursor-pointer bg-gray-50"/>
|
||||
<div class="flex-1 px-4 py-5 sm:p-6 !p-4">
|
||||
<div class="text-gray-700 dark:text-white text-base font-semibold flex flex-col gap-1.5">
|
||||
<div class="flex-1 text-xl cursor-pointer flex items-center">
|
||||
{{ item.shortName }}
|
||||
<el-tag v-if="item.chargingMethod === 0" size="small" type="success" class="text-white ml-2" effect="dark">免费</el-tag>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex items-center gap-1.5 py-2 text-gray-500 justify-between">
|
||||
<div class="text-gray-500 line-clamp-2">{{ item.comments }}</div>
|
||||
</div>
|
||||
<div class="button-group flex justify-between items-center mt-3">
|
||||
<el-space class="flex items-end">
|
||||
<el-avatar size="small" :src="item.companyLogo" />
|
||||
<span class="text-gray-400 line-clamp-1 pr-2">{{ item.companyName }}</span>
|
||||
</el-space>
|
||||
<!-- <el-button @click.stop="loginDeveloperCenterByToken(item)">控制台</el-button>-->
|
||||
<!-- 已购买 -->
|
||||
<!-- <template v-if="item.isBuy">-->
|
||||
<!-- <el-button v-if="item.isBuy && item.installed" type="success" @click.stop="openSpmUrl(`https://${item.domain}`,item,item.companyId,true)">进入控制台</el-button>-->
|
||||
<!-- <el-button v-if="item.isBuy && !item.installed" type="primary" @click.stop="openSpmUrl(`/product/create`,item,item.companyId,true)">立即开通</el-button>-->
|
||||
<!-- </template>-->
|
||||
<!-- 未够买 -->
|
||||
<!-- <template v-if="!item.isBuy">-->
|
||||
<!-- <div class="flex items-center cursor-pointer" v-if="!item.isBuy" @click.stop="openSpmUrl(`/product/create`,item,item.companyId,true)">-->
|
||||
<!-- <div class="flex items-center text-red-600">-->
|
||||
<!-- <span>¥{{ item.price }}</span>-->
|
||||
<!-- <span v-if="item.chargingMethod == 2">/年</span>-->
|
||||
<!-- <span v-if="item.chargingMethod == 3">/月</span>-->
|
||||
<!-- <span v-if="item.chargingMethod == 4">/天</span>-->
|
||||
<!-- </div>-->
|
||||
<!-- </div>-->
|
||||
<!-- </template>-->
|
||||
</div>
|
||||
</div>
|
||||
</el-card>
|
||||
</el-col>
|
||||
</template>
|
||||
</el-row>
|
||||
</div>
|
||||
<div class="flex justify-center py-3">
|
||||
<el-pagination background layout="prev, pager, next" :total="data?.count" @change="onPage" />
|
||||
</div>
|
||||
<!-- <div v-if="disabled" class="px-1 text-center text-gray-500">-->
|
||||
<!-- 没有更多了-->
|
||||
<!-- </div>-->
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import {openSpmUrl} from "~/utils/common";
|
||||
import type {Company} from "~/api/system/company/model";
|
||||
import type {PageResult} from "~/api";
|
||||
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
data?: PageResult<Company>;
|
||||
disabled?: boolean;
|
||||
fit?: any;
|
||||
}>(),
|
||||
{
|
||||
fit: 'cover'
|
||||
}
|
||||
);
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'done', index: number): void;
|
||||
}>();
|
||||
|
||||
// const load = () => {
|
||||
// if(!props.disabled){
|
||||
// emit('done')
|
||||
// }
|
||||
// }
|
||||
|
||||
const onPage = (index: number) => {
|
||||
emit('done',index)
|
||||
}
|
||||
</script>
|
||||
75
pages/market/index.vue
Normal file
75
pages/market/index.vue
Normal file
@@ -0,0 +1,75 @@
|
||||
<template>
|
||||
<PageBanner :layout="layout" :title="`${form?.categoryName}`" :desc="`${form?.comments}`" />
|
||||
<CardList :param="{type: 0,official: true}" :data="data" :disabled="disabled" @done="onSearch" />
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import type {ApiResult, PageResult} from "~/api";
|
||||
import {useServerRequest} from "~/composables/useServerRequest";
|
||||
import {useWebsite} from "~/composables/configState";
|
||||
import type {Navigation} from "~/api/cms/navigation/model";
|
||||
import type {Company, CompanyParam} from "~/api/system/company/model";
|
||||
import CardList from './components/CardList.vue';
|
||||
import {getIdBySpm} from "~/utils/common";
|
||||
|
||||
const route = useRoute();
|
||||
|
||||
// 页面信息
|
||||
const runtimeConfig = useRuntimeConfig();
|
||||
const data = ref<PageResult<Company>>();
|
||||
const page = ref<number>(0);
|
||||
const resultText = ref('');
|
||||
const layout = ref<any>();
|
||||
const disabled = ref<boolean>(false);
|
||||
|
||||
// 获取状态
|
||||
const form = ref<Navigation>();
|
||||
|
||||
// 搜索表单
|
||||
const where = reactive<CompanyParam>({
|
||||
keywords: ''
|
||||
});
|
||||
|
||||
const onSearch = (index: number) => {
|
||||
page.value = index;
|
||||
reload();
|
||||
}
|
||||
|
||||
// 请求数据
|
||||
const reload = async () => {
|
||||
const {data: response} = await useServerRequest<ApiResult<PageResult<Company>>>('/system/company/page',{baseURL: runtimeConfig.public.apiServer, params: {
|
||||
page: page.value,
|
||||
limit: 12,
|
||||
categoryId: getIdBySpm(5),
|
||||
keywords: where.keywords
|
||||
}})
|
||||
if(response.value?.data){
|
||||
data.value = response.value?.data;
|
||||
}
|
||||
}
|
||||
|
||||
const { data: nav } = await useServerRequest<ApiResult<Navigation>>(`/cms/cms-navigation/${getIdBySpm(5)}`)
|
||||
if(nav.value?.data){
|
||||
form.value = nav.value?.data;
|
||||
useHead({
|
||||
title: `${form.value.title} - WEBSOFT`,
|
||||
bodyAttrs: {
|
||||
class: "page-container",
|
||||
}
|
||||
});
|
||||
}
|
||||
// 页面布局
|
||||
if(form.value?.layout){
|
||||
layout.value = JSON.parse(form.value?.layout)
|
||||
}
|
||||
|
||||
|
||||
|
||||
watch(
|
||||
() => getIdBySpm(5),
|
||||
(id) => {
|
||||
console.log(id,'id = .>>>>')
|
||||
reload();
|
||||
},
|
||||
{ immediate: true }
|
||||
);
|
||||
</script>
|
||||
Reference in New Issue
Block a user