|
@@ -22,14 +22,33 @@ Page({
|
|
canIUse: wx.canIUse('button.open-type.getUserInfo'),
|
|
canIUse: wx.canIUse('button.open-type.getUserInfo'),
|
|
showLogin: false,
|
|
showLogin: false,
|
|
deda: 0,
|
|
deda: 0,
|
|
- loadText: "登录中...."
|
|
|
|
|
|
+ loadText: "登录中....",
|
|
|
|
+ showPrivacy:false
|
|
},
|
|
},
|
|
|
|
|
|
/**
|
|
/**
|
|
* 生命周期函数--监听页面加载
|
|
* 生命周期函数--监听页面加载
|
|
*/
|
|
*/
|
|
onLoad(options) {
|
|
onLoad(options) {
|
|
-
|
|
|
|
|
|
+ wx.getPrivacySetting({
|
|
|
|
+ success: res => {
|
|
|
|
+ console.log(res) // 返回结果为: res = { needAuthorization: true/false, privacyContractName: '《xxx隐私保护指引》' }
|
|
|
|
+ if (res.needAuthorization) {
|
|
|
|
+ // 需要弹出隐私协议
|
|
|
|
+ this.setData({
|
|
|
|
+ showPrivacy: true
|
|
|
|
+ })
|
|
|
|
+ } else {
|
|
|
|
+ // 用户已经同意过隐私协议,所以不需要再弹出隐私协议,也能调用已声明过的隐私接口
|
|
|
|
+ // wx.getUserProfile()
|
|
|
|
+ // wx.chooseMedia()
|
|
|
|
+ // wx.getClipboardData()
|
|
|
|
+ // wx.startRecord()
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ fail: () => {},
|
|
|
|
+ complete: () => {}
|
|
|
|
+ })
|
|
},
|
|
},
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -77,19 +96,30 @@ Page({
|
|
})
|
|
})
|
|
}
|
|
}
|
|
},
|
|
},
|
|
-
|
|
|
|
|
|
+ handleAgreePrivacyAuthorization() {
|
|
|
|
+ // 用户同意隐私协议事件回调
|
|
|
|
+ // 用户点击了同意,之后所有已声明过的隐私接口和组件都可以调用了
|
|
|
|
+ this.setData({
|
|
|
|
+ showPrivacy: false
|
|
|
|
+ })
|
|
|
|
+ },
|
|
|
|
+ handleOpenPrivacyContract() {
|
|
|
|
+ // 打开隐私协议页面
|
|
|
|
+ wx.openPrivacyContract({
|
|
|
|
+ success: () => {}, // 打开成功
|
|
|
|
+ fail: () => {}, // 打开失败
|
|
|
|
+ complete: () => {}
|
|
|
|
+ })
|
|
|
|
+ },
|
|
getPhoneNumber(e) {
|
|
getPhoneNumber(e) {
|
|
var that = this
|
|
var that = this
|
|
- console.log(this.data.agree);
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- var phoneCode = e.detail.code
|
|
|
|
|
|
+
|
|
wx.login({
|
|
wx.login({
|
|
success(res) {
|
|
success(res) {
|
|
if (res.code) {
|
|
if (res.code) {
|
|
let data = {
|
|
let data = {
|
|
code: res.code,
|
|
code: res.code,
|
|
- phoneCode: phoneCode
|
|
|
|
|
|
+ phoneCode: "1"
|
|
};
|
|
};
|
|
let int = setInterval(function () {
|
|
let int = setInterval(function () {
|
|
that.setData({
|
|
that.setData({
|
|
@@ -123,7 +153,7 @@ Page({
|
|
// wx.setStorageSync("token", res.data.token)
|
|
// wx.setStorageSync("token", res.data.token)
|
|
wx.setStorageSync('imgUrl', res.data.imgUrl)
|
|
wx.setStorageSync('imgUrl', res.data.imgUrl)
|
|
wx.setStorageSync('nickName', res.data.nickName)
|
|
wx.setStorageSync('nickName', res.data.nickName)
|
|
- wx.setStorageSync('hlToken', res.data.hlToken)
|
|
|
|
|
|
+ // wx.setStorageSync('hlToken', res.data.hlToken)
|
|
wx.setStorageSync('userid', res.data.userId)
|
|
wx.setStorageSync('userid', res.data.userId)
|
|
// 返回上一页携带登录标志
|
|
// 返回上一页携带登录标志
|
|
let pages = getCurrentPages();
|
|
let pages = getCurrentPages();
|
|
@@ -157,14 +187,85 @@ Page({
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- },
|
|
|
|
|
|
+ },
|
|
|
|
+ // getPhoneNumber(e) {
|
|
|
|
+ // var that = this
|
|
|
|
+ // console.log(this.data.agree);
|
|
|
|
+ // var phoneCode = e.detail.code
|
|
|
|
+ // wx.login({
|
|
|
|
+ // success(res) {
|
|
|
|
+ // if (res.code) {
|
|
|
|
+ // let data = {
|
|
|
|
+ // code: res.code,
|
|
|
|
+ // // phoneCode: phoneCode
|
|
|
|
+ // };
|
|
|
|
+ // let int = setInterval(function () {
|
|
|
|
+ // that.setData({
|
|
|
|
+ // deda: that.data.deda + 1
|
|
|
|
+ // })
|
|
|
|
+ // switch (that.data.deda) {
|
|
|
|
+ // case 1:
|
|
|
|
+ // that.setData({
|
|
|
|
+ // loadText: "掌新南岸用户数据更新同步中...."
|
|
|
|
+ // })
|
|
|
|
+ // break
|
|
|
|
+ // case 7:
|
|
|
|
+ // that.setData({
|
|
|
|
+ // loadText: "初始化静态资源中...."
|
|
|
|
+ // })
|
|
|
|
+ // break
|
|
|
|
+ // }
|
|
|
|
+ // }, 1000)
|
|
|
|
+ // that.setData({
|
|
|
|
+ // showLogin: true
|
|
|
|
+ // })
|
|
|
|
+ // login(data).then(res => {
|
|
|
|
+ // that.setData({
|
|
|
|
+ // showLogin: false,
|
|
|
|
+ // deda: 0,
|
|
|
|
+ // loadText: "登录中..."
|
|
|
|
+ // })
|
|
|
|
+ // clearInterval(int)
|
|
|
|
+ // if (res.result) {
|
|
|
|
+ // cacheSet('token', res.data.token, 3600 * 24)
|
|
|
|
+ // // wx.setStorageSync("token", res.data.token)
|
|
|
|
+ // wx.setStorageSync('imgUrl', res.data.imgUrl)
|
|
|
|
+ // wx.setStorageSync('nickName', res.data.nickName)
|
|
|
|
+ // wx.setStorageSync('hlToken', res.data.hlToken)
|
|
|
|
+ // wx.setStorageSync('userid', res.data.userId)
|
|
|
|
+ // // 返回上一页携带登录标志
|
|
|
|
+ // let pages = getCurrentPages();
|
|
|
|
+ // let prevPage = pages[pages.length - 2];
|
|
|
|
+ // prevPage.setData({
|
|
|
|
+ // loginReturnFlag: true
|
|
|
|
+ // })
|
|
|
|
+ // wx.navigateBack({
|
|
|
|
+ // delta: 1
|
|
|
|
+ // });
|
|
|
|
+ // } else {
|
|
|
|
+ // that.setData({
|
|
|
|
+ // showLogin: false
|
|
|
|
+ // })
|
|
|
|
+ // wx.showModal({
|
|
|
|
+ // title: '登录失败',
|
|
|
|
+ // content: '登录失败,请重试',
|
|
|
|
+ // complete: (res) => { }
|
|
|
|
+ // })
|
|
|
|
+ // }
|
|
|
|
+ // })
|
|
|
|
+ // } else {
|
|
|
|
+ // console.log('登录失败!' + res.errMsg)
|
|
|
|
+ // }
|
|
|
|
+ // }
|
|
|
|
+ // })
|
|
|
|
+ // },
|
|
|
|
|
|
protocolTips() {
|
|
protocolTips() {
|
|
wx.showModal({
|
|
wx.showModal({
|
|
title: '温馨提示',
|
|
title: '温馨提示',
|
|
- content: '请仔细阅读并同意勾选用户服务协议!',
|
|
|
|
- confirmText: '确定',
|
|
|
|
- cancelText:"取消",
|
|
|
|
|
|
+ content: '请仔细阅读并勾选用户服务协议!',
|
|
|
|
+ confirmText: '同意',
|
|
|
|
+ cancelText:"不同意",
|
|
success: function (res) {
|
|
success: function (res) {
|
|
},
|
|
},
|
|
});
|
|
});
|