Browse Source

调整多端适配

master
科技小王子 7 months ago
parent
commit
f2bd5ed435
  1. 6
      components/AppFooter.vue
  2. 18
      components/AppHeader.vue
  3. 2
      components/CardList.vue
  4. 2
      components/PageBanner.vue
  5. 2
      components/ProductList.vue
  6. 10
      composables/useServerRequest.ts
  7. 35
      layouts/default.vue
  8. 8
      nuxt.config.ts
  9. 4
      pages/ask/components/CardList.vue
  10. 2
      pages/ask/index.vue
  11. 4
      pages/case/components/CardList.vue
  12. 4
      pages/category/components/CardList.vue
  13. 4
      pages/components/ArticleList.vue
  14. 4
      pages/components/CardList.vue
  15. 4
      pages/components/PlugList.vue
  16. 4
      pages/components/ProductList.vue
  17. 27
      pages/detail/components/LikeArticle.vue
  18. 2
      pages/detail/components/PageBanner.vue
  19. 8
      pages/detail/index.vue
  20. 4
      pages/developer/components/CardList.vue
  21. 4
      pages/docs/components/CardList.vue
  22. 4
      pages/down/components/CardList.vue
  23. 37
      pages/down/index.vue
  24. 4
      pages/market/components/CardList.vue
  25. 4
      pages/product/components/CardList.vue

6
components/AppFooter.vue

@ -11,7 +11,7 @@
</div> </div>
<div class="w-full flex flex-col sm:bg-black justify-between"> <div class="w-full flex flex-col sm:bg-black justify-between">
<!-- PC版 --> <!-- PC版 -->
<div class="sub-menu w-full md:w-screen-xl m-auto flex justify-between py-10 text-center p-2 hidden-sm-and-down">
<div class="sub-menu w-full xl:w-screen-xl xl:px-0 px-4 m-auto flex justify-between py-10 text-center hidden-sm-and-down">
<!-- 底部菜单 --> <!-- 底部菜单 -->
<div class="left flex flex-col sm:flex-row sm:flex-wrap justify-between gap-3xl sm:w-9/12 flex-wrap w-full"> <div class="left flex flex-col sm:flex-row sm:flex-wrap justify-between gap-3xl sm:w-9/12 flex-wrap w-full">
@ -62,7 +62,7 @@
<!-- </div>--> <!-- </div>-->
<!-- 版权信息 --> <!-- 版权信息 -->
<div class="w-full md:w-screen-xl w-full m-auto flex sm:flex-row flex-col-reverse sm:justify-between justify-center items-center sm:py-10 pt-6 pb-6 text-center p-2">
<div class="w-full xl:w-screen-xl xl:px-0 px-4 w-full m-auto flex sm:flex-row flex-col-reverse sm:justify-between justify-center items-center sm:py-10 pt-6 pb-6 text-center">
<div class="text-gray-400 sm:gap-xl leading-7 flex flex-col sm:flex-row"> <div class="text-gray-400 sm:gap-xl leading-7 flex flex-col sm:flex-row">
<span>Copyright © {{ new Date().getFullYear() }} {{ config?.copyright }}</span> <span>Copyright © {{ new Date().getFullYear() }} {{ config?.copyright }}</span>
<a class="text-gray-400 hover:text-gray-400" href="https://beian.miit.gov.cn/" target="_blank"> 备案号{{ config?.icpNo }}</a> <a class="text-gray-400 hover:text-gray-400" href="https://beian.miit.gov.cn/" target="_blank"> 备案号{{ config?.icpNo }}</a>
@ -76,7 +76,7 @@
</div> </div>
</footer> </footer>
<footer class="absolute bottom-0 w-full" v-if="getPath().startsWith('/login')"> <footer class="absolute bottom-0 w-full" v-if="getPath().startsWith('/login')">
<div class="w-full md:w-screen-xl w-full m-auto flex sm:flex-row flex-col-reverse sm:justify-center justify-center items-center sm:py-10 pt-6 pb-6 text-center p-2">
<div class="w-full xl:w-screen-xl xl:p-0 px-4 w-full m-auto flex sm:flex-row flex-col-reverse sm:justify-center justify-center items-center sm:py-10 pt-6 pb-6 text-center">
<div class="text-gray-400 sm:gap-xl leading-7 flex flex-col sm:flex-row"> <div class="text-gray-400 sm:gap-xl leading-7 flex flex-col sm:flex-row">
<span>Copyright © {{ new Date().getFullYear() }} {{ config?.copyright }}</span> <span>Copyright © {{ new Date().getFullYear() }} {{ config?.copyright }}</span>
<a class="text-gray-400 hover:text-gray-400" href="https://beian.miit.gov.cn/" target="_blank"> 备案号{{ config?.icpNo }}</a> <a class="text-gray-400 hover:text-gray-400" href="https://beian.miit.gov.cn/" target="_blank"> 备案号{{ config?.icpNo }}</a>

