完成适配移动端

This commit is contained in:
2025-03-01 10:52:11 +08:00
parent 1f79c93859
commit 8d19a58e9d
68 changed files with 2117 additions and 847 deletions

View File

@@ -1,185 +0,0 @@
<template>
<!-- 主体部分 -->
<div class="xl:w-screen-xl m-auto py-4 mt-20">
<el-page-header :icon="ArrowLeft" @back="goBack">
<template #content>
<span class="text-large font-600"> {{ page.title }} </span>
</template>
<template #extra>
<div class="flex items-center">
<el-select v-model="value" clearable placeholder="筛选" style="width: 200px">
<el-option
v-for="item in options"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</div>
</template>
<el-row :gutter="24" id="container" class="clearfix">
<el-col v-for="(item,index) in list" :key="index" :span="6" class="left">
<el-card shadow="hover" :body-style="{ padding: '0px' }" class=" hover:bg-gray-50 cursor-pointer" @click="navigateTo(`/item/${item.articleId}.html`)">
<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 gap-1.5">
<el-avatar
:src="item.image" shape="square" :size="44" style="background-color: white;"/>
<div class="flex-1 text-xl cursor-pointer flex flex-col">
{{ item.title }}
<sapn class="text-xs text-gray-400">site.websoft.top</sapn>
</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 text-sm">-->
<!-- <el-space class="flex items-end">-->
<!-- <div class="text-gray-400 gap-1 flex items-center"><el-icon><View /></el-icon><span>{{ getViews(item) }}</span></div>-->
<!-- </el-space>-->
<!-- <el-button>控制台</el-button>-->
<!-- </div>-->
</div>
</el-card>
</el-col>
</el-row>
</el-page-header>
<Pagination :total="total" @done="search" />
</div>
</template>
<script setup lang="ts">
import Banner from "@/components/Banner.vue";
import { ArrowLeft,View } from '@element-plus/icons-vue'
import { ElNotification as notify } from 'element-plus'
import {useConfigInfo, useLayout, usePage} from "~/composables/configState";
import type {CmsNavigation} from "~/api/cms/cmsNavigation/model";
import type {CmsArticle, CmsArticleParam} from "~/api/cms/cmsArticle/model";
import type { ComponentSize } from 'element-plus'
import { ElNotification } from 'element-plus'
import type { TabsPaneContext } from 'element-plus'
import { h } from 'vue'
import dayjs from "dayjs";
import {detail, getNavIdByParamsId, navTo, paramsId} from "~/utils/common";
import Left from "~/components/Left.vue";
import {getCmsNavigation, listCmsNavigation} from "~/api/cms/cmsNavigation";
import {pageCmsArticle} from "~/api/cms/cmsArticle";
const route = useRoute();
const navId = ref();
// 页面信息
const list = ref<CmsArticle[]>([]);
const i18n = useI18n();
const category = ref<CmsNavigation[]>([]);
const total = ref(0);
const activeName = ref('2839');
// 获取状态
const page = usePage();
const layout = useLayout();
// 搜索表单
const where = reactive<CmsArticleParam>({
keywords: '',
page: 1,
limit: 20,
status: 0,
parentId: undefined,
categoryId: undefined,
lang: i18n.locale.value
});
const goBack = () => {
console.log('go back')
notify('Back')
route.back();
}
// 加载页面数据
const reload = async () => {
await getCmsNavigation(navId.value).then(data => {
page.value = data;
layout.value.banner = data.banner;
// seo
useSeoMeta({
description: data.comments || data.title,
keywords: data.title,
titleTemplate: `${data?.title}` + ' - %s',
})
// 二级栏目分类
listCmsNavigation({
parentId: data.parentId == 0 ? data.navigationId : data.parentId
}).then(navigation => {
category.value = navigation;
// 加载文章列表
where.categoryId = page.value.navigationId;
pageCmsArticle(where).then(response => {
if(response){
total.value = response.count;
list.value = response.list;
}
})
})
}).catch(() => {})
}
/**
* 搜索
* @param data
*/
const search = (data: CmsArticleParam) => {
where.page = data.page;
reload();
}
const handleClick = (tab: TabsPaneContext, event: Event) => {
console.log(tab, event)
}
const value = ref('')
const options = [
{
value: 'Option1',
label: 'Option1',
},
{
value: 'Option2',
label: 'Option2',
},
{
value: 'Option3',
label: 'Option3',
},
{
value: 'Option4',
label: 'Option4',
},
{
value: 'Option5',
label: 'Option5',
},
]
watch(
() => route.params.id,
(id) => {
navId.value = getNavIdByParamsId(id);
reload();
},
{ immediate: true }
);
</script>
<style lang="scss">
.right .content img{
width: auto !important;
}
.demo-tabs > .el-tabs__content {
padding: 32px;
color: #6b778c;
font-size: 32px;
font-weight: 600;
}
</style>

