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 34b2ccbb
authored
Oct 26, 2022
by
前端
Browse Files
Options
Browse Files
Tag
Download
Plain Diff
Merge branch 'zq_dev_3.0' into 'v3.0'
更改授权过程 See merge request
!84
2 parents
e7aaa522
ff77c3c5
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
82 additions
and
30 deletions
app.json
components/Authorize/Authorize.js
pages/checkProduct/checkProduct.js
pages/checkProduct/checkProduct.wxml
pages/tab/discovery/components/product/product.js
pages/tab/discovery/components/product/product.wxml
pages/tab/discovery/discovery.js
app.json
View file @
34b2ccb
...
@@ -74,6 +74,7 @@
...
@@ -74,6 +74,7 @@
],
],
"usingComponents"
:
{
"usingComponents"
:
{
"navigation-bar"
:
"/components/NavigationBar/NavigationBar"
,
"navigation-bar"
:
"/components/NavigationBar/NavigationBar"
,
"authorize"
:
"/components/Authorize/Authorize"
,
"popup"
:
"/components/Popup/Popup"
,
"popup"
:
"/components/Popup/Popup"
,
"van-picker"
:
"@vant/weapp/picker/index"
,
"van-picker"
:
"@vant/weapp/picker/index"
,
"van-popup"
:
"@vant/weapp/popup/index"
,
"van-popup"
:
"@vant/weapp/popup/index"
,
...
...
components/Authorize/Authorize.js
View file @
34b2ccb
...
@@ -52,7 +52,7 @@ Component({
...
@@ -52,7 +52,7 @@ Component({
/**
/**
* 禁止滑动
* 禁止滑动
*/
*/
noScroll
:
wx
.
$util
.
noScroll
(),
//
noScroll: wx.$util.noScroll(),
cancel
(
e
)
{
cancel
(
e
)
{
let
{
confirm
}
=
e
.
currentTarget
.
dataset
let
{
confirm
}
=
e
.
currentTarget
.
dataset
let
{
buttonType
,
title
}
=
this
.
data
let
{
buttonType
,
title
}
=
this
.
data
...
...
pages/checkProduct/checkProduct.js
View file @
34b2ccb
...
@@ -19,7 +19,7 @@ Page({
...
@@ -19,7 +19,7 @@ Page({
fromLocal
:
0
,
fromLocal
:
0
,
// 模态框
// 模态框
isShow
:
true
,
isShow
:
true
,
showAuth
:
false
,
btnList
:
[
btnList
:
[
{
{
src
:
`
${
IMGURL
}
down.png`
,
src
:
`
${
IMGURL
}
down.png`
,
...
@@ -203,16 +203,33 @@ Page({
...
@@ -203,16 +203,33 @@ Page({
content
:
'确认下载海报?'
,
content
:
'确认下载海报?'
,
success
:
async
(
res
)
=>
{
success
:
async
(
res
)
=>
{
if
(
res
.
confirm
){
if
(
res
.
confirm
){
let
hasAuth
=
await
this
.
toSetting
()
wx
.
getSetting
({
if
(
hasAuth
){
success
:
(
res
)
=>
{
if
(
res
.
authSetting
[
'scope.writePhotosAlbum'
]){
this
.
createImg
()
this
.
createImg
()
}
else
{
this
.
setData
({
showAuth
:
true
})
}
}
}
}
})
}
},
},
fail
:
(
res
)
=>
{},
fail
:
(
res
)
=>
{},
complete
:
(
res
)
=>
{},
complete
:
(
res
)
=>
{},
})
})
},
},
authFail
(){
wx
.
showToast
({
title
:
"下载海报前需要您授权'添加到相册'权限"
,
icon
:
"none"
,
duration
:
2500
,
});
},
authSuccess
(){
this
.
createImg
()
},
toSetting
(){
toSetting
(){
return
new
Promise
((
resolve
,
reject
)
=>
{
return
new
Promise
((
resolve
,
reject
)
=>
{
wx
.
getSetting
({
wx
.
getSetting
({
...
...
pages/checkProduct/checkProduct.wxml
View file @
34b2ccb
<view style="padding-bottom: {{fromLocal==1? 150: 0}}rpx">
<product actNum="{{actNum}}" navIdx="{{activeNavIdx}}" senceData="{{senceData}}" isShare="{{true}}"/>
<product actNum="{{actNum}}" navIdx="{{activeNavIdx}}" senceData="{{senceData}}" isShare="{{true}}"/>
</view>
<!-- 分享弹框 -->
<!-- 分享弹框 -->
<!-- <view class="share-wrap" wx:if="{{isShow && fromLocal==1}}">
<!-- <view class="share-wrap" wx:if="{{isShow && fromLocal==1}}">
<view class="img-wrap" wx:if="{{posterUrl}}">
<view class="img-wrap" wx:if="{{posterUrl}}">
...
@@ -36,3 +39,7 @@
...
@@ -36,3 +39,7 @@
</view>
</view>
</view>
</view>
</view>
</view>
<block wx:if="{{showAuth}}">
<authorize scopeType="writePhotosAlbum" buttonType="openSetting" bindfail="authFail" bindsuccess="authSuccess" show="{{showAuth}}"></authorize>
</block>
pages/tab/discovery/components/product/product.js
View file @
34b2ccb
...
@@ -23,6 +23,7 @@ Component({
...
@@ -23,6 +23,7 @@ Component({
curTabIdx
:
0
,
//适用产品
curTabIdx
:
0
,
//适用产品
intoViewId
:
'to-0'
,
intoViewId
:
'to-0'
,
actNum
:
0
,
//场景
actNum
:
0
,
//场景
showAuth
:
false
},
},
lifetimes
:{
lifetimes
:{
ready
:
function
(){
ready
:
function
(){
...
@@ -124,26 +125,48 @@ Component({
...
@@ -124,26 +125,48 @@ Component({
curTabIdx
:
idx
curTabIdx
:
idx
})
})
},
},
async
downVideo
(
e
)
{
downVideo
(
e
)
{
let
hasAuth
=
await
this
.
toSetting
()
if
(
hasAuth
){
let
{
url
}
=
e
.
target
.
dataset
let
{
url
}
=
e
.
target
.
dataset
this
.
setData
({
curVideoUrl
:
url
})
wx
.
getSetting
({
success
:
(
res
)
=>
{
if
(
res
.
authSetting
[
'scope.writePhotosAlbum'
]){
this
.
toDown
()
}
else
{
this
.
setData
({
showAuth
:
true
})
}
}
})
},
toDown
(){
wx
.
$api
.
showToast
(
'正在下载视频...'
)
wx
.
$api
.
showToast
(
'正在下载视频...'
)
wx
.
downloadFile
({
wx
.
downloadFile
({
url
:
u
rl
,
url
:
this
.
data
.
curVideoU
rl
,
success
(
res
)
{
success
(
res
)
{
if
(
res
.
statusCode
===
200
)
{
if
(
res
.
statusCode
===
200
)
{
wx
.
saveVideoToPhotosAlbum
({
wx
.
saveVideoToPhotosAlbum
({
filePath
:
res
.
tempFilePath
,
filePath
:
res
.
tempFilePath
,
success
(
res
)
{
success
(
resp
)
{
wx
.
$api
.
showToast
(
'下载成功!'
)
wx
.
$api
.
showToast
(
'下载成功!'
)
}
}
})
})
}
}
}
}
})
})
}
},
authFail
(){
wx
.
showToast
({
title
:
"下载视频前需要您授权'添加到相册'权限"
,
icon
:
"none"
,
duration
:
2500
,
});
},
authSuccess
(){
this
.
toDown
()
},
},
toSetting
(){
toSetting
(){
return
new
Promise
((
resolve
,
reject
)
=>
{
return
new
Promise
((
resolve
,
reject
)
=>
{
...
...
pages/tab/discovery/components/product/product.wxml
View file @
34b2ccb
...
@@ -50,3 +50,6 @@
...
@@ -50,3 +50,6 @@
</block>
</block>
</scroll-view>
</scroll-view>
</view>
</view>
<block wx:if="{{showAuth}}">
<authorize scopeType="writePhotosAlbum" buttonType="openSetting" bindfail="authFail" bindsuccess="authSuccess" show="{{showAuth}}"></authorize>
</block>
pages/tab/discovery/discovery.js
View file @
34b2ccb
...
@@ -27,7 +27,8 @@ Page({
...
@@ -27,7 +27,8 @@ Page({
changeSale
:
0
,
changeSale
:
0
,
sceneCodeList
:[],
sceneCodeList
:[],
currentId
:
0
,
currentId
:
0
,
showPage
:
false
showPage
:
false
,
showAuth
:
false
},
},
/**
/**
* 生命周期函数--监听页面加载
* 生命周期函数--监听页面加载
...
@@ -44,24 +45,24 @@ Page({
...
@@ -44,24 +45,24 @@ Page({
if
(
res
?.
length
>
0
){
if
(
res
?.
length
>
0
){
let
sceneCodeList
=
[]
let
sceneCodeList
=
[]
let
senceData
=
[...
this
.
data
.
senceData
]
let
senceData
=
[...
this
.
data
.
senceData
]
//
let res = [
let
res
=
[
//
{
{
//
sceneCode: 'SC001',
sceneCode
:
'SC001'
,
//
status: 1
status
:
1
//
},
},
//
{
{
//
sceneCode: 'SC002',
sceneCode
:
'SC002'
,
//
status: 1
status
:
1
//
},
},
//
{
{
//
sceneCode: 'SC003',
sceneCode
:
'SC003'
,
//
status: 1
status
:
1
//
},
},
//
{
{
//
sceneCode: 'SC004',
sceneCode
:
'SC004'
,
//
status: 1
status
:
1
//
}
}
//
]
]
res
.
forEach
((
item
,
index
)
=>
{
res
.
forEach
((
item
,
index
)
=>
{
if
(
item
.
status
==
1
)
{
if
(
item
.
status
==
1
)
{
let
sceneTarget
=
senceData
.
find
(
sitem
=>
sitem
.
sceneCode
==
item
.
sceneCode
)
let
sceneTarget
=
senceData
.
find
(
sitem
=>
sitem
.
sceneCode
==
item
.
sceneCode
)
...
...
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