Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Sign in / Register
Toggle navigation
Z
zxn-adputin
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lijin
zxn-adputin
Commits
70164191
Commit
70164191
authored
Sep 26, 2025
by
hzl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 切换账户机型设置默认值
parent
99c2a81b
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
40 additions
and
5 deletions
+40
-5
CampaignTaskManage.vue
src/views/campaignTask/CampaignTaskManage.vue
+40
-5
No files found.
src/views/campaignTask/CampaignTaskManage.vue
View file @
70164191
...
...
@@ -1884,7 +1884,10 @@ export default {
this
.
form
.
tiktok_json
.
advertiserId
=
this
.
advertiserOptions
[
0
].
advertiserId
;
// 异步调用第一个账户的计划列表和设备机型列表,不等待完成
this
.
fetchCampaignList
(
this
.
advertiserOptions
[
0
].
advertiserId
);
this
.
fetchDeviceModelList
(
this
.
advertiserOptions
[
0
].
advertiserId
);
this
.
fetchDeviceModelList
(
this
.
advertiserOptions
[
0
].
advertiserId
).
then
(()
=>
{
// 设备机型列表加载完成后,设置默认值
this
.
setDefaultDeviceModels
();
});
}
}
else
{
this
.
$message
.
error
(
response
.
data
.
msg
||
'获取账户列表失败'
);
...
...
@@ -1914,13 +1917,35 @@ export default {
this
.
form
.
accountName
=
selectedAdvertiser
.
advertiserName
;
}
// 只有在不保留设备机型的情况下才清空(用户主动切换账户时)
if
(
!
preserveDeviceModels
)
{
this
.
form
.
tiktok_json
.
deviceModels
=
[];
}
// 保存当前设备机型选择
const
currentDeviceModels
=
[...
this
.
form
.
tiktok_json
.
deviceModels
];
await
this
.
fetchCampaignList
(
advertiserId
);
await
this
.
fetchDeviceModelList
(
advertiserId
);
// 如果之前有选中的设备机型,且新账户的设备机型列表中包含这些机型,则保持选中状态
if
(
currentDeviceModels
.
length
>
0
)
{
this
.
$nextTick
(()
=>
{
const
availableDeviceModels
=
this
.
deviceModelOptions
.
map
(
item
=>
item
.
device_model_id
);
const
validDeviceModels
=
currentDeviceModels
.
filter
(
modelId
=>
availableDeviceModels
.
includes
(
modelId
)
);
if
(
validDeviceModels
.
length
>
0
)
{
this
.
form
.
tiktok_json
.
deviceModels
=
validDeviceModels
;
console
.
log
(
'保持设备机型选择:'
,
validDeviceModels
);
}
else
{
// 如果之前的设备机型在新账户中不可用,则设置默认值
this
.
setDefaultDeviceModels
();
console
.
log
(
'设备机型在新账户中不可用,已设置默认值'
);
}
});
}
else
{
// 如果是新增模板且没有之前的设备机型选择,设置默认值
if
(
!
this
.
form
.
id
)
{
this
.
setDefaultDeviceModels
();
}
}
},
// 修改搜索处理方法
...
...
@@ -1983,6 +2008,16 @@ export default {
}
},
// 设置默认设备机型
setDefaultDeviceModels
()
{
// 默认全选所有可用的安卓设备机型
if
(
this
.
deviceModelOptions
.
length
>
0
)
{
const
allDeviceModelIds
=
this
.
deviceModelOptions
.
map
(
device
=>
device
.
device_model_id
);
this
.
form
.
tiktok_json
.
deviceModels
=
allDeviceModelIds
;
console
.
log
(
'设置默认全选设备机型:'
,
allDeviceModelIds
);
}
},
// 处理平台变化
async
handlePlatformChange
(
value
)
{
// 当平台改变时,重新验证日预算字段
...
...
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