Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
cauchy-ui
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ui
cauchy-ui
Commits
9851715d
Commit
9851715d
authored
Jul 16, 2021
by
郭志伟
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 动画优化
parent
8e3b262e
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
40 additions
and
28 deletions
+40
-28
fontResize.js
src/directives/fontResize.js
+0
-1
SpuList.vue
src/views/vipLife/components/SpuList.vue
+21
-18
index.vue
src/views/vipLife/index.vue
+19
-9
No files found.
src/directives/fontResize.js
View file @
9851715d
...
@@ -4,7 +4,6 @@ const TXT_MIN_SIZE = 12;
...
@@ -4,7 +4,6 @@ const TXT_MIN_SIZE = 12;
export
default
{
export
default
{
inserted
(
el
)
{
inserted
(
el
)
{
let
txtSize
=
TXT_SIZE
;
let
txtSize
=
TXT_SIZE
;
console
.
dir
(
el
.
clientWidth
);
const
containerWidth
=
el
.
offsetWidth
;
const
containerWidth
=
el
.
offsetWidth
;
const
txtLength
=
el
.
innerText
.
length
*
TXT_SIZE
;
const
txtLength
=
el
.
innerText
.
length
*
TXT_SIZE
;
const
overTxtWidth
=
txtLength
-
containerWidth
;
const
overTxtWidth
=
txtLength
-
containerWidth
;
...
...
src/views/vipLife/components/SpuList.vue
View file @
9851715d
...
@@ -6,16 +6,10 @@
...
@@ -6,16 +6,10 @@
:key=
"index"
:key=
"index"
ref=
"spuItem"
ref=
"spuItem"
class=
"Vl__spu-item"
class=
"Vl__spu-item"
:class=
"
{ 'Vl__spu-item_active': info.
spuNos === item.spuNos
}"
:class=
"
{ 'Vl__spu-item_active': info.
index === item.index
}"
@click="
handleSpuClick($event, item, index
)"
@click="
$parent.handleSpuSelected(item
)"
>
>
<cr-image
<img
:src=
"item.icon"
class=
"Vl__spu-icon"
/>
:src=
"item.icon"
height=
"1.093333rem"
width=
"1.093333rem"
fit=
"contain"
class=
"Vl__spu-icon"
/>
<div
class=
"Vl__spu-name"
>
{{
item
.
name
}}
</div>
<div
class=
"Vl__spu-name"
>
{{
item
.
name
}}
</div>
</div>
</div>
</div>
</div>
...
@@ -62,13 +56,18 @@ export default {
...
@@ -62,13 +56,18 @@ export default {
info
:
{
info
:
{
deep
:
true
,
deep
:
true
,
handler
(
val
)
{
handler
(
val
)
{
if
(
Object
.
hasOwnProperty
.
call
(
val
,
'
parentIndex
'
))
{
let
itemIndex
=
val
.
index
;
const
itemIndex
=
this
.
list
.
findIndex
(
item
=>
item
.
parentIndex
===
val
.
parentIndex
);
if
(
Object
.
hasOwnProperty
.
call
(
val
,
'
parentFlagIndex
'
))
{
if
(
itemIndex
===
-
1
)
return
;
const
index
=
this
.
list
.
findIndex
(
item
=>
item
.
parentIndex
===
val
.
parentIndex
);
if
(
index
!==
-
1
)
{
itemIndex
=
index
;
}
}
this
.
$nextTick
(()
=>
{
this
.
$nextTick
(()
=>
{
this
.
$nextTick
(()
=>
{
this
.
handleSpuClick
(
this
.
$refs
.
spuItem
[
itemIndex
],
val
);
this
.
listWrapper
.
scrollToElement
(
this
.
$refs
.
spuItem
[
itemIndex
],
500
,
-
10
,
0
);
});
});
}
}
);
}
}
}
}
},
},
...
@@ -89,7 +88,7 @@ export default {
...
@@ -89,7 +88,7 @@ export default {
click
:
true
,
click
:
true
,
scrollX
:
true
,
scrollX
:
true
,
scrollY
:
false
,
scrollY
:
false
,
probeType
:
2
probeType
:
3
});
});
this
.
listWrapper
.
on
(
'
scroll
'
,
this
.
handleScroll
);
this
.
listWrapper
.
on
(
'
scroll
'
,
this
.
handleScroll
);
},
},
...
@@ -112,11 +111,10 @@ export default {
...
@@ -112,11 +111,10 @@ export default {
numAddUnit
(
num
)
{
numAddUnit
(
num
)
{
return
num
/
37.5
+
'
rem
'
;
return
num
/
37.5
+
'
rem
'
;
},
},
handleSpuClick
(
e
,
item
)
{
handleSpuClick
(
item
,
index
)
{
this
.
$parent
.
handleSpuSelected
(
item
);
this
.
$parent
.
handleSpuSelected
(
item
);
const
target
=
e
.
path
?
e
.
path
.
find
(
item
=>
item
.
className
.
indexOf
(
'
Vl__spu-item
'
)
>
-
1
)
:
e
;
this
.
$nextTick
(()
=>
{
this
.
$nextTick
(()
=>
{
this
.
listWrapper
.
scrollToElement
(
t
arget
,
500
,
-
10
,
0
);
this
.
listWrapper
.
scrollToElement
(
t
his
.
$refs
.
spuItem
[
index
]
,
500
,
-
10
,
0
);
});
});
}
}
}
}
...
@@ -130,6 +128,11 @@ export default {
...
@@ -130,6 +128,11 @@ export default {
height: 121px;
height: 121px;
overflow: hidden;
overflow: hidden;
}
}
&-icon {
width: 40px;
height: 40px;
object-fit: contain;
}
&-placeholder {
&-placeholder {
height: 97px;
height: 97px;
width: 95px;
width: 95px;
...
...
src/views/vipLife/index.vue
View file @
9851715d
...
@@ -63,14 +63,22 @@ export default {
...
@@ -63,14 +63,22 @@ export default {
},
},
computed
:
{
computed
:
{
disabled
()
{
disabled
()
{
return
(
this
.
spuInfo
.
rechargeAccountType
!==
2
&&
!
this
.
account
)
||
!
this
.
skuList
.
length
;
return
(
(
this
.
spuInfo
.
rechargeAccountType
!==
2
&&
!
this
.
account
)
||
!
this
.
skuList
.
length
||
!!
this
.
skuInfo
.
skuNo
);
},
},
spuList
()
{
spuList
()
{
let
spuList
=
[];
let
spuList
=
[];
let
spuNum
=
0
;
let
spuNum
=
0
;
this
.
spuData
.
forEach
((
item
,
index
)
=>
{
this
.
spuData
.
forEach
((
item
,
index
)
=>
{
item
.
itemList
.
forEach
(
it
=>
{
item
.
itemList
.
forEach
((
it
,
idx
)
=>
{
if
(
idx
===
0
)
{
it
.
parentFlagIndex
=
index
;
}
it
.
parentIndex
=
index
;
it
.
parentIndex
=
index
;
it
.
index
=
spuNum
;
it
.
posX
=
spuNum
*
ITEM_WIDTH
;
it
.
posX
=
spuNum
*
ITEM_WIDTH
;
spuList
.
push
(
it
);
spuList
.
push
(
it
);
spuNum
++
;
spuNum
++
;
...
@@ -110,9 +118,8 @@ export default {
...
@@ -110,9 +118,8 @@ export default {
this
.
updateSpuInfo
(
item
);
this
.
updateSpuInfo
(
item
);
this
.
getSkuListDebounce
();
this
.
getSkuListDebounce
();
},
},
handleSkuSelected
(
item
,
index
)
{
handleSkuSelected
(
item
)
{
this
.
skuInfo
=
item
;
this
.
skuInfo
=
item
;
this
.
skuInfo
.
index
=
index
;
},
},
updateSpuInfo
(
info
)
{
updateSpuInfo
(
info
)
{
this
.
$set
(
this
,
'
spuInfo
'
,
info
);
this
.
$set
(
this
,
'
spuInfo
'
,
info
);
...
@@ -141,8 +148,6 @@ export default {
...
@@ -141,8 +148,6 @@ export default {
this
.
skuList
=
res
.
rechargeList
;
this
.
skuList
=
res
.
rechargeList
;
const
defaultItem
=
res
.
rechargeList
.
find
(
item
=>
item
.
hasStock
);
const
defaultItem
=
res
.
rechargeList
.
find
(
item
=>
item
.
hasStock
);
const
defaultIndex
=
res
.
rechargeList
.
findIndex
(
item
=>
item
.
hasStock
);
const
defaultIndex
=
res
.
rechargeList
.
findIndex
(
item
=>
item
.
hasStock
);
// const defaultItem = res.rechargeList[0];
// const defaultIndex = 0;
defaultItem
&&
this
.
handleSkuSelected
(
defaultItem
,
defaultIndex
);
defaultItem
&&
this
.
handleSkuSelected
(
defaultItem
,
defaultIndex
);
}
}
this
.
showLoading
=
false
;
this
.
showLoading
=
false
;
...
@@ -152,8 +157,7 @@ export default {
...
@@ -152,8 +157,7 @@ export default {
return
this
.
$toast
.
fail
(
'
请填写账号!
'
);
return
this
.
$toast
.
fail
(
'
请填写账号!
'
);
if
(
!
this
.
skuInfo
.
skuNo
)
return
this
.
$toast
.
fail
(
'
请选择类型!
'
);
if
(
!
this
.
skuInfo
.
skuNo
)
return
this
.
$toast
.
fail
(
'
请选择类型!
'
);
const
{
skuNo
,
salePrice
}
=
this
.
skuInfo
;
const
{
skuNo
,
salePrice
}
=
this
.
skuInfo
;
const
[
res
,
error
]
=
await
orderApi
.
orderCreate
({
const
params
=
{
account
:
this
.
account
,
totalFee
:
salePrice
,
totalFee
:
salePrice
,
virtualRechargeType
:
this
.
spuInfo
.
type
,
virtualRechargeType
:
this
.
spuInfo
.
type
,
skuList
:
[
skuList
:
[
...
@@ -162,7 +166,13 @@ export default {
...
@@ -162,7 +166,13 @@ export default {
count
:
1
count
:
1
}
}
]
]
});
};
if
(
this
.
spuInfo
.
rechargeAccountType
!==
2
)
{
params
.
account
=
this
.
account
;
}
else
{
delete
params
.
account
;
}
const
[
res
,
error
]
=
await
orderApi
.
orderCreate
(
params
);
if
(
error
)
{
if
(
error
)
{
return
;
return
;
}
}
...
...
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