feat: 完成banner展示模块

This commit is contained in:
陈淳
2023-03-20 19:46:47 +08:00
parent 5a4ac549f6
commit b3b3ca3fe4
16 changed files with 74 additions and 40 deletions

View File

@@ -0,0 +1,8 @@
import myaxios from '@/utils/request'
export function getList(data){
return myaxios({
url: '/banner',
method: 'get',
params:data
})
};

View File

@@ -120,11 +120,11 @@ return `${import.meta.env.VITE_APP_BASEAPI}/file/${str}`
//关闭文件上传弹窗 //关闭文件上传弹窗
const fileHandleClose=()=>{ const fileHandleClose=()=>{
fileDialogVisible=false; fileDialogVisible.value=false;
} }
//文件上传成功后 //文件上传成功后
const onSuccess=(response)=>{ const onSuccess=(response)=>{
fileUrlList.value.push(response[0].id) fileUrlList.value.push(response.data[0].id)
} }
//图片上传 //图片上传
const imgAdd = async (pos, $file) => { const imgAdd = async (pos, $file) => {
@@ -132,7 +132,7 @@ const imgAdd = async (pos, $file) => {
var formdata = new FormData(); var formdata = new FormData();
formdata.append('file', $file); formdata.append('file', $file);
const response = await upload(formdata) const response = await upload(formdata)
const url = `${import.meta.env.VITE_APP_BASEAPI}/file/${response[0].id}`; const url = `${import.meta.env.VITE_APP_BASEAPI}/file/${response.data[0].id}`;
console.log(url) console.log(url)
md.value.$img2Url(pos, url); md.value.$img2Url(pos, url);

View File

@@ -147,8 +147,8 @@ const catalogueData = ref([]);
//子文章初始化 //子文章初始化
const loadArticleData = async () => { const loadArticleData = async () => {
const response= await articleall(route.params.discussId)
articleData.value = await articleall(route.params.discussId); articleData.value = response.data;
} }
//主题初始化 //主题初始化
@@ -158,10 +158,10 @@ const loadDiscuss = async (isRewrite) => {
//跳转路由 //跳转路由
router.push(`/article/${route.params.discussId}`); router.push(`/article/${route.params.discussId}`);
} }
discuss.value = await discussGet(route.params.discussId); discuss.value = (await discussGet(route.params.discussId)).data;
if (route.params.articleId != "") { if (route.params.articleId != "") {
const respose = await articleGet(route.params.articleId); const response = await articleGet(route.params.articleId);
discuss.value.content = respose.content; discuss.value.content = response.data.content;
} }
ContentHander(); ContentHander();
}; };

View File

