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
29f0f304
Commit
29f0f304
authored
Feb 19, 2019
by
hanchao
Committed by
linlinjava
Feb 19, 2019
Browse files
update:对renard项目修改获取权限
parent
0e165c8f
Changes
2
Hide whitespace changes
Inline
Side-by-side
renard-wx/pages/goods/goods.js
View file @
29f0f304
...
...
@@ -30,7 +30,8 @@ Page({
collectImage
:
'
/static/images/icon_collect.png
'
,
shareImage
:
''
,
isGroupon
:
false
,
//标识是否是一个参团购买
soldout
:
false
soldout
:
false
,
canWrite
:
false
},
// 页面分享
...
...
@@ -42,7 +43,27 @@ Page({
path
:
'
/pages/index/index?goodId=
'
+
this
.
data
.
id
}
},
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
})
}
},
showShare
:
function
()
{
this
.
sharePop
.
togglePopup
();
},
...
...
@@ -375,6 +396,33 @@ Page({
});
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
()
{
...
...
renard-wx/pages/goods/goods.wxml
View file @
29f0f304
...
...
@@ -134,7 +134,10 @@
<!-- 底部按钮 -->
<view class="bottom-btn">
<view class="l l-collect" bindtap="showShare" wx:if="{{!isGroupon}}">
<view class="l l-collect"open-type="openSetting" bindopensetting="handleSetting" wx:if="{{(!isGroupon) && (!canWrite) }}">
<image class="icon" src="../../images/goods-share.png" />
</view>
<view class="l l-collect" bindtap="showShare" wx:if="{{!isGroupon && canWrite}}">
<image class="icon" src="../../images/goods-share.png" />
</view>
<view class="l l-cart" wx:if="{{!isGroupon}}">
...
...
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