Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
jinli gu
Litemall
Commits
0e165c8f
Commit
0e165c8f
authored
Feb 19, 2019
by
hanchao
Committed by
linlinjava
Feb 19, 2019
Browse files
update:修改在分享到朋友圈的时候,第一次弹出是否授权保存权限,如果点否,则后续无法再次弹出授权弹窗,并无法保存图片
parent
a6162f6a
Changes
2
Hide whitespace changes
Inline
Side-by-side
litemall-wx/pages/goods/goods.js
View file @
0e165c8f
...
@@ -30,7 +30,8 @@ Page({
...
@@ -30,7 +30,8 @@ Page({
collectImage
:
'
/static/images/icon_collect.png
'
,
collectImage
:
'
/static/images/icon_collect.png
'
,
shareImage
:
''
,
shareImage
:
''
,
isGroupon
:
false
,
//标识是否是一个参团购买
isGroupon
:
false
,
//标识是否是一个参团购买
soldout
:
false
soldout
:
false
,
canWrite
:
false
,
//用户是否获取了保存相册的权限
},
},
// 页面分享
// 页面分享
...
@@ -53,7 +54,27 @@ Page({
...
@@ -53,7 +54,27 @@ Page({
return
false
;
return
false
;
}
}
},
},
handleSetting
:
function
(
e
)
{
var
that
=
this
;
// console.log(e)
if
(
!
e
.
detail
.
authSetting
[
'
scope.writePhotosAlbum
'
])
{
wx
.
showModal
({
title
:
'
警告
'
,
content
:
'
不授权无法保存
'
,
showCancel
:
false
})
that
.
setData
({
canWrite
:
false
})
}
else
{
wx
.
showToast
({
title
:
'
保存成功
'
})
that
.
setData
({
canWrite
:
true
})
}
},
// 保存分享图
// 保存分享图
saveShare
:
function
()
{
saveShare
:
function
()
{
let
that
=
this
;
let
that
=
this
;
...
@@ -399,6 +420,32 @@ Page({
...
@@ -399,6 +420,32 @@ Page({
});
});
this
.
getGrouponInfo
(
options
.
grouponId
);
this
.
getGrouponInfo
(
options
.
grouponId
);
}
}
let
that
=
this
;
wx
.
getSetting
({
success
:
function
(
res
)
{
console
.
log
(
res
)
//不存在相册授权
if
(
!
res
.
authSetting
[
'
scope.writePhotosAlbum
'
])
{
wx
.
authorize
({
scope
:
'
scope.writePhotosAlbum
'
,
success
:
function
()
{
that
.
setData
({
canWrite
:
true
})
},
fail
:
function
(
err
)
{
that
.
setData
({
canWrite
:
false
})
}
})
}
else
{
that
.
setData
({
canWrite
:
true
});
}
}
})
},
},
onShow
:
function
()
{
onShow
:
function
()
{
// 页面显示
// 页面显示
...
...
litemall-wx/pages/goods/goods.wxml
View file @
0e165c8f
...
@@ -19,7 +19,11 @@
...
@@ -19,7 +19,11 @@
<image class='sharebtn_image' src='/static/images/wechat.png'></image>
<image class='sharebtn_image' src='/static/images/wechat.png'></image>
<view class='sharebtn_text'>分享给好友</view>
<view class='sharebtn_text'>分享给好友</view>
</button>
</button>
<button class="savesharebtn" bindtap="saveShare" wx:if="{{!isGroupon}}">
<button class="savesharebtn" open-type="openSetting" bindopensetting="handleSetting" wx:if="{{(!isGroupon) && (!canWrite)}}" >
<image class='sharebtn_image' src='/static/images/friend.png'></image>
<view class='sharebtn_text'>发朋友圈</view>
</button>
<button class="savesharebtn" bindtap="saveShare" wx:if="{{!isGroupon && canWrite}}">
<image class='sharebtn_image' src='/static/images/friend.png'></image>
<image class='sharebtn_image' src='/static/images/friend.png'></image>
<view class='sharebtn_text'>发朋友圈</view>
<view class='sharebtn_text'>发朋友圈</view>
</button>
</button>
...
...
Write
Preview
Supports
Markdown
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