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
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
117 additions
and
79 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,50 +146,49 @@ Page({
options
,
lunarDate
});
checkAuth
().
then
((
result
)
=>
{
this
.
setData
({
isAuth
:
result
})
this
.
initData
();
this
.
queryBlessDetail
().
then
((
result
)
=>
{
this
.
playBgm
();
let
{
detailData
,
ownerMember
,
memberList
}
=
this
.
data
;
// 判断memberList里面是否有自己
let
joined
=
false
;
memberList
.
forEach
(
element
=>
{
if
(
element
.
mySelf
==
1
)
{
joined
=
true
;
}
});
/**q
* 显示加入房间条件
* 1.已定制
* 2.类型为组队类型
* 3.非房主
* 4.shareType为join t="join"
* 5.未加入过 判断memberList里面是否有自己
*/
console
.
log
(
"---- 判断是否显示加入 Start ----"
);
console
.
log
(
"已定制:"
,
detailData
.
customMade
==
1
);
console
.
log
(
"类型为组队类型:"
,
detailData
.
type
==
1
);
console
.
log
(
"非房主:"
,
ownerMember
.
mySelf
==
0
);
console
.
log
(
"shareType为join:"
,
options
);
console
.
log
(
"是否加入过:"
,
joined
);
if
(
detailData
.
customMade
==
1
&&
detailData
.
type
==
1
&&
ownerMember
.
mySelf
==
0
&&
options
.
t
==
"join"
&&
!
joined
)
{
this
.
setData
({
joinRoomDialogVisible
:
true
,
isJoin
:
true
})
// this.initData();
this
.
queryBlessDetail
().
then
((
result
)
=>
{
this
.
playBgm
();
let
{
detailData
,
ownerMember
,
memberList
}
=
this
.
data
;
this
.
checkAuth
();
// 判断memberList里面是否有自己
let
joined
=
false
;
memberList
.
forEach
(
element
=>
{
if
(
element
.
mySelf
==
1
)
{
joined
=
true
;
}
});
console
.
log
(
"memberCode:"
,
app
.
store
.
getItem
(
"memberCode"
));
}).
catch
((
err
)
=>
{});
/**q
* 显示加入房间条件
* 1.已定制
* 2.类型为组队类型
* 3.非房主
* 4.shareType为join t="join"
* 5.未加入过 判断memberList里面是否有自己
*/
console
.
log
(
"---- 判断是否显示加入 Start ----"
);
console
.
log
(
"已定制:"
,
detailData
.
customMade
==
1
);
console
.
log
(
"类型为组队类型:"
,
detailData
.
type
==
1
);
console
.
log
(
"非房主:"
,
ownerMember
.
mySelf
==
0
);
console
.
log
(
"shareType为join:"
,
options
);
console
.
log
(
"是否加入过:"
,
joined
);
if
(
detailData
.
customMade
==
1
&&
detailData
.
type
==
1
&&
ownerMember
.
mySelf
==
0
&&
options
.
t
==
"join"
&&
!
joined
)
{
this
.
setData
({
joinRoomDialogVisible
:
true
,
isJoin
:
true
})
}
});
console
.
log
(
"memberCode:"
,
app
.
store
.
getItem
(
"memberCode"
));
},
...
...
@@ -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"
);
// 先获取小程序码
this
.
getWxCode
().
then
((
result
)
=>
{
let
posterData
=
this
.
getPosterConfig
();
this
.
onCreatePoster
(
posterData
);
});
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,13 +566,24 @@ Page({
// 显示更新用户信息
showUpdateUserInfoDialog
()
{
this
.
checkAuthShowComp
().
then
((
result
)
=>
{
this
.
setData
({
updateUserInfoDialogVisible
:
true
,
updateUserInfo
:
{},
files
:
[]
let
{
detailData
}
=
this
.
data
;
if
(
detailData
.
customMade
==
1
)
{
this
.
checkAuthShowComp
().
then
((
result
)
=>
{
this
.
setData
({
updateUserInfoDialogVisible
:
true
,
updateUserInfo
:
{},
files
:
[]
})
});
}
else
{
wx
.
showModal
({
content
:
"请先定制祝福"
,
success
(
res
)
{}
})
});
}
},
// 房主名字
...
...
@@ -565,12 +597,22 @@ Page({
// 显示更新用户信息
showUpdateRoomDialog
()
{
this
.
checkAuthShowComp
().
then
((
result
)
=>
{
this
.
setData
({
updateRoomDialogVisible
:
true
,
updateRoomInfo
:
{},
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