18
components/AppHeader.vue

@ -3,11 +3,11 @@
<header <header
class="header z-100 top-0 w-full bg-white/75 opacity-90 backdrop-blur border-b border-gray-200 dark:border-gray-800 -mb-px sticky top-0 z-50 lg:mb-0 lg:border-0" class="header z-100 top-0 w-full bg-white/75 opacity-90 backdrop-blur border-b border-gray-200 dark:border-gray-800 -mb-px sticky top-0 z-50 lg:mb-0 lg:border-0"
:class="affix ? 'absolute blur-xs' : 'sticky bg-white/75'"> :class="affix ? 'absolute blur-xs' : 'sticky bg-white/75'">
<div class="flex items-center between md:w-screen-xl w-full m-auto">
<div class="xl:w-screen-xl xl:p-0 px-4 flex items-center between w-full m-auto">
<div class="header___left flex items-center"> <div class="header___left flex items-center">
<div class="logo mt-1 sm:w-[150px] h-7 w-auto py-2 flex items-center"> <div class="logo mt-1 sm:w-[150px] h-7 w-auto py-2 flex items-center">
<nuxt-link v-if="config?.siteLogo" to="/"> <nuxt-link v-if="config?.siteLogo" to="/">
<div class="flex flex-col text-center md:p-0 px-4">
<div class="flex flex-col text-center xl:p-0">
<el-image <el-image
:src="config.siteLogo" :src="config.siteLogo"
shape="square" shape="square"
@ -47,7 +47,7 @@
</el-menu> </el-menu>
</div> </div>
</div> </div>
<div class="header__right items-center pr-4 sm:pr-0 md:flex hidden">
<div class="header__right items-center pr-4 xl:pr-0 md:flex hidden">
<el-space class="sm:flex hidden" size="large" v-if="config.showSearchTools"> <el-space class="sm:flex hidden" size="large" v-if="config.showSearchTools">
<!-- <el-button v-if="token" @click="navigateTo(`/manage`)">控制台</el-button>--> <!-- <el-button v-if="token" @click="navigateTo(`/manage`)">控制台</el-button>-->
<!-- <el-button v-if="config.showSearchIcon" circle :icon="ElIconSearch" @click="navigateTo('/search')"></el-button>--> <!-- <el-button v-if="config.showSearchIcon" circle :icon="ElIconSearch" @click="navigateTo('/search')"></el-button>-->
@ -75,17 +75,18 @@
</el-space> </el-space>
</div> </div>
<!-- 移动端菜单 --> <!-- 移动端菜单 -->
<div class="md:hidden flex md:p-0 px-4">
<div class="sm:hidden flex xl:p-0 px-8">
<el-dropdown> <el-dropdown>
<span class="el-dropdown-link">
<el-space class="el-dropdown-link flex items-center">
<span>{{ user.nickname }}</span>
<el-avatar v-if="token" class="cursor-pointer" :src="user?.avatar" :size="30"/> <el-avatar v-if="token" class="cursor-pointer" :src="user?.avatar" :size="30"/>
<el-button v-else :icon="ElIconMenu"></el-button> <el-button v-else :icon="ElIconMenu"></el-button>
</span>
</el-space>
<template #dropdown> <template #dropdown>
<el-dropdown-menu> <el-dropdown-menu>
<template v-for="(item, index) in navigations"> <template v-for="(item, index) in navigations">
<el-dropdown-item> <el-dropdown-item>
<span @click="navigateTo(item.path)">{{ item.title }}</span>
<span @click="openSpmUrl(`${item.path}`,item,item.navigationId)">{{ item.title }}</span>
</el-dropdown-item> </el-dropdown-item>
</template> </template>
<template v-if="token"> <template v-if="token">
@ -113,8 +114,7 @@ import {
useProductAffix, useProductAffix,
useSysDomain, useSysDomain,
useToken, useToken,
useUser,
useWebsite
useUser
} from "~/composables/configState"; } from "~/composables/configState";
import {useServerRequest} from "~/composables/useServerRequest"; import {useServerRequest} from "~/composables/useServerRequest";
import type {ApiResult} from "~/api"; import type {ApiResult} from "~/api";

2
components/CardList.vue