@@ -120,12 +120,12 @@ onMounted(async()=>{
//加载discuss //加载discuss
const loadDiscussList=async()=>{ const loadDiscussList=async()=>{
const response= await getList(query); const response= await getList(query);
discussList.value=response.items; discussList.value=response.data.items;
total.value=Number( response.total); total.value=Number( response.data.total);
//全查,无需参数 //全查,无需参数
const topResponse=await getTopList(); const topResponse=await getTopList();
topDiscussList.value=topResponse.items; topDiscussList.value=topResponse.data.items;
} }
//进入添加主题页面 //进入添加主题页面

View File

@@ -128,7 +128,7 @@ const submit = async (formEl) => {
//主题创建 //主题创建
if (route.query.operType == "create") { if (route.query.operType == "create") {
const response= await discussAdd(discuss); const response= await discussAdd(discuss);
var routerPer = { path: `/article/${response.id}` }; var routerPer = { path: `/article/${response.data.id}` };
router.push(routerPer); router.push(routerPer);
} }
//主题更新 //主题更新
@@ -149,7 +149,7 @@ const submit = async (formEl) => {
//文章创建 //文章创建
if (route.query.operType == "create") { if (route.query.operType == "create") {
const response= await articleAdd(article); const response= await articleAdd(article);
var routerPer = { path: `/article/${route.query.discussId}/${response.id}` }; var routerPer = { path: `/article/${route.query.discussId}/${response.data.id}` };
router.push(routerPer); router.push(routerPer);
} }
//文章更新 //文章更新
@@ -186,18 +186,20 @@ onMounted(async () => {
//加载主题 //加载主题
const loadDiscuss = async () => { const loadDiscuss = async () => {
const response = await discussGet(route.query.discussId); const response = await discussGet(route.query.discussId);
editForm.content = response.content; const res=response.data
editForm.title = response.title; editForm.content = res.content;
editForm.types = response.types; editForm.title = res.title;
editForm.introduction = response.introduction; editForm.types = res.types;
discuss.plateId=response.plateId; editForm.introduction = res.introduction;
discuss.plateId=res.plateId;
}; };
//加载文章 //加载文章
const loadArticle = async () => { const loadArticle = async () => {
const response = await articleGet(route.query.articleId); const response = await articleGet(route.query.articleId);
editForm.content = response.content; const res=response.data
editForm.name = response.name; editForm.content = res.content;
editForm.discussId = response.discussId; editForm.name = res.name;
editForm.discussId = res.discussId;
}; };
</script> </script>
<style scoped> <style scoped>

View File

@@ -27,8 +27,9 @@
<el-carousel trigger="click" height="150px"> <el-carousel trigger="click" height="150px">
<el-carousel-item v-for="item in 4" :key="item"> <el-carousel-item v-for="item in bannerList">
<h3 class="small justify-center" text="2xl">你好{{ item }}</h3> <div class="carousel-font" :style="{color:item.color}">{{ item.name }}</div>
<el-image style="width: 100%; height: 100%" :src="item.logo" fit="cover" />
</el-carousel-item> </el-carousel-item>
</el-carousel> </el-carousel>
@@ -93,22 +94,25 @@ import AvatarInfo from '@/components/AvatarInfo.vue'
import BottomInfo from '@/components/BottomInfo.vue' import BottomInfo from '@/components/BottomInfo.vue'
import {getList} from '@/apis/plateApi.js' import {getList} from '@/apis/plateApi.js'
import {getList as bannerGetList} from '@/apis/bannerApi.js'
import {getList as discussGetList} from '@/apis/discussApi.js' import {getList as discussGetList} from '@/apis/discussApi.js'
import { onMounted, ref ,reactive} from 'vue' import { onMounted, ref ,reactive} from 'vue'
var plateList=ref([]); var plateList=ref([]);
var discussList=ref([]); var discussList=ref([]);
var bannerList=ref([]);
const items=[{user:"用户1"},{user:"用户2"},{user:"用户3"}] const items=[{user:"用户1"},{user:"用户2"},{user:"用户3"}]
//主题查询参数 //主题查询参数
const query=reactive({ const query=reactive({
pageNum:1, pageNum:1,
pageSize:10, pageSize:10,
}); });
onMounted(async()=>{
const response= await getList();
plateList.value= response.items;
const discussReponse=await discussGetList(query); //初始化
discussList.value= discussReponse.items; onMounted(async()=>{
plateList.value= ( await getList()).data.items;
discussList.value=(await discussGetList(query)).data.items;
bannerList.value=(await bannerGetList()).data.items
}); });
@@ -134,7 +138,12 @@ margin-bottom: 1rem;
background-color:#FFFFFF; background-color:#FFFFFF;
margin-bottom: 1rem; margin-bottom: 1rem;
} }
.carousel-font{
position: absolute;
z-index: 1;
top: 10%;
left: 10%;
}
.top-div .top-div

View File

@@ -80,11 +80,12 @@ const state = reactive({
function getUser() { function getUser() {
getUserProfile().then(response => { getUserProfile().then(response => {
state.user = response.user; const res=response.data;
state.dept=response.dept; state.user = res.user;
state.roles=response.roles; state.dept=res.dept;
state.roleGroup = response.roleGroup; state.roles=res.roles;
state.postGroup = response.postGroup; state.roleGroup = res.roleGroup;
state.postGroup = res.postGroup;
}); });
}; };
onMounted(()=>{ onMounted(()=>{

View File

@@ -115,9 +115,9 @@ async function uploadImg() {
formData.append("file", data); formData.append("file", data);
const response = await upload(formData) const response = await upload(formData)
open.value = false; open.value = false;
options.img = import.meta.env.VITE_APP_BASEAPI + "/file/" + response[0].id; options.img = import.meta.env.VITE_APP_BASEAPI + "/file/" + response.data[0].id;
userStore.icon = options.img; userStore.icon = options.img;
await updateUserIcon(response[0].id); await updateUserIcon(response.data[0].id);
alert("上传成功") alert("上传成功")
}); });
}; };

View File

@@ -49,10 +49,7 @@ function submit() {
userRef.value.validate(valid => { userRef.value.validate(valid => {
if (valid) { if (valid) {
updateUserProfile(props.user).then(response => { updateUserProfile(props.user).then(response => {
console.log(props.user.nick,"props.user.nick")
console.log(userStore,"userStore.nick")
userStore.name=props.user.nick userStore.name=props.user.nick
console.log(userStore.name,"userStore.name");
alert("修改成功"); alert("修改成功");
}); });
} }

View File

@@ -9,5 +9,6 @@ namespace Yi.BBS.Application.Contracts.Exhibition.Dtos.Banner
{ {
public class BannerGetListInputVo : PagedAndSortedResultRequestDto public class BannerGetListInputVo : PagedAndSortedResultRequestDto
{ {
public string Name { get; set; }
} }
} }

View File

@@ -15,5 +15,7 @@ namespace Yi.BBS.Application.Contracts.Exhibition.Dtos.Banner
public string Name { get; set; } public string Name { get; set; }
public string? Logo { get; set; } public string? Logo { get; set; }
public string? Color { get; set; } public string? Color { get; set; }
public DateTime CreationTime { get; set; }
} }
} }

View File

@@ -15,5 +15,7 @@ namespace Yi.BBS.Application.Contracts.Exhibition.Dtos
public string Name { get; set; } public string Name { get; set; }
public string? Logo { get; set; } public string? Logo { get; set; }
public string? Color { get; set; } public string? Color { get; set; }
public DateTime CreationTime { get; set; }
} }
} }

View File

@@ -4,13 +4,14 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using Yi.Framework.Data.Auditing;
using Yi.Framework.Data.Entities; using Yi.Framework.Data.Entities;
using Yi.Framework.Ddd.Entities; using Yi.Framework.Ddd.Entities;
namespace Yi.BBS.Domain.Exhibition.Entities namespace Yi.BBS.Domain.Exhibition.Entities
{ {
[SugarTable("Banner")] [SugarTable("Banner")]
public class BannerEntity : IEntity<long>, ISoftDelete public class BannerEntity : IEntity<long>, ISoftDelete, IAuditedObject
{ {
[SugarColumn(IsPrimaryKey = true)] [SugarColumn(IsPrimaryKey = true)]
public long Id { get; set; } public long Id { get; set; }
@@ -18,5 +19,12 @@ namespace Yi.BBS.Domain.Exhibition.Entities
public string? Logo { get; set; } public string? Logo { get; set; }
public string? Color { get; set; } public string? Color { get; set; }
public bool IsDeleted { get; set; } public bool IsDeleted { get; set; }
public DateTime CreationTime { get; set; }
public long? CreatorId { get; set; }
public long? LastModifierId { get; set; }
public DateTime? LastModificationTime { get; set; }
} }
} }

View File

@@ -30,4 +30,8 @@
</None> </None>
</ItemGroup> </ItemGroup>
<ItemGroup>
<Folder Include="wwwroot\" />
</ItemGroup>
</Project> </Project>