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,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);
......
......@@ -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
}
......