Merge branch 'refs/heads/abp' into digital-collectibles

This commit is contained in:
橙子
2024-11-02 21:06:59 +08:00
22 changed files with 900 additions and 10983 deletions

View File

@@ -0,0 +1,9 @@
namespace Yi.Framework.Bbs.Domain.Shared.Enums;
public enum GoodsTypeEnum
{
/// <summary>
/// 申请类型
/// </summary>
Apply
}

View File

@@ -0,0 +1,73 @@
using SqlSugar;
using Volo.Abp.Auditing;
using Volo.Abp.Domain.Entities;
using Yi.Framework.Bbs.Domain.Shared.Enums;
namespace Yi.Framework.Bbs.Domain.Entities.Shop;
/// <summary>
/// 商品定义表
/// </summary>
[SugarTable("BbsGoods")]
public class BbsGoodsAggregateRoot: AggregateRoot<Guid>, IHasCreationTime
{
/// <summary>
/// 上架时间
/// </summary>
public DateTime CreationTime { get; set; }
/// <summary>
/// 商品类型
/// </summary>
public GoodsTypeEnum GoodsType{ get; set; }
/// <summary>
/// 下架时间
/// </summary>
public DateTime? EndTime { get; set; }
/// <summary>
/// 商品名称
/// </summary>
public string Name { get; set; }
/// <summary>
/// 每人限购数量
/// </summary>
public int LimitNumber { get; set; }
/// <summary>
/// 当前库存数量
/// </summary>
public int StockNumber { get; set; }
/// <summary>
/// 商品图片url
/// </summary>
public string ImageUrl { get; set; }
/// <summary>
/// 描述
/// </summary>
public string Describe { get; set; }
/// <summary>
/// 编号
/// </summary>
public string Code { get; set; }
/// <summary>
/// 所需钱钱
/// </summary>
public decimal NeedMoney { get; set; }
/// <summary>
/// 所需价值
/// </summary>
public decimal NeedValue { get; set; }
/// <summary>
/// 所需积分
/// </summary>
public decimal NeedPoints { get; set; }
}

View File

@@ -0,0 +1,32 @@
using SqlSugar;
using Volo.Abp.Auditing;
using Volo.Abp.Domain.Entities;
namespace Yi.Framework.Bbs.Domain.Entities.Shop;
/// <summary>
/// 商品申请记录表
/// </summary>
[SugarTable("BbsGoodsApply")]
public class BbsGoodsApplyAggregateRoot: AggregateRoot<Guid>, IHasCreationTime
{
/// <summary>
/// 商品id
/// </summary>
public Guid GoodsId { get; set; }
/// <summary>
/// 申请时间
/// </summary>
public DateTime CreationTime { get; set; }
/// <summary>
/// 申请人用户id
/// </summary>
public Guid UserId { get; set; }
/// <summary>
/// 联系方式
/// </summary>
public string ContactInformation { get; set; }
}

View File

@@ -0,0 +1,6 @@
namespace Yi.Framework.Bbs.Domain.Entities.Shop.ValueObjects;
public class ShippingAddress
{
}

View File

@@ -0,0 +1,11 @@
using Volo.Abp.Domain.Services;
namespace Yi.Framework.Bbs.Domain.Managers;
/// <summary>
/// bbs商品领域
/// </summary>
public class BbsShopManager: DomainService
{
}

View File

