修复重大故障: JwtAuthenticationFilter文件,远程读取用户接口导致的服务器请求数量跑满

This commit is contained in:
2025-02-22 00:00:33 +08:00
parent d61e683d41
commit def17d1de9
51 changed files with 1748 additions and 1436 deletions

View File

@@ -30,7 +30,7 @@
</div>
</el-scrollbar>
<el-descriptions title="详细介绍" class="mt-5" />
<MdPreview id="preview-only" class="px-3" :modelValue="form.content" />
<MdPreview id="preview-only" class="px-3" :modelValue="form.content || '暂无详细内容'" />
</div>
<!-- 评分及评价 -->

View File

@@ -24,7 +24,7 @@
<nuxt-link :to="`/market/user/${form.userId}`" class="item text-center flex flex-col items-center">
<div class="text-gray-400">开发者</div>
<el-icon size="24" class="py-1"><Avatar /></el-icon>
<span class="text-gray-500">{{'WebSoft Inc.'}}</span>
<span class="text-gray-500">{{ form || 'WebSoft Inc.' }}</span>
</nuxt-link>
<el-divider class="opacity-40" style="height: 40px" direction="vertical" />
<nuxt-link :to="`http://git.gxwebsoft.com`" class="item text-center">
@@ -53,6 +53,7 @@
<script setup lang="ts">
import { ArrowLeft,View, Menu, Search,Compass, Cpu,Monitor, Download, Platform, Avatar } from '@element-plus/icons-vue'
import type {CmsWebsite} from "~/api/cms/cmsWebsite/model";
import {getUser, listUsers} from "~/api/system/user";
const i18n = useI18n();
@@ -82,8 +83,4 @@ const where = reactive<any>({
lang: i18n.locale.value
});
const reload = () => {
}
reload();
</script>

View File

