1e1f46d0 by simon

默认提交

1 parent 5d8bbffc
import {
getBindtapData,
checkAuth
checkAuthUtils
} from '../../utils/util';
import Dialog from '../../ui/vant-weapp/dialog/dialog';
......@@ -98,12 +98,29 @@ Page({
authorizeVisible: true
})
},
checkAuthShowComp() {
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);
......
......@@ -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}}
......
......@@ -232,7 +232,7 @@ function throttle(func, wait, type) {
* 检查是否授权
* @param {*} name
*/
function checkAuth(name, url) {
function checkAuthUtils(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
checkAuthUtils: checkAuthUtils
}
......