Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
usedCarAuction
/
aus
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 94bf65bd
authored
Jan 27, 2026
by
yancanhua
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
fix: 代码优化
1 parent
8aa75363
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
4 deletions
aus-front/app/src/components/ImprovePopup.vue
aus-front/app/src/module/preference/selectVehicleBrand.vue
aus-front/app/src/components/ImprovePopup.vue
View file @
94bf65b
<
template
>
<
template
>
<view>
<view>
<uni-popup
ref=
"popupRef"
type=
"center"
background-color=
"#fff"
border-radius=
"24px"
z-index=
"10000"
<uni-popup
ref=
"popupRef"
type=
"center"
background-color=
"#fff"
border-radius=
"24px"
z-index=
"10000"
:show-close=
"false"
>
:show-close=
"false"
:mask-click=
"false"
>
<view
class=
"wrapper"
>
<view
class=
"wrapper"
>
<view
class=
"top-bg"
>
<view
class=
"top-bg"
>
<view
class=
"top-icon"
>
<view
class=
"top-icon"
>
...
...
aus-front/app/src/module/preference/selectVehicleBrand.vue
View file @
94bf65b
...
@@ -4,7 +4,7 @@
...
@@ -4,7 +4,7 @@
<van-index-anchor
:index=
"letter"
>
{{
letter
}}
</van-index-anchor>
<van-index-anchor
:index=
"letter"
>
{{
letter
}}
</van-index-anchor>
<van-cell
v-for=
"(brand, index) in getBrandsByLetter(letter)"
:key=
"brand.id"
>
<van-cell
v-for=
"(brand, index) in getBrandsByLetter(letter)"
:key=
"brand.id"
>
<template
slot=
"title"
>
<template
slot=
"title"
>
<div
class=
"brand-cell"
@
click=
"bindClick(brand
, index
)"
>
<div
class=
"brand-cell"
@
click=
"bindClick(brand)"
>
<image
class=
"brand-image"
:src=
"brand.logoUrl"
mode=
"aspectFill"
/>
<image
class=
"brand-image"
:src=
"brand.logoUrl"
mode=
"aspectFill"
/>
{{
brand
.
name
}}
{{
brand
.
name
}}
<div
class=
"check-icon"
>
<div
class=
"check-icon"
>
...
@@ -84,6 +84,7 @@ export default class selectVehicleBrand extends Vue {
...
@@ -84,6 +84,7 @@ export default class selectVehicleBrand extends Vue {
uni
.
setStorageSync
(
'cacheBrands'
,
this
.
brands
);
uni
.
setStorageSync
(
'cacheBrands'
,
this
.
brands
);
});
});
}
}
//默认回显已经选中的品牌
//默认回显已经选中的品牌
const
storagVehicleBrandList
=
JSON
.
parse
(
uni
.
getStorageSync
(
'storagVehicleBrandList'
)
||
'[]'
);
const
storagVehicleBrandList
=
JSON
.
parse
(
uni
.
getStorageSync
(
'storagVehicleBrandList'
)
||
'[]'
);
this
.
brands
=
this
.
brands
.
map
(
item
=>
{
this
.
brands
=
this
.
brands
.
map
(
item
=>
{
...
@@ -97,7 +98,14 @@ export default class selectVehicleBrand extends Vue {
...
@@ -97,7 +98,14 @@ export default class selectVehicleBrand extends Vue {
return
this
.
brands
.
filter
(
brand
=>
brand
.
letter
===
letter
);
return
this
.
brands
.
filter
(
brand
=>
brand
.
letter
===
letter
);
}
}
bindClick
(
brand
:
any
,
index
:
number
)
{
bindClick
(
brand
:
any
)
{
// 找到品牌在原始数组中的索引
const
brandIndex
=
this
.
brands
.
findIndex
(
item
=>
item
.
id
===
brand
.
id
);
// 如果品牌已选中,则直接取消选择
if
(
this
.
brands
[
brandIndex
].
selected
)
{
this
.
brands
[
brandIndex
].
selected
=
false
;
}
else
{
// 检查是否超过最大选择数量
if
(
this
.
selectedBrand
.
length
>=
10
)
{
if
(
this
.
selectedBrand
.
length
>=
10
)
{
uni
.
showToast
({
uni
.
showToast
({
title
:
'最多可选10个品牌'
,
title
:
'最多可选10个品牌'
,
...
@@ -105,7 +113,9 @@ export default class selectVehicleBrand extends Vue {
...
@@ -105,7 +113,9 @@ export default class selectVehicleBrand extends Vue {
});
});
return
;
return
;
}
}
this
.
brands
[
index
].
selected
=
!
this
.
brands
[
index
].
selected
;
this
.
brands
[
brandIndex
].
selected
=
true
;
}
// 更新选中品牌列表
this
.
selectedBrand
=
this
.
brands
.
filter
(
brand
=>
brand
.
selected
);
this
.
selectedBrand
=
this
.
brands
.
filter
(
brand
=>
brand
.
selected
);
}
}
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment