banner增加
This commit is contained in:
@@ -97,7 +97,7 @@
|
|||||||
横幅图片
|
横幅图片
|
||||||
</label>
|
</label>
|
||||||
<FileUpload :as-dialog="false" list-type="cover" v-model:cover-url="currentBanner.imageUrl"
|
<FileUpload :as-dialog="false" list-type="cover" v-model:cover-url="currentBanner.imageUrl"
|
||||||
accept="image/*" :max-size="10" tip="支持 jpg、png、gif 格式,建议尺寸1920x600" module="banner" />
|
accept="image/*" :max-size="10" tip="支持 jpg、png、gif 格式,建议尺寸1920x324" module="banner" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
@@ -106,6 +106,10 @@
|
|||||||
链接类型
|
链接类型
|
||||||
</label>
|
</label>
|
||||||
<div class="radio-group">
|
<div class="radio-group">
|
||||||
|
<label class="radio-item">
|
||||||
|
<input v-model="currentBanner.linkType" type="radio" :value="0" />
|
||||||
|
<span class="radio-label">无</span>
|
||||||
|
</label>
|
||||||
<label class="radio-item">
|
<label class="radio-item">
|
||||||
<input v-model="currentBanner.linkType" type="radio" :value="1" />
|
<input v-model="currentBanner.linkType" type="radio" :value="1" />
|
||||||
<span class="radio-label">资源</span>
|
<span class="radio-label">资源</span>
|
||||||
@@ -264,7 +268,7 @@ const pageParam = ref<PageParam>({
|
|||||||
const dialogVisible = ref(false);
|
const dialogVisible = ref(false);
|
||||||
const isEdit = ref(false);
|
const isEdit = ref(false);
|
||||||
const currentBanner = ref<Banner>({
|
const currentBanner = ref<Banner>({
|
||||||
linkType: 1,
|
linkType: 0,
|
||||||
status: 1,
|
status: 1,
|
||||||
orderNum: 0,
|
orderNum: 0,
|
||||||
});
|
});
|
||||||
@@ -308,7 +312,7 @@ function handlePageSizeChange(size: number) {
|
|||||||
function handleCreate() {
|
function handleCreate() {
|
||||||
isEdit.value = false;
|
isEdit.value = false;
|
||||||
currentBanner.value = {
|
currentBanner.value = {
|
||||||
linkType: 1,
|
linkType: 0,
|
||||||
status: 1,
|
status: 1,
|
||||||
orderNum: 0,
|
orderNum: 0,
|
||||||
};
|
};
|
||||||
@@ -369,7 +373,7 @@ async function loadSelectedItem(linkID: string, linkType: number) {
|
|||||||
function handleCloseDialog() {
|
function handleCloseDialog() {
|
||||||
dialogVisible.value = false;
|
dialogVisible.value = false;
|
||||||
currentBanner.value = {
|
currentBanner.value = {
|
||||||
linkType: 1,
|
linkType: 0,
|
||||||
status: 1,
|
status: 1,
|
||||||
orderNum: 0,
|
orderNum: 0,
|
||||||
};
|
};
|
||||||
@@ -463,11 +467,12 @@ async function handleDelete(banner: Banner) {
|
|||||||
// 获取链接类型文本
|
// 获取链接类型文本
|
||||||
function getLinkTypeText(linkType?: number): string {
|
function getLinkTypeText(linkType?: number): string {
|
||||||
const types: Record<number, string> = {
|
const types: Record<number, string> = {
|
||||||
|
0: '无',
|
||||||
1: '资源',
|
1: '资源',
|
||||||
2: '课程',
|
2: '课程',
|
||||||
3: '外部链接',
|
3: '外部链接',
|
||||||
};
|
};
|
||||||
return types[linkType || 1] || '未知';
|
return types[linkType ?? 0] || '未知';
|
||||||
}
|
}
|
||||||
|
|
||||||
// 格式化日期
|
// 格式化日期
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="banner-card">
|
<div class="banner-card">
|
||||||
<div class="banner-content" @click="handleLearn">
|
<div class="banner-content" :class="{ 'clickable': props.banner.linkType !== 0 }" @click="handleLearn">
|
||||||
<img :src="FILE_DOWNLOAD_URL + props.banner.imageUrl" alt="banner" class="banner-image">
|
<img :src="FILE_DOWNLOAD_URL + props.banner.imageUrl" alt="banner" class="banner-image">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -17,6 +17,10 @@ const props = defineProps<{
|
|||||||
}>();
|
}>();
|
||||||
console.log(props.banner);
|
console.log(props.banner);
|
||||||
function handleLearn() {
|
function handleLearn() {
|
||||||
|
// linkType 为 0 时不跳转,仅展示
|
||||||
|
if (props.banner.linkType === 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (props.banner.linkType === 1) {
|
if (props.banner.linkType === 1) {
|
||||||
console.log(`/resource/${props.banner.linkID}`);
|
console.log(`/resource/${props.banner.linkID}`);
|
||||||
router.push(`/article/show?articleId=${props.banner.linkID}`);
|
router.push(`/article/show?articleId=${props.banner.linkID}`);
|
||||||
@@ -41,7 +45,7 @@ function handleLearn() {
|
|||||||
position: relative;
|
position: relative;
|
||||||
background-color: red;
|
background-color: red;
|
||||||
|
|
||||||
:hover {
|
&.clickable:hover {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user