21
This commit is contained in:
parent
54605a0736
commit
4bbe43bf3e
|
|
@ -1,29 +0,0 @@
|
|||
-- =============================================
|
||||
-- Business Pages Table - Add Icon Fields
|
||||
-- 学业邑规划 - MiAssessment
|
||||
--
|
||||
-- 新增团队页 icon 配置字段:
|
||||
-- IconUrl - 未选中状态图标
|
||||
-- ActiveIconUrl - 选中状态图标
|
||||
--
|
||||
-- Database: SQL Server 2022
|
||||
-- =============================================
|
||||
|
||||
USE [MiAssessment_Business];
|
||||
GO
|
||||
|
||||
-- 新增 IconUrl 字段
|
||||
IF NOT EXISTS (SELECT * FROM sys.columns WHERE object_id = OBJECT_ID(N'[dbo].[business_pages]') AND name = 'IconUrl')
|
||||
BEGIN
|
||||
ALTER TABLE [dbo].[business_pages] ADD [IconUrl] NVARCHAR(500) NULL;
|
||||
PRINT N'Column IconUrl added successfully';
|
||||
END
|
||||
GO
|
||||
|
||||
-- 新增 ActiveIconUrl 字段
|
||||
IF NOT EXISTS (SELECT * FROM sys.columns WHERE object_id = OBJECT_ID(N'[dbo].[business_pages]') AND name = 'ActiveIconUrl')
|
||||
BEGIN
|
||||
ALTER TABLE [dbo].[business_pages] ADD [ActiveIconUrl] NVARCHAR(500) NULL;
|
||||
PRINT N'Column ActiveIconUrl added successfully';
|
||||
END
|
||||
GO
|
||||
|
|
@ -23,18 +23,6 @@ public class BusinessPage
|
|||
[MaxLength(100)]
|
||||
public string Title { get; set; } = null!;
|
||||
|
||||
/// <summary>
|
||||
/// 图标URL(未选中状态)
|
||||
/// </summary>
|
||||
[MaxLength(500)]
|
||||
public string? IconUrl { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 图标URL(选中状态)
|
||||
/// </summary>
|
||||
[MaxLength(500)]
|
||||
public string? ActiveIconUrl { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 详情图片URL
|
||||
/// </summary>
|
||||
|
|
|
|||
|
|
@ -29,6 +29,18 @@ public class Promotion
|
|||
[MaxLength(500)]
|
||||
public string ImageUrl { get; set; } = null!;
|
||||
|
||||
/// <summary>
|
||||
/// 图标URL(未选中状态)
|
||||
/// </summary>
|
||||
[MaxLength(500)]
|
||||
public string? IconUrl { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 图标URL(选中状态)
|
||||
/// </summary>
|
||||
[MaxLength(500)]
|
||||
public string? ActiveIconUrl { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 位置:1首页底部 2团队页
|
||||
/// </summary>
|
||||
|
|
|
|||
|
|
@ -15,16 +15,6 @@ public class BusinessPageDto
|
|||
/// </summary>
|
||||
public string Title { get; set; } = null!;
|
||||
|
||||
/// <summary>
|
||||
/// 图标URL(未选中状态)
|
||||
/// </summary>
|
||||
public string? IconUrl { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 图标URL(选中状态)
|
||||
/// </summary>
|
||||
public string? ActiveIconUrl { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 详情图片URL(长图)
|
||||
/// </summary>
|
||||
|
|
|
|||
|
|
@ -14,18 +14,6 @@ public class CreateBusinessPageRequest
|
|||
[MaxLength(100, ErrorMessage = "标题长度不能超过100个字符")]
|
||||
public string Title { get; set; } = null!;
|
||||
|
||||
/// <summary>
|
||||
/// 图标URL(未选中状态)
|
||||
/// </summary>
|
||||
[MaxLength(500, ErrorMessage = "图标URL长度不能超过500个字符")]
|
||||
public string? IconUrl { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 图标URL(选中状态)
|
||||
/// </summary>
|
||||
[MaxLength(500, ErrorMessage = "选中图标URL长度不能超过500个字符")]
|
||||
public string? ActiveIconUrl { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 详情图片URL(必填,长图)
|
||||
/// </summary>
|
||||
|
|
|
|||
|
|
@ -20,18 +20,6 @@ public class UpdateBusinessPageRequest
|
|||
[MaxLength(100, ErrorMessage = "标题长度不能超过100个字符")]
|
||||
public string Title { get; set; } = null!;
|
||||
|
||||
/// <summary>
|
||||
/// 图标URL(未选中状态)
|
||||
/// </summary>
|
||||
[MaxLength(500, ErrorMessage = "图标URL长度不能超过500个字符")]
|
||||
public string? IconUrl { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 图标URL(选中状态)
|
||||
/// </summary>
|
||||
[MaxLength(500, ErrorMessage = "选中图标URL长度不能超过500个字符")]
|
||||
public string? ActiveIconUrl { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 详情图片URL(必填,长图)
|
||||
/// </summary>
|
||||
|
|
|
|||
|
|
@ -18,6 +18,16 @@ public class CreatePromotionRequest
|
|||
[Required(ErrorMessage = "图片URL不能为空")]
|
||||
public string ImageUrl { get; set; } = null!;
|
||||
|
||||
/// <summary>
|
||||
/// 图标URL(未选中状态)
|
||||
/// </summary>
|
||||
public string? IconUrl { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 图标URL(选中状态)
|
||||
/// </summary>
|
||||
public string? ActiveIconUrl { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 位置:1首页底部 2团队页(必填)
|
||||
/// </summary>
|
||||
|
|
|
|||
|
|
@ -20,6 +20,16 @@ public class PromotionDto
|
|||
/// </summary>
|
||||
public string ImageUrl { get; set; } = null!;
|
||||
|
||||
/// <summary>
|
||||
/// 图标URL(未选中状态)
|
||||
/// </summary>
|
||||
public string? IconUrl { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 图标URL(选中状态)
|
||||
/// </summary>
|
||||
public string? ActiveIconUrl { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 位置:1首页底部 2团队页
|
||||
/// </summary>
|
||||
|
|
|
|||
|
|
@ -24,6 +24,16 @@ public class UpdatePromotionRequest
|
|||
[Required(ErrorMessage = "图片URL不能为空")]
|
||||
public string ImageUrl { get; set; } = null!;
|
||||
|
||||
/// <summary>
|
||||
/// 图标URL(未选中状态)
|
||||
/// </summary>
|
||||
public string? IconUrl { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 图标URL(选中状态)
|
||||
/// </summary>
|
||||
public string? ActiveIconUrl { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 位置:1首页底部 2团队页(必填)
|
||||
/// </summary>
|
||||
|
|
|
|||
|
|
@ -63,8 +63,6 @@ public class BusinessPageService : IBusinessPageService
|
|||
{
|
||||
Id = p.Id,
|
||||
Title = p.Title,
|
||||
IconUrl = p.IconUrl,
|
||||
ActiveIconUrl = p.ActiveIconUrl,
|
||||
ImageUrl = p.ImageUrl,
|
||||
HasActionButton = p.HasActionButton,
|
||||
ActionButtonText = p.ActionButtonText,
|
||||
|
|
@ -92,8 +90,6 @@ public class BusinessPageService : IBusinessPageService
|
|||
{
|
||||
Id = p.Id,
|
||||
Title = p.Title,
|
||||
IconUrl = p.IconUrl,
|
||||
ActiveIconUrl = p.ActiveIconUrl,
|
||||
ImageUrl = p.ImageUrl,
|
||||
HasActionButton = p.HasActionButton,
|
||||
ActionButtonText = p.ActionButtonText,
|
||||
|
|
@ -130,8 +126,6 @@ public class BusinessPageService : IBusinessPageService
|
|||
var entity = new BusinessPage
|
||||
{
|
||||
Title = request.Title,
|
||||
IconUrl = request.IconUrl,
|
||||
ActiveIconUrl = request.ActiveIconUrl,
|
||||
ImageUrl = request.ImageUrl,
|
||||
HasActionButton = request.HasActionButton,
|
||||
ActionButtonText = request.ActionButtonText,
|
||||
|
|
@ -172,8 +166,6 @@ public class BusinessPageService : IBusinessPageService
|
|||
|
||||
// 更新字段
|
||||
entity.Title = request.Title;
|
||||
entity.IconUrl = request.IconUrl;
|
||||
entity.ActiveIconUrl = request.ActiveIconUrl;
|
||||
entity.ImageUrl = request.ImageUrl;
|
||||
entity.HasActionButton = request.HasActionButton;
|
||||
entity.ActionButtonText = request.ActionButtonText;
|
||||
|
|
|
|||
|
|
@ -327,6 +327,8 @@ public class ContentService : IContentService
|
|||
Id = p.Id,
|
||||
Title = p.Title,
|
||||
ImageUrl = p.ImageUrl,
|
||||
IconUrl = p.IconUrl,
|
||||
ActiveIconUrl = p.ActiveIconUrl,
|
||||
Position = p.Position,
|
||||
PositionName = GetPositionName(p.Position),
|
||||
Sort = p.Sort,
|
||||
|
|
@ -350,6 +352,8 @@ public class ContentService : IContentService
|
|||
Id = p.Id,
|
||||
Title = p.Title,
|
||||
ImageUrl = p.ImageUrl,
|
||||
IconUrl = p.IconUrl,
|
||||
ActiveIconUrl = p.ActiveIconUrl,
|
||||
Position = p.Position,
|
||||
PositionName = GetPositionName(p.Position),
|
||||
Sort = p.Sort,
|
||||
|
|
@ -384,6 +388,8 @@ public class ContentService : IContentService
|
|||
{
|
||||
Title = request.Title,
|
||||
ImageUrl = request.ImageUrl,
|
||||
IconUrl = request.IconUrl,
|
||||
ActiveIconUrl = request.ActiveIconUrl,
|
||||
Position = request.Position,
|
||||
Sort = request.Sort,
|
||||
Status = request.Status,
|
||||
|
|
@ -426,6 +432,8 @@ public class ContentService : IContentService
|
|||
// 更新字段
|
||||
promotion.Title = request.Title;
|
||||
promotion.ImageUrl = request.ImageUrl;
|
||||
promotion.IconUrl = request.IconUrl;
|
||||
promotion.ActiveIconUrl = request.ActiveIconUrl;
|
||||
promotion.Position = request.Position;
|
||||
promotion.Sort = request.Sort;
|
||||
promotion.Status = request.Status;
|
||||
|
|
|
|||
|
|
@ -12,8 +12,6 @@ import type { PagedRequest, PagedResult, UpdateStatusRequest } from '@/types/com
|
|||
export interface BusinessPageItem {
|
||||
id: number
|
||||
title: string
|
||||
iconUrl?: string
|
||||
activeIconUrl?: string
|
||||
imageUrl: string
|
||||
hasActionButton: boolean
|
||||
actionButtonText?: string
|
||||
|
|
@ -33,8 +31,6 @@ export interface BusinessPageQuery extends PagedRequest {
|
|||
/** 创建请求 */
|
||||
export interface CreateBusinessPageRequest {
|
||||
title: string
|
||||
iconUrl?: string
|
||||
activeIconUrl?: string
|
||||
imageUrl: string
|
||||
hasActionButton: boolean
|
||||
actionButtonText?: string
|
||||
|
|
|
|||
|
|
@ -87,6 +87,10 @@ export interface PromotionItem {
|
|||
title: string
|
||||
/** 图片URL */
|
||||
imageUrl: string
|
||||
/** 图标URL(未选中状态) */
|
||||
iconUrl: string
|
||||
/** 图标URL(选中状态) */
|
||||
activeIconUrl: string
|
||||
/** 位置 */
|
||||
position: number
|
||||
/** 位置名称 */
|
||||
|
|
@ -121,6 +125,10 @@ export interface CreatePromotionRequest {
|
|||
title?: string
|
||||
/** 图片URL */
|
||||
imageUrl: string
|
||||
/** 图标URL(未选中状态) */
|
||||
iconUrl?: string
|
||||
/** 图标URL(选中状态) */
|
||||
activeIconUrl?: string
|
||||
/** 位置 */
|
||||
position: number
|
||||
/** 排序值 */
|
||||
|
|
|
|||
|
|
@ -150,24 +150,6 @@
|
|||
<el-input v-model="state.formData.title" placeholder="请输入标题" maxlength="100" show-word-limit />
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="图标(未选中)">
|
||||
<ImageUpload
|
||||
v-model="state.formData.iconUrl"
|
||||
placeholder="点击上传未选中图标"
|
||||
tip="建议尺寸64x64px,png格式"
|
||||
:max-size="2"
|
||||
/>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="图标(选中)">
|
||||
<ImageUpload
|
||||
v-model="state.formData.activeIconUrl"
|
||||
placeholder="点击上传选中图标"
|
||||
tip="建议尺寸64x64px,png格式"
|
||||
:max-size="2"
|
||||
/>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="介绍图片" prop="imageUrl" required>
|
||||
<ImageUpload
|
||||
v-model="state.formData.imageUrl"
|
||||
|
|
@ -233,8 +215,6 @@ import { DictSelect, ImageUpload } from '@/components'
|
|||
interface FormData {
|
||||
id?: number
|
||||
title: string
|
||||
iconUrl: string
|
||||
activeIconUrl: string
|
||||
imageUrl: string
|
||||
hasActionButton: boolean
|
||||
actionButtonText: string
|
||||
|
|
@ -289,8 +269,6 @@ const formRules: FormRules = {
|
|||
function getDefaultFormData(): FormData {
|
||||
return {
|
||||
title: '',
|
||||
iconUrl: '',
|
||||
activeIconUrl: '',
|
||||
imageUrl: '',
|
||||
hasActionButton: false,
|
||||
actionButtonText: '',
|
||||
|
|
@ -347,8 +325,6 @@ function handleEdit(row: BusinessPageItem) {
|
|||
state.formData = {
|
||||
id: row.id,
|
||||
title: row.title || '',
|
||||
iconUrl: row.iconUrl || '',
|
||||
activeIconUrl: row.activeIconUrl || '',
|
||||
imageUrl: row.imageUrl,
|
||||
hasActionButton: row.hasActionButton,
|
||||
actionButtonText: row.actionButtonText || '',
|
||||
|
|
@ -400,8 +376,6 @@ async function handleSubmit() {
|
|||
const fd = state.formData
|
||||
const data: CreateBusinessPageRequest | UpdateBusinessPageRequest = {
|
||||
title: fd.title,
|
||||
iconUrl: fd.iconUrl || undefined,
|
||||
activeIconUrl: fd.activeIconUrl || undefined,
|
||||
imageUrl: fd.imageUrl,
|
||||
hasActionButton: fd.hasActionButton,
|
||||
actionButtonText: fd.hasActionButton ? fd.actionButtonText : undefined,
|
||||
|
|
|
|||
|
|
@ -190,6 +190,27 @@
|
|||
/>
|
||||
</el-form-item>
|
||||
|
||||
<!-- 团队页位置时显示图标上传 -->
|
||||
<template v-if="state.formData.position === '2'">
|
||||
<el-form-item label="未选中图标" prop="iconUrl">
|
||||
<ImageUpload
|
||||
v-model="state.formData.iconUrl"
|
||||
placeholder="点击上传未选中图标"
|
||||
tip="建议尺寸:64x64,支持 jpg、png 格式"
|
||||
:max-size="2"
|
||||
/>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="选中图标" prop="activeIconUrl">
|
||||
<ImageUpload
|
||||
v-model="state.formData.activeIconUrl"
|
||||
placeholder="点击上传选中图标"
|
||||
tip="建议尺寸:64x64,支持 jpg、png 格式"
|
||||
:max-size="2"
|
||||
/>
|
||||
</el-form-item>
|
||||
</template>
|
||||
|
||||
<el-form-item label="位置" prop="position" required>
|
||||
<DictSelect
|
||||
v-model="state.formData.position"
|
||||
|
|
@ -254,6 +275,8 @@ interface PromotionFormData {
|
|||
id?: number
|
||||
title: string
|
||||
imageUrl: string
|
||||
iconUrl: string
|
||||
activeIconUrl: string
|
||||
position: string
|
||||
sort: number
|
||||
status: string
|
||||
|
|
@ -327,6 +350,8 @@ function getDefaultFormData(): PromotionFormData {
|
|||
return {
|
||||
title: '',
|
||||
imageUrl: '',
|
||||
iconUrl: '',
|
||||
activeIconUrl: '',
|
||||
position: '',
|
||||
sort: 0,
|
||||
status: '1'
|
||||
|
|
@ -430,6 +455,8 @@ function handleEdit(row: PromotionItem) {
|
|||
id: row.id,
|
||||
title: row.title || '',
|
||||
imageUrl: row.imageUrl,
|
||||
iconUrl: row.iconUrl || '',
|
||||
activeIconUrl: row.activeIconUrl || '',
|
||||
position: String(row.position),
|
||||
sort: row.sort,
|
||||
status: String(row.status)
|
||||
|
|
@ -490,6 +517,8 @@ async function handleSubmit() {
|
|||
const requestData: CreatePromotionRequest | UpdatePromotionRequest = {
|
||||
title: formData.title || undefined,
|
||||
imageUrl: formData.imageUrl,
|
||||
iconUrl: formData.iconUrl || undefined,
|
||||
activeIconUrl: formData.activeIconUrl || undefined,
|
||||
position: Number(formData.position),
|
||||
sort: formData.sort,
|
||||
status: Number(formData.status)
|
||||
|
|
|
|||
|
|
@ -32,10 +32,10 @@ public class TeamService : ITeamService
|
|||
{
|
||||
_logger.LogDebug("获取团队介绍信息");
|
||||
|
||||
// 从 business_pages 表查询启用状态的业务页,按排序降序
|
||||
var pages = await _dbContext.BusinessPages
|
||||
// 从 promotions 表查询团队页(Position=2)启用状态的宣传图,按排序降序
|
||||
var promotions = await _dbContext.Promotions
|
||||
.AsNoTracking()
|
||||
.Where(p => p.Status == 1 && !p.IsDeleted)
|
||||
.Where(p => p.Position == 2 && p.Status == 1 && !p.IsDeleted)
|
||||
.OrderByDescending(p => p.Sort)
|
||||
.Select(p => new TeamPageItemDto
|
||||
{
|
||||
|
|
@ -47,13 +47,13 @@ public class TeamService : ITeamService
|
|||
})
|
||||
.ToListAsync();
|
||||
|
||||
_logger.LogDebug("获取到 {Count} 个团队业务页", pages.Count);
|
||||
_logger.LogDebug("获取到 {Count} 个团队宣传图", promotions.Count);
|
||||
|
||||
return new TeamInfoDto
|
||||
{
|
||||
// 兼容旧版:保留 images 字段
|
||||
Images = pages.Select(p => p.ImageUrl).ToList(),
|
||||
Items = pages
|
||||
Images = promotions.Select(p => p.ImageUrl).ToList(),
|
||||
Items = promotions
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -390,6 +390,12 @@ public partial class MiAssessmentDbContext : DbContext
|
|||
entity.Property(e => e.ImageUrl)
|
||||
.HasMaxLength(500)
|
||||
.HasComment("图片URL");
|
||||
entity.Property(e => e.IconUrl)
|
||||
.HasMaxLength(500)
|
||||
.HasComment("图标URL(未选中状态)");
|
||||
entity.Property(e => e.ActiveIconUrl)
|
||||
.HasMaxLength(500)
|
||||
.HasComment("图标URL(选中状态)");
|
||||
entity.Property(e => e.Position)
|
||||
.HasDefaultValue(1)
|
||||
.HasComment("位置:1首页底部 2团队页");
|
||||
|
|
@ -422,12 +428,6 @@ public partial class MiAssessmentDbContext : DbContext
|
|||
entity.Property(e => e.Title)
|
||||
.HasMaxLength(100)
|
||||
.HasComment("标题");
|
||||
entity.Property(e => e.IconUrl)
|
||||
.HasMaxLength(500)
|
||||
.HasComment("图标URL(未选中状态)");
|
||||
entity.Property(e => e.ActiveIconUrl)
|
||||
.HasMaxLength(500)
|
||||
.HasComment("图标URL(选中状态)");
|
||||
entity.Property(e => e.ImageUrl)
|
||||
.HasMaxLength(500)
|
||||
.HasComment("详情图片URL");
|
||||
|
|
|
|||
|
|
@ -22,18 +22,6 @@ public class BusinessPage
|
|||
[MaxLength(100)]
|
||||
public string? Title { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 图标URL(未选中状态)
|
||||
/// </summary>
|
||||
[MaxLength(500)]
|
||||
public string? IconUrl { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 图标URL(选中状态)
|
||||
/// </summary>
|
||||
[MaxLength(500)]
|
||||
public string? ActiveIconUrl { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 详情图片URL
|
||||
/// </summary>
|
||||
|
|
|
|||
|
|
@ -29,6 +29,18 @@ public class Promotion
|
|||
[MaxLength(500)]
|
||||
public string ImageUrl { get; set; } = null!;
|
||||
|
||||
/// <summary>
|
||||
/// 图标URL(未选中状态)
|
||||
/// </summary>
|
||||
[MaxLength(500)]
|
||||
public string? IconUrl { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 图标URL(选中状态)
|
||||
/// </summary>
|
||||
[MaxLength(500)]
|
||||
public string? ActiveIconUrl { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 位置:1首页底部 2团队页
|
||||
/// </summary>
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user