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 e1dec8d0
authored
Oct 28, 2022
by
杨北旺
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
优化授权
1 parent
20ea01e7
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
47 additions
and
47 deletions
components/sharePopup/sharePopup.js
pages/tab/index/components/activeBox/activeBox.js
pages/tab/index/index.js
pages/tab/index/index.wxml
components/sharePopup/sharePopup.js
View file @
e1dec8d
...
...
@@ -170,8 +170,11 @@ Component({
wx
.
$api
.
showToast
(
'保存成功'
)
},
fail
(
err
)
{
const
auth
=
_this
.
selectComponent
(
'#auth'
)
auth
.
check
()
if
(
err
.
errMsg
==
'saveImageToPhotosAlbum:fail auth deny'
){
_this
.
triggerEvent
(
'showAuth'
,
true
)
}
// const auth = _this.selectComponent('#auth')
// auth.check()
}
}
)
...
...
pages/tab/index/components/activeBox/activeBox.js
View file @
e1dec8d
...
...
@@ -140,49 +140,41 @@ Component({
// 分享活动(复制链接)
copyActivityUrl
(
e
)
{
wx
.
getSetting
({
success
:
(
res
)
=>
{
if
(
res
.
authSetting
[
'scope.writePhotosAlbum'
]
===
false
){
this
.
triggerEvent
(
'showAuth'
,
true
)
}
else
{
let
{
item
}
=
e
.
currentTarget
.
dataset
let
thisPage
=
wx
.
$router
.
getPageInstance
()
wx
.
$api
.
showLoading
()
ActivityApi
.
getActivityPosters
({
id
:
item
.
id
}).
then
(
res
=>
{
// var code= QR.createQrCodeImg(res.activityUrl);
// /*code是指图片base64格式数据*/
// //声明文件系统
// const fs = wx.getFileSystemManager();
// //随机定义路径名称
// var times = new Date().getTime();
// var codeimg = wx.env.USER_DATA_PATH + '/' + times + '.png';
// //将base64图片写入
// fs.writeFile({
// filePath: codeimg,
// data: code.slice(22),
// encoding: 'base64',
// success: () => {
// thisPage.setData({
// sharePopupData: {
// imagePath: codeimg,
// activityName: res.activityName,
// address: res.activityAddressDetailName,
// posterImg: res.posterImg,
// showSharePopup: true
// },
// })
// }
// });
thisPage
.
setData
({
sharePopupData
:
{
posterImg
:
res
,
activityName
:
item
.
activityName
,
showSharePopup
:
true
},
})
})
}
}
let
{
item
}
=
e
.
currentTarget
.
dataset
let
thisPage
=
wx
.
$router
.
getPageInstance
()
wx
.
$api
.
showLoading
()
ActivityApi
.
getActivityPosters
({
id
:
item
.
id
}).
then
(
res
=>
{
// var code= QR.createQrCodeImg(res.activityUrl);
// /*code是指图片base64格式数据*/
// //声明文件系统
// const fs = wx.getFileSystemManager();
// //随机定义路径名称
// var times = new Date().getTime();
// var codeimg = wx.env.USER_DATA_PATH + '/' + times + '.png';
// //将base64图片写入
// fs.writeFile({
// filePath: codeimg,
// data: code.slice(22),
// encoding: 'base64',
// success: () => {
// thisPage.setData({
// sharePopupData: {
// imagePath: codeimg,
// activityName: res.activityName,
// address: res.activityAddressDetailName,
// posterImg: res.posterImg,
// showSharePopup: true
// },
// })
// }
// });
thisPage
.
setData
({
sharePopupData
:
{
posterImg
:
res
,
activityName
:
item
.
activityName
,
showSharePopup
:
true
},
})
})
...
...
pages/tab/index/index.js
View file @
e1dec8d
...
...
@@ -217,6 +217,9 @@ Page({
*/
onShareAppMessage
:
function
()
{
},
authFail
(){
},
toShowAuth
(){
this
.
setData
({
showAuth
:
true
...
...
pages/tab/index/index.wxml
View file @
e1dec8d
...
...
@@ -39,11 +39,13 @@
<!-- 预约安装弹窗 -->
<install-popup show="{{showPopup}}" data="{{installItem}}" bind:hidePopup="hidePopup"></install-popup>
<!-- 分享活动弹窗 -->
<share-popup data="{{sharePopupData}}"></share-popup>
<share-popup
bind:showAuth="toShowAuth"
data="{{sharePopupData}}"></share-popup>
<!-- <van-popup show="{{ showSharePopup }}" round bind:close="onClose">
<image style="width: 352rpx; height: 352rpx;" src="{{imagePath}}"></image>
</van-popup> -->
</view>
</block>
<authorize scopeType="writePhotosAlbum" bindfail="authFail" show="{{showAuth}}" id="auth"></authorize>
<block wx:if="{{showAuth}}">
<authorize title="下载前需要获取您的‘添加到相册’权限,是否打开授权设置?" scopeType="writePhotosAlbum" buttonType="openSetting" bindfail="authFail" show="{{showAuth}}" id="auth"></authorize>
</block>
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