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