细节修正
This commit is contained in:
@@ -121,7 +121,7 @@
|
|||||||
<if test="filter.isBanner != null">
|
<if test="filter.isBanner != null">
|
||||||
AND r.is_banner = #{filter.isBanner}
|
AND r.is_banner = #{filter.isBanner}
|
||||||
</if>
|
</if>
|
||||||
ORDER BY r.publish_time DESC, r.create_time DESC
|
ORDER BY r.create_time DESC, r.publish_time DESC
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<!-- 根据资源ID查询资源信息 -->
|
<!-- 根据资源ID查询资源信息 -->
|
||||||
@@ -138,7 +138,7 @@
|
|||||||
FROM tb_resource r
|
FROM tb_resource r
|
||||||
<include refid="Permission_Filter"/>
|
<include refid="Permission_Filter"/>
|
||||||
WHERE r.tag_id = #{tagId} AND r.deleted = 0
|
WHERE r.tag_id = #{tagId} AND r.deleted = 0
|
||||||
ORDER BY r.publish_time DESC, r.create_time DESC
|
ORDER BY r.create_time DESC, r.publish_time DESC
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<!-- 根据状态查询资源列表 -->
|
<!-- 根据状态查询资源列表 -->
|
||||||
@@ -147,7 +147,7 @@
|
|||||||
FROM tb_resource r
|
FROM tb_resource r
|
||||||
<include refid="Permission_Filter"/>
|
<include refid="Permission_Filter"/>
|
||||||
WHERE r.status = #{status} AND r.deleted = 0
|
WHERE r.status = #{status} AND r.deleted = 0
|
||||||
ORDER BY r.publish_time DESC, r.create_time DESC
|
ORDER BY r.create_time DESC, r.publish_time DESC
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<!-- 根据标签类型查询资源列表 -->
|
<!-- 根据标签类型查询资源列表 -->
|
||||||
@@ -156,7 +156,7 @@
|
|||||||
FROM tb_resource r
|
FROM tb_resource r
|
||||||
<include refid="Permission_Filter"/>
|
<include refid="Permission_Filter"/>
|
||||||
WHERE r.tag_id = #{type} AND r.deleted = 0
|
WHERE r.tag_id = #{type} AND r.deleted = 0
|
||||||
ORDER BY r.publish_time DESC, r.create_time DESC
|
ORDER BY r.create_time DESC, r.publish_time DESC
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<!-- 查询热门资源列表 -->
|
<!-- 查询热门资源列表 -->
|
||||||
@@ -177,7 +177,7 @@
|
|||||||
FROM tb_resource r
|
FROM tb_resource r
|
||||||
<include refid="Permission_Filter"/>
|
<include refid="Permission_Filter"/>
|
||||||
WHERE r.status = 1 AND r.deleted = 0
|
WHERE r.status = 1 AND r.deleted = 0
|
||||||
ORDER BY r.publish_time DESC, r.create_time DESC
|
ORDER BY r.create_time DESC, r.publish_time DESC
|
||||||
<if test="limit != null and limit > 0">
|
<if test="limit != null and limit > 0">
|
||||||
LIMIT #{limit}
|
LIMIT #{limit}
|
||||||
</if>
|
</if>
|
||||||
@@ -192,7 +192,7 @@
|
|||||||
OR content LIKE CONCAT('%', #{keyword}, '%')
|
OR content LIKE CONCAT('%', #{keyword}, '%')
|
||||||
OR summary LIKE CONCAT('%', #{keyword}, '%'))
|
OR summary LIKE CONCAT('%', #{keyword}, '%'))
|
||||||
AND r.status = 1 AND r.deleted = 0
|
AND r.status = 1 AND r.deleted = 0
|
||||||
ORDER BY r.publish_time DESC, r.create_time DESC
|
ORDER BY r.create_time DESC, r.publish_time DESC
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<!-- 检查资源标题是否存在 -->
|
<!-- 检查资源标题是否存在 -->
|
||||||
@@ -353,7 +353,7 @@
|
|||||||
<if test="filter.isBanner != null">
|
<if test="filter.isBanner != null">
|
||||||
AND r.is_banner = #{filter.isBanner}
|
AND r.is_banner = #{filter.isBanner}
|
||||||
</if>
|
</if>
|
||||||
ORDER BY r.publish_time DESC, r.create_time DESC
|
ORDER BY r.create_time DESC, r.publish_time DESC
|
||||||
LIMIT #{pageParam.pageSize} OFFSET #{pageParam.offset}
|
LIMIT #{pageParam.pageSize} OFFSET #{pageParam.offset}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
@@ -431,7 +431,7 @@
|
|||||||
</foreach>
|
</foreach>
|
||||||
</if>
|
</if>
|
||||||
<if test="filter.orderTypes == null or filter.orderTypes.size() == 0">
|
<if test="filter.orderTypes == null or filter.orderTypes.size() == 0">
|
||||||
ORDER BY r.view_count DESC, r.publish_time DESC, r.create_time DESC
|
ORDER BY r.view_count DESC, r.create_time DESC, r.publish_time DESC
|
||||||
</if>
|
</if>
|
||||||
LIMIT #{pageParam.pageSize} OFFSET #{pageParam.offset}
|
LIMIT #{pageParam.pageSize} OFFSET #{pageParam.offset}
|
||||||
</select>
|
</select>
|
||||||
|
|||||||
@@ -299,7 +299,7 @@ export interface DataCollectionLog extends BaseDTO {
|
|||||||
*/
|
*/
|
||||||
export interface ResourceSearchParams {
|
export interface ResourceSearchParams {
|
||||||
/** 关键词 */
|
/** 关键词 */
|
||||||
keyword?: string;
|
title?: string;
|
||||||
/** 标签ID(文章分类标签,tagType=1) */
|
/** 标签ID(文章分类标签,tagType=1) */
|
||||||
tagID?: string;
|
tagID?: string;
|
||||||
/** 状态 */
|
/** 状态 */
|
||||||
|
|||||||
@@ -10,9 +10,16 @@
|
|||||||
v-model="searchKeyword"
|
v-model="searchKeyword"
|
||||||
placeholder="搜索文章..."
|
placeholder="搜索文章..."
|
||||||
style="width: 300px"
|
style="width: 300px"
|
||||||
onkeydown=""
|
|
||||||
clearable
|
clearable
|
||||||
/>
|
@keyup.enter="handleSearch"
|
||||||
|
@clear="handleSearch"
|
||||||
|
>
|
||||||
|
<template #append>
|
||||||
|
<el-button @click="handleSearch">
|
||||||
|
<el-icon><Search /></el-icon>
|
||||||
|
</el-button>
|
||||||
|
</template>
|
||||||
|
</el-input>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<el-table :data="articles" style="width: 100%">
|
<el-table :data="articles" style="width: 100%">
|
||||||
@@ -94,7 +101,8 @@ defineOptions({
|
|||||||
name: 'ArticleManagementView'
|
name: 'ArticleManagementView'
|
||||||
});
|
});
|
||||||
import { ref, onMounted } from 'vue';
|
import { ref, onMounted } from 'vue';
|
||||||
import { ElButton, ElInput, ElTable, ElTableColumn, ElTag, ElPagination, ElMessage, ElMessageBox } from 'element-plus';
|
import { ElButton, ElInput, ElTable, ElTableColumn, ElTag, ElPagination, ElMessage, ElMessageBox, ElIcon } from 'element-plus';
|
||||||
|
import { Search } from '@element-plus/icons-vue';
|
||||||
import { useRouter } from 'vue-router';
|
import { useRouter } from 'vue-router';
|
||||||
import { resourceApi, resourceTagApi } from '@/apis/resource'
|
import { resourceApi, resourceTagApi } from '@/apis/resource'
|
||||||
import type { PageParam, ResourceSearchParams, Resource, Tag } from '@/types';
|
import type { PageParam, ResourceSearchParams, Resource, Tag } from '@/types';
|
||||||
@@ -108,7 +116,7 @@ const pageParam = ref<PageParam>({
|
|||||||
pageSize: 10
|
pageSize: 10
|
||||||
});
|
});
|
||||||
const filter = ref<ResourceSearchParams>({
|
const filter = ref<ResourceSearchParams>({
|
||||||
keyword: searchKeyword.value
|
title: searchKeyword.value
|
||||||
});
|
});
|
||||||
const total = ref<number>(0);
|
const total = ref<number>(0);
|
||||||
const articles = ref<Resource[]>([]);
|
const articles = ref<Resource[]>([]);
|
||||||
@@ -135,6 +143,7 @@ async function loadCategories() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function loadArticles() {
|
async function loadArticles() {
|
||||||
|
filter.value.title = searchKeyword.value;
|
||||||
const res = await resourceApi.getResourcePage(pageParam.value, filter.value);
|
const res = await resourceApi.getResourcePage(pageParam.value, filter.value);
|
||||||
if (res.success) {
|
if (res.success) {
|
||||||
articles.value = res.pageDomain?.dataList || [];
|
articles.value = res.pageDomain?.dataList || [];
|
||||||
@@ -142,6 +151,11 @@ async function loadArticles() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function handleSearch() {
|
||||||
|
pageParam.value.pageNumber = 1; // 搜索时重置到第一页
|
||||||
|
loadArticles();
|
||||||
|
}
|
||||||
|
|
||||||
function showCreateDialog() {
|
function showCreateDialog() {
|
||||||
// 尝试跳转
|
// 尝试跳转
|
||||||
router.push('/article/add')
|
router.push('/article/add')
|
||||||
|
|||||||
@@ -145,9 +145,9 @@
|
|||||||
type="primary"
|
type="primary"
|
||||||
link
|
link
|
||||||
size="small"
|
size="small"
|
||||||
@click="previewAgreementFile(configData[group.groupKey][item.configKey])"
|
@click="downloadAgreementFile(configData[group.groupKey][item.configKey])"
|
||||||
>
|
>
|
||||||
预览文件
|
下载文件
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button
|
<el-button
|
||||||
type="danger"
|
type="danger"
|
||||||
@@ -405,12 +405,12 @@ function handleFileUploadSuccess(files: any[], groupKey: string, configKey: stri
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 预览协议文件(新开tab页)
|
* 下载协议文件
|
||||||
*/
|
*/
|
||||||
function previewAgreementFile(fileId: string) {
|
function downloadAgreementFile(fileId: string) {
|
||||||
if (fileId) {
|
if (fileId) {
|
||||||
// 使用文件下载URL在新标签页打开
|
// 使用文件下载URL
|
||||||
const url = `${import.meta.env.VITE_API_BASE_URL || ''}/api/file/preview/${fileId}`;
|
const url = `${import.meta.env.VITE_API_BASE_URL || ''}/api/file/download/${fileId}`;
|
||||||
window.open(url, '_blank');
|
window.open(url, '_blank');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user