@@ -1,45 +1,212 @@
<template>
<el-space class="flex items-center">
<el-input v-model="where.keywords" :placeholder="`${$t('searchKeywords')}...`" :suffix-icon="Search" @change="reload"/>
<div class="flex flex-col text-sm bg-white px-4 mt-5 pt-2 pb-2">
<div class="flex flex-col">
<el-space class="my-2">
<h4 class="text-sm w-[40px] text-gray-400 font-normal text-center">行业</h4>
<div class="flex-wrap">
<el-radio-group v-model="selectIndustry" @change="onIndustry">
<el-radio-button v-for="(item,index) in IndustryData" :key="index" :label="item.label" :value="item.value" />
</el-radio-group>
</div>
</el-space>
<el-space class="my-2">
<h4 class="text-sm w-[40px] text-gray-400 font-normal text-center">类型</h4>
<el-radio-group v-model="selectType" @change="onType">
<el-radio-button v-for="(item,index) in websiteType" :key="index" :label="item.label" :value="item.value" />
</el-radio-group>
</el-space>
<el-space class="my-2" :size="12">
<h4 class="text-sm w-[40px] text-gray-400 font-normal text-center">色系</h4>
<template v-for="(item,index) in colors" :key="index">
<nuxt-link :to="`?color=${item.label}`" @click="handleColor(item.label)">
<el-avatar v-if="selectColor == item.label" :size="28" :style="item.comments" class="border-solid border-1 border-gray-800 rounded-full"></el-avatar>
<el-avatar v-else :size="24" :style="item.comments"></el-avatar>
</nuxt-link>
</template>
</el-space>
</div>
</div>
<el-space class="gap-4 mt-5">
<el-button type="primary" @click="handleDefault">默认</el-button>
<el-button @click="handleLast">最新</el-button>
<el-button @click="handleHot">最热</el-button>
<el-button @click="handleFree">免费</el-button>
<el-button @click="handlePay">付费</el-button>
<el-button @click="handleOfficial">官方</el-button>
<el-input v-model="keywords" style="width: 400px" :placeholder="`云官网`"
:suffix-icon="Search" @change="handleKeywords"/>
<el-button @click="clearWhere">重置</el-button>
</el-space>
</template>
<script setup lang="ts">
import { Search } from '@element-plus/icons-vue'
import type {CmsArticle} from "~/api/cms/cmsArticle/model";
const i18n = useI18n();
import {Search} from '@element-plus/icons-vue'
import {listDictData} from "~/api/system/dict-data";
import IndustryData from "~/api/json/industry-data.json"
const props = withDefaults(
defineProps<{
title?: string;
desc?: string;
buyUrl?: string;
form?: CmsArticle;
value?: number;
}>(),
{}
defineProps<{
value?: number;
}>(),
{}
);
const emit = defineEmits<{
(e: 'done', where: any): void
}>()
// 关键词
const keywords = ref<string | undefined>()
const selectIndustry = ref<string>();
const selectType = ref<string>();
const selectColor = ref<string>();
// 行业
const industry = ref<string>()
// 类型
const websiteType = ref<any[]>([])
// 色系
const colors = ref<any[]>()
// 搜索表单
const where = reactive<any>({
keywords: '',
page: 1,
limit: 20,
status: 0,
parentId: undefined,
categoryId: undefined,
lang: i18n.locale.value
});
const reload = () => {
navigateTo(`/search/${where.keywords}`)
// 搜索条件
let where = <any>{
keywords: undefined,
websiteType: undefined,
industry: undefined,
color: undefined,
sort: undefined,
order: undefined
}
// 选择类型
const handleType = (text: string) => {
if (text === '全部') {
where.websiteType = undefined;
} else {
where.websiteType = text;
}
reload()
}
// 选择行业
const handleIndustry = (text: string) => {
if (text === '全部') {
where.industry = undefined;
} else {
where.industry = text;
}
reload()
}
// 选择色系
const handleColor = (text: string) => {
selectColor.value = text;
if (text === '彩色') {
where.color = undefined;
} else {
where.color = text;
}
reload()
}
const handleDefault = () => {
where.sort = undefined
where.order = undefined
reload()
}
const handleLast = () => {
where.sort = 'createTime'
where.order = 'desc'
reload()
}
const handleHot = () => {
where.sort = 'clicks'
where.order = 'desc'
reload()
}
const handleFree = () => {
where.price = 0
reload()
}
const handlePay = () => {
where.isPay = true
reload()
}
const handleOfficial = () => {
where.official = true
reload()
}
const clearWhere = () => {
where = {}
selectColor.value = ''
selectType.value = ''
selectIndustry.value = ''
reload()
}
// 搜索关键词
const handleKeywords = () => {
where.keywords = keywords.value;
reload()
}
// 跳转路由
const reload = () => {
navigateTo({
path: '/market',
query: where
})
}
const onType = (text: string) => {
where.websiteType = text
if(text == '全部'){
where.websiteType = undefined
}
reload();
}
const onIndustry = (text: string) => {
where.industry = text
if(text == '全部'){
where.industry = undefined
}
reload();
}
// 获取基础数据
const getData = () => {
listDictData({
dictCode: 'WebsiteType'
}).then(data => {
websiteType.value = data.map((item: any) => {
return {
label: item.dictDataName,
value: item.dictDataCode
}
})
})
listDictData({
dictCode: 'Color'
}).then(data => {
colors.value = data.map((item: any) => {
return {
label: item.dictDataName,
value: item.dictDataCode,
comments: item.comments
}
})
})
}
getData()
// watch(
// () => props.where,
// (query) => {
// if(query){
// where = query;
// }
// }
// );
</script>
<style scoped lang="less">
</style>

View File

@@ -7,123 +7,63 @@
<span class="text-large font-600 mr-3"> 插件市场 </span>
</template>
<template #extra>
<el-space class="flex items-center">
<el-select v-model="value" clearable placeholder="类型" style="width: 180px" @change="onTypes">
<el-option
v-for="item in types"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
<!-- <el-button-group v-model:value="where" @tab-click="handleClick" @change="reload">-->
<!-- <el-button>综合</el-button>-->
<!-- <el-button>最新</el-button>-->
<!-- <el-button>免费</el-button>-->
<!-- <el-button>付费</el-button>-->
<!-- </el-button-group>-->
<el-input v-model="where.keywords" style="width: 400px" :placeholder="`插件ID | 插件名称 | 域名`" :suffix-icon="Search" @change="reload"/>
</el-space>
<span class="text-gray-400">基于WebSoft开发的应用和插件</span>
</template>
<!-- 搜索工具栏 -->
<SearchBar :where="where" id="search" />
<!-- 应用列表 -->
<el-row :gutter="24" id="container" class="clearfix">
<el-col v-for="(item,index) in list" :key="index" :span="8" class="left mb-8">
<el-card shadow="hover" :body-style="{ padding: '0px' }" class="cursor-pointer" @mouseover="showDomain(item)" @mouseleave="hideDomain" @click="navigateTo(`/market/${item.websiteId}.html`)">
<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 gap-1.5">
<el-avatar
<el-card shadow="hover" :body-style="{ padding: '0px' }" class="cursor-pointer" @mouseover="showDomain(item)"
@mouseleave="hideDomain">
<nuxt-link :to="`/market/${item.websiteId}`">
<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 gap-1.5">
<el-avatar
:src="item.websiteLogo" shape="square" :size="55" style="background-color: white;"/>
<div class="flex-1 text-lg cursor-pointer flex flex-col">
{{ item.websiteName }}
<div class="flex justify-between items-center">
<sapn class="text-xs text-gray-400 font-normal line-clamp-1">
{{ id == item.websiteId ? item.domain : item.comments || '暂无描述' }}
</sapn>
<el-button size="small" round>获取</el-button>
<div class="flex-1 text-lg cursor-pointer flex flex-col">
{{ item.websiteName }}
<div class="flex justify-between items-center">
<sapn class="text-xs text-gray-400 font-normal line-clamp-1">
{{ id == item.websiteId ? item.domain : item.comments || '暂无描述' }}
</sapn>
<el-button size="small" round>获取</el-button>
</div>
</div>
</div>
<div class="item-image pt-3">
<el-image v-if="item.files" :src="`${JSON.parse(item.files)[0]}`" class="w-full h-1/2 max-h-[220px]"/>
<el-image v-else class="w-full h-[220px]"/>
</div>
</div>
<div class="item-image pt-3">
<el-image v-if="item.files" :src="`${JSON.parse(item.files)[0]}`" class="w-full h-1/2 max-h-[220px]" />
<el-image v-else class="w-full h-[220px]" />
</div>
</div>
</nuxt-link>
</el-card>
</el-col>
</el-row>
</el-page-header>
<Pagination :total="total" @done="search" />
<Pagination :total="total" @done="search"/>
</div>
</template>
<script setup lang="ts">
import { Picture as IconPicture } from '@element-plus/icons-vue'
import { ArrowLeft,View,Search } from '@element-plus/icons-vue'
import { ElNotification as notify } from 'element-plus'
import { useLayout, usePage} from "~/composables/configState";
import type {CmsNavigation} from "~/api/cms/cmsNavigation/model";
import type {CmsArticleParam} from "~/api/cms/cmsArticle/model";
import type { ComponentSize } from 'element-plus'
import { ElNotification } from 'element-plus'
import type { TabsPaneContext } from 'element-plus'
import dayjs from "dayjs";
import {getCmsNavigation, listCmsNavigation} from "~/api/cms/cmsNavigation";
import {pageCmsArticle} from "~/api/cms/cmsArticle";
import {ArrowLeft, View, Search} from '@element-plus/icons-vue'
import {pageCmsWebsiteAll} from "~/api/cms/cmsWebsite";
import type {CmsWebsite, CmsWebsiteParam} from "~/api/cms/cmsWebsite/model";
import SearchBar from "./components/SearchBar.vue";
const route = useRoute();
const router = useRouter();
const navId = ref();
// 页面信息
const list = ref<CmsWebsite[]>([]);
const i18n = useI18n();
const category = ref<CmsNavigation[]>([]);
const total = ref(0);
const activeName = ref('2839');
const id = ref<number>();
const loading = ref<boolean>(false)
const where = ref<CmsWebsiteParam>({
// 获取状态
const page = usePage();
const layout = useLayout();
// 搜索表单
const where = reactive<CmsWebsiteParam>({
keywords: '',
page: 1,
limit: 12,
status: undefined,
recommend: undefined,
market: true,
websiteType: undefined,
categoryId: undefined,
lang: undefined
});
const types = [
{
value: '网站',
label: '网站',
},
{
value: '小程序',
label: '小程序',
},
{
value: 'MacOS',
label: 'MacOS',
},
{
value: 'Windows',
label: 'Windows',
},
{
value: 'App',
label: 'App',
},
]
const goBack = () => {
router.back();
}
@@ -136,87 +76,58 @@ const hideDomain = () => {
};
// 加载页面数据
const reload = async () => {
await pageCmsWebsiteAll(where).then(response => {
if(response?.list){
list.value = response?.list;
const reload = async (where: any) => {
if (loading.value) return;
loading.value = true;
pageCmsWebsiteAll({
...where,
market: true,
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;
}
}).catch(() => {})
}
const bakReload = 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;
// 加载文章列表
if(data.parentId == 0 && category.value.length > 0){
where.parentId = page.value.navigationId;
}else {
where.categoryId = page.value.navigationId;
}
pageCmsArticle(where).then(response => {
if(response){
total.value = response.count;
list.value = response.list;
}
})
})
}).catch(() => {})
loading.value = false;
}).catch(() => {
loading.value = false;
}).finally(() => {
console.log('index>>>>')
})
}
/**
* 搜索
* @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 onTypes = (value: string) => {
where.websiteType = value;
reload();
const search = (data: CmsWebsiteParam) => {
navigateTo({
path: '/market',
query: {
market: 1,
page: data.page,
limit: 12
}
})
window.scrollTo(0, 0)
}
watch(
() => route.params.id,
(id) => {
// navId.value = getNavIdByParamsId(id);
reload();
},
{ immediate: true }
() => route.query,
(query) => {
where.value = query;
console.log(where.value,'>>>>>')
reload(query);
},
{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>