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
0974ece1
authored
Sep 12, 2024
by
YunaiV
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
【功能优化】公众号:未配置公众号账号的情况下,自动跳转账号管理的菜单
parent
9d0e77b6
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
25 deletions
+17
-25
src/views/mp/components/wx-account-select/main.vue
+11
-0
src/views/mp/statistics/index.vue
+6
-25
No files found.
src/views/mp/components/wx-account-select/main.vue
View file @
0974ece1
...
...
@@ -6,6 +6,11 @@
<
script
lang=
"ts"
setup
>
import
*
as
MpAccountApi
from
'@/api/mp/account'
import
{
useTagsViewStore
}
from
'@/store/modules/tagsView'
const
message
=
useMessage
()
// 消息弹窗
const
{
delView
}
=
useTagsViewStore
()
// 视图操作
const
{
push
,
currentRoute
}
=
useRouter
()
// 路由
defineOptions
({
name
:
'WxAccountSelect'
})
...
...
@@ -22,6 +27,12 @@ const emit = defineEmits<{
const
handleQuery
=
async
()
=>
{
accountList
.
value
=
await
MpAccountApi
.
getSimpleAccountList
()
if
(
accountList
.
value
.
length
==
0
)
{
message
.
error
(
'未配置公众号,请在【公众号管理 -> 账号管理】菜单,进行配置'
)
delView
(
unref
(
currentRoute
))
await
push
({
name
:
'MpAccount'
})
return
}
// 默认选中第一个
if
(
accountList
.
value
.
length
>
0
)
{
account
.
id
=
accountList
.
value
[
0
].
id
...
...
src/views/mp/statistics/index.vue
View file @
0974ece1
...
...
@@ -3,14 +3,7 @@
<ContentWrap>
<el-form
class=
"-mb-15px"
ref=
"queryForm"
:inline=
"true"
label-width=
"68px"
>
<el-form-item
label=
"公众号"
prop=
"accountId"
>
<el-select
v-model=
"accountId"
@
change=
"getSummary"
class=
"!w-240px"
>
<el-option
v-for=
"item in accountList"
:key=
"item.id"
:label=
"item.name"
:value=
"item.id"
/>
</el-select>
<WxAccountSelect
@
change=
"onAccountChanged"
/>
</el-form-item>
<el-form-item
label=
"时间范围"
prop=
"dateRange"
>
<el-date-picker
...
...
@@ -76,7 +69,7 @@
<
script
lang=
"ts"
setup
>
import
{
formatDate
,
addTime
,
betweenDay
,
beginOfDay
,
endOfDay
}
from
'@/utils/formatTime'
import
*
as
StatisticsApi
from
'@/api/mp/statistics'
import
*
as
MpAccountApi
from
'@/api/mp/accoun
t'
import
WxAccountSelect
from
'@/views/mp/components/wx-account-selec
t'
defineOptions
({
name
:
'MpStatistics'
})
...
...
@@ -88,7 +81,6 @@ const dateRange = ref([
endOfDay
(
new
Date
(
new
Date
().
getTime
()
-
3600
*
1000
*
24
))
])
const
accountId
=
ref
(
-
1
)
// 选中的公众号编号
const
accountList
=
ref
<
MpAccountApi
.
AccountVO
[]
>
([])
// 公众号账号列表
const
xAxisDate
=
ref
([]
as
any
[])
// X 轴的日期范围
// 用户增减数据图表配置项
...
...
@@ -230,13 +222,10 @@ const interfaceSummaryOption = reactive({
]
})
/** 加载公众号账号的列表 */
const
getAccountList
=
async
()
=>
{
accountList
.
value
=
await
MpAccountApi
.
getSimpleAccountList
()
// 默认选中第一个
if
(
accountList
.
value
.
length
>
0
)
{
accountId
.
value
=
accountList
.
value
[
0
].
id
!
}
/** 侦听公众号变化 **/
const
onAccountChanged
=
(
id
:
number
)
=>
{
accountId
.
value
=
id
getSummary
()
}
/** 加载数据 */
...
...
@@ -357,12 +346,4 @@ const interfaceSummaryChart = async () => {
})
}
catch
{}
}
/** 初始化 */
onMounted
(
async
()
=>
{
// 获取公众号下拉列表
await
getAccountList
()
// 加载数据
getSummary
()
})
</
script
>
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