Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
yubinCloud
fairy-wiki
提交
b8210d6e
F
fairy-wiki
项目概览
yubinCloud
/
fairy-wiki
通知
4
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
F
fairy-wiki
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
b8210d6e
编写于
4月 22, 2021
作者:
yubinCloud
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
7-6 电子书列表显示分类列表
上级
cc534816
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
21 addition
and
11 deletion
+21
-11
web/src/views/admin/admin-ebook.vue
web/src/views/admin/admin-ebook.vue
+21
-11
未找到文件。
web/src/views/admin/admin-ebook.vue
浏览文件 @
b8210d6e
...
...
@@ -40,6 +40,9 @@
<
template
#cover=
"{ text: cover }"
>
<img
v-if=
"cover"
:src=
"cover"
alt=
"avatar"
/>
</
template
>
<
template
v-slot:category=
"{ text, record }"
>
<span>
{{
getCategoryName
(
record
.
category1Id
)
}}
/
{{
getCategoryName
(
record
.
category2Id
)
}}
</span>
</
template
>
<
template
v-slot:action=
"{ text, record }"
>
<a-space
size=
"small"
>
<a-button
type=
"primary"
@
click=
"edit(record)"
>
...
...
@@ -90,7 +93,7 @@ import { defineComponent, onMounted, ref, UnwrapRef, reactive } from 'vue';
import
axios
from
'
axios
'
;
import
{
message
}
from
'
ant-design-vue
'
import
{
Tool
}
from
"
@/util/tool
"
;
import
{
Ebook
,
EbookQueryForm
}
from
"
@/models
"
import
{
Category
,
Ebook
,
EbookQueryForm
}
from
"
@/models
"
export
default
defineComponent
({
name
:
'
AdminEbook
'
,
...
...
@@ -118,13 +121,8 @@ export default defineComponent({
dataIndex
:
'
name
'
},
{
title
:
'
分类一
'
,
key
:
'
category1Id
'
,
dataIndex
:
'
category1Id
'
},
{
title
:
'
分类二
'
,
dataIndex
:
'
category2Id
'
title
:
'
分类
'
,
slots
:
{
customRender
:
'
category
'
}
},
{
title
:
'
文档数
'
,
...
...
@@ -266,6 +264,7 @@ export default defineComponent({
}
const
level1
=
ref
();
let
categories
:
Category
[];
/**
* 查询所有分类
**/
...
...
@@ -276,11 +275,11 @@ export default defineComponent({
const
respData
=
response
.
data
;
if
(
respData
.
code
==
0
)
{
c
onst
category
s
=
respData
.
data
;
console
.
log
(
"
原始数组:
"
,
categor
y
s
);
c
ategorie
s
=
respData
.
data
;
console
.
log
(
"
原始数组:
"
,
categor
ie
s
);
level1
.
value
=
[];
level1
.
value
=
Tool
.
array2Tree
(
categor
y
s
,
0
);
level1
.
value
=
Tool
.
array2Tree
(
categor
ie
s
,
0
);
console
.
log
(
"
树形结构:
"
,
level1
);
}
else
{
...
...
@@ -289,6 +288,16 @@ export default defineComponent({
});
};
const
getCategoryName
=
(
cid
:
string
)
=>
{
let
result
=
""
;
categories
.
forEach
((
item
:
Category
)
=>
{
if
(
item
.
id
===
cid
)
{
result
=
item
.
name
;
}
});
return
result
;
};
onMounted
(()
=>
{
handleQueryCategory
();
handleQueryEbooks
({
...
...
@@ -314,6 +323,7 @@ export default defineComponent({
add
,
handleDeleteEbook
,
handleQueryFormSubmit
,
getCategoryName
,
ebook
,
modalVisible
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录