Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
dev
/
home-with-kids-mp
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
1e1f46d0
authored
2020-01-15 21:46:26 +0800
by
simon
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
默认提交
1 parent
5d8bbffc
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
66 additions
and
28 deletions
src/pages/blessing/blessing.js
src/pages/blessing/blessing.wxml
src/utils/util.js
src/pages/blessing/blessing.js
View file @
1e1f46d
import
{
getBindtapData
,
checkAuth
checkAuth
Utils
}
from
'../../utils/util'
;
import
Dialog
from
'../../ui/vant-weapp/dialog/dialog'
;
...
...
@@ -98,12 +98,29 @@ Page({
authorizeVisible
:
true
})
},
checkAuth
ShowComp
()
{
checkAuth
()
{
return
new
Promise
((
resolve
,
reject
)
=>
{
checkAuth
().
then
((
result
)
=>
{
let
{
detailData
}
=
this
.
data
;
checkAuthUtils
().
then
((
result
)
=>
{
console
.
log
(
"checkAuth result:"
,
result
);
console
.
log
(
"checkAuth detailData.isAuth:"
,
detailData
.
isAuth
);
let
isAuth
=
result
&&
detailData
.
isAuth
==
1
;
this
.
setData
({
isAuth
:
result
})
isAuth
});
console
.
log
(
"checkAuth isAuth:"
,
isAuth
);
resolve
(
isAuth
);
});
});
},
checkAuthShowComp
()
{
return
new
Promise
((
resolve
,
reject
)
=>
{
this
.
checkAuth
().
then
((
result
)
=>
{
// this.setData({
// isAuth: result
// })
if
(
result
)
{
resolve
(
true
);
}
else
{
...
...
@@ -129,11 +146,8 @@ Page({
options
,
lunarDate
});
checkAuth
().
then
((
result
)
=>
{
this
.
setData
({
isAuth
:
result
})
this
.
initData
();
// this.initData();
this
.
queryBlessDetail
().
then
((
result
)
=>
{
this
.
playBgm
();
let
{
...
...
@@ -142,6 +156,8 @@ Page({
memberList
}
=
this
.
data
;
this
.
checkAuth
();
// 判断memberList里面是否有自己
let
joined
=
false
;
memberList
.
forEach
(
element
=>
{
...
...
@@ -172,7 +188,7 @@ Page({
}
});
console
.
log
(
"memberCode:"
,
app
.
store
.
getItem
(
"memberCode"
));
}).
catch
((
err
)
=>
{});
},
...
...
@@ -181,11 +197,7 @@ Page({
* 授权完毕重拉数据用
*/
initData
()
{
checkAuth
().
then
((
result
)
=>
{
_this
.
setData
({
isAuth
:
result
});
}).
catch
((
err
)
=>
{});
this
.
checkAuth
().
then
((
result
)
=>
{});
},
playBgm
()
{
let
_this
=
this
;
...
...
@@ -367,12 +379,21 @@ Page({
*/
onPosterHandler
()
{
console
.
log
(
"onPosterHandler"
);
let
{
detailData
}
=
this
.
data
;
if
(
detailData
.
customMade
==
1
)
{
// 先获取小程序码
this
.
getWxCode
().
then
((
result
)
=>
{
let
posterData
=
this
.
getPosterConfig
();
this
.
onCreatePoster
(
posterData
);
});
}
else
{
wx
.
showModal
({
content
:
"请先定制祝福"
,
success
(
res
)
{}
})
}
},
onPosterSuccess
(
e
)
{
...
...
@@ -545,6 +566,10 @@ Page({
// 显示更新用户信息
showUpdateUserInfoDialog
()
{
let
{
detailData
}
=
this
.
data
;
if
(
detailData
.
customMade
==
1
)
{
this
.
checkAuthShowComp
().
then
((
result
)
=>
{
this
.
setData
({
updateUserInfoDialogVisible
:
true
,
...
...
@@ -552,6 +577,13 @@ Page({
files
:
[]
})
});
}
else
{
wx
.
showModal
({
content
:
"请先定制祝福"
,
success
(
res
)
{}
})
}
},
// 房主名字
...
...
@@ -565,12 +597,22 @@ Page({
// 显示更新用户信息
showUpdateRoomDialog
()
{
let
{
detailData
}
=
this
.
data
;
if
(
detailData
.
customMade
==
1
)
{
this
.
checkAuthShowComp
().
then
((
result
)
=>
{
this
.
setData
({
updateRoomDialogVisible
:
true
,
updateRoomInfo
:
{},
})
});
}
else
{
wx
.
showModal
({
content
:
"请先定制祝福"
,
success
(
res
)
{}
})
}
},
// 家庭名称
...
...
@@ -847,9 +889,6 @@ Page({
}).
catch
((
err
)
=>
{
});
},
// 点击确认授权按钮
...
...
@@ -892,12 +931,11 @@ Page({
content
:
'授权成功'
,
success
(
res
)
{}
})
checkAuth
().
then
((
result
)
=>
{
_this
.
setData
({
isAuth
:
result
});
this
.
queryBlessDetail
();
this
.
queryBlessDetail
().
then
((
result
)
=>
{
this
.
checkAuth
().
then
((
result
)
=>
{}).
catch
((
err
)
=>
{});
}).
catch
((
err
)
=>
{});
}).
catch
((
err
)
=>
{
wx
.
hideLoading
();
console
.
log
(
"授权成功 err:"
,
err
);
...
...
src/pages/blessing/blessing.wxml
View file @
1e1f46d
...
...
@@ -80,7 +80,7 @@
<view class="blessing">
<view wx:for="{{blessContent}}" wx:key="{{index}}" class="blessing-item">
<!-- 图片 -->
<image mode="widthFix" wx:if="{{item.type == 'image'}}" class="blessing-item-image" src="{{item.url}}" />
<image mode="widthFix" wx:if="{{item.type == 'image'
&& item.url
}}" class="blessing-item-image" src="{{item.url}}" />
<!-- 文本 -->
<text wx:if="{{item.type == 'text'}}" class="blessing-item-text" style="color: {{item.color ? item.color : '#333333'}};">
{{item.content}}
...
...
src/utils/util.js
View file @
1e1f46d
...
...
@@ -232,7 +232,7 @@ function throttle(func, wait, type) {
* 检查是否授权
* @param {*} name
*/
function
checkAuth
(
name
,
url
)
{
function
checkAuth
Utils
(
name
,
url
)
{
return
new
Promise
((
resolve
,
reject
)
=>
{
wx
.
getSetting
({
success
(
res
)
{
...
...
@@ -260,5 +260,5 @@ module.exports = {
wxacodeGet
:
wxacodeGet
,
getObjByListKeyValue
:
getObjByListKeyValue
,
getQueryByUrl
:
getQueryByUrl
,
checkAuth
:
checkAuth
checkAuth
Utils
:
checkAuthUtils
}
...
...
Please
register
or
sign in
to post a comment