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
c6674aa3
Commit
c6674aa3
authored
Jul 16, 2021
by
郭志伟
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 问题修复
parent
734125c5
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
54 additions
and
11 deletions
+54
-11
fontResize.js
src/directives/fontResize.js
+18
-0
main.js
src/main.js
+2
-0
SkuList.vue
src/views/vipLife/components/SkuList.vue
+1
-1
SpuList.vue
src/views/vipLife/components/SpuList.vue
+17
-3
constant.js
src/views/vipLife/components/constant.js
+2
-0
index.less
src/views/vipLife/index.less
+1
-1
index.vue
src/views/vipLife/index.vue
+13
-6
No files found.
src/directives/fontResize.js
0 → 100644
View file @
c6674aa3
const
TXT_SIZE
=
17
;
const
TXT_MIN_SIZE
=
12
;
export
default
{
inserted
(
el
)
{
let
txtSize
=
TXT_SIZE
;
console
.
dir
(
el
.
clientWidth
);
const
containerWidth
=
el
.
offsetWidth
;
const
txtLength
=
el
.
innerText
.
length
*
TXT_SIZE
;
const
overTxtWidth
=
txtLength
-
containerWidth
;
if
(
overTxtWidth
>
0
)
{
const
overSize
=
Math
.
ceil
(
overTxtWidth
/
TXT_SIZE
);
txtSize
=
txtSize
-
overSize
;
}
txtSize
=
txtSize
<
TXT_MIN_SIZE
?
TXT_MIN_SIZE
:
txtSize
;
el
.
style
.
fontSize
=
txtSize
+
'
px
'
;
}
};
src/main.js
View file @
c6674aa3
...
@@ -11,6 +11,7 @@ import Bridge from '@qg/js-bridge';
...
@@ -11,6 +11,7 @@ import Bridge from '@qg/js-bridge';
import
Raven
from
'
raven-js
'
;
import
Raven
from
'
raven-js
'
;
import
RavenVue
from
'
raven-js/plugins/vue
'
;
import
RavenVue
from
'
raven-js/plugins/vue
'
;
import
{
release
}
from
'
../.sentryclirc
'
;
import
{
release
}
from
'
../.sentryclirc
'
;
import
fontResize
from
'
./directives/fontResize
'
;
if
(
process
.
env
.
SENTRY_ENV
!==
'
test
'
&&
process
.
env
.
NODE_ENV
===
'
production
'
)
{
if
(
process
.
env
.
SENTRY_ENV
!==
'
test
'
&&
process
.
env
.
NODE_ENV
===
'
production
'
)
{
Raven
.
config
(
'
//21779c2dcb594299bdc803c5560cfecd@sentry.q-gp.com/60
'
,
{
Raven
.
config
(
'
//21779c2dcb594299bdc803c5560cfecd@sentry.q-gp.com/60
'
,
{
release
,
release
,
...
@@ -24,6 +25,7 @@ window.Bridge = Bridge;
...
@@ -24,6 +25,7 @@ window.Bridge = Bridge;
saService
.
init
(
router
);
saService
.
init
(
router
);
Vue
.
directive
(
'
fontResize
'
,
fontResize
);
Vue
.
config
.
productionTip
=
false
;
Vue
.
config
.
productionTip
=
false
;
window
.
addEventListener
(
window
.
addEventListener
(
...
...
src/views/vipLife/components/SkuList.vue
View file @
c6674aa3
...
@@ -13,7 +13,7 @@
...
@@ -13,7 +13,7 @@
}"
}"
@click="item.hasStock
&&
parent.handleSkuSelected(item, index)"
@click="item.hasStock
&&
parent.handleSkuSelected(item, index)"
>
>
<div
class=
"Vl__sku-name"
>
<div
v-font-resize
class=
"Vl__sku-name"
>
{{
props
.
threeCol
?
item
.
salePrice
:
item
.
skuName
}}{{
props
.
showUnit
?
'
元
'
:
''
}}
{{
props
.
threeCol
?
item
.
salePrice
:
item
.
skuName
}}{{
props
.
showUnit
?
'
元
'
:
''
}}
</div>
</div>
<div
class=
"Vl__sku-price"
>
售价
{{
item
.
price
}}
元
</div>
<div
class=
"Vl__sku-price"
>
售价
{{
item
.
price
}}
元
</div>
...
...
src/views/vipLife/components/SpuList.vue
View file @
c6674aa3
...
@@ -23,7 +23,8 @@
...
@@ -23,7 +23,8 @@
</
template
>
</
template
>
<
script
>
<
script
>
import
BScroll
from
'
@better-scroll/core
'
;
import
BScroll
from
'
@better-scroll/core
'
;
const
SCROLL_ITEM_WIDTH
=
108
;
import
{
SCROLL_ITEM_WIDTH
}
from
'
./constant
'
;
const
EVENT_SCROLL
=
'
scroll
'
;
export
default
{
export
default
{
name
:
'
SpuList
'
,
name
:
'
SpuList
'
,
props
:
{
props
:
{
...
@@ -88,12 +89,25 @@ export default {
...
@@ -88,12 +89,25 @@ export default {
click
:
true
,
click
:
true
,
scrollX
:
true
,
scrollX
:
true
,
scrollY
:
false
,
scrollY
:
false
,
probeType
:
1
probeType
:
2
});
});
this
.
listWrapper
.
on
(
'
scroll
'
,
this
.
handleScroll
);
this
.
listWrapper
.
on
(
'
scroll
'
,
this
.
handleScroll
);
},
},
handleScroll
(
e
)
{
handleScroll
(
e
)
{
console
.
log
(
e
);
const
currentX
=
Math
.
abs
(
e
.
x
);
for
(
let
i
=
0
;
i
<
this
.
list
.
length
;
i
++
)
{
const
curItem
=
this
.
list
[
i
];
let
nextItemX
=
0
;
if
(
this
.
list
[
i
+
1
])
{
nextItemX
=
this
.
list
[
i
+
1
].
posX
;
}
else
{
nextItemX
=
this
.
contentWidth
;
}
if
(
nextItemX
>=
currentX
&&
curItem
.
posX
<=
currentX
)
{
this
.
$emit
(
EVENT_SCROLL
,
curItem
,
e
.
x
);
break
;
}
}
},
},
numAddUnit
(
num
)
{
numAddUnit
(
num
)
{
return
num
/
37.5
+
'
rem
'
;
return
num
/
37.5
+
'
rem
'
;
...
...
src/views/vipLife/components/constant.js
0 → 100644
View file @
c6674aa3
export
const
SCROLL_ITEM_WIDTH
=
108
;
export
const
ITEM_WIDTH
=
97
;
src/views/vipLife/index.less
View file @
c6674aa3
@bottom-height: 60px;
@bottom-height: 60px;
.Vl {
@{deep}
.Vl {
&__panel {
&__panel {
background-color: @white;
background-color: @white;
border-radius: @border-radius-lx @border-radius-lx 0 0;
border-radius: @border-radius-lx @border-radius-lx 0 0;
...
...
src/views/vipLife/index.vue
View file @
c6674aa3
<
template
>
<
template
>
<div
class=
"page page__nopad"
>
<div
class=
"page page__nopad"
>
<cr-tabs
v-model=
"currentTab"
@
c
hange
=
"handleTabChange"
>
<cr-tabs
v-model=
"currentTab"
@
c
lick
=
"handleTabChange"
>
<cr-tab
v-for=
"(item, index) in spuData"
:key=
"index"
:title=
"item.name"
:name=
"+item.type"
/>
<cr-tab
v-for=
"(item, index) in spuData"
:key=
"index"
:title=
"item.name"
:name=
"+item.type"
/>
</cr-tabs>
</cr-tabs>
<spu-list
ref=
"spuList"
:list=
"spuList"
:info=
"spuInfo"
/>
<spu-list
ref=
"spuList"
:list=
"spuList"
:info=
"spuInfo"
@
scroll=
"handleSpuScroll"
/>
<div
class=
"Vl__panel"
>
<div
class=
"Vl__panel"
>
<template>
<template>
<account-input
v-if=
"spuInfo.rechargeAccountType !== 2"
v-model=
"account"
:info=
"spuInfo"
/>
<account-input
v-if=
"spuInfo.rechargeAccountType !== 2"
v-model=
"account"
:info=
"spuInfo"
/>
...
@@ -40,6 +40,7 @@ import SpuList from './components/SpuList.vue';
...
@@ -40,6 +40,7 @@ import SpuList from './components/SpuList.vue';
import
SkuList
from
'
./components/SkuList.vue
'
;
import
SkuList
from
'
./components/SkuList.vue
'
;
import
AccountInput
from
'
./components/AccountInput.vue
'
;
import
AccountInput
from
'
./components/AccountInput.vue
'
;
import
{
throttle
}
from
'
@/service/utils.service
'
;
import
{
throttle
}
from
'
@/service/utils.service
'
;
import
{
ITEM_WIDTH
}
from
'
./components/constant
'
;
export
default
{
export
default
{
name
:
'
VipLife
'
,
name
:
'
VipLife
'
,
components
:
{
components
:
{
...
@@ -66,10 +67,13 @@ export default {
...
@@ -66,10 +67,13 @@ export default {
},
},
spuList
()
{
spuList
()
{
let
spuList
=
[];
let
spuList
=
[];
let
spuNum
=
0
;
this
.
spuData
.
forEach
((
item
,
index
)
=>
{
this
.
spuData
.
forEach
((
item
,
index
)
=>
{
item
.
itemList
.
forEach
(
it
=>
{
item
.
itemList
.
forEach
(
it
=>
{
it
.
parentIndex
=
index
;
it
.
parentIndex
=
index
;
it
.
posX
=
spuNum
*
ITEM_WIDTH
;
spuList
.
push
(
it
);
spuList
.
push
(
it
);
spuNum
++
;
});
});
});
});
return
spuList
;
return
spuList
;
...
@@ -99,6 +103,9 @@ export default {
...
@@ -99,6 +103,9 @@ export default {
this
.
updateSpuInfo
(
this
.
spuData
[
this
.
currentTab
-
1
].
itemList
[
0
]);
this
.
updateSpuInfo
(
this
.
spuData
[
this
.
currentTab
-
1
].
itemList
[
0
]);
this
.
getSkuListDebounce
();
this
.
getSkuListDebounce
();
},
},
handleSpuScroll
(
item
)
{
this
.
currentTab
=
item
.
parentIndex
+
1
;
},
handleSpuSelected
(
item
)
{
handleSpuSelected
(
item
)
{
this
.
updateSpuInfo
(
item
);
this
.
updateSpuInfo
(
item
);
this
.
getSkuListDebounce
();
this
.
getSkuListDebounce
();
...
@@ -132,10 +139,10 @@ export default {
...
@@ -132,10 +139,10 @@ export default {
const
[
res
]
=
await
rechargeApi
.
getSkuList
(
spuNos
,
type
);
const
[
res
]
=
await
rechargeApi
.
getSkuList
(
spuNos
,
type
);
if
(
res
)
{
if
(
res
)
{
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 defaultItem = res.rechargeList[0];
const
defaultIndex
=
0
;
//
const defaultIndex = 0;
defaultItem
&&
this
.
handleSkuSelected
(
defaultItem
,
defaultIndex
);
defaultItem
&&
this
.
handleSkuSelected
(
defaultItem
,
defaultIndex
);
}
}
this
.
showLoading
=
false
;
this
.
showLoading
=
false
;
...
...
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