@ -1,5 +1,5 @@
<template> <template>
<div class="md:w-screen-xl m-auto relative sm:flex">
<div class="xl:w-screen-xl sm:flex xl:p-0 p-4 m-auto relative">
<el-row :gutter="24" class="flex"> <el-row :gutter="24" class="flex">
<template v-for="(item,index) in list" :key="index"> <template v-for="(item,index) in list" :key="index">
<el-col :span="6" class="mb-5 min-w-xs"> <el-col :span="6" class="mb-5 min-w-xs">

2
components/PageBanner.vue

@ -19,7 +19,7 @@
</linearGradient> </linearGradient>
</defs> </defs>
</svg> </svg>
<div class="md:w-screen-xl m-auto md:p-0 px-4">
<div class="md:w-screen-xl m-auto xl:p-0 px-4">
<div class="py-8 sm:py-16" _path="/templates" _dir="" _draft="false" _partial="false" _locale="" <div class="py-8 sm:py-16" _path="/templates" _dir="" _draft="false" _partial="false" _locale=""
_id="content:4.templates.yml" _type="yaml" _source="content" _file="4.templates.yml" _stem="4.templates" _id="content:4.templates.yml" _type="yaml" _source="content" _file="4.templates.yml" _stem="4.templates"
_extension="yml"> _extension="yml">

2
components/ProductList.vue

@ -9,7 +9,7 @@
</p> </p>
</div> </div>
</div> </div>
<div class="md:w-screen-xl m-auto relative md:flex md:p-0 p-4">
<div class="xl:w-screen-xl sm:flex xl:p-0 p-4 m-auto relative">
<el-row :gutter="24" class="flex"> <el-row :gutter="24" class="flex">
<template v-for="(item,index) in list" :key="index"> <template v-for="(item,index) in list" :key="index">
<el-col :span="6" :xs="24" class="mb-5 min-w-xs"> <el-col :span="6" :xs="24" class="mb-5 min-w-xs">

10
composables/useServerRequest.ts

