|
@@ -3,6 +3,8 @@ const util = require('../../utils/util.js')
|
|
|
|
|
|
|
|
Page({
|
|
Page({
|
|
|
data: {
|
|
data: {
|
|
|
|
|
+ showAuthorizedDialog: false,
|
|
|
|
|
+ hasAuth: false,
|
|
|
activeIcon: "/subpages/icons/ic_selected_radio.svg",
|
|
activeIcon: "/subpages/icons/ic_selected_radio.svg",
|
|
|
normalIcon: "/subpages/icons/ic_radio.svg",
|
|
normalIcon: "/subpages/icons/ic_radio.svg",
|
|
|
logs: [],
|
|
logs: [],
|
|
@@ -26,6 +28,10 @@ Page({
|
|
|
},
|
|
},
|
|
|
//扫码
|
|
//扫码
|
|
|
tapScan() {
|
|
tapScan() {
|
|
|
|
|
+ if (!this.data.hasAuth) {
|
|
|
|
|
+ this.showDialog();
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
if (!this.data.checkedPrivacy) {
|
|
if (!this.data.checkedPrivacy) {
|
|
|
wx.showToast({
|
|
wx.showToast({
|
|
|
title: '请先阅读并同意《舒眠大健康用户服务协议》和《舒眠大健康隐私保护政策》',
|
|
title: '请先阅读并同意《舒眠大健康用户服务协议》和《舒眠大健康隐私保护政策》',
|
|
@@ -48,12 +54,43 @@ Page({
|
|
|
},
|
|
},
|
|
|
onLoad() {
|
|
onLoad() {
|
|
|
console.log("scan页面");
|
|
console.log("scan页面");
|
|
|
- }, onShow() {
|
|
|
|
|
|
|
+ },
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 生命周期函数--监听页面显示
|
|
|
|
|
+ */
|
|
|
|
|
+ onShow() {
|
|
|
const app = getApp();
|
|
const app = getApp();
|
|
|
app.globalData.selectedTabIndex = 4;
|
|
app.globalData.selectedTabIndex = 4;
|
|
|
this.getTabBar().setData({
|
|
this.getTabBar().setData({
|
|
|
selected: 4
|
|
selected: 4
|
|
|
})
|
|
})
|
|
|
|
|
+
|
|
|
|
|
+ this.checkAuth()
|
|
|
|
|
+ },
|
|
|
|
|
+ showDialog() {
|
|
|
|
|
+ this.setData({
|
|
|
|
|
+ showAuthorizedDialog: true
|
|
|
|
|
+ })
|
|
|
|
|
+ },
|
|
|
|
|
+ checkAuth() {
|
|
|
|
|
+ var hasAuth = wx.getStorageSync("hasAuth");
|
|
|
|
|
+ this.setData({
|
|
|
|
|
+ hasAuth: hasAuth
|
|
|
|
|
+ })
|
|
|
|
|
+ // if (hasAuth) {
|
|
|
|
|
+ // var userInfo = wx.getStorageSync("userInfo");
|
|
|
|
|
+ // this.setData({
|
|
|
|
|
+ // userName: userInfo.userName || "用户登录",
|
|
|
|
|
+ // avatarUrl: userInfo.avatarUrl || defaultAvatarUrl,
|
|
|
|
|
+ // phoneNumber: userInfo.phoneNumber || ""
|
|
|
|
|
+ // })
|
|
|
|
|
+ // }
|
|
|
|
|
+ return hasAuth;
|
|
|
|
|
+ },
|
|
|
|
|
+ authorizationSuccessful() {
|
|
|
|
|
+ console.log("授权成功");
|
|
|
|
|
+ this.setData({ showAuthorizedDialog: false })
|
|
|
|
|
+ this.checkAuth();
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
login: function () {
|
|
login: function () {
|