Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
saas_plus
/
store-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 0f35ea2d
authored
Oct 19, 2022
by
zhangquan
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
画图
1 parent
99b3633a
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
229 additions
and
11 deletions
pages/checkProduct/checkProduct.js
pages/checkProduct/checkProduct.json
pages/checkProduct/checkProduct.scss
pages/checkProduct/checkProduct.wxml
pages/checkProduct/checkProduct.js
View file @
0f35ea2
// pages/checkProduct/checkProduct.js
// const navStyle = "background-color: transparent;";
import
{
IMG_URL
}
from
"~/utils/constantData.js"
;
const
navStyle
=
"background-color: #fff"
;
const
navStyle
=
"background-color: #fff"
;
import
{
senceData
}
from
"~/pages/tab/discovery/constant/data"
;
import
{
senceData
}
from
"~/pages/tab/discovery/constant/data"
;
import
Draw
from
"~/utils/Draw.js"
;
import
{
IMG_URL
}
from
"~/utils/constantData.js"
;
const
IMGURL
=
IMG_URL
Page
({
Page
({
/**
/**
* 页面的初始数据
* 页面的初始数据
...
@@ -12,8 +11,44 @@ Page({
...
@@ -12,8 +11,44 @@ Page({
navStyle
,
navStyle
,
headerHeight
:
0
,
headerHeight
:
0
,
senceData
,
senceData
,
actNum
:
0
,
// 模态框
// 模态框
isShow
:
true
,
isShow
:
true
,
btnList
:
[
{
src
:
`
${
IMGURL
}
wechat.png`
,
name
:
"微信转发"
,
},
{
src
:
`
${
IMGURL
}
down.png`
,
name
:
"下载为海报"
,
},
],
imgHeightArr
:
[
[
1110
,
1290
,
596
,
744
,
490
,
1532
],
[
2168
,
1290
,
596
,
830
,
490
,
752
],
[
1110
,
1290
,
596
,
984
,
490
],
[
678
,
1266
,
1398
,
830
,
490
,
1666
],
],
posterUrl
:
""
,
//海报url
},
observers
:
{
actNum
:
function
(
actNum
)
{
let
imgList
=
[
`
${
IMGURL
}
index/scene
${
actNum
+
1
}
1.png`
,
`
${
IMGURL
}
index/scene
${
actNum
+
1
}
2.png`
,
`
${
IMGURL
}
index/scene
${
actNum
+
1
}
3.png`
,
`
${
IMGURL
}
index/scene
${
actNum
+
1
}
4.png`
,
`
${
IMGURL
}
index/scene
${
actNum
+
1
}
5.png`
,
];
if
(
actNum
!=
2
)
{
imgList
.
push
(
`
${
IMGURL
}
index/scene
${
actNum
+
1
}
6.png`
);
}
this
.
setData
({
imgList
,
});
},
},
},
navbarReady
(
e
)
{
navbarReady
(
e
)
{
let
{
let
{
...
@@ -32,15 +67,53 @@ Page({
...
@@ -32,15 +67,53 @@ Page({
navStyle
:
scrollTop
==
0
?
navStyle
:
`background-color:
${
color
}
;`
navStyle
:
scrollTop
==
0
?
navStyle
:
`background-color:
${
color
}
;`
})
})
},
},
modelcloseFn
(
e
)
{
// 分享按钮
sharehandle
()
{
this
.
setData
({
this
.
setData
({
isShow
:
e
.
detail
,
isShow
:
true
,
});
});
},
},
// 分享按钮
// 分享按钮
sharehandle
()
{
handleClick
(
e
)
{
let
{
index
}
=
e
.
currentTarget
.
dataset
;
switch
(
index
)
{
case
0
:
this
.
wechatFn
();
break
;
case
1
:
this
.
download
();
break
;
}
},
// 微信转发
wechatFn
()
{
// this.data.onShareAppMessage()
this
.
modelClose
();
},
// 下载海报
download
()
{
if
(
this
.
data
.
posterUrl
){
wx
.
saveImageToPhotosAlbum
({
filePath
:
this
.
data
.
posterUrl
,
//仅为示例,并非真实的资源
success
(
res
)
{
console
.
log
(
'res: '
,
res
);
}
})
}
this
.
modelClose
();
},
//模态框关闭
modelClose
()
{
this
.
setData
({
this
.
setData
({
isShow
:
true
,
isShow
:
false
});
},
// 图片加载事件
onloadFn
(
event
)
{
this
.
setData
({
imgHeight
:
(
event
.
detail
.
height
*
0.2
).
toFixed
(
0
),
});
});
},
},
onRouter
(
options
)
{
onRouter
(
options
)
{
...
@@ -53,6 +126,56 @@ Page({
...
@@ -53,6 +126,56 @@ Page({
*/
*/
onLoad
(
options
)
{
onLoad
(
options
)
{
// actNum,activeNavIdx
// actNum,activeNavIdx
let
{
actNum
,
imgHeightArr
}
=
this
.
data
;
//所有的长度
let
imgAllHeight
=
imgHeightArr
[
actNum
].
reduce
((
total
,
current
)
=>
{
return
total
+
current
;
});
// 缺少视频的长度(前4张)+二维码的长度 (单位rpx)
let
erCodeHeight
=
imgHeightArr
[
actNum
].
slice
(
0
,
4
).
reduce
((
total
,
current
)
=>
{
return
total
+
current
;
})
+
98
*
2
;
console
.
log
(
"imgAllHeight: "
,
imgAllHeight
);
let
W
=
750
/
4
let
H
=
imgAllHeight
/
4
let
drawFun
=
new
Draw
({
width
:
W
,
height
:
H
});
console
.
log
(
`
${
IMGURL
}
scene/longpic
${
actNum
+
1
}.
png
`)
let imgList = [
{
x: 0,
y: 0,
width: W,
height: H,
url: `
$
{
IMGURL
}
scene/longpic
${
actNum
+
1
}.
png
`,
},
{
// x: 245*2,
// y: erCodeHeight-11,
x:0,
y:0,
width: 120*2,
height: 120*2,
url: `
https
:
//img02.glsx.com.cn/weapp/resource/saas/business-assistant/index/discovery_prod1.png`, //二维码
},
];
drawFun
.
begin
({
imageList
:
imgList
,
}).
then
(
res
=>
{
console
.
log
(
'posterUrl.path'
,
res
)
this
.
setData
({
posterUrl
:
res
.
path
,
});
})
},
},
/**
/**
...
...
pages/checkProduct/checkProduct.json
View file @
0f35ea2
{
{
"usingComponents"
:
{
"usingComponents"
:
{
"product"
:
"../tab/discovery/components/product/product"
,
"product"
:
"../tab/discovery/components/product/product"
"shareModel"
:
"../tab/discovery/components/shareModel/shareModel"
},
},
"navigationBarTitleText"
:
"特色产品"
,
"navigationBarTitleText"
:
"特色产品"
,
"onReachBottomDistance"
:
10
,
"onReachBottomDistance"
:
10
,
...
...
pages/checkProduct/checkProduct.scss
View file @
0f35ea2
...
@@ -2,3 +2,74 @@
...
@@ -2,3 +2,74 @@
page
{
page
{
background-color
:
#fff
;
background-color
:
#fff
;
}
}
.share-wrap
{
position
:
fixed
;
top
:
0
;
left
:
0
;
bottom
:
0
;
right
:
0
;
background
:
rgba
(
0
,
0
,
0
,
0
.5
);
z-index
:
1
;
.img-wrap
{
position
:
absolute
;
top
:
20%
;
left
:
50%
;
transform
:
translateX
(
-50%
);
width
:
225px
;
height
:
311px
;
// background-color: red;
overflow
:
auto
;
.img
{
width
:
100%
;
// height: auto;
height
:
60%
;
background-color
:
#fff
;
}
}
.btns
{
position
:
absolute
;
left
:
0
;
bottom
:
0
;
width
:
100%
;
height
:
154px
;
background
:
#ffffff
;
border-radius
:
8px
8px
0
0
;
.top
{
display
:
flex
;
justify-content
:
space-around
;
.btn
{
padding-top
:
16px
;
}
.img
{
display
:
block
;
margin
:
0
auto
8px
;
width
:
40px
;
height
:
40px
;
}
.name
{
font-size
:
12px
;
color
:
#323436
;
text-align
:
center
;
line-height
:
32rpx
;
}
.btn-wechat
{
width
:
auto
;
margin
:
0
;
padding
:
0
;
background-color
:
#fff
;
&
:
:
after
{
border
:none
;
}
}
}
.btom
{
margin
:
18px
auto
0
;
width
:
343px
;
height
:
44px
;
line-height
:
44px
;
border
:
1px
solid
#eeeeee
;
border-radius
:
4px
;
text-align
:
center
;
}
}
}
\ No newline at end of file
\ No newline at end of file
pages/checkProduct/checkProduct.wxml
View file @
0f35ea2
...
@@ -6,4 +6,29 @@
...
@@ -6,4 +6,29 @@
<product actNum="{{actNum}}" senceData="{{senceData}}" isShare="{{true}}"/>
<product actNum="{{actNum}}" senceData="{{senceData}}" isShare="{{true}}"/>
<!-- 分享弹框 -->
<!-- 分享弹框 -->
<shareModel actNum="{{actNum}}" isShow="{{isShow}}" bindmodelclose="modelcloseFn" />
<view class="share-wrap" wx:if="{{isShow}}">
<view class="img-wrap">
<image class="img" style="height:{{imgHeight}}px" src="{{posterUrl}}" bindload="onloadFn" />
<!-- <block wx:for="{{imgList}}" wx:key="*this">
<image class="img" src="{{item}}"/>
</block> -->
</view>
<button></button>
<view class="btns">
<view class="top">
<view class="btn" wx:for="{{btnList}}" wx:key="name" bindtap="handleClick" data-index="{{index}}">
<block wx:if="{{index == 0}}">
<button open-type="share" class="btn-wechat">
<image class="img" src="{{item.src}}" />
<view class="name">{{item.name}}</view>
</button>
</block>
<block wx:else>
<image class="img" src="{{item.src}}" />
<view class="name">{{item.name}}</view>
</block>
</view>
</view>
<view class="btom" bindtap="modelClose">取消</view>
</view>
</view>
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