feat: 完成banner展示模块
This commit is contained in:
8
Yi.BBS.Vue3/src/apis/bannerApi.js
Normal file
8
Yi.BBS.Vue3/src/apis/bannerApi.js
Normal file
@@ -0,0 +1,8 @@
|
||||
import myaxios from '@/utils/request'
|
||||
export function getList(data){
|
||||
return myaxios({
|
||||
url: '/banner',
|
||||
method: 'get',
|
||||
params:data
|
||||
})
|
||||
};
|
||||
@@ -120,11 +120,11 @@ return `${import.meta.env.VITE_APP_BASEAPI}/file/${str}`
|
||||
|
||||
//关闭文件上传弹窗
|
||||
const fileHandleClose=()=>{
|
||||
fileDialogVisible=false;
|
||||
fileDialogVisible.value=false;
|
||||
}
|
||||
//文件上传成功后
|
||||
const onSuccess=(response)=>{
|
||||
fileUrlList.value.push(response[0].id)
|
||||
fileUrlList.value.push(response.data[0].id)
|
||||
}
|
||||
//图片上传
|
||||
const imgAdd = async (pos, $file) => {
|
||||
@@ -132,7 +132,7 @@ const imgAdd = async (pos, $file) => {
|
||||
var formdata = new FormData();
|
||||
formdata.append('file', $file);
|
||||
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)
|
||||
md.value.$img2Url(pos, url);
|
||||
|
||||
|
||||
@@ -147,8 +147,8 @@ const catalogueData = ref([]);
|
||||
|
||||
//子文章初始化
|
||||
const loadArticleData = async () => {
|
||||
|
||||
articleData.value = await articleall(route.params.discussId);
|
||||
const response= await articleall(route.params.discussId)
|
||||
articleData.value = response.data;
|
||||
}
|
||||
|
||||
//主题初始化
|
||||
@@ -158,10 +158,10 @@ const loadDiscuss = async (isRewrite) => {
|
||||
//跳转路由
|
||||
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 != "") {
|
||||
const respose = await articleGet(route.params.articleId);
|
||||
discuss.value.content = respose.content;
|
||||
const response = await articleGet(route.params.articleId);
|
||||
discuss.value.content = response.data.content;
|
||||
}
|
||||
ContentHander();
|
||||
};
|
||||
|
||||
@@ -120,12 +120,12 @@ onMounted(async()=>{
|
||||
//加载discuss
|
||||
const loadDiscussList=async()=>{
|
||||
const response= await getList(query);
|
||||
discussList.value=response.items;
|
||||
total.value=Number( response.total);
|
||||
discussList.value=response.data.items;
|
||||
total.value=Number( response.data.total);
|
||||
|
||||
//全查,无需参数
|
||||
const topResponse=await getTopList();
|
||||
topDiscussList.value=topResponse.items;
|
||||
topDiscussList.value=topResponse.data.items;
|
||||
}
|
||||
|
||||
//进入添加主题页面
|
||||
|
||||
@@ -128,7 +128,7 @@ const submit = async (formEl) => {
|
||||
//主题创建
|
||||
if (route.query.operType == "create") {
|
||||
const response= await discussAdd(discuss);
|
||||
var routerPer = { path: `/article/${response.id}` };
|
||||
var routerPer = { path: `/article/${response.data.id}` };
|
||||
router.push(routerPer);
|
||||
}
|
||||
//主题更新
|
||||
@@ -149,7 +149,7 @@ const submit = async (formEl) => {
|
||||
//文章创建
|
||||
if (route.query.operType == "create") {
|
||||
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);
|
||||
}
|
||||
//文章更新
|
||||
@@ -186,18 +186,20 @@ onMounted(async () => {
|
||||
//加载主题
|
||||
const loadDiscuss = async () => {
|
||||
const response = await discussGet(route.query.discussId);
|
||||
editForm.content = response.content;
|
||||
editForm.title = response.title;
|
||||
editForm.types = response.types;
|
||||
editForm.introduction = response.introduction;
|
||||
discuss.plateId=response.plateId;
|
||||
const res=response.data
|
||||
editForm.content = res.content;
|
||||
editForm.title = res.title;
|
||||
editForm.types = res.types;
|
||||
editForm.introduction = res.introduction;
|
||||
discuss.plateId=res.plateId;
|
||||
};
|
||||
//加载文章
|
||||
const loadArticle = async () => {
|
||||
const response = await articleGet(route.query.articleId);
|
||||
editForm.content = response.content;
|
||||
editForm.name = response.name;
|
||||
editForm.discussId = response.discussId;
|
||||
const res=response.data
|
||||
editForm.content = res.content;
|
||||
editForm.name = res.name;
|
||||
editForm.discussId = res.discussId;
|
||||
};
|
||||
</script>
|
||||
<style scoped>
|
||||
|
||||
@@ -27,8 +27,9 @@
|
||||
|
||||
|
||||
<el-carousel trigger="click" height="150px">
|
||||
<el-carousel-item v-for="item in 4" :key="item">
|
||||
<h3 class="small justify-center" text="2xl">你好{{ item }}</h3>
|
||||
<el-carousel-item v-for="item in bannerList">
|
||||
<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>
|
||||
|
||||
@@ -93,22 +94,25 @@ import AvatarInfo from '@/components/AvatarInfo.vue'
|
||||
import BottomInfo from '@/components/BottomInfo.vue'
|
||||
|
||||
import {getList} from '@/apis/plateApi.js'
|
||||
import {getList as bannerGetList} from '@/apis/bannerApi.js'
|
||||
import {getList as discussGetList} from '@/apis/discussApi.js'
|
||||
import { onMounted, ref ,reactive} from 'vue'
|
||||
var plateList=ref([]);
|
||||
var discussList=ref([]);
|
||||
var bannerList=ref([]);
|
||||
|
||||
const items=[{user:"用户1"},{user:"用户2"},{user:"用户3"}]
|
||||
//主题查询参数
|
||||
const query=reactive({
|
||||
pageNum:1,
|
||||
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;
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
|
||||
.carousel-font{
|
||||
position: absolute;
|
||||
z-index: 1;
|
||||
top: 10%;
|
||||
left: 10%;
|
||||
}
|
||||
|
||||
|
||||
.top-div
|
||||
|
||||
@@ -80,11 +80,12 @@ const state = reactive({
|
||||
|
||||
function getUser() {
|
||||
getUserProfile().then(response => {
|
||||
state.user = response.user;
|
||||
state.dept=response.dept;
|
||||
state.roles=response.roles;
|
||||
state.roleGroup = response.roleGroup;
|
||||
state.postGroup = response.postGroup;
|
||||
const res=response.data;
|
||||
state.user = res.user;
|
||||
state.dept=res.dept;
|
||||
state.roles=res.roles;
|
||||
state.roleGroup = res.roleGroup;
|
||||
state.postGroup = res.postGroup;
|
||||
});
|
||||
};
|
||||
onMounted(()=>{
|
||||
|
||||
@@ -115,9 +115,9 @@ async function uploadImg() {
|
||||
formData.append("file", data);
|
||||
const response = await upload(formData)
|
||||
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;
|
||||
await updateUserIcon(response[0].id);
|
||||
await updateUserIcon(response.data[0].id);
|
||||
alert("上传成功")
|
||||
});
|
||||
};
|
||||
|
||||
@@ -49,10 +49,7 @@ function submit() {
|
||||
userRef.value.validate(valid => {
|
||||
if (valid) {
|
||||
updateUserProfile(props.user).then(response => {
|
||||
console.log(props.user.nick,"props.user.nick")
|
||||
console.log(userStore,"userStore.nick")
|
||||
userStore.name=props.user.nick
|
||||
console.log(userStore.name,"userStore.name");
|
||||
alert("修改成功");
|
||||
});
|
||||
}
|
||||
|
||||
Binary file not shown.
@@ -9,5 +9,6 @@ namespace Yi.BBS.Application.Contracts.Exhibition.Dtos.Banner
|
||||
{
|
||||
public class BannerGetListInputVo : PagedAndSortedResultRequestDto
|
||||
{
|
||||
public string Name { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,5 +15,7 @@ namespace Yi.BBS.Application.Contracts.Exhibition.Dtos.Banner
|
||||
public string Name { get; set; }
|
||||
public string? Logo { get; set; }
|
||||
public string? Color { get; set; }
|
||||
|
||||
public DateTime CreationTime { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,5 +15,7 @@ namespace Yi.BBS.Application.Contracts.Exhibition.Dtos
|
||||
public string Name { get; set; }
|
||||
public string? Logo { get; set; }
|
||||
public string? Color { get; set; }
|
||||
|
||||
public DateTime CreationTime { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,13 +4,14 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.Framework.Data.Auditing;
|
||||
using Yi.Framework.Data.Entities;
|
||||
using Yi.Framework.Ddd.Entities;
|
||||
|
||||
namespace Yi.BBS.Domain.Exhibition.Entities
|
||||
{
|
||||
[SugarTable("Banner")]
|
||||
public class BannerEntity : IEntity<long>, ISoftDelete
|
||||
public class BannerEntity : IEntity<long>, ISoftDelete, IAuditedObject
|
||||
{
|
||||
[SugarColumn(IsPrimaryKey = true)]
|
||||
public long Id { get; set; }
|
||||
@@ -18,5 +19,12 @@ namespace Yi.BBS.Domain.Exhibition.Entities
|
||||
public string? Logo { get; set; }
|
||||
public string? Color { 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; }
|
||||
}
|
||||
}
|
||||
|
||||
Binary file not shown.
@@ -30,4 +30,8 @@
|
||||
</None>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="wwwroot\" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
Reference in New Issue
Block a user