Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
phsl
/
admin
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
99172ea0
authored
Oct 16, 2023
by
YunaiV
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
code review:文章管理
parent
cbb0cfef
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
10 additions
and
117 deletions
+10
-117
src/api/mall/promotion/article/index.ts
+0
-5
src/api/mall/promotion/articleCategory/index.ts
+0
-5
src/views/mall/promotion/article/category/ArticleCategoryForm.vue
+3
-2
src/views/mall/promotion/article/category/index.vue
+4
-30
src/views/mall/promotion/article/index.vue
+3
-75
No files found.
src/api/mall/promotion/article/index.ts
View file @
99172ea0
...
...
@@ -40,8 +40,3 @@ export const updateArticle = async (data: ArticleVO) => {
export
const
deleteArticle
=
async
(
id
:
number
)
=>
{
return
await
request
.
delete
({
url
:
`/promotion/article/delete?id=`
+
id
})
}
// 导出文章管理 Excel
export
const
exportArticle
=
async
(
params
)
=>
{
return
await
request
.
download
({
url
:
`/promotion/article/export-excel`
,
params
})
}
src/api/mall/promotion/articleCategory/index.ts
View file @
99172ea0
...
...
@@ -37,8 +37,3 @@ export const updateArticleCategory = async (data: ArticleCategoryVO) => {
export
const
deleteArticleCategory
=
async
(
id
:
number
)
=>
{
return
await
request
.
delete
({
url
:
`/promotion/article-category/delete?id=`
+
id
})
}
// 导出文章分类 Excel
export
const
exportArticleCategory
=
async
(
params
)
=>
{
return
await
request
.
download
({
url
:
`/promotion/article-category/export-excel`
,
params
})
}
src/views/mall/promotion/article/category/ArticleCategoryForm.vue
View file @
99172ea0
...
...
@@ -37,6 +37,7 @@
<
script
lang=
"ts"
setup
>
import
{
DICT_TYPE
,
getIntDictOptions
}
from
'@/utils/dict'
import
*
as
ArticleCategoryApi
from
'@/api/mall/promotion/articleCategory'
import
{
CommonStatusEnum
}
from
'@/utils/constants'
defineOptions
({
name
:
'PromotionArticleCategoryForm'
})
...
...
@@ -111,8 +112,8 @@ const resetForm = () => {
id
:
undefined
,
name
:
undefined
,
picUrl
:
undefined
,
status
:
undefined
,
sort
:
undefined
status
:
CommonStatusEnum
.
ENABLE
,
sort
:
0
}
formRef
.
value
?.
resetFields
()
}
...
...
src/views/mall/promotion/article/category/index.vue
View file @
99172ea0
...
...
@@ -56,16 +56,6 @@
<Icon
class=
"mr-5px"
icon=
"ep:plus"
/>
新增
</el-button>
<el-button
v-hasPermi=
"['promotion:article-category:export']"
:loading=
"exportLoading"
plain
type=
"success"
@
click=
"handleExport"
>
<Icon
class=
"mr-5px"
icon=
"ep:download"
/>
导出
</el-button>
</el-form-item>
</el-form>
</ContentWrap>
...
...
@@ -73,19 +63,19 @@
<!-- 列表 -->
<ContentWrap>
<el-table
v-loading=
"loading"
:data=
"list"
:show-overflow-tooltip=
"true"
:stripe=
"true"
>
<el-table-column
align=
"center"
label=
"编号"
prop=
"id"
/>
<el-table-column
align=
"center"
label=
"分类名称"
prop=
"name"
/>
<el-table-column
align=
"center"
label=
"编号"
prop=
"id"
min-width=
"100"
/>
<el-table-column
align=
"center"
label=
"分类名称"
prop=
"name"
min-width=
"240"
/>
<el-table-column
label=
"分类图图"
min-width=
"80"
>
<template
#
default=
"
{ row }">
<el-image
:src=
"row.picUrl"
class=
"h-30px w-30px"
@
click=
"imagePreview(row.picUrl)"
/>
</
template
>
</el-table-column>
<el-table-column
align=
"center"
label=
"状态"
prop=
"status"
>
<el-table-column
align=
"center"
label=
"状态"
prop=
"status"
min-width=
"150"
>
<
template
#
default=
"scope"
>
<dict-tag
:type=
"DICT_TYPE.COMMON_STATUS"
:value=
"scope.row.status"
/>
</
template
>
</el-table-column>
<el-table-column
align=
"center"
label=
"排序"
prop=
"sort"
/>
<el-table-column
align=
"center"
label=
"排序"
prop=
"sort"
min-width=
"150"
/>
<el-table-column
:formatter=
"dateFormatter"
align=
"center"
...
...
@@ -130,7 +120,6 @@
<
script
lang=
"ts"
setup
>
import
{
DICT_TYPE
,
getIntDictOptions
}
from
'@/utils/dict'
import
{
dateFormatter
}
from
'@/utils/formatTime'
import
download
from
'@/utils/download'
import
*
as
ArticleCategoryApi
from
'@/api/mall/promotion/articleCategory'
import
ArticleCategoryForm
from
'./ArticleCategoryForm.vue'
import
{
createImageViewer
}
from
'@/components/ImageViewer'
...
...
@@ -203,21 +192,6 @@ const handleDelete = async (id: number) => {
}
catch
{}
}
/** 导出按钮操作 */
const
handleExport
=
async
()
=>
{
try
{
// 导出的二次确认
await
message
.
exportConfirm
()
// 发起导出
exportLoading
.
value
=
true
const
data
=
await
ArticleCategoryApi
.
exportArticleCategory
(
queryParams
)
download
.
excel
(
data
,
'分类.xls'
)
}
catch
{
}
finally
{
exportLoading
.
value
=
false
}
}
/** 初始化 **/
onMounted
(()
=>
{
getList
()
...
...
src/views/mall/promotion/article/index.vue
View file @
99172ea0
...
...
@@ -32,15 +32,6 @@
@
keyup
.
enter=
"handleQuery"
/>
</el-form-item>
<el-form-item
label=
"文章作者"
prop=
"author"
>
<el-input
v-model=
"queryParams.author"
class=
"!w-240px"
clearable
placeholder=
"请输入文章作者"
@
keyup
.
enter=
"handleQuery"
/>
</el-form-item>
<el-form-item
label=
"状态"
prop=
"status"
>
<el-select
v-model=
"queryParams.status"
class=
"!w-240px"
clearable
placeholder=
"请选择状态"
>
<el-option
...
...
@@ -51,41 +42,6 @@
/>
</el-select>
</el-form-item>
<el-form-item
label=
"关联商品"
prop=
"spuId"
>
<el-select
v-model=
"queryParams.spuId"
class=
"!w-240px"
placeholder=
"全部"
@
keyup
.
enter=
"handleQuery"
>
<el-option
v-for=
"item in spuList"
:key=
"item.id"
:label=
"item.name"
:value=
"item.id"
/>
</el-select>
</el-form-item>
<el-form-item
label=
"热门"
prop=
"recommendHot"
>
<el-select
v-model=
"queryParams.recommendHot"
class=
"!w-240px"
clearable
placeholder=
"全部"
>
<el-option
v-for=
"dict in getBoolDictOptions(DICT_TYPE.INFRA_BOOLEAN_STRING)"
:key=
"dict.value"
:label=
"dict.label"
:value=
"dict.value"
/>
</el-select>
</el-form-item>
<el-form-item
label=
"轮播图"
prop=
"recommendBanner"
>
<el-select
v-model=
"queryParams.recommendBanner"
class=
"!w-240px"
clearable
placeholder=
"全部"
>
<el-option
v-for=
"dict in getBoolDictOptions(DICT_TYPE.INFRA_BOOLEAN_STRING)"
:key=
"dict.value"
:label=
"dict.label"
:value=
"dict.value"
/>
</el-select>
</el-form-item>
<el-form-item
label=
"创建时间"
prop=
"createTime"
>
<el-date-picker
v-model=
"queryParams.createTime"
...
...
@@ -115,16 +71,6 @@
<Icon
class=
"mr-5px"
icon=
"ep:plus"
/>
新增
</el-button>
<el-button
v-hasPermi=
"['promotion:article:export']"
:loading=
"exportLoading"
plain
type=
"success"
@
click=
"handleExport"
>
<Icon
class=
"mr-5px"
icon=
"ep:download"
/>
导出
</el-button>
</el-form-item>
</el-form>
</ContentWrap>
...
...
@@ -215,9 +161,8 @@
</template>
<
script
lang=
"ts"
setup
>
import
{
DICT_TYPE
,
get
BoolDictOptions
,
get
IntDictOptions
}
from
'@/utils/dict'
import
{
DICT_TYPE
,
getIntDictOptions
}
from
'@/utils/dict'
import
{
dateFormatter
}
from
'@/utils/formatTime'
import
download
from
'@/utils/download'
import
*
as
ArticleApi
from
'@/api/mall/promotion/article'
import
ArticleForm
from
'./ArticleForm.vue'
import
*
as
ArticleCategoryApi
from
'@/api/mall/promotion/articleCategory'
...
...
@@ -236,12 +181,9 @@ const queryParams = reactive({
pageNo
:
1
,
pageSize
:
10
,
categoryId
:
undefined
,
spuId
:
undefined
,
title
:
null
,
author
:
null
,
status
:
undefined
,
recommendHot
:
undefined
,
recommendBanner
:
undefined
,
spuId
:
undefined
,
createTime
:
[]
})
const
queryFormRef
=
ref
()
// 搜索的表单
...
...
@@ -295,25 +237,11 @@ const handleDelete = async (id: number) => {
}
catch
{}
}
/** 导出按钮操作 */
const
handleExport
=
async
()
=>
{
try
{
// 导出的二次确认
await
message
.
exportConfirm
()
// 发起导出
exportLoading
.
value
=
true
const
data
=
await
ArticleApi
.
exportArticle
(
queryParams
)
download
.
excel
(
data
,
'文章管理.xls'
)
}
catch
{
}
finally
{
exportLoading
.
value
=
false
}
}
const
categoryList
=
ref
<
ArticleCategoryApi
.
ArticleCategoryVO
[]
>
([])
const
spuList
=
ref
<
ProductSpuApi
.
Spu
[]
>
([])
onMounted
(
async
()
=>
{
await
getList
()
// 加载分类、商品列表
categoryList
.
value
=
(
await
ArticleCategoryApi
.
getSimpleArticleCategoryList
())
as
ArticleCategoryApi
.
ArticleCategoryVO
[]
spuList
.
value
=
(
await
ProductSpuApi
.
getSpuSimpleList
())
as
ProductSpuApi
.
Spu
[]
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment