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
87a5ddfd
authored
Apr 02, 2023
by
YunaiV
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
REVIEW 图文发表记录
parent
a56a2f60
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
79 deletions
+30
-79
src/views/mp/freePublish/index.vue
+22
-62
src/views/mp/tag/index.vue
+8
-17
No files found.
src/views/mp/freePublish/index.vue
View file @
87a5ddfd
...
@@ -19,14 +19,8 @@
...
@@ -19,14 +19,8 @@
</el-select>
</el-select>
</el-form-item>
</el-form-item>
<el-form-item>
<el-form-item>
<el-button
@
click=
"handleQuery"
>
<el-button
@
click=
"handleQuery"
><Icon
icon=
"ep:search"
class=
"mr-5px"
/>
搜索
</el-button>
<Icon
icon=
"ep:search"
class=
"mr-5px"
/>
<el-button
@
click=
"resetQuery"
><Icon
icon=
"ep:refresh"
class=
"mr-5px"
/>
重置
</el-button>
搜索
</el-button>
<el-button
@
click=
"resetQuery"
>
<Icon
icon=
"ep:refresh"
class=
"mr-5px"
/>
重置
</el-button>
</el-form-item>
</el-form-item>
</el-form>
</el-form>
</content-wrap>
</content-wrap>
...
@@ -41,7 +35,6 @@
...
@@ -41,7 +35,6 @@
:key=
"item.articleId"
:key=
"item.articleId"
>
>
<wx-news
:articles=
"item.content.newsItem"
/>
<wx-news
:articles=
"item.content.newsItem"
/>
<!-- 操作 -->
<el-row
justify=
"center"
class=
"ope-row"
>
<el-row
justify=
"center"
class=
"ope-row"
>
<el-button
<el-button
type=
"danger"
type=
"danger"
...
@@ -54,9 +47,8 @@
...
@@ -54,9 +47,8 @@
</el-row>
</el-row>
</div>
</div>
</div>
</div>
<!-- 分页组件 -->
<!-- 分页 -->
<pagination
<Pagination
v-show=
"total > 0"
:total=
"total"
:total=
"total"
v-model:page=
"queryParams.pageNo"
v-model:page=
"queryParams.pageNo"
v-model:limit=
"queryParams.pageSize"
v-model:limit=
"queryParams.pageSize"
...
@@ -66,24 +58,18 @@
...
@@ -66,24 +58,18 @@
</
template
>
</
template
>
<
script
setup
lang=
"ts"
name=
"freePublish"
>
<
script
setup
lang=
"ts"
name=
"freePublish"
>
import
{
getFreePublishPage
,
deleteFreePublish
}
from
'@/api/mp/freePublish'
import
*
as
FreePublishApi
from
'@/api/mp/freePublish'
import
*
as
MpAccountApi
from
'@/api/mp/account'
import
*
as
MpAccountApi
from
'@/api/mp/account'
import
WxNews
from
'@/views/mp/components/wx-news/main.vue'
import
WxNews
from
'@/views/mp/components/wx-news/main.vue'
const
message
=
useMessage
()
// 消息弹窗
const
message
=
useMessage
()
// 消息弹窗
const
{
t
}
=
useI18n
()
// 国际化
const
loading
=
ref
(
true
)
// 列表的加载中
const
loading
=
ref
(
true
)
// 列表的加载中
const
total
=
ref
(
0
)
// 列表的总页数
const
total
=
ref
(
0
)
// 列表的总页数
const
list
=
ref
([])
// 列表的数据
const
list
=
ref
([])
// 列表的数据
interface
QueryParams
{
const
queryParams
=
reactive
({
currentPage
:
number
|
undefined
|
string
pageNo
:
1
,
pageNo
:
number
|
undefined
|
string
pageSize
:
10
,
accountId
:
number
|
undefined
|
string
}
const
queryParams
:
QueryParams
=
reactive
({
currentPage
:
1
,
// 当前页数
pageNo
:
1
,
// 当前页数
accountId
:
undefined
// 当前页数
accountId
:
undefined
// 当前页数
})
})
const
queryFormRef
=
ref
()
// 搜索的表单
const
queryFormRef
=
ref
()
// 搜索的表单
...
@@ -96,25 +82,14 @@ const getList = async () => {
...
@@ -96,25 +82,14 @@ const getList = async () => {
message
.
error
(
'未选中公众号,无法查询已发表图文'
)
message
.
error
(
'未选中公众号,无法查询已发表图文'
)
return
false
return
false
}
}
// TODO 改成 await 形式
try
{
loading
.
value
=
true
loading
.
value
=
true
getFreePublishPage
(
queryParams
)
const
data
=
await
FreePublishApi
.
getFreePublishPage
(
queryParams
)
.
then
((
data
)
=>
{
console
.
log
(
data
)
// 将 thumbUrl 转成 picUrl,保证 wx-news 组件可以预览封面
data
.
list
.
forEach
((
item
)
=>
{
console
.
log
(
item
)
const
newsItem
=
item
.
content
.
newsItem
newsItem
.
forEach
((
article
)
=>
{
article
.
picUrl
=
article
.
thumbUrl
})
})
list
.
value
=
data
.
list
list
.
value
=
data
.
list
total
.
value
=
data
.
total
total
.
value
=
data
.
total
})
}
finally
{
.
finally
(()
=>
{
loading
.
value
=
false
loading
.
value
=
false
})
}
}
}
/** 搜索按钮操作 */
/** 搜索按钮操作 */
...
@@ -135,21 +110,15 @@ const resetQuery = () => {
...
@@ -135,21 +110,15 @@ const resetQuery = () => {
/** 删除按钮操作 */
/** 删除按钮操作 */
const
handleDelete
=
async
(
item
)
=>
{
const
handleDelete
=
async
(
item
)
=>
{
{
try
{
// TODO 改成 await 形式
// 删除的二次确认
const
articleId
=
item
.
articleId
await
message
.
delConfirm
(
'删除后用户将无法访问此页面,确定删除?'
)
const
accountId
=
queryParams
.
accountId
// 发起删除
message
await
FreePublishApi
.
deleteFreePublish
(
queryParams
.
accountId
,
item
.
articleId
)
.
confirm
(
'删除后用户将无法访问此页面,确定删除?'
)
message
.
success
(
t
(
'common.delSuccess'
))
.
then
(
function
()
{
// 刷新列表
return
deleteFreePublish
(
accountId
,
articleId
)
await
getList
()
})
}
catch
{}
.
then
(()
=>
{
getList
()
message
.
success
(
'删除成功'
)
})
.
catch
(()
=>
{})
}
}
}
onMounted
(
async
()
=>
{
onMounted
(
async
()
=>
{
...
@@ -162,15 +131,6 @@ onMounted(async () => {
...
@@ -162,15 +131,6 @@ onMounted(async () => {
})
})
</
script
>
</
script
>
<
style
lang=
"scss"
scoped
>
<
style
lang=
"scss"
scoped
>
.pagination
{
float
:
right
;
margin-right
:
25px
;
}
.add_but
{
padding
:
10px
;
}
.ope-row
{
.ope-row
{
margin-top
:
5px
;
margin-top
:
5px
;
text-align
:
center
;
text-align
:
center
;
...
...
src/views/mp/tag/index.vue
View file @
87a5ddfd
...
@@ -12,9 +12,9 @@
...
@@ -12,9 +12,9 @@
<el-select
v-model=
"queryParams.accountId"
placeholder=
"请选择公众号"
class=
"!w-240px"
>
<el-select
v-model=
"queryParams.accountId"
placeholder=
"请选择公众号"
class=
"!w-240px"
>
<el-option
<el-option
v-for=
"item in accountList"
v-for=
"item in accountList"
:key=
"
parseInt(item.id)
"
:key=
"
item.id
"
:label=
"item.name"
:label=
"item.name"
:value=
"
parseInt(item.id)
"
:value=
"
item.id
"
/>
/>
</el-select>
</el-select>
</el-form-item>
</el-form-item>
...
@@ -28,21 +28,15 @@
...
@@ -28,21 +28,15 @@
/>
/>
</el-form-item>
</el-form-item>
<el-form-item>
<el-form-item>
<el-button
@
click=
"handleQuery"
>
<el-form-item>
<Icon
icon=
"ep:search"
class=
"mr-5px"
/>
<el-button
@
click=
"handleQuery"
><Icon
icon=
"ep:search"
class=
"mr-5px"
/>
搜索
</el-button>
搜索
<el-button
@
click=
"resetQuery"
><Icon
icon=
"ep:refresh"
class=
"mr-5px"
/>
重置
</el-button>
</el-button>
</el-form-item>
<el-button
@
click=
"resetQuery"
>
<Icon
icon=
"ep:refresh"
class=
"mr-5px"
/>
重置
</el-button>
<el-button
type=
"primary"
plain
@
click=
"openForm('create')"
v-hasPermi=
"['mp:tag:create']"
>
<el-button
type=
"primary"
plain
@
click=
"openForm('create')"
v-hasPermi=
"['mp:tag:create']"
>
<Icon
icon=
"ep:plus"
class=
"mr-5px"
/>
<Icon
icon=
"ep:plus"
class=
"mr-5px"
/>
新增
新增
</el-button>
</el-button>
<el-button
type=
"success"
plain
@
click=
"handleSync"
v-hasPermi=
"['mp:tag:sync']"
>
<el-button
type=
"success"
plain
@
click=
"handleSync"
v-hasPermi=
"['mp:tag:sync']"
>
<Icon
icon=
"ep:refresh"
class=
"mr-5px"
/>
<Icon
icon=
"ep:refresh"
class=
"mr-5px"
/>
同步
同步
</el-button>
</el-button>
</el-form-item>
</el-form-item>
</el-form>
</el-form>
...
@@ -99,7 +93,6 @@ import { dateFormatter } from '@/utils/formatTime'
...
@@ -99,7 +93,6 @@ import { dateFormatter } from '@/utils/formatTime'
import
*
as
MpTagApi
from
'@/api/mp/tag'
import
*
as
MpTagApi
from
'@/api/mp/tag'
import
*
as
MpAccountApi
from
'@/api/mp/account'
import
*
as
MpAccountApi
from
'@/api/mp/account'
import
TagForm
from
'./TagForm.vue'
import
TagForm
from
'./TagForm.vue'
const
message
=
useMessage
()
// 消息弹窗
const
message
=
useMessage
()
// 消息弹窗
const
{
t
}
=
useI18n
()
// 国际化
const
{
t
}
=
useI18n
()
// 国际化
...
@@ -143,7 +136,6 @@ const resetQuery = () => {
...
@@ -143,7 +136,6 @@ const resetQuery = () => {
queryFormRef
.
value
.
resetFields
()
queryFormRef
.
value
.
resetFields
()
// 默认选中第一个
// 默认选中第一个
if
(
accountList
.
value
.
length
>
0
)
{
if
(
accountList
.
value
.
length
>
0
)
{
// @ts-ignore
queryParams
.
accountId
=
accountList
.
value
[
0
].
id
queryParams
.
accountId
=
accountList
.
value
[
0
].
id
}
}
handleQuery
()
handleQuery
()
...
@@ -184,7 +176,6 @@ onMounted(async () => {
...
@@ -184,7 +176,6 @@ onMounted(async () => {
accountList
.
value
=
await
MpAccountApi
.
getSimpleAccountList
()
accountList
.
value
=
await
MpAccountApi
.
getSimpleAccountList
()
// 选中第一个
// 选中第一个
if
(
accountList
.
value
.
length
>
0
)
{
if
(
accountList
.
value
.
length
>
0
)
{
// @ts-ignore
queryParams
.
accountId
=
accountList
.
value
[
0
].
id
queryParams
.
accountId
=
accountList
.
value
[
0
].
id
}
}
await
getList
()
await
getList
()
...
...
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