Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
saas_plus
/
business-assistant
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 a77b6048
authored
Nov 24, 2022
by
luyt
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
feat:看产品
1 parent
0d321a00
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
209 additions
and
97 deletions
pages/tab/index/components/indexProduct/indexProduct.js
pages/tab/index/components/indexProduct/indexProduct.scss
pages/tab/index/components/indexProduct/indexProduct.wxml
pages/tab/index/constant/data.js
pages/tab/index/index.js
pages/tab/index/components/indexProduct/indexProduct.js
View file @
a77b604
// pages/tab/index/components/indexProduct/indexProduct.js
// pages/tab/index/components/indexProduct/indexProduct.js
import
{
IMG_URL
}
from
'~/utils/constantData.js'
import
{
IMG_URL
}
from
"~/utils/constantData.js"
;
// 导入方法
import
{
behavior
as
computedBehavior
}
from
'~/utils/lib/miniprogram-computed'
const
videoBaseUrl
=
'https://img02.glsx.com.cn/weapp/resource/miniprogram/ai-card/'
const
videoBaseUrl
=
"https://img02.glsx.com.cn/weapp/resource/miniprogram/ai-card/"
;
Component
({
Component
({
// 混入
behaviors
:
[
computedBehavior
],
/**
/**
* 组件的属性列表
* 组件的属性列表
*/
*/
properties
:
{
properties
:
{
actNum
:
Number
,
actNum
:
Number
,
img_version
:
null
,
img_version
:
null
,
senceData
:
Array
,
senceData
:
Array
,
headerHeight
:
Number
headerHeight
:
Number
,
},
// 默认已深度监听
watch
:
{
'tabActive'
:
function
(
a
,
b
)
{
// console.log('变化',a)
this
.
setData
({
mainActiveIndex
:
0
})
this
.
setProType
()
}
},
},
/**
/**
* 组件的初始数据
* 组件的初始数据
*/
*/
data
:
{
data
:
{
refresherFlag
:
true
,
refresherFlag
:
true
,
IMG_URL
,
IMG_URL
,
// 头部tab
// 头部tab
tabActive
:
0
,
tabActive
:
0
,
items
:[
items
:
[
{
{
text
:
'全部'
,
text
:
"全部"
,
type
:
'all'
type
:
"all"
,
},
{
text
:
'全部'
,
type
:
'all'
},
},
],
],
mainActiveIndex
:
0
,
mainActiveIndex
:
0
,
contentHeight
:
0
,
contentHeight
:
0
,
// 视频海报
// 视频海报
videoActive
:
1
videoActive
:
1
,
overlayShow
:
false
,
},
},
lifetimes
:{
lifetimes
:
{
ready
(){
attached
()
{
this
.
setProType
()
},
ready
()
{
// console.log('lifetimes',this)
// console.log('lifetimes',this)
let
contentTop
let
contentTop
;
let
that
=
this
;
let
that
=
this
;
const
query
=
this
.
createSelectorQuery
()
const
query
=
this
.
createSelectorQuery
()
;
query
.
select
(
'#pro-cont'
).
boundingClientRect
(
function
(
res
)
{
query
.
select
(
"#pro-cont"
).
boundingClientRect
(
function
(
res
)
{
// console.log('top',res.top)
// console.log('top',res.top)
contentTop
=
res
.
top
contentTop
=
res
.
top
;
//屏幕
//屏幕
const
windowHeight
=
wx
.
getSystemInfoSync
().
windowHeight
const
windowHeight
=
wx
.
getSystemInfoSync
().
windowHeight
;
// console.log('windowHeight: ', windowHeight, contentTop);
// console.log('windowHeight: ', windowHeight, contentTop);
const
contentHeight
=
windowHeight
-
contentTop
const
contentHeight
=
windowHeight
-
contentTop
;
// console.log('contentHeight: ', contentHeight);
// console.log('contentHeight: ', contentHeight);
that
.
setData
({
that
.
setData
({
contentHeight
contentHeight
,
})
});
})
});
query
.
exec
()
query
.
exec
();
},
}
},
},
/**
/**
* 组件的方法列表
* 组件的方法列表
*/
*/
methods
:
{
methods
:
{
setProType
(){
//视频 海报切换
let
{
tabActive
}
=
this
.
data
;
onclickVideoTab
(
event
){
let
typeItems
=
this
.
getAllTypePro
(
tabActive
,
"productList"
);
// console.log('event: ', event);
typeItems
.
unshift
({
let
videoActive
=
+
event
.
currentTarget
.
dataset
.
num
text
:
"全部"
,
console
.
log
(
'videoActive: '
,
videoActive
);
type
:
"all"
,
this
.
setData
({
});
videoActive
this
.
setData
({
})
items
:
typeItems
,
});
},
},
//获取当前场景下的全部 产品分类
// getAllTypePro(3,'productList')
getAllTypePro
(
index
,
type
)
{
// console.log('senceData[index]',senceData[index])
let
{
senceData
}
=
this
.
data
//获取所有分类
let
res
=
[];
//[ { text: '美容类',type:xxx }, { text: '轻改类',type:xxx } ]
let
list
=
senceData
[
index
][
type
];
function
someFn
(
element
)
{
return
element
.
text
==
this
.
category
;
}
if
(
list
)
{
list
.
forEach
((
item
)
=>
{
if
(
!
res
.
some
(
someFn
,
item
))
{
res
.
push
({
text
:
item
.
category
,
type
:
item
.
type
,
});
}
});
}
// console.log('res',res)
return
res
;
},
onClickNav
({
detail
=
{}
})
{
// 开通
this
.
setData
({
openPro
()
{},
mainActiveIndex
:
detail
.
index
||
0
,
openBus
()
{
});
wx
.
$router
.
go
(
'/packagesList/apply/pages/apply'
)
},
},
// 头部tab回调
onClickHide
()
{
onTabChange
(
event
){
this
.
setData
({
overlayShow
:
false
});
console
.
log
(
'event: '
,
event
);
},
},
// 选车场景切换
//视频 海报切换
selectCar
(
e
)
{
onclickVideoTab
(
event
)
{
// console.log('e: ', e)
// console.log('event: ', event);
let
{
num
}
=
e
.
currentTarget
.
dataset
let
videoActive
=
+
event
.
currentTarget
.
dataset
.
num
;
this
.
triggerEvent
(
'selectCar'
,
num
)
console
.
log
(
"videoActive: "
,
videoActive
);
},
refresherrefreshFn
(){
this
.
triggerEvent
(
'refresherrefresh'
)
setTimeout
(()
=>
{
this
.
setData
({
this
.
setData
({
refresherFlag
:
false
videoActive
,
});
},
onClickNav
({
detail
=
{}
})
{
this
.
setData
({
mainActiveIndex
:
detail
.
index
||
0
,
});
},
// 头部tab回调
onTabChange
(
event
)
{
// console.log("event: ", event);
let
index
=
event
.
detail
.
index
this
.
setData
({
tabActive
:
index
})
})
},
1000
)
},
}
// 选车场景切换
}
selectCar
(
e
)
{
})
// console.log('e: ', e)
let
{
num
}
=
e
.
currentTarget
.
dataset
;
this
.
triggerEvent
(
"selectCar"
,
num
);
},
refresherrefreshFn
()
{
this
.
triggerEvent
(
"refresherrefresh"
);
setTimeout
(()
=>
{
this
.
setData
({
refresherFlag
:
false
,
});
},
1000
);
},
},
});
pages/tab/index/components/indexProduct/indexProduct.scss
View file @
a77b604
...
@@ -143,6 +143,7 @@
...
@@ -143,6 +143,7 @@
height
:
44rpx
;
height
:
44rpx
;
}
}
.pro-cont
{
.pro-cont
{
position
:
relative
;
.van-tree-select__nav
{
.van-tree-select__nav
{
width
:
116rpx
;
width
:
116rpx
;
flex
:
0
;
flex
:
0
;
...
@@ -236,5 +237,61 @@
...
@@ -236,5 +237,61 @@
}
}
}
}
}
}
.expand-business
{
position
:
absolute
;
// top: calc(88rpx * 2);
left
:
0
;
.bus-pro
{
width
:
116rpx
;
height
:
88rpx
;
line-height
:
88rpx
;
font-size
:
22rpx
;
color
:
#8A8C90
;
text-align
:
center
;
}
}
}
}
//图片预览
.overlay-wrap
{
position
:
absolute
;
top
:
52%
;
left
:
50%
;
transform
:
translate
(
-50%
,
-50%
);
width
:
558rpx
;
height
:
944rpx
;
background
:
#FFFFFF
;
border-radius
:
16rpx
16rpx
0
0
;
.overlay-img
{
display
:
block
;
margin
:
32rpx
;
width
:
494rpx
;
height
:
880rpx
;
}
.overlay-msg
{
display
:flex
;
justify-content
:center
;
align-items
:
center
;
height
:
90rpx
;
background
:
#F7F8FA
;
border-radius
:
0
0
12rpx
12rpx
;
.hand
{
margin-right
:
12rpx
;
width
:
40rpx
;
height
:
40rpx
;
}
.forward
{
font-weight
:
500
;
font-size
:
32rpx
;
color
:
#3666FE
;
}
}
.img-close
{
position
:
absolute
;
top
:
-92rpx
;
right
:
0
;
width
:
56rpx
;
height
:
56rpx
;
}
}
}
}
pages/tab/index/components/indexProduct/indexProduct.wxml
View file @
a77b604
...
@@ -45,9 +45,27 @@
...
@@ -45,9 +45,27 @@
</view>
</view>
</view>
</view>
</van-tree-select>
</van-tree-select>
<!-- +产品 +业务 -->
<view class="expand-business" style="top:{{88 * items.length}}rpx" >
<view class="bus-pro" bindtap="openBus">
+业务
</view>
<view class="bus-pro" bindtap="openPro">
+产品
</view>
</view>
</view>
</view>
</view>
</view>
<!-- 图片预览弹窗 -->
<!-- 图片预览弹窗 -->
<van-overlay show="{{ true }}">
<view class="wrapper">123</view>
</van-overlay>
\ No newline at end of file
\ No newline at end of file
<van-overlay show="{{ overlayShow }}" z-index="100">
<view class="overlay-wrap">
<image class="overlay-img" show-menu-by-longpress src="{{IMG_URL}}index/poster/poster0-0.png?v={{img_version}}" />
<view class="overlay-msg">
<image class="hand" src="{{IMG_URL}}index/hand.png?v={{img_version}}"/>
<view class="forward">长按图片转发</view>
</view>
<image class="img-close" bindtap="onClickHide" src="{{IMG_URL}}index/img-close.png?v={{img_version}}"/>
</view>
</van-overlay>
pages/tab/index/constant/data.js
View file @
a77b604
...
@@ -282,30 +282,6 @@ var senceData = [
...
@@ -282,30 +282,6 @@ var senceData = [
// },
// },
]
]
//获取当前场景下的全部 产品分类
const
getAllTypePro
=
(
index
,
type
)
=>
{
//获取所有分类
let
res
=
[];
//[ { text: '美容类' }, { text: '轻改类' } ]
let
list
=
senceData
[
index
][
type
]
function
someFn
(
element
)
{
return
element
.
text
==
this
.
category
;
}
if
(
list
){
list
.
forEach
(
item
=>
{
if
(
!
res
.
some
(
someFn
,
item
)){
res
.
push
({
text
:
item
.
category
,
type
:
item
.
type
})
}
})
}
// console.log('res',res)
return
res
;
}
// getAllTypePro(3,'productList')
module
.
exports
=
{
module
.
exports
=
{
senceData
senceData
}
}
\ No newline at end of file
\ No newline at end of file
pages/tab/index/index.js
View file @
a77b604
...
@@ -297,6 +297,7 @@ Page({
...
@@ -297,6 +297,7 @@ Page({
* 生命周期函数--监听页面加载
* 生命周期函数--监听页面加载
*/
*/
onLoad
:
function
(
options
)
{
onLoad
:
function
(
options
)
{
// console.log('options: ', options);
// console.log('options: ', options);
let
{
sessionId
}
=
wx
.
$storage
.
get
()
let
{
sessionId
}
=
wx
.
$storage
.
get
()
// console.log("sessionId: ", sessionId);
// console.log("sessionId: ", sessionId);
...
...
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