文件种子数据

This commit is contained in:
陈淳
2022-10-13 14:45:09 +08:00
parent ea4ddb68f3
commit 55ad046e96
14 changed files with 79 additions and 13 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 181 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 320 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 460 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 181 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 320 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 460 KiB

View File

@@ -0,0 +1,27 @@
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Yi.Framework.Model.Models;
namespace Yi.Framework.Model.SeedData
{
public class FileSeed : AbstractSeed<FileEntity>
{
public override List<FileEntity> GetSeed()
{
FileEntity file1 = new FileEntity()
{
Id = 0,
FilePath = "Image",
FileType = "",
IsDeleted = false,
FileName = "0.jpg"
};
Entitys.Add(file1);
return Entitys;
}
}
}

View File

@@ -40,6 +40,11 @@ namespace Yi.Framework.Model.SeedData
{
return new DeptSeed().GetSeed();
}
public static List<FileEntity> GetFileSeed()
{
return new FileSeed().GetSeed();
}
public static List<UserRoleEntity> GetUserRoleSeed(List<UserEntity> users, List<RoleEntity> roles)
{
List<UserRoleEntity> userRoleEntities = new();

View File

@@ -23,6 +23,7 @@ namespace Yi.Framework.WebCore.DbExtend
var posts = SeedFactory.GetPostSeed();
var dictinfos = SeedFactory.GetDictionaryInfoSeed();
var depts = SeedFactory.GetDeptSeed();
var files = SeedFactory.GetFileSeed();
try
{
_Db.AsTenant().BeginTran();
@@ -68,6 +69,12 @@ namespace Yi.Framework.WebCore.DbExtend
{
_Db.Insertable(SeedFactory.GetRoleMenuSeed(roles, menus)).ExecuteCommand();
}
if (!_Db.Queryable<FileEntity>().Any())
{
_Db.Insertable(files).ExecuteCommand();
}
_Db.AsTenant().CommitTran();
res = true;
}

View File

@@ -9,6 +9,7 @@ declare module '@vue/runtime-core' {
export interface GlobalComponents {
AppCreateTime: typeof import('./src/components/AppCreateTime.vue')['default']
AppGrid: typeof import('./src/components/AppGrid.vue')['default']
AppUserIcon: typeof import('./src/components/AppUserIcon.vue')['default']
HelloWorld: typeof import('./src/components/HelloWorld.vue')['default']
RouterLink: typeof import('vue-router')['RouterLink']
RouterView: typeof import('vue-router')['RouterView']

View File

@@ -0,0 +1,34 @@
<template>
<van-image
round
:width="width"
:height="height"
:src="url+(src??'0')"
/>
</template>
<script setup lang="ts">
import { type } from 'os';
import { ref } from 'vue'
defineProps<{ src: {type:string,default:'null',required:false},
width:{type:string,default:'3rem',required:false},
height:{type:string,default:'3rem',required:false},
}>()
const url = `${import.meta.env.VITE_APP_BASE_API}/file/`;
</script>
<style scoped>
.col-body
{
text-align: center;
}
.col-body .van-icon
{
margin-bottom: 0.6rem;
}
p{
font-size: large;
font-weight:bold;
}
</style>

View File

@@ -10,12 +10,7 @@
>
<van-row v-for="(item, index) in articleList" :key="index" class="row">
<van-col span="4" class="leftCol">
<van-image
round
width="3rem"
height="3rem"
src="https://fastly.jsdelivr.net/npm/@vant/assets/cat.jpeg"
/>
<AppUserIcon width="3rem" height="3rem" :src="item.user==null?null:(item.user.icon)"/>
</van-col>
<van-col span="14" class="centerTitle">
@@ -77,6 +72,7 @@
import { ref, onMounted, reactive, toRefs } from "vue";
import { ImagePreview, Toast } from "vant";
import AppCreateTime from "@/components/AppCreateTime.vue";
import AppUserIcon from "@/components/AppUserIcon.vue";
import articleApi from "@/api/articleApi.ts";
import { ArticleEntity } from "@/type/interface/ArticleEntity.ts";
const VanImagePreview = ImagePreview.Component;
@@ -172,7 +168,7 @@ const getList = () => {
.rowBody {
text-align: left;
background-color: white;
min-height: 2rem;
margin-top: 1rem;
margin-bottom: 1rem;
}

View File

@@ -9,12 +9,7 @@
<van-row class="bodyRow">
<van-col span="6" class="leftCol">
<van-image
round
width="4rem"
height="4rem"
src="https://fastly.jsdelivr.net/npm/@vant/assets/cat.jpeg"
/>
<AppUserIcon width="4rem" height="4rem" :src="user.icon"></AppUserIcon>
</van-col>
<van-col span="12" class="title"><span>{{user.nick}}</span></van-col>
<van-col span="6" class="subtitle"
@@ -100,6 +95,7 @@ import { ref } from "vue";
import { Dialog } from "vant";
import useUserStore from "@/store/modules/user";
import { storeToRefs } from 'pinia';
import AppUserIcon from "@/components/AppUserIcon.vue";
const show = ref<boolean>(false);
let data1: AppGridData = {
head: "个人中心",