131
pages/product/code/[id].vue Normal file
View File

@@ -0,0 +1,131 @@
<template>
<!-- 主体部分 -->
<div class="xl:w-screen-xl m-auto py-4 mt-12 px-4 sm:px-0 sm:mt-20">
<el-page-header :icon="ArrowLeft" @back="goBack">
<template #content>
<span class="text-large font-600"> 源码下载 </span>
</template>
<div class="text-lg">
<el-result
:title="`权限不足`"
icon="warning"
/>
</div>
<el-row id="container" :gutter="24" class="clearfix">
<el-col v-for="(item,index) in list" :key="index" :sm="4" :xs="12" class="left mb-8">
<nuxt-link :to="`${item.url}`" class="flex-1 cursor-pointer flex flex-col text-center" target="_blank">
<el-card :body-style="{ padding: '0px' }" class="items-center flex justify-center" shadow="hover">
<el-popover
:content="item.comments"
:width="200"
placement="bottom"
trigger="hover"
>
<template #reference>
<div class="flex-1 py-5 sm:p-4 !p-4">
<el-space class="text-gray-700 dark:text-white text-base font-semibold h-[28px] flex justify-center items-center">
<el-image v-if="item.icon" :alt="item.name" :src="item.icon" style="height: 32px"/>
<span :title="item.name" class="text-lg line-clamp-1">{{ item.name }}</span>
</el-space>
</div>
</template>
</el-popover>
</el-card>
</nuxt-link>
</el-col>
</el-row>
</el-page-header>
<Pagination :total="total" @done="search" />
</div>
</template>
<script lang="ts" setup>
import { ArrowLeft,View,Search } from '@element-plus/icons-vue'
import {useLayout, usePage} from "~/composables/configState";
import type {CmsNavigation} from "~/api/cms/cmsNavigation/model";
import type {CmsArticle, CmsArticleParam} from "~/api/cms/cmsArticle/model";
import {getNavIdByParamsId, getViews, paramsId} from "~/utils/common";
import {getCmsNavigation, listCmsNavigation} from "~/api/cms/cmsNavigation";
import {pageCmsLink} from "~/api/cms/cmsLink";
import type {CmsLink, CmsLinkParam} from "~/api/cms/cmsLink/model";
const route = useRoute();
const router = useRouter();
const navId = ref();
const list = ref<CmsLink[]>([]);
const category = ref<CmsNavigation[]>([]);
const total = ref<number>(0);
// 获取状态
const page = usePage();
const layout = useLayout();
const showSearch = ref<boolean>(false);
// 搜索表单
const where = reactive<CmsLinkParam>({
keywords: '',
page: 1,
categoryId: undefined
});
const id = ref<number>(0);
const showMenu = (item: CmsLink) => {
id.value = Number(item.id);
};
const hideMenu = () => {
id.value = 0;
};
// 加载页面数据
const reload = async () => {
getCmsNavigation(navId.value).then(data => {
// 获取栏目信息
page.value = data
layout.value.banner = data.banner;
if(navId.value){
where.categoryId = navId.value;
}
pageCmsLink(where).then(response => {
if(response){
total.value = response?.count;
list.value = response?.list;
}
}).finally(() => showSearch.value = false)
// 设置页面标题
useSeoMeta({
description: data.comments || data.title,
keywords: data.title,
titleTemplate: `${data?.title}` + ' - %s',
})
}).catch(err => {
console.log(err,'加载失败...')
})
}
const goBack = () => {
router.back(); // 返回上一页
}
/**
* 搜索
* @param data
*/
const search = (data: CmsArticleParam) => {
where.page = data.page;
reload();
}
watch(
() => route.params.id,
(id) => {
navId.value = getNavIdByParamsId(id);
reload();
},
{ immediate: true }
);
</script>