@@ -19,7 +19,7 @@ namespace Yi.Framework.Rbac.SqlSugarCore.DataSeeds
public async Task SeedAsync(DataSeedContext context)
{
if (!await _repository.IsAnyAsync(x => x.MenuName == "系统管理"&&x.MenuSource==MenuSourceEnum.Pure))
if (!await _repository.IsAnyAsync(x => x.MenuName == "系统管理" && x.MenuSource == MenuSourceEnum.Pure))
{
await _repository.InsertManyAsync(GetSeedData());
}
@@ -37,7 +37,7 @@ namespace Yi.Framework.Rbac.SqlSugarCore.DataSeeds
OrderNum = 100
};
entities.Add(system);
//系统监控
MenuAggregateRoot monitoring = new MenuAggregateRoot(_guidGenerator.Create())
{
@@ -64,7 +64,7 @@ namespace Yi.Framework.Rbac.SqlSugarCore.DataSeeds
};
entities.Add(online);
//Yi框架
MenuAggregateRoot guide = new MenuAggregateRoot(_guidGenerator.Create())
{
@@ -77,7 +77,7 @@ namespace Yi.Framework.Rbac.SqlSugarCore.DataSeeds
Component = null
};
entities.Add(guide);
//用户管理
MenuAggregateRoot user = new MenuAggregateRoot(_guidGenerator.Create())
{
@@ -141,7 +141,7 @@ namespace Yi.Framework.Rbac.SqlSugarCore.DataSeeds
entities.Add(userRemove);
MenuAggregateRoot userResetPwd = new MenuAggregateRoot(_guidGenerator.Create())
MenuAggregateRoot userResetPwd = new MenuAggregateRoot(_guidGenerator.Create())
{
MenuName = "重置密码",
@@ -408,7 +408,7 @@ namespace Yi.Framework.Rbac.SqlSugarCore.DataSeeds
IsDeleted = false
};
entities.Add(postRemove);
//操作日志
MenuAggregateRoot operationLog = new MenuAggregateRoot(_guidGenerator.Create())
@@ -491,10 +491,78 @@ namespace Yi.Framework.Rbac.SqlSugarCore.DataSeeds
OrderNum = 100,
ParentId = loginLog.Id,
IsDeleted = false,
};
entities.Add(loginLogRemove);
//参数设置
MenuAggregateRoot config = new MenuAggregateRoot(_guidGenerator.Create())
{
MenuName = "参数设置",
PermissionCode = "system:config:list",
MenuType = MenuTypeEnum.Menu,
Router = "config",
IsShow = true,
IsLink = false,
IsCache = true,
Component = "/system/config/index",
MenuIcon = "ri:edit-box-line",
OrderNum = 94,
ParentId = system.Id,
IsDeleted = false
};
entities.Add(config);
MenuAggregateRoot configQuery = new MenuAggregateRoot(_guidGenerator.Create())
{
MenuName = "参数查询",
PermissionCode = "system:config:query",
MenuType = MenuTypeEnum.Component,
OrderNum = 100,
ParentId = config.Id,
IsDeleted = false
};
entities.Add(configQuery);
MenuAggregateRoot configAdd = new MenuAggregateRoot(_guidGenerator.Create())
{
MenuName = "参数新增",
PermissionCode = "system:config:add",
MenuType = MenuTypeEnum.Component,
OrderNum = 100,
ParentId = config.Id,
IsDeleted = false
};
entities.Add(configAdd);
MenuAggregateRoot configEdit = new MenuAggregateRoot(_guidGenerator.Create())
{
MenuName = "参数修改",
PermissionCode = "system:config:edit",
MenuType = MenuTypeEnum.Component,
OrderNum = 100,
ParentId = config.Id,
IsDeleted = false
};
entities.Add(configEdit);
MenuAggregateRoot configRemove = new MenuAggregateRoot(_guidGenerator.Create())
{
MenuName = "参数删除",
PermissionCode = "system:config:remove",
MenuType = MenuTypeEnum.Component,
OrderNum = 100,
ParentId = config.Id,
IsDeleted = false
};
entities.Add(configRemove);
//默认值
entities.ForEach(m =>
{

File diff suppressed because it is too large Load Diff

View File

@@ -28,7 +28,7 @@
</div>
<div style="display: flex; margin-right: 40px;position: relative;
top: -20px;">
top: -10px;">
<el-image
:preview-src-list="[getUrl(discuss.cover)]"
v-if="discuss.cover"

View File

@@ -14,7 +14,7 @@
<el-menu-item index="2" @click="enterStart"
style="color: red;font-weight: bolder;font-size: large;">开始</el-menu-item>
<el-menu-item index="3" @click="enterWatermelon"
>大西瓜</el-menu-item>
>数字藏品</el-menu-item>
<el-sub-menu index="4">
<template #title>学习</template>
<el-menu-item index="3-1">前端</el-menu-item>
@@ -232,7 +232,7 @@ const enterStart = () => {
}
const enterWatermelon=()=>{
alert("即将上线,敬请期待~")
alert("即将发布,敬请期待~")
}
</script>

View File

@@ -35,6 +35,12 @@
</el-icon>
<span>排行榜</span>
</el-menu-item>
<el-menu-item index="7" :route="{ path: '/money' }">
<el-icon>
<ShoppingCart />
</el-icon>
<span>商城即将上线</span>
</el-menu-item>
</el-menu>
</template>

View File

@@ -117,7 +117,15 @@ const router = createRouter({
path:"/money",
component: () => import("../views/money/Index.vue"),
meta: {
title: "钱钱",
title: "钱钱排行榜",
},
},
{
name:"shop",
path:"/shop",
component: () => import("../views/shop/Index.vue"),
meta: {
title: "商城",
},
},
],

View File

@@ -3,61 +3,63 @@
<el-row :gutter="20" class="top-div">
<el-col :span="17">
<div class="chat-hub">
<!-- <p @click="onClickToChatHub">点击前往-最新上线<span>聊天室 </span>现已支持<span>Ai助手</span>希望能帮助大家</p>-->
<p v-if="isIcp"
style="font-size: 25px;
<!-- <p @click="onClickToChatHub">点击前往-最新上线<span>聊天室 </span>现已支持<span>Ai助手</span>希望能帮助大家</p>-->
<p v-if="isIcp"
style="font-size: 25px;
color: blue;
background: red;
/* height: 80px; */
font-weight: 900;
text-align: center;
margin: 10px auto;">
本站点为个人内容分享全部资料免费开源学习所有数据为假数据
<br/>
不涉及企业团体论坛和经营销售等内容只做简单的成果展示
<br/>
富强民主文明和谐自由平等
<br/>
公正法治爱国敬业诚信友善
</p>
<p v-else @click="onClickToWeChat">点击关注-最新上线<span>.Net官方微信公众号 </span>分享有<span>深度</span>.Net知识希望能帮助大家</p>
本站点为个人内容分享全部资料免费开源学习所有数据为假数据
<br/>
不涉及企业团体论坛和经营销售等内容只做简单的成果展示
<br/>
富强民主文明和谐自由平等
<br/>
公正法治爱国敬业诚信友善
</p>
<p v-else @click="onClickToWeChat">
点击关注-最新上线<span>.Net官方微信公众号 </span>分享有<span>深度</span>.Net知识希望能帮助大家</p>
</div>
<div class="scrollbar">
<ScrollbarInfo/>
</div>
<el-row class="left-div">
<el-col :span="8" v-for="i in plateList" :key="i.id" class="plate" :style="{
'padding-left': i % 3 == 1 ? 0 : 0.2 + 'rem',
'padding-right': i % 3 == 0 ? 0 : 0.2 + 'rem',
}">
<img v-if="isIcp" src="@/assets/login.png" style="height: 80px;width: 100%" alt=""/>
<PlateCard v-else :name="i.name" :introduction="i.introduction" :id="i.id" :isPublish="i.isDisableCreateDiscuss"/>
<PlateCard v-else :name="i.name" :introduction="i.introduction" :id="i.id"
:isPublish="i.isDisableCreateDiscuss"/>
</el-col>
<template v-if="isDiscussFinished">
<el-col :span="24" v-for="i in discussList" :key="i.id">
<div ref="scrollableDiv" class="scrollable-div" v-infinite-scroll="loadDiscuss" style="height: 2500px;width: 100%; overflow-y: auto;" infinite-scroll-distance="10">
<el-col v-if="isDiscussFinished" :span="24" v-for="i in discussList" :key="i.id">
<img v-if="isIcp" src="@/assets/login.png" style="height: 150px;width: 100%" alt=""/>
<DisscussCard v-else :discuss="i"/>
<DisscussCard v-else :discuss="i" badge="置顶"/>
</el-col>
</template>
<template v-else>
<Skeleton :isBorder="true"/>
</template>
<template v-if="isAllDiscussFinished">
<Skeleton v-else :isBorder="true"/>
<el-col :span="24" v-for="i in allDiscussList" :key="i.id">
<img v-if="isIcp" src="@/assets/login.png" style="height: 150px;width: 100%" alt=""/>
<DisscussCard v-else :discuss="i"/>
</el-col>
</template>
<template v-else>
<Skeleton :isBorder="true"/>
</template>
<Skeleton v-if="!isAllDiscussFinished" :isBorder="true"/>
</div>
</el-row>
</el-col>
<el-col :span="7">
@@ -220,9 +222,9 @@ margin: 10px auto;">
title="意社区官方微信公众号"
width="800"
>
<div style="display: flex;justify-content: center;">
<img style="width: 585px; height: 186px" src="@/assets/wechat/share.png" alt=""/>
</div>
<div style="display: flex;justify-content: center;">
<img style="width: 585px; height: 186px" src="@/assets/wechat/share.png" alt=""/>
</div>
<template #footer>
<div class="dialog-footer">
@@ -232,6 +234,7 @@ margin: 10px auto;">
</div>
</template>
</el-dialog>
<el-backtop :right="100" :bottom="100" @click="clickBacktop" visibility-height="0"/>
</div>
</template>
@@ -286,6 +289,8 @@ const isAllDiscussFinished = ref(false);
const userAnalyseInfo = ref({});
const onlineNumber = ref(0);
const accessLogTab = ref()
const currentDiscussPageIndex = ref(1);
const activeList = [
{name: "签到", path: "/activity/sign", icon: "Present"},
{name: "等级", path: "/activity/level", icon: "Ticket"},
@@ -297,54 +302,62 @@ const activeList = [
{name: "开始", path: "/start", icon: "Position"},
{name: "聊天室", path: "/chat", icon: "ChatRound"},
];
const isIcp=import.meta.env.VITE_APP_ICP==="true";
//主题查询参数
const query = reactive({
skipCount: 1,
maxResultCount: 10,
isTop: true,
});
const isIcp = import.meta.env.VITE_APP_ICP === "true";
const weekQuery = reactive({accessLogType: "Request"});4
const weekQuery = reactive({accessLogType: "Request"});
const init = async () => {
const init=async ()=>{
//分阶段优化
await Promise.all([
(async ()=>{const {data: allDiscussData, config: allDiscussConfig} =
await getAllDiscussList({Type: 0, skipCount: 1, maxResultCount: 30,});
(async () => {
const {data: allDiscussData, config: allDiscussConfig} =
await getAllDiscussList({Type: 0, skipCount: currentDiscussPageIndex.value, maxResultCount: 10});
isAllDiscussFinished.value = allDiscussConfig.isFinish;
allDiscussList.value = allDiscussData.items;})(),
(async ()=>{const {data: plateData} = await getList();
plateList.value = plateData.items;})(),
(async ()=>{const {data: discussData, config: discussConfig} = await getHomeDiscuss();
allDiscussList.value = allDiscussData.items;
})(),
(async () => {
const {data: plateData} = await getList();
plateList.value = plateData.items;
})(),
(async () => {
const {data: discussData, config: discussConfig} = await getHomeDiscuss();
discussList.value = discussData;
isDiscussFinished.value = discussConfig.isFinish;})(),
(async ()=>{const {data: bannerData} = await bannerGetList();
bannerList.value = bannerData.items;})(),
(async ()=>{const {data: weekData} = await getWeek(weekQuery);
weekList.value = weekData;})(),
(async ()=>{const {data: pointData, config: pointConfig} = await getRankingPoints();
isDiscussFinished.value = discussConfig.isFinish;
})(),
(async () => {
const {data: bannerData} = await bannerGetList();
bannerList.value = bannerData.items;
})(),
(async () => {
const {data: weekData} = await getWeek(weekQuery);
weekList.value = weekData;
})(),
(async () => {
const {data: pointData, config: pointConfig} = await getRankingPoints();
pointList.value = pointData.items;
isPointFinished.value = pointConfig.isFinish;})(),
(async ()=>{const {data: userAnalyseInfoData} = await getUserAnalyse();
isPointFinished.value = pointConfig.isFinish;
})(),
(async () => {
const {data: userAnalyseInfoData} = await getUserAnalyse();
onlineNumber.value = userAnalyseInfoData.onlineNumber;
userAnalyseInfo.value = userAnalyseInfoData;})(),
userAnalyseInfo.value = userAnalyseInfoData;
})(),
]);
//不重要的请求滞后
const {data: friendData, config: friendConfig} = await getRecommendedFriend();
friendList.value = friendData;
isFriendFinished.value = friendConfig.isFinish;
const {data: themeData, config: themeConfig} = await getRecommendedTopic();
themeList.value = themeData;
isThemeFinished.value = themeConfig.isFinish;
const {data: friendData, config: friendConfig} = await getRecommendedFriend();
friendList.value = friendData;
isFriendFinished.value = friendConfig.isFinish;
const {data: themeData, config: themeConfig} = await getRecommendedTopic();
themeList.value = themeData;
isThemeFinished.value = themeConfig.isFinish;
await access();
}
//初始化
onMounted(async () => {
await init();
await init();
});
const weekXAxis = ["周一", "周二", "周三", "周四", "周五", "周六", "周日"];
@@ -446,11 +459,35 @@ const onClickAccessLog = async () => {
}
const wechatDialogVisible=ref(false)
let loadingDiscuss = false;
//加载滚动文章
const loadDiscuss = async () => {
if (loadingDiscuss === false) {
loadingDiscuss = true;
currentDiscussPageIndex.value += 1;
isAllDiscussFinished.value = false;
const {data: allDiscussData, config: allDiscussConfig} =
await getAllDiscussList({Type: 0, skipCount: currentDiscussPageIndex.value, maxResultCount: 10});
isAllDiscussFinished.value = allDiscussConfig.isFinish;
//在列表后新增
allDiscussList.value.push(...allDiscussData.items);
loadingDiscuss = false;
}
}
const wechatDialogVisible = ref(false)
//切换统计开关
const onClickWeekSwitch = async () => {
if (weekQuery.accessLogType === "HomeClick") {
weekQuery.accessLogType= "Request";
weekQuery.accessLogType = "Request";
} else if (weekQuery.accessLogType === "Request") {
weekQuery.accessLogType = "HomeClick";
}
@@ -458,10 +495,17 @@ const onClickWeekSwitch = async () => {
const {data: weekData} = await getWeek(weekQuery);
weekList.value = weekData;
}
const scrollableDiv = ref(null);
//回到顶部
const clickBacktop=()=>{
if (scrollableDiv.value) {
scrollableDiv.value.scrollTop = 0; // 设置滚动条到顶部
}
}
//打开微信公众号弹窗
const onClickToWeChat=()=>{
wechatDialogVisible.value=true;
const onClickToWeChat = () => {
wechatDialogVisible.value = true;
};
</script>
<style scoped lang="scss">
@@ -610,14 +654,15 @@ const onClickToWeChat=()=>{
.VisitsLineChart > > > .el-card__body {
padding: 0.5rem;
}
.VisitsLineChart p{
display: flex;
justify-content: flex-end;
color: #409eff;
cursor: pointer;
margin-top: 8px;
}
.VisitsLineChart p {
display: flex;
justify-content: flex-end;
color: #409eff;
cursor: pointer;
margin-top: 8px;
}
.statisChart {
width: 100%;
height: 300px;
@@ -664,4 +709,23 @@ const onClickToWeChat=()=>{
transform: translateX(-100%);
}
}
/* 设置滚动条的样式 */
.scrollable-div::-webkit-scrollbar {
width: 3px; /* 设置滚动条的宽度 */
}
.scrollable-div::-webkit-scrollbar-track {
background: #f1f1f1; /* 滚动条轨道背景 */
}
.scrollable-div::-webkit-scrollbar-thumb {
background: #cccccc; /* 滚动条的颜色 */
border-radius: 10px; /* 设置圆角 */
}
.scrollable-div::-webkit-scrollbar-thumb:hover {
background: #555; /* 滚动条 hover 时的颜色 */
}
</style>

View File

@@ -0,0 +1,74 @@
<template>
<div class="content-body">
<div class="title">
意社区-商城
</div>
<div class="header">
<span >你的钱钱
<el-tooltip effect="dark" content="社区通用货币,(来源:通过社区活动获取)" placement="top-start">
<el-icon><InfoFilled/></el-icon>
</el-tooltip>
50</span>
<span>你的价值
<el-tooltip effect="dark" content="数字藏品账号价值,(来源:通过社区小程序数字藏品获取)" placement="top-start">
<el-icon><InfoFilled/></el-icon>
</el-tooltip>
70</span>
<span> 你的积分
<el-tooltip effect="dark" content="邀请码积分,(来源:通过社区小程序个人中心邀请获取)" placement="top-start">
<el-icon><InfoFilled/></el-icon>
</el-tooltip>
40</span>
</div>
<div class="shop">
<el-row :gutter="30">
<el-col :span="6" v-for="i in 10">
<ShopCard/>
</el-col>
</el-row>
</div>
</div>
</template>
<style scoped>
.header span {
margin-left: 50px;
}
.el-col {
margin: 10px 0;
}
.content-body {
margin-bottom: 40px;
margin-top: 20px;
padding: 20px;
background-color: #ffffff;
width: 60%;
.title {
display: flex;
justify-content: center;
font-size: 40px;
margin-bottom: 20px;
}
.header {
display: flex;
justify-content: center;
margin-bottom: 40px;
}
.shop {
display: flex;
}
}
</style>
<script setup lang="ts">
import ShopCard from "./components/ShopCard.vue";
</script>

View File

@@ -0,0 +1,29 @@
<template>
<el-card shadow="hover">
<template #header>商品-物品A</template>
<img
src="https://ccnetcore.com/prod-api/wwwroot/logo.png"
style="width: 100%"
alt=""/>
<ul>
<li>所需钱钱扣除666</li>
<li>所需价值拥有777</li>
<li>所需积分拥有888</li>
<li>限制数量1</li>
</ul>
<el-divider />
<div class="bottom">
<el-button type="success">申请购买</el-button>
</div>
</el-card>
</template>
<script setup lang="ts">
</script>
<style scoped lang="scss">
.bottom
{
display: flex;
justify-content: flex-end;
margin-top: 20px;
}
</style>

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,27 @@
import { http } from "@/utils/http";
import type { Result, ResultPage } from "@/api/result";
/** 获取系统管理-参数配置列表 */
export const getConfigList = (data?: object) => {
return http.request<ResultPage>("get", "/config", { data });
};
/** 查询参数详细 */
export const getConfig = id => {
return http.request<Result>("get", `/config/${id}`, {});
};
/** 新增参数 */
export const addConfig = data => {
return http.request<Result>("post", `/config`, { data });
};
/** 修改参数 */
export const updateConfig = (id, data) => {
return http.request<Result>("put", `/config/${id}`, { data });
};
/** 删除参数 */
export const delConfig = id => {
return http.request<Result>("delete", `/config`, { params: { id } });
};

View File

@@ -0,0 +1,67 @@
<script setup lang="ts">
import { ref } from "vue";
import ReCol from "@/components/ReCol";
import { formRules } from "./utils/rule";
import { FormProps } from "./utils/types";
import { usePublicHooks } from "../hooks";
const props = withDefaults(defineProps<FormProps>(), {
formInline: () => ({
id: "",
configName: "",
configValue: "",
configKey: "",
configType: "",
remark: ""
})
});
const ruleFormRef = ref();
const { switchStyle } = usePublicHooks();
const newFormInline = ref(props.formInline);
function getRef() {
return ruleFormRef.value;
}
defineExpose({ getRef });
</script>
<template>
<el-form
ref="ruleFormRef"
:model="newFormInline"
:rules="formRules"
label-width="82px">
<el-row :gutter="30">
<re-col :value="12" :xs="24" :sm="24">
<el-form-item label="参数名称" prop="configName">
<el-input v-model="newFormInline.configName" clearable placeholder="请输入参数名称" />
</el-form-item>
</re-col>
<re-col :value="12" :xs="24" :sm="24">
<el-form-item label="参数键名" prop="configKey">
<el-input v-model="newFormInline.configKey" clearable placeholder="请输入参数键名" />
</el-form-item>
</re-col>
<re-col :value="12" :xs="24" :sm="24">
<el-form-item label="参数键值" prop="configValue">
<el-input v-model="newFormInline.configValue" clearable placeholder="请输入参数键值" />
</el-form-item>
</re-col>
<re-col :value="12" :xs="24" :sm="24">
<el-form-item label="系统内置">
<el-switch v-model="newFormInline.configType" inline-prompt :active-value="true" :inactive-value="false"
active-text="" inactive-text="" :style="switchStyle" />
</el-form-item>
</re-col>
<re-col>
<el-form-item label="备注" prop="remark">
<el-input v-model="newFormInline.remark" placeholder="请输入备注信息" type="textarea" />
</el-form-item>
</re-col>
</el-row>
</el-form>
</template>

View File

@@ -0,0 +1,117 @@
<script setup lang="ts">
import { ref } from "vue";
import { useConfig } from "./utils/hook";
import { PureTableBar } from "@/components/RePureTableBar";
import { useRenderIcon } from "@/components/ReIcon/src/hooks";
import Delete from "@iconify-icons/ep/delete";
import EditPen from "@iconify-icons/ep/edit-pen";
import Refresh from "@iconify-icons/ep/refresh";
import AddFill from "@iconify-icons/ri/add-circle-line";
defineOptions({
name: "SystemConfig"
});
const formRef = ref();
const tableRef = ref();
const {
form,
loading,
columns,
dataList,
onSearch,
resetForm,
openDialog,
handleDelete,
pagination,
rowStyle,
handleSelectionChange
} = useConfig();
</script>
<template>
<div class="main">
<el-form ref="formRef" :inline="true"
:model="form"
class="search-form bg-bg_color w-[99/100] pl-8 pt-[12px] overflow-auto">
<el-form-item label="参数名称:" prop="name">
<el-input v-model="form.configName" placeholder="请输入参数名称" clearable class="!w-[180px]" />
</el-form-item>
<el-form-item label="参数键名:" prop="key">
<el-input v-model="form.configKey" placeholder="请输入参数名称" clearable class="!w-[180px]" />
</el-form-item>
<el-form-item label="是否内置:" prop="state">
<el-select v-model="form.configType" placeholder="" clearable class="!w-[180px]">
<el-option label="是" :value="true" />
<el-option label="否" :value="false" />
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" :icon="useRenderIcon('ri:search-line')" :loading="loading" @click="onSearch">
搜索
</el-button>
<el-button :icon="useRenderIcon(Refresh)" @click="resetForm(formRef)">
重置
</el-button>
</el-form-item>
</el-form>
<PureTableBar title="参数设置" :columns="columns" :tableRef="tableRef?.getTableRef()" @refresh="onSearch" >
<template #buttons>
<el-button type="primary" :icon="useRenderIcon(AddFill)" @click="openDialog()">
新增参数
</el-button>
</template>
<template v-slot="{ size, dynamicColumns }">
<pure-table
ref="tableRef"
row-key="id"
align-whole="center"
table-layout="auto"
:loading="loading"
:size="size"
adaptive
:adaptiveConfig="{ offsetBottom: 108 }"
:data="dataList"
:columns="dynamicColumns"
:pagination="{ ...pagination, size }"
:header-cell-style="{
background: 'var(--el-fill-color-light)',
color: 'var(--el-text-color-primary)'
}"
@selection-change="handleSelectionChange">
<template #operation="{ row }">
<el-button class="reset-margin" link type="primary" :size="size" :icon="useRenderIcon(EditPen)"
@click="openDialog('修改', row)">
修改
</el-button>
<el-popconfirm :title="`是否确认删除 ? 参数: ${row.configName}`" @confirm="handleDelete(row)">
<template #reference>
<el-button class="reset-margin" link type="primary" :size="size" :icon="useRenderIcon(Delete)">
删除
</el-button>
</template>
</el-popconfirm>
</template>
</pure-table>
</template>
</PureTableBar>
</div>
</template>
<style lang="scss" scoped>
:deep(.el-dropdown-menu__item i) {
margin: 0;
}
.main-content {
margin: 24px 24px 0 !important;
}
.search-form {
:deep(.el-form-item) {
margin-bottom: 12px;
}
}
</style>

View File

@@ -0,0 +1,192 @@
import editForm from "../form.vue";
import { handleTree } from "@/utils/tree";
import { message } from "@/utils/message";
import { usePublicHooks } from "../../hooks";
import { addDialog } from "@/components/ReDialog";
import { reactive, ref, onMounted, h, toRaw } from "vue";
import type { FormItemProps } from "../utils/types";
import type { PaginationProps } from "@pureadmin/table";
import { cloneDeep, isAllEmpty, deviceDetection } from "@pureadmin/utils";
import { addConfig, delConfig, getConfig, getConfigList, updateConfig } from "@/api/system/config";
import { getPlatformConfig } from "@/config/index";
export function useConfig() {
const form = reactive({
configName: "",
configKey:"",
configType:"",
});
const pagination = reactive<PaginationProps>({
total: 0,
pageSize: 10,
currentPage: 1,
background: true
});
/** 高亮当前权限选中行 */
function rowStyle({ row: { id } }) {
return {
cursor: "pointer",
background: id === curRow.value?.id ? "var(--el-fill-color-light)" : ""
};
}
const curRow = ref();
const formRef = ref();
const dataList = ref([]);
const loading = ref(true);
const { tagStyle } = usePublicHooks();
const columns: TableColumnList = [
{
label: "参数主键",
prop: "id",
width: 180,
align: "left"
},
{
label: "参数名称",
prop: "configName",
width: 180,
align: "left"
},
{
label: "参数键名",
prop: "configKey",
width: 180,
align: "left"
},
{
label: "参数键值",
prop: "configValue",
width: 180,
align: "left"
},
{
label: "系统内置",
prop: "configType",
width: 180,
align: "left"
},
{
label: "备注",
prop: "remark",
minWidth: 120,
align: "left"
},
{
label: "创建时间",
prop: "creationTime",
width: 180,
align: "left"
},
{
label: "操作",
fixed: "right",
width: 210,
slot: "operation"
}
];
function handleSelectionChange(val) {
console.log("handleSelectionChange", val);
}
function resetForm(formEl) {
if (!formEl) return;
formEl.resetFields();
onSearch();
}
async function onSearch() {
loading.value = true;
const { data } = await getConfigList(toRaw(form));
dataList.value = data.items;
pagination.total = data.totalCount;
loading.value = false;
}
async function openDialog(title = "新增", row?: FormItemProps) {
let data: any = null;
if (title == "修改") {
const response = await getConfig(row?.id);
data = response.data;
}
addDialog({
title: `${title}参数`,
props: {
formInline: {
configName:data?.configName?? "",
configKey:data?.configKey?? "",
configValue:data?.configValue?? "",
configTYpe:data?.configType?? "",
remark:data?.remark?? "",
}
},
width: "40%",
draggable: true,
fullscreen: deviceDetection(),
fullscreenIcon: true,
closeOnClickModal: false,
contentRenderer: () => h(editForm, { ref: formRef }),
beforeSure: (done, { options }) => {
const FormRef = formRef.value.getRef();
const curData = options.props.formInline as FormItemProps;
function chores() {
message(`${title} 了参数名称为 ${curData.configName} 的这条数据`, {
type: "success"
});
done(); // 关闭弹框
onSearch(); // 刷新表格数据
}
FormRef.validate(async valid => {
if (valid) {
// 表单规则校验通过
if (title === "新增") {
// 实际开发先调用新增接口,再进行下面操作
console.log('新增参数');
await addConfig(curData);
chores();
} else {
// 实际开发先调用修改接口,再进行下面操作
curData.id = row.id
curData.creationTime = row.creationTime
await updateConfig(row.id, curData);
chores();
}
}
});
}
});
}
async function handleDelete(row) {
await delConfig([row.id]);
message(`您删除了参数名称为 ${row.configName} 的这条数据`, { type: "success" });
onSearch();
}
onMounted(() => {
onSearch();
});
return {
form,
loading,
columns,
dataList,
/** 搜索 */
onSearch,
/** 重置 */
resetForm,
/** 新增、修改部门 */
openDialog,
/** 删除部门 */
handleDelete,
pagination,
handleSelectionChange,
rowStyle
};
}

View File

@@ -0,0 +1,13 @@
import { reactive } from "vue";
import type { FormRules } from "element-plus";
/** 自定义表单规则校验 */
export const formRules = reactive(<FormRules>{
configName: [
{ required: true, message: "参数名称为必填项", trigger: "blur" }
],
configKey: [{ required: true, message: "参数键名为必填项", trigger: "blur" }],
configValue: [
{ required: true, message: "参数键值为必填项", trigger: "blur" }
]
});

View File

@@ -0,0 +1,14 @@
interface FormItemProps {
id: string;
configName: string;
configValue: string;
configKey: string;
configType: string;
remark: string;
creationTime:string;
}
interface FormProps {
formInline: FormItemProps;
}
export type { FormItemProps, FormProps };

View File

@@ -108,7 +108,7 @@ defineExpose({ getRef });
<el-input
v-model="newFormInline.routerName"
clearable
placeholder="请输入菜单名称"
placeholder="请输入路由名称"
class="w-full"
/>
</el-form-item>