@ -14,13 +14,11 @@ export const useServerRequest = <T>(url: string, opts?: UseFetchOptions<T, unkno
// 请求接口 // 请求接口
const baseUrl = ref(''); const baseUrl = ref('');
// 获取 Cookie // 获取 Cookie
const token = useCookie('token');
const token = useToken();
const _token = localStorage.getItem('token');
if(localStorage.getItem('token')){
const tokenStr = localStorage.getItem('token');
if(tokenStr){
token.value = JSON.parse(tokenStr)
}
if(_token){
token.value = _token
} }
baseUrl.value = runtimeConfig.public.apiBase; baseUrl.value = runtimeConfig.public.apiBase;

35
layouts/default.vue

@ -1,21 +1,22 @@
<template> <template>
<!-- 加载应用 -->
<template v-if="!loading" @scroll="handleScroll">
<!-- 管理中心界面 -->
<template v-if="getPath().startsWith('/manage')">
<slot/>
<div class="overflow-x-hidden">
<!-- 加载应用 -->
<template v-if="!loading" @scroll="handleScroll">
<!-- 管理中心界面 -->
<template v-if="getPath().startsWith('/manage')">
<slot/>
</template>
<!-- 默认布局 -->
<template v-else>
<app-header/>
<slot/>
<app-footer/>
</template>
</template> </template>
<!-- 默认布局 -->
<template v-else>
<app-header/>
<slot/>
<app-footer/>
</template>
</template>
<!-- 异常状态 -->
<UnderMaintenance v-if="loading"/>
<!-- 异常状态 -->
<UnderMaintenance v-if="loading"/>
</div>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import {useServerRequest} from "~/composables/useServerRequest"; import {useServerRequest} from "~/composables/useServerRequest";
@ -41,10 +42,10 @@ const subMenu = useSubMenu()
// //
onMounted(() => { onMounted(() => {
//onMountedlocalwindow //onMountedlocalwindow
getLoacl();
// getLoacl();
window.onbeforeunload = () => { window.onbeforeunload = () => {
//setLocal //setLocal
setLocal(); //
// setLocal(); //
}; };
}); });

8
nuxt.config.ts

@ -33,12 +33,12 @@ export default defineNuxtConfig({
public: { public: {
// 开发环境配置 // 开发环境配置
// tenantId: '5', // tenantId: '5',
// apiBase: 'http://127.0.0.1:9090/api',
// apiServer: 'http://127.0.0.1:9090/api',
apiBase: 'http://127.0.0.1:9090/api',
apiServer: 'http://127.0.0.1:9090/api',
// 生产环境 // 生产环境
apiBase: 'https://server.gxwebsoft.com/api',
apiServer: 'https://server.gxwebsoft.com/api',
// apiBase: 'https://server.gxwebsoft.com/api',
// apiServer: 'https://server.gxwebsoft.com/api',
globalTitle: '网宿软件', globalTitle: '网宿软件',
domain: 'websoft.top' domain: 'websoft.top'
}, },

4
pages/ask/components/CardList.vue

@ -1,8 +1,8 @@
<template> <template>
<div class="md:w-screen-xl m-auto relative sm:flex md:p-0 px-4" v-infinite-scroll="load">
<div class="xl:w-screen-xl sm:flex xl:p-0 p-4 m-auto relative" v-infinite-scroll="load">
<el-row :gutter="24" class="flex"> <el-row :gutter="24" class="flex">
<template v-for="(item,index) in list" :key="index"> <template v-for="(item,index) in list" :key="index">
<el-col :span="6" :xs="24" class="mb-5 min-w-xs">
<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(`/detail`,item,item.articleId,true)"> <el-card shadow="hover" :body-style="{ padding: '0px' }" class="hover:bg-gray-50 cursor-pointer" @click="openSpmUrl(`/detail`,item,item.articleId,true)">
<el-image :src="item.image" fit="fill" :lazy="true" class="w-full md:h-[150px] h-[199px] cursor-pointer" /> <el-image :src="item.image" fit="fill" :lazy="true" class="w-full md:h-[150px] h-[199px] cursor-pointer" />
<div class="flex-1 px-4 py-5 sm:p-6 !p-4"> <div class="flex-1 px-4 py-5 sm:p-6 !p-4">

2
pages/ask/index.vue

@ -1,6 +1,6 @@
<template> <template>
<PageBanner :layout="layout" title="社区" desc="分享研发成果 交流技术经验" /> <PageBanner :layout="layout" title="社区" desc="分享研发成果 交流技术经验" />
<el-tabs v-model="activeName" class="md:w-screen-xl m-auto relative sm:flex pb-2" @tab-click="handleClick">
<el-tabs v-model="activeName" class="xl:w-screen-xl sm:flex xl:p-0 p-4 m-auto relative pb-2" @tab-click="handleClick">
<el-tab-pane label="轻松一刻" name="happy"></el-tab-pane> <el-tab-pane label="轻松一刻" name="happy"></el-tab-pane>
<el-tab-pane label="企业官网" name="website"></el-tab-pane> <el-tab-pane label="企业官网" name="website"></el-tab-pane>
<el-tab-pane label="企业商城" name="weShop"></el-tab-pane> <el-tab-pane label="企业商城" name="weShop"></el-tab-pane>

4
pages/case/components/CardList.vue

@ -1,8 +1,8 @@
<template> <template>
<div class="md:w-screen-xl m-auto relative sm:flex md:p-0 p-4" v-infinite-scroll="load">
<div class="xl:w-screen-xl sm:flex xl:p-0 p-4 m-auto relative" v-infinite-scroll="load">
<el-row :gutter="24" class="flex"> <el-row :gutter="24" class="flex">
<template v-for="(item,index) in list" :key="index"> <template v-for="(item,index) in list" :key="index">
<el-col :span="6" :xs="24" class="mb-5 min-w-xs">
<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"> <el-card shadow="hover" :body-style="{ padding: '0px' }" class="hover:bg-gray-50 cursor-pointer">
<el-image :src="item.appIcon" fit="contain" :lazy="true" class="w-full md:h-[150px] h-[199px] cursor-pointer" /> <el-image :src="item.appIcon" fit="contain" :lazy="true" class="w-full md:h-[150px] h-[199px] cursor-pointer" />
<div class="flex-1 px-4 py-5 sm:p-6 !p-4"> <div class="flex-1 px-4 py-5 sm:p-6 !p-4">

4
pages/category/components/CardList.vue

@ -1,8 +1,8 @@
<template> <template>
<div class="md:w-screen-xl m-auto relative sm:flex" v-infinite-scroll="load">
<div class="xl:w-screen-xl sm:flex xl:p-0 p-4 m-auto relative" v-infinite-scroll="load">
<el-row :gutter="24" class="flex"> <el-row :gutter="24" class="flex">
<template v-for="(item,index) in list" :key="index"> <template v-for="(item,index) in list" :key="index">
<el-col :span="6" class="mb-5 min-w-xs">
<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(`/detail`,item,item.articleId,true)"> <el-card shadow="hover" :body-style="{ padding: '0px' }" class="hover:bg-gray-50 cursor-pointer" @click="openSpmUrl(`/detail`,item,item.articleId,true)">
<el-image :src="item.image" fit="fill" :lazy="true" class="w-full h-[150px] cursor-pointer" /> <el-image :src="item.image" fit="fill" :lazy="true" class="w-full h-[150px] cursor-pointer" />
<div class="flex-1 px-4 py-5 sm:p-6 !p-4"> <div class="flex-1 px-4 py-5 sm:p-6 !p-4">

4
pages/components/ArticleList.vue

@ -9,10 +9,10 @@
</p> </p>
</div> </div>
</div> </div>
<div class="md:w-screen-xl m-auto relative md:flex md:p-0 p-4" v-infinite-scroll="load">
<div class="xl:w-screen-xl sm:flex xl:p-0 p-4 m-auto relative" v-infinite-scroll="load">
<el-row :gutter="24" class="flex"> <el-row :gutter="24" class="flex">
<template v-for="(item,index) in list" :key="index"> <template v-for="(item,index) in list" :key="index">
<el-col :span="6" :xs="24" class="mb-5 min-w-xs">
<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" <el-card shadow="hover" :body-style="{ padding: '0px' }" class="hover:bg-gray-50 cursor-pointer"
@click="openSpmUrl(`/detail`,item,item.articleId,true)"> @click="openSpmUrl(`/detail`,item,item.articleId,true)">
<el-image :src="item.image" fit="fill" :lazy="true" class="w-full md:h-[150px] h-[199px] cursor-pointer"/> <el-image :src="item.image" fit="fill" :lazy="true" class="w-full md:h-[150px] h-[199px] cursor-pointer"/>

4
pages/components/CardList.vue

@ -9,10 +9,10 @@
</p> </p>
</div> </div>
</div> </div>
<div class="md:w-screen-xl m-auto relative md:flex md:p-0 p-4">
<div class="xl:w-screen-xl sm:flex xl:p-0 p-4 m-auto relative">
<el-row :gutter="24" class="flex"> <el-row :gutter="24" class="flex">
<template v-for="(item,index) in list" :key="index"> <template v-for="(item,index) in list" :key="index">
<el-col :span="6" :xs="24" class="mb-5 min-w-xs">
<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"> <el-card shadow="hover" :body-style="{ padding: '0px' }" class="hover:bg-gray-50 cursor-pointer">
<el-image <el-image
:src="`https://oss.wsdns.cn/20240925/e5e47100f4b6471395b3b81f834d2902.jpg?x-oss-process=image/resize,m_fixed,w_750/quality,Q_90`" :src="`https://oss.wsdns.cn/20240925/e5e47100f4b6471395b3b81f834d2902.jpg?x-oss-process=image/resize,m_fixed,w_750/quality,Q_90`"

4
pages/components/PlugList.vue

@ -9,10 +9,10 @@
</p> </p>
</div> </div>
</div> </div>
<div class="md:w-screen-xl m-auto relative md:flex md:p-0 p-4">
<div class="xl:w-screen-xl sm:flex xl:p-0 p-4 m-auto relative">
<el-row :gutter="24" class="flex"> <el-row :gutter="24" class="flex">
<template v-for="(item,index) in list" :key="index"> <template v-for="(item,index) in list" :key="index">
<el-col :span="6" :xs="24" class="mb-5 min-w-xs">
<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"> <el-card shadow="hover" :body-style="{ padding: '0px' }" class="hover:bg-gray-50 cursor-pointer">
<el-image <el-image
:src="`https://oss.wsdns.cn/20240925/e5e47100f4b6471395b3b81f834d2902.jpg?x-oss-process=image/resize,m_fixed,w_750/quality,Q_90`" :src="`https://oss.wsdns.cn/20240925/e5e47100f4b6471395b3b81f834d2902.jpg?x-oss-process=image/resize,m_fixed,w_750/quality,Q_90`"

4
pages/components/ProductList.vue

@ -9,10 +9,10 @@
</p> </p>
</div> </div>
</div> </div>
<div class="md:w-screen-xl m-auto relative md:flex md:p-0 p-4">
<div class="xl:w-screen-xl sm:flex xl:p-0 p-4 m-auto relative">
<el-row :gutter="24" class="flex"> <el-row :gutter="24" class="flex">
<template v-for="(item,index) in list" :key="index"> <template v-for="(item,index) in list" :key="index">
<el-col :span="6" :xs="24" class="mb-5 min-w-xs">
<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"> <el-card shadow="hover" :body-style="{ padding: '0px' }" class="hover:bg-gray-50 cursor-pointer">
<el-image <el-image
:src="`${item.image}`" :src="`${item.image}`"

27
pages/detail/components/LikeArticle.vue

@ -1,6 +1,5 @@
<template> <template>
<!-- PC -->
<el-affix class="hidden-sm-and-down" v-if="form" :offset="offset" @change="onAffix">
<el-affix class="lg:p-0 p-3" v-if="form" :offset="offset" @change="onAffix">
<el-button type="text" color="gray"> <el-button type="text" color="gray">
<div class="text-xl text-gray-600 ">你可能还喜欢</div> <div class="text-xl text-gray-600 ">你可能还喜欢</div>
<el-icon class="el-icon--right text-gray-600" color="#999999"> <el-icon class="el-icon--right text-gray-600" color="#999999">
@ -23,30 +22,6 @@
</el-card> </el-card>
</template> </template>
</el-affix> </el-affix>
<!-- H5 -->
<div class="hidden-xs-and-up p-3">
<el-button type="text" color="gray">
<div class="text-xl text-gray-600 ">你可能还喜欢</div>
<el-icon class="el-icon--right text-gray-600" color="#999999">
<ArrowRightBold/>
</el-icon>
</el-button>
<template v-for="(item,index) in list" :key="index">
<el-card shadow="hover" :body-style="{ padding: '0px' }" class="hover:bg-gray-50 cursor-pointer mt-3"
@click="openSpmUrl(`/detail`,item,item.articleId,true)">
<el-image :src="item.image" fit="fill" :lazy="true" class="w-full md:h-[150px] h-[199px] cursor-pointer"/>
<div class="flex-1 px-4 py-5 sm:p-6 !p-4">
<p class="text-gray-700 dark:text-white text-base font-semibold flex items-center gap-1.5">
<span class="flex-1 text-xl cursor-pointer max-h-[57px] overflow-hidden">{{ item.title }}</span>
</p>
<p class="flex items-center gap-1.5 py-2 text-gray-500">
<el-avatar :src="item.avatar" :size="20"/>
<span>{{ item.nickname }} · {{ dayjs(item.createTime).format('MM-DD hh:mm') }}</span>
</p>
</div>
</el-card>
</template>
</div>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { ArrowRightBold } from '@element-plus/icons-vue' import { ArrowRightBold } from '@element-plus/icons-vue'

2
pages/detail/components/PageBanner.vue

@ -19,7 +19,7 @@
</linearGradient> </linearGradient>
</defs> </defs>
</svg> </svg>
<div class="md:w-screen-xl m-auto p-1">
<div class="md:w-screen-xl m-auto px-3">
<Breadcrumb :data="form" /> <Breadcrumb :data="form" />
<div class="md:py-8 sm:py-16 md:px-0 px-4 py-8" _path="/templates" _dir="" _draft="false" _partial="false" _locale="" <div class="md:py-8 sm:py-16 md:px-0 px-4 py-8" _path="/templates" _dir="" _draft="false" _partial="false" _locale=""
_id="content:4.templates.yml" _type="yaml" _source="content" _file="4.templates.yml" _stem="4.templates" _id="content:4.templates.yml" _type="yaml" _source="content" _file="4.templates.yml" _stem="4.templates"

8
pages/detail/index.vue

@ -1,10 +1,9 @@
<!-- 文章详情 --> <!-- 文章详情 -->
<template> <template>
<PageBanner :form="form"/> <PageBanner :form="form"/>
<div class="page-main md:w-screen-xl m-auto" ref="container">
<div class="page-main md:w-screen-xl m-auto md:px-3" ref="container">
<el-row :gutter="24"> <el-row :gutter="24">
<el-col :span="18" :xs="24" class="min-w-xs">
<el-col :xs="24" :sm="12" :md="12" :lg="18" class="min-w-xs">
<div class="p-6 leading-7 bg-white md:rounded-lg text-lg line-height-loose text-gray-600 content" <div class="p-6 leading-7 bg-white md:rounded-lg text-lg line-height-loose text-gray-600 content"
v-html="form?.content"> v-html="form?.content">
</div> </div>
@ -19,7 +18,8 @@
</div> </div>
</div> </div>
</el-col> </el-col>
<el-col :span="6" :xs="24">
<!-- <el-col :xs="24" :sm="6" :md="4" :lg="3" :xl="6">-->
<el-col :xs="24" :sm="6" :md="6" :lg="6">
<!-- 你可能感兴趣 --> <!-- 你可能感兴趣 -->
<LikeArticle v-if="form" :form="form" /> <LikeArticle v-if="form" :form="form" />
</el-col> </el-col>

4
pages/developer/components/CardList.vue

@ -1,8 +1,8 @@
<template> <template>
<div class="md:w-screen-xl m-auto relative sm:flex" v-infinite-scroll="load">
<div class="xl:w-screen-xl sm:flex xl:p-0 p-4 m-auto relative" v-infinite-scroll="load">
<el-row :gutter="24" class="flex"> <el-row :gutter="24" class="flex">
<template v-for="(item,index) in list" :key="index"> <template v-for="(item,index) in list" :key="index">
<el-col :span="6" class="mb-5 min-w-xs">
<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(`/detail`,item,item.articleId)"> <el-card shadow="hover" :body-style="{ padding: '0px' }" class="hover:bg-gray-50 cursor-pointer" @click="openSpmUrl(`/detail`,item,item.articleId)">
<el-image :src="item.image" fit="fill" :lazy="true" class="w-full h-[150px] cursor-pointer" /> <el-image :src="item.image" fit="fill" :lazy="true" class="w-full h-[150px] cursor-pointer" />
<div class="flex-1 px-4 py-5 sm:p-6 !p-4"> <div class="flex-1 px-4 py-5 sm:p-6 !p-4">

4
pages/docs/components/CardList.vue

@ -1,8 +1,8 @@
<template> <template>
<div class="md:w-screen-xl m-auto relative sm:flex" v-infinite-scroll="load">
<div class="xl:w-screen-xl sm:flex xl:p-0 p-4 m-auto relative" v-infinite-scroll="load">
<el-row :gutter="24" class="flex"> <el-row :gutter="24" class="flex">
<template v-for="(item,index) in list" :key="index"> <template v-for="(item,index) in list" :key="index">
<el-col :span="6" class="mb-5 min-w-xs">
<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(`/detail`,item,item.articleId)"> <el-card shadow="hover" :body-style="{ padding: '0px' }" class="hover:bg-gray-50 cursor-pointer" @click="openSpmUrl(`/detail`,item,item.articleId)">
<el-image :src="item.image" fit="fill" :lazy="true" class="w-full h-[150px] cursor-pointer" /> <el-image :src="item.image" fit="fill" :lazy="true" class="w-full h-[150px] cursor-pointer" />
<div class="flex-1 px-4 py-5 sm:p-6 !p-4"> <div class="flex-1 px-4 py-5 sm:p-6 !p-4">

4
pages/down/components/CardList.vue

@ -1,8 +1,8 @@
<template> <template>
<div class="md:w-screen-xl m-auto relative sm:flex md:p-0 p-4" v-infinite-scroll="load">
<div class="xl:w-screen-xl sm:flex xl:p-0 p-4 m-auto relative" v-infinite-scroll="load">
<el-row :gutter="24" class="flex"> <el-row :gutter="24" class="flex">
<template v-for="(item,index) in list" :key="index"> <template v-for="(item,index) in list" :key="index">
<el-col :span="6" :xs="24" class="mb-5 min-w-xs">
<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"> <el-card shadow="hover" :body-style="{ padding: '0px' }" class="hover:bg-gray-50 cursor-pointer">
<el-image :src="`${item.image}`" fit="contain" :lazy="true" class="w-full md:h-[150px] h-[199px] cursor-pointer" /> <el-image :src="`${item.image}`" fit="contain" :lazy="true" class="w-full md:h-[150px] h-[199px] cursor-pointer" />
<div class="flex-1 px-4 py-5 sm:p-6 !p-4"> <div class="flex-1 px-4 py-5 sm:p-6 !p-4">

37
pages/down/index.vue

@ -1,6 +1,9 @@
<template> <template>
<PageBanner :layout="layout" :title="`开源版免费下载`" desc="`拥抱开源、坚守品质;致力于打造安全稳定高可用的WEB应用!`" />
<CardList :list="list" :disabled="disabled" @done="onSearch" />
<PageBanner :layout="layout" :title="`开源版免费下载`"
:desc="`拥抱开源、坚守品质;致力于打造安全稳定高可用的WEB应用!`"/>
<div class="text-3xl py-5">{{ count }}</div>
<el-button @click="increment">点击</el-button>
<CardList :list="list" :disabled="disabled" @done="onSearch"/>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import type {ApiResult, PageResult} from "~/api"; import type {ApiResult, PageResult} from "~/api";
@ -10,7 +13,7 @@ import type {Navigation} from "~/api/cms/navigation/model";
import type {CompanyParam} from "~/api/system/company/model"; import type {CompanyParam} from "~/api/system/company/model";
import CardList from './components/CardList.vue'; import CardList from './components/CardList.vue';
import type {CmsProduct} from "~/api/cms/cmsProduct/model"; import type {CmsProduct} from "~/api/cms/cmsProduct/model";
import { v4 as uuidv4 } from 'uuid';
const route = useRoute(); const route = useRoute();
// //
@ -31,40 +34,48 @@ const where = reactive<CompanyParam>({
}); });
const onSearch = () => { const onSearch = () => {
if(!disabled.value){
if (!disabled.value) {
page.value++; page.value++;
reload(route.path); reload(route.path);
} }
} }
const count = useToken()
function increment() {
count.value = uuidv4()
}
// //
const reload = async (path: string) => { const reload = async (path: string) => {
const {data: response} = await useServerRequest<ApiResult<PageResult<CmsProduct>>>('/cms/cms-product/page',{baseURL: runtimeConfig.public.apiServer, params: {
const {data: response} = await useServerRequest<ApiResult<PageResult<CmsProduct>>>('/cms/cms-product/page', {
baseURL: runtimeConfig.public.apiServer, params: {
page: page.value, page: page.value,
limit: 8, limit: 8,
price: 0,
keywords: where.keywords keywords: where.keywords
}})
if(response.value?.data){
}
})
if (response.value?.data) {
if (list.value.length < response.value?.data.count) { if (list.value.length < response.value?.data.count) {
disabled.value = false; disabled.value = false;
if (response.value?.data.list) { if (response.value?.data.list) {
list.value = list.value.concat(response.value?.data.list); list.value = list.value.concat(response.value?.data.list);
} }
}else {
} else {
disabled.value = true; disabled.value = true;
} }
if(response.value.data.count == 0){
if (response.value.data.count == 0) {
resultText.value = '暂无相关结果' resultText.value = '暂无相关结果'
} }
} }
} }
const { data: nav } = await useServerRequest<ApiResult<Navigation>>('/cms/cms-navigation/getNavigationByPath',{query: {path: route.path}})
if(nav.value?.data){
const {data: nav} = await useServerRequest<ApiResult<Navigation>>('/cms/cms-navigation/getNavigationByPath', {query: {path: route.path}})
if (nav.value?.data) {
form.value = nav.value?.data; form.value = nav.value?.data;
} }
// //
if(form.value?.layout){
if (form.value?.layout) {
layout.value = JSON.parse(form.value?.layout) layout.value = JSON.parse(form.value?.layout)
} }
@ -80,6 +91,6 @@ watch(
(path) => { (path) => {
reload(path); reload(path);
}, },
{ immediate: true }
{immediate: true}
); );
</script> </script>