131
pages/product/docs/[id].vue Normal file
View File

@@ -0,0 +1,131 @@
<template>
<Banner :layout="layout" />
<!-- 主体部分 -->
<div class="xl:w-screen-xl m-auto py-4 mt-12 px-4 sm:px-0 sm:mt-20">
<el-page-header :icon="ArrowLeft" @back="goBack">
<template #content>
<span class="text-large font-600"> {{ '产品文档' }} </span>
</template>
<!-- <div class="text-lg">-->
<!-- <el-result-->
<!-- icon="warning"-->
<!-- :title="`权限不足`"-->
<!-- />-->
<!-- </div>-->
<el-row id="container" :gutter="24" class="clearfix">
<el-col v-for="(item,index) in list" :key="index" :span="6" :xs="24" class="left mb-6">
<el-card :body-style="{ padding: '0px' }" class=" hover:bg-gray-50 cursor-pointer" shadow="hover" @click="navigateTo(`/detail/${item.articleId}.html`)">
<el-image
:lazy="true"
:src="item.image"
class="w-full md:h-[166px] h-[199px] cursor-pointer bg-gray-50" fit="cover"/>
<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 min-h-[56px]">
{{ item.title }}
</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 text-sm">
<el-space class="flex items-end">
<div class="text-gray-400 gap-1 flex items-center"><el-icon><View /></el-icon><span>{{ getViews(item) }}</span></div>
</el-space>
<div class="text-gray-400">
<el-avatar v-if="item.avatar" :src="`${item.avatar}`" size="small" />
{{ dayjs(item.createTime).format('YYYY-MM-DD') }}
</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,View,Search } from '@element-plus/icons-vue'
import {useLayout, usePage} from "~/composables/configState";
import type {CmsNavigation} from "~/api/cms/cmsNavigation/model";
import type {CmsArticle, CmsArticleParam} from "~/api/cms/cmsArticle/model";
import {getNavIdByParamsId, getViews, paramsId} from "~/utils/common";
import dayjs from "dayjs";
import {getCmsNavigation, listCmsNavigation} from "~/api/cms/cmsNavigation";
import {pageCmsArticle} from "~/api/cms/cmsArticle";
import Banner from "~/components/Banner.vue";
import {getCmsWebsiteAll} from "~/api/cms/cmsWebsite";
import type {CmsWebsite} from "~/api/cms/cmsWebsite/model";
const route = useRoute();
const router = useRouter();
const navId = ref();
const website = ref<CmsWebsite>();
const list = ref<CmsArticle[]>([]);
const i18n = useI18n();
const category = ref<CmsNavigation[]>([]);
const total = ref<number>(0);
// 获取状态
const page = usePage();
const layout = useLayout();
// 搜索表单
const where = reactive<CmsArticleParam>({
keywords: '',
page: 1,
status: 0,
parentId: undefined,
categoryId: undefined
});
// 加载页面数据
const reload = async () => {
getCmsWebsiteAll(navId.value).then(data => {
// 获取栏目信息
website.value = data
where.tenantId = data.tenantId;
pageCmsArticle(where).then(response => {
if(response){
total.value = response?.count;
list.value = response?.list;
}
})
// 设置页面标题
useSeoMeta({
description: data.comments || data.websiteName,
keywords: data.websiteName,
titleTemplate: `${data.websiteName}` + ' - %s',
})
}).catch(err => {
console.log(err,'加载失败...')
})
}
const goBack = () => {
router.back(); // 返回上一页
// window.history.back();
}
/**
* 搜索
* @param data
*/
const search = (data: CmsArticleParam) => {
where.page = data.page;
reload();
}
watch(
() => route.params.id,
(id) => {
navId.value = getNavIdByParamsId(id);
reload();
},
{ immediate: true }
);
</script>

141
pages/product/index.vue Normal file
View 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-20">
<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="`https://${item.adminUrl}`" 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="`https://${item.adminUrl}`" class="text-lg" target="_blank">{{ item.websiteName }}</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="`https://${item.adminUrl}`" target="_blank"><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="`/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>