完善推荐页显示
This commit is contained in:
@@ -50,7 +50,9 @@ namespace Yi.Framework.ApiMicroservice.Controllers
|
|||||||
public override Task<Result> Add(ArticleEntity entity)
|
public override Task<Result> Add(ArticleEntity entity)
|
||||||
{
|
{
|
||||||
//如果标题为空,默认为内容的前20个字符
|
//如果标题为空,默认为内容的前20个字符
|
||||||
entity.Title = string.IsNullOrEmpty(entity.Title) ? entity.Content.Substring(0, 20): entity.Title;
|
entity.Title = string.IsNullOrEmpty(entity.Title) ?
|
||||||
|
(entity.Content.Length > 20 ? entity.Content.Substring(0, 20) : entity.Content) :
|
||||||
|
entity.Title;
|
||||||
entity.UserId = HttpContext.GetUserIdInfo();
|
entity.UserId = HttpContext.GetUserIdInfo();
|
||||||
return base.Add(entity);
|
return base.Add(entity);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -56,10 +56,10 @@ namespace Yi.Framework.ApiMicroservice.Controllers
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
//路径为: 文件路径/文件id+文件扩展名
|
//路径为: 文件路径/文件id+文件扩展名
|
||||||
var path = Path.Combine($"{PathConst.wwwroot}/{file.FilePath}", file.Id.ToString()+ Path.GetExtension(file.FileName));
|
var path = Path.Combine($"{PathConst.wwwroot}/{file.FilePath}", file.Id.ToString() + Path.GetExtension(file.FileName));
|
||||||
var stream = System.IO.File.OpenRead(path);
|
var stream = System.IO.File.OpenRead(path);
|
||||||
var MimeType = Common.Helper.MimeHelper.GetMimeMapping(file.FileName);
|
var MimeType = Common.Helper.MimeHelper.GetMimeMapping(file.FileName);
|
||||||
return File(stream, MimeType, file.FileName);
|
return File(stream, MimeType, file.FileName);
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
@@ -76,22 +76,18 @@ namespace Yi.Framework.ApiMicroservice.Controllers
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[Route("/api/file/Upload/{type?}")]
|
[Route("/api/file/Upload/{type?}")]
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
public async Task<Result> Upload([FromRoute] string? type, [FromForm] IFormFileCollection file,[FromQuery] string? remark)
|
public async Task<Result> Upload([FromRoute] string? type, [FromForm] IFormFileCollection file, [FromQuery] string? remark)
|
||||||
{
|
{
|
||||||
if (type is null)
|
type = type ?? PathEnum.File.ToString();
|
||||||
|
|
||||||
|
type = CultureInfo.CurrentCulture.TextInfo.ToTitleCase(type.ToLower());
|
||||||
|
if (!Enum.IsDefined(typeof(PathEnum), type))
|
||||||
{
|
{
|
||||||
type = PathEnum.File.ToString();
|
//后续类型可从字典表中获取
|
||||||
}
|
return Result.Error("上传失败!文件类型不支持!");
|
||||||
else
|
|
||||||
{
|
|
||||||
type = CultureInfo.CurrentCulture.TextInfo.ToTitleCase(type!.ToLower());
|
|
||||||
if (!Enum.IsDefined(typeof(PathEnum), type))
|
|
||||||
{
|
|
||||||
//后续类型可从字典表中获取
|
|
||||||
return Result.Error("上传失败!文件类型不支持!");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (file.Count() == 0)
|
if (file.Count() == 0)
|
||||||
{
|
{
|
||||||
return Result.Error("未选择文件");
|
return Result.Error("未选择文件");
|
||||||
|
|||||||
Binary file not shown.
@@ -11,14 +11,14 @@ namespace Yi.Framework.Common.Helper
|
|||||||
{
|
{
|
||||||
public static List<T> SetTree<T>(List<T> list, Action<T> action = null)
|
public static List<T> SetTree<T>(List<T> list, Action<T> action = null)
|
||||||
{
|
{
|
||||||
if (list != null && list.Count > 0)
|
if (list is not null && list.Count > 0)
|
||||||
{
|
{
|
||||||
IList<T> result = new List<T>();
|
IList<T> result = new List<T>();
|
||||||
long pid = list.Min(m => (m as ITreeModel<T>).ParentId);
|
long pid = list.Min(m => (m as ITreeModel<T>).ParentId);
|
||||||
IList<T> t = list.Where(m => (m as ITreeModel<T>).ParentId == pid).ToList();
|
IList<T> t = list.Where(m => (m as ITreeModel<T>).ParentId == pid).ToList();
|
||||||
foreach (T model in t)
|
foreach (T model in t)
|
||||||
{
|
{
|
||||||
if (action != null)
|
if (action is not null)
|
||||||
{
|
{
|
||||||
action(model);
|
action(model);
|
||||||
}
|
}
|
||||||
@@ -40,7 +40,7 @@ namespace Yi.Framework.Common.Helper
|
|||||||
mm.Children = new List<T>();
|
mm.Children = new List<T>();
|
||||||
foreach (T item in children)
|
foreach (T item in children)
|
||||||
{
|
{
|
||||||
if (action != null)
|
if (action is not null)
|
||||||
{
|
{
|
||||||
action(item);
|
action(item);
|
||||||
}
|
}
|
||||||
|
|||||||
1
Yi.Vue3.x.Vant/components.d.ts
vendored
1
Yi.Vue3.x.Vant/components.d.ts
vendored
@@ -25,6 +25,7 @@ declare module '@vue/runtime-core' {
|
|||||||
VanIcon: typeof import('vant/es')['Icon']
|
VanIcon: typeof import('vant/es')['Icon']
|
||||||
VanImage: typeof import('vant/es')['Image']
|
VanImage: typeof import('vant/es')['Image']
|
||||||
VanList: typeof import('vant/es')['List']
|
VanList: typeof import('vant/es')['List']
|
||||||
|
VanLoading: typeof import('vant/es')['Loading']
|
||||||
VanNavBar: typeof import('vant/es')['NavBar']
|
VanNavBar: typeof import('vant/es')['NavBar']
|
||||||
VanPopup: typeof import('vant/es')['Popup']
|
VanPopup: typeof import('vant/es')['Popup']
|
||||||
VanPullRefresh: typeof import('vant/es')['PullRefresh']
|
VanPullRefresh: typeof import('vant/es')['PullRefresh']
|
||||||
|
|||||||
@@ -7,9 +7,11 @@ import 'vant/es/notify/style';
|
|||||||
import router from './router'
|
import router from './router'
|
||||||
import store from './store'
|
import store from './store'
|
||||||
import './permission'
|
import './permission'
|
||||||
|
import { Lazyload } from 'vant';
|
||||||
import App from './App.vue'
|
import App from './App.vue'
|
||||||
|
|
||||||
const app=createApp(App)
|
const app=createApp(App)
|
||||||
app.use(router)
|
app.use(router)
|
||||||
app.use(store)
|
app.use(store)
|
||||||
|
app.use(Lazyload);
|
||||||
app.mount('#app');
|
app.mount('#app');
|
||||||
@@ -30,13 +30,18 @@
|
|||||||
v-for="(image, imageIndex) in item.images"
|
v-for="(image, imageIndex) in item.images"
|
||||||
:key="imageIndex"
|
:key="imageIndex"
|
||||||
class="imageCol"
|
class="imageCol"
|
||||||
@click="openImage(item.images)"
|
@click="openImage(item.images,imageIndex)"
|
||||||
><van-image
|
><van-image
|
||||||
|
lazy-load
|
||||||
|
fit="cover"
|
||||||
width="100%"
|
width="100%"
|
||||||
height="7rem"
|
height="7rem"
|
||||||
:src="url + image"
|
:src="url + image"
|
||||||
radius="5"
|
radius="5"
|
||||||
/>
|
/>
|
||||||
|
<template v-slot:loading>
|
||||||
|
<van-loading type="spinner" size="20" />
|
||||||
|
</template>
|
||||||
</van-col>
|
</van-col>
|
||||||
|
|
||||||
<van-col span="24" class="bottomRow">
|
<van-col span="24" class="bottomRow">
|
||||||
@@ -61,6 +66,7 @@
|
|||||||
<van-image-preview
|
<van-image-preview
|
||||||
v-model:show="imageShow"
|
v-model:show="imageShow"
|
||||||
:images="imagesPreview"
|
:images="imagesPreview"
|
||||||
|
:startPosition="startIndex"
|
||||||
@change="onChange"
|
@change="onChange"
|
||||||
:closeable="true"
|
:closeable="true"
|
||||||
>
|
>
|
||||||
@@ -102,7 +108,7 @@ const list = ref<Number[]>([]);
|
|||||||
const loading = ref(false);
|
const loading = ref(false);
|
||||||
const finished = ref(false);
|
const finished = ref(false);
|
||||||
const refreshing = ref(false);
|
const refreshing = ref(false);
|
||||||
|
const startIndex=ref(0)
|
||||||
const show = ref(false);
|
const show = ref(false);
|
||||||
const actions = [{ name: "取消关注" }, { name: "将TA拉黑" }, { name: "举报" }];
|
const actions = [{ name: "取消关注" }, { name: "将TA拉黑" }, { name: "举报" }];
|
||||||
|
|
||||||
@@ -138,8 +144,9 @@ const onRefresh = () => {
|
|||||||
queryParams.value.pageNum = 1;
|
queryParams.value.pageNum = 1;
|
||||||
onLoad();
|
onLoad();
|
||||||
};
|
};
|
||||||
const openImage = (imagesUrl: string[]) => {
|
const openImage = (imagesUrl: string[],imageIndex:any) => {
|
||||||
imagesPreview.value = imagesUrl.map((i) => url + i);
|
imagesPreview.value = imagesUrl.map((i) => url + i);
|
||||||
|
startIndex.value=imageIndex;
|
||||||
imageShow.value = true;
|
imageShow.value = true;
|
||||||
};
|
};
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
@@ -149,7 +156,7 @@ onMounted(() => {
|
|||||||
|
|
||||||
const getList = () => {
|
const getList = () => {
|
||||||
articleApi.pageList(queryParams.value).then((response: any) => {
|
articleApi.pageList(queryParams.value).then((response: any) => {
|
||||||
articleList.value.unshift(...(response.data.data));
|
articleList.value.push(...(response.data.data));
|
||||||
totol.value = response.data.totol;
|
totol.value = response.data.totol;
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -53,12 +53,11 @@ import articleApi from "@/api/articleApi";
|
|||||||
import { Toast } from "vant";
|
import { Toast } from "vant";
|
||||||
import { useRouter } from 'vue-router'
|
import { useRouter } from 'vue-router'
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const form = reactive<ArticleEntity>({
|
const form = reactive<any>({
|
||||||
title: "",
|
title: "",
|
||||||
content: "",
|
content: "",
|
||||||
images: [],
|
images: [],
|
||||||
isDeleted: false,
|
isDeleted: false
|
||||||
createTime:""
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const isSend=ref(false)
|
const isSend=ref(false)
|
||||||
|
|||||||
Reference in New Issue
Block a user