4
pages/market/components/CardList.vue

@ -1,8 +1,8 @@
<template> <template>
<div class="md:w-screen-xl m-auto relative sm:flex md:p-0 px-4" v-infinite-scroll="load">
<div class="xl:w-screen-xl sm:flex xl:p-0 p-4 m-auto relative" v-infinite-scroll="load">
<el-row :gutter="24" class="flex"> <el-row :gutter="24" class="flex">
<template v-for="(item,index) in list" :key="index"> <template v-for="(item,index) in list" :key="index">
<el-col :span="6" :xs="24" class="mb-5 min-w-xs">
<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.productId,true)"> <el-card shadow="hover" :body-style="{ padding: '0px' }" class="hover:bg-gray-50 cursor-pointer" @click="openSpmUrl(`/item`, item, item.productId,true)">
<el-image <el-image
:src="item.image" :src="item.image"

4
pages/product/components/CardList.vue

@ -1,8 +1,8 @@
<template> <template>
<div class="md:w-screen-xl m-auto relative sm:flex md:p-0 p-4" v-infinite-scroll="load">
<div class="xl:w-screen-xl sm:flex xl:p-0 p-4 m-auto relative" v-infinite-scroll="load">
<el-row :gutter="24" class="flex"> <el-row :gutter="24" class="flex">
<template v-for="(item,index) in list" :key="index"> <template v-for="(item,index) in list" :key="index">
<el-col :span="6" :xs="24" class="mb-5 min-w-xs">
<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"> <el-card shadow="hover" :body-style="{ padding: '0px' }" class="hover:bg-gray-50 cursor-pointer">
<el-image :src="`${item.image}`" fit="contain" :lazy="true" class="w-full md:h-[150px] h-[199px] cursor-pointer" /> <el-image :src="`${item.image}`" fit="contain" :lazy="true" class="w-full md:h-[150px] h-[199px] cursor-pointer" />
<div class="flex-1 px-4 py-5 sm:p-6 !p-4"> <div class="flex-1 px-4 py-5 sm:p-6 !p-4">

Loading…
Cancel
Save